UNPKG

js-slang

Version:

Javascript-based implementations of Source, written in Typescript

54 lines 1.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StepperLiteral = void 0; /** * 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. */ class StepperLiteral { constructor(value, raw, leadingComments, trailingComments, loc, range) { this.type = 'Literal'; this.value = value; this.raw = raw; this.leadingComments = leadingComments; this.trailingComments = trailingComments; this.loc = loc; this.range = range; } static create(literal) { return new StepperLiteral(literal.value, literal.raw, literal.leadingComments, literal.trailingComments, literal.loc, literal.range); } isContractible() { return false; } isOneStepPossible() { return false; } contract() { throw new Error('Method not implemented.'); } oneStep() { throw new Error('Method not implemented.'); } substitute(_id, _value) { return this; } freeNames() { return []; } allNames() { return []; } rename(_before, _after) { return new StepperLiteral(this.value, this.raw, this.leadingComments, this.trailingComments, this.loc, this.range); } } exports.StepperLiteral = StepperLiteral; //# sourceMappingURL=Literal.js.map