File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1160,7 +1160,14 @@ function Headers(s::AbstractString)
11601160end
11611161
11621162function line_to_items (line)
1163- items = split (line, " " ; keepempty = false )
1163+ # Split on any whitespace characters. We can't split only on `' '` because
1164+ # at least one models in MIPLIB has `\t` as a separator.
1165+ #
1166+ # This decision assumes that we are parsing a free MPS file, where
1167+ # whitespace is disallowed in names. If this ever becomes a problem, we
1168+ # could change to the fixed MPS format, where the files are split at the
1169+ # usual offsets.
1170+ items = split (line, r" \s " ; keepempty = false )
11641171 return String .(items)
11651172end
11661173
Original file line number Diff line number Diff line change @@ -1703,6 +1703,16 @@ function test_issue_2792()
17031703 return
17041704end
17051705
1706+ function test_issue_2797_tab ()
1707+ @test MPS. line_to_items (" a b" ) == [" a" , " b" ]
1708+ @test MPS. line_to_items (" a b" ) == [" a" , " b" ]
1709+ @test MPS. line_to_items (" a\t b" ) == [" a" , " b" ]
1710+ @test MPS. line_to_items (" a\t b" ) == [" a" , " b" ]
1711+ @test MPS. line_to_items (" a\t b" ) == [" a" , " b" ]
1712+ @test MPS. line_to_items (" a \t b c " ) == [" a" , " b" , " c" ]
1713+ return
1714+ end
1715+
17061716end # TestMPS
17071717
17081718TestMPS. runtests ()
You can’t perform that action at this time.
0 commit comments