Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Parser/asdl.py

    r2 r388  
    22
    33See http://asdl.sourceforge.net/ and
    4 http://www.cs.princeton.edu/~danwang/Papers/dsl97/dsl97-abstract.html.
     4http://www.cs.princeton.edu/research/techreps/TR-554-97
    55
    66Only supports top level module decl, not view.  I'm guessing that view
     
    1111"""
    1212
    13 #__metaclass__ = type
    14 
    1513import os
    1614import traceback
     
    1816import spark
    1917
    20 class Token:
     18class Token(object):
    2119    # spark seems to dispatch in the parser based on a token's
    2220    # type attribute
     
    4644        self.lineno = lineno
    4745
    48 class ASDLSyntaxError:
     46class ASDLSyntaxError(Exception):
    4947
    5048    def __init__(self, lineno, token=None, msg=None):
     
    207205    def p_field_2(self, (type, _, name)):
    208206        " field ::= Id * Id "
    209         return Field(type, name, seq=1)
     207        return Field(type, name, seq=True)
    210208
    211209    def p_field_3(self, (type, _, name)):
    212210        " field ::= Id ? Id "
    213         return Field(type, name, opt=1)
     211        return Field(type, name, opt=True)
    214212
    215213    def p_field_4(self, (type, _)):
    216214        " field ::= Id * "
    217         return Field(type, seq=1)
     215        return Field(type, seq=True)
    218216
    219217    def p_field_5(self, (type, _)):
    220218        " field ::= Id ? "
    221         return Field(type, opt=1)
     219        return Field(type, opt=True)
    222220
    223221builtin_types = ("identifier", "string", "int", "bool", "object")
     
    227225# piecemeal as they seem helpful
    228226
    229 class AST:
     227class AST(object):
    230228    pass # a marker class
    231229
     
    259257
    260258class Field(AST):
    261     def __init__(self, type, name=None, seq=0, opt=0):
     259    def __init__(self, type, name=None, seq=False, opt=False):
    262260        self.type = type
    263261        self.name = name
     
    267265    def __repr__(self):
    268266        if self.seq:
    269             extra = ", seq=1"
     267            extra = ", seq=True"
    270268        elif self.opt:
    271             extra = ", opt=1"
     269            extra = ", opt=True"
    272270        else:
    273271            extra = ""
     
    297295class VisitorBase(object):
    298296
    299     def __init__(self, skip=0):
     297    def __init__(self, skip=False):
    300298        self.cache = {}
    301299        self.skip = skip
     
    332330
    333331    def __init__(self):
    334         super(Check, self).__init__(skip=1)
     332        super(Check, self).__init__(skip=True)
    335333        self.cons = {}
    336334        self.errors = 0
     
    374372
    375373    for t in v.types:
    376         if not mod.types.has_key(t) and not t in builtin_types:
     374        if t not in mod.types and not t in builtin_types:
    377375            v.errors += 1
    378376            uses = ", ".join(v.types[t])
Note: See TracChangeset for help on using the changeset viewer.