-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #40, EOF/EOL #45
Conversation
… not end with that
Hi ! By the way I don't think it's useful to put (java) tests in the (java) Parser submodule as I think it's very cumbersome to directly test the antlr parse tree. So I put it in the CompilerAst module. You can still directly access the antlr nodes there if you like but also (preferably) the transformed Ast nodes from the prog8 parse tree |
Great! I'll add tests to the PR. You're right, let's not add java tests. I realized that the parser module isn't Kotlin but java just before I read your comment :) Right now I'm having my fights with IDEA, it won't build because of some strange "missing/conflicting dependency" re the JDK for module compilerAst - but only for one file, and on top of that, it's a different file after restart of the IDE...! Well, doesn't matter too much, I can still build and run tests with gradle. |
…we can see that tests actually fail
…ust have a newline after their closing `}`
…doesn't actually fail with old grammar, but a built jar does - WHY?!*
Hi @irmen, Anyhow, the gradle stuff - building and testing - does work, and with no more warnings now. I've managed to create (hopefully) reasonable tests, and as you might see from my numerous additional commits, went to great lengths to make sure that what I did actually does test what it should. Bear in mind that I'm in the midst of learning all that stuff still. There's one strange thing I couldn't wrap my head around yet: one test, So, can this PR be merged now? |
I found the problem, hope you didn't waste time on this yet. I'll add a commit and explain soon. |
It's probably in the weekend that I have time to actually investigate this PR anyway, so you can keep working on it if you like no problem |
…): also test sole \r AND do not allow any recovery, neither from parser not lexer.
… a "synthesized double EOF" (behavior remains exactly the same)
The strange non-failing test (7c1de81, ce76a7d):
...so I learned quite a bit of ANTLR, which led to Other things I found out:
So far, I'd say this PR is ready now.
|
yeah the antlr plugin for IDEA is quite useful! I used it a lot when first constructing the grammar |
Tracked down mentioned bug, finally: #46 |
Then we lose the possibility of just having a module file containing just %import directives.
possibly, but I found it not really worth it. Do you think "directive xxx is only allowed on module scope" is too vague? This should be one of the errors printed by the ast checker step if you make a mistake with the directives |
|
Oh, maybe I didn't get you quite right re "Which directive where?". I suppose you meant that the error messages already say "directive xxx ...". But that's not always the case, in fact rather seldom. Rather as I described. Needs of course more thorough investigation - and tests ;) |
Just checked this out. Looking very good! Thanks for your work on this! |
Finally, I can build myself :D
So I just tried what I had been proposing in #40, and it turned out to just work. I did the "automagic newline normalization" as well, including support for Mac newlines (sole
\r
).I wasn't quite sure what you had in mind with
COMMENT
andLINECOMMENT
, so I went for maximally defensive = same behavior as before, just with added Windows and Mac line endings.What's missing are tests, I'd need your help with that. Haven't worked with IDEA, gradle, Kotlin before. Maybe you could just add one trivial test to the
parser
module, so that I can see what setup is needed. I'd try to adapt then.