[Python-checkins] python/nondist/sandbox/ast python.asdl,1.2,1.3

jhylton@sourceforge.net jhylton@sourceforge.net
Tue, 09 Apr 2002 12:13:39 -0700


Update of /cvsroot/python/python/nondist/sandbox/ast
In directory usw-pr-cvs1:/tmp/cvs-serv22159

Modified Files:
	python.asdl 
Log Message:
A bunch of small changes suggested by Guido


Index: python.asdl
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/ast/python.asdl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** python.asdl	9 Apr 2002 05:35:27 -0000	1.2
--- python.asdl	9 Apr 2002 19:13:36 -0000	1.3
***************
*** 5,11 ****
  	mod = Module(stmts body)
  
! 	stmts = Function(identifier name, arguments args, stmts body)
! 	      | Lambda(arguments args, expr body)
! 	      | Class(identifier name, bases bases, stmts body)
  	      | Return(expr value) | Yield(expr value)
  
--- 5,10 ----
  	mod = Module(stmts body)
  
! 	stmts = FunctionDef(identifier name, arguments args, stmts body)
! 	      | ClassDef(identifier name, expr* bases, stmts body)
  	      | Return(expr value) | Yield(expr value)
  
***************
*** 15,19 ****
  
  	      -- not sure if bool is allowed, can always use int
!  	      | Print(expr? dest, expr value, bool nl)
  
  	      -- XXX use 'orelse' because else is a keyword
--- 14,18 ----
  
  	      -- not sure if bool is allowed, can always use int
!  	      | Print(expr? dest, expr* value, bool nl)
  
  	      -- XXX use 'orelse' because else is a keyword
***************
*** 23,46 ****
  	      | If(expr test, stmts body, stmts? orelse)
  
! 	      | Raise(expr type, expr inst, expr tback)
  	      | TryExcept(stmts body) -- XXX
  	      | TryFinally(stmts body, stmts final)
! 	      | Assert(expr test, expr fail)
  
  	      | Import(identifier* names)
  	      | ImportAs(identifier name, identifier alias)
  	      | ImportFrom(identifier module, identifier* names)
  
  	      -- Doesn't capture requirement that locals must be
  	      -- defined if globals is
  	      | Exec(expr body, expr? locals, expr? globals)
  
! 	      | Global(identifier)
! 	      | Noop(expr value)
  	      | Pass | Break | Continue
  
! 	expr = VarOp(varop op, expr* values)
  	     | BinOp(expr left, operator op, expr right)
  	     | UnaryOp(unaryop op, expr operand)
  	     | Dict(expr* elts) 
  	     | ListComp(expr target, listcomp* generators)
--- 22,54 ----
  	      | If(expr test, stmts body, stmts? orelse)
  
! 	      -- 'type' is a bad name
! 	      | Raise(expr? type, expr? inst, expr? tback)
  	      | TryExcept(stmts body) -- XXX
  	      | TryFinally(stmts body, stmts final)
! 	      | Assert(expr test, expr? msg)
  
+ 	      -- may want to factor this differently perhaps excluding
+               -- 'as' from the type because can mix name and alias w/ from
+ 	      -- also need import *
  	      | Import(identifier* names)
  	      | ImportAs(identifier name, identifier alias)
  	      | ImportFrom(identifier module, identifier* names)
+ 	      | ImportFromAs(identifier module, identifier name,
+ 			     identifier alias)
  
  	      -- Doesn't capture requirement that locals must be
  	      -- defined if globals is
+ 	      -- still supports use as a function!
  	      | Exec(expr body, expr? locals, expr? globals)
  
! 	      | Global(identifier* name)
! 	      | Expr(expr value)
  	      | Pass | Break | Continue
  
! 	      -- BoolOp() can use left & right
! 	expr = BoolOp(boolop op, expr* values)
  	     | BinOp(expr left, operator op, expr right)
  	     | UnaryOp(unaryop op, expr operand)
+ 	     | Lambda(arguments args, expr body)
  	     | Dict(expr* elts) 
  	     | ListComp(expr target, listcomp* generators)
***************
*** 48,56 ****
  	     -- x < 4 < 3 and (x < 4) < 3
  	     | Compare(expr left, cmpop* ops, expr* comparators)
! 	     | Call(expr func, expr* args, expr? starargs, expr? kwargs)
  	     | Repr(expr)
! 	     | Literal(string) -- numbers, strings
  	     -- the following items appear in expr and assign
! 	     | Attribute(expr value, identifier* attrs)
  	     | Subscript(expr value, slice slice)
  	     | Name(identifier)
--- 56,65 ----
  	     -- x < 4 < 3 and (x < 4) < 3
  	     | Compare(expr left, cmpop* ops, expr* comparators)
! 	     | Call(expr func, expr* args, XXX keywords,
! 			 expr? starargs, expr? kwargs)
  	     | Repr(expr)
! 	     | Literal(string) -- numbers, strings -- probably separate
  	     -- the following items appear in expr and assign
! 	     | Attribute(expr value, identifier attr)
  	     | Subscript(expr value, slice slice)
  	     | Name(identifier)
***************
*** 59,63 ****
  	-- the subset of expressions that are valid as the target of
  	-- assignments. 
! 	assign = Attribute(expr value, identifier* attrs)
  	     | Subscript(expr value, slice slice)
  	     | Name(identifier)
--- 68,72 ----
  	-- the subset of expressions that are valid as the target of
  	-- assignments. 
! 	assign = Attribute(expr value, identifier attr)
  	     | Subscript(expr value, slice slice)
  	     | Name(identifier)
***************
*** 68,72 ****
  	      | ExtSlice(expr* dims) 
  
! 	varop = And | Or 
  
  	operator = Add | Sub | Mult | Div | Mod | Pow | LShift 
--- 77,81 ----
  	      | ExtSlice(expr* dims) 
  
! 	boolop = And | Or 
  
  	operator = Add | Sub | Mult | Div | Mod | Pow | LShift 
***************
*** 77,82 ****
  	cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | LtGt 
  	      | Is | IsNot | In | NotIn
- 
- 	bases = (expr* bases)
  
  	listcomp = (expr target, expr iter, expr* ifs)
--- 86,89 ----