* #40 grammar: don't require EOL after blocks, so .p8 files need not end with that

This commit is contained in:
meisl 2021-06-12 17:52:44 +02:00
parent f2844bdf1a
commit b8117394c0
2 changed files with 1 additions and 3 deletions

View File

@ -45,8 +45,6 @@ class ModuleImporter(private val program: Program,
throw ParsingFailedError("No such file: $filePath")
var content = filePath.toFile().readText().replace("\r\n", "\n") // normalize line endings
if(content.last()!='\n')
content+='\n' // grammar requires blocks (and thus module files) to end in an EOL
return importModule(CharStreams.fromString(content), filePath, false)
}

View File

@ -75,7 +75,7 @@ register: 'A' | 'X' | 'Y' | 'AX' | 'AY' | 'XY' | 'Pc' | 'Pz' | 'Pn' | 'Pv' | 'R0
module : (directive | block | EOL)* EOF ;
block: identifier integerliteral? '{' EOL (block_statement | EOL) * '}' EOL ;
block: identifier integerliteral? '{' EOL (block_statement | EOL) * '}' (EOL | EOF) ;
block_statement: