[3365] | 1 | /**************************************************************************
|
---|
| 2 | *
|
---|
| 3 | * GSDLQueryLex.h -- Lexical analyser for a simple query language, for GSDL
|
---|
| 4 | * Copyright (C) 2000 Rodger McNab
|
---|
| 5 | *
|
---|
| 6 | * This program is free software; you can redistribute it and/or modify
|
---|
| 7 | * it under the terms of the GNU General Public License as published by
|
---|
| 8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 9 | * (at your option) any later version.
|
---|
| 10 | *
|
---|
| 11 | * This program is distributed in the hope that it will be useful,
|
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | * GNU General Public License for more details.
|
---|
| 15 | *
|
---|
| 16 | * You should have received a copy of the GNU General Public License
|
---|
| 17 | * along with this program; if not, write to the Free Software
|
---|
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 19 | *
|
---|
| 20 | **************************************************************************/
|
---|
| 21 |
|
---|
| 22 | #ifndef GSDLQUERYLEX_H
|
---|
| 23 | #define GSDLQUERYLEX_H
|
---|
| 24 |
|
---|
| 25 | #include "UCArray.h"
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | // note: white space is ignored
|
---|
| 29 | enum LexType {NoTypeE, OpenBracketE, CloseBracketE, TermE, AndOpE, OrOpE,
|
---|
[6117] | 30 | NotOpE, NearOpE, WithinOpE, QuoteE, IntegerE, TermWeightE,
|
---|
| 31 | StemMethodE, RangeE, AtE, TagE, OpenSquareBracketE,
|
---|
[8242] | 32 | CloseSquareBracketE, StarE, UnknownE};
|
---|
[3365] | 33 |
|
---|
| 34 | struct LexEl {
|
---|
| 35 | LexType lexType;
|
---|
| 36 | UCArray text;
|
---|
| 37 | int num; // for IntegerE
|
---|
| 38 |
|
---|
| 39 | void Clear () {
|
---|
| 40 | lexType = NoTypeE;
|
---|
| 41 | UCArrayClear (text);
|
---|
| 42 | num = 0;
|
---|
| 43 | }
|
---|
| 44 | LexEl () { Clear (); }
|
---|
| 45 | };
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | // returns true if another lexical element could be parsed.
|
---|
| 49 | bool ParseLexEl (UCArray::const_iterator &here,
|
---|
| 50 | UCArray::const_iterator end,
|
---|
| 51 | LexEl &el);
|
---|
| 52 |
|
---|
| 53 |
|
---|
| 54 | #endif
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 |
|
---|