Skip to content

Commit

Permalink
Add ParseQueryWithLimit (#304)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Coffman <steve@khanacademy.org>
  • Loading branch information
StevenACoffman authored Jun 12, 2024
1 parent d457fc0 commit 36a3658
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion parser/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import (
func ParseQuery(source *Source) (*QueryDocument, error) {
p := parser{
lexer: lexer.New(source),
maxTokenLimit: 0, // 0 is the default value
maxTokenLimit: 0, // 0 means unlimited
}
return p.parseQueryDocument(), p.err
}

func ParseQueryWithTokenLimit(source *Source, maxTokenLimit int) (*QueryDocument, error) {
p := parser{
lexer: lexer.New(source),
maxTokenLimit: maxTokenLimit,
}
return p.parseQueryDocument(), p.err
}
Expand Down

0 comments on commit 36a3658

Please sign in to comment.