- Added
parse.manyTill
- Thanks @felixSchl ** Consumes first parser until the second parser matches.
- Small optimizations.
- Fixed
not
not backtracking in certain edge cases.
- Added
parse.not(p)
as non consuming combinator that fails whenp
succeeds. - parse_lang.betweenTimes will always consume at least
min
even ifmax < min
.
- Fixed bug when
label
called on already labeled parser.
- Allow
optional
to be used with a single argument to returnnull
on fail.
- Fixed
map
.
- Fixed
ap
.
- Fixed V8 related error messaging issue.
- Improved human readable error messaging formatting.
- Really Fixed
eof
.
- Fixed
eof
- Added
late
to resolve a parser on first use.
- Added
Fantasy Land
compatibility. ** Allows directly chaining parsers using parser objectsparse.always('x').chain(...)
- Added top level
ap
andempty
andchain
. - Reversed order of incremental functions to allow currying and pipelining.
- Renamed
characters
tooneOf
. - Added
noneOf
.
- Improved performance of Error objects.
- Positions are passed an additional parameter for the rest of the stream after the consumed token.
- Made memo frame push and pop constant time.
- Fixed certain edge cases creating large stack.
- Fixed
Parser
called on existing parser being an error.
- Added node package.
- Changed pruning to be more aggressive.
- Removed
parserId
from parser since memo table is no longer a Javascript object.
- Defunctionalized the values stored in memo tables for better performance.
- Further improved tail call performance.
- Changed tail call implementation to use best performing version from: http://jsperf.com/external-tail-calls/2
- Fixed bug causing certain edge case incremental parsers to fail when used with a backtracking parser at eof.
- Fixed a bug in look and lookahead that caused them to call
cok
instead ofeok
, potential leading to incorrect behavior when used in a either.
- Updated to nu V3.0.0
- Library files now live in
dist
.
- Updated
parse.lookahead
to also restore old position. Its behavior is now to merge the old position and input into the new state.
- Changed
parse.lookahead
to merge state with old input. This is what the documentation said the parser does. - Added
parse.look
that does whatparse.lookahead
used to do. This is the same as parsec's lookahead.
- Added
enumerations
,choices
, andsequences
for combining finite streams of parsers. - Fixed
lang.betweenTimes
to work with infinite upper bound. - Added
lang.atMostTimes
to consumep
up ton
times.
- Fixed
parse_text.characters
to work with array-likes.
- Added
parse_text.characters
for selecting any from a set of characters. ** Performs in constant time vs the linearparse.choice
of characters. - Changed
parse_text.trie
to be more efficient. ** Improves performance when used with a large set of words. - Shorter and clearer error messages for tries.
- Changed incremental state empty check to better delegate to inner state instead of assuming empty rest of input means state is empty.
- Fixed
incremental
state not correctly forwarding properties to inner state.
- Fixed
incremental.provide
to be noop when providing empty stream.
- Fixed test returning function of result instead of result.
- Added module for creating incremental parsers. ** Incremental parser are be feed data incrementally and will parse as much as possible before waiting for more data. ** A single incremental parser can also be branched by feeding different input streams.
- Changed outermost continuation to only be a single level function. ** This means that any thrown errors may take place inside of the parser itself in edge cases, but this should not effect the interfaces. ** Also, parsers can now better return abrupt completions.
- Eliminated
parse.perform
since all parsers work that way now. - Added
parse.parser*
functions for easily passing success and error continuations to parsers. - Moved
runMany
running to incremental module. - Exported
tail
andtrampoline
to support recreating internal tail call logic.
- Fixed for Chrome's broken
Error.prototype.toString
preventing errors from printing anything useful.
- Added support for parsing potential invalid inputs (streams that error while evaluating). The first input element must be valid but after that, a custom parser state can be used to catch error attempting to get the next state after a token has been consumed.
- Changed
ParserState.prototype.next
to return a parser instead of the next state. This allows the next call to potentially fail and can map any errors to parser errors.
- Fixed
perform
only calling callbacks with yielded value, not state as well.
- Moved
isEmpty
and first logic onto parser state instead of usinginput
stream directly. This allows more customized behavior.
- Fixed memoization returning old values if the parser changes the input.
- Memoization now also takes the state into account for lookup.
- Changed
parse.sequence
to return last element from a set of 1 or more parser. - Added
parse.enumeration
to return stream of parser results. - Removed
parse.string
as it basically does the same thing asparse.enumeration
and the name is confusing whenparse_string.string
exists. - Removed
parse.character
as the name is confused withparse_text.character
. - Changed state getters to be actual parsers and not functions.
- Changed eof to be parser and not function.
- Removed
ParserState.prototype.eq
as it generally does not do what is expected and the logic it uses should not be exposed. - Added concept of windows to memoization to automatically prune memoized results.
- Removed
parse.backtrack
as it is not needed with windows. - Added
parse_text.match
for a character level regular expression test. - Added both array and argument versions of parsers that take a variable number
of parsers,
choice and choicea, sequence and sequencea, enumeration and enumerationa
- Refactored
parse_text.string
to generally improve performance.
- Updated nu
- Fixed
trie
to always match longest and possibly backtrack and added trie tests.
- Small formatting changes, updated Nu to V2.0.5.
- Fixed trie khepri related issue.
- Removed 'parse_eager' module and replaced it with 'parse.eager' parser. ** 'parse.eager' takes a parser and flattens resulting stream into an array.
- Added 'parse_lang' module for language type parsers. ** 'times', 'betweenTimes', 'sepBy', 'sepBy1', 'between', and 'then' and then parsers all moved to 'parse_lang.'
- Added 'sepEndBy', 'sepEndBy1', 'endBy', 'endBy1', 'chainr1', 'chainr', 'chainl1', 'chainl' parsers to 'parse_lang' to bring more in line with parsec.
- Renamed 'binda' 'binds'.
- Added 'perform' running function for simple, direct callbacks instead of the two levels 'exec' uses.
- 'betweenTimes'and 'choice' throw 'ParserError' on construction if bad params supplied instead of at runtime.
- 'anyToken' is object again instead of function.
- 'Added ids to string character type parsers and 'anyToken'.
- Added 'Position.initial' object for initial position instead of 'new Position(0)'.
- Clarified that 'parse.sepBy' should not backtrack.
- Added 'parse.then' as opposite of 'parse.next', parse p then q and return p result.
- All run and runStream type functions take an optional user data object.
- Added 'parse.expected' parser similar to <?> in parsec for better error messages. Displays an expected message when parser fails without consuming any input.
- Renamed 'InputState' to 'ParserState' ** 'ParserState.pos' renamed to 'ParserState.position'. ** 'ParserState' added 'userState' property for a user object that can be threaded though the parsers. ** 'ParserState' added methods for setting 'input', 'position', and 'userState'. Any custom 'ParserState' must implement these.
- Added parsers for getting, setting, and modifying input, position, parser state, and user state.
- Ensured that all parsers are functions ('anyToken' was the parser itself before).
- Made 'parse_string.string' and 'parse_string.trie' parsers all or nothing. ** 'parse_string.string' produces better error messages detailing entire error.
- 'parse.token' onError also called for end of input
- Fixed 'MultipleError' and 'ParserError' not being exported.
- Made choice defer merging errors until needed.
- Fixed 'choice' discarding memo table and state.
- Added new error object, 'ParserError' for errors with the parsers themselves. Used by 'many' when passed infinite parser.
- Renamed 'consParser' to 'cons' and 'concatParser' to 'append'.
- 'choice' parser now flattens errors into a single 'MultipleError'. Before it returned nested 'MultipleError's.
- 'MultipleError' now takes two arguments, a position and an array of errors. This makes calling easier since Javascript does not support new with vargs well and also allows the position of the error to differ from the errors it contains.
- Creating named parsers with 'parse.Parser' now works correctly when passed an existing named parser. Before it would throw an error strict mode or worse, mutate the object silently. Now it wraps the parser in a named parser.
- Update to Nu 2.0.0
- Reworked error constructors. Should be more flexible and delay string conversion as long as possible. ** 'ParseError' takes a message instead of an array of messages. ** 'ParseError' calls 'errorMessage' to get the message to display. ** 'ExpectError' takes two params, the expected value and an optional found value. these may be objects. ** 'UnexpectError' takes an unexpected value. This may be an object. ** 'MultipleError' takes one or more errors instead of just two.
- Builtin error messages have clearer message formatting.
- Never allows an optional 'msg' value. If message is not provided, throws 'UnknownError'. Otherwise throws a ParseError with 'msg'.
- Fixed 'MultipleError' only listing the last error.
- 'parse.token' takes on optional 'err' function to generate the error when consume fails.
- 'eof' also reports found item on expected error.
- 'eof' uses correct stream operations.
- 'binda' no longer passes state.
- Updated parse_string parsers to produce better error messages that include expected and found token.
- Corrected string unboxing in parse_string. Now uses valueOf.
- Fixed calls to 'Position' in 'run' using old style arguments.
- Changed 'Position' to use compare instead of simple equals.
- Position changed to use array index only instead of assuming string input.
- 'binda' calls 'f' with state as last argument.
- Altered how multiple errors are displayed. Errors should now be joined together correctly.
- Fixed error in 'sepBy' with trailing sep.
- Improved 'between' perf about 2x.
- Update 'manyStream' to pass along memo table.
- Update exec to take memo table.
- Updated 'manyStream' to return memoized stream.
- Updated memo impl to not use trampoline but store values with callbacks. Should fix memo stack issues
- Refactored all parsers to allow passing a memoization table. params are now 'state, m, cok, cerr, eok, eerr'.
- Added 'memo' and 'backtrack' for working with memoization table.
- Changed position to be a prototyped object. Must be called with 'new' now. Position can be subclassed now.
- Added state and pos equality tests.
- Renamed 'RecParser' to 'rec' and 'NamedRecParser' to 'RecParser' to make their purposes more clear.
- Changed 'token' to use own error type to avoid string building until needed.
- Changed 'choice' and 'string' to use reduceRight instead of reduce. Should improve performance when dealing with many choices and larger inputs.
- Renamed 'runParser' to 'runState' and 'testParser' to 'testState'.
- Exported 'exec' for cleanly manually running a parser and correctly extracting the results.
- Added 'runMany' for running a parser zero or more times to produce a lazy stream of results.
- Changed how 'optional' parser works. It returns a value, not a stream. May return a default value as well.
- Exported 'consParser' for working with streams.
- Exported 'concatParser' for working with streams.
- Updated to use stream.js for iterative parsers. Should improve performance for large inputs.
- Added set of eager iterative parsers that transform streams into finite arrays before returning.
- Token parser calls 'state.next' instead of creating new InputState itself. Allows InputState to be subclassed and other implementations passed in when running a parser.
- Added 'binda' parser that calls apply 'f' with result of 'p'.
- Use 'parse' package to access to parse and parse_string.
- Added 'sequence' parsing a finite sequence of different parsers.
- Added 'sepBy', 'sepBy1' for parsing list or infix operator type input.
- Renamed exported 'char' parser 'character' because ECMAScript 3 reserves char keyword.
- Added 'parse_string.trie' parser for parsing large sets of words.
- Moved Parse string specific parsers to own file to better separate when string input is assumed.
- 'parse.char' and 'parse.string' do strict equal. Also can be given own predicate compare. Does not convert to string.
- 'parse_string.char' and 'parse_string.string' have old logic, unboxing string objects for comparison.
- Renamed 'Parser' constructor 'RecParser'.
- Added new 'Parser' constructor for creating named parsers. Also, 'NamedRecParser'.
- Rewrote 'betweenTimes' parser.
- Updated implementation of consume multiple parsers.
- Constant parsers (letter, space, ... ) use object instead of constant function.
- Added anyToken parser that accepts any token. Different in behavior than anyChar.
- Added 'test' to test if a parser succeeds or fails for a given input.
- Added 'optional' parser to consume item zero or one time.
- Added 'betweenTimes' parser to consume item between a min and max times.
- Fixed creating String objects instead of string literals.
- Added stream style input.
- Added runStream function for parsing streams.
- Fixed 'char' when passing in string Objects.
- Fixed 'eof' negation.
- Added 'Parser' function for defining parsers recursively.
- Fixed stack size for large inputs and recursive parsers.
- Cleanup implementation.
- Performance improvements.
- Initial Release