* A lazy, by-name reference to another object. The syntax for these identifiers uses the same
* rules as Java identifiers.
*/
@Cached
<R> Rule Ident(Class<R> referentType) {
StringVar x = new StringVar();
return Sequence(
ANY,
ACTION(Character.isJavaIdentifierStart(matchedChar()) && x.append(matchedChar())),
ZeroOrMore(
ANY,
ACTION(Character.isJavaIdentifierPart(matchedChar()) && x.append(matchedChar()))
),
ACTION(push(new Ident<R>(referentType, x.get()))),
WS());
}