[Python-checkins] CVS: python/dist/src/Lib/compiler __init__.py,1.6,1.7 ast.py,1.18,1.19 future.py,1.2,1.3 misc.py,1.10,1.11 pyassem.py,1.28,1.29 pycodegen.py,1.55,1.56 symbols.py,1.9,1.10 transformer.py,1.29,1.30 visitor.py,1.8,1.9

Tim Peters tim_one@users.sourceforge.net
2001年10月18日 14:57:39 -0700


Update of /cvsroot/python/python/dist/src/Lib/compiler
In directory usw-pr-cvs1:/tmp/cvs-serv29225/python/Lib/compiler
Modified Files:
	__init__.py ast.py future.py misc.py pyassem.py pycodegen.py 
	symbols.py transformer.py visitor.py 
Log Message:
Whitespace normalization.
Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/__init__.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** __init__.py	2001年09月27日 04:18:36	1.6
--- __init__.py	2001年10月18日 21:57:37	1.7
***************
*** 16,20 ****
 
 compile(source, filename, mode, flags=None, dont_inherit=None)
! Returns a code object. A replacement for the builtin compile() function. 
 
 compileFile(filename)
--- 16,20 ----
 
 compile(source, filename, mode, flags=None, dont_inherit=None)
! Returns a code object. A replacement for the builtin compile() function.
 
 compileFile(filename)
***************
*** 25,27 ****
 from visitor import walk
 from pycodegen import compile, compileFile
- 
--- 25,26 ----
Index: ast.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/ast.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** ast.py	2001年09月17日 20:17:02	1.18
--- ast.py	2001年10月18日 21:57:37	1.19
***************
*** 439,443 ****
 if flags & CO_VARKEYWORDS:
 self.kwargs = 1
! 
 
 
--- 439,443 ----
 if flags & CO_VARKEYWORDS:
 self.kwargs = 1
! 
 
 
Index: future.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/future.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** future.py	2001年08月18日 00:07:46	1.2
--- future.py	2001年10月18日 21:57:37	1.3
***************
*** 17,21 ****
 
 features = ("nested_scopes", "generators", "division")
! 
 def __init__(self):
 self.found = {} # set
--- 17,21 ----
 
 features = ("nested_scopes", "generators", "division")
! 
 def __init__(self):
 self.found = {} # set
***************
*** 71,73 ****
 print v.found
 print
- 
--- 71,72 ----
Index: misc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/misc.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** misc.py	2001年09月17日 18:02:21	1.10
--- misc.py	2001年10月18日 21:57:37	1.11
***************
*** 73,75 ****
 node.filename = filename
 worklist.extend(node.getChildNodes())
- 
--- 73,74 ----
Index: pyassem.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/pyassem.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** pyassem.py	2001年10月17日 13:37:29	1.28
--- pyassem.py	2001年10月18日 21:57:37	1.29
***************
*** 56,60 ****
 # however. :-( If a client needs to remove these edges, call
 # pruneEdges().
! 
 self.current.addNext(block)
 self.startBlock(block)
--- 56,60 ----
 # however. :-( If a client needs to remove these edges, call
 # pruneEdges().
! 
 self.current.addNext(block)
 self.startBlock(block)
***************
*** 111,115 ****
 # XXX This is a total mess. There must be a better way to get
 # the code blocks in the right order.
! 
 self.fixupOrderHonorNext(blocks, default_next)
 self.fixupOrderForward(blocks, default_next)
--- 111,115 ----
 # XXX This is a total mess. There must be a better way to get
 # the code blocks in the right order.
! 
 self.fixupOrderHonorNext(blocks, default_next)
 self.fixupOrderForward(blocks, default_next)
***************
*** 117,121 ****
 def fixupOrderHonorNext(self, blocks, default_next):
 """Fix one problem with DFS.
! 
 The DFS uses child block, but doesn't know about the special
 "next" block. As a result, the DFS can order blocks so that a
--- 117,121 ----
 def fixupOrderHonorNext(self, blocks, default_next):
 """Fix one problem with DFS.
! 
 The DFS uses child block, but doesn't know about the special
 "next" block. As a result, the DFS can order blocks so that a
***************
*** 201,205 ****
 for b in c:
 blocks.append(b)
