hets -- a heterogenous Specification (CASL) tool setContentsIndex
Common.Id
Portability portable
Stability provisional
Maintainer hets@tzi.de
Contents
positions from Common.Lib.Parsec.Pos starting at (1,1)
Tokens as Strings with positions that are ignored for Eq and Ord
placeholder stuff
identifiers with positions (usually ignored) of compound lists
show stuff
splitting identifiers
reconstructing token lists
conversion from SIMPLE_ID
fixity stuff
position stuff
Description

This modul supplies simple and mixfix identifiers. A simple identifier is a lexical token given by a string and a start position.

  • A place is a special token within mixfix identifiers.
  • A mixfix identifier may have a compound list. This compound list follows the last non-place token!
  • Identifiers fixed for all logics
Synopsis
type Pos = SourcePos
nullPos :: Pos
isNullPos :: Pos -> Bool
data Token = Token {
tokStr :: String
tokPos :: Pos
}
type SIMPLE_ID = Token
mkSimpleId :: String -> Token
showTok :: Token -> ShowS
toPos :: Token -> [Token] -> Token -> [Pos]
place :: String
isPlace :: Token -> Bool
data Id = Id [Token] [Id] [Pos]
noShow :: Bool -> ShowS -> ShowS
showSepList :: ShowS -> (a -> ShowS) -> [a] -> ShowS
showIds :: [Id] -> ShowS
showId :: Id -> ShowS
splitMixToken :: [Token] -> ([Token], [Token])
getListBrackets :: Id -> ([Token], [Token], [Id])
expandPos :: (Token -> a) -> (String, String) -> [a] -> [Pos] -> [a]
getPlainTokenList :: Id -> [Token]
getCompoundTokenList :: [Id] -> [Pos] -> [Token]
simpleIdToId :: SIMPLE_ID -> Id
isSingle :: [a] -> Bool
isSimpleId :: Id -> Bool
placeCount :: Id -> Int
isOrdAppl :: Id -> Bool
isMixfix :: Id -> Bool
isPrefix :: Id -> Bool
isPostfix :: Id -> Bool
isInfix2 :: Id -> Bool
isInfix :: Id -> Bool
isSurround :: Id -> Bool
isNonCompound :: Id -> Bool
posOfId :: Id -> Pos
headPos :: [Pos] -> Pos
getMyPos :: PosItem a => a -> Pos
posOf :: PosItem a => [a] -> Pos
firstPos :: PosItem a => [a] -> [Pos] -> Pos
class PosItem a where
up_pos :: (Pos -> Pos) -> a -> a
up_pos_l :: ([Pos] -> [Pos]) -> a -> a
get_pos :: a -> Maybe Pos
get_pos_l :: a -> Maybe [Pos]
up_pos_err :: String -> a
positions from Common.Lib.Parsec.Pos starting at (1,1)
type Pos = SourcePos
nullPos :: Pos
unknown position (0, 0)
isNullPos :: Pos -> Bool
Tokens as Strings with positions that are ignored for Eq and Ord
data Token
tokens as supplied by the scanner
Constructors
Token
tokStr :: String
tokPos :: Pos
Instances
ATermConvertibleSML Token
ATermConvertible Token
Eq Token
Ord Token
PosItem Token
Show Token
PrettyPrint Token
type SIMPLE_ID = Token
simple ids are just tokens
mkSimpleId :: String -> Token
a Token with nullPos
showTok :: Token -> ShowS
show the plain string
toPos :: Token -> [Token] -> Token -> [Pos]
shortcut to get positions of surrounding and interspersed tokens
placeholder stuff
place :: String
the special place
isPlace :: Token -> Bool
is a place token
identifiers with positions (usually ignored) of compound lists
data Id
mixfix and compound identifiers
Constructors
Id [Token] [Id] [Pos]
Instances
ATermConvertibleSML Id
ATermConvertible Id
Eq Id
Ord Id
PosItem Id
Show Id
PrettyPrint Id
show stuff
noShow :: Bool -> ShowS -> ShowS
shortcut to suppress output for input condition
showSepList :: ShowS -> (a -> ShowS) -> [a] -> ShowS
intersperse seperators
showIds :: [Id] -> ShowS
shows a compound list
showId :: Id -> ShowS
shows an Id, puts final places behind a compound list
splitting identifiers
splitMixToken :: [Token] -> ([Token], [Token])
splits off the front and final places
getListBrackets :: Id -> ([Token], [Token], [Id])
return open and closing list bracket and a compound list from a bracket Id (parsed by caslListBrackets)
reconstructing token lists
expandPos :: (Token -> a) -> (String, String) -> [a] -> [Pos] -> [a]
reconstruct a list with surrounding strings and interspersed commas with proper position information that should be preserved by the input function
getPlainTokenList :: Id -> [Token]
reconstruct the token list of an Id including square brackets and commas of (nested) compound lists.
getCompoundTokenList :: [Id] -> [Pos] -> [Token]
reconstruct tokens of compound list
conversion from SIMPLE_ID
simpleIdToId :: SIMPLE_ID -> Id
a SIMPLE_ID as Id
isSingle :: [a] -> Bool
efficiently test for a singleton list
isSimpleId :: Id -> Bool
test for a SIMPLE_ID
fixity stuff
placeCount :: Id -> Int
number of place in Id
isOrdAppl :: Id -> Bool
has no (toplevel) place
isMixfix :: Id -> Bool
has a place
isPrefix :: Id -> Bool
ends with a place
isPostfix :: Id -> Bool
starts with a place
isInfix2 :: Id -> Bool
is a classical infix Id with three tokens, the middle one is a non-place
isInfix :: Id -> Bool
starts and ends with a place
isSurround :: Id -> Bool
has a place but neither starts nor ends with one
isNonCompound :: Id -> Bool
has no compound list
position stuff
posOfId :: Id -> Pos
compute a meaningful single position from an Id for diagnostics
headPos :: [Pos] -> Pos
first Pos or nullPos
getMyPos :: PosItem a => a -> Pos
get a reasonable position
posOf :: PosItem a => [a] -> Pos
get a reasonable position for a list
firstPos :: PosItem a => [a] -> [Pos] -> Pos
get a reasonable position for a list with an additional position list
class PosItem a where
This class is derivable with DrIFT. Its main purpose is to have a function that operates on constructors with a Pos or list of Pos field. During parsing, mixfix analysis and ATermConversion this function might be very useful.
Methods
up_pos :: (Pos -> Pos) -> a -> a
up_pos_l :: ([Pos] -> [Pos]) -> a -> a
get_pos :: a -> Maybe Pos
get_pos_l :: a -> Maybe [Pos]
up_pos_err :: String -> a
Instances
PosItem BASIC_ITEMS
PosItem SIG_ITEMS
PosItem SORT_ITEM
PosItem OP_ITEM
PosItem OP_TYPE
PosItem OP_HEAD
PosItem ARG_DECL
PosItem PRED_ITEM
PosItem PRED_TYPE
PosItem PRED_HEAD
PosItem DATATYPE_DECL
PosItem ALTERNATIVE
PosItem COMPONENTS
PosItem VAR_DECL
PosItem FORMULA
PosItem PRED_SYMB
PosItem TERM
PosItem OP_SYMB
PosItem SYMB_ITEMS
PosItem SYMB_ITEMS_LIST
PosItem SYMB_MAP_ITEMS
PosItem SYMB_MAP_ITEMS_LIST
PosItem SYMB
PosItem SYMB_OR_MAP
PosItem Component
PosItem Annotation
PosItem Token
PosItem Id
PosItem Diagnosis
PosItem Kind
PosItem Vars
PosItem TypePattern
PosItem TypeArg
PosItem TypeScheme
PosItem Type
PosItem Term
PosItem Pattern
PosItem VarDecl
PosItem ARCH_SPEC_DEFN
PosItem ARCH_SPEC
PosItem UNIT_DECL_DEFN
PosItem UNIT_SPEC_DEFN
PosItem UNIT_SPEC
PosItem UNIT_EXPRESSION
PosItem UNIT_BINDING
PosItem UNIT_TERM
PosItem FIT_ARG_UNIT
PosItem LIB_DEFN
PosItem LIB_ITEM
PosItem ITEM_NAME_OR_MAP
PosItem LIB_ID
PosItem VERSION_NUMBER
PosItem SPEC
PosItem RENAMING
PosItem RESTRICTION
PosItem SPEC_DEFN
PosItem GENERICITY
PosItem FIT_ARG
PosItem VIEW_DEFN
PosItem VIEW_TYPE
PosItem Logic_code
Produced by Haddock version 0.6