1grammar t013parser; 2options { 3 language = JavaScript; 4} 5 6@parser::members { 7this.identifiers = []; 8this.reportedErrors = []; 9 10this.foundIdentifier = function(name) { 11 this.identifiers.push(name); 12}; 13 14this.emitErrorMessage = function(msg) { 15 this.reportedErrors.push(msg); 16}; 17} 18 19document: 20 t=IDENTIFIER {this.foundIdentifier($t.text)} 21 ; 22 23IDENTIFIER: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*; 24