PmParse.dcl 1.98 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1 2
definition module PmParse

3
// Clean system syntax dependant parsing
Diederik van Arkel's avatar
Diederik van Arkel committed
4

5
import StdString, StdFile
6
from UtilStrictLists import :: List
Diederik van Arkel's avatar
Diederik van Arkel committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76

FindImportsInFile ::
	!.String					// pathname
	!*Files
	-> *((Bool,List String),*Files);

Tokenize ::
	!String
	!*Files
	-> ([String],*Files)


:: SearchKind
	= Definition
	| Implementation
	| Identifier

:: IdentifierPositionList
	= PosNil
	| Pos !Int !Int IdentifierPositionList
	| Cls !Int !Int IdentifierPositionList
	| Ins !Int !Int IdentifierPositionList


FindIdentifiersInFile ::
	!Bool
	!(List String)		// list of imported modules
	!String
	!String				// pathname
	!Files
	-> ((!List String,!IdentifierPositionList), !Files)

FindIdentifiersInText ::
	!Bool
	!(List String)		// list of imported modules
	!String
	!*{String}
	!Files 
	-> ((!List String,!IdentifierPositionList), !Files);

//	FindDefinitionInFile searches Clean source text (.dcl/.icl file) for an identifier.
FindDefinitionInFile ::
	!Bool						// Bool indicating whether a list of imported module names must be returned
	!(List String)				// List of module names to which modules names imported by this module must be attached
	!String						// The clean identifier to search for
	!String						// The .dcl/.icl full path name.
	!*Files						// The filesystem
	-> (
	( !List String				// List of imported module names
	, !IdentifierPositionList)	// 
	, !Files					// The filesystem
	)

FindDefinitionInText ::
	!Bool
	!(List String)		// list of imported modules
	!String
	!*{String}
	!*Files
	-> ((!List String,!IdentifierPositionList), !Files)

/*	Returns True when 1st arg. is a valid Clean identifier. */
CleanModId :: !String -> Bool;

/*	Returns True when 1st arg. is a type listed by the Clean compiler. */
IsTypeSpec :: !String -> Bool;

IsImportError13 :: !String -> (!Bool,!String);
IsImportError20 :: !String -> (!Bool,!String);

77 78 79 80 81 82 83
// x-perimental...
:: Def
	= DefFun	String Int
	| DefType	String Int
	| DefClass	String Int
	| DefInst	String String Int
FindDefinesInText :: !*{String} !Files -> (![Def],!Files)