qscilexerfortran77.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. // This defines the interface to the QsciLexerFortran77 class.
  2. //
  3. // Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
  4. //
  5. // This file is part of QScintilla.
  6. //
  7. // This file may be used under the terms of the GNU General Public License
  8. // version 3.0 as published by the Free Software Foundation and appearing in
  9. // the file LICENSE included in the packaging of this file. Please review the
  10. // following information to ensure the GNU General Public License version 3.0
  11. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  12. //
  13. // If you do not wish to use this file under the terms of the GPL version 3.0
  14. // then you may purchase a commercial license. For more information contact
  15. // info@riverbankcomputing.com.
  16. //
  17. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  18. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19. #ifndef QSCILEXERFORTRAN77_H
  20. #define QSCILEXERFORTRAN77_H
  21. #include <QObject>
  22. #include <Qsci/qsciglobal.h>
  23. #include <Qsci/qscilexer.h>
  24. //! \brief The QsciLexerFortran77 class encapsulates the Scintilla Fortran77
  25. //! lexer.
  26. class QSCINTILLA_EXPORT QsciLexerFortran77 : public QsciLexer
  27. {
  28. Q_OBJECT
  29. public:
  30. //! This enum defines the meanings of the different styles used by the
  31. //! Fortran77 lexer.
  32. enum {
  33. //! The default.
  34. Default = 0,
  35. //! A comment.
  36. Comment = 1,
  37. //! A number.
  38. Number = 2,
  39. //! A single-quoted string.
  40. SingleQuotedString = 3,
  41. //! A double-quoted string.
  42. DoubleQuotedString = 4,
  43. //! The end of a line where a string is not closed.
  44. UnclosedString = 5,
  45. //! An operator.
  46. Operator = 6,
  47. //! An identifier
  48. Identifier = 7,
  49. //! A keyword.
  50. Keyword = 8,
  51. //! An intrinsic function.
  52. IntrinsicFunction = 9,
  53. //! An extended, non-standard or user defined function.
  54. ExtendedFunction = 10,
  55. //! A pre-processor block.
  56. PreProcessor = 11,
  57. //! An operator in .NAME. format.
  58. DottedOperator = 12,
  59. //! A label.
  60. Label = 13,
  61. //! A continuation.
  62. Continuation = 14
  63. };
  64. //! Construct a QsciLexerFortran77 with parent \a parent. \a parent is
  65. //! typically the QsciScintilla instance.
  66. QsciLexerFortran77(QObject *parent = 0);
  67. //! Destroys the QsciLexerFortran77 instance.
  68. virtual ~QsciLexerFortran77();
  69. //! Returns the name of the language.
  70. const char *language() const;
  71. //! Returns the name of the lexer. Some lexers support a number of
  72. //! languages.
  73. const char *lexer() const;
  74. //! \internal Returns the style used for braces for brace matching.
  75. int braceStyle() const;
  76. //! Returns the foreground colour of the text for style number \a style.
  77. //!
  78. //! \sa defaultPaper()
  79. QColor defaultColor(int style) const;
  80. //! Returns the end-of-line fill for style number \a style.
  81. bool defaultEolFill(int style) const;
  82. //! Returns the font for style number \a style.
  83. QFont defaultFont(int style) const;
  84. //! Returns the background colour of the text for style number \a style.
  85. //!
  86. //! \sa defaultColor()
  87. QColor defaultPaper(int style) const;
  88. //! Returns the set of keywords for the keyword set \a set recognised
  89. //! by the lexer as a space separated string.
  90. const char *keywords(int set) const;
  91. //! Returns the descriptive name for style number \a style. If the
  92. //! style is invalid for this language then an empty QString is returned.
  93. //! This is intended to be used in user preference dialogs.
  94. QString description(int style) const;
  95. //! Causes all properties to be refreshed by emitting the
  96. //! propertyChanged() signal as required.
  97. void refreshProperties();
  98. //! Returns true if trailing blank lines are included in a fold block.
  99. //!
  100. //! \sa setFoldCompact()
  101. bool foldCompact() const;
  102. public slots:
  103. //! If \a fold is true then trailing blank lines are included in a fold
  104. //! block. The default is true.
  105. //!
  106. //! \sa foldCompact()
  107. virtual void setFoldCompact(bool fold);
  108. protected:
  109. //! The lexer's properties are read from the settings \a qs. \a prefix
  110. //! (which has a trailing '/') should be used as a prefix to the key of
  111. //! each setting. true is returned if there is no error.
  112. //!
  113. //! \sa writeProperties()
  114. bool readProperties(QSettings &qs,const QString &prefix);
  115. //! The lexer's properties are written to the settings \a qs.
  116. //! \a prefix (which has a trailing '/') should be used as a prefix to
  117. //! the key of each setting. true is returned if there is no error.
  118. //!
  119. //! \sa readProperties()
  120. bool writeProperties(QSettings &qs,const QString &prefix) const;
  121. private:
  122. void setCompactProp();
  123. bool fold_compact;
  124. QsciLexerFortran77(const QsciLexerFortran77 &);
  125. QsciLexerFortran77 &operator=(const QsciLexerFortran77 &);
  126. };
  127. #endif