G:/ScriptBasic/source/lexer.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "errcodes.h"
#include "report.h"
#include "lexer.h"
#include "ipreproc.h"

Go to the source code of this file.

Defines

#define BUFFERINCREASE   1024
#define REPORT(x1, x2, x3, x4)   if( pLex->report )pLex->report(pLex->reportptr,x1,x2,x3,REPORT_ERROR,&(pLex->iErrorCounter),x4,&(pLex->fErrorFlags))
#define CALL_PREPROCESSOR(X, Y)   if( pLex->pPREP && pLex->pPREP->n )ipreproc_Process(pLex->pPREP,X,Y)
#define GETC()   __GETC(pLex->pfGetCharacter,pLex->pvInput,UngetBuffer,&UngetCounter)
#define UNGETC(x)   __UNGETC(UngetBuffer,&UngetCounter,x)
#define UNGET_BUFFER_LENGTH   10
#define lexALLOC(x)   (pLex->memory_allocating_function((x),pLex->pMemorySegment))
#define lexFREE(x)   (pLex->memory_releasing_function((x),pLex->pMemorySegment),(x)=NULL)
#define NewLexeme()   _NewLexeme(pLex)
#define pfLexeme   (*plexLastLexeme)
#define STORE_CH(x)   lex_StoreCharacter(pLex,x,i)

Functions

int stricmp (char *, char *)
static isinset (int ch, char *string)
static double pow10 (double a)
static int __GETC (int(*pfGetCharacter)(void *), void *pvInput, int *UngetBuffer, int *UngetCounter)
static void __UNGETC (int *UngetBuffer, int *UngetCounter, int ch)
static pLexeme _NewLexeme (pLexObject pLex)
char * lex_SymbolicName (pLexObject pLex, long OpCode)
void lex_HandleContinuationLines (pLexObject pLex)
void lex_RemoveSkipSymbols (pLexObject pLex)
void lex_RemoveComments (pLexObject pLex)
void lex_NextLexeme (pLexObject pLex)
void lex_SavePosition (pLexObject pLex, pLexeme *ppPosition)
void lex_RestorePosition (pLexObject pLex, pLexeme *ppPosition)
void lex_StartIteration (pLexObject pLex)
int lex_EOF (pLexObject pLex)
int lex_Type (pLexObject pLex)
double lex_Double (pLexObject pLex)
char * lex_String (pLexObject pLex)
long lex_StrLen (pLexObject pLex)
long lex_Long (pLexObject pLex)
long lex_LineNumber (pLexObject pLex)
char * lex_FileName (pLexObject pLex)
void lex_Finish (pLexObject pLex)
void lex_DumpLexemes (pLexObject pLex, FILE *psDump)
static void lex_StoreCharacter (pLexObject pLex, int ch, int i)
int lex_ReadInput (pLexObject pLex)
static void * lex_malloc (size_t n, void *pMemorySegment)
static void lex_free (void *p, void *pMemorySegment)
static long _MyLineNumber (void *p)
static char * _MyFileName (void *p)
void lex_InitStructure (pLexObject pLex)


Define Documentation

#define BUFFERINCREASE   1024
 

Definition at line 122 of file lexer.c.

Referenced by lex_InitStructure(), and lex_StoreCharacter().

#define CALL_PREPROCESSOR X,
 )     if( pLex->pPREP && pLex->pPREP->n )ipreproc_Process(pLex->pPREP,X,Y)
 

Definition at line 130 of file lexer.c.

 
#define GETC  )     __GETC(pLex->pfGetCharacter,pLex->pvInput,UngetBuffer,&UngetCounter)
 

Definition at line 170 of file lexer.c.

Referenced by getC(), and lex_ReadInput().

#define lexALLOC  )     (pLex->memory_allocating_function((x),pLex->pMemorySegment))
 

Definition at line 174 of file lexer.c.

Referenced by _NewLexeme(), lex_InitStructure(), lex_ReadInput(), and lex_StoreCharacter().

#define lexFREE  )     (pLex->memory_releasing_function((x),pLex->pMemorySegment),(x)=NULL)
 

Definition at line 175 of file lexer.c.

Referenced by lex_Finish(), lex_HandleContinuationLines(), lex_ReadInput(), lex_RemoveComments(), lex_RemoveSkipSymbols(), and lex_StoreCharacter().

 
#define NewLexeme  )     _NewLexeme(pLex)
 

Definition at line 190 of file lexer.c.

Referenced by lex_ReadInput().

#define pfLexeme   (*plexLastLexeme)
 

Referenced by lex_ReadInput().

#define REPORT x1,
x2,
x3,
x4   )     if( pLex->report )pLex->report(pLex->reportptr,x1,x2,x3,REPORT_ERROR,&(pLex->iErrorCounter),x4,&(pLex->fErrorFlags))
 

Definition at line 128 of file lexer.c.

#define STORE_CH  )     lex_StoreCharacter(pLex,x,i)
 

Referenced by lex_ReadInput().

#define UNGET_BUFFER_LENGTH   10
 

Definition at line 172 of file lexer.c.

#define UNGETC  )     __UNGETC(UngetBuffer,&UngetCounter,x)
 

Definition at line 171 of file lexer.c.

Referenced by _readexpr(), c_readexpr(), c_readlist(), lex_ReadInput(), and readcons().


Function Documentation

static int __GETC int(*)(void *)  pfGetCharacter,
void *  pvInput,
int *  UngetBuffer,
int *  UngetCounter
[static]
 

