Token.hs revision e6d40133bc9f858308654afb1262b8b483ec5922
e071fb22ea9923a2a4ff41184d80ca46b55ee932Till MossakowskiModule : $Header$
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachDescription : parser for CASL 'Id's based on "Common.Lexer"
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian MaederCopyright : (c) Christian Maeder and Uni Bremen 2002-2004
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachMaintainer : maeder@tzi.de
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachStability : provisional
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachPortability : portable
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettParser for CASL 'Id's based on "Common.Lexer"
fbb2d28086a1860850f661fbf4af531322bac405Christian Maeder{- http://www.cofi.info/Documents/CASL/Summary/
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach from 25 March 2001
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach C.2.1 Basic Specifications with Subsorts
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus RoggenbachSIMPLE-ID ::= WORDS
e771539425f4a0abef9f94cf4b63690f3603f682Andy GimblettID ::= TOKEN-ID | MIXFIX-ID
e771539425f4a0abef9f94cf4b63690f3603f682Andy GimblettTOKEN-ID ::= TOKEN
e771539425f4a0abef9f94cf4b63690f3603f682Andy GimblettMIXFIX-ID ::= TOKEN-ID PLACE-TOKEN-ID ... PLACE-TOKEN-ID
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett | PLACE-TOKEN-ID ... PLACE-TOKEN-ID
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy GimblettPLACE-TOKEN-ID ::= PLACE TOKEN-ID
90047eafd2de482c67bcd13103c6064e9b0cb254Andy GimblettTOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
b22c258cca179a5ffe777b64b32e10687c5f6b2cAndy Gimblett SIGNS are adapted here and more permissive as in the summary
e771539425f4a0abef9f94cf4b63690f3603f682Andy Gimblett WORDS and NO-BRACKET-SIGNS are treated equally
e771539425f4a0abef9f94cf4b63690f3603f682Andy Gimblett legal are, ie. "{a}", "{+}", "a{}="
e771539425f4a0abef9f94cf4b63690f3603f682Andy Gimblett illegal is "a=" (no two SIMPLE-TOKEN stay beside each other)
90047eafd2de482c67bcd13103c6064e9b0cb254Andy Gimblett SIMPLE-TOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
90047eafd2de482c67bcd13103c6064e9b0cb254Andy Gimblett | NO-BRACKET-SIGNS
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett STB ::= SIMPLE-TOKEN BRACKETS
90047eafd2de482c67bcd13103c6064e9b0cb254Andy Gimblett BST ::= BRACKETS SIMPLE-TOKEN
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett SIGNS ::= BRACKETS
a79fe3aad8743ea57e473ea5f66a723244cb9c0eMarkus Roggenbach | BRACKETS STB ... STB
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett | BRACKETS STB ... STB SIMPLE-TOKEN
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett | SIMPLE-TOKEN
41486a487c9b065d4d9d1a8adf63c00925cd455bAndy Gimblett | SIMPLE-TOKEN BST ... BST
929190acb9f2b2f5857dce841c5a389710895515Andy Gimblett | SIMPLE-TOKEN BST ... BST BRACKETS
41486a487c9b065d4d9d1a8adf63c00925cd455bAndy Gimblett A SIMPLE-TOKEN followed by "[" outside nested brackets
41486a487c9b065d4d9d1a8adf63c00925cd455bAndy Gimblett will be taken as the beginning of a compound list.
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett Within SIGNS brackets need not be balanced,
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett only after their composition to a MIXFIX-ID.
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett BRACKETS = BRACKET ... BRACKET
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett BRACKET ::= [ | ] | { | }
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett 2.4 Identifiers
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett brackets/braces within MIXFIX-ID must be balanced
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett C.2.2 Structured Specifications
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett TOKEN-ID ::= ... | TOKEN [ ID ,..., ID ]
eca4db63ed0bdbd93b62678feea6e3eb80aa47bbChristian Maeder A compound list must follow the last TOKEN within MIXFIX-ID,
1df33829303cbf924aa018ac5ce9a28e69c17d22Till Mossakowski so a compound list is never nested within (balanced) mixfix BRACKETS.
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett Only PLACEs may follow a compound list.
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblett The IDs within the compound list may surely be compound IDs again.
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski-- ----------------------------------------------
41486a487c9b065d4d9d1a8adf63c00925cd455bAndy Gimblett-- * Casl keyword lists
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski-- ----------------------------------------------
41486a487c9b065d4d9d1a8adf63c00925cd455bAndy Gimblett-- | reserved signs
03136b84a0c70d877e227444f0875e209506b9e4Christian Maedercasl_reserved_ops :: [String]
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblettcasl_reserved_ops = [colonS, colonQuMark, defnS, dotS, cDot, mapsTo]
1df33829303cbf924aa018ac5ce9a28e69c17d22Till Mossakowski-- | these formula signs are legal in terms, but illegal in declarations
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowskiformula_ops :: [String]
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblettformula_ops = [equalS, implS, equivS, lOr, lAnd, negS]
41486a487c9b065d4d9d1a8adf63c00925cd455bAndy Gimblett-- | all reseverd signs
afd6ed16928bbd774b6c6c5b3f440a917dd638a1Andy Gimblettcasl_reserved_fops :: [String]
-- | like 'varId'. 'Common.Id.SIMPLE_ID' for spec- and view names