rails-graphql 0.2.1 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/console.rb +18 -0
- data/ext/extconf.h +3 -0
- data/ext/extconf.rb +1 -54
- data/ext/gql_parser.c +631 -0
- data/ext/gql_parser.h +21 -0
- data/ext/shared.c +477 -0
- data/ext/shared.h +177 -0
- data/lib/generators/graphql/channel_generator.rb +27 -0
- data/lib/generators/graphql/controller_generator.rb +9 -4
- data/lib/generators/graphql/install_generator.rb +49 -0
- data/lib/generators/graphql/schema_generator.rb +9 -4
- data/lib/generators/graphql/templates/channel.erb +7 -0
- data/lib/generators/graphql/templates/config.rb +97 -0
- data/lib/generators/graphql/templates/controller.erb +2 -0
- data/lib/generators/graphql/templates/schema.erb +5 -3
- data/lib/gql_parser.so +0 -0
- data/lib/rails/graphql/adapters/mysql_adapter.rb +59 -0
- data/lib/rails/graphql/adapters/pg_adapter.rb +25 -22
- data/lib/rails/graphql/adapters/sqlite_adapter.rb +17 -14
- data/lib/rails/graphql/alternative/field_set.rb +48 -0
- data/lib/rails/graphql/alternative/mutation.rb +17 -0
- data/lib/rails/graphql/alternative/query.rb +98 -0
- data/lib/rails/graphql/alternative/subscription.rb +18 -0
- data/lib/rails/graphql/alternative.rb +20 -0
- data/lib/rails/graphql/argument.rb +25 -26
- data/lib/rails/graphql/callback.rb +30 -14
- data/lib/rails/graphql/collectors/hash_collector.rb +26 -7
- data/lib/rails/graphql/collectors/idented_collector.rb +10 -7
- data/lib/rails/graphql/collectors/json_collector.rb +43 -17
- data/lib/rails/graphql/collectors.rb +4 -4
- data/lib/rails/graphql/config.rb +154 -23
- data/lib/rails/graphql/directive/cached_directive.rb +33 -0
- data/lib/rails/graphql/directive/deprecated_directive.rb +10 -10
- data/lib/rails/graphql/directive/include_directive.rb +4 -4
- data/lib/rails/graphql/directive/skip_directive.rb +4 -4
- data/lib/rails/graphql/directive/specified_by_directive.rb +24 -0
- data/lib/rails/graphql/directive.rb +134 -73
- data/lib/rails/graphql/errors.rb +33 -4
- data/lib/rails/graphql/event.rb +21 -9
- data/lib/rails/graphql/field/authorized_field.rb +17 -6
- data/lib/rails/graphql/field/input_field.rb +8 -12
- data/lib/rails/graphql/field/mutation_field.rb +43 -9
- data/lib/rails/graphql/field/output_field.rb +112 -12
- data/lib/rails/graphql/field/proxied_field.rb +35 -26
- data/lib/rails/graphql/field/resolved_field.rb +27 -25
- data/lib/rails/graphql/field/scoped_config.rb +10 -4
- data/lib/rails/graphql/field/subscription_field.rb +123 -0
- data/lib/rails/graphql/field/typed_field.rb +69 -24
- data/lib/rails/graphql/field.rb +89 -74
- data/lib/rails/graphql/global_id.rb +89 -0
- data/lib/rails/graphql/helpers/attribute_delegator.rb +5 -5
- data/lib/rails/graphql/helpers/inherited_collection/array.rb +51 -0
- data/lib/rails/graphql/helpers/inherited_collection/base.rb +45 -0
- data/lib/rails/graphql/helpers/inherited_collection/hash.rb +88 -0
- data/lib/rails/graphql/helpers/inherited_collection.rb +25 -76
- data/lib/rails/graphql/helpers/instantiable.rb +15 -0
- data/lib/rails/graphql/helpers/leaf_from_ar.rb +7 -7
- data/lib/rails/graphql/helpers/registerable.rb +44 -62
- data/lib/rails/graphql/helpers/unregisterable.rb +16 -0
- data/lib/rails/graphql/helpers/with_arguments.rb +33 -28
- data/lib/rails/graphql/helpers/with_assignment.rb +6 -6
- data/lib/rails/graphql/helpers/with_callbacks.rb +28 -11
- data/lib/rails/graphql/helpers/with_description.rb +73 -0
- data/lib/rails/graphql/helpers/with_directives.rb +58 -30
- data/lib/rails/graphql/helpers/with_events.rb +22 -23
- data/lib/rails/graphql/helpers/with_fields.rb +86 -26
- data/lib/rails/graphql/helpers/with_global_id.rb +22 -0
- data/lib/rails/graphql/helpers/with_name.rb +44 -0
- data/lib/rails/graphql/helpers/with_namespace.rb +7 -4
- data/lib/rails/graphql/helpers/with_owner.rb +8 -7
- data/lib/rails/graphql/helpers/with_schema_fields.rb +162 -56
- data/lib/rails/graphql/helpers/with_validator.rb +9 -9
- data/lib/rails/graphql/helpers.rb +10 -3
- data/lib/rails/graphql/introspection.rb +43 -36
- data/lib/rails/graphql/railtie.rb +89 -33
- data/lib/rails/graphql/railties/app/base_channel.rb +10 -0
- data/lib/rails/graphql/railties/app/base_controller.rb +12 -0
- data/lib/rails/graphql/railties/app/views/_cable.js.erb +56 -0
- data/lib/rails/graphql/railties/app/views/_fetch.js.erb +20 -0
- data/lib/rails/graphql/railties/app/views/graphiql.html.erb +101 -0
- data/lib/rails/graphql/railties/base_generator.rb +5 -17
- data/lib/rails/graphql/railties/channel.rb +157 -0
- data/lib/rails/graphql/railties/controller.rb +91 -25
- data/lib/rails/graphql/railties/controller_runtime.rb +5 -5
- data/lib/rails/graphql/railties/log_subscriber.rb +81 -14
- data/lib/rails/graphql/request/arguments.rb +26 -50
- data/lib/rails/graphql/request/backtrace.rb +212 -0
- data/lib/rails/graphql/request/component/field.rb +98 -70
- data/lib/rails/graphql/request/component/fragment.rb +80 -26
- data/lib/rails/graphql/request/component/operation/subscription.rb +162 -4
- data/lib/rails/graphql/request/component/operation.rb +73 -34
- data/lib/rails/graphql/request/component/spread.rb +79 -27
- data/lib/rails/graphql/request/component/typename.rb +28 -13
- data/lib/rails/graphql/request/component.rb +77 -36
- data/lib/rails/graphql/request/context.rb +19 -9
- data/lib/rails/graphql/request/errors.rb +16 -6
- data/lib/rails/graphql/request/event.rb +23 -8
- data/lib/rails/graphql/request/helpers/directives.rb +69 -27
- data/lib/rails/graphql/request/helpers/selection_set.rb +57 -25
- data/lib/rails/graphql/request/helpers/value_writers.rb +24 -19
- data/lib/rails/graphql/request/prepared_data.rb +100 -0
- data/lib/rails/graphql/request/steps/authorizable.rb +24 -14
- data/lib/rails/graphql/request/steps/organizable.rb +111 -49
- data/lib/rails/graphql/request/steps/{prepareable.rb → preparable.rb} +21 -8
- data/lib/rails/graphql/request/steps/{resolveable.rb → resolvable.rb} +16 -7
- data/lib/rails/graphql/request/strategy/cached_strategy.rb +64 -0
- data/lib/rails/graphql/request/strategy/dynamic_instance.rb +6 -6
- data/lib/rails/graphql/request/strategy/multi_query_strategy.rb +6 -13
- data/lib/rails/graphql/request/strategy/sequenced_strategy.rb +9 -9
- data/lib/rails/graphql/request/strategy.rb +147 -77
- data/lib/rails/graphql/request/subscription.rb +82 -0
- data/lib/rails/graphql/request.rb +353 -104
- data/lib/rails/graphql/schema.rb +251 -106
- data/lib/rails/graphql/shortcuts.rb +33 -8
- data/lib/rails/graphql/source/active_record/builders.rb +64 -51
- data/lib/rails/graphql/source/active_record_source.rb +158 -82
- data/lib/rails/graphql/source/base.rb +83 -0
- data/lib/rails/graphql/source/builder.rb +115 -0
- data/lib/rails/graphql/source/scoped_arguments.rb +39 -21
- data/lib/rails/graphql/source.rb +90 -228
- data/lib/rails/graphql/subscription/provider/action_cable.rb +113 -0
- data/lib/rails/graphql/subscription/provider/base.rb +192 -0
- data/lib/rails/graphql/subscription/provider.rb +18 -0
- data/lib/rails/graphql/subscription/store/base.rb +141 -0
- data/lib/rails/graphql/subscription/store/memory.rb +136 -0
- data/lib/rails/graphql/subscription/store.rb +19 -0
- data/lib/rails/graphql/subscription.rb +17 -0
- data/lib/rails/graphql/to_gql.rb +29 -32
- data/lib/rails/graphql/type/creator.rb +196 -0
- data/lib/rails/graphql/type/enum/directive_location_enum.rb +11 -11
- data/lib/rails/graphql/type/enum/type_kind_enum.rb +3 -3
- data/lib/rails/graphql/type/enum.rb +44 -50
- data/lib/rails/graphql/type/input.rb +92 -25
- data/lib/rails/graphql/type/interface.rb +29 -28
- data/lib/rails/graphql/type/object/directive_object.rb +10 -9
- data/lib/rails/graphql/type/object/enum_value_object.rb +3 -3
- data/lib/rails/graphql/type/object/field_object.rb +24 -6
- data/lib/rails/graphql/type/object/input_value_object.rb +6 -7
- data/lib/rails/graphql/type/object/schema_object.rb +5 -8
- data/lib/rails/graphql/type/object/type_object.rb +62 -25
- data/lib/rails/graphql/type/object.rb +34 -26
- data/lib/rails/graphql/type/scalar/any_scalar.rb +30 -0
- data/lib/rails/graphql/type/scalar/bigint_scalar.rb +5 -5
- data/lib/rails/graphql/type/scalar/binary_scalar.rb +5 -3
- data/lib/rails/graphql/type/scalar/boolean_scalar.rb +8 -8
- data/lib/rails/graphql/type/scalar/date_scalar.rb +5 -3
- data/lib/rails/graphql/type/scalar/date_time_scalar.rb +5 -3
- data/lib/rails/graphql/type/scalar/decimal_scalar.rb +5 -3
- data/lib/rails/graphql/type/scalar/float_scalar.rb +5 -5
- data/lib/rails/graphql/type/scalar/id_scalar.rb +6 -5
- data/lib/rails/graphql/type/scalar/int_scalar.rb +6 -5
- data/lib/rails/graphql/type/scalar/json_scalar.rb +41 -0
- data/lib/rails/graphql/type/scalar/string_scalar.rb +18 -4
- data/lib/rails/graphql/type/scalar/time_scalar.rb +8 -6
- data/lib/rails/graphql/type/scalar.rb +26 -23
- data/lib/rails/graphql/type/union.rb +21 -18
- data/lib/rails/graphql/type.rb +43 -26
- data/lib/rails/graphql/type_map.rb +268 -165
- data/lib/rails/graphql/uri.rb +167 -0
- data/lib/rails/graphql/version.rb +19 -3
- data/lib/rails/graphql.rake +3 -0
- data/lib/rails/graphql.rb +91 -56
- data/lib/rails-graphql.rb +1 -1
- data/test/assets/en.yml +29 -0
- data/test/assets/introspection-mem.txt +1 -1
- data/test/assets/introspection.gql +2 -0
- data/test/assets/mem.gql +86 -99
- data/test/assets/mysql.gql +406 -0
- data/test/assets/sqlite.gql +96 -73
- data/test/assets/translate.gql +346 -0
- data/test/config.rb +19 -8
- data/test/graphql/schema_test.rb +14 -50
- data/test/graphql/source_test.rb +8 -85
- data/test/graphql/type/enum_test.rb +207 -203
- data/test/graphql/type/input_test.rb +14 -9
- data/test/graphql/type/interface_test.rb +12 -9
- data/test/graphql/type/object_test.rb +8 -2
- data/test/graphql/type/scalar/any_scalar_test.rb +38 -0
- data/test/graphql/type/scalar/boolean_scalar_test.rb +6 -3
- data/test/graphql/type/scalar/json_scalar_test.rb +23 -0
- data/test/graphql/type_map_test.rb +63 -81
- data/test/graphql/type_test.rb +0 -19
- data/test/graphql_test.rb +1 -1
- data/test/integration/{authorization/authorization_test.rb → authorization_test.rb} +40 -14
- data/test/integration/config.rb +36 -3
- data/test/integration/customization_test.rb +39 -0
- data/test/integration/global_id_test.rb +99 -0
- data/test/integration/memory/star_wars_introspection_test.rb +24 -16
- data/test/integration/memory/star_wars_query_test.rb +54 -3
- data/test/integration/memory/star_wars_validation_test.rb +3 -3
- data/test/integration/mysql/star_wars_introspection_test.rb +25 -0
- data/test/integration/persisted_query_test.rb +87 -0
- data/test/integration/resolver_precedence_test.rb +154 -0
- data/test/integration/schemas/memory.rb +24 -10
- data/test/integration/schemas/mysql.rb +62 -0
- data/test/integration/schemas/sqlite.rb +21 -12
- data/test/integration/sqlite/star_wars_global_id_test.rb +89 -0
- data/test/integration/sqlite/star_wars_introspection_test.rb +10 -0
- data/test/integration/sqlite/star_wars_query_test.rb +14 -1
- data/test/integration/translate_test.rb +73 -0
- data/test/test_ext.rb +16 -13
- metadata +125 -161
- data/ext/depend +0 -3
- data/ext/graphqlparser/Ast.cpp +0 -346
- data/ext/graphqlparser/Ast.h +0 -1214
- data/ext/graphqlparser/AstNode.h +0 -36
- data/ext/graphqlparser/AstVisitor.h +0 -137
- data/ext/graphqlparser/GraphQLParser.cpp +0 -76
- data/ext/graphqlparser/GraphQLParser.h +0 -55
- data/ext/graphqlparser/JsonVisitor.cpp +0 -161
- data/ext/graphqlparser/JsonVisitor.cpp.inc +0 -456
- data/ext/graphqlparser/JsonVisitor.h +0 -121
- data/ext/graphqlparser/JsonVisitor.h.inc +0 -110
- data/ext/graphqlparser/VERSION +0 -1
- data/ext/graphqlparser/c/GraphQLAst.cpp +0 -324
- data/ext/graphqlparser/c/GraphQLAst.h +0 -180
- data/ext/graphqlparser/c/GraphQLAstForEachConcreteType.h +0 -44
- data/ext/graphqlparser/c/GraphQLAstNode.cpp +0 -25
- data/ext/graphqlparser/c/GraphQLAstNode.h +0 -33
- data/ext/graphqlparser/c/GraphQLAstToJSON.cpp +0 -21
- data/ext/graphqlparser/c/GraphQLAstToJSON.h +0 -24
- data/ext/graphqlparser/c/GraphQLAstVisitor.cpp +0 -55
- data/ext/graphqlparser/c/GraphQLAstVisitor.h +0 -53
- data/ext/graphqlparser/c/GraphQLParser.cpp +0 -35
- data/ext/graphqlparser/c/GraphQLParser.h +0 -54
- data/ext/graphqlparser/dump_json_ast.cpp +0 -48
- data/ext/graphqlparser/lexer.lpp +0 -324
- data/ext/graphqlparser/parser.ypp +0 -693
- data/ext/graphqlparser/parsergen/lexer.cpp +0 -2633
- data/ext/graphqlparser/parsergen/lexer.h +0 -528
- data/ext/graphqlparser/parsergen/location.hh +0 -189
- data/ext/graphqlparser/parsergen/parser.tab.cpp +0 -3300
- data/ext/graphqlparser/parsergen/parser.tab.hpp +0 -646
- data/ext/graphqlparser/parsergen/position.hh +0 -179
- data/ext/graphqlparser/parsergen/stack.hh +0 -156
- data/ext/graphqlparser/syntaxdefs.h +0 -19
- data/ext/libgraphqlparser/AstNode.h +0 -36
- data/ext/libgraphqlparser/CMakeLists.txt +0 -148
- data/ext/libgraphqlparser/CONTRIBUTING.md +0 -23
- data/ext/libgraphqlparser/GraphQLParser.cpp +0 -76
- data/ext/libgraphqlparser/GraphQLParser.h +0 -55
- data/ext/libgraphqlparser/JsonVisitor.cpp +0 -161
- data/ext/libgraphqlparser/JsonVisitor.h +0 -121
- data/ext/libgraphqlparser/LICENSE +0 -22
- data/ext/libgraphqlparser/README.clang-tidy +0 -7
- data/ext/libgraphqlparser/README.md +0 -84
- data/ext/libgraphqlparser/ast/ast.ast +0 -203
- data/ext/libgraphqlparser/ast/ast.py +0 -61
- data/ext/libgraphqlparser/ast/c.py +0 -100
- data/ext/libgraphqlparser/ast/c.pyc +0 -0
- data/ext/libgraphqlparser/ast/c_impl.py +0 -61
- data/ext/libgraphqlparser/ast/c_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/c_visitor_impl.py +0 -39
- data/ext/libgraphqlparser/ast/c_visitor_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/casing.py +0 -26
- data/ext/libgraphqlparser/ast/casing.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx.py +0 -197
- data/ext/libgraphqlparser/ast/cxx.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_impl.py +0 -61
- data/ext/libgraphqlparser/ast/cxx_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_header.py +0 -42
- data/ext/libgraphqlparser/ast/cxx_json_visitor_header.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.py +0 -80
- data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_visitor.py +0 -64
- data/ext/libgraphqlparser/ast/cxx_visitor.pyc +0 -0
- data/ext/libgraphqlparser/ast/js.py +0 -65
- data/ext/libgraphqlparser/ast/license.py +0 -10
- data/ext/libgraphqlparser/ast/license.pyc +0 -0
- data/ext/libgraphqlparser/c/GraphQLAstNode.cpp +0 -25
- data/ext/libgraphqlparser/c/GraphQLAstNode.h +0 -33
- data/ext/libgraphqlparser/c/GraphQLAstToJSON.cpp +0 -21
- data/ext/libgraphqlparser/c/GraphQLAstToJSON.h +0 -24
- data/ext/libgraphqlparser/c/GraphQLAstVisitor.cpp +0 -55
- data/ext/libgraphqlparser/c/GraphQLAstVisitor.h +0 -53
- data/ext/libgraphqlparser/c/GraphQLParser.cpp +0 -35
- data/ext/libgraphqlparser/c/GraphQLParser.h +0 -54
- data/ext/libgraphqlparser/clang-tidy-all.sh +0 -3
- data/ext/libgraphqlparser/cmake/version.cmake +0 -16
- data/ext/libgraphqlparser/dump_json_ast.cpp +0 -48
- data/ext/libgraphqlparser/go/README.md +0 -20
- data/ext/libgraphqlparser/go/callbacks.go +0 -18
- data/ext/libgraphqlparser/go/gotest.go +0 -64
- data/ext/libgraphqlparser/lexer.lpp +0 -324
- data/ext/libgraphqlparser/libgraphqlparser.pc.in +0 -11
- data/ext/libgraphqlparser/parser.ypp +0 -693
- data/ext/libgraphqlparser/parsergen/lexer.cpp +0 -2633
- data/ext/libgraphqlparser/parsergen/lexer.h +0 -528
- data/ext/libgraphqlparser/parsergen/location.hh +0 -189
- data/ext/libgraphqlparser/parsergen/parser.tab.cpp +0 -3300
- data/ext/libgraphqlparser/parsergen/parser.tab.hpp +0 -646
- data/ext/libgraphqlparser/parsergen/position.hh +0 -179
- data/ext/libgraphqlparser/parsergen/stack.hh +0 -156
- data/ext/libgraphqlparser/python/CMakeLists.txt +0 -14
- data/ext/libgraphqlparser/python/README.md +0 -5
- data/ext/libgraphqlparser/python/example.py +0 -31
- data/ext/libgraphqlparser/syntaxdefs.h +0 -19
- data/ext/libgraphqlparser/test/BuildCAPI.c +0 -5
- data/ext/libgraphqlparser/test/CMakeLists.txt +0 -25
- data/ext/libgraphqlparser/test/JsonVisitorTests.cpp +0 -28
- data/ext/libgraphqlparser/test/ParserTests.cpp +0 -352
- data/ext/libgraphqlparser/test/kitchen-sink.graphql +0 -59
- data/ext/libgraphqlparser/test/kitchen-sink.json +0 -1
- data/ext/libgraphqlparser/test/schema-kitchen-sink.graphql +0 -78
- data/ext/libgraphqlparser/test/schema-kitchen-sink.json +0 -1
- data/ext/libgraphqlparser/test/valgrind.supp +0 -33
- data/ext/version.cpp +0 -21
- data/lib/graphqlparser.so +0 -0
- data/lib/rails/graphql/native/functions.rb +0 -38
- data/lib/rails/graphql/native/location.rb +0 -41
- data/lib/rails/graphql/native/pointers.rb +0 -23
- data/lib/rails/graphql/native/visitor.rb +0 -349
- data/lib/rails/graphql/native.rb +0 -56
- data/test/integration/schemas/authorization.rb +0 -12
@@ -1,528 +0,0 @@
|
|
1
|
-
#ifndef yyHEADER_H
|
2
|
-
#define yyHEADER_H 1
|
3
|
-
#define yyIN_HEADER 1
|
4
|
-
|
5
|
-
#line 5 "lexer.h"
|
6
|
-
|
7
|
-
#line 7 "lexer.h"
|
8
|
-
|
9
|
-
#define YY_INT_ALIGNED short int
|
10
|
-
|
11
|
-
/* A lexical scanner generated by flex */
|
12
|
-
|
13
|
-
#define FLEX_SCANNER
|
14
|
-
#define YY_FLEX_MAJOR_VERSION 2
|
15
|
-
#define YY_FLEX_MINOR_VERSION 6
|
16
|
-
#define YY_FLEX_SUBMINOR_VERSION 4
|
17
|
-
#if YY_FLEX_SUBMINOR_VERSION > 0
|
18
|
-
#define FLEX_BETA
|
19
|
-
#endif
|
20
|
-
|
21
|
-
#ifdef yyget_lval
|
22
|
-
#define yyget_lval_ALREADY_DEFINED
|
23
|
-
#else
|
24
|
-
#define yyget_lval yyget_lval
|
25
|
-
#endif
|
26
|
-
|
27
|
-
#ifdef yyset_lval
|
28
|
-
#define yyset_lval_ALREADY_DEFINED
|
29
|
-
#else
|
30
|
-
#define yyset_lval yyset_lval
|
31
|
-
#endif
|
32
|
-
|
33
|
-
#ifdef yyget_lloc
|
34
|
-
#define yyget_lloc_ALREADY_DEFINED
|
35
|
-
#else
|
36
|
-
#define yyget_lloc yyget_lloc
|
37
|
-
#endif
|
38
|
-
|
39
|
-
#ifdef yyset_lloc
|
40
|
-
#define yyset_lloc_ALREADY_DEFINED
|
41
|
-
#else
|
42
|
-
#define yyset_lloc yyset_lloc
|
43
|
-
#endif
|
44
|
-
|
45
|
-
/* First, we deal with platform-specific or compiler-specific issues. */
|
46
|
-
|
47
|
-
/* begin standard C headers. */
|
48
|
-
#include <stdio.h>
|
49
|
-
#include <string.h>
|
50
|
-
#include <errno.h>
|
51
|
-
#include <stdlib.h>
|
52
|
-
|
53
|
-
/* end standard C headers. */
|
54
|
-
|
55
|
-
/* flex integer type definitions */
|
56
|
-
|
57
|
-
#ifndef FLEXINT_H
|
58
|
-
#define FLEXINT_H
|
59
|
-
|
60
|
-
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
61
|
-
|
62
|
-
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
63
|
-
|
64
|
-
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
65
|
-
* if you want the limit (max/min) macros for int types.
|
66
|
-
*/
|
67
|
-
#ifndef __STDC_LIMIT_MACROS
|
68
|
-
#define __STDC_LIMIT_MACROS 1
|
69
|
-
#endif
|
70
|
-
|
71
|
-
#include <inttypes.h>
|
72
|
-
typedef int8_t flex_int8_t;
|
73
|
-
typedef uint8_t flex_uint8_t;
|
74
|
-
typedef int16_t flex_int16_t;
|
75
|
-
typedef uint16_t flex_uint16_t;
|
76
|
-
typedef int32_t flex_int32_t;
|
77
|
-
typedef uint32_t flex_uint32_t;
|
78
|
-
#else
|
79
|
-
typedef signed char flex_int8_t;
|
80
|
-
typedef short int flex_int16_t;
|
81
|
-
typedef int flex_int32_t;
|
82
|
-
typedef unsigned char flex_uint8_t;
|
83
|
-
typedef unsigned short int flex_uint16_t;
|
84
|
-
typedef unsigned int flex_uint32_t;
|
85
|
-
|
86
|
-
/* Limits of integral types. */
|
87
|
-
#ifndef INT8_MIN
|
88
|
-
#define INT8_MIN (-128)
|
89
|
-
#endif
|
90
|
-
#ifndef INT16_MIN
|
91
|
-
#define INT16_MIN (-32767-1)
|
92
|
-
#endif
|
93
|
-
#ifndef INT32_MIN
|
94
|
-
#define INT32_MIN (-2147483647-1)
|
95
|
-
#endif
|
96
|
-
#ifndef INT8_MAX
|
97
|
-
#define INT8_MAX (127)
|
98
|
-
#endif
|
99
|
-
#ifndef INT16_MAX
|
100
|
-
#define INT16_MAX (32767)
|
101
|
-
#endif
|
102
|
-
#ifndef INT32_MAX
|
103
|
-
#define INT32_MAX (2147483647)
|
104
|
-
#endif
|
105
|
-
#ifndef UINT8_MAX
|
106
|
-
#define UINT8_MAX (255U)
|
107
|
-
#endif
|
108
|
-
#ifndef UINT16_MAX
|
109
|
-
#define UINT16_MAX (65535U)
|
110
|
-
#endif
|
111
|
-
#ifndef UINT32_MAX
|
112
|
-
#define UINT32_MAX (4294967295U)
|
113
|
-
#endif
|
114
|
-
|
115
|
-
#ifndef SIZE_MAX
|
116
|
-
#define SIZE_MAX (~(size_t)0)
|
117
|
-
#endif
|
118
|
-
|
119
|
-
#endif /* ! C99 */
|
120
|
-
|
121
|
-
#endif /* ! FLEXINT_H */
|
122
|
-
|
123
|
-
/* begin standard C++ headers. */
|
124
|
-
|
125
|
-
/* TODO: this is always defined, so inline it */
|
126
|
-
#define yyconst const
|
127
|
-
|
128
|
-
#if defined(__GNUC__) && __GNUC__ >= 3
|
129
|
-
#define yynoreturn __attribute__((__noreturn__))
|
130
|
-
#else
|
131
|
-
#define yynoreturn
|
132
|
-
#endif
|
133
|
-
|
134
|
-
/* An opaque pointer. */
|
135
|
-
#ifndef YY_TYPEDEF_YY_SCANNER_T
|
136
|
-
#define YY_TYPEDEF_YY_SCANNER_T
|
137
|
-
typedef void* yyscan_t;
|
138
|
-
#endif
|
139
|
-
|
140
|
-
/* For convenience, these vars (plus the bison vars far below)
|
141
|
-
are macros in the reentrant scanner. */
|
142
|
-
#define yyin yyg->yyin_r
|
143
|
-
#define yyout yyg->yyout_r
|
144
|
-
#define yyextra yyg->yyextra_r
|
145
|
-
#define yyleng yyg->yyleng_r
|
146
|
-
#define yytext yyg->yytext_r
|
147
|
-
#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
|
148
|
-
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
|
149
|
-
#define yy_flex_debug yyg->yy_flex_debug_r
|
150
|
-
|
151
|
-
/* Size of default input buffer. */
|
152
|
-
#ifndef YY_BUF_SIZE
|
153
|
-
#ifdef __ia64__
|
154
|
-
/* On IA-64, the buffer size is 16k, not 8k.
|
155
|
-
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
156
|
-
* Ditto for the __ia64__ case accordingly.
|
157
|
-
*/
|
158
|
-
#define YY_BUF_SIZE 32768
|
159
|
-
#else
|
160
|
-
#define YY_BUF_SIZE 16384
|
161
|
-
#endif /* __ia64__ */
|
162
|
-
#endif
|
163
|
-
|
164
|
-
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
165
|
-
#define YY_TYPEDEF_YY_BUFFER_STATE
|
166
|
-
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
167
|
-
#endif
|
168
|
-
|
169
|
-
#ifndef YY_TYPEDEF_YY_SIZE_T
|
170
|
-
#define YY_TYPEDEF_YY_SIZE_T
|
171
|
-
typedef size_t yy_size_t;
|
172
|
-
#endif
|
173
|
-
|
174
|
-
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
175
|
-
#define YY_STRUCT_YY_BUFFER_STATE
|
176
|
-
struct yy_buffer_state
|
177
|
-
{
|
178
|
-
FILE *yy_input_file;
|
179
|
-
|
180
|
-
char *yy_ch_buf; /* input buffer */
|
181
|
-
char *yy_buf_pos; /* current position in input buffer */
|
182
|
-
|
183
|
-
/* Size of input buffer in bytes, not including room for EOB
|
184
|
-
* characters.
|
185
|
-
*/
|
186
|
-
int yy_buf_size;
|
187
|
-
|
188
|
-
/* Number of characters read into yy_ch_buf, not including EOB
|
189
|
-
* characters.
|
190
|
-
*/
|
191
|
-
int yy_n_chars;
|
192
|
-
|
193
|
-
/* Whether we "own" the buffer - i.e., we know we created it,
|
194
|
-
* and can realloc() it to grow it, and should free() it to
|
195
|
-
* delete it.
|
196
|
-
*/
|
197
|
-
int yy_is_our_buffer;
|
198
|
-
|
199
|
-
/* Whether this is an "interactive" input source; if so, and
|
200
|
-
* if we're using stdio for input, then we want to use getc()
|
201
|
-
* instead of fread(), to make sure we stop fetching input after
|
202
|
-
* each newline.
|
203
|
-
*/
|
204
|
-
int yy_is_interactive;
|
205
|
-
|
206
|
-
/* Whether we're considered to be at the beginning of a line.
|
207
|
-
* If so, '^' rules will be active on the next match, otherwise
|
208
|
-
* not.
|
209
|
-
*/
|
210
|
-
int yy_at_bol;
|
211
|
-
|
212
|
-
int yy_bs_lineno; /**< The line count. */
|
213
|
-
int yy_bs_column; /**< The column count. */
|
214
|
-
|
215
|
-
/* Whether to try to fill the input buffer when we reach the
|
216
|
-
* end of it.
|
217
|
-
*/
|
218
|
-
int yy_fill_buffer;
|
219
|
-
|
220
|
-
int yy_buffer_status;
|
221
|
-
|
222
|
-
};
|
223
|
-
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
224
|
-
|
225
|
-
void yyrestart ( FILE *input_file , yyscan_t yyscanner );
|
226
|
-
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
|
227
|
-
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
|
228
|
-
void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
|
229
|
-
void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
|
230
|
-
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
|
231
|
-
void yypop_buffer_state ( yyscan_t yyscanner );
|
232
|
-
|
233
|
-
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
|
234
|
-
YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
|
235
|
-
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
|
236
|
-
|
237
|
-
void *yyalloc ( yy_size_t , yyscan_t yyscanner );
|
238
|
-
void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
|
239
|
-
void yyfree ( void * , yyscan_t yyscanner );
|
240
|
-
|
241
|
-
/* Begin user sect3 */
|
242
|
-
|
243
|
-
#define yywrap(yyscanner) (/*CONSTCOND*/1)
|
244
|
-
#define YY_SKIP_YYWRAP
|
245
|
-
|
246
|
-
#define yytext_ptr yytext_r
|
247
|
-
|
248
|
-
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
249
|
-
#define INITIAL 0
|
250
|
-
#define STRING_STATE 1
|
251
|
-
#define BLOCK_STRING_STATE 2
|
252
|
-
#define C_COMMENT_STATE 3
|
253
|
-
#define LINE_COMMENT_STATE 4
|
254
|
-
|
255
|
-
#endif
|
256
|
-
|
257
|
-
#ifndef YY_NO_UNISTD_H
|
258
|
-
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
259
|
-
* down here because we want the user's section 1 to have been scanned first.
|
260
|
-
* The user has a chance to override it with an option.
|
261
|
-
*/
|
262
|
-
#include <unistd.h>
|
263
|
-
#endif
|
264
|
-
|
265
|
-
#define YY_EXTRA_TYPE struct LexerExtra *
|
266
|
-
|
267
|
-
int yylex_init (yyscan_t* scanner);
|
268
|
-
|
269
|
-
int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
|
270
|
-
|
271
|
-
/* Accessor methods to globals.
|
272
|
-
These are made visible to non-reentrant scanners for convenience. */
|
273
|
-
|
274
|
-
int yylex_destroy ( yyscan_t yyscanner );
|
275
|
-
|
276
|
-
int yyget_debug ( yyscan_t yyscanner );
|
277
|
-
|
278
|
-
void yyset_debug ( int debug_flag , yyscan_t yyscanner );
|
279
|
-
|
280
|
-
YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
|
281
|
-
|
282
|
-
void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
|
283
|
-
|
284
|
-
FILE *yyget_in ( yyscan_t yyscanner );
|
285
|
-
|
286
|
-
void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
|
287
|
-
|
288
|
-
FILE *yyget_out ( yyscan_t yyscanner );
|
289
|
-
|
290
|
-
void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
|
291
|
-
|
292
|
-
int yyget_leng ( yyscan_t yyscanner );
|
293
|
-
|
294
|
-
char *yyget_text ( yyscan_t yyscanner );
|
295
|
-
|
296
|
-
int yyget_lineno ( yyscan_t yyscanner );
|
297
|
-
|
298
|
-
void yyset_lineno ( int _line_number , yyscan_t yyscanner );
|
299
|
-
|
300
|
-
int yyget_column ( yyscan_t yyscanner );
|
301
|
-
|
302
|
-
void yyset_column ( int _column_no , yyscan_t yyscanner );
|
303
|
-
|
304
|
-
YYSTYPE * yyget_lval ( yyscan_t yyscanner );
|
305
|
-
|
306
|
-
void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
|
307
|
-
|
308
|
-
YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
|
309
|
-
|
310
|
-
void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
|
311
|
-
|
312
|
-
/* Macros after this point can all be overridden by user definitions in
|
313
|
-
* section 1.
|
314
|
-
*/
|
315
|
-
|
316
|
-
#ifndef YY_SKIP_YYWRAP
|
317
|
-
#ifdef __cplusplus
|
318
|
-
extern "C" int yywrap ( yyscan_t yyscanner );
|
319
|
-
#else
|
320
|
-
extern int yywrap ( yyscan_t yyscanner );
|
321
|
-
#endif
|
322
|
-
#endif
|
323
|
-
|
324
|
-
#ifndef yytext_ptr
|
325
|
-
static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
|
326
|
-
#endif
|
327
|
-
|
328
|
-
#ifdef YY_NEED_STRLEN
|
329
|
-
static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
|
330
|
-
#endif
|
331
|
-
|
332
|
-
#ifndef YY_NO_INPUT
|
333
|
-
|
334
|
-
#endif
|
335
|
-
|
336
|
-
/* Amount of stuff to slurp up with each read. */
|
337
|
-
#ifndef YY_READ_BUF_SIZE
|
338
|
-
#ifdef __ia64__
|
339
|
-
/* On IA-64, the buffer size is 16k, not 8k */
|
340
|
-
#define YY_READ_BUF_SIZE 16384
|
341
|
-
#else
|
342
|
-
#define YY_READ_BUF_SIZE 8192
|
343
|
-
#endif /* __ia64__ */
|
344
|
-
#endif
|
345
|
-
|
346
|
-
/* Number of entries by which start-condition stack grows. */
|
347
|
-
#ifndef YY_START_STACK_INCR
|
348
|
-
#define YY_START_STACK_INCR 25
|
349
|
-
#endif
|
350
|
-
|
351
|
-
/* Default declaration of generated scanner - a define so the user can
|
352
|
-
* easily add parameters.
|
353
|
-
*/
|
354
|
-
#ifndef YY_DECL
|
355
|
-
#define YY_DECL_IS_OURS 1
|
356
|
-
|
357
|
-
extern int yylex \
|
358
|
-
(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
|
359
|
-
|
360
|
-
#define YY_DECL int yylex \
|
361
|
-
(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
|
362
|
-
#endif /* !YY_DECL */
|
363
|
-
|
364
|
-
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
365
|
-
|
366
|
-
#undef YY_NEW_FILE
|
367
|
-
#undef YY_FLUSH_BUFFER
|
368
|
-
#undef yy_set_bol
|
369
|
-
#undef yy_new_buffer
|
370
|
-
#undef yy_set_interactive
|
371
|
-
#undef YY_DO_BEFORE_ACTION
|
372
|
-
|
373
|
-
#ifdef YY_DECL_IS_OURS
|
374
|
-
#undef YY_DECL_IS_OURS
|
375
|
-
#undef YY_DECL
|
376
|
-
#endif
|
377
|
-
|
378
|
-
#ifndef yy_create_buffer_ALREADY_DEFINED
|
379
|
-
#undef yy_create_buffer
|
380
|
-
#endif
|
381
|
-
#ifndef yy_delete_buffer_ALREADY_DEFINED
|
382
|
-
#undef yy_delete_buffer
|
383
|
-
#endif
|
384
|
-
#ifndef yy_scan_buffer_ALREADY_DEFINED
|
385
|
-
#undef yy_scan_buffer
|
386
|
-
#endif
|
387
|
-
#ifndef yy_scan_string_ALREADY_DEFINED
|
388
|
-
#undef yy_scan_string
|
389
|
-
#endif
|
390
|
-
#ifndef yy_scan_bytes_ALREADY_DEFINED
|
391
|
-
#undef yy_scan_bytes
|
392
|
-
#endif
|
393
|
-
#ifndef yy_init_buffer_ALREADY_DEFINED
|
394
|
-
#undef yy_init_buffer
|
395
|
-
#endif
|
396
|
-
#ifndef yy_flush_buffer_ALREADY_DEFINED
|
397
|
-
#undef yy_flush_buffer
|
398
|
-
#endif
|
399
|
-
#ifndef yy_load_buffer_state_ALREADY_DEFINED
|
400
|
-
#undef yy_load_buffer_state
|
401
|
-
#endif
|
402
|
-
#ifndef yy_switch_to_buffer_ALREADY_DEFINED
|
403
|
-
#undef yy_switch_to_buffer
|
404
|
-
#endif
|
405
|
-
#ifndef yypush_buffer_state_ALREADY_DEFINED
|
406
|
-
#undef yypush_buffer_state
|
407
|
-
#endif
|
408
|
-
#ifndef yypop_buffer_state_ALREADY_DEFINED
|
409
|
-
#undef yypop_buffer_state
|
410
|
-
#endif
|
411
|
-
#ifndef yyensure_buffer_stack_ALREADY_DEFINED
|
412
|
-
#undef yyensure_buffer_stack
|
413
|
-
#endif
|
414
|
-
#ifndef yylex_ALREADY_DEFINED
|
415
|
-
#undef yylex
|
416
|
-
#endif
|
417
|
-
#ifndef yyrestart_ALREADY_DEFINED
|
418
|
-
#undef yyrestart
|
419
|
-
#endif
|
420
|
-
#ifndef yylex_init_ALREADY_DEFINED
|
421
|
-
#undef yylex_init
|
422
|
-
#endif
|
423
|
-
#ifndef yylex_init_extra_ALREADY_DEFINED
|
424
|
-
#undef yylex_init_extra
|
425
|
-
#endif
|
426
|
-
#ifndef yylex_destroy_ALREADY_DEFINED
|
427
|
-
#undef yylex_destroy
|
428
|
-
#endif
|
429
|
-
#ifndef yyget_debug_ALREADY_DEFINED
|
430
|
-
#undef yyget_debug
|
431
|
-
#endif
|
432
|
-
#ifndef yyset_debug_ALREADY_DEFINED
|
433
|
-
#undef yyset_debug
|
434
|
-
#endif
|
435
|
-
#ifndef yyget_extra_ALREADY_DEFINED
|
436
|
-
#undef yyget_extra
|
437
|
-
#endif
|
438
|
-
#ifndef yyset_extra_ALREADY_DEFINED
|
439
|
-
#undef yyset_extra
|
440
|
-
#endif
|
441
|
-
#ifndef yyget_in_ALREADY_DEFINED
|
442
|
-
#undef yyget_in
|
443
|
-
#endif
|
444
|
-
#ifndef yyset_in_ALREADY_DEFINED
|
445
|
-
#undef yyset_in
|
446
|
-
#endif
|
447
|
-
#ifndef yyget_out_ALREADY_DEFINED
|
448
|
-
#undef yyget_out
|
449
|
-
#endif
|
450
|
-
#ifndef yyset_out_ALREADY_DEFINED
|
451
|
-
#undef yyset_out
|
452
|
-
#endif
|
453
|
-
#ifndef yyget_leng_ALREADY_DEFINED
|
454
|
-
#undef yyget_leng
|
455
|
-
#endif
|
456
|
-
#ifndef yyget_text_ALREADY_DEFINED
|
457
|
-
#undef yyget_text
|
458
|
-
#endif
|
459
|
-
#ifndef yyget_lineno_ALREADY_DEFINED
|
460
|
-
#undef yyget_lineno
|
461
|
-
#endif
|
462
|
-
#ifndef yyset_lineno_ALREADY_DEFINED
|
463
|
-
#undef yyset_lineno
|
464
|
-
#endif
|
465
|
-
#ifndef yyget_column_ALREADY_DEFINED
|
466
|
-
#undef yyget_column
|
467
|
-
#endif
|
468
|
-
#ifndef yyset_column_ALREADY_DEFINED
|
469
|
-
#undef yyset_column
|
470
|
-
#endif
|
471
|
-
#ifndef yywrap_ALREADY_DEFINED
|
472
|
-
#undef yywrap
|
473
|
-
#endif
|
474
|
-
#ifndef yyget_lval_ALREADY_DEFINED
|
475
|
-
#undef yyget_lval
|
476
|
-
#endif
|
477
|
-
#ifndef yyset_lval_ALREADY_DEFINED
|
478
|
-
#undef yyset_lval
|
479
|
-
#endif
|
480
|
-
#ifndef yyget_lloc_ALREADY_DEFINED
|
481
|
-
#undef yyget_lloc
|
482
|
-
#endif
|
483
|
-
#ifndef yyset_lloc_ALREADY_DEFINED
|
484
|
-
#undef yyset_lloc
|
485
|
-
#endif
|
486
|
-
#ifndef yyalloc_ALREADY_DEFINED
|
487
|
-
#undef yyalloc
|
488
|
-
#endif
|
489
|
-
#ifndef yyrealloc_ALREADY_DEFINED
|
490
|
-
#undef yyrealloc
|
491
|
-
#endif
|
492
|
-
#ifndef yyfree_ALREADY_DEFINED
|
493
|
-
#undef yyfree
|
494
|
-
#endif
|
495
|
-
#ifndef yytext_ALREADY_DEFINED
|
496
|
-
#undef yytext
|
497
|
-
#endif
|
498
|
-
#ifndef yyleng_ALREADY_DEFINED
|
499
|
-
#undef yyleng
|
500
|
-
#endif
|
501
|
-
#ifndef yyin_ALREADY_DEFINED
|
502
|
-
#undef yyin
|
503
|
-
#endif
|
504
|
-
#ifndef yyout_ALREADY_DEFINED
|
505
|
-
#undef yyout
|
506
|
-
#endif
|
507
|
-
#ifndef yy_flex_debug_ALREADY_DEFINED
|
508
|
-
#undef yy_flex_debug
|
509
|
-
#endif
|
510
|
-
#ifndef yylineno_ALREADY_DEFINED
|
511
|
-
#undef yylineno
|
512
|
-
#endif
|
513
|
-
#ifndef yytables_fload_ALREADY_DEFINED
|
514
|
-
#undef yytables_fload
|
515
|
-
#endif
|
516
|
-
#ifndef yytables_destroy_ALREADY_DEFINED
|
517
|
-
#undef yytables_destroy
|
518
|
-
#endif
|
519
|
-
#ifndef yyTABLES_NAME_ALREADY_DEFINED
|
520
|
-
#undef yyTABLES_NAME
|
521
|
-
#endif
|
522
|
-
|
523
|
-
#line 205 "lexer.lpp"
|
524
|
-
|
525
|
-
|
526
|
-
#line 526 "lexer.h"
|
527
|
-
#undef yyIN_HEADER
|
528
|
-
#endif /* yyHEADER_H */
|
@@ -1,189 +0,0 @@
|
|
1
|
-
// A Bison parser, made by GNU Bison 3.0.5.
|
2
|
-
|
3
|
-
// Locations for Bison parsers in C++
|
4
|
-
|
5
|
-
// Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
|
6
|
-
|
7
|
-
// This program is free software: you can redistribute it and/or modify
|
8
|
-
// it under the terms of the GNU General Public License as published by
|
9
|
-
// the Free Software Foundation, either version 3 of the License, or
|
10
|
-
// (at your option) any later version.
|
11
|
-
|
12
|
-
// This program is distributed in the hope that it will be useful,
|
13
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
-
// GNU General Public License for more details.
|
16
|
-
|
17
|
-
// You should have received a copy of the GNU General Public License
|
18
|
-
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
|
-
|
20
|
-
// As a special exception, you may create a larger work that contains
|
21
|
-
// part or all of the Bison parser skeleton and distribute that work
|
22
|
-
// under terms of your choice, so long as that work isn't itself a
|
23
|
-
// parser generator using the skeleton or a modified version thereof
|
24
|
-
// as a parser skeleton. Alternatively, if you modify or redistribute
|
25
|
-
// the parser skeleton itself, you may (at your option) remove this
|
26
|
-
// special exception, which will cause the skeleton and the resulting
|
27
|
-
// Bison output files to be licensed under the GNU General Public
|
28
|
-
// License without this special exception.
|
29
|
-
|
30
|
-
// This special exception was added by the Free Software Foundation in
|
31
|
-
// version 2.2 of Bison.
|
32
|
-
|
33
|
-
/**
|
34
|
-
** \file location.hh
|
35
|
-
** Define the yy::location class.
|
36
|
-
*/
|
37
|
-
|
38
|
-
#ifndef YY_YY_LOCATION_HH_INCLUDED
|
39
|
-
# define YY_YY_LOCATION_HH_INCLUDED
|
40
|
-
|
41
|
-
# include "position.hh"
|
42
|
-
|
43
|
-
|
44
|
-
namespace yy {
|
45
|
-
#line 46 "location.hh" // location.cc:333
|
46
|
-
/// Abstract a location.
|
47
|
-
class location
|
48
|
-
{
|
49
|
-
public:
|
50
|
-
|
51
|
-
/// Construct a location from \a b to \a e.
|
52
|
-
location (const position& b, const position& e)
|
53
|
-
: begin (b)
|
54
|
-
, end (e)
|
55
|
-
{}
|
56
|
-
|
57
|
-
/// Construct a 0-width location in \a p.
|
58
|
-
explicit location (const position& p = position ())
|
59
|
-
: begin (p)
|
60
|
-
, end (p)
|
61
|
-
{}
|
62
|
-
|
63
|
-
/// Construct a 0-width location in \a f, \a l, \a c.
|
64
|
-
explicit location (std::string* f,
|
65
|
-
unsigned l = 1u,
|
66
|
-
unsigned c = 1u)
|
67
|
-
: begin (f, l, c)
|
68
|
-
, end (f, l, c)
|
69
|
-
{}
|
70
|
-
|
71
|
-
|
72
|
-
/// Initialization.
|
73
|
-
void initialize (std::string* f = YY_NULLPTR,
|
74
|
-
unsigned l = 1u,
|
75
|
-
unsigned c = 1u)
|
76
|
-
{
|
77
|
-
begin.initialize (f, l, c);
|
78
|
-
end = begin;
|
79
|
-
}
|
80
|
-
|
81
|
-
/** \name Line and Column related manipulators
|
82
|
-
** \{ */
|
83
|
-
public:
|
84
|
-
/// Reset initial location to final location.
|
85
|
-
void step ()
|
86
|
-
{
|
87
|
-
begin = end;
|
88
|
-
}
|
89
|
-
|
90
|
-
/// Extend the current location to the COUNT next columns.
|
91
|
-
void columns (int count = 1)
|
92
|
-
{
|
93
|
-
end += count;
|
94
|
-
}
|
95
|
-
|
96
|
-
/// Extend the current location to the COUNT next lines.
|
97
|
-
void lines (int count = 1)
|
98
|
-
{
|
99
|
-
end.lines (count);
|
100
|
-
}
|
101
|
-
/** \} */
|
102
|
-
|
103
|
-
|
104
|
-
public:
|
105
|
-
/// Beginning of the located region.
|
106
|
-
position begin;
|
107
|
-
/// End of the located region.
|
108
|
-
position end;
|
109
|
-
};
|
110
|
-
|
111
|
-
/// Join two locations, in place.
|
112
|
-
inline location& operator+= (location& res, const location& end)
|
113
|
-
{
|
114
|
-
res.end = end.end;
|
115
|
-
return res;
|
116
|
-
}
|
117
|
-
|
118
|
-
/// Join two locations.
|
119
|
-
inline location operator+ (location res, const location& end)
|
120
|
-
{
|
121
|
-
return res += end;
|
122
|
-
}
|
123
|
-
|
124
|
-
/// Add \a width columns to the end position, in place.
|
125
|
-
inline location& operator+= (location& res, int width)
|
126
|
-
{
|
127
|
-
res.columns (width);
|
128
|
-
return res;
|
129
|
-
}
|
130
|
-
|
131
|
-
/// Add \a width columns to the end position.
|
132
|
-
inline location operator+ (location res, int width)
|
133
|
-
{
|
134
|
-
return res += width;
|
135
|
-
}
|
136
|
-
|
137
|
-
/// Subtract \a width columns to the end position, in place.
|
138
|
-
inline location& operator-= (location& res, int width)
|
139
|
-
{
|
140
|
-
return res += -width;
|
141
|
-
}
|
142
|
-
|
143
|
-
/// Subtract \a width columns to the end position.
|
144
|
-
inline location operator- (location res, int width)
|
145
|
-
{
|
146
|
-
return res -= width;
|
147
|
-
}
|
148
|
-
|
149
|
-
/// Compare two location objects.
|
150
|
-
inline bool
|
151
|
-
operator== (const location& loc1, const location& loc2)
|
152
|
-
{
|
153
|
-
return loc1.begin == loc2.begin && loc1.end == loc2.end;
|
154
|
-
}
|
155
|
-
|
156
|
-
/// Compare two location objects.
|
157
|
-
inline bool
|
158
|
-
operator!= (const location& loc1, const location& loc2)
|
159
|
-
{
|
160
|
-
return !(loc1 == loc2);
|
161
|
-
}
|
162
|
-
|
163
|
-
/** \brief Intercept output stream redirection.
|
164
|
-
** \param ostr the destination output stream
|
165
|
-
** \param loc a reference to the location to redirect
|
166
|
-
**
|
167
|
-
** Avoid duplicate information.
|
168
|
-
*/
|
169
|
-
template <typename YYChar>
|
170
|
-
inline std::basic_ostream<YYChar>&
|
171
|
-
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
172
|
-
{
|
173
|
-
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
|
174
|
-
ostr << loc.begin;
|
175
|
-
if (loc.end.filename
|
176
|
-
&& (!loc.begin.filename
|
177
|
-
|| *loc.begin.filename != *loc.end.filename))
|
178
|
-
ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col;
|
179
|
-
else if (loc.begin.line < loc.end.line)
|
180
|
-
ostr << '-' << loc.end.line << '.' << end_col;
|
181
|
-
else if (loc.begin.column < end_col)
|
182
|
-
ostr << '-' << end_col;
|
183
|
-
return ostr;
|
184
|
-
}
|
185
|
-
|
186
|
-
|
187
|
-
} // yy
|
188
|
-
#line 189 "location.hh" // location.cc:333
|
189
|
-
#endif // !YY_YY_LOCATION_HH_INCLUDED
|