Examples of PatternToken


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

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

        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

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

    }


    @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

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


    @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
Copyright © 2018 www.massapi.com. 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.