Package lexer

Examples of lexer.Token


    final Type<Integer> integer = new Type<>("Integer");
    final Type<Double> decimal = new Type<>("Decimal");
    lexer.addRule("Integer", new Rule<Integer>("[0-9]+", integer, new Action<Integer>() {
      @Override
      public Token action(Matcher matcher, Lexer lexer, Type<Integer> type) {
        return new Token(new Integer(matcher.group()), type);
      }
    }));
    lexer.addRule("Decimal", new Rule<Double>("([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)", decimal, new Action<Double>() {
      @Override
      public Token action(Matcher matcher, Lexer lexer, Type<Double> type) {
        return new Token(new Double(matcher.group()), type);
      }
    }));
    lexer.addDescender("Parentheses", new Descender("(", ")", new Type<Token>("Parentheses"), null));
    lexer.addDescender("Brackets", new Descender("[", "]", new Type<Token>("Brackets"), null));
    lexer.ignore("\n");
View Full Code Here

TOP

Related Classes of lexer.Token

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.