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