'END' directive stops parsing. Prepared next release.

This commit is contained in:
2021-08-09 12:14:02 +02:00
parent 431caf64fd
commit 0cb90ff8d7
8 changed files with 66 additions and 5 deletions
@@ -624,11 +624,11 @@ public class _M68kLexer implements FlexLexer {
/**
* Refills the input buffer.
*
* @return {@code false}, iff there was new input.
* @return {@code false}, iff there was NO new input.
* @throws java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
return true;
return !zzAtEOF;
}
@@ -871,6 +871,11 @@ public class _M68kLexer implements FlexLexer {
yybegin(ASMINSTR);
return MNEMONIC;
}
if (isEndDirective(yytext())) {
yybegin(YYINITIAL);
zzAtEOF = true;
return null;
}
if (isDataDirective(yytext())) {
startExpr(EXPR, EXPR_OP);
return DATA_DIRECTIVE;
@@ -57,6 +57,8 @@ object AssemblerDirectives {
"machine", "mc68000", "mc68010", "mc68020", "mc68030", "mc68040", "mc68060",
"fpu",
"basereg", "endb", "far", "near", "initnear"
"basereg", "endb", "far", "near", "initnear",
"end"
)
}
@@ -19,6 +19,9 @@ object LexerUtil {
&& text.dropLast(1).endsWith('.')
&& mnemonics.contains(text.dropLast(2).toString().lowercase())
@JvmStatic
fun isEndDirective(text: CharSequence) = text.contentEquals("end", ignoreCase = true)
@JvmStatic
fun isDataDirective(text: CharSequence) = AssemblerDirectives.dataDirectives.contains(text.toString().lowercase())
@@ -117,6 +117,7 @@ PLAIN_MACRO_LINE=[^;\r\n]+
{DIRECTIVE_KEYWORD} {
if(isAsmMnemonicWithSize(yytext())) { yybegin(ASMINSTR); yypushback(2); return MNEMONIC; }
if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); return MNEMONIC; }
if(isEndDirective(yytext())) { yybegin(YYINITIAL); zzAtEOF = true; return null; }
if(isDataDirective(yytext())) { startExpr(EXPR, EXPR_OP); return DATA_DIRECTIVE; }
if(isPlainDirective(yytext())) { yybegin(PLAINPARAMS); return OTHER_DIRECTIVE; }
if(isOtherDirective(yytext())) { startExpr(EXPR, EXPR_OP); return OTHER_DIRECTIVE; }