antlr - How to strip quotes from a string -
i wrote simple rule match string in antlr grammar:
string : '"' (esc | ~["\\])* '"' ;
actually need content of string , not quotes, required match string.
i found solution antlr 3, which published in antlr wiki. know if there solution achive same without custom code.
this should work:
string : '"' (esc | ~["\\])* '"' {settext(gettext().substring(1, gettext().length()-1));} ;
it simple removes first , last character string.
taken https://theantlrguy.atlassian.net/wiki/spaces/antlr3/pages/2687006/how+do+i+strip+quotes
Comments
Post a Comment