Re: Line continuation characters
[email protected] (Ted Zlatanov)
| Newsgroups | perl.recdescent |
|---|---|
| Organization | Cienfuegos |
| Message-ID | <[email protected]> |
[email protected] (Randal L. Schwartz) writes: >>>>>> "Marc" == Marc Mims <[email protected]> writes: > > Marc> I need to parse a grammar that includes line continuation > Marc> characters. For example: > If the skip between tokens is any combination of spaces, tabs, or "+\n" combos, > then say that: > > file: command(s) > command: <skip: '(?:[ \t]+|\+\n)+'> commandline /\n/ > commandline: "//" ... # real command > commandline: "*" ... # comment > > You need to match a literal /\n/ at the end of your real > command, since that's not matched by this skip. Because Marc's grammar seems to be otherwise line-oriented, I'd suggest preprocessing the grammar input to merge lines as needed, to simplify the grammar. The major disadvantage would be that line numbers would be off when reporting errors though. Ted