Ignoring text not defined in Grammar

Jan 13, 2014 at 7:30 AM

I am new to Irony and language grammar. I want to know, if it is possible to parse only a specific block of a code\text file and ignoring the rest, so that I do not have to define the grammer for the "rest".

Example text file content:

some text that I am not interesting in
more text... more words...
some code that I am not interesting in

DEF VAR a int = 10;
DEF VAR b int = 20;

some text... many words...
more text... more words...
some code...

The question is now, how can I build a grammar\parser that ignores all text except the "DEF VAR..." lines?
I alread have defined a grammar for the "DEF VAR..." lines, but when I am parsing the files I logically get parsing errors.

Thanks in advance!
Jan 14, 2014 at 5:38 PM
I think your best approach would be to write pre-parser analyzers: break the file into lines, analyze each and see if it should be skipped or parsed. If not to skip, feed it to the parser.