How can I get AWK or SED type filtering behavior?

Terence Parr

The core of the answer is: use the filter option in the lexer. This option is used in a simple form where filter=true and in a more sophisticated form of filter=SKIP_RULE. The first just says, "if you don't see a rule that matches it, ignore the input". This is very similar to awk/sed. The second form is really nice because you can specify the "skip language". For example, if you want to ignore comments except in strings for HTML, then the SKIP_RULE would match strings (so you can ignore everything inside them) and "dot" (the wildcard meaning any char). These two articles should help you out:

Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact