2001-05-23 15:26:42 +02:00
|
|
|
/*
|
|
|
|
* PROGRAM: Language Preprocessor
|
|
|
|
* MODULE: parse.h
|
|
|
|
* DESCRIPTION: Common parser definitions
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Interbase Public
|
|
|
|
* License Version 1.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy
|
|
|
|
* of the License at http://www.Inprise.com/IPL.html
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an
|
|
|
|
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
|
|
|
|
* or implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code was created by Inprise Corporation
|
|
|
|
* and its predecessors. Portions created by Inprise Corporation are
|
|
|
|
* Copyright (C) Inprise Corporation.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
* Contributor(s): ______________________________________.
|
|
|
|
*/
|
|
|
|
|
2003-09-08 13:27:51 +02:00
|
|
|
#ifndef GPRE_PARSE_H
|
|
|
|
#define GPRE_PARSE_H
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
typedef enum kwwords {
|
|
|
|
KW_none = 0,
|
|
|
|
#include "../gpre/words.h"
|
|
|
|
KW_max
|
|
|
|
} KWWORDS;
|
|
|
|
|
2001-07-12 07:46:06 +02:00
|
|
|
#include "../gpre/gpre.h"
|
|
|
|
|
2001-05-23 15:26:42 +02:00
|
|
|
#define MATCH(keyword) MSC_match(keyword)
|
|
|
|
#define KEYWORD(kw) ((int) token.tok_keyword == (int) kw)
|
|
|
|
#define ADVANCE_TOKEN PAR_get_token ()
|
|
|
|
#define SYNTAX_ERROR CPR_s_error
|
|
|
|
|
|
|
|
/* Token block, used to hold a lexical token. */
|
|
|
|
|
|
|
|
enum tok_t {
|
|
|
|
tok_ident,
|
|
|
|
tok_number,
|
|
|
|
tok_quoted,
|
|
|
|
tok_punct,
|
|
|
|
tok_introducer,
|
|
|
|
tok_dblquoted
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct tok {
|
|
|
|
enum tok_t tok_type; /* type of token */
|
2003-09-05 12:14:08 +02:00
|
|
|
sym* tok_symbol; /* hash block if recognized */
|
2001-05-23 15:26:42 +02:00
|
|
|
KWWORDS tok_keyword; /* keyword number, if recognized */
|
|
|
|
SLONG tok_position; /* byte number in input stream */
|
|
|
|
USHORT tok_length;
|
|
|
|
USHORT tok_white_space;
|
|
|
|
SCHAR tok_string[MAXSYMLEN];
|
|
|
|
USHORT tok_first; /* first token in a statement */
|
2003-09-05 12:14:08 +02:00
|
|
|
sym* tok_charset; /* Character set of token */
|
2001-05-23 15:26:42 +02:00
|
|
|
} *TOK;
|
|
|
|
|
2003-09-05 12:14:08 +02:00
|
|
|
#define TOK_LEN sizeof(tok)
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#ifdef PARSER_MAIN
|
|
|
|
#define EXTERN
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2003-09-05 12:14:08 +02:00
|
|
|
EXTERN tok token;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
|
2003-09-08 13:27:51 +02:00
|
|
|
#endif /* GPRE_PARSE_H */
|