Commit 297eea71 authored by Igor Dejanovic's avatar Igor Dejanovic

Fixing PEP8 violations in peg_peg.

parent 40c1b0a9
......@@ -12,28 +12,29 @@
##############################################################################
from arpeggio import *
from arpeggio.export import PMDOTExport, PTDOTExport
from arpeggio import RegExMatch as _
from arpeggio.peg import ParserPEG
import logging
# Semantic actions
from arpeggio.peg import SemGrammar, SemRule, SemOrderedChoice, SemSequence, SemPrefix, \
SemSufix, SemExpression, SemRegEx, SemIdentifier, SemLiteral, SemTerminal
from arpeggio.peg import SemGrammar, SemRule, SemOrderedChoice, SemSequence,\
SemPrefix, SemSufix, SemExpression, SemRegEx, SemIdentifier, SemLiteral,\
SemTerminal
sem_actions = {
"grammar" : SemGrammar(),
"rule" : SemRule(),
"ordered_choice" : SemOrderedChoice(),
"sequence" : SemSequence(),
"prefix" : SemPrefix(),
"sufix" : SemSufix(),
"expression" : SemExpression(),
"regex" : SemRegEx(),
"identifier" : SemIdentifier(),
"literal" : SemLiteral()
"grammar": SemGrammar(),
"rule": SemRule(),
"ordered_choice": SemOrderedChoice(),
"sequence": SemSequence(),
"prefix": SemPrefix(),
"sufix": SemSufix(),
"expression": SemExpression(),
"regex": SemRegEx(),
"identifier": SemIdentifier(),
"literal": SemLiteral()
}
for sem in ["LEFT_ARROW", "SLASH", "STAR", "QUESTION", "PLUS", "AND", "NOT", "OPEN", "CLOSE"]:
for sem in ["LEFT_ARROW", "SLASH", "STAR", "QUESTION", "PLUS", "AND", "NOT",
"OPEN", "CLOSE"]:
sem_actions[sem] = SemTerminal()
......@@ -76,9 +77,9 @@ try:
PMDOTExport().exportFile(parser.parser_model,
"peg_peg_parser_model.dot")
# Now we will use created parser to parse the same peg_grammar used for parser
# initialization. We can parse peg_grammar because it is specified using
# PEG itself.
# Now we will use created parser to parse the same peg_grammar used for
# parser initialization. We can parse peg_grammar because it is specified
# using PEG itself.
parser.parse(peg_grammar)
PTDOTExport().exportFile(parser.parse_tree,
......@@ -98,6 +99,6 @@ try:
parser.parser_model = asg
parser.parse(peg_grammar)
except NoMatch, e:
print "Expected %s at position %s." % (e.value, str(e.parser.pos_to_linecol(e.position)))
print "Expected %s at position %s." % \
(e.value, str(e.parser.pos_to_linecol(e.position)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment