diff options
Diffstat (limited to 'compiler.d')
| -rw-r--r-- | compiler.d | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -99,6 +99,17 @@ class Compiler { */ } + void compileString(Form form, ValueType expecting) { + LiteralString ls = cast(LiteralString)form; + + this.func.chunk.writeOp(OpCode.OP_CONSTANT, ls.line); + String str = new String(ls.value); + int idx = this.func.chunk.addConstant(makeSeqValue(str)); + this.func.chunk.writeOp(to!ubyte(idx), ls.line); + + this.advance(); + } + void compileAtom(Form form, const ValueType expecting) { Atom atom = cast(Atom)form; /* @@ -719,6 +730,9 @@ class Compiler { case FormType.ATOM: this.compileAtom(form, expecting); break; + case FormType.LITERALSTRING: + this.compileString(form, expecting); + break; case FormType.CONS: return this.compileCons(form, expecting); break; |
