Token.hs revision 743178d5294deadc2ed15e56b5e58ca0e7101fe4
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian MaederModule : $Header$
e071fb22ea9923a2a4ff41184d80ca46b55ee932Till MossakowskiDescription : parser for CASL 'Id's based on "Common.Lexer"
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettCopyright : (c) Christian Maeder and Uni Bremen 2002-2004
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuLicense : GPLv2 or higher, see LICENSE.txt
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettMaintainer : Christian.Maeder@dfki.de
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettStability : provisional
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettPortability : portable
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettParser for CASL 'Id's based on "Common.Lexer"
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett{- http://www.cofi.info/Documents/CASL/Summary/
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett from 25 March 2001
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett C.2.1 Basic Specifications with Subsorts
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettSIMPLE-ID ::= WORDS
f909337bf7012aca169c0b56b89efbd4a310f8daAndy GimblettID ::= TOKEN-ID | MIXFIX-ID
9f93b2a8b552789cd939d599504d39732672dc84Christian MaederTOKEN-ID ::= TOKEN
9f93b2a8b552789cd939d599504d39732672dc84Christian MaederMIXFIX-ID ::= TOKEN-ID PLACE-TOKEN-ID ... PLACE-TOKEN-ID
f909337bf7012aca169c0b56b89efbd4a310f8daAndy Gimblett | PLACE-TOKEN-ID ... PLACE-TOKEN-ID
04ceed96d1528b939f2e592d0656290d81d1c045Andy GimblettPLACE-TOKEN-ID ::= PLACE TOKEN-ID
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettTOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett SIGNS are adapted here and more permissive as in the summary
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett WORDS and NO-BRACKET-SIGNS are treated equally
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett legal are, ie. "{a}", "{+}", "a{}="
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett illegal is "a=" (no two SIMPLE-TOKEN stay beside each other)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett SIMPLE-TOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett | NO-BRACKET-SIGNS
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett STB ::= SIMPLE-TOKEN BRACKETS
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett BST ::= BRACKETS SIMPLE-TOKEN
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett SIGNS ::= BRACKETS
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett | BRACKETS STB ... STB
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett | BRACKETS STB ... STB SIMPLE-TOKEN
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett | SIMPLE-TOKEN
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett | SIMPLE-TOKEN BST ... BST
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett | SIMPLE-TOKEN BST ... BST BRACKETS
2f06b54890375b6cac90394b80b07bd451d728fcAndy Gimblett A SIMPLE-TOKEN followed by "[" outside nested brackets
2f06b54890375b6cac90394b80b07bd451d728fcAndy Gimblett will be taken as the beginning of a compound list.
2f06b54890375b6cac90394b80b07bd451d728fcAndy Gimblett Within SIGNS brackets need not be balanced,
2f06b54890375b6cac90394b80b07bd451d728fcAndy Gimblett only after their composition to a MIXFIX-ID.
a09bfcbcb0fba5663fca1968aa82daebf2e092c4Andy Gimblett BRACKETS = BRACKET ... BRACKET
ac5ec613b786cd05f495b568ab5214c31a333e67Andy Gimblett BRACKET ::= [ | ] | { | }
a88d32442096d4fd88fce34842ca6f8cf34d8160Christian Maeder 2.4 Identifiers
a88d32442096d4fd88fce34842ca6f8cf34d8160Christian Maeder brackets/braces within MIXFIX-ID must be balanced
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder C.2.2 Structured Specifications
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder TOKEN-ID ::= ... | TOKEN [ ID ,..., ID ]
a88d32442096d4fd88fce34842ca6f8cf34d8160Christian Maeder A compound list must follow the last TOKEN within MIXFIX-ID,
a88d32442096d4fd88fce34842ca6f8cf34d8160Christian Maeder so a compound list is never nested within (balanced) mixfix BRACKETS.
a88d32442096d4fd88fce34842ca6f8cf34d8160Christian Maeder Only PLACEs may follow a compound list.
a88d32442096d4fd88fce34842ca6f8cf34d8160Christian Maeder The IDs within the compound list may surely be compound IDs again.
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder-- * Casl keyword lists
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder-- | reserved signs
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maedercasl_reserved_ops :: [String]
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maedercasl_reserved_ops = [colonS, colonQuMark, defnS, dotS, cDot, mapsTo]
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder-- | these formula signs are legal in terms, but illegal in declarations
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maederformula_ops :: [String]
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maederformula_ops = [equalS, implS, equivS, lOr, lAnd, negS]
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder-- | all reseverd signs
-- | like 'varId'. 'Common.Id.SIMPLE_ID' for spec- and view names