I am parsing a grammar that uses minus or plus at the end of line to
indicate a continuation.

Following are some examples --

*       command parm1-
                  parm2

*       command parm1 -
                  parm2

*       command parm1 par-
                  m2

*       command verylongparmthatextends-
                acrosstwolines-
                oreventhreelines

The general structure of the grammar is

        Command <one or more positional parameters> <one or more keyword
parameters>

        Keyword parameters are keyword with one or more optional
subparameters.

I have developed a parser that successfully parses the language, but I
can't seem to resolve the issue of the continuations in a consistent
fashion due to the way that they can be inserted at any point in the
token stream.

I would like to just absorb them into the hidden stream so that the
input appears to be on a single line.  

If I wanted to make a first pass on the input and just absorb '-\n' and
'+\n' then all would be well.  That seems pretty wasteful to make a pass
to just do that.  It seems like I should be able to do it during the
lexical pass.

One other thing, the + and - continuation characters can be considered
part of the parameter; it's only the case that a + or - at the end of
the line is considered a continuation.  For example

*       command 'this is a literal that includes a --
                  in the text'

should reduce to "command 'this is a literal that includes a -in the
text'"

This seems like this should be a simple thing to do considering that
whitespace and comments are so easily absorbed.  

Any advice or suggestion is appreciated.

Regards, Fred


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to