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

Last change on this file since 5448 was 5448, checked in by kjdon, 21 years ago

added a new token type to the Lex module - UnknownE. this will match any unrecognisable char - can now just skip over unknown chars rather than spitting the dummy and stopping the parsing

  • 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 **************************************************************************/
21
22#ifndef GSDLQUERYLEX_H
23#define GSDLQUERYLEX_H
24
25#include "UCArray.h"
26
27
28// note: white space is ignored
29enum LexType {NoTypeE, OpenBracketE, CloseBracketE, TermE, AndOpE, OrOpE,
30 NotOpE, NearOpE, QuoteE, IntegerE, TermWeightE, StemMethodE,
31 RangeE, AtE, TagE, OpenSquareBracketE, CloseSquareBracketE,
32 UnknownE};
33
34struct 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.
49bool 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
Note: See TracBrowser for help on using the repository browser.