com.intellij.lexer.FlexAdapter Java Examples

The following examples show how to use com.intellij.lexer.FlexAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MakefileFindUsagesProvider.java    From CppTools with Apache License 2.0 5 votes vote down vote up
public WordsScanner getWordsScanner() {
  return new DefaultWordsScanner(
    new FlexAdapter(new _MakefileLexer(true)),
    TokenSet.create(MakefileTokenTypes.IDENTIFIER, MakefileTokenTypes.TARGET_IDENTIFIER,
      MakefileTokenTypes.VAR_DEFINITION, MakefileTokenTypes.VAR_REFERENCE),
    MakefileTokenTypes.COMMENTS,
    MakefileTokenTypes.LITERALS
  );
}
 
Example #2
Source File: CppHighlighter.java    From CppTools with Apache License 2.0 5 votes vote down vote up
@NotNull
public Lexer getHighlightingLexer() {
  return new LayeredLexer( new FlexAdapter(new _CppLexer(true, false, true, true, true)) ) { // TODO: c/c++ dialects
    {
      registerSelfStoppingLayer(new StringLiteralLexer('\"', CppTokenTypes.STRING_LITERAL),
                            new IElementType[]{CppTokenTypes.STRING_LITERAL}, IElementType.EMPTY_ARRAY);

      registerSelfStoppingLayer(new StringLiteralLexer('\'', CppTokenTypes.SINGLE_QUOTE_STRING_LITERAL),
                            new IElementType[]{CppTokenTypes.SINGLE_QUOTE_STRING_LITERAL},
                            IElementType.EMPTY_ARRAY);
    }
  };
}
 
Example #3
Source File: CppFindUsagesProvider.java    From CppTools with Apache License 2.0 5 votes vote down vote up
@Nullable
public WordsScanner getWordsScanner() {
  return new DefaultWordsScanner(
    new FlexAdapter(new _CppLexer(true, false, true, true, true)), // TODO: c/c++ dialects
    TokenSet.create(CppTokenTypes.IDENTIFIER),
    CppTokenTypes.COMMENTS,
    TokenSet.create(CppTokenTypes.STRING_LITERAL)
  );
}
 
Example #4
Source File: HaskellParserWrapper.java    From intellij-haskforce with Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public ASTNode parse(IElementType root_, PsiBuilder builder_) {
    maxRbraceDebt = -1;
    lastCountedTok = -1;
    regressed = false;
    debtPoints.clear();
    builder_.setTokenTypeRemapper(myRemapper);
    lexer =  (_HaskellParsingLexer) ((FlexAdapter) ((PsiBuilderImpl) builder_).getLexer()).getFlex();
    return super.parse(root_, builder_);
    // return super.parse(root_, new MyDebugPsiBuilderWrapper(builder_));
}
 
Example #5
Source File: LexerEditorHighlighter.java    From consulo with Apache License 2.0 4 votes vote down vote up
private InvalidStateException(LexerEditorHighlighter highlighter, String message, Throwable cause) {
  super(highlighter.getClass().getName() + "(" +
        (highlighter.myLexer.getClass() == FlexAdapter.class ? highlighter.myLexer.toString() : highlighter.myLexer.getClass().getName()) +
        "): " + message, cause);
  myAttachments = new Attachment[]{AttachmentFactory.get().create("content.txt", highlighter.myLexer.getBufferSequence().toString())};
}
 
Example #6
Source File: LattePhpLexerAdapter.java    From intellij-latte with MIT License 4 votes vote down vote up
public LattePhpLexerAdapter() {
	super(
		new FlexAdapter(new LattePhpLexer((java.io.Reader) null)),
		TokenSet.create(T_TEXT, T_HTML_CLOSE_TAG_OPEN, T_HTML_OPEN_TAG_OPEN, T_HTML_OPEN_TAG_CLOSE, T_HTML_TAG_CLOSE)
	);
}
 
Example #7
Source File: LatteTopLexerAdapter.java    From intellij-latte with MIT License 4 votes vote down vote up
public LatteTopLexerAdapter() {
	super(
		new FlexAdapter(new LatteTopLexer((java.io.Reader) null)),
			LatteHtmlUtil.HTML_TOKENS
	);
}
 
Example #8
Source File: HXMLSyntaxHighlighter.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public Lexer getHighlightingLexer() {
  return new FlexAdapter(new HXMLLexer((Reader)null));
}
 
Example #9
Source File: HXMLParserDefinition.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public Lexer createLexer(Project project) {
  return new FlexAdapter(new HXMLLexer((Reader) null));
}
 
Example #10
Source File: XQueryLexer.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public XQueryLexer() {
    super(new MergingLexerAdapter(new FlexAdapter(new _XQueryLexer()), orSet(COMMENTS, WHITE_SPACES, CHARACTER_CONTENTS)));
}
 
Example #11
Source File: BuckParserDefinition.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public Lexer createLexer(Project project) {
  return new FlexAdapter(new _BuckLexer((Reader) null));
}
 
