Reputation: 6861
I create an input stream from a string with
pANTLR3_UINT8 input_string = (pANTLR3_UINT8) "test";
pANTLR3_INPUT_STREAM stream = antlr3StringStreamNew(input_string, ANTLR3_ENC_8BIT, sizeof(input_string), (pANTLR3_UINT8)"testname");
and then use my lexer and parser to process the string. When I'm done with this string I want to process a new one, but re-creating the lexer and parser objects seems inefficient.
I've found the reset
method of the lexer and parser classes and the reuse
method of the stream, but how do I use those to parse a new string?
Upvotes: 0
Views: 442
Reputation: 104110
I believe what you're looking for is the setCharStream()
function.
Upvotes: 1