aboutsummaryrefslogtreecommitdiff
path: root/compiler.d
diff options
context:
space:
mode:
Diffstat (limited to 'compiler.d')
-rw-r--r--compiler.d14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler.d b/compiler.d
index 66ee664..ecd7785 100644
--- a/compiler.d
+++ b/compiler.d
@@ -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;