Defining tokens at runtime

Posted by Peter Crenshaw on Stack Overflow See other posts from Stack Overflow or by Peter Crenshaw
Published on 2010-06-14T15:20:13Z Indexed on 2010/06/14 15:22 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about parsing