Package com.intellij.lexer

Examples of com.intellij.lexer.FlexAdapter


*
* @author Alexey Efimov
*/
public class BatchHighlighterLexer extends LayeredLexer {
    public BatchHighlighterLexer() {
        super(new FlexAdapter(new _BatchLexer((java.io.Reader) null)));

        _ExpressionLexer stringLexer = new _ExpressionLexer((java.io.Reader) null);
        stringLexer.setDefaultToken(BatchTokenTypes.STRING_LITERAL);
        registerLayer(
                new FlexAdapter(stringLexer),
                BatchTokenTypes.STRING_LITERAL);
        _ExpressionLexer extressionLexer = new _ExpressionLexer((java.io.Reader) null);
        extressionLexer.setDefaultToken(BatchTokenTypes.EXPRESSION);
        registerLayer(
                new FlexAdapter(extressionLexer),
                BatchTokenTypes.EXPRESSION);
        _ExpressionLexer labelLexer = new _ExpressionLexer((java.io.Reader) null);
        labelLexer.setDefaultToken(BatchTokenTypes.LABEL_REFERENCE);
        registerLayer(
                new FlexAdapter(labelLexer),
                BatchTokenTypes.LABEL_REFERENCE);
    }
View Full Code Here


   * @return the lexer tokens
   * @throws IOException when the example cannot be read
   */
  private static Collection<CoffeeScriptLexerTestToken> getExpectedTokens(String example) throws IOException {

    final FlexAdapter lexer = new CoffeeScriptFlexLexer();
    lexer.start(readFile(example, FileType.COFFEE));

    ArrayList<CoffeeScriptLexerTestToken> tokens = new ArrayList<CoffeeScriptLexerTestToken>();
    while (lexer.getCurrentPosition().getOffset() < lexer.getBufferEnd()) {
      CoffeeScriptLexerTestToken token = new CoffeeScriptLexerTestToken(lexer.getTokenType(), lexer.getTokenSequence());
      tokens.add(token);
      lexer.advance();
    }

    return tokens;
  }
View Full Code Here

public class ErlangLexer extends LookAheadLexer {
  public static final TokenSet KEYWORDS = TokenSet.create(
    ERL_AFTER, ERL_WHEN, ERL_BEGIN, ERL_END, ERL_OF, ERL_CASE, ERL_FUN, ERL_CATCH, ERL_IF, ERL_RECEIVE, ERL_TRY);

  public ErlangLexer() {
    super(new MergingLexerAdapter(new FlexAdapter(new _ErlangLexer()), COMMENTS));
  }
View Full Code Here

  public static final IFileElementType FILE = new IFileElementType(Language.findInstance(RustLanguage.class));

  @NotNull
  @Override
  public Lexer createLexer(Project project) {
    return new FlexAdapter(new RustLexer((Reader) null));
  }
View Full Code Here

  public static final TextAttributesKey[] EMPTY_KEYS = new TextAttributesKey[0];

  @NotNull
  @Override
  public Lexer getHighlightingLexer() {
    return new FlexAdapter(new RustLexer((Reader) null));
  }
View Full Code Here

TOP

Related Classes of com.intellij.lexer.FlexAdapter

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.