0.3.2 / 2012-09-16

0.3.1 / 2012-07-26

Fix: corrupted result when addrule(number|firsOf) return an empty token

0.3.0 / 2012-07-10

Cleanups

deleteRuleSet() -> removeRuleSet()

loadProps() -> setProps(): all or a subset of properties are returned

escaped() -> escape()

renamed internal properties with a leading _

offsetBuffer -> markedOffset

Deprecated

saveProps(): use getProps() to retrieve all properties

existsRule()

getAllRuleSet()

bytesRead property

seek(): use the offset property directly

ruleIndex is now private (_ruleIndex) and may not be systematically updated during parsing

Boolean subrules in addRule(): set the handler/type to false to get the same behaviour

addRule(0): use the [empty] event (NB. addRule(..., 0, ...)) is still supported.

Internals

Use of Node's StringDecoder for utf-8 encoding

Better compliance with Nodejs Stream API:

writable and readable properties are set to false after an error, end() and destroy()

The buffer is always truncated from min(offset, markedOffset) to try and minimize memory usage

.continue(-1).ignore(true).next().addRule(subrule, handler) are optimized with a while()

Features

getProps() returns all current properties

continue(string|function): resolution automatically performed on saveRuleSet() and write(). This means that stricter checks are imposed:

continue(+x) with x>=0 cannot be set on the last rule

continue(-x) with x<-1 cannot be set on the first rule

Infinite loop detection. Cannot detect rule handlers changing the offset property to the one before the rule execution.

Added slice([startIndex[, endIndex]]): returns a slice of the buffer. NB. the buffer is not altered.

Added groupRule(boolean): bind the following rules to the same index (useful for writing helpers and make them behave as a single rule). Groups can be set at any level. Empty or 1 rule groups are ignored.

addRule(function) is now considered a successful rule

If the last argument to addRule() is false, the rule is ignored

Subrule { firstOf: (string|array) } accepts a string as well as an array

0.2.6 / 2012-05-23

Fix: addRule(null) throws an error

Fix: addRule([1,2]) returns proper token

Fix: first rule validation enforced (waits for more data if required, which means rules starting with an array of numbers is equivalent to a rule with the max of those numbers: addRule([1,2]) <=> addRule(2))

0.2.5 / 2012-05-11

Added offsetBuffer property: when set to a positive value, the buffer is not sliced when write() ends.
Use with caution as this can make the buffer continuously grow.

Added currentRule property: name of the current rule set, getRuleSet() is deprecated

New split(flag) property: split token by subrules. No effect if # of subrules is < 3.

New debug option: emits the [debug] event if set to true or trigger the given function for debugging purposes. Note that thanks to dynamic method setting, this has absolutely no impact on performance if not set!

0.1.9 / 2012-02-20

continue() supports string and function input - must perform a saveRuleSet() to take effect

Some refactoring

Array.prototype.slice calls

Rule index internal fetching

0.1.8 / 2012-02-12

clearProps() reset properties to their default values

saveProps() -> saveProps(name) with name=default if not set

0.1.7 / 2012-02-12

addRule(rule, 123) fixed when used with quiet(true)

continue() applied when a handler uses pause()

write() will continue at the last rule index if the last successful rule was subject to continue()

next() and ignore() can now be applied to addRule(0) - note that continue() cannot