Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two parsers with same encoding #31

Closed

Conversation

tmende
Copy link

@tmende tmende commented Aug 16, 2018

When instantiating two parsers with the same encoding, I get the following error, which is fixed by this pull request

        throw Parser.errors.invalidCharacter(chunk.charAt(index), index);
        ^

Error: Invalid character a at position 104
    at Object.invalidCharacter (sample/node_modules/edifact/parser.js:231:12)
    at Parser.write (sample/node_modules/edifact/parser.js:204:29)
    at Object.parse (sample/parser/sample.js:90:10)
    at sample (sample/test/helper/dumper.js:15:17)
    at Command.program.command.action (sample/test/helper/dumper.js:37:32)
    at Command.listener (sample/node_modules/commander/index.js:315:8)
    at emitTwo (events.js:126:13)
    at Command.emit (events.js:214:7)
    at Command.parseArgs (sample/node_modules/commander/index.js:651:12)
    at Command.parse (sample/node_modules/commander/index.js:474:21) 

@@ -39,6 +39,7 @@ Tokenizer.prototype.configure = function (configuration) {

if (Tokenizer.cache.contains(configuration.toString())) {
this._regexes = Tokenizer.cache.get(configuration.toString());
this.alphanumeric();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this is important to initialize the Tokenizer. But since it is not dependent on the if condition, shouldn't it be moved out of the if/else statement altogether?

@tdecaluwe tdecaluwe force-pushed the development branch 7 times, most recently from 152c037 to 3863dca Compare November 11, 2020 05:52
@tdecaluwe tdecaluwe closed this Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants