예제 #1
0
    def __new__(cls, *args):
        """
        This constructor can be used in the grammar to create a parser for this
        AST node.
        """
        from langkit.parsers import _Row, _Transform

        return _Transform(_Row(*args), T.Defer(cls._resolve, cls._name.camel))
예제 #2
0
 def type_ref(self):
     """
     TypeRepo.Defer instance for the ASTNodeType subclass corresponding
     to this alternative.
     """
     def get():
         assert self._type
         return self._type
     return T.Defer(get, 'Alternative({})'.format(self.name.camel))
예제 #3
0
 def entity(cls):
     return T.Defer(lambda: cls._resolve().entity,
                    '{}.entity'.format(cls._name.camel))
예제 #4
0
 def array(cls):
     """
     Return the array type whose element type is `cls`.
     """
     return T.Defer(lambda: cls._resolve().array,
                    '{}.array'.format(cls._name.camel))