sequenceparser.h
1/* This file is part of the KDE project
2 Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
3 Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef SEQUENCEPARSER_H
22#define SEQUENCEPARSER_H
23
24#include <tqptrlist.h>
25#include <tqstring.h>
26
27#include "kformuladefs.h"
28
29KFORMULA_NAMESPACE_BEGIN
30
31class BasicElement;
32class ElementType;
33class SymbolTable;
34
35
40public:
41 SequenceParser(const SymbolTable& table);
42
46 ElementType* parse(TQPtrList<BasicElement>& elements);
47
51 void nextToken();
52
53 uint getStart() const { return tokenStart; }
54 uint getEnd() const { return tokenEnd; }
55 TokenType getTokenType() const { return type; }
56
63 void setElementType(uint pos, ElementType* type);
64
69
73 TQString text();
74
75private:
76
80 void readNumber();
81
85 void readDigits();
86
90 void readText();
91
95 TQChar getEndChar();
96
101 TQPtrList<BasicElement> list;
102
107 uint tokenStart;
108
112 uint tokenEnd;
113
117 TokenType type;
118
122 bool binOpAllowed;
123
127 const SymbolTable& table;
128};
129
130KFORMULA_NAMESPACE_END
131
132#endif // SEQUENCEPARSER_H
Basis of every formula element.
Basis of all types.
Definition elementtype.h:52
The parser that gets the element list and returns a syntax tree.
void nextToken()
Reads the next token.
ElementType * parse(TQPtrList< BasicElement > &elements)
ElementType * getPrimitive()
void setElementType(uint pos, ElementType *type)
Tells the element about its new type.
The symbol table.
Definition symboltable.h:77