Token.hs revision e64aab3e57d843884cd489cc3aa130120a400b05
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina SojakovaModule : $Header$
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina SojakovaDescription : parser for CASL 'Id's based on "Common.Lexer"
097b7fb3f8f90e87120d30bf37a1d89fe0ddfaf0Kristina SojakovaCopyright : (c) Christian Maeder and Uni Bremen 2002-2004
94e2e03f6efde106de095ef4ea0ec87f74955a31Kristina SojakovaLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
211c5fb252e0a776baad9a4857ab198659289a4aKristina SojakovaMaintainer : Christian.Maeder@dfki.de
94e2e03f6efde106de095ef4ea0ec87f74955a31Kristina SojakovaStability : provisional
211c5fb252e0a776baad9a4857ab198659289a4aKristina SojakovaPortability : portable
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina SojakovaParser for CASL 'Id's based on "Common.Lexer"
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova{- http://www.cofi.info/Documents/CASL/Summary/
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova from 25 March 2001
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova C.2.1 Basic Specifications with Subsorts
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina SojakovaSIMPLE-ID ::= WORDS
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina SojakovaID ::= TOKEN-ID | MIXFIX-ID
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina SojakovaTOKEN-ID ::= TOKEN
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina SojakovaMIXFIX-ID ::= TOKEN-ID PLACE-TOKEN-ID ... PLACE-TOKEN-ID
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova | PLACE-TOKEN-ID ... PLACE-TOKEN-ID
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina SojakovaPLACE-TOKEN-ID ::= PLACE TOKEN-ID
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina SojakovaTOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova SIGNS are adapted here and more permissive as in the summary
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder WORDS and NO-BRACKET-SIGNS are treated equally
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova legal are, ie. "{a}", "{+}", "a{}="
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova illegal is "a=" (no two SIMPLE-TOKEN stay beside each other)
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova SIMPLE-TOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova | NO-BRACKET-SIGNS
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder STB ::= SIMPLE-TOKEN BRACKETS
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina Sojakova BST ::= BRACKETS SIMPLE-TOKEN
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder SIGNS ::= BRACKETS
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova | BRACKETS STB ... STB
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina Sojakova | BRACKETS STB ... STB SIMPLE-TOKEN
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina Sojakova | SIMPLE-TOKEN
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina Sojakova | SIMPLE-TOKEN BST ... BST
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina Sojakova | SIMPLE-TOKEN BST ... BST BRACKETS
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder A SIMPLE-TOKEN followed by "[" outside nested brackets
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova will be taken as the beginning of a compound list.
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina Sojakova Within SIGNS brackets need not be balanced,
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova only after their composition to a MIXFIX-ID.
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova BRACKETS = BRACKET ... BRACKET
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina Sojakova BRACKET ::= [ | ] | { | }
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina Sojakova 2.4 Identifiers
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina Sojakova brackets/braces within MIXFIX-ID must be balanced
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina Sojakova C.2.2 Structured Specifications
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina Sojakova TOKEN-ID ::= ... | TOKEN [ ID ,..., ID ]
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina Sojakova A compound list must follow the last TOKEN within MIXFIX-ID,
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina Sojakova so a compound list is never nested within (balanced) mixfix BRACKETS.
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova Only PLACEs may follow a compound list.
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina Sojakova The IDs within the compound list may surely be compound IDs again.
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina Sojakova-- * Casl keyword lists
81d28e8372831ae5e6054d8d2212f0114b09b79aKristina Sojakova-- | reserved signs
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroedercasl_reserved_ops :: [String]
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina Sojakovacasl_reserved_ops = [colonS, colonQuMark, defnS, dotS, cDot, mapsTo]
f2f62e61c66f678b0042d1a772ff89849d8b2113Kristina Sojakova-- | these formula signs are legal in terms, but illegal in declarations
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakovaformula_ops :: [String]
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakovaformula_ops = [equalS, implS, equivS, lOr, lAnd, negS]
f2f62e61c66f678b0042d1a772ff89849d8b2113Kristina Sojakova-- | all reseverd signs
f2f62e61c66f678b0042d1a772ff89849d8b2113Kristina Sojakovacasl_reserved_fops :: [String]
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakovacasl_reserved_fops = formula_ops ++ casl_reserved_ops
887a1999374d1fb3a534e602a8d322de6ef4c8e8Kristina Sojakova-- | reserved keywords
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakovacasl_basic_reserved_words :: [String]
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroedercasl_basic_reserved_words =
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova [axiomS, axiomS ++ sS, cogeneratedS, cotypeS, cotypeS ++ sS,
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova esortS, esortS ++ sS, etypeS, etypeS ++ sS,
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova existsS, forallS, freeS, generatedS,
fc08da86ea2ef76a631faca30ca30b8ed112d864Christian Maeder opS, opS ++ sS, predS, predS ++ sS,
fc08da86ea2ef76a631faca30ca30b8ed112d864Christian Maeder sortS, sortS ++ sS, typeS, typeS ++ sS, varS, varS ++ sS]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | reserved keywords
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovacasl_structured_reserved_words :: [String]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovacasl_structured_reserved_words =
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova [andS, archS, behaviourallyS, closedS, cofreeS, endS,
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova fitS, freeS, fromS, getS, givenS,
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova hideS, lambdaS, libraryS, localS, logicS,
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova refinedS, refinementS,
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova resultS, revealS, specS, thenS, toS,
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova unitS, unitS ++ sS, versionS, viewS, withS, withinS]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | reserved keywords
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovacasl_reserved_words :: [String]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovacasl_reserved_words =
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova casl_basic_reserved_words++ casl_structured_reserved_words
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | these formula words are legal in terms, but illegal in declarations
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovaformula_words :: [String]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovaformula_words = [asS, defS, elseS, ifS, inS, whenS, falseS, notS, trueS]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | all reserved words
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovacasl_reserved_fwords :: [String]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovacasl_reserved_fwords = formula_words ++ casl_reserved_words
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- * a single 'Token' parser taking lists of key symbols and words as parameter
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | a simple 'Token' parser depending on reserved signs and words
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- (including a quoted char, dot-words or a single digit)
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovasid :: ([String], [String]) -> GenParser Char st Token
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovasid (kOps, kWords) = pToken (scanQuotedChar <|> scanDotWords
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova <|> scanDigit <|> reserved kOps scanAnySigns
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova <|> reserved kWords scanAnyWords <?> "simple-id")
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- * 'Token' lists parsers
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | balanced mixfix components within braces
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovabraceP :: GenParser Char st [Token] -> GenParser Char st [Token]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovabraceP p = begDoEnd oBraceT p cBraceT <|> try (oBracketT <:> single cBracketT)
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | balanced mixfix components within square brackets
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovabracketP :: GenParser Char st [Token] -> GenParser Char st [Token]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovabracketP p = begDoEnd oBracketT p cBracketT
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | an 'sid' optionally followed by other mixfix components
12d9bff7c82145a8b68bfb8553688172655c926eKristina Sojakova-- (without no two consecutive 'sid's)
12d9bff7c82145a8b68bfb8553688172655c926eKristina SojakovainnerMix1 :: ([String], [String]) -> GenParser Char st [Token]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovainnerMix1 l = sid l <:> optionL (innerMix2 l)
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | mixfix components not starting with a 'sid' (possibly places)
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovainnerMix2 :: ([String], [String]) -> GenParser Char st [Token]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovainnerMix2 l = let p = innerList l in
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova flat (many1 (braceP p <|> bracketP p <|> many1 placeT))
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova <++> optionL (innerMix1 l)
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova-- | any mixfix components within braces or brackets
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von SchroederinnerList :: ([String], [String]) -> GenParser Char st [Token]
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina SojakovainnerList l = optionL (innerMix1 l <|> innerMix2 l <?> "token")
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder-- | mixfix components starting with a 'sid' (outside 'innerList')
fc08da86ea2ef76a631faca30ca30b8ed112d864Christian MaedertopMix1 :: ([String], [String]) -> GenParser Char st [Token]
fc08da86ea2ef76a631faca30ca30b8ed112d864Christian MaedertopMix1 l = sid l <:> optionL (topMix2 l)
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakova-- | mixfix components starting with braces ('braceP')
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova-- that may follow 'sid' outside 'innerList'.
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova-- (Square brackets after a 'sid' will be taken as a compound list.)
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina SojakovatopMix2 :: ([String], [String]) -> GenParser Char st [Token]
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von SchroedertopMix2 l = flat (many1 (braceP $ innerList l)) <++> optionL (topMix1 l)
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova-- | mixfix components starting with square brackets ('bracketP')
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova-- that may follow a place ('placeT') (outside 'innerList')
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina SojakovatopMix3 :: ([String], [String]) -> GenParser Char st [Token]
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina SojakovatopMix3 l = let p = innerList l in
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder bracketP p <++> flat (many (braceP p))
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova <++> optionL (topMix1 l)
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova-- | any ('topMix1', 'topMix2', 'topMix3') mixfix components
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova-- that may follow a place ('placeT') at the top level
fc08da86ea2ef76a631faca30ca30b8ed112d864Christian MaederafterPlace :: ([String], [String]) -> GenParser Char st [Token]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovaafterPlace l = topMix1 l <|> topMix2 l<|> topMix3 l
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder-- | places possibly followed by other ('afterPlace') mixfix components
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina Sojakovamiddle :: ([String], [String]) -> GenParser Char st [Token]
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakovamiddle l = many1 placeT <++> optionL (afterPlace l)
df31d6f25f90e5112184f4eb60c8d3c7b116ca2dKristina Sojakova-- | many (balanced, top-level) mixfix components ('afterPlace')
b470a3e54a4289b4189906e41f0c04578c85619dKristina Sojakova-- possibly interspersed with multiple places ('placeT')
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovatokStart :: ([String], [String]) -> GenParser Char st [Token]
5b84285ea066187061fc123a3b86b1b6433e06b5Kristina SojakovatokStart l = afterPlace l <++> flat (many (middle l))
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova-- | any (balanced, top-level) mixfix components
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova-- possibly starting with places but no single 'placeT' only.
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakovastart :: ([String], [String]) -> GenParser Char st [Token]
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakovastart l = tokStart l <|> placeT <:> (tokStart l <|>
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova many1 placeT <++> optionL (tokStart l))
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova-- * parser for mixfix and compound 'Id's
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova-- | parsing a compound list
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakovacomps :: ([String], [String]) -> GenParser Char st ([Id], Range)
887a1999374d1fb3a534e602a8d322de6ef4c8e8Kristina Sojakovacomps keys = do o <- oBracketT
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova (ts, ps) <- mixId keys keys `separatedBy` commaT
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova c <- cBracketT
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova return (ts, toRange o ps c)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder{- | parse mixfix components ('start') and an optional compound list ('comps')
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova if the last token was no place. Accept possibly further places.
887a1999374d1fb3a534e602a8d322de6ef4c8e8Kristina Sojakova Key strings (second argument) within compound list may differ from
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova top-level key strings (first argument)!
887a1999374d1fb3a534e602a8d322de6ef4c8e8Kristina SojakovamixId :: ([String], [String]) -> ([String], [String]) -> GenParser Char st Id
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina SojakovamixId keys idKeys =
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova do l <- start keys
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova if isPlace (last l) then return (Id l [] nullRange)
fc08da86ea2ef76a631faca30ca30b8ed112d864Christian Maeder else do (c, p) <- option ([], nullRange) (comps idKeys)
887a1999374d1fb3a534e602a8d322de6ef4c8e8Kristina Sojakova u <- many placeT
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova return (Id (l++u) c p)
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder-- | the Casl key strings (signs first) with additional keywords
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakovacasl_keys :: [String] -> ([String], [String])
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroedercasl_keys ks = (ks ++ casl_reserved_fops, ks ++ casl_reserved_fwords)
887a1999374d1fb3a534e602a8d322de6ef4c8e8Kristina Sojakova-- | Casl ids for operations and predicates
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina SojakovaparseId :: [String] -> GenParser Char st Id
887a1999374d1fb3a534e602a8d322de6ef4c8e8Kristina SojakovaparseId ks = mixId (casl_keys ks) (casl_keys ks)
345d3dcc9f809776009851c446916fc770aa428dKristina Sojakova-- | disallow 'barS' within the top-level of constructor names
345d3dcc9f809776009851c446916fc770aa428dKristina SojakovaconsId :: [String] -> GenParser Char st Id
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina SojakovaconsId ks = mixId (barS : ks ++ casl_reserved_fops,
345d3dcc9f809776009851c446916fc770aa428dKristina Sojakova ks ++ casl_reserved_fwords) $ casl_keys ks
9d770d1ea15092156d65e2a89b081eeeb8c6b153Kristina Sojakova-- | Casl sorts are simple words ('varId'),
a3a6b6ebe9c2d1dc3554e44779dc7361a90e7617Kristina Sojakova-- but may have a compound list ('comps')
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina SojakovasortId :: [String] -> GenParser Char st Id
cb5d588c4c3b286cc1e7210335d6ef7f584d79bcKristina Sojakova do s <- varId ks
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova (c, p) <- option ([], nullRange) (comps $ casl_keys ks)
45caf47cd6ed07be0637f6c51e4735512ce9d83aKristina Sojakova return (Id [s] c p)
45caf47cd6ed07be0637f6c51e4735512ce9d83aKristina Sojakova-- * parser for simple 'Id's
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina Sojakova-- | parse a simple word not in 'casl_reserved_fwords'
14650c9e129d8dc51ed55b2edc6ec27d9f0f6d00Kristina SojakovavarId :: [String] -> GenParser Char st Token
d71bb9deea089887b4fd829c5b766e7e4de9f204Kristina SojakovavarId ks = pToken (reserved (ks++casl_reserved_fwords) scanAnyWords)
d71bb9deea089887b4fd829c5b766e7e4de9f204Kristina Sojakova-- | like 'varId'. 'Common.Id.SIMPLE_ID' for spec- and view names
d71bb9deea089887b4fd829c5b766e7e4de9f204Kristina SojakovasimpleId :: GenParser Char st Token
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von SchroedersimpleId = pToken (reserved casl_structured_reserved_words scanAnyWords)
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova-- * parser for key 'Token's
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina Sojakova-- | parse a question mark key sign ('quMark')
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina SojakovaquMarkT :: GenParser Char st Token
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina SojakovaquMarkT = pToken $ toKey quMark
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder-- | parse a 'colonS' possibly immediately followed by a 'quMark'
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von SchroedercolonST :: GenParser Char st Token
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von SchroedercolonST = pToken $ try $ string colonS << notFollowedBy
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroeder (oneOf $ delete '?' signChars)
8b054cade993ef373d564b2d74c9c5a2da48f8b7Kristina Sojakova-- | parse the product key sign ('prodS' or 'timesS')
51bbd37b3957f301b2628422e161aac2cbd46f1cKristina SojakovacrossT :: GenParser Char st Token
fc08da86ea2ef76a631faca30ca30b8ed112d864Christian MaedercrossT = pToken (toKey prodS <|> toKey timesS) <?> "cross"