The first token in "--:\n" is... a) varsym, because varsym always wins according to section 2.3: An ordinary comment begins with a sequence of two or more consecutive dashes (e.g. --) and extends to the following newline. The sequence of dashes must not form part of a legal lexeme. For example, "-->" or "|--" do not begin a comment, because both of these are legal lexemes; however "--foo" does start a comment. or b) comment, because the maximal munch rule says so (it matches the newline): comment -> dashes [any<symbol> {any}] newline varsym -> (symbol {symbol | :})<reservedop | dashes> GHC says comment. Hugs says varsym. What's the answer? -- Taral <taralx@gmail.com> "Computer science is no more about computers than astronomy is about telescopes." -- Edsger Dijkstra
On 12/8/05, Taral <taralx@gmail.com> wrote:
or b) comment, because the maximal munch rule says so (it matches the newline):
comment -> dashes [any<symbol> {any}] newline varsym -> (symbol {symbol | :})<reservedop | dashes>
Aha. Maximal munch only applies to non-whitespace, so Hugs is right. Yay. -- Taral <taralx@gmail.com> "Computer science is no more about computers than astronomy is about telescopes." -- Edsger Dijkstra
ghc = let h --: g = False :: Bool h = True in h --: False main = print ghc -- Cale On 09/12/05, Taral <taralx@gmail.com> wrote:
On 12/8/05, Taral <taralx@gmail.com> wrote:
or b) comment, because the maximal munch rule says so (it matches the newline):
comment -> dashes [any<symbol> {any}] newline varsym -> (symbol {symbol | :})<reservedop | dashes>
Aha. Maximal munch only applies to non-whitespace, so Hugs is right. Yay.
-- Taral <taralx@gmail.com> "Computer science is no more about computers than astronomy is about telescopes." -- Edsger Dijkstra _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
participants (2)
-
Cale Gibbard -
Taral