import "ecdefs"
+import "lexer"
extern int yychar;
OldList dataRedefinitions;
-// #define MAX_INCLUDE_DEPTH 10
+// #define MAX_INCLUDE_DEPTH 30
extern char sourceFileStack[MAX_INCLUDE_DEPTH][MAX_LOCATION];
extern int include_stack_ptr;
public void SetEcereImported(bool b) { ecereImported = b; } public bool GetEcereImported() { return ecereImported; }
bool inPreCompiler = false;
public void SetInPreCompiler(bool b) {inPreCompiler = b; }
+bool inSymbolGen = false;
+public void SetInSymbolGen(bool b) {inSymbolGen = b; }
OldList * precompDefines;
public void SetPrecompDefines(OldList * list) { precompDefines = list; }
-bool DummyMethod()
+public bool DummyMethod()
{
return true;
}
f.GetLine(line, sizeof(line)); TrimLSpaces(line, line);
if(regClass && strcmp(line, "[None]"))
{
+ LexerBackup backup = pushLexer(); // We currently don't have a separate Lexer instance for TU/Type/Expression
Operand op;
Expression exp;
- Location oldLocation = yylloc;
-
- File backFileInput = fileInput;
- declMode = 0;
- resetScanner();
exp = ParseExpressionString(line);
if(info)
defaultArg.expression.ui64 = op.ui64;
FreeExpression(exp);
- // TESTING THIS SCANNER RESUME STUFF
- resetScanner();
- yylloc = oldLocation;
- fileInput = backFileInput;
- if(fileInput)
- {
- fileInput.Seek(yylloc.start.pos, start);
- resetScannerPos(&yylloc.start);
- yychar = -2;
- }
+ popLexer(backup);
}
break;
case identifier:
{
// TOFIX:
//if(!(data = (GlobalData)nameSpace->functions.FindString(name)))
- data = (GlobalData)nameSpace->functions.FindString(name);
+ data = (GlobalData)nameSpace->functions.FindString(name + start);
if(!data)
{
data = GlobalData
dataTypeString = CopyString(line),
module = privateModule
};
- data.key = (uint)(data.fullName + start);
+ data.key = (uintptr)(data.fullName + start);
// Reusing functions here...
nameSpace->functions.Add((BTNode)data);
}
}
else if(importType != comCheckImport)
{
- Compiler_Error($"Couldn't open %s\n", fileName);
+ char sysFileName[MAX_LOCATION];
+ GetSystemPathBuffer(sysFileName, fileName);
+ Compiler_Error($"Couldn't open %s\n", sysFileName);
}
return globalInstance;
}
// Load an extra instance of any shared module to ensure freeing up a
// module loaded in another file will not invalidate our objects.
- if(!inCompiler)
+ if(!inCompiler && !inPreCompiler && !inSymbolGen)
{
MapIterator<String, List<Module> > it { map = loadedModules };
if(!it.Index(file, false))
{
- Module firstModule = eModule_LoadStrict(__thisModule, file, importAccess);
+ Module firstModule = eModule_LoadStrict(__thisModule.application, file, importAccess);
if(firstModule)
{
list = { };
break;
}
}
- if(sysIncludeDirs)
+ if(!file && sysIncludeDirs)
{
for(includeDir = sysIncludeDirs->first; includeDir; includeDir = includeDir.next)
{