home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pascal.zip / lexical / lexical.hi < prev    next >
Text File  |  1995-10-29  |  3KB  |  112 lines

  1. /*
  2.  *        C . A . P .   L E X I C A L   A N A L Y Z E R
  3.  *
  4.  *        I N T E R N A L   I N C L U D E   F I L E
  5.  *
  6.  *        Stéphane Charette @ C.A.P. Services
  7.  *
  8.  *        Last modified:  Stéphane Charette, 1995 October 29
  9.  *
  10.  *****************************************************************************
  11.  *
  12.  *        Project:    BILL
  13.  *        Group:    lexical analyzer
  14.  *        File:        lexical\lexical.hi
  15.  *
  16.  *        This file contains all of the internal definitions used with
  17.  *        the lexical portion of the interpreter BILL.
  18.  */
  19.  
  20.  
  21.  
  22. #ifndef _LEXICAL_H_INTERNAL
  23.  
  24.     #define _LEXICAL_H_INTERNAL
  25.  
  26.     /*
  27.      *        Includes
  28.      */
  29.         #include "..\lexical\lexical.h"
  30.         #include "..\symtable\symtable.h"
  31.         #include <stdio.h>
  32.         #include <stdlib.h>
  33.         #include <ctype.h>                // isspace
  34.         #include <string.h>                // strchr, tolower
  35.         #include <stdarg.h>                // vprintf, vfprintf
  36.  
  37.  
  38.  
  39.     /*
  40.      *        Defines
  41.      */
  42.  
  43.         #define LEX_MAX_BUFFER_LEN    3        // must be minimum of 3
  44.         #define SET_OF_TOKEN_DELIMITERS " \'\r\n\t{}:;,.+-*/<>=()"    // valid token delimiters
  45.         #define SET_OF_ILLEGAL_CHARS "!@#$%^&~[]\\/|?\""                // invalid characters
  46.         #if( _LEX_DEBUG )
  47.         #define LEX_DEBUG_SOURCE_FILENAME "LEX_SRC.TXT"        // output file for lex debug (source listing)
  48.         #define LEX_DEBUG_TOKEN_FILENAME "LEX_TOK.TXT"        // output file for lex debug (tokenized listing)
  49.         #define LEX_DEBUG_MIX_FILENAME "LEX_MIX.TXT"            // output file for lex debug (source + tokenized listing)
  50.         #endif
  51.  
  52.  
  53.  
  54.     /*
  55.      *        Types & structures
  56.      */
  57.         #if( _LEX_DEBUG )
  58.         struct LEXICAL_DEBUG_STRUCT
  59.         {
  60.             BOOL    ScreenOutput;        // enable screen output
  61.             BOOL    SourceOutput;        // output each character to the source output file
  62.             BOOL    TokenOutput;        // output each token after recogniztion to the token output file
  63.             BOOL    MixOutput;            // mix source and token output to the mix output file
  64.         };
  65.         typedef struct LEXICAL_DEBUG_STRUCT LEXICAL_DEBUG;
  66.         #endif
  67.  
  68.  
  69.  
  70.     /*
  71.      *        Macros
  72.      */
  73.  
  74.  
  75.  
  76.     /*
  77.      *        Local (internal) variables
  78.      */
  79.         LEXICAL_STATE    Lex_State;                            // global lex states defined in "lexical.h"
  80.         FILE            *FilePtr;                                // handle to source file
  81.         UCHAR            Buffer[ LEX_MAX_BUFFER_LEN ];        // file buffer
  82.         /*********************************************************
  83.          *        Buffer will be used as follows:                            *
  84.          *        Buffer[ 0 ] will be the previously read character    *
  85.          *        Buffer[ 1 ] will be the current character                *
  86.          *        Buffer[ 2+ ] will be the look-ahead                        *
  87.          *********************************************************/
  88.         UCHAR            FileName[ LEX_MAX_PATH_LEN+1 ];    // path of source
  89.         #if( _LEX_DEBUG )
  90.         LEXICAL_DEBUG    Lex_Debug;                            // lexical debug states
  91.         FILE             *LexDebugSourceFilePtr;                // file pointer for debug output (source)
  92.         FILE            *LexDebugTokenFilePtr;                // file pointer for debug output (token)
  93.         FILE            *LexDebugMixFilePtr;                    // file pointer for debug output (source+token)
  94.         #endif
  95.  
  96.  
  97.  
  98.     /*
  99.      *        Local (internal) prototyping
  100.      */
  101.          void LexError( ERR );                // sets error flag to specified ERR
  102.         ERR GetNextCharacter( void );        // reads a new character into Buffer
  103.         ERR SkipWhiteSpace( void );        // skips consecutive white characters in Buffer
  104.         #if( _LEX_DEBUG )
  105.         ERR LexDebugWrite( UCHAR *text, ... );    // write debug information to screen/files
  106.         #endif
  107.  
  108.  
  109.  
  110. #endif
  111.  
  112.