RSyntaxTextArea icon indicating copy to clipboard operation
RSyntaxTextArea copied to clipboard

[Bug]: Highlight the import files

Open lzhiyong opened this issue 3 years ago • 0 comments

Description the CPlusPlusTokenMaker.flex and CTokenMaker.flex can't parse header files correctly.

like this: <xxx.h>

IMG_20220929_190938

Expected behavior Can correctly highlight header files.

like this:

IMG_20220929_191008

Java version openjdk-17

Additional context I can't fix this as I'm not familiar with the Jflex syntax. see the cpp.flex

Pseudo code:

/* Add state to import files */
%state IMPORT_FILE

%%

<YYINITIAL> {
    ...
    /* Preprocessor directives */
    "#"{WhiteSpace}*{PreprocessorWord}    { start = zzMarkedPos-2; yybegin(IMPORT_FILE); }
  
    <IMPORT_FILE>{
        /* <xxx.h> or <xxx> as the StringLiteral  */
	{WhiteSpace}\*<{AnyChrChr}>    { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.PREPROCESSOR); addToken(temp,zzMarkedPos-1, Token.LITERAL_CHAR); start = zzMarkedPos; }
	\n			{ addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
	<<EOF>>			{ addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken; }
    }

}

lzhiyong avatar Sep 29 '22 12:09 lzhiyong