diff --git a/examples/nolol/loops_test.yaml b/examples/nolol/loops_test.yaml index 89fdd35..657e8dc 100644 --- a/examples/nolol/loops_test.yaml +++ b/examples/nolol/loops_test.yaml @@ -3,11 +3,5 @@ scripts: cases: - name: draw outputs: - out: | - XXXXXX - X0000X - X0000X - X0000X - X0000X - XXXXXX + out: "XXXXXX\\nX0000X\\nX0000X\\nX0000X\\nX0000X\\nXXXXXX\\n" out2: 5 diff --git a/pkg/parser/ast/tokenizer.go b/pkg/parser/ast/tokenizer.go index 75d62f3..ad7424a 100644 --- a/pkg/parser/ast/tokenizer.go +++ b/pkg/parser/ast/tokenizer.go @@ -313,30 +313,9 @@ func (t *Tokenizer) getStringConstant() (*Token, int) { if len(t.remaining) < 2 || t.remaining[0] != '"' { return nil, 0 } - escaped := false + str := "" for i, b := range t.remaining[1:] { - if b == '\\' { - escaped = true - continue - } - if escaped { - switch b { - case 'n': - str += "\n" - escaped = false - continue - case 't': - str += "\t" - escaped = false - continue - case '"': - str += "\"" - escaped = false - continue - } - } - if b == '"' { return t.newToken(TypeString, str), i + 2 } diff --git a/pkg/parser/ast/tokenizer_test.go b/pkg/parser/ast/tokenizer_test.go index 4e7b8ee..545f5dc 100644 --- a/pkg/parser/ast/tokenizer_test.go +++ b/pkg/parser/ast/tokenizer_test.go @@ -16,7 +16,7 @@ func TestTokenizer(t *testing.T) { i++ a = 0 and 1 // comment 2 - :var = "another\"test" + :var = "another--test" :foo = (1+2.75)*3 :_=1 ` @@ -101,7 +101,7 @@ func TestTokenizer(t *testing.T) { Line: 9, Coloumn: 6, Type: Whitespace, Value: ' ' Line: 9, Coloumn: 7, Type: Symbol, Value: '=' Line: 9, Coloumn: 8, Type: Whitespace, Value: ' ' - Line: 9, Coloumn: 9, Type: String, Value: 'another"test' + Line: 9, Coloumn: 9, Type: String, Value: 'another--test' Line: 9, Coloumn: 24, Type: Newline Line: 10, Coloumn: 1, Type: Whitespace, Value: ' ' Line: 10, Coloumn: 2, Type: ID, Value: ':foo'