UNPKG

solidity-antlr4

Version:

Solidity Lang Lexer and Parser by official ANTLR4 grammar

24 lines (23 loc) 707 B
import { BaseNode } from "../base.js"; import { LiteralWithSubDenominationContext } from "../../antlr4/index.js"; export class NumberLiteral extends BaseNode { type = "NumberLiteral"; value = null; hexValue = null; subDenomination = null; constructor(ctx, visitor) { super(ctx, visitor); let target; if (ctx instanceof LiteralWithSubDenominationContext) { target = ctx.numberLiteral(); this.subDenomination = ctx.SubDenomination()?.getText() ?? null; } else { target = ctx; } this.value = target.DecimalNumber()?.getText() ?? null; this.hexValue = target.HexNumber()?.getText() ?? null; } } export { NumberLiteral as LiteralWithSubDenomination };