UNPKG

@flowscripter/mpeg-sdl-parser

Version:

ISO/IEC 14496-34 Syntactic Description Language (MPEG SDL) parser implemented in TypeScript

21 lines (18 loc) 577 B
import { Text } from "@codemirror/state"; import type { TreeCursor } from "@lezer/common"; import { getToken } from "../../util/nodeFactoryUtils"; import { NumberLiteral } from "../node/NumberLiteral"; import { NumberLiteralKind } from "../node/enum/number_literal_kind"; export function getIntegerLiteral( cursor: TreeCursor, text: Text, ): NumberLiteral { const literal = getToken(cursor, text); const literalText = literal.text; const value = parseInt(literalText, 10); return new NumberLiteral( NumberLiteralKind.INTEGER, value, [literal], ); }