Definition at line 149 of file lexer.c.

static void __UNGETC int *  UngetBuffer,
int *  UngetCounter,
int  ch
[static]
 

Definition at line 161 of file lexer.c.

static char* _MyFileName void *  p  )  [static]
 

Definition at line 1175 of file lexer.c.

Referenced by lex_InitStructure().

static long _MyLineNumber void *  p  )  [static]
 

Definition at line 1172 of file lexer.c.

Referenced by lex_InitStructure().

static pLexeme _NewLexeme pLexObject  pLex  )  [static]
 

Definition at line 178 of file lexer.c.

References lexALLOC, NULL, and p.

static isinset int  ch,
char *  string
[static]
 

Definition at line 132 of file lexer.c.

double lex_Double pLexObject  pLex  ) 
 

Definition at line 444 of file lexer.c.

Referenced by lex_DumpLexemes().

void lex_DumpLexemes pLexObject  pLex,
FILE *  psDump
 

Definition at line 587 of file lexer.c.

References lex_Double(), lex_EOF(), lex_Long(), lex_NextLexeme(), lex_StartIteration(), lex_String(), and lex_Type().

int lex_EOF pLexObject  pLex  ) 
 

Definition at line 404 of file lexer.c.

References NULL.

Referenced by ex_IsCommandCALL(), and lex_DumpLexemes().

char* lex_FileName pLexObject  pLex  ) 
 

Definition at line 519 of file lexer.c.

void lex_Finish pLexObject  pLex  ) 
 

Definition at line 558 of file lexer.c.

References lexFREE, p, and r.

static void lex_free void *  p,
void *  pMemorySegment
[static]
 

Definition at line 1169 of file lexer.c.

References free().

void lex_HandleContinuationLines pLexObject  pLex  ) 
 

Definition at line 234 of file lexer.c.

References lexFREE, p, and r.

Referenced by HttpExtensionProc(), main(), and scriba_DoLexicalAnalysis().

void lex_InitStructure pLexObject  pLex  ) 
 

Definition at line 1187 of file lexer.c.

References _MyFileName(), _MyLineNumber(), BUFFERINCREASE, CALL_PREPROCESSOR, lexALLOC, and NULL.

Referenced by HttpExtensionProc(), main(), and scriba_DoLexicalAnalysis().

long lex_LineNumber pLexObject  pLex  ) 
 

Definition at line 501 of file lexer.c.

long lex_Long pLexObject  pLex  ) 
 

Definition at line 486 of file lexer.c.

Referenced by lex_DumpLexemes().

static void* lex_malloc size_t  n,
void *  pMemorySegment
[static]
 

Definition at line 1166 of file lexer.c.

void lex_NextLexeme pLexObject  pLex  ) 
 

Definition at line 343 of file lexer.c.

Referenced by lex_DumpLexemes().

int lex_ReadInput pLexObject  pLex  ) 
 

This is 0x... or &H... hexadecimal number

Definition at line 664 of file lexer.c.

References ch, GETC, i, ipreproc_Process(), iResult, isinset(), lexALLOC, lexFREE, nch(), NewLexeme, NULL, pfLexeme, pszFileName, REPORT, s, STORE_CH, strcpy(), stricmp(), and UNGETC.

Referenced by HttpExtensionProc(), main(), and scriba_DoLexicalAnalysis().

void lex_RemoveComments pLexObject  pLex  ) 
 

Definition at line 306 of file lexer.c.

References lexFREE, p, q, r, stricmp(), and w.

Referenced by HttpExtensionProc(), main(), and scriba_DoLexicalAnalysis().

void lex_RemoveSkipSymbols pLexObject  pLex  ) 
 

Definition at line 279 of file lexer.c.

References lexFREE, p, and r.

Referenced by scriba_DoLexicalAnalysis().

void lex_RestorePosition pLexObject  pLex,
pLexeme *  ppPosition
 

Definition at line 376 of file lexer.c.

Referenced by ex_Command_r(), and ex_IsCommandCALL().

void lex_SavePosition pLexObject  pLex,
pLexeme *  ppPosition
 

Definition at line 359 of file lexer.c.

Referenced by ex_Command_r(), and ex_IsCommandCALL().

void lex_StartIteration pLexObject  pLex  ) 
 

Definition at line 391 of file lexer.c.

Referenced by ex_init(), and lex_DumpLexemes().

static void lex_StoreCharacter pLexObject  pLex,
int  ch,
int  i
[static]
 

Definition at line 632 of file lexer.c.

References BUFFERINCREASE, lexALLOC, lexFREE, memcpy(), NULL, r, and s.

char* lex_String pLexObject  pLex  ) 
 

Definition at line 457 of file lexer.c.

Referenced by lex_DumpLexemes().

long lex_StrLen pLexObject  pLex  ) 
 

Definition at line 472 of file lexer.c.

char* lex_SymbolicName pLexObject  pLex,
long  OpCode
 

Definition at line 199 of file lexer.c.

References p.

Referenced by _ex_pprint(), ex_IsCommandOPEN(), and ex_IsCommandThis().

int lex_Type pLexObject  pLex  ) 
 

Definition at line 430 of file lexer.c.

Referenced by lex_DumpLexemes().

static double pow10 double  a  )  [static]
 

Definition at line 137 of file lexer.c.

References i, and j.

int stricmp char *  ,
char * 
 

Definition at line 117 of file reader.c.


Generated on Sun Mar 12 23:56:37 2006 for ScriptBasic by  doxygen 1.4.6-NO