java - Lexer rule -> Get only content of string -
i've lexer rule on grammar:
string_literal : '\'' ( ~'\'' | '\'\'' )* '\'' ;
when visit rule, want "content" of string_literal
. so, that's between first '
, last '
.
example:
string s = node.gettext(); s -> "'sample string'"
is possible touch bit lexer rule in order "content" of string?
why not strip quotes when read out text in listener/walker/whatever-consume-code? ibre5041 right, don't put processing in grammar. semantic phase better place that.
Comments
Post a Comment