In smali the signature of a method taking two integers and returning one integer is written like this:
add(II)I
For parsing this using xtext, I tried the following:
ID'('Type*')'Type
Unfortunately this only works with whitespace between the two I
.
How can I change the rule to make it not insist on whitespace here?
As far as I see, this should already be a problem with the lexer processing the terminal rules. Whenever it sees a sequence of characters like III
it always marks it as an ID immediately. - Independent of the position. :(
To parse something like:
III(III)I
i.e. a function named III
taking three Integers and returning another Integer, it seems like I have to force the lexer to always emit only single characters and reassemble it again using a parser rule.
But in this case I don't manage to create an ID rule anymore...
It seems like I missed something important.
NB: Beside primitive data types like I
(integer), D
(double) and V
(void) there are also class types written as Ljava/lang/String;
and arrays starting with [
.
A typical main method looks like this .method public static main([Ljava/lang/String;)V
.