Skip to content

Instantly share code, notes, and snippets.

@mikejs
Created May 3, 2010 01:38
Show Gist options
  • Save mikejs/387635 to your computer and use it in GitHub Desktop.
Save mikejs/387635 to your computer and use it in GitHub Desktop.
Index: lib/clyther/api/ast/astgen.py
===================================================================
--- lib/clyther/api/ast/astgen.py (revision 68)
+++ lib/clyther/api/ast/astgen.py (working copy)
@@ -584,6 +584,14 @@
return ast.Bitor( cl_nodes, node.lineno ), nd_type
+ def visitBitxor(self,node):
+ nd, nd_type = self.dispatch(node.nodes[0])
+ cl_nodes = [nd]
+ for nd in node.nodes[1:]:
+ cl_node,nd_type2 = self.dispatch(nd)
+ cl_nodes.append(cl_node)
+ nd_type = TypeTree(nd_type, nd_type2)
+ return ast.Bitxor(cl_nodes, node.lineno), nd_type
def visitNot(self,node):
Index: lib/clyther/api/ast/codegen.py
===================================================================
--- lib/clyther/api/ast/codegen.py (revision 68)
+++ lib/clyther/api/ast/codegen.py (working copy)
@@ -429,7 +429,9 @@
def visitBitand(self,node):
return "( (%s) )" % ") & (".join([ self.dispatch(nd) for nd in node.nodes if nd is not None])
-
+
+ def visitBitxor(self, node):
+ return "( (%s) )" % ") ^ (".join([self.dispatch(nd) for nd in node.nodes if nd is not None])
def visitTuple(self,node):
clnodes = [ self.dispatch(nd) for nd in node.nodes]
Index: lib/clyther/api/ast/astgen.py
===================================================================
--- lib/clyther/api/ast/astgen.py (revision 68)
+++ lib/clyther/api/ast/astgen.py (working copy)
@@ -560,7 +560,7 @@
nd,nd_type = self.dispatch( node.nodes[0] )
cl_nodes = [nd]
- for nd in node.nodes:
+ for nd in node.nodes[1:]:
cl_node,nd_type2 = self.dispatch( nd )
@@ -574,7 +574,7 @@
nd,nd_type = self.dispatch( node.nodes[0] )
cl_nodes = [nd]
- for nd in node.nodes:
+ for nd in node.nodes[1:]:
cl_node,nd_type2 = self.dispatch( nd )
Index: lib/clyther/api/ast/astgen.py
===================================================================
--- lib/clyther/api/ast/astgen.py (revision 68)
+++ lib/clyther/api/ast/astgen.py (working copy)
@@ -625,7 +625,7 @@
left,ltype = self.dispatch(node.left)
right,rtype = self.dispatch(node.right)
- return ast.LeftShift((left, right), node.lineno), ltype
+ return ast.RightShift((left, right), node.lineno), ltype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment