Question

I am a newbie to antlr and i have written a basic combined grammar to parse my jsp file. I am using antlrworks 1.4.3... Here, I need my grammar to ignore certain lines of text, instead of showing Mismatched exception error.

What should I do? should i write a separate rule to ignore few lines of unwanted code.

For example, there is something like:

              <myTag: selectName = "SelectedLocation" html = "onChange=onChangeType('LOCATION', 'PLACE')"; util.myProject.display();"/>

How should i write a rule to ignore such junk lines in between code.. can anyone help please.

Was it helpful?

Solution

Write a simple lexer to ignore the sea around the islands (tags). Then parse the tags with ANTLR. Or use ANTLR 4 and see book for XML parsing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top