home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
POLYEDIT.LZH
/
ML
/
SCANNER.H
< prev
next >
Wrap
C/C++ Source or Header
|
1996-01-17
|
4KB
|
138 lines
/*
* トークン読み込み関数
*
* T.Kobayashi 1993.8.5
*/
#define SCANNER 1
#ifndef DATA
#include "data.h"
#endif
/* 入力用構造体 */
typedef struct {
FILE *fp ;
unsigned char *last ;
unsigned char *buf, *ptr ;
int ch, ch1 ;
int token ;
char str[IDENT_CHARS+1] ;
DataStruct data ;
}
InputStruct ;
extern InputStruct Input ;
extern char *InputFile ;
extern int InputLine ;
/* 定数リスト */
typedef struct {
char *name ;
DataStruct data ;
}
ConstStruct ;
extern int SysConsts ;
extern ConstStruct SysConst[] ;
/*
* 識別子
*/
#define SYM_IDENT 0x00000
/*
* 特殊文字
*/
#define SYM_SPL_CHAR 0x10000
/* かっこ */
#define SYM_OPEN1 (SYM_SPL_CHAR+1) /* ( */
#define SYM_CLOSE1 (SYM_SPL_CHAR+2) /* ) */
#define SYM_OPEN2 (SYM_SPL_CHAR+3) /* { */
#define SYM_CLOSE2 (SYM_SPL_CHAR+4) /* } */
#define SYM_OPEN3 (SYM_SPL_CHAR+5) /* [ */
#define SYM_CLOSE3 (SYM_SPL_CHAR+6) /* ] */
/* 四則演算 */
#define SYM_PLUS (SYM_SPL_CHAR+11) /* + */
#define SYM_MINUS (SYM_SPL_CHAR+12) /* - */
#define SYM_MULT (SYM_SPL_CHAR+13) /* * */
#define SYM_DIVIDE (SYM_SPL_CHAR+14) /* / */
#define SYM_MOD (SYM_SPL_CHAR+15) /* % */
#define SYM_DOT (SYM_SPL_CHAR+16) /* . */
#define SYM_REFER (SYM_SPL_CHAR+17) /* -> */
/* 論理演算 */
#define SYM_AND (SYM_SPL_CHAR+22) /* & */
#define SYM_OR (SYM_SPL_CHAR+23) /* | */
#define SYM_XOR (SYM_SPL_CHAR+24) /* ^ */
#define SYM_NOT (SYM_SPL_CHAR+25) /* ! */
/* 比較 */
#define SYM_NOTEQ (SYM_SPL_CHAR+31) /* != */
#define SYM_EQ (SYM_SPL_CHAR+32) /* == */
#define SYM_LSS (SYM_SPL_CHAR+33) /* < */
#define SYM_GTR (SYM_SPL_CHAR+34) /* > */
#define SYM_LSSEQ (SYM_SPL_CHAR+35) /* <= */
#define SYM_GTREQ (SYM_SPL_CHAR+36) /* >= */
/* シフト演算 */
#define SYM_LSFT (SYM_SPL_CHAR+37) /* << */
#define SYM_RSFT (SYM_SPL_CHAR+38) /* >> */
/* 代入 */
#define SYM_ASSIGN (SYM_SPL_CHAR+41) /* = */
#define SYM_ASN_PLUS (SYM_SPL_CHAR+42) /* += */
#define SYM_ASN_MINUS (SYM_SPL_CHAR+43) /* -= */
#define SYM_ASN_MULT (SYM_SPL_CHAR+44) /* *= */
#define SYM_ASN_DIVIDE (SYM_SPL_CHAR+45) /* /= */
#define SYM_ASN_AND (SYM_SPL_CHAR+46) /* &= */
#define SYM_ASN_OR (SYM_SPL_CHAR+47) /* |= */
#define SYM_ASN_XOR (SYM_SPL_CHAR+48) /* ^= */
#define SYM_ASN_INC (SYM_SPL_CHAR+49) /* ++ */
#define SYM_ASN_DEC (SYM_SPL_CHAR+50) /* -- */
/* その他 */
#define SYM_COMMA (SYM_SPL_CHAR+61) /* , */
#define SYM_SEMCLN (SYM_SPL_CHAR+62) /* ; */
#define SYM_COLON (SYM_SPL_CHAR+63) /* : */
#define SYM_PREPROC (SYM_SPL_CHAR+64) /* # */
#define SYM_EOF (SYM_SPL_CHAR+70)
#define SYM_UNKNOWN (SYM_SPL_CHAR+71)
/*
* 予約語
*/
#define SYM_RESERVED 0x20000
#define SYM_BREAK (SYM_RESERVED+1)
#define SYM_CONST (SYM_RESERVED+2)
#define SYM_CONTINUE (SYM_RESERVED+3)
#define SYM_DO (SYM_RESERVED+4)
#define SYM_ELSE (SYM_RESERVED+5)
#define SYM_FOR (SYM_RESERVED+6)
#define SYM_FUNCTION (SYM_RESERVED+7)
#define SYM_IF (SYM_RESERVED+8)
#define SYM_PRIVATE (SYM_RESERVED+9)
#define SYM_RETURN (SYM_RESERVED+10)
#define SYM_VAR (SYM_RESERVED+11)
#define SYM_WHILE (SYM_RESERVED+12)
/*
* 定数
*/
#define SYM_CONSTDATA 0x40000
/*
* プロトタイプ
*/
/* scanner.c */
extern void ScannerInit( void );
extern void SetSystemConst( char*, DataStruct* );
extern void FileOpen( char* );
extern void FileClose( void );
extern int GetToken( void );