UNPKG

js-slang

Version:

Javascript-based implementations of Source, written in Typescript

34 lines (33 loc) 1.7 kB
import type { Comment, SimpleLiteral, SourceLocation } from 'estree'; import type { StepperExpression, StepperPattern } from '..'; import type { StepperBaseNode } from '../../interface'; /** * This class represents a literal node in the stepper's AST (Abstract Syntax Tree). * It extends both SimpleLiteral and StepperBaseNode to integrate with the stepper system. * The class stores value-related properties such as type, value, raw representation, * and location metadata. * * @method isContractible() Indicates whether this node can be contracted (returns false). * @method isOneStepPossible() Indicates whether a single step evaluation is possible (returns false). * @method contract() Throws an error as contraction is not implemented. * @method oneStep() Throws an error as one-step evaluation is not implemented. */ export declare class StepperLiteral implements SimpleLiteral, StepperBaseNode { type: 'Literal'; value: string | number | boolean | null; raw?: string; leadingComments?: Comment[]; trailingComments?: Comment[]; loc?: SourceLocation | null; range?: [number, number]; constructor(value: string | number | boolean | null, raw?: string, leadingComments?: Comment[], trailingComments?: Comment[], loc?: SourceLocation | null, range?: [number, number]); static create(literal: SimpleLiteral): StepperLiteral; isContractible(): boolean; isOneStepPossible(): boolean; contract(): StepperLiteral; oneStep(): StepperLiteral; substitute(_id: StepperPattern, _value: StepperExpression): StepperLiteral; freeNames(): string[]; allNames(): string[]; rename(_before: string, _after: string): StepperExpression; }