OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
python_syntax_highlighter.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GUI_PYTHON_SYNTAX_HIGHLIGHTER_HH
20 #define OST_GUI_PYTHON_SYNTAX_HIGHLIGHTER_HH
21 /*
22  Authors: Marco Biasini, Andreas Schenk
23  */
24 
25 
26 #include "python_shell_fw.hh"
27 #include "python_tokenizer.hh"
28 
29 #include <QSyntaxHighlighter>
30 #include <QTextDocument>
31 namespace ost { namespace gui {
32 
36 class DLLEXPORT_OST_GUI PythonSyntaxHighlighter : public QSyntaxHighlighter {
37 public:
38  PythonSyntaxHighlighter(QTextDocument* parent);
39 
42  virtual void highlightBlock(const QString& text_block);
43 
44 
45 private:
46  std::map<PythonToken::Type,QTextCharFormat> formats_;
47  std::map<BlockType,QTextBlockFormat> block_formats_;
48 
49 };
50 
51 }}
52 
53 #endif //OST_GUI_PYTHON_GRAMMAR
#define DLLEXPORT_OST_GUI