Releases: romshark/llparser
v0.8.0
This release introduces improved performance for the Lexed
pattern, improved parse-tree formatting options and the new recursion control feature which allows limiting the maximum level of recursion when parsing, hence avoiding runtime panics.
Added
Parser.MaxRecursionLevel
specifying the maximum tolerated recursion level.Lexed.MinLen
specifying the minimum expected length of the lexed token.FragPrintOptions.Format
specifying the formatting of a parse-tree node (optionally both header and body).
Changed
Lexed.Fn
changed its type tofunc(index uint, cursor llparser.Cursor) bool
.
Removed
FragPrintOptions.HeadFmt
was replaced by the newFragPrintOptions.Format
option.
Fixed
- Fixed a few small documentation issues.
v0.7.0
This release improves reliability by automatically validating the grammar during the parser's initialization.
Added
ValidatePattern(ptr Pattern) error
was added to allow for manual recursive pattern validation.
Changed
- Pattern
Lexed
must now be passed as a pointer. - Pattern
Exact
must now be passed as a pointer. - Pattern
Repeated
must now be passed as a pointer. NewParser
now takesgrammar *Rule
anderrGrammar *Rule
parameters and returns(*Parser, error)
returning an error in case of invalid grammars.(pr *Parser) Parse
now takes only one parameter:source *SourceFile
.
v0.6.0
v0.5.0
This release ships a new example (boolean expression parser), bug-fixes, performance improvements and an improved fragment printer implementation allowing the user to specify printing prefixes, custom line-breaks and custom token-header formatting functions.
Added
- A new boolean expression parser example was added.
Changed
PrintFragment
now takesFragPrintOptions
as the second parameter.
Fixed
- Endless recursion on right-recursive grammars was fixed by making the parser check for EOF before parsing terminals.
PrintFragment
now uses spaces instead of line-breaks when indentation is disabled.
v0.4.0
This release improves and simplifies the API introducing the Repeated
pattern (#10) replacing the removed ZeroOrMore
, OneOrMore
and Optional
patterns.
Added
- A new pattern
Repeated
was added to replace the removed patterns.
Changed
Removed
- The pattern
ZeroOrMore
was removed. - The pattern
OneOrMore
was removed. - The pattern
Optional
was removed.
Fixed
- A parser-bug in example/dicklang was fixed.
v0.3.0
This release improves and simplifies the API and introduces error-rules to allow users to associate specific patterns with specific errors returned by the parser to improve the error reporting quality (#8). The lexer is now a built-in part of the parser, implementing a custom Lexer
is no longer possible, Lexed
should be used instead.
Changed
Parser.Parse
now takes an additional parametererrRule *Rule
which defines the error-rule
which the parser tries to match before returning a genericErrUnexpectedToken
error.Parser.Parse
now takes*SourceFile
as the first parameter instead ofLexer
.- The pattern
TermExact
was renamed toExact
.
Removed
- The
Lexer
interface was removed. - The pattern
Term
was removed. - The pattern
Checked
was removed. Scanner
is no longer an exported type.- The field
ErrUnexpectedToken.Actual
was removed. - The package
misc
was removed.
v0.2.0
Added
- Added a new pattern
Lexed
to allow instructing the lexer to lex a particular sequence of characters specified by the grammar.
Changed
llparser.SourceFile.Src
is now of type[]rune
instead ofstring
.llparser.Fragment.Src
now returns[]rune
instead ofstring
.llparser.TermExact.Expectation
is now of type[]rune
instead ofstring
.llparser.Checked.Fn
is now of typefunc([]rune) bool
instead offunc(string) bool
.llparser.Lexer.ReadExact
now acceptsexpectation []rune
instead ofexpectation string
as its first parameter.llparser.Lexer
now requires a new method to be supported by the lexer implementation:
ReadUntil(
fn func(Cursor) uint,
kind FragmentKind,
) (
token *Token,
err error,
)