! 
 def getBlocks(self):
 return self.blocks.elements()
--- 201,205 ----
 for b in c:
 blocks.append(b)
! 
 def getBlocks(self):
 return self.blocks.elements()
***************
*** 208,212 ****
 """Return nodes appropriate for use with dominator"""
 return self.entry
! 
 def getContainedGraphs(self):
 l = []
--- 208,212 ----
 """Return nodes appropriate for use with dominator"""
 return self.entry
! 
 def getContainedGraphs(self):
 l = []
***************
*** 247,251 ****
 insts = map(str, self.insts)
 return "<block %s %d:\n%s>" % (self.label, self.bid,
! string.join(insts, '\n')) 
 
 def emit(self, inst):
--- 247,251 ----
 insts = map(str, self.insts)
 return "<block %s %d:\n%s>" % (self.label, self.bid,
! string.join(insts, '\n'))
 
 def emit(self, inst):
***************
*** 332,336 ****
 self.klass = klass
 if optimized:
! self.flags = CO_OPTIMIZED | CO_NEWLOCALS 
 else:
 self.flags = 0
--- 332,336 ----
 self.klass = klass
 if optimized:
! self.flags = CO_OPTIMIZED | CO_NEWLOCALS
 else:
 self.flags = 0
***************
*** 568,572 ****
 if name[:9] == "_convert_":
 opname = name[9:]
! _converters[opname] = obj 
 del name, obj, opname
 
--- 568,572 ----
 if name[:9] == "_convert_":
 opname = name[9:]
! _converters[opname] = obj
 del name, obj, opname
 
***************
*** 624,628 ****
 l.append(elt)
 return tuple(l)
! 
 def isJump(opname):
 if opname[:4] == 'JUMP':
--- 624,628 ----
 l.append(elt)
 return tuple(l)
! 
 def isJump(opname):
 if opname[:4] == 'JUMP':
***************
*** 655,659 ****
 class LineAddrTable:
 """lnotab
! 
 This class builds the lnotab, which is documented in compile.c.
 Here's a brief recap:
--- 655,659 ----
 class LineAddrTable:
 """lnotab
! 
 This class builds the lnotab, which is documented in compile.c.
 Here's a brief recap:
***************
*** 718,722 ****
 def getTable(self):
 return string.join(map(chr, self.lnotab), '')
! 
 class StackDepthTracker:
 # XXX 1. need to keep track of stack depth on jumps
--- 718,722 ----
 def getTable(self):
 return string.join(map(chr, self.lnotab), '')
! 
 class StackDepthTracker:
 # XXX 1. need to keep track of stack depth on jumps
***************
*** 793,797 ****
 ('LOAD_', 1),
 ]
! 
 def UNPACK_SEQUENCE(self, count):
 return count-1
--- 793,797 ----
 ('LOAD_', 1),
 ]
! 
 def UNPACK_SEQUENCE(self, count):
 return count-1
***************
*** 821,824 ****
 def DUP_TOPX(self, argc):
 return argc
! 
 findDepth = StackDepthTracker().findDepth
--- 821,824 ----
 def DUP_TOPX(self, argc):
 return argc
! 
 findDepth = StackDepthTracker().findDepth
Index: pycodegen.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/pycodegen.py,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** pycodegen.py	2001年09月17日 21:02:51	1.55
--- pycodegen.py	2001年10月18日 21:57:37	1.56
***************
*** 37,41 ****
 class BlockStack(misc.Stack):
 __super_init = misc.Stack.__init__
! 
 def __init__(self):
 self.__super_init(self)
--- 37,41 ----
 class BlockStack(misc.Stack):
 __super_init = misc.Stack.__init__
! 
 def __init__(self):
 self.__super_init(self)
***************
*** 60,64 ****
 if flags is not None or dont_inherit is not None:
 raise RuntimeError, "not implemented yet"
! 
 if mode == "single":
 gen = Interactive(source, filename)
--- 60,64 ----
 if flags is not None or dont_inherit is not None:
 raise RuntimeError, "not implemented yet"
! 
 if mode == "single":
 gen = Interactive(source, filename)
***************
*** 199,203 ****
 defined in the initClass() method, which is a hook for
 initializing these methods after all the classes have been
! defined. 
 """
 
--- 199,203 ----
 defined in the initClass() method, which is a hook for
 initializing these methods after all the classes have been
! defined.
 """
 
***************
*** 313,317 ****
 
 def set_lineno(self, node, force=0):
! """Emit SET_LINENO if node has lineno attribute and it is 
 different than the last lineno emitted.
 
--- 313,317 ----
 
 def set_lineno(self, node, force=0):
! """Emit SET_LINENO if node has lineno attribute and it is
 different than the last lineno emitted.
 
***************
*** 514,518 ****
 self.nextBlock()
 elif kind == END_FINALLY:
! msg = "'continue' not allowed inside 'finally' clause (%s, %d)" 
 raise SyntaxError, msg % (node.filename, node.lineno)
 
--- 514,518 ----
 self.nextBlock()
 elif kind == END_FINALLY:
! msg = "'continue' not allowed inside 'finally' clause (%s, %d)"
 raise SyntaxError, msg % (node.filename, node.lineno)
 
***************
*** 559,563 ****
 # list comprehensions
 __list_count = 0
! 
 def visitListComp(self, node):
 self.set_lineno(node)
--- 559,563 ----
 # list comprehensions
 __list_count = 0
! 
 def visitListComp(self, node):
 self.set_lineno(node)
***************
*** 569,573 ****
 self.emit('LOAD_ATTR', 'append')
 self._implicitNameOp('STORE', append)
! 
 stack = []
 for i, for_ in zip(range(len(node.quals)), node.quals):
--- 569,573 ----
 self.emit('LOAD_ATTR', 'append')
 self._implicitNameOp('STORE', append)
! 
 stack = []
 for i, for_ in zip(range(len(node.quals)), node.quals):
***************
*** 584,588 ****
 self.emit('CALL_FUNCTION', 1)
 self.emit('POP_TOP')
! 
 for start, cont, anchor in stack:
 if cont:
--- 584,588 ----
 self.emit('CALL_FUNCTION', 1)
 self.emit('POP_TOP')
! 
 for start, cont, anchor in stack:
 if cont:
***************
*** 595,599 ****
 self.startBlock(anchor)
 self._implicitNameOp('DELETE', append)
! 
 self.__list_count = self.__list_count - 1
 
--- 595,599 ----
 self.startBlock(anchor)
 self._implicitNameOp('DELETE', append)
! 
 self.__list_count = self.__list_count - 1
 
***************
*** 676,680 ****
 self.emit('JUMP_FORWARD', lElse)
 self.startBlock(handlers)
! 
 last = len(node.handlers) - 1
 for i in range(len(node.handlers)):
--- 676,680 ----
 self.emit('JUMP_FORWARD', lElse)
 self.startBlock(handlers)
! 
 last = len(node.handlers) - 1
 for i in range(len(node.handlers)):
***************
*** 708,712 ****
 self.visit(node.else_)
 self.nextBlock(end)
! 
 def visitTryFinally(self, node):
 body = self.newBlock()
--- 708,712 ----
 self.visit(node.else_)
 self.nextBlock(end)
! 
 def visitTryFinally(self, node):
 body = self.newBlock()
***************
*** 747,751 ****
 self.set_lineno(node)
 self.loadName(node.name)
! 
 def visitPass(self, node):
 self.set_lineno(node)
--- 747,751 ----
 self.set_lineno(node)
 self.loadName(node.name)
! 
 def visitPass(self, node):
 self.set_lineno(node)
***************
*** 1140,1144 ****
 
 scopes = None
! 
 def __init__(self, tree):
 self.graph = pyassem.PyFlowGraph("<module>", tree.filename)
--- 1140,1144 ----
 
 scopes = None
! 
 def __init__(self, tree):
 self.graph = pyassem.PyFlowGraph("<module>", tree.filename)
***************
*** 1155,1159 ****
 scopes = None
 futures = ()
! 
 def __init__(self, tree):
 self.graph = pyassem.PyFlowGraph("<expression>", tree.filename)
--- 1155,1159 ----
 scopes = None
 futures = ()
! 
 def __init__(self, tree):
 self.graph = pyassem.PyFlowGraph("<expression>", tree.filename)
