Ejemplo n.º 1
0
 def __init__(self, parent=None):
     super(PyInteractiveConsole, self).__init__(parent)
     self.set_writer(self._write)
     self.setMouseTracking(True)
     self.PROG = QtCore.QRegExp(r'\s*File ".*", line [0-9]*, in ')
     self.FILENAME_PROG = QtCore.QRegExp(r'".*"')
     self.LINE_PROG = QtCore.QRegExp(r'line [0-9]*')
     self.setLineWrapMode(self.NoWrap)
     self._module_color = QtGui.QColor('blue')
Ejemplo n.º 2
0
 def __init__(self, parent=None):
     super(PyInteractiveConsole, self).__init__(parent)
     self.set_writer(self._write)
     self.setMouseTracking(True)
     self.PROG = QtCore.QRegExp(
         r'\s*File "[a-zA-Z\/_\d:\\\.]*((.\.[a-zA-Z\/_\d:\\]*")|(")), '
         r'line [0-9]*.*')
     self.FILENAME_PROG = QtCore.QRegExp(r'"[a-zA-Z\/_\.\d:\\]*"')
     self.LINE_PROG = QtCore.QRegExp(r'line [0-9]*')
     self.setLineWrapMode(self.NoWrap)
     self._module_color = QtGui.QColor('blue')
Ejemplo n.º 3
0
 def __init__(self, parent, color_scheme=None):
     """
     :param parent: parent document (QTextDocument)
     :param color_scheme: color scheme to use.
     """
     QtGui.QSyntaxHighlighter.__init__(self, parent)
     Mode.__init__(self)
     if not color_scheme:
         color_scheme = ColorScheme('qt')
     self._color_scheme = color_scheme
     self._spaces_ptrn = QtCore.QRegExp(r'[ \t]+')
     #: Fold detector. Set it to a valid FoldDetector to get code folding
     #: to work. Default is None
     self.fold_detector = None
     self.WHITESPACES = QtCore.QRegExp(r'\s+')
Ejemplo n.º 4
0
"""
This module contains the various regular expressions used through the whole
project.

"""
from pyqode.qt import QtCore

#: This pattern identifies a struct definition (01 XXXX.)
STRUCT_PATTERN = QtCore.QRegExp(r'((^|^\s*)\d\d [\w\-]+\.$)')
#: This pattern identifies a paragraph definition
PARAGRAPH_PATTERN = QtCore.QRegExp(r'((^|^\s*)\.?[\w\-]+\.\s*$)')
#: This pattern identifies a loop pattern
LOOP_PATTERN = QtCore.QRegExp(
    r'(^|^\s)PERFORM.*(VARYING|UNTIL|TIMES|WITH|TEST|AFTER)*')
#: This pattern identifies the start of a branch
BRANCH_START = QtCore.QRegExp(r'((^|\s)IF\b|ELSE)')
#: This pattern identifies the end of a branch
BRANCH_END = QtCore.QRegExp(r'END-(PERFORM|IF|READ)\.?')
#: This pattern identifiers a DIVISION
DIVISION = QtCore.QRegExp(r'.*\s+DIVISION.*\.*')
#: This pattern identifiers a SECTION
SECTION = QtCore.QRegExp(r'.*\s+SECTION.*\.*')
#: This pattern identify
VAR_PATTERN = QtCore.QRegExp(r'\s*\d+\s.*.+')