Added M68kLexerPrefs (preliminary). Added support for optional space-introducing comments.

This commit is contained in:
2021-07-17 16:49:50 +02:00
parent 618a4eee01
commit 349372f6b3
17 changed files with 771 additions and 536 deletions
@@ -47,4 +47,40 @@ internal class CommentsTest : AbstractParsingTest() {
internal fun end_of_line_comments(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
testGoodSyntax(testCase, "foo = 1234; hi\n\n\nlabel; foo\n\n\n add.w d0,d0;narf \n\n")
}
@Test
internal fun comment_after_instruction_with_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
(testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = true
testGoodSyntax(testCase, " add.w d0,d0 hey comment\n")
}
@Test
internal fun comment_after_assignment_with_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
(testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = true
testGoodSyntax(testCase, "FOO = 123+23 hey comment\n")
}
@Test
internal fun comment_after_macro_call_with_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
(testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = true
testGoodSyntax(testCase, " PUSHM d0,d0 hey comment\n")
}
@Test
internal fun space_does_not_start_comment_within_instruction_without_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
(testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = false
testGoodSyntax(testCase, " add.w # 234, d0 ; hey comment\n")
}
@Test
internal fun space_does_not_start_comment_within_assignment_without_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
(testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = false
testGoodSyntax(testCase, "FOO = 123 + 23 ; hey comment\n")
}
@Test
internal fun space_does_not_start_comment_within_macro_call_without_space_introduces_comment_option(@MyTestCase testCase: ParsingTestExtension.IParsingTestCase) {
(testCase.parserDefinition as M68kParserDefinition).lexerPrefs.spaceIntroducesComment = false
testGoodSyntax(testCase, " PUSHM d0, d0 ; hey comment\n")
}
}