~ecs/hare.lua

0b0e2639e9c7eb376d972d95280d6f48ff889477 — Ember Sawady 3 years ago c38dfc8
Add type keyword and append builtin
1 files changed, 2 insertions(+), 3 deletions(-)

M hare.lua
M hare.lua => hare.lua +2 -3
@@ 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,