Skip to content

Commit

Permalink
Allow control character to be used as an component separator (GH-189)
Browse files Browse the repository at this point in the history
  • Loading branch information
kputnam committed May 28, 2019
1 parent 8a63cb0 commit c1d35ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/stupidedi/reader/stream_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ def read_segment
# it is not terminated by an element separator. The {read_character}
# method defined by TokenReader skips past control characters.
remaining.flatmap do |w|
w.read_character.flatmap do |isa16, cR|
w.stream.read_character.flatmap do |isa16, cR|
elements << SimpleElementTok.build(isa16, w.input, cR.input)

# The character after the last element is defined to be the
# segment terminator. The {read_character} method here, defined
# by StreamReader, does not skip past control character, so the
# separator could be a control character.
cR.stream.read_character.flatmap do |char_, dR|
cR.read_character.flatmap do |char_, dR|
if char_ == separators.element
failure("element separator and segment terminator must be distinct", dR.input)
else
Expand Down
6 changes: 6 additions & 0 deletions spec/fixtures/004010/QM214/pass/gh-189.edi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ISA00 00 ZZ0607047800010GBZZBLIT_T 1905072217U004010000008931T
GSQMFEDEXBLIT201905072217914X004010
ST21460810001
SE1960810001
GE1914
IEA1000000893
2 changes: 1 addition & 1 deletion spec/lib/stupidedi/parser/builder_dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ def config(details, version = "005010")
end
end

fcontext "composite" do
context "composite" do
context "when element is missing" do
let(:b) do
strict(Detail("2", Segment(10, COS(), s_mandatory, bounded(1))))
Expand Down

0 comments on commit c1d35ed

Please sign in to comment.