@@ 7,7 7,7 @@ local P, R, S = lpeg.P, lpeg.R, lpeg.S
local M = {_NAME = 'hare'}
local builtin = token(l.FUNCTION, word_match{
- 'len', 'offset', 'free', 'alloc', 'assert',
+ 'len', 'offset', 'free', 'alloc', 'assert', 'append'
})
local comment = token(l.COMMENT, '//' * l.nonnewline_esc^0)
@@ 21,7 21,7 @@ local identifier = token(l.IDENTIFIER, l.word)
local keyword = token(l.KEYWORD, word_match{
'let', 'const', 'fn', 'def', 'static', 'export', 'defer', 'for',
'while', 'return', 'break', 'continue', 'if', 'else', 'match',
- 'switch',
+ 'switch', 'type'
})
local operator = token(l.OPERATOR, word_match{
@@ 37,7 37,6 @@ local integer_constant = (P("0x") * hex_digit^1
+ P("0o") * R("07")^1
+ P("0b") * R("01")^1
+ R("09")^1) * integer_suffix^-1
--- TODO: write spec for floating-constant
local number = token(l.NUMBER, integer_constant)
local preproc = token(l.PREPROCESSOR,