Giter Club home page Giter Club logo

Comments (7)

meisl avatar meisl commented on June 8, 2024

Ooh... that PR didn't hold too long. I'll amend it with a test for that and look into it.

from prog8.

irmen avatar irmen commented on June 8, 2024

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.

meisl avatar meisl commented on June 8, 2024

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.

meisl avatar meisl commented on June 8, 2024

Hm, since #45 was already merged the fix didn't appear there. So I just opened #48.

from prog8.

meisl avatar meisl commented on June 8, 2024

Btw: thanks for checking on me. It's great working with you 👍

from prog8.

irmen avatar irmen commented on June 8, 2024

fixed by merging #48 .

I appreciate your extensive problem reports and analyses they really help getting to the core of the matter

from prog8.

meisl avatar meisl commented on June 8, 2024

Thank you :D

from prog8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.