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

103 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
2004-05-03 01:06:37 +02:00
#include <stdio.h>
2001-05-23 15:26:42 +02:00
#define MAXSYMLEN 256
#define MATCH(kw) PAR_match (kw)
2004-03-07 08:58:55 +01:00
// Keywords
2001-05-23 15:26:42 +02:00
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;
2004-03-07 08:58:55 +01:00
// Token block, used to hold a lexical token.
2001-05-23 15:26:42 +02:00
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;
2004-02-02 12:02:12 +01:00
struct qli_tok {
blk tok_header;
2004-03-07 08:58:55 +01:00
TOK_T tok_type; // type of token
qli_symbol* tok_symbol; // hash block if recognized
KWWORDS tok_keyword; // keyword number, if recognized
SLONG tok_position; // byte number in input stream
2004-02-02 12:02:12 +01:00
USHORT tok_length;
qli_tok* tok_next;
qli_tok* tok_prior;
TEXT tok_string [2];
};
2001-05-23 15:26:42 +02:00
2004-03-07 08:58:55 +01:00
// Input line control
2001-05-23 15:26:42 +02:00
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
};
2004-02-02 12:02:12 +01:00
struct qli_line {
blk line_header;
qli_line* line_next;
dbb* line_database;
USHORT line_size;
USHORT line_length;
TEXT* line_ptr;
SLONG line_position;
2004-05-03 01:06:37 +02:00
FB_API_HANDLE line_source_blob; // Blob handle
FILE* line_source_file; // File handle
2003-08-22 12:56:55 +02:00
enum line_t line_type;
2004-02-02 12:02:12 +01:00
TEXT line_data[256];
TEXT line_source_name[2];
};
2001-05-23 15:26:42 +02:00
#ifdef PARSER_MAIN
#define EXTERN
#else
#define EXTERN extern
#endif
2004-02-02 12:02:12 +01:00
EXTERN qli_tok* QLI_token;
EXTERN qli_line* QLI_line;
EXTERN TEXT* QLI_prompt;
2001-05-23 15:26:42 +02:00
#undef EXTERN
2004-02-02 12:02:12 +01:00
#endif // QLI_PARSE_H