I had a similar requirement. I maintained a class LexerContext in a Thread local variable and accessed it and modified it. There might be better solutions.
Thanks, Gokul. On Tue, Jul 26, 2011 at 8:07 PM, Mu Qiao <qiao...@gmail.com> wrote: > Hello, > > My lexer has to rely on some internal status like the following: > > DQUOTE : '"' { if(LA(-1) != '\\') double_quoted = !double_quoted; > }; > SQUOTE : { double_quoted }? => '\''; > SINGLE_QUOTED_STRING_TOKEN : { !double_quoted }? => '\'' .* '\''; > > "double_quoted" is a bool variable declared in @member section. The > generated code will declare it in global scope, which is not thread > safe. I wonder if there is any way to make the lexer thread-safe? For > example declare the variable in xxxLexer_Ctx_struct. > > -- > Best wishes, > Mu Qiao > GnuPG fingerprint: 92B1 B0C4 8D14 F8C4 EFA5 3ACC 30B3 0DE4 17B1 57E9 > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.