***************
*** 1172,1176 ****
 scopes = None
 futures = ()
! 
 def __init__(self, tree):
 self.graph = pyassem.PyFlowGraph("<interactive>", tree.filename)
--- 1172,1176 ----
 scopes = None
 futures = ()
! 
 def __init__(self, tree):
 self.graph = pyassem.PyFlowGraph("<interactive>", tree.filename)
***************
*** 1202,1207 ****
 name = func.name
 args, hasTupleArg = generateArgList(func.argnames)
! self.graph = pyassem.PyFlowGraph(name, func.filename, args, 
! optimized=1) 
 self.isLambda = isLambda
 self.super_init()
--- 1202,1207 ----
 name = func.name
 args, hasTupleArg = generateArgList(func.argnames)
! self.graph = pyassem.PyFlowGraph(name, func.filename, args,
! optimized=1)
 self.isLambda = isLambda
 self.super_init()
***************
*** 1235,1239 ****
 self.emit('LOAD_FAST', '.%d' % (i * 2))
 self.unpackSequence(arg)
! 
 def unpackSequence(self, tup):
 if VERSION > 1:
--- 1235,1239 ----
 self.emit('LOAD_FAST', '.%d' % (i * 2))
 self.unpackSequence(arg)
! 
 def unpackSequence(self, tup):
 if VERSION > 1:
***************
*** 1250,1254 ****
 
 class FunctionCodeGenerator(NestedScopeMixin, AbstractFunctionCode,
! CodeGenerator): 
 super_init = CodeGenerator.__init__ # call be other init
 scopes = None
--- 1250,1254 ----
 
 class FunctionCodeGenerator(NestedScopeMixin, AbstractFunctionCode,
! CodeGenerator):
 super_init = CodeGenerator.__init__ # call be other init
 scopes = None
Index: symbols.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/symbols.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** symbols.py	2001年09月14日 22:45:57	1.9
--- symbols.py	2001年10月18日 21:57:37	1.10
***************
*** 132,136 ****
 
 Be careful to stop if a child does not think the name is
! free. 
 """
 self.globals[name] = 1
--- 132,136 ----
 
 Be careful to stop if a child does not think the name is
! free.
 """
 self.globals[name] = 1
***************
*** 173,177 ****
 class ModuleScope(Scope):
 __super_init = Scope.__init__
! 
 def __init__(self):
 self.__super_init("global", self)
--- 173,177 ----
 class ModuleScope(Scope):
 __super_init = Scope.__init__
! 
 def __init__(self):
 self.__super_init("global", self)
***************
*** 184,188 ****
 
 __counter = 1
! 
 def __init__(self, module, klass=None):
 i = self.__counter
--- 184,188 ----
 
 __counter = 1
! 
 def __init__(self, module, klass=None):
 i = self.__counter
***************
*** 200,204 ****
 self.scopes = {}
 self.klass = None
! 
 # node that define new scopes
 
--- 200,204 ----
 self.scopes = {}
 self.klass = None
! 
 # node that define new scopes
 
***************
*** 218,222 ****
 self.visit(node.code, scope)
 self.handle_free_vars(scope, parent)
! 
 def visitLambda(self, node, parent):
 for n in node.defaults:
--- 218,222 ----
 self.visit(node.code, scope)
 self.handle_free_vars(scope, parent)
! 
 def visitLambda(self, node, parent):
 for n in node.defaults:
***************
*** 327,331 ****
 if node.upper:
 self.visit(node.upper, scope, 0)
! 
 def visitAugAssign(self, node, scope):
 # If the LHS is a name, then this counts as assignment.
--- 327,331 ----
 if node.upper:
 self.visit(node.upper, scope, 0)
! 
 def visitAugAssign(self, node, scope):
 # If the LHS is a name, then this counts as assignment.
***************
*** 372,377 ****
 def get_names(syms):
 return [s for s in [s.get_name() for s in syms.get_symbols()]
! if not (s.startswith('_[') or s.startswith('.'))] 
! 
 for file in sys.argv[1:]:
 print file
--- 372,377 ----
 def get_names(syms):
 return [s for s in [s.get_name() for s in syms.get_symbols()]
! if not (s.startswith('_[') or s.startswith('.'))]
! 
 for file in sys.argv[1:]:
 print file
