From 798891d98241954af09309717d6b5d7cece0023e Mon Sep 17 00:00:00 2001 From: John van Groningen Date: Fri, 22 Oct 2010 10:34:07 +0000 Subject: [PATCH] remove overload statement from Clean 1.3 --- Pm/PmParse.icl | 50 +------------------------------------------------- 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/Pm/PmParse.icl b/Pm/PmParse.icl index c9eda04..871160c 100644 --- a/Pm/PmParse.icl +++ b/Pm/PmParse.icl @@ -8,9 +8,7 @@ import StdPathname import UtilStrictLists import UtilNewlinesFile -//import StdDebug trace_n _ g :== g -//from dodebug import trace_n` instance toString Symbol where @@ -52,7 +50,6 @@ IdentUpperSymID :== 14; IdentFunnySymID :== 15; FromSymID :== 16; ImportSymID :== 17; -OverloadSymID :== 18; InstanceSymID :== 19; ClassSymID :== 20; InfixSymID :== 21; @@ -76,7 +73,6 @@ TypeSpecSym :== {repr = TypeSpecSymID, string = ""}; UniqueAttrSym :== {repr = UniqueAttrSymID, string = "*"}; FromSym :== {repr = FromSymID, string = ""}; ImportSym :== {repr = ImportSymID, string = ""}; -OverloadSym :== {repr = OverloadSymID, string = ""}; InstanceSym :== {repr = InstanceSymID, string = ""}; ClassSym :== {repr = ClassSymID, string = ""}; InfixSym :== {repr = InfixSymID, string = ""}; // DvA @@ -139,8 +135,6 @@ where # (rest,input) = TT input = ([sym:rest],input) -//==== - :: DefinesState = { syms :: ![Def] } @@ -255,7 +249,6 @@ ScanMatch str open close (oString,cString) depth input TypeSpecSymID -> ScanMatch (str +++. "::") open close (oString,cString) depth input FromSymID -> ScanMatch (str +++. "from") open close (oString,cString) depth input ImportSymID -> ScanMatch (str +++. "import") open close (oString,cString) depth input - OverloadSymID -> ScanMatch (str +++. "overload") open close (oString,cString) depth input InstanceSymID -> ScanMatch (str +++. "instance") open close (oString,cString) depth input ClassSymID -> ScanMatch (str +++. "class") open close (oString,cString) depth input InfixSymID -> ScanMatch (str +++. "infix") open close (oString,cString) depth input @@ -309,8 +302,6 @@ FindDefinitionInText imp imports cleanid text files # (input,imports,positions) = FindDefinitionInInput imp cleanid imports (StartInput` text) = ((imports,positions), files) -//--- - //FindIdentifiersInInput :: !Bool !String !(List String) !Symbol !Input -> (!Input, !List String, !IdentifierPositionList); FindIdentifiersInInput imp cleanid imports sym=:{repr} input positions | repr==FromSymID && imp @@ -374,8 +365,6 @@ FindDefinitionInInput imp cleanid imports input where (input`,sym,_,_) = ScanInput input; -//-- - Definition1 :: !(Maybe (Symbol,Int,Int)) !Bool !String !(List String) !(Input a) -> (!Input a, !List String,!IdentifierPositionList) | ScanInput a; Definition1 maybe_sym imp cleanid imports input | match_from @@ -385,7 +374,6 @@ Definition1 maybe_sym imp cleanid imports input # (inputb,symb,importsb) = ScanImport imports input`; = SkipToDefinition imp cleanid importsb symb inputb; | match_typespec = TypeDef imp cleanid imports input`; - | match_overload = RuleOrInfixRuleDef imp cleanid imports input`; | match_instance = InstanceDef imp cleanid imports input`; | match_class = trace_n ("Definition1: match_class",lnr) ClassDef imp cleanid imports input`; | match_ident = RuleOrMacroDef lnr cnr imp False cleanid imports input`; @@ -399,7 +387,6 @@ where match_typespec = sym.repr == TypeSpecSymID; match_from = sym.repr == FromSymID && imp; match_import = sym.repr == ImportSymID && imp; - match_overload = sym.repr == OverloadSymID; match_instance = sym.repr == InstanceSymID; match_class = sym.repr == ClassSymID; match_ident = IdentSymId sym.repr && sym.string == cleanid; @@ -529,8 +516,6 @@ where match_closebrace2 = sym.repr == CloseBraceSymID; match_eof = sym.repr == EofSymID; -//-- - InstanceDef :: !Bool !String !(List String) !(Input a) -> (!Input a, !List String,!IdentifierPositionList) | ScanInput a; InstanceDef imp cleanid imports input | match_ident = FoundInstance cleanid sym lnr cnr imp imports input`; @@ -628,7 +613,6 @@ TypeDef imp cleanid imports input match_typevar2 = IsTypeSymId sym.repr; match_typevar1 = match_typevar2 && sym.string == cleanid; - Algebraic :: !Bool !String !(List String) !(Input a) -> (!Input a, !List String,!IdentifierPositionList) | ScanInput a; Algebraic imp cleanid imports input | sym.repr==IsSymID @@ -640,7 +624,6 @@ Algebraic imp cleanid imports input = (input`,imports,PosNil); where (input`,sym,_,_) = ScanInput input; - Constructors :: !Bool !String !(List String) !(Input a) -> (!Input a, !List String,!IdentifierPositionList) | ScanInput a; Constructors imp cleanid imports input @@ -687,7 +670,6 @@ NextFields imp cleanid imports input where (input1,sym,_,_) = ScanInput input; - InfixConstructors :: !Bool !String !(List String) !(Input a) -> (!Input a, !List String,!IdentifierPositionList) | ScanInput a; InfixConstructors imp cleanid imports input | match_ident1 = FoundDefinition cleanid sym lnr cnr imp imports input`; @@ -839,7 +821,6 @@ FindColon1 curpos curlen line where curpos` = inc curpos; curchar = line.[curpos]; - FindColon2 :: !Int !Int !String -> (!Bool, !Int, !Symbol); FindColon2 curpos curlen line @@ -850,7 +831,6 @@ FindColon2 curpos curlen line curpos` = inc curpos; curchar = line.[curpos]; - FindIs1 :: !Int !Int !String -> (!Bool, !Int, !Symbol); FindIs1 curpos curlen line | curpos >= curlen = (True, curpos, IsSym); @@ -859,7 +839,6 @@ FindIs1 curpos curlen line where curchar = line.[curpos]; - FindHash1 :: !Int !Int !String -> (!Bool, !Int, !Symbol); FindHash1 curpos curlen line | curpos >= curlen = (True, curpos, HashSym); @@ -876,7 +855,6 @@ FindBar1 curpos curlen line where curchar = line.[curpos]; - FindStar1 :: !Int !Int !String -> (!Bool, !Int, !Symbol); FindStar1 curpos curlen line | curpos >= curlen = (True, curpos, UniqueAttrSym); @@ -884,7 +862,6 @@ FindStar1 curpos curlen line = (True, curpos, UniqueAttrSym); where curchar = line.[curpos]; - FindId1 :: !SymbolId !Int !Int !Int !String -> (!Bool, !Int, !Symbol); FindId1 symid start curpos curlen str @@ -897,7 +874,6 @@ FindId1 symid start curpos curlen str where curchar = str.[curpos]; curpos` = inc curpos; - FindReserved :: !SymbolId !Int !Int !Int !String -> (!Bool, !Int, !Symbol); FindReserved symid start curpos curlen str @@ -908,9 +884,6 @@ FindReserved symid start curpos curlen str | first_char=='i' && start+6==curpos && str.[start+1]=='m' && str.[start+2]=='p' && str.[start+3]=='o' && str.[start+4]=='r' && str.[start+5]=='t' = (True,curpos,ImportSym); - | first_char=='o' && start+8==curpos && str.[start+1]=='v' && str.[start+2]=='e' && str.[start+3]=='r' - && str.[start+4]=='l' && str.[start+5]=='o' && str.[start+6]=='a' && str.[start+7]=='d' - = (True,curpos,OverloadSym); | first_char=='i' && start+8==curpos && str.[start+1]=='n' && str.[start+2]=='s' && str.[start+3]=='t' && str.[start+4]=='a' && str.[start+5]=='n' && str.[start+6]=='c' && str.[start+7]=='e' = (True,curpos,InstanceSym); @@ -929,7 +902,6 @@ FindReserved symid start curpos curlen str = (True,curpos,{repr=symid, string=str % (start,dec curpos)}); where first_char = str.[start]; - FindId2 :: !SymbolId !Int !Int !Int !String -> (!Bool, !Int, !Symbol); FindId2 symid start curpos curlen str @@ -948,14 +920,12 @@ OpenTextFile path files = (files`, ok, file) where (ok,file,files`) = fopen path FReadData files - CloseTextFile :: !*File !Files -> Files CloseTextFile file files = files` where (_,files`) = fclose file files - StartInput :: !*File -> Input *File StartInput file @@ -982,7 +952,6 @@ StartInput` file where (_,curpos,curlen,line,file`,linenr,charnr) = SkipLayOut1` False 0 0 0 "" file (-1) (-1); offside = ApplyLayOutRule curpos curlen line; - ApplyLayOutRule :: !Int !Int !String -> Bool ApplyLayOutRule curpos curlen str @@ -1167,7 +1136,6 @@ where where curchar = s.[0] nextchar = s.[1] - SkipQuote :: !Int !Int !String !Int -> (!Int, !Int, !Int); SkipQuote pos len str charnr @@ -1179,7 +1147,6 @@ SkipQuote pos len str charnr curchar = str.[pos]; pos` = inc pos; charnr` = inc charnr; - SkipQuote2 :: !Int !Int !String !Int -> (!Int, !Int, !Int); SkipQuote2 pos len str charnr @@ -1197,7 +1164,6 @@ IsSubStr subpos substop substr pos stop str where subc = substr.[subpos]; c = str.[pos]; - /* Aux. functions for testing whether characters are in certain classes */ @@ -1207,7 +1173,6 @@ SpecialChar c = pos < speciallen; pos = FindChar c special speciallen 0; special = "~@#$%^?!+-*<>\\/|&=:."; speciallen = size special; - FindChar :: !Char !String !Int !Int -> Int; FindChar c line linelen pos @@ -1268,9 +1233,7 @@ SkipDigits i len str | i >= len || c < '0' || '9' < c = i; c = str.[i]; */ -// // Check whether a clipboard selection is a valid Clean module identifier -// CleanModId :: !String -> Bool; CleanModId id = IsModId 0 (size id) id; @@ -1285,7 +1248,6 @@ IsModId pos len id | pos >= len = False; where curchar= id.[pos]; - IsModId1 :: !Int !Int !String -> Bool; IsModId1 pos len id | pos >= len = True; | LowerCase curchar = IsModId1 (inc pos) len id; @@ -1296,18 +1258,14 @@ IsModId1 pos len id | pos >= len = True; where curchar = id.[pos]; - IsModId2 :: !Int !Int !String -> Bool; IsModId2 pos len id | pos >= len = True; | SpecialChar curchar = IsModId2 (inc pos) len id; = False; where curchar = id.[pos]; - -// // Checks whether string is a type specification -// IsTypeSpec :: !String -> Bool; IsTypeSpec str @@ -1320,13 +1278,12 @@ IsTypeSpec str (_,cleanid) = FindCleanId str strlen pos1; hastype = HasSubStr 2 "::" strlen str (inc cleanid); - HasSubStr :: !Int !String !Int !String !Int -> Int; HasSubStr substrlen substr strlen str pos | pos + dec substrlen >= strlen = strlen; | IsSubStr 0 substrlen substr pos (pos+substrlen) str = pos; = HasSubStr substrlen substr strlen str (inc pos); - + SkipLayOutChars :: !String !Int !Int -> Int; SkipLayOutChars str strlen pos | pos >= strlen = pos; @@ -1334,7 +1291,6 @@ SkipLayOutChars str strlen pos = pos; where curchar = str.[pos]; - FindCleanId :: !String !Int !Int -> (!Int, !Int); FindCleanId id idlen pos @@ -1359,7 +1315,6 @@ where | Special curchar = FindCleanId1 id idlen pos`; = dec pos; - // Checks whether string is an error message Error :: !String !Int !Int -> Int; @@ -1372,7 +1327,6 @@ Error str strlen pos where is_error = (str.[pos]=='e' || str.[pos]=='E') && str.[pos+1]=='r' && str.[pos+2]=='r' && str.[pos+3]=='o' && str.[pos+4]=='r'; - // Extracts the modulename out of a ' could not be imported' message @@ -1412,7 +1366,6 @@ IsImportError20 str = (True,path); = (False,EmptyPathname); - // FindOpenChar :: !String !Int !Int -> Int; FindOpenChar str len pos :== FindChar '[' str len pos; @@ -1427,4 +1380,3 @@ FindQuoteChar str len pos :== FindChar '\"' str len pos; // FindColonChar :: !String !Int !Int -> Int; FindColonChar str len pos :== FindChar ':' str len pos; - -- GitLab