i have code :
vardeclaration : type id ('=' expression)? ';' ; so, not ('=' expression) exist. but, sometimes, want process part, don't know exist or not in context. i'm using antlr 4 (and using listener), how can know this.
thanks :)
in listener (exitvardeclaration) or visitor (visitvardeclaration) check whether ctx.expression() == null. if null, ('=' expression) didn't exist. if non-null, did exist.
Comments
Post a Comment