mirror of
https://github.com/irmen/prog8.git
synced 2025-01-12 04:30:03 +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))
|
if(!Files.isReadable(filePath))
|
||||||
throw ParsingFailedError("No such file: $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)
|
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?
|
- 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???
|
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?
|
- github issue about strings and their immutability:
|
||||||
IMPROVE DOCUMENTATION ABOUT STRINGS AND DEDUP.
|
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
|
- test all examples before release of the new version
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user