Skip to content

Commit

Permalink
Pre-compiled parsers for all types.
Browse files Browse the repository at this point in the history
Closes #122.
  • Loading branch information
flatheadmill committed Jul 13, 2013
1 parent 1773b0c commit b5d6ee3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions index.js
Expand Up @@ -201,7 +201,6 @@ function Definition (context, packets, transforms, options) {
// moving the `start`, we give up on trying to have nice fixed numbers.
var offset = 0;
pattern.forEach(function (field, index) {
if (!/^(x|n|f)$/.test(field.type)) throw new Error;
if (field.lengthEncoding) return;
if (field.endianness == 'x') {
fix();
Expand Down Expand Up @@ -333,8 +332,7 @@ function Definition (context, packets, transforms, options) {
if (parsed.every(function (part) {
return ! part.alternation &&
! part.packing &&
! part.pipeline &&
/^(n|f)$/.test(part.type)
! part.pipeline
})) {
precompile(parsed);
}
Expand Down

0 comments on commit b5d6ee3

Please sign in to comment.