Commit 798891d9 authored by John van Groningen's avatar John van Groningen

remove overload statement from Clean 1.3

parent e67b093c
......@@ -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
......@@ -641,7 +625,6 @@ Algebraic imp cleanid imports input
where
(input`,sym,_,_) = ScanInput input;
Constructors :: !Bool !String !(List String) !(Input a) -> (!Input a, !List String,!IdentifierPositionList) | ScanInput a;
Constructors imp cleanid imports input
| trace_n ("Constructors",sym,input.linenr) False = undef
......@@ -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`;
......@@ -840,7 +822,6 @@ FindColon1 curpos curlen line
curpos` = inc curpos;
curchar = line.[curpos];
FindColon2 :: !Int !Int !String -> (!Bool, !Int, !Symbol);
FindColon2 curpos curlen line
| curpos >= curlen = FindId2 IdentFunnySymID (dec curpos) 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);
......@@ -885,7 +863,6 @@ FindStar1 curpos curlen line
where
curchar = line.[curpos];
FindId1 :: !SymbolId !Int !Int !Int !String -> (!Bool, !Int, !Symbol);
FindId1 symid start curpos curlen str
| curpos >= curlen = FindReserved symid start curpos curlen str;
......@@ -898,7 +875,6 @@ FindId1 symid start curpos curlen str
curchar = str.[curpos];
curpos` = inc curpos;
FindReserved :: !SymbolId !Int !Int !Int !String -> (!Bool, !Int, !Symbol);
FindReserved symid start curpos curlen str
| start>=curpos
......@@ -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);
......@@ -930,7 +903,6 @@ FindReserved symid start curpos curlen str
where
first_char = str.[start];
FindId2 :: !SymbolId !Int !Int !Int !String -> (!Bool, !Int, !Symbol);
FindId2 symid start curpos curlen str
| curpos >= curlen = (True, curpos, {repr=symid, string=str % (start,dec curpos)});
......@@ -949,14 +921,12 @@ OpenTextFile path files
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
= { offside = offside,
......@@ -983,7 +953,6 @@ 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
| curpos >= curlen = True
......@@ -1168,7 +1137,6 @@ where
curchar = s.[0]
nextchar = s.[1]
SkipQuote :: !Int !Int !String !Int -> (!Int, !Int, !Int);
SkipQuote pos len str charnr
| pos >= len = (pos,len,charnr);
......@@ -1180,7 +1148,6 @@ SkipQuote pos len str charnr
pos` = inc pos;
charnr` = inc charnr;
SkipQuote2 :: !Int !Int !String !Int -> (!Int, !Int, !Int);
SkipQuote2 pos len str charnr
| pos >= len = (pos,len,charnr);
......@@ -1198,7 +1165,6 @@ IsSubStr subpos substop substr pos stop str
subc = substr.[subpos];
c = str.[pos];
/* Aux. functions for testing whether characters are in certain classes */
SpecialChar :: !Char -> Bool;
......@@ -1208,7 +1174,6 @@ SpecialChar c = pos < speciallen;
special = "~@#$%^?!+-*<>\\/|&=:.";
speciallen = size special;
FindChar :: !Char !String !Int !Int -> Int;
FindChar c line linelen pos
| pos >= 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,7 +1258,6 @@ 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;
......@@ -1304,10 +1265,7 @@ IsModId2 pos len id | pos >= len = True;
where
curchar = id.[pos];
//
// Checks whether string is a type specification
//
IsTypeSpec :: !String -> Bool;
IsTypeSpec str
......@@ -1320,7 +1278,6 @@ 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;
......@@ -1335,7 +1292,6 @@ SkipLayOutChars str strlen pos
where
curchar = str.[pos];
FindCleanId :: !String !Int !Int -> (!Int, !Int);
FindCleanId id idlen pos
| pos >= idlen = (idlen, idlen);
......@@ -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;
......@@ -1373,7 +1328,6 @@ Error str strlen pos
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 '<modulename> could not be imported' message
IsImportError13 :: !String -> (!Bool,!String);
......@@ -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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment