This project has moved. For the latest updates, please go here.

Suggestion for RegexBasedTerminal class

Sep 24, 2012 at 8:27 PM
Edited Sep 24, 2012 at 8:28 PM

I notice that the ExplicitCapture option is not set in the construction of patterns. As capturing-groups are not exposed externally (and I see no reason to do so), setting this option should improve the efficiency of complicated regular expressions.

BTW: I find myself relying on this class almost exclusively, as the others seem unpredictable; clearly I am missing something in proper setup of the others, but this class seems to be working great.

Sep 26, 2012 at 5:42 PM

thanks for the tip. I'm surprised you rely on regex so much, it is thought up as a thing to be used in a few marginal cases. It is much slower than other regular terminals, and has some other shortcomings... 

Sep 26, 2012 at 6:00 PM

I cut my teeth on RegEx'es more than 20 years ago, so the moment I encountered difficulties with the others I fell back on them as a comfort zone. Also, the grammars I am implementing do not use whitespace between tokens ....

Sep 26, 2012 at 6:20 PM

A specific issue with KeyTerm is that it is case sensitive even in a case-insensitve grammar. So, it was much easier to define RegExTerminals.