<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Sorry, that was a careless extraction of code - I should have made sure that it was complete. </div>
<div style="font-family:arial,sans-serif;font-size:13px">Please, have a look again. When downloading and running the gist (<a href="https://gist.github.com/dargosch/5955045">https://gist.github.com/dargosch/5955045</a>) , I still get the error:</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>Main> let testFile = "/Users/frkkan96/Documents/src/ume/umecore/testing/testdata/testdata.TextGrid"</div>
<div class="im"><div>*Main> parseFromFile textgridfile testFile</div><div>Left "/Users/frkkan96/Documents/src/ume/umecore/testing/testdata/testdata.TextGrid" (line 35, column 5):</div><div>unexpected "t"</div>
<div>expecting "intervals ["</div><div><br></div></div><div>on the attached testfile. The "tier" parser works once, but then I get an error that I cant understand, given the input.</div><div>How come the parser finds the "unexpected "t"" when the expected thing is what is in the input at that point?</div>
<div><br></div><div>Thankful for any help I can get on this.</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 9, 2013 at 10:22 PM, Fredrik Karlsson <span dir="ltr"><<a href="mailto:dargosch@gmail.com" target="_blank">dargosch@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>Sorry, that was a careless extraction of code - I should have made sure that it was complete. </div>
<div>Please, have a look again. When downloading and running the gist, I still get the error:</div>
<div><br></div><div><div>Main> let testFile = "/Users/frkkan96/Documents/src/ume/umecore/testing/testdata/testdata.TextGrid"</div><div class="im"><div>*Main> parseFromFile textgridfile testFile</div><div>
Left "/Users/frkkan96/Documents/src/ume/umecore/testing/testdata/testdata.TextGrid" (line 35, column 5):</div>
<div>unexpected "t"</div><div>expecting "intervals ["</div><div><br></div></div><div>on the attached testfile. The "tier" parser works once, but then I get an error that I cant understand, given the input.</div>
<div>How come the parser finds the "unexpected "t"" when the expected thing is what is in the input at that point?</div><div><br></div><div>Thankful for any help I can get on this.</div><span class="HOEnZb"><font color="#888888">
<div><br></div><div><br></div><div>/Fredrik</div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 9, 2013 at 9:37 AM, Roman Cheplyaka <span dir="ltr"><<a href="mailto:roma@ro-che.info" target="_blank">roma@ro-che.info</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Please check your code.<br>
<br>
I had two problems with it: mixed tabs and spaces, and undefined<br>
'quotedChar'. After defining quotedChar = anyChar, I get a different<br>
error message from yours:<br>
<br>
*Main> parseFromFile textgridfile "testdata.TextGrid"<br>
Left "testdata.TextGrid" (line 137, column 1):<br>
unexpected end of input<br>
expecting quote at end of cell<br>
<br>
Roman<br>
<br>
* Fredrik Karlsson <<a href="mailto:dargosch@gmail.com" target="_blank">dargosch@gmail.com</a>> [2013-07-09 08:07:24+0200]<br>
<div><div>> Hi Roman,<br>
><br>
> I'm using parsec-3.1.3<br>
><br>
> I put the code in a gist here - sorry about that.<br>
><br>
> <a href="https://gist.github.com/dargosch/5955045" target="_blank">https://gist.github.com/dargosch/5955045</a><br>
><br>
> Fredrik<br>
><br>
><br>
><br>
><br>
> On Tue, Jul 9, 2013 at 12:08 AM, Roman Cheplyaka <<a href="mailto:roma@ro-che.info" target="_blank">roma@ro-che.info</a>> wrote:<br>
><br>
> > Hi Fredrik,<br>
> ><br>
> > First, do you use the latest parsec version (3.1.3)? If not, can you try<br>
> > the same with 3.1.3?<br>
> ><br>
> > Second, please upload your code to <a href="http://hpaste.org" target="_blank">hpaste.org</a> or a similar service and<br>
> > give us the link. It's not much fun to extract code from an html email.<br>
> ><br>
> > Roman<br>
> ><br>
> > * Fredrik Karlsson <<a href="mailto:dargosch@gmail.com" target="_blank">dargosch@gmail.com</a>> [2013-07-08 23:54:17+0200]<br>
> > > Dear list,<br>
> > ><br>
> > > I have a Parsec parser that fails and gives the following error message:<br>
> > ><br>
> > > *Main> parseFromFile textgridfile testFile<br>
> > > Left<br>
> > ><br>
> > "/Users/frkkan96/Documents/src/ume/umecore/testing/testdata/testdata.TextGrid"<br>
> > > (line 35, column 5):<br>
> > > unexpected "t"<br>
> > > expecting "intervals ["<br>
> > ><br>
> > > Now, this is perfectly understandable, but line 35, col 5 in the file<br>
> > being<br>
> > > parsed looks like the supplies image - there is no 't' there.<br>
> > ><br>
> > > Any ideas on what is going on?<br>
> > ><br>
> > > The parser I am using is:<br>
> > ><br>
> > > data VariableLine = VariableLine String String deriving Show<br>
> > > data TierType = IntervalTier | PointTier deriving Show<br>
> > ><br>
> > > data Tier = Tier String deriving Show<br>
> > > data LabelFile = LabelFile Double Double deriving Show<br>
> > ><br>
> > > data Label = Label String TierType Double Double String deriving Show<br>
> > ><br>
> > ><br>
> > > haskelldef = makeTokenParser haskellDef<br>
> > ><br>
> > ><br>
> > > textgridfile :: Parser (LabelFile, [[Label]])<br>
> > > textgridfile = do<br>
> > > h <- header<br>
> > > ll <- many1 tier<br>
> > > return $ (h,ll)<br>
> > ><br>
> > > header :: Parser LabelFile<br>
> > > header = do<br>
> > > string headTS1<br>
> > > start <- try (float haskelldef)<br>
> > > <|> (fmap fromInteger $ integer haskelldef )<br>
> > > string "xmax = "<br>
> > > end <- try (float haskelldef)<br>
> > > <|> (fmap fromInteger $ integer haskelldef )<br>
> > > string "tiers? <exists> \n"<br>
> > > string "size = "<br>
> > > integer haskelldef<br>
> > > string "item []:"<br>
> > > whiteSpace haskelldef<br>
> > > return $ LabelFile start end<br>
> > ><br>
> > > tier :: Parser [Label]<br>
> > > tier = do<br>
> > > whiteSpace haskelldef<br>
> > > string "item ["<br>
> > > integer haskelldef<br>
> > > string "]:"<br>
> > > whiteSpace haskelldef<br>
> > > try (string "class = \"IntervalTier\"")<br>
> > > <|> string "class = \"TextTier\""<br>
> > > whiteSpace haskelldef<br>
> > > string "name = "<br>
> > > char '"'<br>
> > > name <- many quotedChar<br>
> > > char '"' <?> "quote at end of cell"<br>
> > > whiteSpace haskelldef<br>
> > > string "xmin = "<br>
> > > try (float haskelldef) <|> (fmap fromInteger $ integer haskelldef )<br>
> > > whiteSpace haskelldef<br>
> > > string "xmax = "<br>
> > > try (float haskelldef) <|> (fmap fromInteger $ integer haskelldef )<br>
> > > string "intervals: size = " <|> string "points: size = "<br>
> > > integer haskelldef<br>
> > > whiteSpace haskelldef<br>
> > > labelList <- many1 (interval name)<br>
> > > return $ labelList<br>
> > > interval :: String -> Parser Label<br>
> > > interval tierName = do<br>
> > > whiteSpace haskelldef<br>
> > > string "intervals ["<br>
> > > integer haskelldef<br>
> > > string "]:"<br>
> > > whiteSpace haskelldef<br>
> > > string "xmin = "<br>
> > > start <- try (float haskelldef)<br>
> > > <|> (fmap fromInteger $ integer haskelldef )<br>
> > > whiteSpace haskelldef<br>
> > > string "xmax = "<br>
> > > end <- try (float haskelldef)<br>
> > > <|> (fmap fromInteger $ integer haskelldef )<br>
> > > whiteSpace haskelldef<br>
> > > string "text = "<br>
> > > char '"'<br>
> > > text <- many quotedChar<br>
> > > char '"' <?> "quote at end of cell"<br>
> > > return $ Label tierName IntervalTier start end text<br>
> > ><br>
> > > which fails on the attached input file.<br>
> > ><br>
> > > I can't see how 't' is found?? What am I doing wrong?<br>
> > ><br>
> > > /Fredrik<br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > > "Life is like a trumpet - if you don't put anything into it, you don't<br>
> > get<br>
> > > anything out of it."<br>
> ><br>
> ><br>
> ><br>
> > > _______________________________________________<br>
> > > Haskell-Cafe mailing list<br>
> > > <a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
> > > <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
> ><br>
> ><br>
><br>
><br>
> --<br>
> "Life is like a trumpet - if you don't put anything into it, you don't get<br>
> anything out of it."<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>"Life is like a trumpet - if you don't put anything into it, you don't get anything out of it."
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>"Life is like a trumpet - if you don't put anything into it, you don't get anything out of it."
</div>