Package csep.example.cake.parser

Source Code of csep.example.cake.parser.CustomLexer

package csep.example.cake.parser;

import org.antlr.runtime.CharStream;
import org.antlr.runtime.Token;

import csep.example.cake.parser.antlr.internal.InternalCakefileLexer;
import csep.parser.Lexer;

public class CustomLexer extends Lexer {
 
  public CustomLexer(CharStream in) {
    super(in);
  }

  @Override
  public Token nextToken() {
    Token token = super.nextToken();
    token.setType(TokenTypeMapper.coffeeToCakefile(token.getType()));
    if (token.getType() == InternalCakefileLexer.RULE_IDENTIFIER) {
      if ("task".equals(token.getText())) {
        token.setType(InternalCakefileLexer.RULE_TASK);
      }
    }
    return token;
  }
}
TOP

Related Classes of csep.example.cake.parser.CustomLexer

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.