mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
Transfer: Removed PType from source and core languages.
This commit is contained in:
@@ -58,7 +58,6 @@ data Tree :: * -> * where
|
||||
PEmptyList :: Tree Pattern_
|
||||
PList :: [CommaPattern] -> Tree Pattern_
|
||||
PTuple :: CommaPattern -> [CommaPattern] -> Tree Pattern_
|
||||
PType :: Tree Pattern_
|
||||
PStr :: String -> Tree Pattern_
|
||||
PInt :: Integer -> Tree Pattern_
|
||||
PVar :: Ident -> Tree Pattern_
|
||||
@@ -212,7 +211,6 @@ instance Show (Tree c) where
|
||||
PEmptyList -> showString "PEmptyList"
|
||||
PList commapatterns -> opar n . showString "PList" . showChar ' ' . showsPrec 1 commapatterns . cpar n
|
||||
PTuple commapattern commapatterns -> opar n . showString "PTuple" . showChar ' ' . showsPrec 1 commapattern . showChar ' ' . showsPrec 1 commapatterns . cpar n
|
||||
PType -> showString "PType"
|
||||
PStr str -> opar n . showString "PStr" . showChar ' ' . showsPrec 1 str . cpar n
|
||||
PInt n -> opar n . showString "PInt" . showChar ' ' . showsPrec 1 n . cpar n
|
||||
PVar i -> opar n . showString "PVar" . showChar ' ' . showsPrec 1 i . cpar n
|
||||
@@ -288,7 +286,6 @@ johnMajorEq (PRec fieldpatterns) (PRec fieldpatterns_) = fieldpatterns == fieldp
|
||||
johnMajorEq PEmptyList PEmptyList = True
|
||||
johnMajorEq (PList commapatterns) (PList commapatterns_) = commapatterns == commapatterns_
|
||||
johnMajorEq (PTuple commapattern commapatterns) (PTuple commapattern_ commapatterns_) = commapattern == commapattern_ && commapatterns == commapatterns_
|
||||
johnMajorEq PType PType = True
|
||||
johnMajorEq (PStr str) (PStr str_) = str == str_
|
||||
johnMajorEq (PInt n) (PInt n_) = n == n_
|
||||
johnMajorEq (PVar i) (PVar i_) = i == i_
|
||||
@@ -363,59 +360,58 @@ instance Ord (Tree c) where
|
||||
index (PEmptyList ) = 14
|
||||
index (PList _) = 15
|
||||
index (PTuple _ _) = 16
|
||||
index (PType ) = 17
|
||||
index (PStr _) = 18
|
||||
index (PInt _) = 19
|
||||
index (PVar _) = 20
|
||||
index (PWild ) = 21
|
||||
index (CommaPattern _) = 22
|
||||
index (FieldPattern _ _) = 23
|
||||
index (EPi _ _ _) = 24
|
||||
index (EPiNoVar _ _) = 25
|
||||
index (EAbs _ _) = 26
|
||||
index (ELet _ _) = 27
|
||||
index (ECase _ _) = 28
|
||||
index (EIf _ _ _) = 29
|
||||
index (EDo _ _) = 30
|
||||
index (EBind _ _) = 31
|
||||
index (EBindC _ _) = 32
|
||||
index (EOr _ _) = 33
|
||||
index (EAnd _ _) = 34
|
||||
index (EEq _ _) = 35
|
||||
index (ENe _ _) = 36
|
||||
index (ELt _ _) = 37
|
||||
index (ELe _ _) = 38
|
||||
index (EGt _ _) = 39
|
||||
index (EGe _ _) = 40
|
||||
index (EListCons _ _) = 41
|
||||
index (EAdd _ _) = 42
|
||||
index (ESub _ _) = 43
|
||||
index (EMul _ _) = 44
|
||||
index (EDiv _ _) = 45
|
||||
index (EMod _ _) = 46
|
||||
index (ENeg _) = 47
|
||||
index (EApp _ _) = 48
|
||||
index (EProj _ _) = 49
|
||||
index (ERecType _) = 50
|
||||
index (ERec _) = 51
|
||||
index (EEmptyList ) = 52
|
||||
index (EList _) = 53
|
||||
index (ETuple _ _) = 54
|
||||
index (EVar _) = 55
|
||||
index (EType ) = 56
|
||||
index (EStr _) = 57
|
||||
index (EInteger _) = 58
|
||||
index (EDouble _) = 59
|
||||
index (EMeta ) = 60
|
||||
index (VVar _) = 61
|
||||
index (VWild ) = 62
|
||||
index (LetDef _ _) = 63
|
||||
index (Case _ _ _) = 64
|
||||
index (BindVar _ _) = 65
|
||||
index (BindNoVar _) = 66
|
||||
index (FieldType _ _) = 67
|
||||
index (FieldValue _ _) = 68
|
||||
index (Ident _) = 69
|
||||
index (PStr _) = 17
|
||||
index (PInt _) = 18
|
||||
index (PVar _) = 19
|
||||
index (PWild ) = 20
|
||||
index (CommaPattern _) = 21
|
||||
index (FieldPattern _ _) = 22
|
||||
index (EPi _ _ _) = 23
|
||||
index (EPiNoVar _ _) = 24
|
||||
index (EAbs _ _) = 25
|
||||
index (ELet _ _) = 26
|
||||
index (ECase _ _) = 27
|
||||
index (EIf _ _ _) = 28
|
||||
index (EDo _ _) = 29
|
||||
index (EBind _ _) = 30
|
||||
index (EBindC _ _) = 31
|
||||
index (EOr _ _) = 32
|
||||
index (EAnd _ _) = 33
|
||||
index (EEq _ _) = 34
|
||||
index (ENe _ _) = 35
|
||||
index (ELt _ _) = 36
|
||||
index (ELe _ _) = 37
|
||||
index (EGt _ _) = 38
|
||||
index (EGe _ _) = 39
|
||||
index (EListCons _ _) = 40
|
||||
index (EAdd _ _) = 41
|
||||
index (ESub _ _) = 42
|
||||
index (EMul _ _) = 43
|
||||
index (EDiv _ _) = 44
|
||||
index (EMod _ _) = 45
|
||||
index (ENeg _) = 46
|
||||
index (EApp _ _) = 47
|
||||
index (EProj _ _) = 48
|
||||
index (ERecType _) = 49
|
||||
index (ERec _) = 50
|
||||
index (EEmptyList ) = 51
|
||||
index (EList _) = 52
|
||||
index (ETuple _ _) = 53
|
||||
index (EVar _) = 54
|
||||
index (EType ) = 55
|
||||
index (EStr _) = 56
|
||||
index (EInteger _) = 57
|
||||
index (EDouble _) = 58
|
||||
index (EMeta ) = 59
|
||||
index (VVar _) = 60
|
||||
index (VWild ) = 61
|
||||
index (LetDef _ _) = 62
|
||||
index (Case _ _ _) = 63
|
||||
index (BindVar _ _) = 64
|
||||
index (BindNoVar _) = 65
|
||||
index (FieldType _ _) = 66
|
||||
index (FieldValue _ _) = 67
|
||||
index (Ident _) = 68
|
||||
compareSame (Module imports decls) (Module imports_ decls_) = mappend (compare imports imports_) (compare decls decls_)
|
||||
compareSame (Import i) (Import i_) = compare i i_
|
||||
compareSame (DataDecl i exp consdecls) (DataDecl i_ exp_ consdecls_) = mappend (compare i i_) (mappend (compare exp exp_) (compare consdecls consdecls_))
|
||||
@@ -433,7 +429,6 @@ instance Ord (Tree c) where
|
||||
compareSame PEmptyList PEmptyList = EQ
|
||||
compareSame (PList commapatterns) (PList commapatterns_) = compare commapatterns commapatterns_
|
||||
compareSame (PTuple commapattern commapatterns) (PTuple commapattern_ commapatterns_) = mappend (compare commapattern commapattern_) (compare commapatterns commapatterns_)
|
||||
compareSame PType PType = EQ
|
||||
compareSame (PStr str) (PStr str_) = compare str str_
|
||||
compareSame (PInt n) (PInt n_) = compare n n_
|
||||
compareSame (PVar i) (PVar i_) = compare i i_
|
||||
|
||||
@@ -143,7 +143,6 @@ All other symbols are terminals.\\
|
||||
& {\delimit} &{\terminal{[}} {\terminal{]}} \\
|
||||
& {\delimit} &{\terminal{[}} {\nonterminal{ListCommaPattern}} {\terminal{]}} \\
|
||||
& {\delimit} &{\terminal{(}} {\nonterminal{CommaPattern}} {\terminal{,}} {\nonterminal{ListCommaPattern}} {\terminal{)}} \\
|
||||
& {\delimit} &{\terminal{Type}} \\
|
||||
& {\delimit} &{\nonterminal{String}} \\
|
||||
& {\delimit} &{\nonterminal{Integer}} \\
|
||||
& {\delimit} &{\nonterminal{Ident}} \\
|
||||
|
||||
@@ -44,7 +44,7 @@ share :: String -> String
|
||||
share = id
|
||||
|
||||
data Tok =
|
||||
TS !String -- reserved words
|
||||
TS !String -- reserved words and symbols
|
||||
| TL !String -- string literals
|
||||
| TI !String -- integer literals
|
||||
| TV !String -- identifiers
|
||||
|
||||
@@ -15,7 +15,7 @@ $d = [0-9] -- digit
|
||||
$i = [$l $d _ '] -- identifier character
|
||||
$u = [\0-\255] -- universal: any character
|
||||
|
||||
@rsyms = -- reserved words consisting of special symbols
|
||||
@rsyms = -- symbols and non-identifier-like reserved words
|
||||
\; | \: | \{ | \} | \= | \| | \| \| | \: \: | \( | \) | \[ | \] | \, | \_ | \- \> | \\ | \< \- | \> \> \= | \> \> | \& \& | \= \= | \/ \= | \< | \< \= | \> | \> \= | \+ | \- | \* | \/ | \% | \. | \?
|
||||
|
||||
:-
|
||||
@@ -39,7 +39,7 @@ share :: String -> String
|
||||
share = id
|
||||
|
||||
data Tok =
|
||||
TS !String -- reserved words
|
||||
TS !String -- reserved words and symbols
|
||||
| TL !String -- string literals
|
||||
| TI !String -- integer literals
|
||||
| TV !String -- identifiers
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -137,7 +137,6 @@ Pattern3 : 'rec' '{' ListFieldPattern '}' { PRec $3 }
|
||||
| '[' ']' { PEmptyList }
|
||||
| '[' ListCommaPattern ']' { PList $2 }
|
||||
| '(' CommaPattern ',' ListCommaPattern ')' { PTuple $2 $4 }
|
||||
| 'Type' { PType }
|
||||
| String { PStr $1 }
|
||||
| Integer { PInt $1 }
|
||||
| Ident { PVar $1 }
|
||||
|
||||
@@ -97,7 +97,6 @@ instance Print (Tree c) where
|
||||
PEmptyList -> prPrec _i 3 (concatD [doc (showString "[") , doc (showString "]")])
|
||||
PList commapatterns -> prPrec _i 3 (concatD [doc (showString "[") , prt 0 commapatterns , doc (showString "]")])
|
||||
PTuple commapattern commapatterns -> prPrec _i 3 (concatD [doc (showString "(") , prt 0 commapattern , doc (showString ",") , prt 0 commapatterns , doc (showString ")")])
|
||||
PType -> prPrec _i 3 (concatD [doc (showString "Type")])
|
||||
PStr str -> prPrec _i 3 (concatD [prt 0 str])
|
||||
PInt n -> prPrec _i 3 (concatD [prt 0 n])
|
||||
PVar i -> prPrec _i 3 (concatD [prt 0 i])
|
||||
|
||||
@@ -28,7 +28,6 @@ transTree t = case t of
|
||||
PEmptyList -> failure t
|
||||
PList commapatterns -> failure t
|
||||
PTuple commapattern commapatterns -> failure t
|
||||
PType -> failure t
|
||||
PStr str -> failure t
|
||||
PInt n -> failure t
|
||||
PVar i -> failure t
|
||||
@@ -116,7 +115,6 @@ transPattern t = case t of
|
||||
PEmptyList -> failure t
|
||||
PList commapatterns -> failure t
|
||||
PTuple commapattern commapatterns -> failure t
|
||||
PType -> failure t
|
||||
PStr str -> failure t
|
||||
PInt n -> failure t
|
||||
PVar i -> failure t
|
||||
|
||||
@@ -55,8 +55,6 @@ PTuple. Pattern3 ::= "(" CommaPattern "," [CommaPattern] ")" ;
|
||||
CommaPattern. CommaPattern ::= Pattern ;
|
||||
separator nonempty CommaPattern "," ;
|
||||
|
||||
-- The pattern matching the Type constant
|
||||
PType. Pattern3 ::= "Type" ;
|
||||
-- String literal patterns
|
||||
PStr. Pattern3 ::= String ;
|
||||
-- Integer literal patterns
|
||||
|
||||
Reference in New Issue
Block a user