1. Olemis Lang
  2. trac-gviz

Source

trac-gviz / trac-dev / gviz / tracgviz / testing / test_parsing.py

Diff from to

File trac-dev/gviz/tracgviz/testing/test_parsing.py

 
 from pygments.token import *
 
-from tracgviz.util.parsing import OperatorPrecedenceParser as Parser, Any, \
-    EndMarker, NonTerminal
+from tracgviz.util.parsing import Any, EndMarker, gen_precedence, NonTerminal, \
+    OperatorPrecedenceParser as Parser
 
 # Modified version of sample operator precedence grammar in
 # The Theory of Parsing, Translation, and Compiling, A.V. Aho, J.B. Ullman
       },
   }
 
-SAMPLE_GRAMMAR_PRECEDENCE = dict(
-    [ (tkn1, tkn2), prec] \
-        for tkn1, v1 in SAMPLE_GRAMMAR_PRECEDENCE.iteritems() \
-        for prec, v2 in v1.iteritems() \
-        for tkn2 in v2
-  )
+SAMPLE_GRAMMAR_PRECEDENCE = gen_precedence(SAMPLE_GRAMMAR_PRECEDENCE) 
 
 SAMPLE_GRAMMAR_PRODUCTIONS = {
     (Name, Any) : {