Token.hs revision 3f69b6948966979163bdfe8331c38833d5d90ecd
eb483f2216949400bfef8f6deb5320f071445626Christian MaederModule : $Header$
e6d40133bc9f858308654afb1262b8b483ec5922Till MossakowskiDescription : parser for CASL 'Id's based on "Common.Lexer"
eb483f2216949400bfef8f6deb5320f071445626Christian MaederCopyright : (c) Christian Maeder and Uni Bremen 2002-2004
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian MaederLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
3f69b6948966979163bdfe8331c38833d5d90ecdChristian MaederMaintainer : Christian.Maeder@dfki.de
eb483f2216949400bfef8f6deb5320f071445626Christian MaederStability : provisional
eb483f2216949400bfef8f6deb5320f071445626Christian MaederPortability : portable
e6d40133bc9f858308654afb1262b8b483ec5922Till MossakowskiParser for CASL 'Id's based on "Common.Lexer"
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder{- http://www.cofi.info/Documents/CASL/Summary/
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder from 25 March 2001
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder C.2.1 Basic Specifications with Subsorts
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederSIMPLE-ID ::= WORDS
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederID ::= TOKEN-ID | MIXFIX-ID
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederTOKEN-ID ::= TOKEN
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederMIXFIX-ID ::= TOKEN-ID PLACE-TOKEN-ID ... PLACE-TOKEN-ID
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder | PLACE-TOKEN-ID ... PLACE-TOKEN-ID
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederPLACE-TOKEN-ID ::= PLACE TOKEN-ID
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederTOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder SIGNS are adapted here and more permissive as in the summary
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder WORDS and NO-BRACKET-SIGNS are treated equally
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder legal are, ie. "{a}", "{+}", "a{}="
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder illegal is "a=" (no two SIMPLE-TOKEN stay beside each other)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder SIMPLE-TOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder | NO-BRACKET-SIGNS
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder STB ::= SIMPLE-TOKEN BRACKETS
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder BST ::= BRACKETS SIMPLE-TOKEN
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder SIGNS ::= BRACKETS
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder | BRACKETS STB ... STB
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder | BRACKETS STB ... STB SIMPLE-TOKEN
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder | SIMPLE-TOKEN
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder | SIMPLE-TOKEN BST ... BST
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder | SIMPLE-TOKEN BST ... BST BRACKETS
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder A SIMPLE-TOKEN followed by "[" outside nested brackets
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder will be taken as the beginning of a compound list.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder Within SIGNS brackets need not be balanced,
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder only after their composition to a MIXFIX-ID.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder BRACKETS = BRACKET ... BRACKET
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder BRACKET ::= [ | ] | { | }
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder 2.4 Identifiers
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder brackets/braces within MIXFIX-ID must be balanced
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder C.2.2 Structured Specifications
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder TOKEN-ID ::= ... | TOKEN [ ID ,..., ID ]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder A compound list must follow the last TOKEN within MIXFIX-ID,
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder so a compound list is never nested within (balanced) mixfix BRACKETS.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder Only PLACEs may follow a compound list.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder The IDs within the compound list may surely be compound IDs again.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- * Casl keyword lists
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | reserved signs
eb483f2216949400bfef8f6deb5320f071445626Christian Maedercasl_reserved_ops :: [String]
07b1bf56f3a486f26d69514d05b73100abb25a0eChristian Maedercasl_reserved_ops = [colonS, colonQuMark, defnS, dotS, cDot, mapsTo]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | these formula signs are legal in terms, but illegal in declarations
eb483f2216949400bfef8f6deb5320f071445626Christian Maederformula_ops :: [String]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederformula_ops = [equalS, implS, equivS, lOr, lAnd, negS]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | all reseverd signs
eb483f2216949400bfef8f6deb5320f071445626Christian Maedercasl_reserved_fops :: [String]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedercasl_reserved_fops = formula_ops ++ casl_reserved_ops
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski-- | reserved keywords
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowskicasl_basic_reserved_words :: [String]
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowskicasl_basic_reserved_words =
e33e3b425e953236b4617870f995d263ac35b883Christian Maeder [axiomS, axiomS ++ sS, cogeneratedS, cotypeS, cotypeS ++ sS,
e33e3b425e953236b4617870f995d263ac35b883Christian Maeder existsS, forallS, freeS, generatedS,
e33e3b425e953236b4617870f995d263ac35b883Christian Maeder opS, opS ++ sS, predS, predS ++ sS,
3a3bbc51abf804d91bc9d8e0f2ce745cfae4c9c7Christian Maeder sortS, sortS ++ sS, typeS, typeS ++ sS, varS, varS ++ sS]
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski-- | reserved keywords
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowskicasl_structured_reserved_words :: [String]
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowskicasl_structured_reserved_words =
f624c6980131e5b0598e00e7d8b4acb9720f8996Christian Maeder [andS, archS, behaviourallyS, closedS, cofreeS, endS,
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski fitS, freeS, fromS, getS, givenS,
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski hideS, lambdaS, libraryS, localS, logicS,
f624c6980131e5b0598e00e7d8b4acb9720f8996Christian Maeder refinedS, refinementS,
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski resultS, revealS, specS, thenS, toS,
3a3bbc51abf804d91bc9d8e0f2ce745cfae4c9c7Christian Maeder unitS, unitS ++ sS, versionS, viewS, withS, withinS]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | reserved keywords
eb483f2216949400bfef8f6deb5320f071445626Christian Maedercasl_reserved_words :: [String]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedercasl_reserved_words =
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski casl_basic_reserved_words++ casl_structured_reserved_words
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | these formula words are legal in terms, but illegal in declarations
eb483f2216949400bfef8f6deb5320f071445626Christian Maederformula_words :: [String]
1865083b72c1307e9040d78c2743abd5a54ee260Christian Maederformula_words = [asS, defS, elseS, ifS, inS, whenS, falseS, notS, trueS]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | all reserved words
eb483f2216949400bfef8f6deb5320f071445626Christian Maedercasl_reserved_fwords :: [String]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedercasl_reserved_fwords = formula_words ++ casl_reserved_words
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- * a single 'Token' parser
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- pass list of key symbols and keywords as parameter
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | a simple 'Token' parser depending on reserved signs and words
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- (including a quoted char, dot-words or a single digit)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedersid :: ([String], [String]) -> GenParser Char st Token
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedersid (kOps, kWords) = pToken (scanQuotedChar <|> scanDotWords
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder <|> scanDigit <|> reserved kOps scanAnySigns
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder <|> reserved kWords scanAnyWords <?> "simple-id")
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- * 'Token' lists parsers
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | balanced mixfix components within braces
eb483f2216949400bfef8f6deb5320f071445626Christian MaederbraceP :: GenParser Char st [Token] -> GenParser Char st [Token]
1509ea46b471bef1c5e70864fb1cfc0a5280266bChristian MaederbraceP p = begDoEnd oBraceT p cBraceT <|> try (oBracketT <:> single cBracketT)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | balanced mixfix components within square brackets
eb483f2216949400bfef8f6deb5320f071445626Christian MaederbracketP :: GenParser Char st [Token] -> GenParser Char st [Token]
afbd86903151121381e4e9d22862136817d7f0f0Christian MaederbracketP p = begDoEnd oBracketT p cBracketT
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | an 'sid' optionally followed by other mixfix components
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- (without no two consecutive 'sid's)
eb483f2216949400bfef8f6deb5320f071445626Christian MaederinnerMix1 :: ([String], [String]) -> GenParser Char st [Token]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederinnerMix1 l = sid l <:> option [] (innerMix2 l)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | mixfix components not starting with a 'sid' (possibly places)
eb483f2216949400bfef8f6deb5320f071445626Christian MaederinnerMix2 :: ([String], [String]) -> GenParser Char st [Token]
afbd86903151121381e4e9d22862136817d7f0f0Christian MaederinnerMix2 l = let p = innerList l in
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder flat (many1 (braceP p <|> bracketP p <|> many1 placeT))
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder <++> option [] (innerMix1 l)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | any mixfix components within braces or brackets
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederinnerList :: ([String], [String]) -> GenParser Char st [Token]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederinnerList l = option [] (innerMix1 l <|> innerMix2 l <?> "token")
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | mixfix components starting with a 'sid' (outside 'innerList')
eb483f2216949400bfef8f6deb5320f071445626Christian MaedertopMix1 :: ([String], [String]) -> GenParser Char st [Token]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedertopMix1 l = sid l <:> option [] (topMix2 l)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | mixfix components starting with braces ('braceP')
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- that may follow 'sid' outside 'innerList'.
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- (Square brackets after a 'sid' will be taken as a compound list.)
eb483f2216949400bfef8f6deb5320f071445626Christian MaedertopMix2 :: ([String], [String]) -> GenParser Char st [Token]
afbd86903151121381e4e9d22862136817d7f0f0Christian MaedertopMix2 l = flat (many1 (braceP $ innerList l)) <++> option [] (topMix1 l)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | mixfix components starting with square brackets ('bracketP')
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- that may follow a place ('placeT') (outside 'innerList')
eb483f2216949400bfef8f6deb5320f071445626Christian MaedertopMix3 :: ([String], [String]) -> GenParser Char st [Token]
afbd86903151121381e4e9d22862136817d7f0f0Christian MaedertopMix3 l = let p = innerList l in
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder bracketP p <++> flat (many (braceP p))
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder <++> option [] (topMix1 l)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | any ('topMix1', 'topMix2', 'topMix3') mixfix components
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- that may follow a place ('placeT') at the top level
eb483f2216949400bfef8f6deb5320f071445626Christian MaederafterPlace :: ([String], [String]) -> GenParser Char st [Token]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederafterPlace l = topMix1 l <|> topMix2 l<|> topMix3 l
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maeder-- | places possibly followed by other ('afterPlace') mixfix components
eb483f2216949400bfef8f6deb5320f071445626Christian Maedermiddle :: ([String], [String]) -> GenParser Char st [Token]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedermiddle l = many1 placeT <++> option [] (afterPlace l)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | many (balanced, top-level) mixfix components ('afterPlace')
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- possibly interspersed with multiple places ('placeT')
eb483f2216949400bfef8f6deb5320f071445626Christian MaedertokStart :: ([String], [String]) -> GenParser Char st [Token]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedertokStart l = afterPlace l <++> flat (many (middle l))
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | any (balanced, top-level) mixfix components
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- possibly starting with places but no single 'placeT' only.
eb483f2216949400bfef8f6deb5320f071445626Christian Maederstart :: ([String], [String]) -> GenParser Char st [Token]
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederstart l = tokStart l <|> placeT <:> (tokStart l <|>
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder many1 placeT <++> option [] (tokStart l))
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- * parser for mixfix and compound 'Id's
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | parsing a compound list
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowskicomps :: ([String], [String]) -> GenParser Char st ([Id], Range)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedercomps keys = do o <- oBracketT
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder (ts, ps) <- mixId keys keys `separatedBy` commaT
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder c <- cBracketT
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder return (ts, toPos o ps c)
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maeder{- | parse mixfix components ('start') and an optional compound list ('comps')
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maeder if the last token was no place. Accept possibly further places.
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maeder Key strings (second argument) within compound list may differ from
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maeder top-level key strings (frist argument)!
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedermixId :: ([String], [String]) -> ([String], [String]) -> GenParser Char st Id
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedermixId keys idKeys =
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder do l <- start keys
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski if isPlace (last l) then return (Id l [] nullRange)
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder else do (c, p) <- option ([], nullRange) (comps idKeys)
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder u <- many placeT
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder return (Id (l++u) c p)
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder-- | the Casl key strings (signs first) with additional keywords
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maedercasl_keys :: [String] -> ([String], [String])
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maedercasl_keys ks = (ks ++ casl_reserved_fops, ks ++ casl_reserved_fwords)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | Casl ids for operations and predicates
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaederparseId :: [String] -> GenParser Char st Id
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaederparseId ks = mixId (casl_keys ks) (casl_keys ks)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | disallow 'barS' with in the top-level of constructor names
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaederconsId :: [String] -> GenParser Char st Id
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaederconsId ks = mixId (barS:ks++casl_reserved_fops,
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder ks++casl_reserved_fwords) $ casl_keys ks
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | Casl sorts are simple words ('varId'),
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- but may have a compound list ('comps')
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaedersortId :: [String] -> GenParser Char st Id
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder do s <- varId ks
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski (c, p) <- option ([], nullRange) (comps $ casl_keys ks)
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder return (Id [s] c p)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- * parser for simple 'Id's
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | parse a simple word not in 'casl_reserved_fwords'
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaedervarId :: [String] -> GenParser Char st Token
50dce6b011347f92377adb8bbabaeeb80975e86dChristian MaedervarId ks = pToken (reserved (ks++casl_reserved_fwords) scanAnyWords)
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maeder-- | like 'varId'. 'Common.Id.SIMPLE_ID' for spec- and view names
90bf4bf40789422552e566b73738ba5efae144c3Christian MaedersimpleId :: GenParser Char st Token
3a3bbc51abf804d91bc9d8e0f2ce745cfae4c9c7Christian MaedersimpleId = pToken (reserved casl_structured_reserved_words scanAnyWords)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- * parser for key 'Token's
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | parse a question mark key sign ('quMark')
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederquMarkT :: GenParser Char st Token
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederquMarkT = pToken $ toKey quMark
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | parse a colon ('colonS') even if other signs (like 'quMark')
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- immediately follow.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedercolonST :: GenParser Char st Token
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedercolonST = pToken (string colonS)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | parse the product key sign ('prodS' or 'timesS')
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaedercrossT :: GenParser Char st Token
3639c2cf7f65e04c883054f4a52c6fa733663304Christian MaedercrossT = pToken (toKey prodS <|> toKey timesS) <?> "cross"