Hello all, I´m doing parser for fixed width with instaparse and the code is
(->>
((insta/parser
"VALOR = CODIGO BARRAS
CODIGO = 2DIGIT
BARRAS = 3DIGIT
" :input-format :abnf) "12334")
(insta/transform {:DIGIT (comp str)}))
How do I concat the "DIGITs" and keep CODIGO and BARRAS?@fabrao try adding transform entries for :CODIGO (partial apply str) :BARRAS (partial apply str)
@aengelberg it did not work, this keep showing [:VALOR [:DIGIT "1"]:DIGIT2 [:DIGIT "3"][:DIGIT "3"]:DIGIT4]
I had to change to
((insta/parser
"VALOR = CODIGO BARRAS
CODIGO = #'.{3}'
BARRAS = #'.{2}'
") "12334")