diff --git a/package.json b/package.json index ec16341..7afacda 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "name": "edifact" -, "version": "1.2.5" +, "version": "1.2.6" , "description": "JavaScript parser for UN/EDIFACT documents." , "keywords": ["edifact", "edi", "eancom"] , "main": "index.js" diff --git a/parser.js b/parser.js index 697b948..abcccb2 100644 --- a/parser.js +++ b/parser.js @@ -114,8 +114,11 @@ Parser.prototype.write = function (chunk) { switch (this.state) { case Parser.states.empty: index = this.una(chunk) ? 9 : 0; + // If the first segment is interrupted by, for example, a line break, the + // parser will remain in the same state as it has here. Since we don't + // want the parser to detect another UNA header, in such a case, we put it + // in the segment state. this.state = Parser.states.segment; - break; case Parser.states.segment: index = this._tokenizer.segment(chunk, index); // Determine the next parser state.