~ecs/hare.lua

0dbc519f11e78208839dc23dc8e673e202cfaa59 — Haelwenn (lanodan) Monnier 3 months ago b1c56f3
Add support for string literals
1 files changed, 4 insertions(+), 1 deletions(-)

M hare.lua
M hare.lua => hare.lua +4 -1
@@ 50,7 50,10 @@ local escape_sequence = named_escape
	+ '\\u' * hex_digit * hex_digit * hex_digit * hex_digit
local rune = escape_sequence + l.nonnewline_esc-S("\\'")
local string_char = escape_sequence + l.nonnewline_esc-S('\\"')
local string = token(l.STRING, "'" * rune * "'" + '"' * string_char^0 * '"')
local sq_str = "'" * rune * "'"
local dq_str = '"' * string_char^0 * '"'
local bt_str = l.delimited_range('`', false, true)
local string = token(l.STRING, sq_str + dq_str + bt_str)

-- TODO: highlight size correctly both as keyword and type
local type = token(l.TYPE, word_match{