Stefan,
It's a very simple mistake I've made a thousand times—you single-quoted your
newline and return in the #absent? section of :textdata, so it was trying to
match "\\n" instead of "\n". ("\\n" == '\n')
All I did to figure it out was to comment out the lines in the input after
the ones that were working (in order to exclude the trouble spot). I got:
{:row=>
[{:column=>"John"@0},
{:column=>"Doe"@5},
{:column=>"120 jefferson st."@9},
{:column=>"Riverside"@27},
{:column=>" NJ"@37},
{:column=>" 08075\nJack"@41},
{:column=>"McGinnis"@53},
{:column=>"220 hobo Av."@62},
{:column=>"Phila"@75},
{:column=>" PA"@81},
{:column=>"09119\nStephen"@85},
{:column=>"Tyler"@99},
{:column=>"\"7452 Terrace \"\"At the Plaza\"\" road\""@105},
{:column=>"SomeTown"@142},
{:column=>"SD"@151},
{:column=>" 91234\n"@154}]}
And that let me know that the unquoted record value was consuming newlines
when it shouldn't be.
Best of luck!
Jason
On Thu, Aug 4, 2011 at 6:12 PM, Stefan Rohlfing
<[email protected]>wrote:
> Hi,
>
> I am trying to parse CSV files with Parset according to the more or
> less official abfn specification. Unfortunately, I got stuck and have
> not been able to figure how to make the error message go away.
>
> This is the code in question:
> https://github.com/bytesource/CSVTable/blob/master/lib/csvparser.rb
>
> It contains all the relevant information, that is the:
> -- abfn specification
> -- parser code
> -- test code
> -- error message form running the code
>
> I would be glad if someone could take a look at this code and maybe
> help me spot my error.
>
> Thanks in advance!
>
> Stefan
>