Esempio n. 1
0
 def __init__(self, original_str, location, tokens):
     super(Function, self).__init__(original_str, location, tokens)
     self.return_type = None
     if (hasattr(tokens, "return_type")):
         self.return_type = tokens.return_type
     self.name = tokens.function_name
     self.params = tokens.params
     self.min_param_length = len(self.params)
     for param in self.params:
         if (param.is_optional):
             self.min_param_length -= 1
     self.statements = tokens.statements
     try:
         len(self.statements)
     except:
         self.statements = [self.statements]
     self.return_type = tokens.return_type
     self.vars = {}
     self.bogus_if = None
     if (len(tokens.bogus_if) > 0):
         self.bogus_if = tokens.bogus_if
     # Get a dict mapping labeled blocks of code to labels.
     # This will be used to handle GOTO statements when emulating.
     visitor = tagged_block_finder_visitor()
     self.accept(visitor)
     self.tagged_blocks = visitor.blocks
     log.info('parsed %r' % self)
Esempio n. 2
0
 def __init__(self, original_str, location, tokens):
     super(Sub, self).__init__(original_str, location, tokens)
     self.name = tokens.sub_name
     self.params = tokens.params
     self.statements = tokens.statements
     self.bogus_if = None
     if (len(tokens.bogus_if) > 0):
         self.bogus_if = tokens.bogus_if
     # Get a dict mapping labeled blocks of code to labels.
     # This will be used to handle GOTO statements when emulating.
     visitor = tagged_block_finder_visitor()
     self.accept(visitor)
     self.tagged_blocks = visitor.blocks
     log.info('parsed %r' % self)
Esempio n. 3
0
 def __init__(self, original_str, location, tokens):
     super(PropertyLet, self).__init__(original_str, location, tokens)
     self.name = tokens.property_name
     self.params = tokens.params
     self.min_param_length = len(self.params)
     for param in self.params:
         if (param.is_optional):
             self.min_param_length -= 1
     self.statements = tokens.statements
     try:
         len(self.statements)
     except:
         self.statements = [self.statements]
     # Get a dict mapping labeled blocks of code to labels.
     # This will be used to handle GOTO statements when emulating.
     visitor = tagged_block_finder_visitor()
     self.accept(visitor)
     self.tagged_blocks = visitor.blocks
     log.info('parsed %r' % self)