'END' directive stops parsing. Prepared next release.
This commit is contained in:
parent
431caf64fd
commit
0cb90ff8d7
@ -147,7 +147,7 @@ make it work with JUnit 5. Feel free to use the code (in package ```de.platon42.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
### V0.6 (unreleased)
|
### V0.6 (09-Aug-21)
|
||||||
|
|
||||||
- Enhancement: `opt` and several other directives (`printt`, `fail` etc.) no longer causes a syntax error when unquoted.
|
- Enhancement: `opt` and several other directives (`printt`, `fail` etc.) no longer causes a syntax error when unquoted.
|
||||||
- Enhancement: `include`, `incdir` and `incbin` and `output` with `<pathname>` quotes no longer cause syntax error.
|
- Enhancement: `include`, `incdir` and `incbin` and `output` with `<pathname>` quotes no longer cause syntax error.
|
||||||
@ -155,6 +155,7 @@ make it work with JUnit 5. Feel free to use the code (in package ```de.platon42.
|
|||||||
- New: Code completion for local label definitions, suggesting undefined labels already referenced.
|
- New: Code completion for local label definitions, suggesting undefined labels already referenced.
|
||||||
- New: Added inspection suppression possibility and quickfix.
|
- New: Added inspection suppression possibility and quickfix.
|
||||||
- New: Added inspection for unresolved symbols, macros and labels.
|
- New: Added inspection for unresolved symbols, macros and labels.
|
||||||
|
- Enhancement: 'END' directive stops parsing.
|
||||||
|
|
||||||
### V0.5 (06-Aug-21)
|
### V0.5 (06-Aug-21)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ runPluginVerifier {
|
|||||||
|
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
setChangeNotes("""
|
setChangeNotes("""
|
||||||
<h4>V0.6 (unreleased)</h4>
|
<h4>V0.6 (09-Aug-21)</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Enhancement: 'opt' and several other directives ('printt', 'fail' etc.) no longer causes a syntax error when unquoted.
|
<li>Enhancement: 'opt' and several other directives ('printt', 'fail' etc.) no longer causes a syntax error when unquoted.
|
||||||
<li>Enhancement: 'include', 'incdir' and 'incbin' and 'output' with '<pathname>' quotes no longer cause syntax error.
|
<li>Enhancement: 'include', 'incdir' and 'incbin' and 'output' with '<pathname>' quotes no longer cause syntax error.
|
||||||
@ -65,6 +65,7 @@ patchPluginXml {
|
|||||||
<li>New: Code completion for local label definitions, suggesting undefined labels already referenced.
|
<li>New: Code completion for local label definitions, suggesting undefined labels already referenced.
|
||||||
<li>New: Added inspection suppression possibility and quickfix.
|
<li>New: Added inspection suppression possibility and quickfix.
|
||||||
<li>New: Added inspection for unresolved symbols, macros and labels.
|
<li>New: Added inspection for unresolved symbols, macros and labels.
|
||||||
|
<li>Enhancement: 'END' directive stops parsing.
|
||||||
</ul>
|
</ul>
|
||||||
<h4>V0.5 (06-Aug-21)</h4>
|
<h4>V0.5 (06-Aug-21)</h4>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -624,11 +624,11 @@ public class _M68kLexer implements FlexLexer {
|
|||||||
/**
|
/**
|
||||||
* Refills the input buffer.
|
* 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
|
* @throws java.io.IOException if any I/O-Error occurs
|
||||||
*/
|
*/
|
||||||
private boolean zzRefill() throws java.io.IOException {
|
private boolean zzRefill() throws java.io.IOException {
|
||||||
return true;
|
return !zzAtEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -871,6 +871,11 @@ public class _M68kLexer implements FlexLexer {
|
|||||||
yybegin(ASMINSTR);
|
yybegin(ASMINSTR);
|
||||||
return MNEMONIC;
|
return MNEMONIC;
|
||||||
}
|
}
|
||||||
|
if (isEndDirective(yytext())) {
|
||||||
|
yybegin(YYINITIAL);
|
||||||
|
zzAtEOF = true;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (isDataDirective(yytext())) {
|
if (isDataDirective(yytext())) {
|
||||||
startExpr(EXPR, EXPR_OP);
|
startExpr(EXPR, EXPR_OP);
|
||||||
return DATA_DIRECTIVE;
|
return DATA_DIRECTIVE;
|
||||||
|
@ -57,6 +57,8 @@ object AssemblerDirectives {
|
|||||||
"machine", "mc68000", "mc68010", "mc68020", "mc68030", "mc68040", "mc68060",
|
"machine", "mc68000", "mc68010", "mc68020", "mc68030", "mc68040", "mc68060",
|
||||||
"fpu",
|
"fpu",
|
||||||
|
|
||||||
"basereg", "endb", "far", "near", "initnear"
|
"basereg", "endb", "far", "near", "initnear",
|
||||||
|
|
||||||
|
"end"
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -19,6 +19,9 @@ object LexerUtil {
|
|||||||
&& text.dropLast(1).endsWith('.')
|
&& text.dropLast(1).endsWith('.')
|
||||||
&& mnemonics.contains(text.dropLast(2).toString().lowercase())
|
&& mnemonics.contains(text.dropLast(2).toString().lowercase())
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun isEndDirective(text: CharSequence) = text.contentEquals("end", ignoreCase = true)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isDataDirective(text: CharSequence) = AssemblerDirectives.dataDirectives.contains(text.toString().lowercase())
|
fun isDataDirective(text: CharSequence) = AssemblerDirectives.dataDirectives.contains(text.toString().lowercase())
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ PLAIN_MACRO_LINE=[^;\r\n]+
|
|||||||
{DIRECTIVE_KEYWORD} {
|
{DIRECTIVE_KEYWORD} {
|
||||||
if(isAsmMnemonicWithSize(yytext())) { yybegin(ASMINSTR); yypushback(2); return MNEMONIC; }
|
if(isAsmMnemonicWithSize(yytext())) { yybegin(ASMINSTR); yypushback(2); return MNEMONIC; }
|
||||||
if(isAsmMnemonic(yytext())) { yybegin(ASMINSTR); 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(isDataDirective(yytext())) { startExpr(EXPR, EXPR_OP); return DATA_DIRECTIVE; }
|
||||||
if(isPlainDirective(yytext())) { yybegin(PLAINPARAMS); return OTHER_DIRECTIVE; }
|
if(isPlainDirective(yytext())) { yybegin(PLAINPARAMS); return OTHER_DIRECTIVE; }
|
||||||
if(isOtherDirective(yytext())) { startExpr(EXPR, EXPR_OP); return OTHER_DIRECTIVE; }
|
if(isOtherDirective(yytext())) { startExpr(EXPR, EXPR_OP); return OTHER_DIRECTIVE; }
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package de.platon42.intellij.plugins.m68k.parser
|
||||||
|
|
||||||
|
import de.platon42.intellij.jupiter.MyTestCase
|
||||||
|
import de.platon42.intellij.jupiter.ParsingTestExtension
|
||||||
|
import de.platon42.intellij.jupiter.TestDataSubPath
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@TestDataSubPath("directives")
|
||||||
|
internal class EndDirectiveTest : AbstractParsingTest() {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
internal fun end_directive(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
|
||||||
|
testGoodSyntax(
|
||||||
|
testCase, """
|
||||||
|
moveq.l #0,d0
|
||||||
|
rts
|
||||||
|
END narf
|
||||||
|
äöö#öä235r2352ou485742q3535p3ü
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
26
src/test/resources/parser/directives/end_directive.txt
Normal file
26
src/test/resources/parser/directives/end_directive.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Assembly File: a.asm
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
M68kStatementImpl(STATEMENT)
|
||||||
|
M68kAsmInstructionImpl(ASM_INSTRUCTION)
|
||||||
|
M68kAsmOpImpl(ASM_OP)
|
||||||
|
PsiElement(M68kTokenType.MNEMONIC)('moveq')
|
||||||
|
M68kOperandSizeImpl(OPERAND_SIZE)
|
||||||
|
PsiElement(M68kTokenType.OPSIZE_L)('.l')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
M68kImmediateDataImpl(IMMEDIATE_DATA)
|
||||||
|
PsiElement(M68kTokenType.HASH)('#')
|
||||||
|
M68kLiteralExprImpl(LITERAL_EXPR)
|
||||||
|
PsiElement(M68kTokenType.DECIMAL)('0')
|
||||||
|
PsiElement(M68kTokenType.SEPARATOR)(',')
|
||||||
|
M68kDataRegisterDirectAddressingModeImpl(DATA_REGISTER_DIRECT_ADDRESSING_MODE)
|
||||||
|
M68kDataRegisterImpl(DATA_REGISTER)
|
||||||
|
PsiElement(M68kTokenType.DREG)('d0')
|
||||||
|
PsiElement(M68kTokenType.EOL)('\n')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
M68kStatementImpl(STATEMENT)
|
||||||
|
M68kAsmInstructionImpl(ASM_INSTRUCTION)
|
||||||
|
M68kAsmOpImpl(ASM_OP)
|
||||||
|
PsiElement(M68kTokenType.MNEMONIC)('rts')
|
||||||
|
PsiElement(M68kTokenType.EOL)('\n')
|
||||||
|
PsiWhiteSpace(' END narf\n äöö#öä235r2352ou485742q3535p3ü\n')
|
Loading…
Reference in New Issue
Block a user