add basic support for tuples

This commit is contained in:
Neemek 2026-07-11 12:37:15 +02:00
parent 7bb277045c
commit e03d18c7db
Signed by: neemek
GPG key ID: 84FFE4D7D40AB25E
7 changed files with 339 additions and 18 deletions

View file

@ -960,6 +960,31 @@ func TestParser_Parse(t *testing.T) {
}
}
func TestParser_AcceptAll(t *testing.T) {
p := NewParser("a:", []string{}, []Token{
NewToken(TokenName, 0, 1, 0, "a"),
NewToken(TokenColon, 1, 2, 0, "a"),
})
if !p.acceptAll(TokenName, TokenColon) {
t.Fatalf("tokens were not accepted")
}
t.Logf("tokens were accepted")
}
func TestParser_AcceptAll_TooFew(t *testing.T) {
p := NewParser("a", []string{}, []Token{
NewToken(TokenName, 0, 1, 0, "a"),
})
if p.acceptAll(TokenName, TokenColon) {
t.Fatalf("tokens were incorrectly accepted")
}
t.Logf("tokens were, as expected, not accepted")
}
func BenchmarkParser_Parse(b *testing.B) {
tokenData := GetTokenTestData()