Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/syntax.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                                 syntax.h
00003                                ----------
00004     begin                : Sat Mar 11 2006
00005     copyright            : (C) 2006 by Michael Margraf
00006     email                : michael.margraf@alumni.tu-berlin.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef SYNTAX_H
00019 #define SYNTAX_H
00020 
00021 #include "textdoc.h"
00022 #include <QSyntaxHighlighter>
00023 
00024 enum language_type {
00025   LANG_NONE = 0,
00026   LANG_VHDL,
00027   LANG_VERILOG,
00028   LANG_VERILOGA,
00029   LANG_OCTAVE,
00030 };
00031 
00032 enum textstate_type {
00033   STATE_NONE = 0,
00034   STATE_COMMENT = 100,
00035 };
00036 
00037 class SyntaxHighlighter : public QSyntaxHighlighter {
00038 public:
00039  SyntaxHighlighter(TextDoc*);
00040  virtual ~SyntaxHighlighter();
00041 
00042  void setLanguage(int);
00043  void highlightBlock(const QString&);
00044 
00045 private:
00046   int language;
00047   TextDoc *Doc;
00048 
00049   struct HighlightingRule
00050      {
00051          QRegExp pattern;
00052          QTextCharFormat format;
00053      };
00054   
00055   QVector<HighlightingRule> highlightingRules;
00056 
00057   QTextCharFormat reservedWordFormat;
00058   QTextCharFormat unitFormat;
00059   QTextCharFormat datatypeFormat;
00060   QTextCharFormat directiveFormat;
00061   QTextCharFormat functionFormat;
00062   QTextCharFormat commentFormat;
00063 
00064 };
00065 
00066 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines