module Common.Token where
import Common.Id
import Common.Keywords
import Common.Lexer
import Common.Parsec
import Text.ParserCombinators.Parsec
casl_reserved_ops :: [String]
casl_reserved_ops :: [String]
casl_reserved_ops = [String
colonS, String
colonQuMark, String
defnS, String
dotS, String
cDot, String
mapsTo]
formula_ops :: [String]
formula_ops :: [String]
formula_ops = [String
equalS, String
implS, String
equivS, String
lOr, String
lAnd, String
negS]
casl_reserved_fops :: [String]
casl_reserved_fops :: [String]
casl_reserved_fops = [String]
formula_ops [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
casl_reserved_ops
casl_basic_reserved_words :: [String]
casl_basic_reserved_words :: [String]
casl_basic_reserved_words =
[String
axiomS, String
axiomS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS, String
cogeneratedS, String
cotypeS, String
cotypeS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS,
String
esortS, String
esortS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS, String
etypeS, String
etypeS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS,
String
existsS, String
forallS, String
freeS, String
generatedS,
String
opS, String
opS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS, String
predS, String
predS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS,
String
sortS, String
sortS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS, String
typeS, String
typeS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS, String
varS, String
varS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS]
casl_structured_reserved_words :: [String]
casl_structured_reserved_words :: [String]
casl_structured_reserved_words = String
libraryS String -> [String] -> [String]
forall a. a -> [a] -> [a]
:
[String]
continuationKeywords [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
otherStartKeywords
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
criticalKeywords
criticalKeywords :: [String]
criticalKeywords :: [String]
criticalKeywords = [String]
terminatingKeywords [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
startingKeywords
terminatingKeywords :: [String]
terminatingKeywords :: [String]
terminatingKeywords =
[ String
andS, String
endS, String
extractS, String
fitS, String
forgetS, String
hideS, String
keepS, String
rejectS, String
removeS,
String
revealS, String
selectS, String
thenS, String
withS, String
withinS, String
ofS, String
forS, String
toS, String
intersectS]
startingKeywords :: [String]
startingKeywords :: [String]
startingKeywords =
[ String
archS, String
fromS, String
logicS, String
newlogicS, String
refinementS, String
specS, String
unitS, String
viewS
, String
ontologyS, String
alignmentS, String
networkS, String
equivalenceS, String
newcomorphismS
, String
interpretationS, String
entailmentS ]
otherStartKeywords :: [String]
otherStartKeywords :: [String]
otherStartKeywords =
[String
closedS, String
cofreeS, String
freeS, String
localS, String
unitS String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
sS, String
combineS]
continuationKeywords :: [String]
continuationKeywords :: [String]
continuationKeywords =
[ String
behaviourallyS, String
getS, String
givenS, String
lambdaS, String
refinedS, String
resultS, String
toS, String
versionS
, String
excludingS, String
entailsS ]
casl_reserved_words :: [String]
casl_reserved_words :: [String]
casl_reserved_words =
[String]
casl_basic_reserved_words [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
casl_structured_reserved_words
formula_words :: [String]
formula_words :: [String]
formula_words = [String
asS, String
defS, String
elseS, String
ifS, String
inS, String
whenS, String
falseS, String
notS, String
trueS]
casl_reserved_fwords :: [String]
casl_reserved_fwords :: [String]
casl_reserved_fwords = [String]
formula_words [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
casl_reserved_words
sid :: ([String], [String]) -> GenParser Char st Token
sid :: ([String], [String]) -> GenParser Char st Token
sid (kOps :: [String]
kOps, kWords :: [String]
kWords) = CharParser st String -> GenParser Char st Token
forall st. CharParser st String -> CharParser st Token
pToken (CharParser st String
forall st. CharParser st String
scanQuotedChar CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st String
forall st. CharParser st String
scanDotWords
CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st String
forall st. CharParser st String
scanDigit CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> [String] -> CharParser st String -> CharParser st String
forall st. [String] -> CharParser st String -> CharParser st String
reserved [String]
kOps CharParser st String
forall st. CharParser st String
scanAnySigns
CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> [String] -> CharParser st String -> CharParser st String
forall st. [String] -> CharParser st String -> CharParser st String
reserved [String]
kWords CharParser st String
forall st. CharParser st String
scanAnyWords CharParser st String -> String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "simple-id")
braceP :: GenParser Char st [Token] -> GenParser Char st [Token]
braceP :: GenParser Char st [Token] -> GenParser Char st [Token]
braceP p :: GenParser Char st [Token]
p = CharParser st Token
forall st. CharParser st Token
oBraceT CharParser st Token
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m a -> m [a] -> m [a]
<:> GenParser Char st [Token]
p GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [a] -> m [a] -> m [a]
<++> CharParser st Token -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m a -> m [a]
single CharParser st Token
forall st. CharParser st Token
cBraceT
GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> GenParser Char st [Token] -> GenParser Char st [Token]
forall tok st a. GenParser tok st a -> GenParser tok st a
try (CharParser st Token
forall st. CharParser st Token
oBracketT CharParser st Token
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m a -> m [a] -> m [a]
<:> CharParser st Token -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m a -> m [a]
single CharParser st Token
forall st. CharParser st Token
cBracketT)
bracketP :: GenParser Char st [Token] -> GenParser Char st [Token]
bracketP :: GenParser Char st [Token] -> GenParser Char st [Token]
bracketP p :: GenParser Char st [Token]
p = CharParser st Token
forall st. CharParser st Token
oBracketT CharParser st Token
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m a -> m [a] -> m [a]
<:> GenParser Char st [Token]
p GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [a] -> m [a] -> m [a]
<++> CharParser st Token -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m a -> m [a]
single CharParser st Token
forall st. CharParser st Token
cBracketT
innerMix1 :: ([String], [String]) -> GenParser Char st [Token]
innerMix1 :: ([String], [String]) -> GenParser Char st [Token]
innerMix1 l :: ([String], [String])
l = ([String], [String]) -> GenParser Char st Token
forall st. ([String], [String]) -> GenParser Char st Token
sid ([String], [String])
l GenParser Char st Token
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m a -> m [a] -> m [a]
<:> GenParser Char st [Token] -> GenParser Char st [Token]
forall tok st a. GenParser tok st [a] -> GenParser tok st [a]
optionL (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
innerMix2 ([String], [String])
l)
innerMix2 :: ([String], [String]) -> GenParser Char st [Token]
innerMix2 :: ([String], [String]) -> GenParser Char st [Token]
innerMix2 l :: ([String], [String])
l = let p :: GenParser Char st [Token]
p = ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
innerList ([String], [String])
l in
ParsecT String st Identity [[Token]] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [[a]] -> m [a]
flat (GenParser Char st [Token] -> ParsecT String st Identity [[Token]]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 (GenParser Char st [Token] -> GenParser Char st [Token]
forall st. GenParser Char st [Token] -> GenParser Char st [Token]
braceP GenParser Char st [Token]
forall st. GenParser Char st [Token]
p GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> GenParser Char st [Token] -> GenParser Char st [Token]
forall st. GenParser Char st [Token] -> GenParser Char st [Token]
bracketP GenParser Char st [Token]
forall st. GenParser Char st [Token]
p GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ParsecT String st Identity Token -> GenParser Char st [Token]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 ParsecT String st Identity Token
forall st. CharParser st Token
placeT))
GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [a] -> m [a] -> m [a]
<++> GenParser Char st [Token] -> GenParser Char st [Token]
forall tok st a. GenParser tok st [a] -> GenParser tok st [a]
optionL (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
innerMix1 ([String], [String])
l)
innerList :: ([String], [String]) -> GenParser Char st [Token]
innerList :: ([String], [String]) -> GenParser Char st [Token]
innerList l :: ([String], [String])
l = GenParser Char st [Token] -> GenParser Char st [Token]
forall tok st a. GenParser tok st [a] -> GenParser tok st [a]
optionL (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
innerMix1 ([String], [String])
l GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
innerMix2 ([String], [String])
l GenParser Char st [Token] -> String -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "token")
topMix1 :: ([String], [String]) -> GenParser Char st [Token]
topMix1 :: ([String], [String]) -> GenParser Char st [Token]
topMix1 l :: ([String], [String])
l = ([String], [String]) -> GenParser Char st Token
forall st. ([String], [String]) -> GenParser Char st Token
sid ([String], [String])
l GenParser Char st Token
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m a -> m [a] -> m [a]
<:> GenParser Char st [Token] -> GenParser Char st [Token]
forall tok st a. GenParser tok st [a] -> GenParser tok st [a]
optionL (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
topMix2 ([String], [String])
l)
topMix2 :: ([String], [String]) -> GenParser Char st [Token]
topMix2 :: ([String], [String]) -> GenParser Char st [Token]
topMix2 l :: ([String], [String])
l = ParsecT String st Identity [[Token]] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [[a]] -> m [a]
flat (GenParser Char st [Token] -> ParsecT String st Identity [[Token]]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 (GenParser Char st [Token] -> GenParser Char st [Token]
forall st. GenParser Char st [Token] -> GenParser Char st [Token]
braceP (GenParser Char st [Token] -> GenParser Char st [Token])
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall a b. (a -> b) -> a -> b
$ ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
innerList ([String], [String])
l)) GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [a] -> m [a] -> m [a]
<++> GenParser Char st [Token] -> GenParser Char st [Token]
forall tok st a. GenParser tok st [a] -> GenParser tok st [a]
optionL (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
topMix1 ([String], [String])
l)
topMix3 :: ([String], [String]) -> GenParser Char st [Token]
topMix3 :: ([String], [String]) -> GenParser Char st [Token]
topMix3 l :: ([String], [String])
l = let p :: GenParser Char st [Token]
p = ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
innerList ([String], [String])
l in
GenParser Char st [Token] -> GenParser Char st [Token]
forall st. GenParser Char st [Token] -> GenParser Char st [Token]
bracketP GenParser Char st [Token]
forall st. GenParser Char st [Token]
p GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [a] -> m [a] -> m [a]
<++> ParsecT String st Identity [[Token]] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [[a]] -> m [a]
flat (GenParser Char st [Token] -> ParsecT String st Identity [[Token]]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many (GenParser Char st [Token] -> GenParser Char st [Token]
forall st. GenParser Char st [Token] -> GenParser Char st [Token]
braceP GenParser Char st [Token]
forall st. GenParser Char st [Token]
p))
GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [a] -> m [a] -> m [a]
<++> GenParser Char st [Token] -> GenParser Char st [Token]
forall tok st a. GenParser tok st [a] -> GenParser tok st [a]
optionL (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
topMix1 ([String], [String])
l)
afterPlace :: ([String], [String]) -> GenParser Char st [Token]
afterPlace :: ([String], [String]) -> GenParser Char st [Token]
afterPlace l :: ([String], [String])
l = ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
topMix1 ([String], [String])
l GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
topMix2 ([String], [String])
l GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
topMix3 ([String], [String])
l
middle :: ([String], [String]) -> GenParser Char st [Token]
middle :: ([String], [String]) -> GenParser Char st [Token]
middle l :: ([String], [String])
l = ParsecT String st Identity Token -> GenParser Char st [Token]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 ParsecT String st Identity Token
forall st. CharParser st Token
placeT GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [a] -> m [a] -> m [a]
<++> GenParser Char st [Token] -> GenParser Char st [Token]
forall tok st a. GenParser tok st [a] -> GenParser tok st [a]
optionL (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
afterPlace ([String], [String])
l)
tokStart :: ([String], [String]) -> GenParser Char st [Token]
tokStart :: ([String], [String]) -> GenParser Char st [Token]
tokStart l :: ([String], [String])
l = ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
afterPlace ([String], [String])
l GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [a] -> m [a] -> m [a]
<++> ParsecT String st Identity [[Token]] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [[a]] -> m [a]
flat (GenParser Char st [Token] -> ParsecT String st Identity [[Token]]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
middle ([String], [String])
l))
start :: ([String], [String]) -> GenParser Char st [Token]
start :: ([String], [String]) -> GenParser Char st [Token]
start l :: ([String], [String])
l = ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
tokStart ([String], [String])
l GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> CharParser st Token
forall st. CharParser st Token
placeT CharParser st Token
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m a -> m [a] -> m [a]
<:> (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
tokStart ([String], [String])
l GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|>
CharParser st Token -> GenParser Char st [Token]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 CharParser st Token
forall st. CharParser st Token
placeT GenParser Char st [Token]
-> GenParser Char st [Token] -> GenParser Char st [Token]
forall (m :: * -> *) a. Monad m => m [a] -> m [a] -> m [a]
<++> GenParser Char st [Token] -> GenParser Char st [Token]
forall tok st a. GenParser tok st [a] -> GenParser tok st [a]
optionL (([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
tokStart ([String], [String])
l))
GenParser Char st [Token] -> String -> GenParser Char st [Token]
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> "id"
comps :: ([String], [String]) -> GenParser Char st ([Id], Range)
comps :: ([String], [String]) -> GenParser Char st ([Id], Range)
comps keys :: ([String], [String])
keys = do
Token
o <- CharParser st Token
forall st. CharParser st Token
oBracketT
(ts :: [Id]
ts, ps :: [Token]
ps) <- ([String], [String])
-> ([String], [String]) -> GenParser Char st Id
forall st.
([String], [String])
-> ([String], [String]) -> GenParser Char st Id
mixId ([String], [String])
keys ([String], [String])
keys GenParser Char st Id
-> CharParser st Token -> GenParser Char st ([Id], [Token])
forall tok st a b.
GenParser tok st a
-> GenParser tok st b -> GenParser tok st ([a], [b])
`separatedBy` CharParser st Token
forall st. CharParser st Token
commaT
Token
c <- CharParser st Token
forall st. CharParser st Token
cBracketT
([Id], Range) -> GenParser Char st ([Id], Range)
forall (m :: * -> *) a. Monad m => a -> m a
return ([Id]
ts, Token -> [Token] -> Token -> Range
toRange Token
o [Token]
ps Token
c)
mixId :: ([String], [String]) -> ([String], [String]) -> GenParser Char st Id
mixId :: ([String], [String])
-> ([String], [String]) -> GenParser Char st Id
mixId keys :: ([String], [String])
keys idKeys :: ([String], [String])
idKeys = do
[Token]
l <- ([String], [String]) -> GenParser Char st [Token]
forall st. ([String], [String]) -> GenParser Char st [Token]
start ([String], [String])
keys
if Token -> Bool
isPlace ([Token] -> Token
forall a. [a] -> a
last [Token]
l) then Id -> GenParser Char st Id
forall (m :: * -> *) a. Monad m => a -> m a
return ([Token] -> [Id] -> Range -> Id
Id [Token]
l [] Range
nullRange) else do
(c :: [Id]
c, p :: Range
p) <- ([Id], Range)
-> ParsecT String st Identity ([Id], Range)
-> ParsecT String st Identity ([Id], Range)
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
option ([], Range
nullRange) (([String], [String]) -> ParsecT String st Identity ([Id], Range)
forall st. ([String], [String]) -> GenParser Char st ([Id], Range)
comps ([String], [String])
idKeys)
[Token]
u <- ParsecT String st Identity Token -> GenParser Char st [Token]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many ParsecT String st Identity Token
forall st. CharParser st Token
placeT
Id -> GenParser Char st Id
forall (m :: * -> *) a. Monad m => a -> m a
return ([Token] -> [Id] -> Range -> Id
Id ([Token]
l [Token] -> [Token] -> [Token]
forall a. [a] -> [a] -> [a]
++ [Token]
u) [Id]
c Range
p)
casl_keys :: [String] -> ([String], [String])
casl_keys :: [String] -> ([String], [String])
casl_keys ks :: [String]
ks = ([String]
ks [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
casl_reserved_fops, [String]
ks [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
casl_reserved_fwords)
parseId :: [String] -> GenParser Char st Id
parseId :: [String] -> GenParser Char st Id
parseId ks :: [String]
ks = ([String], [String])
-> ([String], [String]) -> GenParser Char st Id
forall st.
([String], [String])
-> ([String], [String]) -> GenParser Char st Id
mixId ([String] -> ([String], [String])
casl_keys [String]
ks) ([String] -> ([String], [String])
casl_keys [String]
ks)
consId :: [String] -> GenParser Char st Id
consId :: [String] -> GenParser Char st Id
consId ks :: [String]
ks = ([String], [String])
-> ([String], [String]) -> GenParser Char st Id
forall st.
([String], [String])
-> ([String], [String]) -> GenParser Char st Id
mixId (String
barS String -> [String] -> [String]
forall a. a -> [a] -> [a]
: [String]
ks [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
casl_reserved_fops,
[String]
ks [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
casl_reserved_fwords) (([String], [String]) -> GenParser Char st Id)
-> ([String], [String]) -> GenParser Char st Id
forall a b. (a -> b) -> a -> b
$ [String] -> ([String], [String])
casl_keys [String]
ks
sortId :: [String] -> GenParser Char st Id
sortId :: [String] -> GenParser Char st Id
sortId ks :: [String]
ks =
do Token
s <- [String] -> GenParser Char st Token
forall st. [String] -> GenParser Char st Token
varId [String]
ks
(c :: [Id]
c, p :: Range
p) <- ([Id], Range)
-> ParsecT String st Identity ([Id], Range)
-> ParsecT String st Identity ([Id], Range)
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
option ([], Range
nullRange) (([String], [String]) -> ParsecT String st Identity ([Id], Range)
forall st. ([String], [String]) -> GenParser Char st ([Id], Range)
comps (([String], [String]) -> ParsecT String st Identity ([Id], Range))
-> ([String], [String]) -> ParsecT String st Identity ([Id], Range)
forall a b. (a -> b) -> a -> b
$ [String] -> ([String], [String])
casl_keys [String]
ks)
Id -> GenParser Char st Id
forall (m :: * -> *) a. Monad m => a -> m a
return ([Token] -> [Id] -> Range -> Id
Id [Token
s] [Id]
c Range
p)
varId :: [String] -> GenParser Char st Token
varId :: [String] -> GenParser Char st Token
varId ks :: [String]
ks = CharParser st String -> GenParser Char st Token
forall st. CharParser st String -> CharParser st Token
pToken ([String] -> CharParser st String -> CharParser st String
forall st. [String] -> CharParser st String -> CharParser st String
reserved ([String]
ks [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
casl_reserved_fwords) CharParser st String
forall st. CharParser st String
scanAnyWords)
nonSkippingSimpleId :: GenParser Char st Token
nonSkippingSimpleId :: GenParser Char st Token
nonSkippingSimpleId =
CharParser st String -> GenParser Char st Token
forall st. CharParser st String -> CharParser st Token
parseToken (CharParser st String -> GenParser Char st Token)
-> CharParser st String -> GenParser Char st Token
forall a b. (a -> b) -> a -> b
$ [String] -> CharParser st String -> CharParser st String
forall st. [String] -> CharParser st String -> CharParser st String
reserved [String]
casl_reserved_words CharParser st String
forall st. CharParser st String
scanAnyWords
simpleId :: GenParser Char st Token
simpleId :: GenParser Char st Token
simpleId = GenParser Char st Token
forall st. CharParser st Token
nonSkippingSimpleId GenParser Char st Token
-> ParsecT String st Identity () -> GenParser Char st Token
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity ()
forall st. CharParser st ()
skipSmart
quMarkT :: GenParser Char st Token
quMarkT :: GenParser Char st Token
quMarkT = CharParser st String -> GenParser Char st Token
forall st. CharParser st String -> CharParser st Token
pToken (CharParser st String -> GenParser Char st Token)
-> CharParser st String -> GenParser Char st Token
forall a b. (a -> b) -> a -> b
$ String -> CharParser st String
forall st. String -> CharParser st String
toKey String
quMark
colonST :: GenParser Char st Token
colonST :: GenParser Char st Token
colonST = CharParser st String -> GenParser Char st Token
forall st. CharParser st String -> CharParser st Token
pToken (CharParser st String -> GenParser Char st Token)
-> CharParser st String -> GenParser Char st Token
forall a b. (a -> b) -> a -> b
$ CharParser st String -> CharParser st String
forall tok st a. GenParser tok st a -> GenParser tok st a
try (CharParser st String -> CharParser st String)
-> CharParser st String -> CharParser st String
forall a b. (a -> b) -> a -> b
$ String -> CharParser st String
forall s (m :: * -> *) u.
Stream s m Char =>
String -> ParsecT s u m String
string String
colonS CharParser st String
-> ParsecT String st Identity () -> CharParser st String
forall (m :: * -> *) a b. Monad m => m a -> m b -> m a
<< ParsecT String st Identity Char -> ParsecT String st Identity ()
forall s (m :: * -> *) t a u.
(Stream s m t, Show a) =>
ParsecT s u m a -> ParsecT s u m ()
notFollowedBy
((Char -> Bool) -> ParsecT String st Identity Char
forall s (m :: * -> *) u.
Stream s m Char =>
(Char -> Bool) -> ParsecT s u m Char
satisfy ((Char -> Bool) -> ParsecT String st Identity Char)
-> (Char -> Bool) -> ParsecT String st Identity Char
forall a b. (a -> b) -> a -> b
$ \ c :: Char
c -> Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= '?' Bool -> Bool -> Bool
&& Char -> Bool
isSignChar Char
c)
crossT :: GenParser Char st Token
crossT :: GenParser Char st Token
crossT = CharParser st String -> GenParser Char st Token
forall st. CharParser st String -> CharParser st Token
pToken (String -> CharParser st String
forall st. String -> CharParser st String
toKey String
prodS CharParser st String
-> CharParser st String -> CharParser st String
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> String -> CharParser st String
forall st. String -> CharParser st String
toKey String
timesS) GenParser Char st Token -> String -> GenParser Char st Token
forall s u (m :: * -> *) a.
ParsecT s u m a -> String -> ParsecT s u m a
<?> String -> String
forall a. Show a => a -> String
show String
prodS