Package com.googlecode.aviator.lexer.token

Examples of com.googlecode.aviator.lexer.token.PatternToken


            break;
        }
        if (this.inPattern) {
            reportSyntaxError();
        }
        codeGenerator.onConstant(new PatternToken(sb.toString(), startIndex));
        move(true);
    }
View Full Code Here


        case String:
            final String str = (String) operand.getValue(null);
            token = new StringToken(str, -1);
            break;
        case Pattern:
            token = new PatternToken(((AviatorPattern) operand).getPattern().pattern(), -1);
            break;
        }
        return token;
    }
View Full Code Here

    }


    @Test
    public void testOnConstant_Pattern() throws Exception {
        this.codeGenerator.onConstant(new PatternToken("[a-z_A-Z]+", 0));
        Expression exp = this.codeGenerator.getResult();
        Object result = exp.execute();
        assertEquals("/[a-z_A-Z]+/", result);
    }
View Full Code Here


    @Test
    public void testOnMatch() throws Exception {
        codeGenerator.onConstant(new StringToken("killme2008@gmail.com", 0));
        codeGenerator.onConstant(new PatternToken("^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[a-z]{2,4}$", 1));
        codeGenerator.onMatch(null);
        Object result = eval(new HashMap<String, Object>());
        assertEquals(Boolean.TRUE, result);
    }
View Full Code Here

TOP

Related Classes of com.googlecode.aviator.lexer.token.PatternToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.