2008/9/13 Gavin Lambert <[EMAIL PROTECTED]>:
> At 01:58 13/09/2008, Dave Pawson wrote:
>>Obvious next question, how to do it in the Parser please?
>
> Just output whatever you want. Like so:
>
> list : { Console.writeLine("<list>"); } item* {
> Console.writeLine("</list>"); } ;
> item : TEXT { Console.writeLine("<item>", $TEXT.text, "</item>"); } ;
That's the problem? There is no textual content for the lexer to
trigger on for 'list'?
I can define 'item', but not list?
The input is
blah
blah
*list item 1
* list content 2
etc.
>
>>I'm not that far in the Antlr book - seems like I do need a tree
>>with a non-existant node to hang the list item children from.
>
> Maybe you should read more of the book :)
I will, though it is discouraging that its content is 3.0 based.
>
> And you can do it like that if you want to (eg. if you want to generate an
> AST you can manipulate or generate multiple kinds of output from), but if
> your needs are simple then you might as well just do the output directly in
> the parser.
As I said, this is just me learning by example as I go.
regards
--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---