mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +00:00
allow correct parsing of source files that don't end in a EOL character. Fixes #40
This commit is contained in:
parent
b9bd541532
commit
ae5d7705bb
@ -44,7 +44,10 @@ class ModuleImporter(private val program: Program,
|
||||
if(!Files.isReadable(filePath))
|
||||
throw ParsingFailedError("No such file: $filePath")
|
||||
|
||||
val content = filePath.toFile().readText().replace("\r\n", "\n")
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,9 @@ TODO
|
||||
|
||||
- possible idea: option to mark vardecls 'shared' to indicate they should not be optimized away because they're shared with assembly code?
|
||||
However: who even needs variables declared in prog8 code that are only used by assembly???
|
||||
- github issue: make strings no longer immutable? Deduplication selectable via command line switch?
|
||||
IMPROVE DOCUMENTATION ABOUT STRINGS AND DEDUP.
|
||||
- github issue about strings and their immutability:
|
||||
StatementOptimizer line 60: only optimize when it's a known constant literal
|
||||
IMPROVE DOCUMENTATION ABOUT STRINGS AND DEDUP and (NON)IMMUTABILITY.
|
||||
|
||||
- test all examples before release of the new version
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user