From 2eab5877e1c634db872b595dd2414f4031ae4eb5 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 13 Nov 2023 09:34:56 +0100 Subject: parser: initial support for type declarations. The parsing logic for type declarations is there. Note that no tokens are produced, only symbols. The different type kinds will be added next. --- parser/interpreter_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'parser/interpreter_test.go') diff --git a/parser/interpreter_test.go b/parser/interpreter_test.go index edb6b0d..3a5598e 100644 --- a/parser/interpreter_test.go +++ b/parser/interpreter_test.go @@ -164,6 +164,17 @@ func TestSwitch(t *testing.T) { }) } +func TestType(t *testing.T) { + run(t, []etest{ + {src: "type t int; var a t = 1; a", res: "1"}, + {src: "type t = int; var a t = 1; a", res: "1"}, + {src: `type ( + I int + S string +); var s S = "xx"; s`, res: "xx"}, + }) +} + func TestVar(t *testing.T) { run(t, []etest{ {src: "var a int; a", res: "0"}, -- cgit v1.2.3