[antlr-interest] Is ANTLR suitable for wiki grammar parsing?

Thomas Brandon tbrandonau at gmail.com
Tue Jun 5 07:27:38 PDT 2007


As phrase is a parser rule "." means any token rather than any character, as
your only tokens are '*' and '_' this is all that will be matched. You need
a lexer rule to deal with other characters.

Tom.

On 6/5/07, Collin VanDyck <collin.vandyck at hannonhill.com> wrote:
>
> Hi
>
> Thanks for your reply. I'll admit, even after reading the PDF, I'm a
> little confused on how to accomplish what I want. I tried using your
> suggestion, and tried this grammar:
>
> grammar WikiGrammar;
>
> wiki
>         : phrase+
>         ;
>
> phrase
>         : bolded
>         | underlined
>         | ( options {greedy=false;} : .)+
>         ;
>
> bolded
>         : '*' phrase '*'
>         ;
>
> underlined
>         : '_' phrase '_'
>         ;
>
>
> With the input
>
> "Hello"
>
> And I got the NoViableAltException.
>
> I'm a little confused as to figure out how to exactly accomplish
> this.  Essentially, I just want to be able to spit out whatever input
> I receive, and be able to recognize recursive markup patterns.  Any
> ideas on how I can get this example (with bold and underline) to do
> this?
>
> Many thanks
> Collin
>
>
> -----
> Collin VanDyck
> CTO - Hannon Hill
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070606/b2182eee/attachment.html 


More information about the antlr-interest mailing list