Token.hs revision f3a94a197960e548ecd6520bb768cb0d547457bb
eb483f2216949400bfef8f6deb5320f071445626Christian MaederModule : $Header$
eb483f2216949400bfef8f6deb5320f071445626Christian MaederCopyright : (c) Christian Maeder and Uni Bremen 2002-2004
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian MaederLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
b4fbc96e05117839ca409f5f20f97b3ac872d1edTill MossakowskiMaintainer : maeder@tzi.de
eb483f2216949400bfef8f6deb5320f071445626Christian MaederStability : provisional
eb483f2216949400bfef8f6deb5320f071445626Christian MaederPortability : portable
f3a94a197960e548ecd6520bb768cb0d547457bbChristian Maederparser 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.
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian Maederimport Common.Id (Id(Id), Token(..), Pos, toPos, isPlace)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- * Casl keyword lists
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder-- ----------------------------------------------
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | reserved signs
eb483f2216949400bfef8f6deb5320f071445626Christian Maedercasl_reserved_ops :: [String]
7325bbe03797fd413af504fb3fac109b2c652a7bChristian Maedercasl_reserved_ops = [colonS, colonS++quMark, 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
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder <|> scanDigit <|> reserved kOps scanAnySigns
9929f81562adecc8aafaefb14a0159afcf4a3351Christian 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
afbd86903151121381e4e9d22862136817d7f0f0Christian Maeder flat (many1 (braceP p <|> bracketP p <|> many1 placeT))
afbd86903151121381e4e9d22862136817d7f0f0Christian 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
afbd86903151121381e4e9d22862136817d7f0f0Christian Maeder bracketP p <++> flat (many (braceP p))
afbd86903151121381e4e9d22862136817d7f0f0Christian 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
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | 'place's 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 <|>
9929f81562adecc8aafaefb14a0159afcf4a3351Christian 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
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedercomps :: ([String], [String]) -> GenParser Char st ([Id], [Pos])
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maedercomps keys = do o <- oBracketT
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder (ts, ps) <- mixId keys keys `separatedBy` commaT
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder c <- cBracketT
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder return (ts, toPos o ps c)
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- | parse mixfix components ('start') and an optional compound list ('comps')
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- if the last token was no 'place'. Accept possibly further places.
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder-- Key strings (second argument) within compound list may differ from
eb483f2216949400bfef8f6deb5320f071445626Christian 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
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder if isPlace (last l) then return (Id l [] [])
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder else do (c, p) <- option ([], []) (comps idKeys)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder u <- many placeT
9929f81562adecc8aafaefb14a0159afcf4a3351Christian 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,
50dce6b011347f92377adb8bbabaeeb80975e86dChristian 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
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder (c, p) <- option ([], []) (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)
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder-- | like 'varId'. '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"