lin q
2012-11-29 00:11:20 UTC
Hi,
The data input may be of this format: "command arg" and the arg must be 1
or 2 of "arg1", "arg2" and "arg3", namely it could be any of the following:
command arg1
command arg2
command arg3
command arg1 arg2
command arg1 arg3
command arg2 arg3
I wonder if I could define the grammar like this:
cmd : 'command' ('arg1' | 'arg2' | 'arg3' | 'arg1' 'arg2' | 'arg1' 'arg3' |
'arg2' 'arg3')
Or do I have to put 2 arg into one string like this:
cmd : 'command' ('arg1' | 'arg2' | 'arg3' | 'arg1 arg2' | 'arg1 arg3' |
'arg2 arg3')
The latter is very restrictive to me.
Thanks!
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
The data input may be of this format: "command arg" and the arg must be 1
or 2 of "arg1", "arg2" and "arg3", namely it could be any of the following:
command arg1
command arg2
command arg3
command arg1 arg2
command arg1 arg3
command arg2 arg3
I wonder if I could define the grammar like this:
cmd : 'command' ('arg1' | 'arg2' | 'arg3' | 'arg1' 'arg2' | 'arg1' 'arg3' |
'arg2' 'arg3')
Or do I have to put 2 arg into one string like this:
cmd : 'command' ('arg1' | 'arg2' | 'arg3' | 'arg1 arg2' | 'arg1 arg3' |
'arg2 arg3')
The latter is very restrictive to me.
Thanks!
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address