UNPKG

solidity-antlr4

Version:

Solidity Lang Lexer and Parser by official ANTLR4 grammar

23 lines (22 loc) 775 B
import { UnaryPrefixOperationContext, UnarySuffixOperationContext } from "../../antlr4/index.js"; import { BaseNode } from "../base.js"; export class UnaryOperation extends BaseNode { type = "UnaryOperation"; operator = null; left = null; right = null; constructor(ctx, visitor) { super(ctx, visitor); if (ctx instanceof UnaryPrefixOperationContext) { this.operator = ctx.getChild(0)?.getText() ?? null; this.right = ctx.getChild(1)?.accept(visitor) ?? null; } else if (ctx instanceof UnarySuffixOperationContext) { this.left = ctx.getChild(0)?.accept(visitor) ?? null; this.operator = ctx.getChild(1)?.getText() ?? null; } } } export { UnaryOperation as UnaryPrefixOperation, UnaryOperation as UnarySuffixOperation };