summaryrefslogtreecommitdiffstats
path: root/kommander/widget/parserdata.h
blob: e427e60036ee818b2fe875c1be95044d674d60df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/***************************************************************************
                    parserdata.h - Parser data: keywords, functions etc.
                             -------------------
    copyright          : (C) 2004      Michal Rudolf <mrudolf@kdewebdwev.org>
    
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef _HAVE_PARSERDATA_H_
#define _HAVE_PARSERDATA_H_

#include "parsenode.h"
#include "function.h"
#include <tqmap.h>

class ParserData {
public:
  /* initialize keywords */
  ParserData();
  /* Return group of given keyword */
  Parse::KeywordGroup keywordGroup(Parse::Keyword k) const;
  /* Convert string to keyword */
  Parse::Keyword stringToKeyword(const TQString& s) const;
  /* Convert keyword to string */
  TQString keywordToString(Parse::Keyword k) const;
  /* register a function */
  bool registerFunction(const TQString& name, Function f);
  /* check if this is a name of standard function */
  bool isFunction(const TQString& name) const;
  /* Return function with given name. Warning: this function has undefined behavior when there is
    no such function. */
  const Function& function(const TQString& name) const;
private:
  // register standard function
  void registerStandardFunctions();
  TQMap<TQString, Parse::Keyword> m_keywords;
  TQMap<Parse::Keyword, Parse::KeywordGroup> m_groups;
  TQMap<TQString, Function> m_functions;
}; 


#endif