antlr2 return multiple values
问题 How to make a rule return multiple values in antlr2.For example: declSpecifiers returns [int mods] : ( storageClassSpecifier | typeQualifier | typeSpecifier)+ ; I have some other information besides 'mods' to return.What should I do? 回答1: In ANTLR v3.x, you can include multiple return values by listing them in the brackets. declSpecifiers returns [int mods, Object otherInfo] : ( storageClassSpecifier | typeQualifier | typeSpecifier)+ ; The generated code will return a generated class