Token.hs revision 1865083b72c1307e9040d78c2743abd5a54ee260
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederModule : $Header$
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederCopyright : (c) Christian Maeder and Uni Bremen 2002-2004
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederLicence : similar to LGPL, see HetCATS/LICENCE.txt or LIZENZ.txt
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederMaintainer : hets@tzi.de
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederStability : provisional
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederPortability : portable
d50927e6f3214849a363476e536e738ea9265d13Christian Maeder parser for CASL 'Id's based on "Common.Lexer"
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder{- http://www.cofi.info/Documents/CASL/Summary/
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder from 25 March 2001
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder C.2.1 Basic Specifications with Subsorts
d50927e6f3214849a363476e536e738ea9265d13Christian MaederSIMPLE-ID ::= WORDS
d50927e6f3214849a363476e536e738ea9265d13Christian MaederID ::= TOKEN-ID | MIXFIX-ID
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederTOKEN-ID ::= TOKEN
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederMIXFIX-ID ::= TOKEN-ID PLACE-TOKEN-ID ... PLACE-TOKEN-ID
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder | PLACE-TOKEN-ID ... PLACE-TOKEN-ID
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederPLACE-TOKEN-ID ::= PLACE TOKEN-ID
d7db9d1741d9e292b217161f8fbbad8368625c04Christian MaederTOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder SIGNS are adapted here and more permissive as in the summary
d50927e6f3214849a363476e536e738ea9265d13Christian Maeder WORDS and NO-BRACKET-SIGNS are treated equally
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder legal are, ie. "{a}", "{+}", "a{}="
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder illegal is "a=" (no two SIMPLE-TOKEN stay beside each other)
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder SIMPLE-TOKEN ::= WORDS | DOT-WORDS | DIGIT | QUOTED-CHAR
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder | NO-BRACKET-SIGNS
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder STB ::= SIMPLE-TOKEN BRACKETS
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder BST ::= BRACKETS SIMPLE-TOKEN
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder SIGNS ::= BRACKETS
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder | BRACKETS STB ... STB
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder | BRACKETS STB ... STB SIMPLE-TOKEN
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder | SIMPLE-TOKEN
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder | SIMPLE-TOKEN BST ... BST
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder | SIMPLE-TOKEN BST ... BST BRACKETS
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder A SIMPLE-TOKEN followed by "[" outside nested brackets
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder will be taken as the beginning of a compound list.
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder Within SIGNS brackets need not be balanced,
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder only after their composition to a MIXFIX-ID.
d50927e6f3214849a363476e536e738ea9265d13Christian Maeder BRACKETS = BRACKET ... BRACKET
d50927e6f3214849a363476e536e738ea9265d13Christian Maeder BRACKET ::= [ | ] | { | }
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder 2.4 Identifiers
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder brackets/braces within MIXFIX-ID must be balanced
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder C.2.2 Structured Specifications
d7db9d1741d9e292b217161f8fbbad8368625c04Christian Maeder TOKEN-ID ::= ... | TOKEN [ ID ,..., ID ]
module Common.Token where
import Common.Keywords
import Common.Lexer
import Common.Id (Id(Id), Token(..), Pos, toPos, isPlace)