Haskell parsec statement will try to solve the problem

I am going to Windows using GHC. Here is my code for reference http://hpaste.org/86539

The problem is that the following expression is not parsed: 3+2 < 1+-4 <= -3 << 1 . He should analyze how:

enter image description here

.. however, I unexpectedly - when it is clearly the highest operator. I suspect this because of my use of try on line 55, however without it, < and << and operators that are repetitions of a single character are not parsed correctly.

I am looking for tips or tricks.

+4
source share
1 answer

The problem is on line 56:

 P.lexeme <$ string s 

Must read:

 P.lexeme gmlLexer $ string s 

The first construct matched s , and then returned the P.lexeme function as a result of parsing! Subsequent >> discarded the result, so its type is checked.

What you wanted to do is a later line. Apply P.lexeme for your gmlLexer language to the parser to match s .

+6
source

All Articles