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): ______________________________________.
|
|
|
|
*/
|
|
|
|
|
2003-09-25 13:49:12 +02:00
|
|
|
#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>
|
|
|
|
|
2004-05-16 03:42:11 +02:00
|
|
|
const int MAXSYMLEN = 256;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2008-12-05 01:56:15 +01:00
|
|
|
// Keywords
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-01-10 11:51:02 +01:00
|
|
|
enum kwwords {
|
2001-05-23 15:26:42 +02:00
|
|
|
KW_none = 0,
|
|
|
|
#include "../qli/symbols.h"
|
|
|
|
KW_continuation
|
2009-01-10 11:51:02 +01:00
|
|
|
};
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2008-12-05 01:56:15 +01:00
|
|
|
// Token block, used to hold a lexical token.
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-01-10 11:51:02 +01:00
|
|
|
enum tok_t {
|
2008-12-05 01:56:15 +01:00
|
|
|
tok_ident,
|
|
|
|
tok_number,
|
|
|
|
tok_quoted,
|
2001-05-23 15:26:42 +02:00
|
|
|
tok_punct,
|
|
|
|
tok_eol,
|
|
|
|
tok_eof
|
2009-01-10 11:51:02 +01:00
|
|
|
};
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2009-01-10 11:51:02 +01:00
|
|
|
struct qli_tok
|
|
|
|
{
|
2004-02-02 12:02:12 +01:00
|
|
|
blk tok_header;
|
2009-01-10 11:51:02 +01:00
|
|
|
tok_t tok_type; // type of token
|
2008-12-05 01:56:15 +01:00
|
|
|
qli_symbol* tok_symbol; // hash block if recognized
|
2009-01-10 11:51:02 +01:00
|
|
|
kwwords tok_keyword; // keyword number, if recognized
|
2008-12-05 01:56:15 +01:00
|
|
|
SLONG tok_position; // byte number in input stream
|
2004-02-02 12:02:12 +01:00
|
|
|
USHORT tok_length;
|
2008-12-09 08:24:32 +01:00
|
|
|
//qli_tok* tok_next;
|
|
|
|
//qli_tok* tok_prior;
|
2004-02-02 12:02:12 +01:00
|
|
|
TEXT tok_string [2];
|
|
|
|
};
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2008-12-05 01:56:15 +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,
|
2008-12-09 08:24:32 +01:00
|
|
|
line_string
|
|
|
|
//, line_edit
|
2001-05-23 15:26:42 +02:00
|
|
|
};
|
|
|
|
|
2009-01-10 11:51:02 +01:00
|
|
|
struct qli_line
|
|
|
|
{
|
2004-02-02 12:02:12 +01:00
|
|
|
blk line_header;
|
|
|
|
qli_line* line_next;
|
2009-01-10 11:51:02 +01:00
|
|
|
qli_dbb* line_database;
|
2004-02-02 12:02:12 +01:00
|
|
|
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
|
2008-12-09 08:24:32 +01:00
|
|
|
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
|
|
|
|
2004-02-02 12:02:12 +01:00
|
|
|
#endif // QLI_PARSE_H
|
2003-09-25 13:49:12 +02:00
|
|
|
|