Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Extending a Parse::RecDescent grammar for inline comments

by JavaFan (Canon)
on Aug 20, 2010 at 09:16 UTC ( #856215=note: print w/replies, xml ) Need Help??


in reply to Extending a Parse::RecDescent grammar for inline comments

I would use the SKIP directive - the pattern used to skip text between tokens (whitespace by default). I don't remember the syntax for setting the directive, but setting it to
/\s*(?:;[^\n]*\n)?/
should go a long way.

Replies are listed 'Best First'.
Re^2: Extending a Parse::RecDescent grammar for inline comments
by bronto (Priest) on Aug 20, 2010 at 14:47 UTC

    Thanks for the suggestion! Is it possible to do it in a way that I can capture the content of the comment?

    Ciao!
    --bronto


    In theory, there is no difference between theory and practice. In practice, there is.
      Then it's not a comment at all (i.e. it's meaningful), and you'd match it like anything else (i.e. not use <skip>).

        That's what I tried to do, actually, e.g. adding an InlineComment rule, but I failed. Do you know the correct way to do this?

        Thanks!

        Ciao!
        --bronto


        In theory, there is no difference between theory and practice. In practice, there is.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://856215]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2023-01-27 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?