diff --git a/src/main.cpp b/src/main.cpp index 4e6f536..e4cda98 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -212,7 +212,6 @@ namespace HighGround { GroundInstruction gi3 = groundCreateInstruction(CREATELABEL); groundAddReferenceToInstruction(&gi3, groundCreateReference(LABEL, labelId.data())); codeBlock.code.push_back(gi3); - codeBlock.code.push_back(groundCreateInstruction(PAUSE)); code.push_back(codeBlock); break; } @@ -525,9 +524,29 @@ namespace HighGround { current = 0; std::vector tokens; std::string buf; + bool inString = false; while (auto copt = consume()) { char c = copt.value(); + if (inString) { + buf.push_back(c); + if (c == '"') { + tokens.push_back(buf); + buf.clear(); + inString = false; + } + continue; + } switch (c) { + // double quotes are special + case '"': { + if (!buf.empty()) { + tokens.push_back(buf); + buf.clear(); + } + buf.push_back(c); + inString = true; + break; + } // tokens which are not followed by anything case '\n': case '(': diff --git a/tests/data.hg b/tests/data.hg index 79332ec..c034a30 100644 --- a/tests/data.hg +++ b/tests/data.hg @@ -3,3 +3,5 @@ puts 432 puts 3.141 puts 'c' puts true + +puts "now we have proper string lexing!!!!!11!!@!2!1@1@12!!!112!@" diff --git a/tests/if.hg b/tests/if.hg index ee6ca87..ebea1a3 100644 --- a/tests/if.hg +++ b/tests/if.hg @@ -1,4 +1,4 @@ -if true { +if 1 == 1 { puts "huzzah" }