stringLiteral.js 365 B

12345678910111213141516171819
  1. import { Literal } from './literal';
  2. import { Types } from './../../typeSystem/types';
  3. export class StringLiteral extends Literal {
  4. constructor(value) {
  5. super(Types.STRING);
  6. this.value = value;
  7. }
  8. toString() {
  9. const text = '"' + this.value + '"';
  10. if(this.parenthesis) {
  11. return `(${text})`;
  12. } else {
  13. return text;
  14. }
  15. }
  16. }