diff --git a/lib/eco/cflexer/codebuilder.py b/lib/eco/cflexer/codebuilder.py index afefd1cb..10e31ff2 100644 --- a/lib/eco/cflexer/codebuilder.py +++ b/lib/eco/cflexer/codebuilder.py @@ -56,4 +56,4 @@ def restore_code(self, (blocks, code)): def add_code(self, (blocks, code)): self.code += [(depth + len(self.blocks), line) for depth, line in code] self.blocks += blocks - + diff --git a/lib/eco/cflexer/tree.py b/lib/eco/cflexer/tree.py index 69ff2ef7..f6d63132 100644 --- a/lib/eco/cflexer/tree.py +++ b/lib/eco/cflexer/tree.py @@ -26,7 +26,7 @@ def __init__(self, symbol, additional_info, token): def getsourcepos(self): return self.token.source_pos - + def __repr__(self): return "Symbol(%r, %r)" % (self.symbol, self.additional_info) diff --git a/lib/eco/dotviewer/drawgraph.py b/lib/eco/dotviewer/drawgraph.py index 9e0124fb..0785f35e 100644 --- a/lib/eco/dotviewer/drawgraph.py +++ b/lib/eco/dotviewer/drawgraph.py @@ -72,7 +72,7 @@ def add_edge(self, *args): def get_display(self): from graphdisplay import GraphDisplay self.gdisplay = GraphDisplay(self) - return self.gdisplay + return self.gdisplay def send(self, command, *args): self.pgviewer.send(command, *args) @@ -91,9 +91,9 @@ def reset(self): # async interaction helpers def display_async_quit(): - pygame.event.post(pygame.event.Event(QUIT)) + pygame.event.post(pygame.event.Event(QUIT)) -def display_async_cmd(**kwds): +def display_async_cmd(**kwds): pygame.event.post(pygame.event.Event(USEREVENT, **kwds)) EventQueue = [] @@ -132,7 +132,7 @@ def sethighlight(self, which): class Edge: label = None - + def __init__(self, nodes, tail, head, cnt, *rest): self.tail = nodes[forceunicode(tail)] self.head = nodes[forceunicode(head)] @@ -259,7 +259,7 @@ class GraphRenderer: SCALEMIN = 3 SCALEMAX = 100 FONTCACHE = {} - + def __init__(self, screen, graphlayout, scale=75): self.graphlayout = graphlayout self.setscale(scale) @@ -312,7 +312,7 @@ def getfont(self, size): filename = pygame.font.get_default_font() font = self.FONTCACHE[size] = pygame.font.Font(filename, size) return font - + def setoffset(self, offsetx, offsety): "Set the (x,y) origin of the rectangle where the graph will be rendered." self.ofsx = offsetx - self.margin @@ -646,7 +646,7 @@ def edge_at_position(self, (x, y), distmax=14): class TextSnippet: - + def __init__(self, renderer, text, fgcolor, bgcolor=None, font=None): self.renderer = renderer self.imgs = [] diff --git a/lib/eco/dotviewer/graphdisplay.py b/lib/eco/dotviewer/graphdisplay.py index a01b9f7c..34a3dea9 100644 --- a/lib/eco/dotviewer/graphdisplay.py +++ b/lib/eco/dotviewer/graphdisplay.py @@ -168,7 +168,7 @@ def __init__(self, layout): def initialize_keys(self): pygame.key.set_repeat(*self.KEY_REPEAT) - + mask = 0 for strnames, methodname in self.KEYS.iteritems(): @@ -212,7 +212,7 @@ def initialize_keys(self): mod = mod & ~KMOD_SHIFT self.ascii_key_cache[(char, mod)] = (method, args) mask |= mod - + self.key_mask = mask def help(self): @@ -373,7 +373,7 @@ def calculate_zoom_to_fit(self): return min(float(self.width) / self.viewer.width, float(self.height) / self.viewer.height, float(self.viewer.SCALEMAX) / self.viewer.scale) - + def zoom_to_fit(self): """ center and scale to view the whole graph @@ -389,14 +389,14 @@ def zoom(self, scale): def reoffset(self): self.viewer.reoffset(self.width, self.height) - + def pan(self, (x, y)): self.viewer.shiftoffset(x * (self.width // 8), y * (self.height // 8)) self.updated_viewer() def fast_pan(self, (x, y)): self.pan((x * 4, y * 4)) - + def update_status_bar(self): self.statusbarinfo = None self.must_redraw = True @@ -405,7 +405,7 @@ def update_status_bar(self): else: info = 'Press H for help' self.setstatusbar(info) - + def updated_viewer(self, keep_highlight=False): self.reoffset() if not keep_highlight: @@ -629,7 +629,7 @@ def process_event(self, event): self.method_cache[method] = method if method is not None: method(event) - + def process_MouseMotion(self, event): if self.peek(MOUSEMOTION): return @@ -706,7 +706,7 @@ def process_VideoResize(self, event): def process_Quit(self, event): self.quit() - + def process_UserEvent(self, event): # new layout request if hasattr(event, 'layout'): if event.layout is None: @@ -715,7 +715,7 @@ def process_UserEvent(self, event): # new layout request self.setlayout(event.layout) elif hasattr(event, 'say'): self.setstatusbar(event.say) - + def quit(self): raise StopIteration diff --git a/lib/eco/editortab.py b/lib/eco/editortab.py index 260a5fb5..8e4e3e4d 100644 --- a/lib/eco/editortab.py +++ b/lib/eco/editortab.py @@ -50,7 +50,7 @@ def __init__(self, parent=None): self.scrollarea.update_theme() self.linenumbers = LineNumbers(self) - self.linenumbers.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.linenumbers.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) boxlayout.addWidget(self.linenumbers) boxlayout.addWidget(self.scrollarea) @@ -221,13 +221,13 @@ def decVSlider(self, page=False): self.verticalScrollBar().setSliderPosition(self.verticalScrollBar().sliderPosition() - step) class LineNumbers(QFrame): - def mouseDoubleClickEvent(self, event): + def mouseDoubleClickEvent(self, event): if not self.parent().debugging: - return None; + return None; # Check which number is clicked editor = self.parent().editor line_clicked = self.findLineNumberAt(event.y()) - if line_clicked <= len(editor.lines): + if line_clicked <= len(editor.lines): event.accept() self.emit(SIGNAL("breakpoint"), False, line_clicked, True) @@ -238,14 +238,14 @@ def contextMenuEvent(self, event): editor = self.parent().editor line_clicked = self.findLineNumberAt(event.y()) - if line_clicked > len(editor.lines): + if line_clicked > len(editor.lines): return None; event.accept() menu = QMenu(self) - bAction = menu.addAction("Toggle breakpoint at "+str(line_clicked)) - tbAction = menu.addAction("Toggle temp breakpoint at "+str(line_clicked)) + bAction = menu.addAction("Toggle breakpoint at "+str(line_clicked)) + tbAction = menu.addAction("Toggle temp breakpoint at "+str(line_clicked)) bcAction = menu.addAction("Set breakpoint with condition at "+str(line_clicked)) - action = menu.exec_(self.mapToGlobal(event.pos())) + action = menu.exec_(self.mapToGlobal(event.pos())) if action == bAction: self.emit(SIGNAL("breakpoint"), False, line_clicked, False) elif action == tbAction: @@ -269,7 +269,7 @@ def paintEvent(self, event): paint.setPen(QColor("grey")) paint.setFont(gfont.font) - debugging = self.parent().debugging + debugging = self.parent().debugging self.breakpoint_space = 10 editor = self.parent().editor @@ -279,7 +279,7 @@ def paintEvent(self, event): text = str(i+1) paint.drawText(QtCore.QPointF(self.geometry().width() - (len(text)+1)*gfont.fontwt, gfont.fontht + y*gfont.fontht), text +":") if debugging: - self.draw_breakpoint(paint, text, gfont.fontht+y*gfont.fontht-9) + self.draw_breakpoint(paint, text, gfont.fontht+y*gfont.fontht-9) y += editor.lines[i].height i += 1 if (y+1)*gfont.fontht >= editor.geometry().height(): @@ -287,10 +287,10 @@ def paintEvent(self, event): paint.end() - def draw_breakpoint(self, paint, line_no, y_pos): + def draw_breakpoint(self, paint, line_no, y_pos): big_rect = QtCore.QRectF(0, y_pos, 8, 8) small_rect = QtCore.QRectF(2, y_pos+2, 4, 4) - + paint.setBrush(QColor("blue")) breakpoints = self.parent().breakpoints @@ -302,11 +302,11 @@ def draw_breakpoint(self, paint, line_no, y_pos): paint.drawEllipse(big_rect) move = True if line_no in breakpoints['del']: - paint.setBrush(QColor("yellow")) - if move: - paint.drawEllipse(small_rect) - else: - paint.drawEllipse(big_rect) + paint.setBrush(QColor("yellow")) + if move: + paint.drawEllipse(small_rect) + else: + paint.drawEllipse(big_rect) def update(self): gfont = QApplication.instance().gfont diff --git a/lib/eco/export/PHPPython.py b/lib/eco/export/PHPPython.py index 2b49280e..04c58b90 100644 --- a/lib/eco/export/PHPPython.py +++ b/lib/eco/export/PHPPython.py @@ -41,7 +41,7 @@ def language_box(self, name, node): if name == "": python = Python(self.source, self.lineno) buf = python.pp(node) - + if self.in_class(): classname = self.get_classname() self.embed.append((classname, buf, self.lineno)) diff --git a/lib/eco/grammars/java15.py b/lib/eco/grammars/java15.py index 6627e72b..880f55ea 100644 --- a/lib/eco/grammars/java15.py +++ b/lib/eco/grammars/java15.py @@ -154,35 +154,35 @@ compilation_unit ::= - package_declaration_opt + package_declaration_opt import_declarations_opt type_declarations_opt - -package_declaration_opt ::= package_declaration | -import_declarations_opt ::= import_declarations | -type_declarations_opt ::= type_declarations | -import_declarations ::= +package_declaration_opt ::= package_declaration | +import_declarations_opt ::= import_declarations | +type_declarations_opt ::= type_declarations | + +import_declarations ::= import_declaration | import_declarations import_declaration -type_declarations ::= +type_declarations ::= type_declaration | type_declarations type_declaration -package_declaration ::= +package_declaration ::= "PACKAGE" name "SEMICOLON" -import_declaration ::= +import_declaration ::= single_type_import_declaration | type_import_on_demand_declaration | static_single_type_import_declaration | static_type_import_on_demand_declaration -single_type_import_declaration ::= +single_type_import_declaration ::= "IMPORT" name "SEMICOLON" -static_single_type_import_declaration ::= +static_single_type_import_declaration ::= "IMPORT" "STATIC" name "SEMICOLON" type_import_on_demand_declaration ::= @@ -211,31 +211,31 @@ -class_declaration ::= +class_declaration ::= modifiers_opt "CLASS" "IDENTIFIER" type_parameters_opt super_opt interfaces_opt class_body super ::= "EXTENDS" class_type -super_opt ::= +super_opt ::= | super interfaces ::= "IMPLEMENTS" interface_type_list interfaces_opt::= - | interfaces + | interfaces -interface_type_list ::= +interface_type_list ::= interface_type | interface_type_list "COMMA" interface_type -class_body ::= "LBRACE" class_body_declarations_opt "RBRACE" +class_body ::= "LBRACE" class_body_declarations_opt "RBRACE" class_body_opt ::= - | class_body -class_body_declarations_opt ::= - | class_body_declarations -class_body_declarations ::= + | class_body +class_body_declarations_opt ::= + | class_body_declarations +class_body_declarations ::= class_body_declaration | class_body_declarations class_body_declaration @@ -278,7 +278,7 @@ | "SEMICOLON" class_body_declarations_opt -field_declaration ::= +field_declaration ::= modifiers_opt type variable_declarators "SEMICOLON" variable_declarators ::= @@ -324,7 +324,7 @@ | type "ELLIPSIS" "IDENTIFIER" | "FINAL" type "ELLIPSIS" "IDENTIFIER" -throws_opt ::= +throws_opt ::= | throws throws ::= "THROWS" class_type_list @@ -494,7 +494,7 @@ "IF" "LPAREN" expression "RPAREN" statement if_then_else_statement ::= - "IF" "LPAREN" expression "RPAREN" statement_no_short_if + "IF" "LPAREN" expression "RPAREN" statement_no_short_if "ELSE" statement if_then_else_statement_no_short_if ::= @@ -571,7 +571,7 @@ | statement_expression_list "COMMA" statement_expression -identifier_opt ::= +identifier_opt ::= | "IDENTIFIER" @@ -812,7 +812,7 @@ expression -type_parameters_opt ::= type_parameters | +type_parameters_opt ::= type_parameters | type_parameters ::= "LT" type_parameter_list_1 @@ -831,7 +831,7 @@ type_variable "GT" | type_variable type_bound_1 -type_bound_opt ::= type_bound | +type_bound_opt ::= type_bound | type_bound ::= "EXTENDS" reference_type additional_bound_list_opt @@ -839,7 +839,7 @@ "EXTENDS" reference_type_1 | "EXTENDS" reference_type additional_bound_list_1 -additional_bound_list_opt ::= additional_bound_list | +additional_bound_list_opt ::= additional_bound_list | additional_bound_list ::= additional_bound additional_bound_list | additional_bound @@ -948,7 +948,7 @@ conditional_expression_nn ::= conditional_or_expression_nn | name "QUESTION" expression "COLON" conditional_expression - | conditional_or_expression_nn "QUESTION" expression + | conditional_or_expression_nn "QUESTION" expression "COLON" conditional_expression assignment_expression_nn ::= diff --git a/lib/eco/grammars/sql.py b/lib/eco/grammars/sql.py index dbbc3075..a0349194 100644 --- a/lib/eco/grammars/sql.py +++ b/lib/eco/grammars/sql.py @@ -308,7 +308,7 @@ table_ref ::= - table + table | table range_variable