8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-31 00:43:02 +01:00
firebird-mirror/src/qli/parse.h

100 lines
2.2 KiB
C
Raw Normal View History

2001-05-23 15:26:42 +02:00
/*
* PROGRAM: JRD Command Oriented Query Language
* MODULE: par.h
* DESCRIPTION: 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): ______________________________________.
*/
#ifndef QLI_PARSE_H
#define QLI_PARSE_H
2001-05-23 15:26:42 +02:00
#define MAXSYMLEN 256
#define MATCH(kw) PAR_match (kw)
/* Keywords */
2003-08-22 12:56:55 +02:00
typedef enum kwwords {
2001-05-23 15:26:42 +02:00
KW_none = 0,
#include "../qli/symbols.h"
KW_continuation
} KWWORDS;
/* Token block, used to hold a lexical token. */
2003-08-22 12:56:55 +02:00
typedef enum tok_t {
2001-05-23 15:26:42 +02:00
tok_ident,
tok_number,
tok_quoted,
tok_punct,
tok_eol,
tok_eof
} TOK_T;
typedef struct tok {
2003-09-19 12:26:46 +02:00
blk tok_header;
2001-05-23 15:26:42 +02:00
TOK_T tok_type; /* type of token */
2003-09-19 12:26:46 +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;
2003-09-19 12:26:46 +02:00
tok* tok_next;
tok* tok_prior;
2001-05-23 15:26:42 +02:00
TEXT tok_string [2];
} *TOK ;
/* Input line control */
2003-08-22 12:56:55 +02:00
enum line_t {
2001-05-23 15:26:42 +02:00
line_stdin,
line_blob,
line_file,
line_string,
line_edit
};
typedef struct line {
2003-09-19 12:26:46 +02:00
blk line_header;
line* line_next;
dbb* line_database;
2001-05-23 15:26:42 +02:00
USHORT line_size;
USHORT line_length;
TEXT *line_ptr;
SLONG line_position;
FRBRD *line_source; /* File or blob handle */
2003-08-22 12:56:55 +02:00
enum line_t line_type;
2001-05-23 15:26:42 +02:00
TEXT line_data [256];
TEXT line_source_name [2];
} *LINE;
#ifdef PARSER_MAIN
#define EXTERN
#else
#define EXTERN extern
#endif
EXTERN TOK QLI_token;
EXTERN LINE QLI_line;
EXTERN TEXT *QLI_prompt;
#undef EXTERN
#endif /* QLI_PARSE_H */