• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

Analitza

  • sources
  • kde-4.14
  • kdeedu
  • analitza
  • analitza
abstractlexer.h
Go to the documentation of this file.
1 /*************************************************************************************
2  * Copyright (C) 2008 by Aleix Pol <aleixpol@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License *
6  * as published by the Free Software Foundation; either version 2 *
7  * of the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the Free Software *
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
17  *************************************************************************************/
18 
19 #ifndef ABSTRACTLEXER_H
20 #define ABSTRACTLEXER_H
21 
22 #include <QtCore/QString>
23 #include <QtCore/QStringList>
24 #include <QtCore/QHash>
25 #include <QtCore/QQueue>
26 #include "analitzaexport.h"
27 
28 class ANALITZA_EXPORT AbstractLexer
29 {
30  public:
31  struct TOKEN
32  {
33  TOKEN(int _type=-1, uint _pos=0, const QString& _val=QString(), unsigned char _len=0) :
34  type(_type), val(_val), len(_len), pos(_pos) {}
35 
36  int type;
37  QString val;
38  unsigned char len;
39  uint pos;
40  };
41 
42  AbstractLexer(const QString &source);
43  virtual ~AbstractLexer();
44  int lex();
45  int lineNumber() const { return m_lines; }
46  bool isCompletelyRead() const { return m_openPr==0 && m_openCb==0; }
47 
48  TOKEN current;
49  QString error() const { return m_err; }
50  bool isCompleteExpression(bool justempty=false);
51 
52  protected:
53  QString m_err;
54  QString m_source;
55 
56  int m_lines;
57  int m_openPr, m_openCb;
58  QQueue<TOKEN> m_tokens;
59  static QHash<QChar, int> m_operators;
60  static QHash<QString, int> m_longOperators;
61  virtual void getToken()=0;
62  void printQueue(const QQueue<TOKEN>& q) const;
63 };
64 
65 #endif
AbstractLexer::m_err
QString m_err
Definition: abstractlexer.h:53
QQueue
AbstractLexer::TOKEN::len
unsigned char len
Definition: abstractlexer.h:38
AbstractLexer::isCompletelyRead
bool isCompletelyRead() const
Definition: abstractlexer.h:46
AbstractLexer::error
QString error() const
Definition: abstractlexer.h:49
AbstractLexer::m_operators
static QHash< QChar, int > m_operators
Definition: abstractlexer.h:59
AbstractLexer::TOKEN
Definition: abstractlexer.h:31
AbstractLexer::TOKEN::val
QString val
Definition: abstractlexer.h:37
AbstractLexer::m_tokens
QQueue< TOKEN > m_tokens
Definition: abstractlexer.h:58
QHash< QChar, int >
AbstractLexer::lineNumber
int lineNumber() const
Definition: abstractlexer.h:45
QString
AbstractLexer::current
TOKEN current
Definition: abstractlexer.h:48
AbstractLexer::m_longOperators
static QHash< QString, int > m_longOperators
Definition: abstractlexer.h:60
AbstractLexer::m_source
QString m_source
Definition: abstractlexer.h:54
analitzaexport.h
ANALITZA_EXPORT
#define ANALITZA_EXPORT
Definition: analitzaexport.h:31
AbstractLexer::TOKEN::TOKEN
TOKEN(int _type=-1, uint _pos=0, const QString &_val=QString(), unsigned char _len=0)
Definition: abstractlexer.h:33
AbstractLexer::TOKEN::type
int type
Definition: abstractlexer.h:36
AbstractLexer::m_lines
int m_lines
Definition: abstractlexer.h:56
AbstractLexer::TOKEN::pos
uint pos
Definition: abstractlexer.h:39
AbstractLexer
Definition: abstractlexer.h:28
AbstractLexer::m_openPr
int m_openPr
Definition: abstractlexer.h:57
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:37 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Analitza

Skip menu "Analitza"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal