2008-10-12 20:53:28 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "picoc.h"
|
|
|
|
|
|
|
|
/* the table of global definitions */
|
|
|
|
struct Table GlobalTable;
|
|
|
|
struct TableEntry GlobalHashTable[GLOBAL_TABLE_SIZE];
|
|
|
|
|
|
|
|
|
2008-10-14 00:51:34 -04:00
|
|
|
|
2008-10-12 20:53:28 -04:00
|
|
|
void ParseInit()
|
|
|
|
{
|
|
|
|
TableInit(&GlobalTable, &GlobalHashTable[0], "global", GLOBAL_TABLE_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* quick scan a source file for definitions */
|
|
|
|
void ParseScan(const Str *FileName, const Str *Source)
|
|
|
|
{
|
|
|
|
enum LexToken Token;
|
2008-10-14 00:51:34 -04:00
|
|
|
struct LexState Lexer;
|
2008-10-12 20:53:28 -04:00
|
|
|
|
2008-10-14 00:51:34 -04:00
|
|
|
LexInit(&Lexer, Source, FileName, 1);
|
2008-10-12 20:53:28 -04:00
|
|
|
|
2008-10-14 00:51:34 -04:00
|
|
|
while ( (Token = LexGetToken(&Lexer)) != TokenEOF)
|
2008-10-12 20:53:28 -04:00
|
|
|
{
|
|
|
|
/* do parsey things here */
|
2008-10-14 07:18:43 -04:00
|
|
|
StrPrintf("token %d\n", (int)Token);
|
2008-10-12 20:53:28 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ParseCallFunction(const Str *FuncIdent, int argc, char **argv)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|