mirror of
https://github.com/irmen/prog8.git
synced 2024-10-18 16:24:26 +00:00
* #40 grammar: don't require EOL after blocks, so .p8 files need not end with that
This commit is contained in:
parent
f2844bdf1a
commit
b8117394c0
@ -45,8 +45,6 @@ class ModuleImporter(private val program: Program,
|
|||||||
throw ParsingFailedError("No such file: $filePath")
|
throw ParsingFailedError("No such file: $filePath")
|
||||||
|
|
||||||
var content = filePath.toFile().readText().replace("\r\n", "\n") // normalize line endings
|
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)
|
return importModule(CharStreams.fromString(content), filePath, false)
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ register: 'A' | 'X' | 'Y' | 'AX' | 'AY' | 'XY' | 'Pc' | 'Pz' | 'Pn' | 'Pv' | 'R0
|
|||||||
|
|
||||||
module : (directive | block | EOL)* EOF ;
|
module : (directive | block | EOL)* EOF ;
|
||||||
|
|
||||||
block: identifier integerliteral? '{' EOL (block_statement | EOL) * '}' EOL ;
|
block: identifier integerliteral? '{' EOL (block_statement | EOL) * '}' (EOL | EOF) ;
|
||||||
|
|
||||||
|
|
||||||
block_statement:
|
block_statement:
|
||||||
|
Loading…
Reference in New Issue
Block a user