ExpressionContext expressionContext = getChild(context, ExpressionContext.class);
if (expressionContext != null) {
return getAdapter(ExpressionAdapter.class).adapt(expressionContext);
}
TerminalNode firstTerminal = getChild(context, TerminalNode.class);
if (firstTerminal != null) {
switch (firstTerminal.getSymbol().getType()) {
case JavaParser.THIS:
return createNode(context, ThisExpression.class);
case JavaParser.SUPER:
return createNode(context, SuperExpression.class);
case JavaParser.Identifier:
return getAdapter(IdentifierAdapter.class).adapt(firstTerminal);
case JavaParser.VOID: {
ClassExpression classExpression = createNode(context, ClassExpression.class);
classExpression.setType(createNode(firstTerminal, VoidType.class));
return classExpression;
}
default:
}
}
LiteralContext literalContext = getChild(context, LiteralContext.class);
if (literalContext != null) {
Literal literal = createNode(context, Literal.class);
TerminalNode terminal = getChild(literalContext, TerminalNode.class);
if (terminal != null && LITERAL_TYPE_MAP.containsKey(terminal.getSymbol().getType())) {
literal.setType(LITERAL_TYPE_MAP.get(terminal.getSymbol().getType()));
literal.setText(terminal.getText());
}
return literal;
}