grammar V3;
message: response | request;
request: command '(' ( param (',' param)* ) ')';
param: astring | number (numberwithzero*);
command: 'command_1' | 'command_2' | 'command_3';
response: returncode (responsedata);
returncode: numberwithzero;
number: ('-') '1' | '2' | '3' | '4' | '5'| '6' | '7' | '8' | '9';
numberwithzero: number | '0';
realnumber: ('-') numberwithzero* '.' numberwithzero*;
realnumberenotation: realnumber (('e' | 'E') realnumber );
responsedata: responseparam (delimiter responseparam)*;
delimiter: (' '*)','(' '*);
responseparam: astring | numberwithzero*;
astring: '"' ('""' | ~'"')* '"';String msg1 = "0, \"Hola\", \"!~^?%&ç*\"";String msg2 = "-1, \"745\" ,\"133\"";
ANTLRInputStream input = new ANTLRInputStream(msg1);
V3Lexer lexer = new V3Lexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
V3Parser parser = new V3Parser(tokens);
parser.message().accept(new MyVisitor());
Working on message: -1, "745" ,"133"92 [main] DEBUG client.protocol.TestApp - Visit message: -1, "745" ,"133"93 [main] DEBUG client.protocol.TestApp - Visit response param: 93 [main] DEBUG client.protocol.TestApp - Visit response param: "745"93 [main] DEBUG client.protocol.TestApp - Visit response param: "133"Working on message: 0, "Hola", "!~^?%&ç*"--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.