source: trunk/gsdl/src/mgpp/text/GSDLQueryLex.h@ 1127

Last change on this file since 1127 was 1127, checked in by kjm18, 24 years ago

new parser and lex modules for GSDL syntax (designed for my bibliosystem)

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
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 * $Id: GSDLQueryLex.h 1127 2000-04-18 04:09:11Z kjm18 $
21 *
22 **************************************************************************/
23
24#ifndef GSDLQUERYLEX_H
25#define GSDLQUERYLEX_H
26
27#include "UCArray.h"
28
29
30// note: white space is ignored
31enum LexType {NoTypeE, OpenBracketE, CloseBracketE, TermE, AndOpE, OrOpE,
32 NotOpE, NearOpE, QuoteE, IntegerE, TermWeightE, StemMethodE,
33 RangeE, AtE, TagE, OpenSquareBracketE, CloseSquareBracketE};
34
35struct LexEl {
36 LexType lexType;
37 UCArray text;
38 int num; // for IntegerE
39
40 void Clear () {
41 lexType = NoTypeE;
42 UCArrayClear (text);
43 num = 0;
44 }
45 LexEl () { Clear (); }
46};
47
48
49// returns true if another lexical element could be parsed.
50bool ParseLexEl (UCArray::const_iterator &here,
51 UCArray::const_iterator end,
52 LexEl &el);
53
54
55#endif
56
57
58
59
60
61
62
63
64
65
Note: See TracBrowser for help on using the repository browser.