Comments (7)
Ooh... that PR didn't hold too long. I'll amend it with a test for that and look into it.
from prog8.
It popped up immediately because I was doing a p8compile examples/*.p8 after the merge of the PR :-)
No worries, here's a skeleton for the test that I worked on before going for an ice cream:
@Test
fun testCommentLinesWorkWithEmptyLines() {
val srcText = """; comment before empty line
; comment after empty line
main {
sub start() {
}
}
"""
val parseTree = parseModule(srcText)
assertTrue(parseTree.block().size > 0)
}
from prog8.
Well, that's the nice thing about automated tests ;)
Anyways, just pushed to #45.
The problem was this:
- comments go into their own channel, and aren't seen by the parser
- EOLs, however are, since they are used as end-of-statement marker etc
- By looking at just the EOL lexer rule, one can get the impression, that the parser will never see consecutive EOLs - it seems they should "eat up" all prior vertical whitespace
- But that's not true, putting comments in between EOLs has the parser see consecutive EOLs (which are separated by the invisible comments)
So the fix itself was straight-forward:
EOL?
->EOL*
EOL
->EOL+
from prog8.
Hm, since #45 was already merged the fix didn't appear there. So I just opened #48.
from prog8.
Btw: thanks for checking on me. It's great working with you 👍
from prog8.
fixed by merging #48 .
I appreciate your extensive problem reports and analyses they really help getting to the core of the matter
from prog8.
Thank you :D
from prog8.
Related Issues (20)
- Newline is significant when it shouldn't be HOT 1
- Don't do that! [about the idea to remove drive num from diskio routines] HOT 7
- Array of Structs HOT 4
- filenames with non-ASCII characters don't get loaded by the compiler on Windows while in UTF-8 mode HOT 1
- @(variable) to work for uword as well as ubyte HOT 4
- Prog8 generates ASM that will not build HOT 3
- parse error: no viable alternative at input 'not in' Where as, this does not: HOT 3
- How to convert uword to str? HOT 3
- Docs: List all available @varflags/tags HOT 4
- Problem with string.find(...) HOT 2
- Support for new encodings HOT 8
- known problems in version 10.3
- compiler crash when using call builtin HOT 6
- string.find is not working HOT 5
- Incorrect 6502 asm generated with indexing a uword pointer using array syntax HOT 1
- Compilation broken with new Kotlin versions HOT 1
- windows build fails on line endings HOT 1
- floats.atan2() wrong results
- vera CTRL not properly reset in line drawing code
- for 'raw' outputs, syslib is sometimes not imported
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prog8.