package
1.5.0
Repository: https://github.com/paulsonkoly/calc.git
Documentation: pkg.go.dev

# Functions

Accept asserts the next token given a predicate p on a lexer Token, parses successfully if the predicate is true for the next token provided by l, and then returns the node holding that token.
And is sequencing two parsers Parses with a and then continues parsing with b.
Any parses with 0 or more execution of a It tries parsing with predicate and if that succeeds it commits to go one more step with success.
Assert asserts the given parser p would succeed without consuming input.
Choose is a choice between many parsers It uses Conditionals, asserting that the Gate succeeds and if so it commits to parsing with OnSuccess part of choice.
Drop drops the result of p.
Fmap maps f : []Node -> []Node function on parser p.
No description provided by the author
Not asserts that the given parser p will fail.
Ok is a parser that doesn't do anything just returns a successful parse result.
OneOf is a choice between many parsers It tries each parser in turn, rolling back the input after each failed attempt It is meant to be used with terminal rules only, for complex language rules prefer Choose because it gives much closer syntax errors to the actual error location.
SeparatedBy parses with a sequence of a, separated by b.
Seq is sequencing many parsers Parses with a sequence of parsers, returns the concatenated result from all if all are successful.
SurroundedBy parses with a sequence of a, b, c but returns the parse result of b only It fails if any of a, b, c fails.

# Structs

Conditional is a pair of parsers.
Error indicates an error in the input source code.

# Interfaces

Lexer produces a stream of tokens.
No description provided by the author
Token represents a lexeme from a lexer.
TokenWrapper wraps a token in a single AST node containing the token.
It's expected to be stack based just like a database transaction.

# Type aliases

Node is an AST node, with pointers to sub-tree nodes and potentially some parse information data.
Parser accepts input and returns sequence of parsed nodes or error.