Commit Graph

2 Commits

Author SHA1 Message Date
Bob Nystrom
cc55fd2a57 feat: implement string escape sequence parsing in lexer and add test coverage
Add escape sequence handling to the string literal lexer in compiler.c, translating
common escape sequences (\", \\, \n) into their literal character equivalents during
tokenization. Introduce a fixed-size buffer (MAX_STRING 1024) in the Parser struct to
accumulate the unescaped string content, along with a helper function addStringChar()
to append characters. The readString() function now loops over input characters,
breaking on an unescaped double quote, and processing backslash-prefixed escapes via
a switch statement. Remove the previous TODO placeholder comment and the elapsed time
computation simplification in benchmark/fib.lua. Add a new test file
test/string_escapes.wren that verifies the three supported escape sequences, and
remove the now-obsolete TODO about escapes from test/string_literals.wren.
2013-11-24 05:00:47 +00:00
Bob Nystrom
6e8b5a2861 feat: add initial string literal tests covering empty and basic strings
Add a new test file `test/string_literals.wren` with two test cases: one for
empty string length (expecting 0) and one for basic string output (expecting
"a string"). Includes a TODO comment for future escape sequence tests.
2013-10-28 13:45:19 +00:00