Defining tokens at runtime
- by Peter Crenshaw
I want to write a parser for EDIFACT messages with JavaCC.
My problem is that I cannot define all terminal symbols before parsing a message because at the begining of each message there is a so called "Advice Segment" ("UNA" Segment) which defines things like element seperator symbol, escape symbol, segment terminator symbol and decimal notation (e.g. '.' or ',').
So I think/guess the production rules need some kind of variables which must be set at runtime during parsing.
Can this be done with JavaCC and if so how?
Or is there another way I am missing?