|extend xbase with a binary literal [message #707387]
||Mon, 01 August 2011 15:30
| Missing name Missing name
Registered: August 2010
I would like to add binary literals to my DSL that extends xbase. More specifically I would like to be able to type "0b1" (binary 1) "0b10" (binary 2) etc. This syntax is inspired from Python.
For this I followed Jan Koehnlein's very helpful blog post (extending xbase).
and added these rules to my grammar:
XLiteral returns XExpression:
ZerosOrOnes : ('0'|'1')('0'|'1')*;
When I try this "0b1" and "0b0" are recognized
but I get the error message below for "0b100" :
no viable alternative at input '100'
Any info would be greatly appreciated.
[Updated on: Tue, 02 August 2011 10:59]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02255 seconds