I'm trying to use Parsec for a language which have identifiers where
the '-' character is allowed only inside identifiers, not at the start
or the end.
ParsecToken has identStart to tell that the '-' is not allowed at the
start but I find no equivalent identEnd?
I tried also to express the same rule with ordinary combinators,
without ParsecToken but this fails:
identifier = do
start <- letter
rest <- many (alphaNum <|> char '-')
end <- letter
return ([start] ++ rest ++ [end])
<?> "characters authorized for identifiers"
because the parser created by "many" is greedy: it consumes
everything, including the final letter.
Any idea?
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe