* included in the distribution.
*
* $RCSfile: input.c,v $
- * $Revision: 1.11 $
- * $Date: 1999/11/12 16:38:31 $
+ * $Revision: 1.15 $
+ * $Date: 1999/12/01 11:50:34 $
* ------------------------------------------------------------------------*/
#include "prelude.h"
#undef IN
#endif
-#if HAVE_LIBREADLINE && HAVE_READLINE_READLINE_H
+#if HAVE_LIBREADLINE && HAVE_READLINE_READLINE_H && HAVE_READLINE_HISTORY_H
#define USE_READLINE 1
#else
#define USE_READLINE 0
* Global data:
* ------------------------------------------------------------------------*/
-List tyconDefns = NIL; /* type constructor definitions */
-List typeInDefns = NIL; /* type synonym restrictions */
-List valDefns = NIL; /* value definitions in script */
-List classDefns = NIL; /* class defns in script */
-List instDefns = NIL; /* instance defns in script */
-List selDefns = NIL; /* list of selector lists */
-List genDefns = NIL; /* list of generated names */
-List unqualImports = NIL; /* unqualified import list */
-List foreignImports = NIL; /* foreign imports */
-List foreignExports = NIL; /* foreign exportsd */
-List defaultDefns = NIL; /* default definitions (if any) */
-Int defaultLine = 0; /* line in which default defs occur*/
-List evalDefaults = NIL; /* defaults for evaluator */
-
-Cell inputExpr = NIL; /* input expression */
-Cell inputContext = NIL; /* input context */
-Bool literateScripts = FALSE; /* TRUE => default to lit scripts */
-Bool literateErrors = TRUE; /* TRUE => report errs in lit scrs */
-Bool offsideON = TRUE; /* TRUE => implement offside rule */
+List tyconDefns = NIL; /* type constructor definitions */
+List typeInDefns = NIL; /* type synonym restrictions */
+List valDefns = NIL; /* value definitions in script */
+List classDefns = NIL; /* class defns in script */
+List instDefns = NIL; /* instance defns in script */
+List selDefns = NIL; /* list of selector lists */
+List genDefns = NIL; /* list of generated names */
+List unqualImports = NIL; /* unqualified import list */
+List foreignImports = NIL; /* foreign imports */
+List foreignExports = NIL; /* foreign exportsd */
+List defaultDefns = NIL; /* default definitions (if any) */
+Int defaultLine = 0; /* line in which default defs occur*/
+List evalDefaults = NIL; /* defaults for evaluator */
+
+Cell inputExpr = NIL; /* input expression */
+Cell inputContext = NIL; /* input context */
+Bool literateScripts = FALSE; /* TRUE => default to lit scripts */
+Bool literateErrors = TRUE; /* TRUE => report errs in lit scrs */
+Bool offsideON = TRUE; /* TRUE => implement offside rule */
+Bool readingInterface = FALSE;
String repeatStr = 0; /* Repeat last expr */
} while (isISO(c0) && isIn(c0,IDAFTER));
endToken();
identType = isIn(tokenStr[0],LARGE) ? CONID : VARID;
- return findText(tokenStr);
+ if (readingInterface)
+ return unZcodeThenFindText(tokenStr); else
+ return findText(tokenStr);
}
static Void local goOffside(col) /* insert offside marker */
Int col; { /* for specified column */
-assert(offsideON);
+ assert(offsideON);
if (indentDepth>=MAXINDENT) {
ERRMSG(row) "Too many levels of program nesting"
EEND;
}
static Void local unOffside() { /* leave layout rule area */
-assert(offsideON);
+ assert(offsideON);
indentDepth--;
}
static Bool local canUnOffside() { /* Decide if unoffside permitted */
-assert(offsideON);
+ assert(offsideON);
return indentDepth>=0 && layout[indentDepth]!=HARD;
}
if (it==textExport) return EXPORT;
if (it==textDynamic) return DYNAMIC;
if (it==textCcall) return CCALL;
- if (it==textStdcall) return STDCALL;
+ if (it==textStdcall) return STDKALL;
if (it==textUUExport) return UUEXPORT;
if (it==textHiding) return HIDING;
if (it==textQualified) return QUALIFIED;
Int startWith; { /* determining whether to read a */
firstToken = TRUE; /* script or an expression */
firstTokenIs = startWith;
- if (startWith==INTERFACE)
- offsideON = FALSE; else
- offsideON = TRUE;
+ if (startWith==INTERFACE) {
+ offsideON = FALSE; readingInterface = TRUE;
+ } else {
+ offsideON = TRUE; readingInterface = FALSE;
+ }
clearStack();
if (yyparse()) { /* This can only be parser overflow */
setLastExpr(inputExpr);
}
+
+#if EXPLAIN_INSTANCE_RESOLUTION
Void parseContext() { /* Read a context to prove */
parseInput(CONTEXT);
}
+#endif
Void parseInterface(nm,len) /* Read a GHC interface file */
String nm;