textiles-lab / fenced-tangle-supplemental

14 stars 3 forks source link

Carrier names containing semicolons not correctly parsed by `k2f.mjs` #9

Open t0mpr1c3 opened 10 months ago

t0mpr1c3 commented 10 months ago

e.g. on the patched version in commit e472b86

;!knitout-2
;;Carriers: 1 2 ; 4 5
in 1
in 2
in ;
in 4
in 5
knit - f0 1 2 ; 4 5

gives

...
Carrier names were not integers in order, so using position-based remapping.
Carrier names map to yarn numbers as follows:
  '1' -> 1
  '2' -> 2
  ';' -> 3
  '4' -> 4
  '5' -> 5
test1.k:5: ERROR: Can't bring in no carriers
ixchow commented 10 months ago

I would argue that this is working as intended. It is valid to have a carrier named with a semicolon, but you obviously can't use it in an operation since instructions are split at ; into the instruction and comment parts! :-)

Probably I should have thought this through a bit more in the issue thread over on the knitout repository. But I still maintain that this is correct behavior. The specification makes it clear that the comment part of a line starts at the first ';' in that line and is not part of the operation.