Example #12
Source File: LexerEditorHighlighter.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
  return getClass().getName() + "(" + (myLexer.getClass() == FlexAdapter.class ? myLexer.toString() : myLexer.getClass().getName()) + "): '" + myLexer.getBufferSequence() + "'";
}
 
Example #13
Source File: LatteMacroContentLexerAdapter.java    From intellij-latte with MIT License 4 votes vote down vote up
public LatteMacroContentLexerAdapter() {
	super(
			new FlexAdapter(new LatteMacroContentLexer(null)),
			TokenSet.create(LatteTypes.T_PHP_CONTENT, LatteTypes.T_MACRO_ARGS)
	);
}
 
Example #14
Source File: DustParserDefinition.java    From Intellij-Dust with MIT License 4 votes vote down vote up
@NotNull
@Override
public Lexer createLexer(Project project) {
  return new FlexAdapter(new DustLexer((Reader) null));
}
 
Example #15
Source File: DustSyntaxHighlighter.java    From Intellij-Dust with MIT License 4 votes vote down vote up
@NotNull
@Override
public Lexer getHighlightingLexer() {
  return new FlexAdapter(new DustLexer((Reader) null));
}
 
Example #16
Source File: CppLanguage.java    From CppTools with Apache License 2.0 4 votes vote down vote up
static Lexer createLexerStatic(Project project) {
  return new FlexAdapter(new _CppLexer(false, false, true, true, true)); // TODO: different lexers needed!
}
 
Example #17
Source File: MakefileLexer.java    From CppTools with Apache License 2.0 4 votes vote down vote up
public MakefileLexer(boolean highlighting) {
  super(new FlexAdapter(new _MakefileLexer(highlighting)), tokenSet);
}
 
Example #18
Source File: DuneParserDefinition.java    From reasonml-idea-plugin with MIT License 4 votes vote down vote up
@NotNull
@Override
public Lexer createLexer(Project project) {
    return new FlexAdapter(new DuneLexer(DuneTypes.INSTANCE));
}
 
Example #19
Source File: LatteMacroLexerAdapter.java    From intellij-latte with MIT License 4 votes vote down vote up
public LatteMacroLexerAdapter() {
	super(
		new FlexAdapter(new LatteMacroLexer((java.io.Reader) null)),
		TokenSet.create(LatteTypes.T_MACRO_CONTENT)
	);
}
 
Example #20
Source File: RTLexer.java    From react-templates-plugin with MIT License 4 votes vote down vote up
public RTLexer() {
    super(new FlexAdapter(new _RTLexer((Reader) null)), TokenSet.create(JSTokenTypes.STRING_LITERAL));
}
 
Example #21
Source File: BashLexer.java    From BashSupport with Apache License 2.0 4 votes vote down vote up
public BashLexer(BashVersion bashVersion) {
    super(new FlexAdapter(
            new _BashLexer(bashVersion, null)),
            MergeTuple.create(TokenSet.create(STRING_DATA), STRING_CONTENT),
            MergeTuple.create(TokenSet.create(HEREDOC_LINE), HEREDOC_CONTENT));
}
 
Example #22
Source File: BuckParserDefinition.java    From Buck-IntelliJ-Plugin with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public Lexer createLexer(Project project) {
  return new FlexAdapter(new _BuckLexer((Reader) null));
}
 
Example #23
Source File: JSGraphQEndpointDocLexerTest.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
@Override
protected Lexer createLexer() {
	return new FlexAdapter(new JSGraphQLEndpointDocLexer());
}
 
Example #24
Source File: JSGraphQEndpointLexerTest.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
@Override
protected Lexer createLexer() {
	return new FlexAdapter(new JSGraphQLEndpointLexer());
}
 
Example #25
Source File: JSGraphQLEndpointDocSyntaxHighlighter.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
@NotNull
@Override
public Lexer getHighlightingLexer() {
	return new FlexAdapter(new JSGraphQLEndpointDocLexer());
}
 
Example #26
Source File: JSGraphQLEndpointDocParserDefinition.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
@NotNull
@Override
public Lexer createLexer(Project project) {
	return new FlexAdapter(new JSGraphQLEndpointDocLexer());
}
 
Example #27
Source File: JSGraphQLEndpointSyntaxHighlighter.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
@NotNull
@Override
public Lexer getHighlightingLexer() {
	return new FlexAdapter(new JSGraphQLEndpointLexer());
}
 
Example #28
Source File: JSGraphQLEndpointParserDefinition.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
@NotNull
@Override
public Lexer createLexer(Project project) {
    return new FlexAdapter(new JSGraphQLEndpointLexer());
}
 
Example #29
Source File: JSGraphQLEndpointTodoIndexer.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
JSGraphQLEndpointTodoLexer(OccurrenceConsumer occurrenceConsumer) {
    super(new FlexAdapter(new JSGraphQLEndpointLexer()), occurrenceConsumer);
}
 
Example #30
Source File: RTLexer.java    From react-templates-plugin with MIT License 4 votes vote down vote up
public RTLexer() {
    super(new FlexAdapter(new _RTLexer((Reader) null)), TokenSet.create(JSTokenTypes.STRING_LITERAL));
}