ebnf-railroad-visualizer
Version:
A web-based EBNF railroad diagram visualizer
23 lines • 735 B
JavaScript
/*
* This work © 2024 by Alexander Voglsperger is licensed under CC BY 4.0.
* To view a copy of this license, see the provided LICENSE file or visit https://creativecommons.org/licenses/by/4.0/
*/
import { Sym } from "../scannerparser/Sym.js";
/**
* An identifier is a TS defined as a sequence of atomic letters:
*
* `IDENTIFIER = letter { letter } .`
*/
export class Identifier extends Sym {
constructor(letters, id = -1) {
if (letters.length === 0) {
throw new Error("An identifier must have at least one letter");
}
super(letters.join(""), id);
this.letters = letters;
}
toString() {
return this.letters.join("");
}
}
//# sourceMappingURL=Identifier.js.map