コード例 #1
0
ファイル: dsl.py プロジェクト: yakobowski/langkit
    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
ファイル: dsl.py プロジェクト: geoffreycopin/langkit
 def entity(cls):
     return T.Defer(lambda: cls._resolve().entity,
                    '{}.entity'.format(cls._name.camel))
コード例 #4
0
ファイル: dsl.py プロジェクト: geoffreycopin/langkit
 def array(cls):
     """
     Return the array type whose element type is `cls`.
     """
     return T.Defer(lambda: cls._resolve().array,
                    '{}.array'.format(cls._name.camel))