]> hydra-www.ietfng.org Git - dyna2/commitdiff
added ':' operator.
authorTim Vieira <tim.f.vieira@gmail.com>
Wed, 24 Jul 2013 18:05:43 +0000 (14:05 -0400)
committerTim Vieira <tim.f.vieira@gmail.com>
Wed, 24 Jul 2013 18:05:43 +0000 (14:05 -0400)
src/Dyna/Backend/Python/interpreter.py
src/Dyna/Backend/Python/utils.py
src/Dyna/Term/SurfaceSyntax.hs

index baf1b70950924033be36558307bb4047fef410d0..e5a8a059921dab32569b38d094fc64526286208e 100644 (file)
@@ -324,7 +324,6 @@ class Interpreter(object):
         # update parser state
         self.pstate = parse_parser_state(env.parser_state)
 
-
         for k, v in env.agg_decl.items():
             self.new_fn(k, v)
 
index 58a598e30f315f9e87337cf080f251007887504d..2865ec58ead9ba3cdd66ec6e93965512d1710cbc 100644 (file)
@@ -143,9 +143,10 @@ def hide_ugly_filename(x, replacement='<repl>'):
 
 def lexer(term):
     return re.findall('"[^"]*"'               # string
+                      "|'[^']+'"              # quoted functor
                       '|[a-z][a-zA-Z_0-9]*'   # functor
-                      '|[A-Z_][a-zA-Z0-9_]*'   # variable
-                      '|[(), \[\]|]+'         # parens and comma
+                      '|[A-Z_][a-zA-Z0-9_]*'  # variable
+                      '|[(), \[\]|:]+'        # parens and comma
                       '|[^(), ]+', term)      # everything else
 
 
index e0c84564a601e9f2b0b1879e7ae3cca319400011..db11ffe007cb2d4939634ec246008395a3af4d7a 100644 (file)
@@ -82,6 +82,7 @@ defOperSpec = foldr (\(k,v) -> mapInOrCons k v) def more
     , ("with_key" ,[(4,PFIn AssocNone )      ])
 
     , ("->" ,[(5,PFIn AssocNone )      ])
+    , (":"  ,[(5,PFIn AssocRight )     ])
 
     , ("<=" ,[(4,PFIn AssocNone )            ])
     , ("<"  ,[(4,PFIn AssocNone )            ])
@@ -182,6 +183,7 @@ disposTab_prologish t = DisposTab s a
        , (("nil",  0),(SDQuote,[]))
        , (("cons", 2),(SDQuote,[ADEval,ADEval]))
        , (("->",2),(SDQuote,[ADQuote, ADQuote]))
+       , ((":",2),(SDQuote,[ADQuote, ADQuote]))       
        ]
 
 -- | Make the default surface syntax more functional.  Here, all functors
@@ -213,6 +215,8 @@ disposTab_dyna t = DisposTab s a
        , (("$key" ,1),(SDEval,[ADQuote]))
        , (("with_key",2),(SDQuote,[ADEval, ADEval]))
        , (("->",2),(SDQuote,[ADQuote, ADQuote]))
+       , ((":",2),(SDQuote,[ADQuote, ADQuote]))
+
        ]
 
 ------------------------------------------------------------------------}}}