User:OrenBochman/SearchTools/Awk Antlr
Appearance
"You often want to perform an action upon seeing a pattern or two in a complicated input stream, such as pulling out links in an HTML file. One solution is to take the HTML grammar and just put actions where you want." - antlr docs [1]
class cfgAwk extends Lexer;
options {
k=2; //lookahead
filter=IGNORE;
// charVocabulary = '\3'..'\177';
}
//replace by language transformation rules
P : "<p>" ;
BR: "<br>" ;
fragment
IGNORE
: '<' (~'>')* '>'
{System.out.println("bad tag:"+$getText) ; }
| ( "\r\n" | '\r' | '\n' ) {newline();}
| .
;
based on [2]