parse Java @interface defaults
Brought to you by:
dhiebert
we fall over on this:
public @interface i {
String n() default "ninjas; monkeys!";
String m();
}
producing a bogus unprintable tag containing the single character 0xd3, which is used by fileGetc to represent string constants. (which in itself is a bug, because 0xd3 could be part of an identifier.)
the easy part of the fix is something like this:
@@ -2019,6 +2019,10 @@
c = skipToNonWhite ();
}
} while (c == '.' || c == ',');
+ } else if (token->keyword == KEYWORD_DEFAULT) {
+ c = skipToNonWhite ();
+ readIdentifier (token, c);
+ c = skipToNonWhite ();
}
}
cppUngetc (c);
but the readIdentifier is wrong, because the default is an expression, and needn't be a single identifier.
This is a simpler example that produces wrong output:
produces the symbol
dinstead ofabc.