Using TParser in the Classes Unit to Parse a Filter String

I want to parse a filter string like the following:

((Field1 = 'red') and (field2 = 2)) or (Field3 between 1 and 5) or (field4 in ['up', 'down'])

      

I would like to use TParser in the Classes unit, but there doesn't seem to be a lot of documentation or examples on it.

-1


a source to share


1 answer


TParser is used by the IDE to parse DFM files in binary format (ObjectTextToBinary). As far as I know, it only recognizes 5 tokens: (EOF, Symbol, String, Integer, Float). It's not general enough, but built on purpose. You will have to subclass it and change its implementation to suit your needs. My opinion is that it is better to just write your own class / automata for your specific purpose. (It's not even a parser, but a lexical tokenizer).



+8


a source







All Articles