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.MaxRecursionLevelspecifying the maximum tolerated recursion level.Lexed.MinLenspecifying the minimum expected length of the lexed token.FragPrintOptions.Formatspecifying the formatting of a parse-tree node (optionally both header and body).
Changed
Lexed.Fnchanged its type tofunc(index uint, cursor llparser.Cursor) bool.
Removed
FragPrintOptions.HeadFmtwas replaced by the newFragPrintOptions.Formatoption.
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) errorwas added to allow for manual recursive pattern validation.
Changed
- Pattern
Lexedmust now be passed as a pointer. - Pattern
Exactmust now be passed as a pointer. - Pattern
Repeatedmust now be passed as a pointer. NewParsernow takesgrammar *RuleanderrGrammar *Ruleparameters and returns(*Parser, error)returning an error in case of invalid grammars.(pr *Parser) Parsenow 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
PrintFragmentnow takesFragPrintOptionsas the second parameter.
Fixed
- Endless recursion on right-recursive grammars was fixed by making the parser check for EOF before parsing terminals.
PrintFragmentnow 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
Repeatedwas added to replace the removed patterns.
Changed
Removed
- The pattern
ZeroOrMorewas removed. - The pattern
OneOrMorewas removed. - The pattern
Optionalwas 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.Parsenow takes an additional parametererrRule *Rulewhich defines the error-rule
which the parser tries to match before returning a genericErrUnexpectedTokenerror.Parser.Parsenow takes*SourceFileas the first parameter instead ofLexer.- The pattern
TermExactwas renamed toExact.
Removed
- The
Lexerinterface was removed. - The pattern
Termwas removed. - The pattern
Checkedwas removed. Scanneris no longer an exported type.- The field
ErrUnexpectedToken.Actualwas removed. - The package
miscwas removed.
v0.2.0
Added
- Added a new pattern
Lexedto allow instructing the lexer to lex a particular sequence of characters specified by the grammar.
Changed
llparser.SourceFile.Srcis now of type[]runeinstead ofstring.llparser.Fragment.Srcnow returns[]runeinstead ofstring.llparser.TermExact.Expectationis now of type[]runeinstead ofstring.llparser.Checked.Fnis now of typefunc([]rune) boolinstead offunc(string) bool.llparser.Lexer.ReadExactnow acceptsexpectation []runeinstead ofexpectation stringas its first parameter.llparser.Lexernow requires a new method to be supported by the lexer implementation:
ReadUntil(
fn func(Cursor) uint,
kind FragmentKind,
) (
token *Token,
err error,
)