Index: transformer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/transformer.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** transformer.py	2001年10月17日 13:32:52	1.29
--- transformer.py	2001年10月18日 21:57:37	1.30
***************
*** 693,697 ****
 n.lineno = nodelist[0][2]
 return n
! 
 def atom_number(self, nodelist):
 ### need to verify this matches compile.c
--- 693,697 ----
 n.lineno = nodelist[0][2]
 return n
! 
 def atom_number(self, nodelist):
 ### need to verify this matches compile.c
***************
*** 700,704 ****
 n.lineno = nodelist[0][2]
 return n
! 
 def atom_string(self, nodelist):
 ### need to verify this matches compile.c
--- 700,704 ----
 n.lineno = nodelist[0][2]
 return n
! 
 def atom_string(self, nodelist):
 ### need to verify this matches compile.c
***************
*** 744,748 ****
 # ('const', xxxx)) Nodes)
 return Discard(Const(None))
! 
 def com_arglist(self, nodelist):
 # varargslist:
--- 744,748 ----
 # ('const', xxxx)) Nodes)
 return Discard(Const(None))
! 
 def com_arglist(self, nodelist):
 # varargslist:
***************
*** 806,810 ****
 
 def com_fplist(self, node):
! # fplist: fpdef (',' fpdef)* [','] 
 if len(node) == 2:
 return self.com_fpdef(node[1])
--- 806,810 ----
 
 def com_fplist(self, node):
! # fplist: fpdef (',' fpdef)* [',']
 if len(node) == 2:
 return self.com_fpdef(node[1])
***************
*** 855,859 ****
 # try_fin_stmt: "try" ":" suite "finally" ":" suite
 n = TryFinally(self.com_node(nodelist[2]),
! self.com_node(nodelist[5])) 
 n.lineno = nodelist[0][2]
 return n
--- 855,859 ----
 # try_fin_stmt: "try" ":" suite "finally" ":" suite
 n = TryFinally(self.com_node(nodelist[2]),
! self.com_node(nodelist[5]))
 n.lineno = nodelist[0][2]
 return n
***************
*** 923,927 ****
 primary = self.com_apply_trailer(primary, ch)
 return self.com_assign_trailer(primary, node[-1],
! assigning) 
 node = node[1]
 elif t == symbol.atom:
--- 923,927 ----
 primary = self.com_apply_trailer(primary, ch)
 return self.com_assign_trailer(primary, node[-1],
! assigning)
 node = node[1]
 elif t == symbol.atom:
***************
*** 1024,1028 ****
 
 # XXX should raise SyntaxError for assignment
! 
 lineno = node[1][2]
 fors = []
--- 1024,1028 ----
 
 # XXX should raise SyntaxError for assignment
! 
 lineno = node[1][2]
 fors = []
***************
*** 1101,1105 ****
 node = nodelist[i]
 if node[0] == token.STAR or node[0] == token.DOUBLESTAR:
! break
 kw, result = self.com_argument(node, kw)
 args.append(result)
--- 1101,1105 ----
 node = nodelist[i]
 if node[0] == token.STAR or node[0] == token.DOUBLESTAR:
! break
 kw, result = self.com_argument(node, kw)
 args.append(result)
***************
*** 1146,1150 ****
 # slicing: simple_slicing | extended_slicing
 # simple_slicing: primary "[" short_slice "]"
! # extended_slicing: primary "[" slice_list "]" 
 # slice_list: slice_item ("," slice_item)* [","]
 
--- 1146,1150 ----
 # slicing: simple_slicing | extended_slicing
 # simple_slicing: primary "[" short_slice "]"
! # extended_slicing: primary "[" slice_list "]"
 # slice_list: slice_item ("," slice_item)* [","]
 
Index: visitor.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/compiler/visitor.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** visitor.py	2001年08月29日 18:17:22	1.8
--- visitor.py	2001年10月18日 21:57:37	1.9
***************
*** 79,83 ****
 """
 examples = {}
! 
 def dispatch(self, node, *args):
 self.node = node
--- 79,83 ----
 """
 examples = {}
! 
 def dispatch(self, node, *args):
 self.node = node

AltStyle によって変換されたページ (->オリジナル) /