/* * PROJECT: * SUBSYSTEM: * MODULE: * * FILE: $RCSfile: parser.h,v $ * REVISION: $Revision: 1.8 $ * Date: $Date: 1995/05/18 09:41:31 $ * Author: $Author: jeff $ * RCS Ident: $Id: parser.h,v 1.8 1995/05/18 09:41:31 jeff beta $ * * FUNCTION: * * Copyright (c) 1994 Division Ltd. * * All Rights Reserved. * * This Document may not, in whole or in part, be copied, * photocopied, reproduced, translated, or reduced to any * electronic medium or machine readable form without prior * written consent from Division Ltd. */ #ifndef _PARSER_H #define _PARSER_H #ifdef __cplusplus extern "C" { #endif #define PARSER_MAX_TOKEN_SIZE 2048 #define PARSER_MATCH_CASE 0 #define PARSER_ANY_CASE 1 /* * macros for testing char classes */ #define PARSER_LEX_START 1 #define PARSER_LEX_CONTINUE 2 #define parserStartChar(f,x) ((f)->LexClass[(x)] & PARSER_LEX_START ) #define parserContinueChar(f,x) ((f)->LexClass[(x)] & PARSER_LEX_CONTINUE ) /* * tokens returned by parser functions */ #define PARSER_OK 0 #define PARSER_ERR -1 #define PARSER_EOF -2 #define PARSER_STRING -3 #define PARSER_INT -4 #define PARSER_FLOAT -5 #define PARSER_PUSH -6 #define PARSER_POP -7 #define PARSER_QUOTED_STRING -8 /* * used to hold pre-processing state info. * Contents are not made public. */ typedef struct pprocState pprocState; typedef struct dParseKeyTab { int tok; char *name; int matchCase; } dParseKeyTab; typedef struct dParseFile { int errorFlag; int seeIncludes; int pushedBackToken; float fpNumber; long iNumber; char *buffer; int bufSize; int bufPos; dParseKeyTab *keyTab; int charNo; pprocState *ppstate; char LexClass[128]; } dParseFile, *dParseFilePtr; extern void parserVersion(FILE *openfp); extern dParseFilePtr parserCreate(char *name, FILE *openfp, dParseKeyTab *keyTable, int bufferSize, FILE *(*fileFinder)(const char *), const char *startChars, const char *continueChars, int seeIncludes); extern void parserDestroy(dParseFilePtr fptr); extern dParseFilePtr parserOpenFile(char *name, FILE *fp, dParseKeyTab *keyTable, int bufferSize, FILE *(*fileFinder)(const char *), const char *startChars, const char *continueChars, int seeIncludes); extern void parserCloseFile(dParseFilePtr fPtr); extern int parserGetc(dParseFilePtr fptr); extern int parserUngetc(dParseFilePtr fptr, char c); extern char *parserTokenToString(dParseFilePtr fptr, const int token); extern int parserPushToken(dParseFilePtr fptr, const int token); extern int parserNextToken(dParseFilePtr fptr); extern char *parserMatchString(dParseFilePtr fptr); extern int parserMatchInt(dParseFilePtr fptr, int *num); extern int parserMatchFloat(dParseFilePtr fptr, float *num); extern int parserMatchCharacter(dParseFilePtr fptr, char c); extern const char *parserCurrentFile(dParseFilePtr fptr); extern int parserCurrentLine(dParseFilePtr fptr); #ifdef __cplusplus } #endif #endif