This is a modified version of the xml example from the ANTLR website. 
Eventually I want to extract data from XHTML.
I probably just need a second to spot a simple mistake. I have the reference 
book, not finished it yet, but did spend plenty of time on this and I am stuck.
error(100): XMLParser.g:29:11: syntax error: antlr: 
NoViableAltException(72@[475:4: ( ( id ( ASSIGN | PLUS_ASSIGN ) ( atom | block 
) ) (sub= ebnfSuffix[root_0,false] )? |a= atom (sub2= ebnfSuffix[$a.tree,false] 
)? | ebnf | FORCED_ACTION | ACTION |p= SEMPRED ( IMPLIES )? |t3= tree_ 
)])error(100): XMLParser.g:29:11: syntax error: antlr: 
NoViableAltException(72@[475:4: ( ( id ( ASSIGN | PLUS_ASSIGN ) ( atom | block 
) ) (sub= ebnfSuffix[root_0,false] )? |a= atom (sub2= ebnfSuffix[$a.tree,false] 
)? | ebnf | FORCED_ACTION | ACTION |p= SEMPRED ( IMPLIES )? |t3= tree_ 
)])error(100): XMLParser.g:0:1: syntax error: assign.types: 
MismatchedTreeNodeException(0!=32)error(100): XMLParser.g:0:1: syntax error: 
assign.types: MismatchedTreeNodeException(3!=33)error(100): XMLParser.g:0:1: 
syntax error: assign.types: MismatchedTreeNodeException(3!=34)error(10):  
internal error: XMLParser.g : System.InvalidCastException: Unable to cast 
object of type 'Antlr.Runtime.Tree.CommonTree' to type 'Antlr
 3.Tool.GrammarAST'.


parser  grammar XMLParser;options{    language=CSharp3;    tokenVocab=XMLLexer;}
@header {using System;}@namespace { XMLParserN }
document  : element ;
element    : startTag         (element        | PCDATA        )*        endTag  
  | emptyElement    ;
startTag        : TAG_START_OPEN GENERIC_ID {Console.Write(@"<" + 
$GENERIC_ID.text); }    (attribute {if $attribute.cl!=@"" then Console.Write(@" 
class=\"" + $attribute.cl + @"\"");}          )*        TAG_CLOSE 
{Console.Write(@">" + $GENERIC_ID.text); }
attribute returns [string cl]   : GENERIC_ID ATTR_EQ ATTR_VALUE                 
{ if ($GENERIC_ID.text==@"class") $cl = $ATTR_VALUE.text else $cl = @""; } ;
endTag  : TAG_END_OPEN GENERIC_ID TAG_CLOSE     {Console.Write(@"</" + 
$GENERIC_ID.text + @">"); };             
emptyElement : TAG_START_OPEN GENERIC_ID  (attribute)* TAG_EMPTY_CLOSE ;        
                                  

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/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.

Reply via email to