Skip to content

Commit

Permalink
Correctly handle EOF in within 'arbitrary code' sections
Browse files Browse the repository at this point in the history
Not handling these correctly caused the editor not to accept inputs in empty files and certain other situations

(cherry picked from commit 3865577)
  • Loading branch information
tsalzinger committed Jul 21, 2019
1 parent f8752e8 commit a3d3d0b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/kotlin/me/salzinger/intellij/coco/Coco.flex
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ ANY_CHAR=.
return EMBEDDED_CODE;
}
}
<<EOF>> {
yybegin(STATE_COMPILER);
return EMBEDDED_CODE;
}

// everything is valid in here
[^] { }
}
Expand All @@ -186,6 +191,12 @@ ANY_CHAR=.
"CHARACTERS" { yypushback(yylength()); yybegin(STATE_COMPILER); return EMBEDDED_CODE; }
{LINE_COMMENT} { globalsStarted = true; }
{BLOCK_COMMENT} { globalsStarted = true; }

<<EOF>> {
yybegin(STATE_COMPILER);
return EMBEDDED_CODE;
}

[^] { globalsStarted = true; }
}

Expand Down

0 comments on commit a3d3d0b

Please sign in to comment.