How to use the lark.lexer.Token function in lark

To help you get started, we’ve selected a few lark examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tartiflette / tartiflette / tests / unit / sdl / test_parse_graphql_sdl_to_ast.py View on Github external
                                                            Token('IDENT', 'Custom'),
                                                        ]),
                                                    ]),
                                                ]),
                                            ]),
                                        ]),
                                    ]),
                                ]),
                            ]),
                        ]),
                    ]),
                ]),
            ]),
        ]),
    ),
    # Schema with invalid double ! modifier
    (
github tartiflette / tartiflette / tests / unit / sdl / test_parse_graphql_sdl_to_ast_full_sdl.py View on Github external
Token('IDENT', 'Date'),
                                    ]),
                                ]),
                            ]),
                        ]),
                    ]),
                ]),
            ]),
        ]),
        Tree('type_system_definition', [
            Tree('type_extension', [
                Tree('input_object_type_extension', [
                    Token('EXTEND', 'extend'),
                    Token('INPUT', 'input'),
                    Tree('name', [
                        Token('IDENT', 'FilterCharacters'),
                    ]),
                    Tree('input_fields_definition', [
                        Tree('input_value_definition', [
                            Tree('name', [
                                Token('IDENT', 'existsSince'),
                            ]),
                            Tree('type', [
                                Tree('named_type', [
                                    Tree('name', [
                                        Token('IDENT', 'Date'),
                                    ]),
                                ]),
                            ]),
                        ]),
                    ]),
                ]),
github tartiflette / tartiflette / tests / unit / sdl / test_parse_graphql_sdl_to_ast.py View on Github external
                                    Token('IDENT', 'acl'),
                                ]),
                                Tree('arguments', [
                                    Tree('argument', [
                                        Tree('name', [
                                            Token('IDENT', 'role'),
                                        ]),
                                        Tree('value', [
                                            Tree('string_value', [
                                                Token('STRING', '"can-filter"'),
                                            ]),
                                        ]),
                                    ]),
                                ]),
                            ]),
                        ]),
                        Tree('input_fields_definition', [
github nightblade9 / dragon / tests / transpiler / lark / transformers / test_haxe_transformer.py View on Github external
def test_string_turns_list_into_empty_string(self):
        h = HaxeTransformer()
        metadata = '@:build(flixel.system.FlxAssets.buildFileReferences("assets", true))'
        data = [Token("LONG_STRING", '"""{}"""'.format(metadata))]
        output = h.string(data)
        self.assertEqual("", output)
github tartiflette / tartiflette / tests / unit / sdl / test_parse_graphql_sdl_to_ast.py View on Github external
                                        Token('IDENT', 'INACTIVE'),
                                    ]),
                                ]),
                            ]),
                            Tree('enum_value_definition', [
                                Tree('enum_value', [
                                    Tree('name', [
                                        Token('IDENT', 'SUSPENDED'),
                                    ]),
                                ]),
                            ]),
                        ]),
                    ]),
                ]),
            ]),
        ]),
    ),
github tartiflette / tartiflette / tests / unit / sdl / test_parse_graphql_sdl_to_ast.py View on Github external
                                        Token('IDENT', 'str'),
                                    ]),
                                    Tree('value', [
                                        Tree('string_value', [
                                            Token('STRING', '"test"')
                                        ]),
                                    ]),
                                ]),
                                Tree('argument', [
                                    Tree('name', [
                                        Token('IDENT', 'int'),
                                    ]),
                                    Tree('value', [
                                        Tree('int_value', [
                                            Token('SIGNED_INT', '14')
                                        ]),
                                    ]),
github tartiflette / tartiflette / tests / unit / sdl / test_parse_graphql_sdl_to_ast.py View on Github external
                                        Token('IDENT', 'NOT_FOUND'),
                                    ]),
                                ]),
                            ]),
                            Tree('enum_value_definition', [
                                Tree('enum_value', [
                                    Tree('name', [
                                        Token('IDENT', 'ACTIVE'),
                                    ]),
                                ]),
                                Tree('directives', [
                                    Tree('directive', [
                                        Tree('name', [
                                            Token('IDENT', 'cache'),
                                        ]),
                                        Tree('arguments', [
                                            Tree('argument', [
github protective / stationeers_pymips / compiler / expr_look_ahead.py View on Github external
def reduce_expr(self, tree):
        lst = tree.children.copy()
        for node in lst:
            if not isinstance(node, Token):
                self.visit(node)