realLiteral.js 440 B

1234567891011121314151617181920
  1. import { Literal } from './literal';
  2. import { Types } from './../../typeSystem/types';
  3. import { convertToString } from './../../typeSystem/parsers';
  4. export class RealLiteral extends Literal {
  5. constructor(value) {
  6. super(Types.REAL);
  7. this.value = value;
  8. }
  9. toString() {
  10. const text = convertToString(this.value, this.type);
  11. if (this.parenthesis) {
  12. return `(${text})`;
  13. } else {
  14. return text;
  15. }
  16. }
  17. }