From 6dd78f44adf6fb032d0ecd9db813651b9524fcac Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Wed, 6 Sep 2023 08:49:19 +0200 Subject: chore: refactor some APIs The scanner returns a slice of pointers to tokens instead of a slice of tokens. The parser now pass the initial node context. --- scanner/scan_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scanner/scan_test.go') diff --git a/scanner/scan_test.go b/scanner/scan_test.go index bdd3176..41ee62e 100644 --- a/scanner/scan_test.go +++ b/scanner/scan_test.go @@ -79,7 +79,7 @@ func TestScan(t *testing.T) { } } -func tokStr(tokens []Token) (s string) { +func tokStr(tokens []*Token) (s string) { for _, t := range tokens { s += fmt.Sprintf("%#v ", t.content) } @@ -155,4 +155,7 @@ def"`, }, { // #21 src: `println("in f")`, tok: `"println" "(\"in f\")" `, +}, { // #22 + src: "a, b = 1, 2", + tok: `"a" "," "b" "=" "1" "," "2" `, }} -- cgit v1.2.3