Copyright | (c) Klaus Luettich and Christian Maeder and Uni Bremen 2002-2003 |
---|---|
License | GPLv2 or higher, see LICENSE.txt |
Maintainer | Christian.Maeder@dfki.de |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Common.Id
Contents
Description
This module supplies positions, 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
- data Pos = SourcePos {
- sourceName :: String
- sourceLine :: !Int
- sourceColumn :: !Int
- newtype Range = Range {
- rangeToList :: [Pos]
- nullRange :: Range
- isNullRange :: Range -> Bool
- appRange :: Range -> Range -> Range
- concatMapRange :: (a -> Range) -> [a] -> Range
- newPos :: String -> Int -> Int -> Pos
- incSourceColumn :: Pos -> Int -> Pos
- showPos :: Pos -> ShowS
- data Token = Token {}
- type SIMPLE_ID = Token
- mkSimpleId :: String -> Token
- nullTok :: Token
- mkNumStr :: String -> Int -> String
- mkNumVar :: String -> Int -> Token
- isSimpleToken :: Token -> Bool
- catPosAux :: [Token] -> [Pos]
- catRange :: [Token] -> Range
- toRange :: Token -> [Token] -> Token -> Range
- place :: String
- isPlace :: Token -> Bool
- placeTok :: Token
- equalS :: String
- exEqual :: String
- typeTok :: Token
- data Id = Id {}
- mkId :: [Token] -> Id
- mkInfix :: String -> Id
- genNamePrefix :: String
- genToken :: String -> Token
- genNumVar :: String -> Int -> Token
- genName :: String -> Id
- mkGenName :: Id -> Id
- isGeneratedToken :: Token -> Bool
- appendNumber :: Id -> Int -> Id
- injToken :: Token
- injName :: Id
- mkUniqueName :: Token -> [Id] -> Id
- projToken :: Token
- projName :: Id
- mkUniqueProjName :: Id -> Id -> Id
- mkUniqueInjName :: Id -> Id -> Id
- isInjName :: Id -> Bool
- typeId :: Id
- applId :: Id
- eqId :: Id
- exEq :: Id
- 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] -> Range -> [a]
- getPlainTokenList :: Id -> [Token]
- getTokenList :: String -> Id -> [Token]
- simpleIdToId :: SIMPLE_ID -> Id
- stringToId :: String -> Id
- isSingle :: [a] -> Bool
- isSimpleId :: Id -> Bool
- idToSimpleId :: Id -> Token
- placeCount :: Id -> Int
- isMixfix :: Id -> Bool
- begPlace :: Id -> Bool
- endPlace :: Id -> Bool
- isPostfix :: Id -> Bool
- isInfix :: Id -> Bool
- posOfId :: Id -> Range
- tokenRange :: Token -> [Pos]
- mkTokPos :: String -> Pos -> [Pos]
- outerRange :: Range -> [Pos]
- sortRange :: [Pos] -> [Pos] -> [Pos]
- joinRanges :: [[Pos]] -> [Pos]
- idRange :: Id -> [Pos]
- class GetRange a where
- getPosList :: GetRange a => a -> [Pos]
- getRangeSpan :: GetRange a => a -> Range
Documentation
data Pos
Constructors
SourcePos | |
Fields
|
isNullRange :: Range -> Bool
concatMapRange :: (a -> Range) -> [a] -> Range
incSourceColumn :: Pos -> Int -> Pos
increment the column counter
Tokens as String
s with positions that are ignored for Eq
and Ord
data Token
tokens as supplied by the scanner
mkSimpleId :: String -> Token
construct a token without position from a string
isSimpleToken :: Token -> Bool
test if the first character indicates a legal simple CASL identifier
toRange :: Token -> [Token] -> Token -> Range
shortcut to get positions of surrounding and interspersed tokens
placeholder stuff
equality symbols
mixfix identifiers with compound lists and its range
data Id
mixfix and compound identifiers
Instances
Eq Id | |
Data Id | |
Ord Id | |
Show Id | |
ShATermConvertible Id | |
GetRange Id | |
Pretty Id | |
SymbolName Id | |
ListCheck Id | |
ATermConvertibleSML Id | |
Typeable * Id | |
StaticAnalysis RelScheme RSScheme Sentence () () Sign RSMorphism RSSymbol RSRawSymbol | Static Analysis for Rel |
Logic RelScheme () RSScheme Sentence () () Sign RSMorphism RSSymbol RSRawSymbol () | Instance of Logic for Relational Schemes |
Comorphism RelScheme2CASL RelScheme () RSScheme Sentence () () Sign RSMorphism RSSymbol RSRawSymbol () CASL CASL_Sublogics CASLBasicSpec CASLFORMULA SYMB_ITEMS SYMB_MAP_ITEMS CASLSign CASLMor Symbol RawSymbol ProofTree |
a prefix for generated names
isGeneratedToken :: Token -> Bool
tests whether a Token is already a generated one
appendNumber :: Id -> Int -> Id
append a number to the first token of a (possible compound) Id, or generate a new identifier for invisible ones
mkUniqueName :: Token -> [Id] -> Id
mkUniqueProjName :: Id -> Id -> Id
mkUniqueInjName :: Id -> Id -> Id
show stuff
showSepList :: ShowS -> (a -> ShowS) -> [a] -> ShowS
intersperse seperators
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] -> Range -> [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.
getTokenList :: String -> Id -> [Token]
reconstruct the token list of an Id
.
Replace top-level places with the input String
conversion from SIMPLE_ID
simpleIdToId :: SIMPLE_ID -> Id
stringToId :: String -> Id
a string as Id
isSimpleId :: Id -> Bool
test for a SIMPLE_ID
idToSimpleId :: Id -> Token
fixity stuff
placeCount :: Id -> Int
position stuff
tokenRange :: Token -> [Pos]
compute start and end position of a Token (or leave it empty)
outerRange :: Range -> [Pos]
joinRanges :: [[Pos]] -> [Pos]
compute start and end position of a declared Id (or leave it empty). Do not use for applied identifiers where place holders are replaced.
class GetRange a where
This class is derivable with DrIFT.
Its main purpose is to have a function that operates on
constructors with a Range
field. During parsing, mixfix
analysis and ATermConversion this function might be very useful.
Minimal complete definition
Nothing
Instances
getPosList :: GetRange a => a -> [Pos]
getRangeSpan :: GetRange a => a -> Range