diff --git a/config.yml b/config.yml index 8551779f3f..21fd752118 100644 --- a/config.yml +++ b/config.yml @@ -436,6 +436,8 @@ nodes: - optional: args - name: RBS::AST::Members::Private rust_name: PrivateNode + - name: RBS::AST::Members::Protected + rust_name: ProtectedNode - name: RBS::AST::Members::Public rust_name: PublicNode - name: RBS::AST::TypeParam @@ -887,6 +889,7 @@ enums: - unspecified - public - private + - protected attribute_kind: symbols: - instance @@ -906,6 +909,7 @@ enums: - unspecified - public - private + - protected type_param_variance: symbols: - invariant diff --git a/core/pathname.rbs b/core/pathname.rbs index cdcfc82bab..1a58aa22b5 100644 --- a/core/pathname.rbs +++ b/core/pathname.rbs @@ -1306,6 +1306,15 @@ class Pathname SEPARATOR_PAT: Regexp TO_PATH: Symbol + + # + # The internal string representation of the path. + # + # This is exposed as a protected attribute so that two `Pathname` instances + # can compare and combine their underlying paths without exposing the + # accessor to outside callers. + # + protected attr_reader path: String end %a{annotate:rdoc:skip} diff --git a/docs/config.md b/docs/config.md index 0e7bf384c7..d3082c71ed 100644 --- a/docs/config.md +++ b/docs/config.md @@ -120,10 +120,11 @@ enums: - unspecified - public - private + - protected ``` For example, the `attribute_visibility` enum is a data type for `visibility` attribute of `attr_reader`, `attr_writer`, and `attr_accessor` definitions. -The `visibility` attribute can be one of `unspecified`, `public`, and `private`. +The `visibility` attribute can be one of `unspecified`, `public`, `private`, and `protected`. ### Symbol enums @@ -137,6 +138,7 @@ enums: - unspecified - public - private + - protected ``` It defines an `enum` in C AST definition. @@ -146,6 +148,7 @@ enum RBS_ATTRIBUTE_VISIBILITY_TAG { RBS_ATTRIBUTE_VISIBILITY_TAG_UNSPECIFIED, RBS_ATTRIBUTE_VISIBILITY_TAG_PUBLIC, RBS_ATTRIBUTE_VISIBILITY_TAG_PRIVATE, + RBS_ATTRIBUTE_VISIBILITY_TAG_PROTECTED, }; ``` @@ -160,12 +163,14 @@ VALUE rbs_attribute_visibility_to_ruby(enum rbs_attribute_visibility value) { return rb_id2sym(rb_intern("public")); case RBS_ATTRIBUTE_VISIBILITY_PRIVATE: return rb_id2sym(rb_intern("private")); + case RBS_ATTRIBUTE_VISIBILITY_PROTECTED: + return rb_id2sym(rb_intern("protected")); default: rb_fatal("unknown enum rbs_attribute_visibility value: %d", value); } } ``` -`RBS_ATTRIBUTE_VISIBILITY_PUBLIC` and `RBS_ATTRIBUTE_VISIBILITY_PRIVATE` are translated to Ruby symbols `:public` and `:private` respectively. +`RBS_ATTRIBUTE_VISIBILITY_PUBLIC`, `RBS_ATTRIBUTE_VISIBILITY_PRIVATE`, and `RBS_ATTRIBUTE_VISIBILITY_PROTECTED` are translated to Ruby symbols `:public`, `:private`, and `:protected` respectively. Note that the first `RBS_ATTRIBUTE_VISIBILITY_UNSPECIFIED` is translated to `nil` in Ruby. This is specified by the `optional: true` attribute in YAML. When `optional: true` is set, the first enum value is translated to `nil`. diff --git a/docs/syntax.md b/docs/syntax.md index 855f182efa..e753532566 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -428,7 +428,7 @@ _attribute-member_ ::= _visibility_ _attribute-type_ _method-name_ `:` _type_ | _visibility_ _attribute-type_ `self.` _method-name_ `:` _type_ # Singleton attribute | _visibility_ _attribute-type_ `self.` _method-name_ `(` _ivar-name_ `) :` _type_ # Singleton attribute with variable name specification | _visibility_ _attribute-type_ `self.` _method-name_ `() :` _type_ # Singleton attribute without variable -_visibility_ ::= `public` | `private` +_visibility_ ::= `public` | `private` | `protected` _attribute-type_ ::= `attr_reader` | `attr_writer` | `attr_accessor` @@ -502,11 +502,13 @@ def +: (Float | Integer) -> (Float | Integer) | (Numeric) -> Numeric ``` -Adding `public` and `private` modifier changes the visibility of the method. +Adding `public`, `private`, and `protected` modifiers changes the visibility of the method. ```rbs private def puts: (*untyped) -> void # Defines private instance method +protected def size: () -> Integer # Defines protected instance method + public def self.puts: (*untyped) -> void # Defines public singleton method public def self?.puts: (*untyped) -> void # 🚨🚨🚨 Error: `?.` has own visibility semantics (== `module_function`) 🚨🚨🚨 @@ -537,11 +539,13 @@ attr_accessor people (): Array[Person] # def people=: (Array[Person]) -> Array[Person] ``` -Attribute definitions can have the `public` and `private` modifiers like method definitions: +Attribute definitions can have the `public`, `private`, and `protected` modifiers like method definitions: ```rbs private attr_accessor id: Integer +protected attr_reader path: String + private attr_reader self.name: String ``` @@ -593,6 +597,12 @@ private def bar: () -> void # private instance method attr_reader email: String # private instance attribute + +protected + +def baz: () -> void # protected instance method + +attr_reader path: String # protected instance attribute ``` The visibility _modifiers_ overwrite the default visibility per member bases. diff --git a/ext/rbs_extension/ast_translation.c b/ext/rbs_extension/ast_translation.c index 2592116280..a8ed77b68f 100644 --- a/ext/rbs_extension/ast_translation.c +++ b/ext/rbs_extension/ast_translation.c @@ -101,6 +101,8 @@ VALUE rbs_attribute_visibility_to_ruby(enum rbs_attribute_visibility value) { return rb_id2sym(rb_intern("public")); case RBS_ATTRIBUTE_VISIBILITY_PRIVATE: return rb_id2sym(rb_intern("private")); + case RBS_ATTRIBUTE_VISIBILITY_PROTECTED: + return rb_id2sym(rb_intern("protected")); default: rb_fatal("unknown enum rbs_attribute_visibility value: %d", value); } @@ -149,6 +151,8 @@ VALUE rbs_method_definition_visibility_to_ruby(enum rbs_method_definition_visibi return rb_id2sym(rb_intern("public")); case RBS_METHOD_DEFINITION_VISIBILITY_PRIVATE: return rb_id2sym(rb_intern("private")); + case RBS_METHOD_DEFINITION_VISIBILITY_PROTECTED: + return rb_id2sym(rb_intern("protected")); default: rb_fatal("unknown enum rbs_method_definition_visibility value: %d", value); } @@ -996,6 +1000,19 @@ VALUE rbs_struct_to_ruby_value(rbs_translation_context_t ctx, rbs_node_t *instan rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location); return CLASS_NEW_INSTANCE(RBS_AST_Members_Private, 1, &h); } + case RBS_AST_MEMBERS_PROTECTED: { + rbs_ast_members_protected_t *node = (rbs_ast_members_protected_t *) instance; + + // Compute child VALUEs into locals variables first, before any recursion into `rbs_struct_to_ruby_value()`. + VALUE arg_location = rbs_location_range_to_ruby_location(ctx, node->base.location); + + // Claim the shared kwargs hash, clear it, fill it, and hand it to `.new`. + // Must not recurse between `rb_hash_clear()` and `CLASS_NEW_INSTANCE()`. + VALUE h = ctx.reusable_kwargs_hash; + rb_hash_clear(h); + rb_hash_aset(h, ID2SYM(rb_intern("location")), arg_location); + return CLASS_NEW_INSTANCE(RBS_AST_Members_Protected, 1, &h); + } case RBS_AST_MEMBERS_PUBLIC: { rbs_ast_members_public_t *node = (rbs_ast_members_public_t *) instance; diff --git a/ext/rbs_extension/class_constants.c b/ext/rbs_extension/class_constants.c index 0445a6d255..7068371518 100644 --- a/ext/rbs_extension/class_constants.c +++ b/ext/rbs_extension/class_constants.c @@ -46,6 +46,7 @@ VALUE RBS_AST_Members_MethodDefinition; VALUE RBS_AST_Members_MethodDefinition_Overload; VALUE RBS_AST_Members_Prepend; VALUE RBS_AST_Members_Private; +VALUE RBS_AST_Members_Protected; VALUE RBS_AST_Members_Public; VALUE RBS_AST_Ruby_Annotations_BlockParamTypeAnnotation; VALUE RBS_AST_Ruby_Annotations_ClassAliasAnnotation; @@ -140,6 +141,7 @@ void rbs__init_constants(void) { IMPORT_CONSTANT(RBS_AST_Members_MethodDefinition_Overload, RBS_AST_Members_MethodDefinition, "Overload"); IMPORT_CONSTANT(RBS_AST_Members_Prepend, RBS_AST_Members, "Prepend"); IMPORT_CONSTANT(RBS_AST_Members_Private, RBS_AST_Members, "Private"); + IMPORT_CONSTANT(RBS_AST_Members_Protected, RBS_AST_Members, "Protected"); IMPORT_CONSTANT(RBS_AST_Members_Public, RBS_AST_Members, "Public"); IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_BlockParamTypeAnnotation, RBS_AST_Ruby_Annotations, "BlockParamTypeAnnotation"); IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_ClassAliasAnnotation, RBS_AST_Ruby_Annotations, "ClassAliasAnnotation"); diff --git a/ext/rbs_extension/class_constants.h b/ext/rbs_extension/class_constants.h index 1a3e2afa81..36b75c97e9 100644 --- a/ext/rbs_extension/class_constants.h +++ b/ext/rbs_extension/class_constants.h @@ -54,6 +54,7 @@ extern VALUE RBS_AST_Members_MethodDefinition; extern VALUE RBS_AST_Members_MethodDefinition_Overload; extern VALUE RBS_AST_Members_Prepend; extern VALUE RBS_AST_Members_Private; +extern VALUE RBS_AST_Members_Protected; extern VALUE RBS_AST_Members_Public; extern VALUE RBS_AST_Ruby_Annotations_BlockParamTypeAnnotation; extern VALUE RBS_AST_Ruby_Annotations_ClassAliasAnnotation; diff --git a/include/rbs/ast.h b/include/rbs/ast.h index feddcaf0a2..9d42dafb77 100644 --- a/include/rbs/ast.h +++ b/include/rbs/ast.h @@ -18,6 +18,7 @@ enum rbs_attribute_visibility { RBS_ATTRIBUTE_VISIBILITY_UNSPECIFIED, /* unspecified (nil) */ RBS_ATTRIBUTE_VISIBILITY_PUBLIC, /* public (:public) */ RBS_ATTRIBUTE_VISIBILITY_PRIVATE, /* private (:private) */ + RBS_ATTRIBUTE_VISIBILITY_PROTECTED, /* protected (:protected) */ }; enum rbs_attribute_kind { @@ -40,6 +41,7 @@ enum rbs_method_definition_visibility { RBS_METHOD_DEFINITION_VISIBILITY_UNSPECIFIED, /* unspecified (nil) */ RBS_METHOD_DEFINITION_VISIBILITY_PUBLIC, /* public (:public) */ RBS_METHOD_DEFINITION_VISIBILITY_PRIVATE, /* private (:private) */ + RBS_METHOD_DEFINITION_VISIBILITY_PROTECTED, /* protected (:protected) */ }; enum rbs_type_param_variance { @@ -90,53 +92,54 @@ enum rbs_node_type { RBS_AST_MEMBERS_METHOD_DEFINITION_OVERLOAD = 28, RBS_AST_MEMBERS_PREPEND = 29, RBS_AST_MEMBERS_PRIVATE = 30, - RBS_AST_MEMBERS_PUBLIC = 31, - RBS_AST_RUBY_ANNOTATIONS_BLOCK_PARAM_TYPE_ANNOTATION = 32, - RBS_AST_RUBY_ANNOTATIONS_CLASS_ALIAS_ANNOTATION = 33, - RBS_AST_RUBY_ANNOTATIONS_COLON_METHOD_TYPE_ANNOTATION = 34, - RBS_AST_RUBY_ANNOTATIONS_DOUBLE_SPLAT_PARAM_TYPE_ANNOTATION = 35, - RBS_AST_RUBY_ANNOTATIONS_INSTANCE_VARIABLE_ANNOTATION = 36, - RBS_AST_RUBY_ANNOTATIONS_METHOD_TYPES_ANNOTATION = 37, - RBS_AST_RUBY_ANNOTATIONS_MODULE_ALIAS_ANNOTATION = 38, - RBS_AST_RUBY_ANNOTATIONS_MODULE_SELF_ANNOTATION = 39, - RBS_AST_RUBY_ANNOTATIONS_NODE_TYPE_ASSERTION = 40, - RBS_AST_RUBY_ANNOTATIONS_PARAM_TYPE_ANNOTATION = 41, - RBS_AST_RUBY_ANNOTATIONS_RETURN_TYPE_ANNOTATION = 42, - RBS_AST_RUBY_ANNOTATIONS_SKIP_ANNOTATION = 43, - RBS_AST_RUBY_ANNOTATIONS_SPLAT_PARAM_TYPE_ANNOTATION = 44, - RBS_AST_RUBY_ANNOTATIONS_TYPE_APPLICATION_ANNOTATION = 45, - RBS_AST_STRING = 46, - RBS_AST_TYPE_PARAM = 47, - RBS_METHOD_TYPE = 48, - RBS_NAMESPACE = 49, - RBS_SIGNATURE = 50, - RBS_TYPE_NAME = 51, - RBS_TYPES_ALIAS = 52, - RBS_TYPES_BASES_ANY = 53, - RBS_TYPES_BASES_BOOL = 54, - RBS_TYPES_BASES_BOTTOM = 55, - RBS_TYPES_BASES_CLASS = 56, - RBS_TYPES_BASES_INSTANCE = 57, - RBS_TYPES_BASES_NIL = 58, - RBS_TYPES_BASES_SELF = 59, - RBS_TYPES_BASES_TOP = 60, - RBS_TYPES_BASES_VOID = 61, - RBS_TYPES_BLOCK = 62, - RBS_TYPES_CLASS_INSTANCE = 63, - RBS_TYPES_CLASS_SINGLETON = 64, - RBS_TYPES_FUNCTION = 65, - RBS_TYPES_FUNCTION_PARAM = 66, - RBS_TYPES_INTERFACE = 67, - RBS_TYPES_INTERSECTION = 68, - RBS_TYPES_LITERAL = 69, - RBS_TYPES_OPTIONAL = 70, - RBS_TYPES_PROC = 71, - RBS_TYPES_RECORD = 72, - RBS_TYPES_RECORD_FIELD_TYPE = 73, - RBS_TYPES_TUPLE = 74, - RBS_TYPES_UNION = 75, - RBS_TYPES_UNTYPED_FUNCTION = 76, - RBS_TYPES_VARIABLE = 77, + RBS_AST_MEMBERS_PROTECTED = 31, + RBS_AST_MEMBERS_PUBLIC = 32, + RBS_AST_RUBY_ANNOTATIONS_BLOCK_PARAM_TYPE_ANNOTATION = 33, + RBS_AST_RUBY_ANNOTATIONS_CLASS_ALIAS_ANNOTATION = 34, + RBS_AST_RUBY_ANNOTATIONS_COLON_METHOD_TYPE_ANNOTATION = 35, + RBS_AST_RUBY_ANNOTATIONS_DOUBLE_SPLAT_PARAM_TYPE_ANNOTATION = 36, + RBS_AST_RUBY_ANNOTATIONS_INSTANCE_VARIABLE_ANNOTATION = 37, + RBS_AST_RUBY_ANNOTATIONS_METHOD_TYPES_ANNOTATION = 38, + RBS_AST_RUBY_ANNOTATIONS_MODULE_ALIAS_ANNOTATION = 39, + RBS_AST_RUBY_ANNOTATIONS_MODULE_SELF_ANNOTATION = 40, + RBS_AST_RUBY_ANNOTATIONS_NODE_TYPE_ASSERTION = 41, + RBS_AST_RUBY_ANNOTATIONS_PARAM_TYPE_ANNOTATION = 42, + RBS_AST_RUBY_ANNOTATIONS_RETURN_TYPE_ANNOTATION = 43, + RBS_AST_RUBY_ANNOTATIONS_SKIP_ANNOTATION = 44, + RBS_AST_RUBY_ANNOTATIONS_SPLAT_PARAM_TYPE_ANNOTATION = 45, + RBS_AST_RUBY_ANNOTATIONS_TYPE_APPLICATION_ANNOTATION = 46, + RBS_AST_STRING = 47, + RBS_AST_TYPE_PARAM = 48, + RBS_METHOD_TYPE = 49, + RBS_NAMESPACE = 50, + RBS_SIGNATURE = 51, + RBS_TYPE_NAME = 52, + RBS_TYPES_ALIAS = 53, + RBS_TYPES_BASES_ANY = 54, + RBS_TYPES_BASES_BOOL = 55, + RBS_TYPES_BASES_BOTTOM = 56, + RBS_TYPES_BASES_CLASS = 57, + RBS_TYPES_BASES_INSTANCE = 58, + RBS_TYPES_BASES_NIL = 59, + RBS_TYPES_BASES_SELF = 60, + RBS_TYPES_BASES_TOP = 61, + RBS_TYPES_BASES_VOID = 62, + RBS_TYPES_BLOCK = 63, + RBS_TYPES_CLASS_INSTANCE = 64, + RBS_TYPES_CLASS_SINGLETON = 65, + RBS_TYPES_FUNCTION = 66, + RBS_TYPES_FUNCTION_PARAM = 67, + RBS_TYPES_INTERFACE = 68, + RBS_TYPES_INTERSECTION = 69, + RBS_TYPES_LITERAL = 70, + RBS_TYPES_OPTIONAL = 71, + RBS_TYPES_PROC = 72, + RBS_TYPES_RECORD = 73, + RBS_TYPES_RECORD_FIELD_TYPE = 74, + RBS_TYPES_TUPLE = 75, + RBS_TYPES_UNION = 76, + RBS_TYPES_UNTYPED_FUNCTION = 77, + RBS_TYPES_VARIABLE = 78, RBS_AST_SYMBOL, }; @@ -560,6 +563,11 @@ typedef struct rbs_ast_members_private { } rbs_ast_members_private_t; +typedef struct rbs_ast_members_protected { + rbs_node_t base; + +} rbs_ast_members_protected_t; + typedef struct rbs_ast_members_public { rbs_node_t base; @@ -996,6 +1004,7 @@ rbs_ast_members_method_definition_t *RBS_NONNULL rbs_ast_members_method_definiti rbs_ast_members_method_definition_overload_t *RBS_NONNULL rbs_ast_members_method_definition_overload_new(rbs_allocator_t *RBS_NONNULL allocator, rbs_location_range location, rbs_node_list_t *RBS_NONNULL annotations, rbs_node_t *RBS_NONNULL method_type); rbs_ast_members_prepend_t *RBS_NONNULL rbs_ast_members_prepend_new(rbs_allocator_t *RBS_NONNULL allocator, rbs_location_range location, rbs_type_name_t *RBS_NONNULL name, rbs_node_list_t *RBS_NONNULL args, rbs_node_list_t *RBS_NONNULL annotations, rbs_ast_comment_t *RBS_NULLABLE comment, rbs_location_range name_range, rbs_location_range keyword_range); rbs_ast_members_private_t *RBS_NONNULL rbs_ast_members_private_new(rbs_allocator_t *RBS_NONNULL allocator, rbs_location_range location); +rbs_ast_members_protected_t *RBS_NONNULL rbs_ast_members_protected_new(rbs_allocator_t *RBS_NONNULL allocator, rbs_location_range location); rbs_ast_members_public_t *RBS_NONNULL rbs_ast_members_public_new(rbs_allocator_t *RBS_NONNULL allocator, rbs_location_range location); rbs_ast_ruby_annotations_block_param_type_annotation_t *RBS_NONNULL rbs_ast_ruby_annotations_block_param_type_annotation_new(rbs_allocator_t *RBS_NONNULL allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range ampersand_location, rbs_location_range name_location, rbs_location_range colon_location, rbs_location_range question_location, rbs_location_range type_location, rbs_node_t *RBS_NONNULL type_, rbs_location_range comment_location); rbs_ast_ruby_annotations_class_alias_annotation_t *RBS_NONNULL rbs_ast_ruby_annotations_class_alias_annotation_new(rbs_allocator_t *RBS_NONNULL allocator, rbs_location_range location, rbs_location_range prefix_location, rbs_location_range keyword_location, rbs_type_name_t *RBS_NONNULL type_name, rbs_location_range type_name_location); diff --git a/include/rbs/lexer.h b/include/rbs/lexer.h index 6b5c533e8a..ea0dbdc05f 100644 --- a/include/rbs/lexer.h +++ b/include/rbs/lexer.h @@ -55,6 +55,7 @@ enum RBSTokenType { kOUT, /* out */ kPREPEND, /* prepend */ kPRIVATE, /* private */ + kPROTECTED, /* protected */ kPUBLIC, /* public */ kSELF, /* self */ kSINGLETON, /* singleton */ diff --git a/lib/rbs/ast/members.rb b/lib/rbs/ast/members.rb index c1c3f96a51..5ee7a8baf3 100644 --- a/lib/rbs/ast/members.rb +++ b/lib/rbs/ast/members.rb @@ -396,6 +396,14 @@ def to_json(state = nil) end end + class Protected < Base + include LocationOnly + + def to_json(state = nil) + { member: :protected, location: location }.to_json(state) + end + end + class Alias < Base attr_reader :new_name attr_reader :old_name diff --git a/lib/rbs/ast/visitor.rb b/lib/rbs/ast/visitor.rb index 7d33e6b0a8..b47b76a1e6 100644 --- a/lib/rbs/ast/visitor.rb +++ b/lib/rbs/ast/visitor.rb @@ -48,6 +48,8 @@ def visit(node) visit_member_instance_variable(node) when Members::Private visit_member_private(node) + when Members::Protected + visit_member_protected(node) when Members::Public visit_member_public(node) when Members::MethodDefinition @@ -109,6 +111,9 @@ def visit_member_instance_variable(node) def visit_member_private(node) end + def visit_member_protected(node) + end + def visit_member_public(node) end diff --git a/lib/rbs/definition.rb b/lib/rbs/definition.rb index 0503f795e1..c44be265ec 100644 --- a/lib/rbs/definition.rb +++ b/lib/rbs/definition.rb @@ -164,6 +164,10 @@ def private? @accessibility == :private end + def protected? + @accessibility == :protected + end + def sub(s) return self if s.empty? diff --git a/lib/rbs/definition_builder/method_builder.rb b/lib/rbs/definition_builder/method_builder.rb index a4f47e4051..4fdefb9367 100644 --- a/lib/rbs/definition_builder/method_builder.rb +++ b/lib/rbs/definition_builder/method_builder.rb @@ -271,6 +271,8 @@ def each_rbs_member_with_accessibility(members, accessibility: :public) accessibility = :public when AST::Members::Private accessibility = :private + when AST::Members::Protected + accessibility = :protected else yield member, accessibility end diff --git a/lib/rbs/prototype/rb.rb b/lib/rbs/prototype/rb.rb index 8e3562db46..b933cead37 100644 --- a/lib/rbs/prototype/rb.rb +++ b/lib/rbs/prototype/rb.rb @@ -308,7 +308,7 @@ def process(node, decls:, comments:, context:) end end end - when :public, :private + when :public, :private, :protected accessibility = __send__(node.children[0]) if args.empty? decls << accessibility @@ -744,9 +744,13 @@ def public @public ||= AST::Members::Public.new(location: nil) end + def protected + @protected ||= AST::Members::Protected.new(location: nil) + end + def current_accessibility(decls, index = decls.size) slice = decls.slice(0, index) or raise - idx = slice.rindex { |decl| decl == private || decl == public } + idx = slice.rindex { |decl| decl == private || decl == public || decl == protected } if idx _ = decls[idx] else @@ -781,7 +785,7 @@ def remove_unnecessary_accessibility_methods!(decls) end def is_accessibility?(decl) - decl == public || decl == private + decl == public || decl == private || decl == protected end def find_def_index_by_name(decls, name) diff --git a/lib/rbs/prototype/runtime.rb b/lib/rbs/prototype/runtime.rb index c209f9ad01..97c8cafd95 100644 --- a/lib/rbs/prototype/runtime.rb +++ b/lib/rbs/prototype/runtime.rb @@ -379,6 +379,48 @@ def generate_methods(mod, module_name, members) end end + protected_instance_methods = mod.protected_instance_methods.select {|name| target_method?(mod, instance: name) } + unless protected_instance_methods.empty? + added = false + members << AST::Members::Protected.new(location: nil) + + protected_instance_methods.sort.each do |name| + method = mod.instance_method(name) + next if todo_object&.skip_instance_method?(module_name: module_name_absolute, method: method, accessibility: :protected) + + added = true + if can_alias?(mod, method) + members << AST::Members::Alias.new( + new_name: method.name, + old_name: method.original_name, + kind: :instance, + location: nil, + comment: nil, + annotations: [], + ) + else + merge_rbs(module_name, members, instance: name) do + RBS.logger.info "missing #{module_name}##{name} #{method.source_location}" + + members << AST::Members::MethodDefinition.new( + name: method.name, + overloads: [ + AST::Members::MethodDefinition::Overload.new(annotations: [], method_type: method_type(method)) + ], + kind: :instance, + location: nil, + comment: nil, + annotations: [], + overloading: false, + visibility: nil + ) + end + end + end + + members.pop unless added + end + private_instance_methods = mod.private_instance_methods.select {|name| target_method?(mod, instance: name) } unless private_instance_methods.empty? added = false diff --git a/lib/rbs/sorter.rb b/lib/rbs/sorter.rb index 99ef0cb018..652e5ddc64 100644 --- a/lib/rbs/sorter.rb +++ b/lib/rbs/sorter.rb @@ -46,9 +46,11 @@ def sort_decl(decl) module_functions: [], singleton_new_methods: [], public_singleton_methods: [], + protected_singleton_methods: [], private_singleton_methods: [], instance_initialize_methods: [], public_instance_methods: [], + protected_instance_methods: [], private_instance_methods: [], } #: partitioned @@ -63,6 +65,8 @@ def sort_decl(decl) :public when Members::Private :private + when Members::Protected + :protected when Members::MethodDefinition, Members::AttrReader, Members::AttrWriter, Members::AttrAccessor visibility_annotated_members << member.update(visibility: member.visibility || current_visibility) current_visibility @@ -93,10 +97,12 @@ def sort_decl(decl) when Members::InstanceVariable partitioned[:instance_variables] << member when Members::AttrAccessor, Members::AttrWriter, Members::AttrReader + member = member.update(visibility: nil) if member.visibility == :public + if member.kind == :singleton - partitioned[:singleton_attributes] << member.update(visibility: nil) + partitioned[:singleton_attributes] << member else - partitioned[:instance_attributes] << member.update(visibility: nil) + partitioned[:instance_attributes] << member end when Members::MethodDefinition case member.kind @@ -107,14 +113,18 @@ def sort_decl(decl) partitioned[:singleton_new_methods] << member.update(visibility: nil) elsif member.visibility == :public partitioned[:public_singleton_methods] << member.update(visibility: nil) + elsif member.visibility == :protected + partitioned[:protected_singleton_methods] << member else - partitioned[:private_singleton_methods] << member.update(visibility: nil) + partitioned[:private_singleton_methods] << member end else if member.name == :initialize partitioned[:instance_initialize_methods] << member.update(visibility: nil) elsif member.visibility == :public partitioned[:public_instance_methods] << member.update(visibility: nil) + elsif member.visibility == :protected + partitioned[:protected_instance_methods] << member.update(visibility: nil) else partitioned[:private_instance_methods] << member.update(visibility: nil) end @@ -125,7 +135,7 @@ def sort_decl(decl) else partitioned[:public_instance_methods] << member end - when Members::Public, Members::Private + when Members::Public, Members::Private, Members::Protected raise else partitioned[:other_decls] << member @@ -145,8 +155,10 @@ def sort_decl(decl) partitioned[:instance_attributes].sort_by! {|decl| decl.name.to_s } partitioned[:module_functions].sort_by! {|decl| decl.name.to_s } partitioned[:public_singleton_methods].sort_by! {|decl| decl.is_a?(Members::MethodDefinition) ? decl.name.to_s : decl.new_name.to_s } + partitioned[:protected_singleton_methods].sort_by! {|decl| decl.name.to_s } partitioned[:private_singleton_methods].sort_by! {|decl| decl.name.to_s } partitioned[:public_instance_methods].sort_by! {|decl| decl.is_a?(Members::MethodDefinition) ? decl.name.to_s : decl.new_name.to_s } + partitioned[:protected_instance_methods].sort_by! {|decl| decl.name.to_s } partitioned[:private_instance_methods].sort_by! {|decl| decl.name.to_s } members = [] #: Array[member] @@ -167,13 +179,11 @@ def sort_decl(decl) members.push(*partitioned[:singleton_new_methods]) members.push(*partitioned[:public_singleton_methods]) - if !partitioned[:private_singleton_methods].empty? - current_visibility = :private - members.push Members::Private.new(location: nil) - end + members.push(*partitioned[:protected_singleton_methods]) + members.push(*partitioned[:private_singleton_methods]) - if current_visibility == :private && !partitioned[:public_instance_methods].empty? + if current_visibility != :public && !partitioned[:public_instance_methods].empty? current_visibility = :public members.push Members::Public.new(location: nil) end @@ -181,7 +191,13 @@ def sort_decl(decl) members.push(*partitioned[:instance_initialize_methods]) members.push(*partitioned[:public_instance_methods]) - if current_visibility == :public && !partitioned[:private_instance_methods].empty? + if current_visibility != :protected && !partitioned[:protected_instance_methods].empty? + current_visibility = :protected + members.push Members::Protected.new(location: nil) + end + members.push(*partitioned[:protected_instance_methods]) + + if current_visibility != :private && !partitioned[:private_instance_methods].empty? current_visibility = :private members.push Members::Private.new(location: nil) end diff --git a/lib/rbs/subtractor.rb b/lib/rbs/subtractor.rb index d772505c8c..eb70d1496e 100644 --- a/lib/rbs/subtractor.rb +++ b/lib/rbs/subtractor.rb @@ -78,7 +78,7 @@ def call(minuend = @minuend, context: nil) cvar_exist?(owner, member.name) when AST::Members::Include, AST::Members::Extend, AST::Members::Prepend mixin_exist?(owner, member, context: context) - when AST::Members::Public, AST::Members::Private + when AST::Members::Public, AST::Members::Private, AST::Members::Protected # They should not be removed even if the subtrahend has them. false else @@ -161,7 +161,7 @@ def call(minuend = @minuend, context: nil) end private def access_modifier?(decl) - decl.is_a?(AST::Members::Public) || decl.is_a?(AST::Members::Private) + decl.is_a?(AST::Members::Public) || decl.is_a?(AST::Members::Private) || decl.is_a?(AST::Members::Protected) end private def update_decl(decl, members:) diff --git a/lib/rbs/writer.rb b/lib/rbs/writer.rb index 4d2a1d0d21..72d4bd30ea 100644 --- a/lib/rbs/writer.rb +++ b/lib/rbs/writer.rb @@ -266,6 +266,8 @@ def write_member(member) puts "public" when AST::Members::Private puts "private" + when AST::Members::Protected + puts "protected" when AST::Members::Alias write_comment member.comment write_annotation member.annotations @@ -318,6 +320,8 @@ def write_def(member) "public " when :private "private " + when :protected + "protected " else "" end @@ -370,6 +374,8 @@ def attribute(kind, attr) "public " when :private "private " + when :protected + "protected " else "" end diff --git a/rust/ruby-rbs-sys/build.rs b/rust/ruby-rbs-sys/build.rs index c4ff9d13c2..d1a8668988 100644 --- a/rust/ruby-rbs-sys/build.rs +++ b/rust/ruby-rbs-sys/build.rs @@ -102,6 +102,7 @@ fn generate_bindings(include_path: &Path) -> Result void + protected def secret: () -> void + protected alias instance_method target_method alias self.singleton_method self.target_method end @@ -650,23 +653,45 @@ mod tests { panic!("Expected AttrReader"); } + // protected attr_reader - should preserve protected visibility + if let Node::AttrReader(attr) = &members[1] { + assert_eq!(attr.kind(), AttributeKind::Instance); + assert_eq!(attr.visibility(), AttributeVisibility::Protected); + } else { + panic!("Expected AttrReader"); + } + // def self.process - should be singleton method with unspecified visibility (default) - if let Node::MethodDefinition(method) = &members[1] { + if let Node::MethodDefinition(method) = &members[2] { assert_eq!(method.kind(), MethodDefinitionKind::Singleton); assert_eq!(method.visibility(), MethodDefinitionVisibility::Unspecified); } else { panic!("Expected MethodDefinition"); } + // protected def - should preserve protected visibility + if let Node::MethodDefinition(method) = &members[3] { + assert_eq!(method.kind(), MethodDefinitionKind::Instance); + assert_eq!(method.visibility(), MethodDefinitionVisibility::Protected); + } else { + panic!("Expected MethodDefinition"); + } + + // standalone protected visibility member + if let Node::Protected(_) = &members[4] { + } else { + panic!("Expected Protected"); + } + // alias instance_method - if let Node::Alias(alias) = &members[2] { + if let Node::Alias(alias) = &members[5] { assert_eq!(alias.kind(), AliasKind::Instance); } else { panic!("Expected Alias"); } // alias self.singleton_method - if let Node::Alias(alias) = &members[3] { + if let Node::Alias(alias) = &members[6] { assert_eq!(alias.kind(), AliasKind::Singleton); } else { panic!("Expected Alias"); diff --git a/schema/members.json b/schema/members.json index 700ed63bd1..8bce9092b7 100644 --- a/schema/members.json +++ b/schema/members.json @@ -47,7 +47,7 @@ "type": "boolean" }, "visibility": { - "enum": ["public", "private", null] + "enum": ["public", "private", "protected", null] } }, "required": ["member", "name", "kind", "overloads", "comment", "annotations", "location", "visibility", "overloading"] @@ -209,19 +209,19 @@ "$ref": "location.json" }, "visibility": { - "enum": ["public", "private", null] + "enum": ["public", "private", "protected", null] } }, "required": ["member", "name", "ivar_name", "type", "annotations", "kind", "comment", "location", "visibility"] }, "visibility": { "title": "Visibility specifier", - "description": "`public` and `private`.", + "description": "`public`, `private`, and `protected`.", "type": "object", "properties": { "member": { "type": "string", - "enum": ["public", "private"] + "enum": ["public", "private", "protected"] }, "location": { "$ref": "location.json" diff --git a/sig/definition.rbs b/sig/definition.rbs index 61ee6f0ea0..68bea531fd 100644 --- a/sig/definition.rbs +++ b/sig/definition.rbs @@ -1,6 +1,6 @@ module RBS class Definition - type accessibility = :public | :private + type accessibility = :public | :private | :protected class Variable attr_reader parent_variable: Variable? @@ -126,6 +126,8 @@ module RBS def private?: () -> bool + def protected?: () -> bool + # Substitutes type variables to some types. # Takes care of type parameter bounds. # diff --git a/sig/members.rbs b/sig/members.rbs index 2951d3ba2a..7b3daffa48 100644 --- a/sig/members.rbs +++ b/sig/members.rbs @@ -5,14 +5,14 @@ module RBS | InstanceVariable | ClassInstanceVariable | ClassVariable | Include | Extend | Prepend | AttrReader | AttrWriter | AttrAccessor - | Public | Private + | Public | Private | Protected | Alias # Base class for members. class Base end - type visibility = :public | :private + type visibility = :public | :private | :protected class MethodDefinition < Base class Overload @@ -220,6 +220,11 @@ module RBS include _ToJson end + class Protected < Base + include LocationOnly + include _ToJson + end + class Alias < Base type kind = :instance | :singleton diff --git a/sig/prototype/rb.rbs b/sig/prototype/rb.rbs index e575fc4ee1..ea81d42dd3 100644 --- a/sig/prototype/rb.rbs +++ b/sig/prototype/rb.rbs @@ -82,7 +82,11 @@ module RBS @public: AST::Members::Public? - def current_accessibility: (Array[decl] decls, ?Integer index) -> (AST::Members::Private | AST::Members::Public) + def protected: () -> AST::Members::Protected + + @protected: AST::Members::Protected? + + def current_accessibility: (Array[decl] decls, ?Integer index) -> (AST::Members::Private | AST::Members::Public | AST::Members::Protected) def remove_unnecessary_accessibility_methods!: (Array[decl]) -> void diff --git a/sig/sorter.rbs b/sig/sorter.rbs index a8a38fa9ab..b58f81b5bc 100644 --- a/sig/sorter.rbs +++ b/sig/sorter.rbs @@ -29,9 +29,11 @@ module RBS module_functions: Array[AST::Members::MethodDefinition], singleton_new_methods: Array[AST::Members::MethodDefinition], public_singleton_methods: Array[AST::Members::MethodDefinition | AST::Members::Alias], + protected_singleton_methods: Array[AST::Members::MethodDefinition], private_singleton_methods: Array[AST::Members::MethodDefinition], instance_initialize_methods: Array[AST::Members::MethodDefinition], public_instance_methods: Array[AST::Members::MethodDefinition | AST::Members::Alias], + protected_instance_methods: Array[AST::Members::MethodDefinition], private_instance_methods: Array[AST::Members::MethodDefinition], other_decls: Array[member] } diff --git a/sig/visitor.rbs b/sig/visitor.rbs index d0a8087e3e..aa216a85b7 100644 --- a/sig/visitor.rbs +++ b/sig/visitor.rbs @@ -27,6 +27,8 @@ module RBS def visit_member_private: (Members::Private node) -> void + def visit_member_protected: (Members::Protected node) -> void + def visit_member_public: (Members::Public node) -> void def visit_member_method_definition: (Members::MethodDefinition node) -> void diff --git a/src/ast.c b/src/ast.c index 7e52681910..68930431a2 100644 --- a/src/ast.c +++ b/src/ast.c @@ -73,6 +73,8 @@ const char *RBS_NONNULL rbs_node_type_name(rbs_node_t *RBS_NONNULL node) { return "RBS::AST::Members::Prepend"; case RBS_AST_MEMBERS_PRIVATE: return "RBS::AST::Members::Private"; + case RBS_AST_MEMBERS_PROTECTED: + return "RBS::AST::Members::Protected"; case RBS_AST_MEMBERS_PUBLIC: return "RBS::AST::Members::Public"; case RBS_AST_RUBY_ANNOTATIONS_BLOCK_PARAM_TYPE_ANNOTATION: @@ -879,6 +881,19 @@ rbs_ast_members_private_t *RBS_NONNULL rbs_ast_members_private_new(rbs_allocator return instance; } #line 140 "templates/src/ast.c.erb" +rbs_ast_members_protected_t *RBS_NONNULL rbs_ast_members_protected_new(rbs_allocator_t *RBS_NONNULL allocator, rbs_location_range location) { + rbs_ast_members_protected_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_protected_t); + + *instance = (rbs_ast_members_protected_t) { + .base = (rbs_node_t) { + .type = RBS_AST_MEMBERS_PROTECTED, + .location = location, + }, + }; + + return instance; +} +#line 140 "templates/src/ast.c.erb" rbs_ast_members_public_t *RBS_NONNULL rbs_ast_members_public_new(rbs_allocator_t *RBS_NONNULL allocator, rbs_location_range location) { rbs_ast_members_public_t *instance = rbs_allocator_alloc(allocator, rbs_ast_members_public_t); diff --git a/src/lexer.c b/src/lexer.c index 4c6eaf8789..bdf0989154 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -1,3217 +1,3027 @@ -/* Generated by re2c 4.3 */ +/* Generated by re2c 3.1 */ #line 1 "src/lexer.re" #include "rbs/lexer.h" rbs_token_t rbs_lexer_next_token(rbs_lexer_t *lexer) { - rbs_lexer_t backup; + rbs_lexer_t backup; - backup = *lexer; + backup = *lexer; + #line 12 "src/lexer.c" - { - unsigned int yych; - unsigned int yyaccept = 0; - yych = rbs_peek(lexer); - switch (yych) { - case 0x00000000: - goto yy1; - case '\t': - case ' ': - goto yy4; - case '\n': - case '\r': - goto yy6; - case '!': - goto yy7; - case '"': - goto yy9; - case '#': - goto yy10; - case '$': - goto yy12; - case '%': - goto yy13; - case '&': - goto yy14; - case '\'': - goto yy15; - case '(': - goto yy16; - case ')': - goto yy17; - case '*': - goto yy18; - case '+': - goto yy19; - case ',': - goto yy20; - case '-': - goto yy21; - case '.': - goto yy22; - case '/': - case '~': - goto yy24; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - goto yy25; - case ':': - goto yy27; - case '<': - goto yy29; - case '=': - goto yy31; - case '>': - goto yy33; - case '?': - goto yy35; - case '@': - goto yy36; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - goto yy37; - case '[': - goto yy39; - case ']': - goto yy40; - case '^': - goto yy41; - case '_': - goto yy42; - case '`': - goto yy44; - case 'a': - goto yy46; - case 'b': - goto yy48; - case 'c': - goto yy49; - case 'd': - goto yy50; - case 'e': - goto yy51; - case 'f': - goto yy52; - case 'g': - case 'h': - case 'j': - case 'k': - case 'l': - case 'q': - case 'w': - case 'x': - case 'y': - case 'z': - goto yy53; - case 'i': - goto yy55; - case 'm': - goto yy56; - case 'n': - goto yy57; - case 'o': - goto yy58; - case 'p': - goto yy59; - case 'r': - goto yy60; - case 's': - goto yy61; - case 't': - goto yy62; - case 'u': - goto yy63; - case 'v': - goto yy64; - case '{': - goto yy65; - case '|': - goto yy66; - case '}': - goto yy67; - default: - goto yy2; - } - yy1: - rbs_skip(lexer); -#line 152 "src/lexer.re" - { - return rbs_next_eof_token(lexer); - } -#line 121 "src/lexer.c" - yy2: - rbs_skip(lexer); - yy3: +{ + unsigned int yych; + unsigned int yyaccept = 0; + yych = rbs_peek(lexer); + switch (yych) { + case 0x00000000: goto yy1; + case '\t': + case ' ': goto yy4; + case '\n': + case '\r': goto yy6; + case '!': goto yy7; + case '"': goto yy9; + case '#': goto yy10; + case '$': goto yy12; + case '%': goto yy13; + case '&': goto yy14; + case '\'': goto yy15; + case '(': goto yy16; + case ')': goto yy17; + case '*': goto yy18; + case '+': goto yy19; + case ',': goto yy20; + case '-': goto yy21; + case '.': goto yy22; + case '/': + case '~': goto yy24; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy25; + case ':': goto yy27; + case '<': goto yy29; + case '=': goto yy31; + case '>': goto yy33; + case '?': goto yy35; + case '@': goto yy36; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': goto yy37; + case '[': goto yy39; + case ']': goto yy40; + case '^': goto yy41; + case '_': goto yy42; + case '`': goto yy44; + case 'a': goto yy46; + case 'b': goto yy48; + case 'c': goto yy49; + case 'd': goto yy50; + case 'e': goto yy51; + case 'f': goto yy52; + case 'g': + case 'h': + case 'j': + case 'k': + case 'l': + case 'q': + case 'w': + case 'x': + case 'y': + case 'z': goto yy53; + case 'i': goto yy55; + case 'm': goto yy56; + case 'n': goto yy57; + case 'o': goto yy58; + case 'p': goto yy59; + case 'r': goto yy60; + case 's': goto yy61; + case 't': goto yy62; + case 'u': goto yy63; + case 'v': goto yy64; + case '{': goto yy65; + case '|': goto yy66; + case '}': goto yy67; + default: goto yy2; + } +yy1: + rbs_skip(lexer); #line 153 "src/lexer.re" - { - return rbs_next_token(lexer, ErrorToken); - } + { return rbs_next_eof_token(lexer); } +#line 121 "src/lexer.c" +yy2: + rbs_skip(lexer); +yy3: +#line 154 "src/lexer.re" + { return rbs_next_token(lexer, ErrorToken); } #line 127 "src/lexer.c" - yy4: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '\t') goto yy4; - if (yych == ' ') goto yy4; - yy5: -#line 151 "src/lexer.re" - { - return rbs_next_token(lexer, tTRIVIA); - } +yy4: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '\t') goto yy4; + if (yych == ' ') goto yy4; +yy5: +#line 152 "src/lexer.re" + { return rbs_next_token(lexer, tTRIVIA); } #line 136 "src/lexer.c" - yy6: - rbs_skip(lexer); - goto yy5; - yy7: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '=') goto yy24; - if (yych == '~') goto yy24; - yy8: +yy6: + rbs_skip(lexer); + goto yy5; +yy7: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '=') goto yy24; + if (yych == '~') goto yy24; +yy8: #line 49 "src/lexer.re" - { - return rbs_next_token(lexer, tOPERATOR); - } + { return rbs_next_token(lexer, tOPERATOR); } #line 148 "src/lexer.c" - yy9: - yyaccept = 0; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych <= 0x00000000) goto yy3; - goto yy69; - yy10: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 0x00000000) goto yy11; - if (yych != '\n') goto yy10; - yy11: +yy9: + yyaccept = 0; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych <= 0x00000000) goto yy3; + goto yy69; +yy10: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 0x00000000) goto yy11; + if (yych != '\n') goto yy10; +yy11: #line 61 "src/lexer.re" - { + { return rbs_next_token( - lexer, - lexer->first_token_of_line ? tLINECOMMENT : tCOMMENT + lexer, + lexer->first_token_of_line ? tLINECOMMENT : tCOMMENT ); - } + } #line 169 "src/lexer.c" - yy12: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= ')') { - if (yych <= 0x0000001F) { - if (yych <= '\n') { - if (yych <= 0x00000000) goto yy3; - if (yych <= 0x00000008) goto yy73; - goto yy3; - } else { - if (yych == '\r') goto yy3; - goto yy73; - } - } else { - if (yych <= '#') { - if (yych <= ' ') goto yy3; - if (yych <= '"') goto yy75; - goto yy73; - } else { - if (yych == '%') goto yy3; - if (yych <= '\'') goto yy75; - goto yy3; - } - } - } else { - if (yych <= 'Z') { - if (yych <= '/') { - if (yych == '-') goto yy73; - goto yy75; - } else { - if (yych <= '9') goto yy73; - if (yych <= '>') goto yy75; - goto yy73; - } - } else { - if (yych <= '^') { - if (yych == '\\') goto yy75; - goto yy3; - } else { - if (yych <= 'z') goto yy73; - if (yych <= '}') goto yy3; - if (yych <= '~') goto yy75; - goto yy73; - } - } - } - yy13: - yyaccept = 1; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych == 'a') goto yy76; - goto yy8; - yy14: - rbs_skip(lexer); +yy12: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= ')') { + if (yych <= 0x0000001F) { + if (yych <= '\n') { + if (yych <= 0x00000000) goto yy3; + if (yych <= 0x00000008) goto yy73; + goto yy3; + } else { + if (yych == '\r') goto yy3; + goto yy73; + } + } else { + if (yych <= '#') { + if (yych <= ' ') goto yy3; + if (yych <= '"') goto yy75; + goto yy73; + } else { + if (yych == '%') goto yy3; + if (yych <= '\'') goto yy75; + goto yy3; + } + } + } else { + if (yych <= 'Z') { + if (yych <= '/') { + if (yych == '-') goto yy73; + goto yy75; + } else { + if (yych <= '9') goto yy73; + if (yych <= '>') goto yy75; + goto yy73; + } + } else { + if (yych <= '^') { + if (yych == '\\') goto yy75; + goto yy3; + } else { + if (yych <= 'z') goto yy73; + if (yych <= '}') goto yy3; + if (yych <= '~') goto yy75; + goto yy73; + } + } + } +yy13: + yyaccept = 1; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych == 'a') goto yy76; + goto yy8; +yy14: + rbs_skip(lexer); #line 33 "src/lexer.re" - { - return rbs_next_token(lexer, pAMP); - } + { return rbs_next_token(lexer, pAMP); } #line 227 "src/lexer.c" - yy15: - yyaccept = 0; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych <= 0x00000000) goto yy3; - goto yy78; - yy16: - rbs_skip(lexer); +yy15: + yyaccept = 0; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych <= 0x00000000) goto yy3; + goto yy78; +yy16: + rbs_skip(lexer); #line 24 "src/lexer.re" - { - return rbs_next_token(lexer, pLPAREN); - } + { return rbs_next_token(lexer, pLPAREN); } #line 239 "src/lexer.c" - yy17: - rbs_skip(lexer); +yy17: + rbs_skip(lexer); #line 25 "src/lexer.re" - { - return rbs_next_token(lexer, pRPAREN); - } + { return rbs_next_token(lexer, pRPAREN); } #line 244 "src/lexer.c" - yy18: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '*') goto yy82; +yy18: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '*') goto yy82; #line 35 "src/lexer.re" - { - return rbs_next_token(lexer, pSTAR); - } + { return rbs_next_token(lexer, pSTAR); } #line 251 "src/lexer.c" - yy19: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '/') goto yy8; - if (yych <= '9') goto yy25; - if (yych == '@') goto yy24; - goto yy8; - yy20: - rbs_skip(lexer); +yy19: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '/') goto yy8; + if (yych <= '9') goto yy25; + if (yych == '@') goto yy24; + goto yy8; +yy20: + rbs_skip(lexer); #line 30 "src/lexer.re" - { - return rbs_next_token(lexer, pCOMMA); - } + { return rbs_next_token(lexer, pCOMMA); } #line 263 "src/lexer.c" - yy21: - rbs_skip(lexer); - yych = rbs_peek(lexer); - switch (yych) { - case '-': - goto yy83; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - goto yy25; - case '>': - goto yy84; - case '@': - goto yy24; - default: - goto yy8; - } - yy22: - yyaccept = 2; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych == '.') goto yy85; - yy23: +yy21: + rbs_skip(lexer); + yych = rbs_peek(lexer); + switch (yych) { + case '-': goto yy83; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy25; + case '>': goto yy84; + case '@': goto yy24; + default: goto yy8; + } +yy22: + yyaccept = 2; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych == '.') goto yy85; +yy23: #line 37 "src/lexer.re" - { - return rbs_next_token(lexer, pDOT); - } + { return rbs_next_token(lexer, pDOT); } #line 292 "src/lexer.c" - yy24: - rbs_skip(lexer); - goto yy8; - yy25: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '/') goto yy26; - if (yych <= '9') goto yy25; - if (yych == '_') goto yy25; - yy26: +yy24: + rbs_skip(lexer); + goto yy8; +yy25: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '/') goto yy26; + if (yych <= '9') goto yy25; + if (yych == '_') goto yy25; +yy26: #line 53 "src/lexer.re" - { - return rbs_next_token(lexer, tINTEGER); - } + { return rbs_next_token(lexer, tINTEGER); } #line 305 "src/lexer.c" - yy27: - yyaccept = 3; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - switch (yych) { - case '!': - goto yy86; - case '"': - goto yy88; - case '$': - goto yy89; - case '%': - case '&': - case '/': - case '^': - case '`': - case '|': - case '~': - goto yy90; - case '\'': - goto yy91; - case '*': - goto yy92; - case '+': - case '-': - goto yy93; - case ':': - goto yy94; - case '<': - goto yy95; - case '=': - goto yy96; - case '>': - goto yy97; - case '@': - goto yy98; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': - goto yy99; - case '[': - goto yy101; - default: - goto yy28; - } - yy28: +yy27: + yyaccept = 3; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + switch (yych) { + case '!': goto yy86; + case '"': goto yy88; + case '$': goto yy89; + case '%': + case '&': + case '/': + case '^': + case '`': + case '|': + case '~': goto yy90; + case '\'': goto yy91; + case '*': goto yy92; + case '+': + case '-': goto yy93; + case ':': goto yy94; + case '<': goto yy95; + case '=': goto yy96; + case '>': goto yy97; + case '@': goto yy98; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case '_': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy99; + case '[': goto yy101; + default: goto yy28; + } +yy28: #line 44 "src/lexer.re" - { - return rbs_next_token(lexer, pCOLON); - } + { return rbs_next_token(lexer, pCOLON); } #line 390 "src/lexer.c" - yy29: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= ';') goto yy30; - if (yych <= '<') goto yy24; - if (yych <= '=') goto yy102; - yy30: +yy29: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= ';') goto yy30; + if (yych <= '<') goto yy24; + if (yych <= '=') goto yy102; +yy30: #line 46 "src/lexer.re" - { - return rbs_next_token(lexer, pLT); - } + { return rbs_next_token(lexer, pLT); } #line 400 "src/lexer.c" - yy31: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '>') { - if (yych <= '<') goto yy32; - if (yych <= '=') goto yy103; - goto yy104; - } else { - if (yych == '~') goto yy24; - } - yy32: +yy31: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '>') { + if (yych <= '<') goto yy32; + if (yych <= '=') goto yy103; + goto yy104; + } else { + if (yych == '~') goto yy24; + } +yy32: #line 43 "src/lexer.re" - { - return rbs_next_token(lexer, pEQ); - } + { return rbs_next_token(lexer, pEQ); } #line 414 "src/lexer.c" - yy33: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '<') goto yy34; - if (yych <= '>') goto yy24; - yy34: +yy33: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '<') goto yy34; + if (yych <= '>') goto yy24; +yy34: #line 47 "src/lexer.re" - { - return rbs_next_token(lexer, pGT); - } + { return rbs_next_token(lexer, pGT); } #line 423 "src/lexer.c" - yy35: - rbs_skip(lexer); +yy35: + rbs_skip(lexer); #line 34 "src/lexer.re" - { - return rbs_next_token(lexer, pQUESTION); - } + { return rbs_next_token(lexer, pQUESTION); } #line 428 "src/lexer.c" - yy36: - yyaccept = 0; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych <= '_') { - if (yych <= '@') { - if (yych <= '?') goto yy3; - goto yy105; - } else { - if (yych <= 'Z') goto yy106; - if (yych <= '^') goto yy3; - goto yy106; - } - } else { - if (yych <= 'q') { - if (yych <= '`') goto yy3; - goto yy106; - } else { - if (yych <= 'r') goto yy109; - if (yych <= 'z') goto yy106; - goto yy3; - } - } - yy37: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy37; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy38; - if (yych <= 'Z') goto yy37; - } else { - if (yych == '`') goto yy38; - if (yych <= 'z') goto yy37; - } - } - yy38: -#line 137 "src/lexer.re" - { - return rbs_next_token(lexer, tUIDENT); - } +yy36: + yyaccept = 0; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych <= '_') { + if (yych <= '@') { + if (yych <= '?') goto yy3; + goto yy105; + } else { + if (yych <= 'Z') goto yy106; + if (yych <= '^') goto yy3; + goto yy106; + } + } else { + if (yych <= 'q') { + if (yych <= '`') goto yy3; + goto yy106; + } else { + if (yych <= 'r') goto yy109; + if (yych <= 'z') goto yy106; + goto yy3; + } + } +yy37: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy37; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy38; + if (yych <= 'Z') goto yy37; + } else { + if (yych == '`') goto yy38; + if (yych <= 'z') goto yy37; + } + } +yy38: +#line 138 "src/lexer.re" + { return rbs_next_token(lexer, tUIDENT); } #line 475 "src/lexer.c" - yy39: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == ']') goto yy112; +yy39: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == ']') goto yy112; #line 26 "src/lexer.re" - { - return rbs_next_token(lexer, pLBRACKET); - } + { return rbs_next_token(lexer, pLBRACKET); } #line 482 "src/lexer.c" - yy40: - rbs_skip(lexer); +yy40: + rbs_skip(lexer); #line 27 "src/lexer.re" - { - return rbs_next_token(lexer, pRBRACKET); - } + { return rbs_next_token(lexer, pRBRACKET); } #line 487 "src/lexer.c" - yy41: - rbs_skip(lexer); +yy41: + rbs_skip(lexer); #line 32 "src/lexer.re" - { - return rbs_next_token(lexer, pHAT); - } + { return rbs_next_token(lexer, pHAT); } #line 492 "src/lexer.c" - yy42: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy113; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy43; - if (yych <= 'Z') goto yy116; - } else { - if (yych <= '_') goto yy118; - if (yych <= '`') goto yy43; - if (yych <= 'z') goto yy113; - } - } - yy43: -#line 140 "src/lexer.re" - { - return rbs_next_token(lexer, tULLIDENT); - } +yy42: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy113; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy43; + if (yych <= 'Z') goto yy116; + } else { + if (yych <= '_') goto yy118; + if (yych <= '`') goto yy43; + if (yych <= 'z') goto yy113; + } + } +yy43: +#line 141 "src/lexer.re" + { return rbs_next_token(lexer, tULLIDENT); } #line 516 "src/lexer.c" - yy44: - yyaccept = 4; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych <= ' ') { - if (yych <= 0x00000000) goto yy45; - if (yych <= 0x0000001F) goto yy119; - } else { - if (yych != ':') goto yy119; - } - yy45: +yy44: + yyaccept = 4; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych <= ' ') { + if (yych <= 0x00000000) goto yy45; + if (yych <= 0x0000001F) goto yy119; + } else { + if (yych != ':') goto yy119; + } +yy45: #line 39 "src/lexer.re" - { - return rbs_next_token(lexer, tOPERATOR); - } + { return rbs_next_token(lexer, tOPERATOR); } #line 531 "src/lexer.c" - yy46: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 'r') { - if (yych == 'l') goto yy120; - goto yy54; - } else { - if (yych <= 's') goto yy121; - if (yych <= 't') goto yy123; - goto yy54; - } - yy47: -#line 136 "src/lexer.re" - { - return rbs_next_token(lexer, tLIDENT); - } +yy46: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 'r') { + if (yych == 'l') goto yy120; + goto yy54; + } else { + if (yych <= 's') goto yy121; + if (yych <= 't') goto yy123; + goto yy54; + } +yy47: +#line 137 "src/lexer.re" + { return rbs_next_token(lexer, tLIDENT); } #line 546 "src/lexer.c" - yy48: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'o') goto yy124; - goto yy54; - yy49: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy125; - goto yy54; - yy50: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy126; - goto yy54; - yy51: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'n') goto yy127; - if (yych == 'x') goto yy128; - goto yy54; - yy52: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy129; - goto yy54; - yy53: - rbs_skip(lexer); - yych = rbs_peek(lexer); - yy54: - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - goto yy47; - } else { - if (yych <= '9') goto yy53; - if (yych <= '<') goto yy47; - goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy47; - if (yych <= 'Z') goto yy53; - goto yy47; - } else { - if (yych == '`') goto yy47; - if (yych <= 'z') goto yy53; - goto yy47; - } - } - yy55: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'n') goto yy130; - goto yy54; - yy56: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'o') goto yy132; - goto yy54; - yy57: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'i') goto yy133; - goto yy54; - yy58: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'u') goto yy134; - goto yy54; - yy59: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'r') goto yy135; - if (yych == 'u') goto yy136; - goto yy54; - yy60: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy137; - goto yy54; - yy61: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 'h') { - if (yych == 'e') goto yy138; - goto yy54; - } else { - if (yych <= 'i') goto yy139; - if (yych == 'k') goto yy140; - goto yy54; - } - yy62: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 'q') { - if (yych == 'o') goto yy141; - goto yy54; - } else { - if (yych <= 'r') goto yy142; - if (yych == 'y') goto yy143; - goto yy54; - } - yy63: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'n') goto yy144; - if (yych == 's') goto yy145; - goto yy54; - yy64: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'o') goto yy146; - goto yy54; - yy65: - rbs_skip(lexer); +yy48: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'o') goto yy124; + goto yy54; +yy49: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy125; + goto yy54; +yy50: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy126; + goto yy54; +yy51: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'n') goto yy127; + if (yych == 'x') goto yy128; + goto yy54; +yy52: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy129; + goto yy54; +yy53: + rbs_skip(lexer); + yych = rbs_peek(lexer); +yy54: + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + goto yy47; + } else { + if (yych <= '9') goto yy53; + if (yych <= '<') goto yy47; + goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy47; + if (yych <= 'Z') goto yy53; + goto yy47; + } else { + if (yych == '`') goto yy47; + if (yych <= 'z') goto yy53; + goto yy47; + } + } +yy55: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'n') goto yy130; + goto yy54; +yy56: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'o') goto yy132; + goto yy54; +yy57: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'i') goto yy133; + goto yy54; +yy58: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'u') goto yy134; + goto yy54; +yy59: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'r') goto yy135; + if (yych == 'u') goto yy136; + goto yy54; +yy60: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy137; + goto yy54; +yy61: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 'h') { + if (yych == 'e') goto yy138; + goto yy54; + } else { + if (yych <= 'i') goto yy139; + if (yych == 'k') goto yy140; + goto yy54; + } +yy62: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 'q') { + if (yych == 'o') goto yy141; + goto yy54; + } else { + if (yych <= 'r') goto yy142; + if (yych == 'y') goto yy143; + goto yy54; + } +yy63: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'n') goto yy144; + if (yych == 's') goto yy145; + goto yy54; +yy64: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'o') goto yy146; + goto yy54; +yy65: + rbs_skip(lexer); #line 28 "src/lexer.re" - { - return rbs_next_token(lexer, pLBRACE); - } + { return rbs_next_token(lexer, pLBRACE); } #line 665 "src/lexer.c" - yy66: - rbs_skip(lexer); +yy66: + rbs_skip(lexer); #line 31 "src/lexer.re" - { - return rbs_next_token(lexer, pBAR); - } + { return rbs_next_token(lexer, pBAR); } #line 670 "src/lexer.c" - yy67: - rbs_skip(lexer); +yy67: + rbs_skip(lexer); #line 29 "src/lexer.re" - { - return rbs_next_token(lexer, pRBRACE); - } + { return rbs_next_token(lexer, pRBRACE); } #line 675 "src/lexer.c" - yy68: - rbs_skip(lexer); - yych = rbs_peek(lexer); - yy69: - if (yych <= '"') { - if (yych <= 0x00000000) goto yy70; - if (yych <= '!') goto yy68; - goto yy71; - } else { - if (yych == '\\') goto yy72; - goto yy68; - } - yy70: - *lexer = backup; - if (yyaccept <= 4) { - if (yyaccept <= 2) { - if (yyaccept <= 1) { - if (yyaccept == 0) goto yy3; - else - goto yy8; - } else { - goto yy23; - } - } else { - if (yyaccept == 3) goto yy28; - else - goto yy45; - } - } else { - if (yyaccept <= 6) { - if (yyaccept == 5) goto yy80; - else - goto yy162; - } else { - if (yyaccept == 7) goto yy262; - else - goto yy290; - } - } - yy71: - rbs_skip(lexer); -#line 114 "src/lexer.re" - { - return rbs_next_token(lexer, tDQSTRING); - } -#line 715 "src/lexer.c" - yy72: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'u') goto yy147; - if (yych == 'x') goto yy148; - goto yy68; - yy73: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= ',') { - if (yych <= '\f') { - if (yych <= 0x00000000) goto yy74; - if (yych <= 0x00000008) goto yy73; - if (yych >= '\v') goto yy73; - } else { - if (yych <= 0x0000001F) { - if (yych >= 0x0000000E) goto yy73; - } else { - if (yych == '#') goto yy73; - } - } - } else { - if (yych <= '>') { - if (yych <= '-') goto yy73; - if (yych <= '/') goto yy74; - if (yych <= '9') goto yy73; - } else { - if (yych <= '^') { - if (yych <= 'Z') goto yy73; - } else { - if (yych <= 'z') goto yy73; - if (yych >= 0x0000007F) goto yy73; - } - } - } - yy74: -#line 147 "src/lexer.re" - { - return rbs_next_token(lexer, tGIDENT); - } -#line 754 "src/lexer.c" - yy75: - rbs_skip(lexer); - goto yy74; - yy76: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 'Z') { - if (yych <= '(') { - if (yych <= '\'') goto yy70; - goto yy149; - } else { - if (yych == '<') goto yy150; - goto yy70; - } - } else { - if (yych <= 'z') { - if (yych <= '[') goto yy151; - goto yy70; - } else { - if (yych <= '{') goto yy152; - if (yych <= '|') goto yy153; - goto yy70; - } - } - yy77: - rbs_skip(lexer); - yych = rbs_peek(lexer); - yy78: - if (yych <= '\'') { - if (yych <= 0x00000000) goto yy70; - if (yych <= '&') goto yy77; - } else { - if (yych == '\\') goto yy81; - goto yy77; - } - yy79: - rbs_skip(lexer); - yy80: +yy68: + rbs_skip(lexer); + yych = rbs_peek(lexer); +yy69: + if (yych <= '"') { + if (yych <= 0x00000000) goto yy70; + if (yych <= '!') goto yy68; + goto yy71; + } else { + if (yych == '\\') goto yy72; + goto yy68; + } +yy70: + *lexer = backup; + if (yyaccept <= 4) { + if (yyaccept <= 2) { + if (yyaccept <= 1) { + if (yyaccept == 0) { + goto yy3; + } else { + goto yy8; + } + } else { + goto yy23; + } + } else { + if (yyaccept == 3) { + goto yy28; + } else { + goto yy45; + } + } + } else { + if (yyaccept <= 6) { + if (yyaccept == 5) { + goto yy80; + } else { + goto yy162; + } + } else { + if (yyaccept == 7) { + goto yy264; + } else { + goto yy293; + } + } + } +yy71: + rbs_skip(lexer); #line 115 "src/lexer.re" - { - return rbs_next_token(lexer, tSQSTRING); - } -#line 795 "src/lexer.c" - yy81: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '\'') { - if (yych <= 0x00000000) goto yy70; - if (yych <= '&') goto yy77; - goto yy154; - } else { - if (yych == '\\') goto yy81; - goto yy77; - } - yy82: - rbs_skip(lexer); + { return rbs_next_token(lexer, tDQSTRING); } +#line 727 "src/lexer.c" +yy72: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'u') goto yy147; + if (yych == 'x') goto yy148; + goto yy68; +yy73: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= ',') { + if (yych <= '\f') { + if (yych <= 0x00000000) goto yy74; + if (yych <= 0x00000008) goto yy73; + if (yych >= '\v') goto yy73; + } else { + if (yych <= 0x0000001F) { + if (yych >= 0x0000000E) goto yy73; + } else { + if (yych == '#') goto yy73; + } + } + } else { + if (yych <= '>') { + if (yych <= '-') goto yy73; + if (yych <= '/') goto yy74; + if (yych <= '9') goto yy73; + } else { + if (yych <= '^') { + if (yych <= 'Z') goto yy73; + } else { + if (yych <= 'z') goto yy73; + if (yych >= 0x0000007F) goto yy73; + } + } + } +yy74: +#line 148 "src/lexer.re" + { return rbs_next_token(lexer, tGIDENT); } +#line 766 "src/lexer.c" +yy75: + rbs_skip(lexer); + goto yy74; +yy76: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 'Z') { + if (yych <= '(') { + if (yych <= '\'') goto yy70; + goto yy149; + } else { + if (yych == '<') goto yy150; + goto yy70; + } + } else { + if (yych <= 'z') { + if (yych <= '[') goto yy151; + goto yy70; + } else { + if (yych <= '{') goto yy152; + if (yych <= '|') goto yy153; + goto yy70; + } + } +yy77: + rbs_skip(lexer); + yych = rbs_peek(lexer); +yy78: + if (yych <= '\'') { + if (yych <= 0x00000000) goto yy70; + if (yych <= '&') goto yy77; + } else { + if (yych == '\\') goto yy81; + goto yy77; + } +yy79: + rbs_skip(lexer); +yy80: +#line 116 "src/lexer.re" + { return rbs_next_token(lexer, tSQSTRING); } +#line 807 "src/lexer.c" +yy81: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '\'') { + if (yych <= 0x00000000) goto yy70; + if (yych <= '&') goto yy77; + goto yy154; + } else { + if (yych == '\\') goto yy81; + goto yy77; + } +yy82: + rbs_skip(lexer); #line 36 "src/lexer.re" - { - return rbs_next_token(lexer, pSTAR2); - } -#line 811 "src/lexer.c" - yy83: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych >= 0x00000001) goto yy83; + { return rbs_next_token(lexer, pSTAR2); } +#line 823 "src/lexer.c" +yy83: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych >= 0x00000001) goto yy83; #line 50 "src/lexer.re" - { - return rbs_next_token(lexer, tINLINECOMMENT); - } -#line 818 "src/lexer.c" - yy84: - rbs_skip(lexer); + { return rbs_next_token(lexer, tINLINECOMMENT); } +#line 830 "src/lexer.c" +yy84: + rbs_skip(lexer); #line 41 "src/lexer.re" - { - return rbs_next_token(lexer, pARROW); - } -#line 823 "src/lexer.c" - yy85: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '.') goto yy155; - goto yy70; - yy86: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '=') goto yy90; - if (yych == '~') goto yy90; - yy87: -#line 134 "src/lexer.re" - { - return rbs_next_token(lexer, tSYMBOL); - } -#line 837 "src/lexer.c" - yy88: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '"') { - if (yych <= 0x00000000) goto yy70; - if (yych <= '!') goto yy88; - goto yy156; - } else { - if (yych == '\\') goto yy157; - goto yy88; - } - yy89: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= ')') { - if (yych <= 0x0000001F) { - if (yych <= '\n') { - if (yych <= 0x00000000) goto yy70; - if (yych <= 0x00000008) goto yy158; - goto yy70; - } else { - if (yych == '\r') goto yy70; - goto yy158; - } - } else { - if (yych <= '#') { - if (yych <= ' ') goto yy70; - if (yych <= '"') goto yy160; - goto yy158; - } else { - if (yych == '%') goto yy70; - if (yych <= '\'') goto yy160; - goto yy70; - } - } - } else { - if (yych <= 'Z') { - if (yych <= '/') { - if (yych == '-') goto yy158; - goto yy160; - } else { - if (yych <= '9') goto yy158; - if (yych <= '>') goto yy160; - goto yy158; - } - } else { - if (yych <= '^') { - if (yych == '\\') goto yy160; - goto yy70; - } else { - if (yych <= 'z') goto yy158; - if (yych <= '}') goto yy70; - if (yych <= '~') goto yy160; - goto yy158; - } - } - } - yy90: - rbs_skip(lexer); - goto yy87; - yy91: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '\'') { - if (yych <= 0x00000000) goto yy70; - if (yych <= '&') goto yy91; - goto yy161; - } else { - if (yych == '\\') goto yy163; - goto yy91; - } - yy92: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '*') goto yy90; - goto yy87; - yy93: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '@') goto yy90; - goto yy87; - yy94: - rbs_skip(lexer); + { return rbs_next_token(lexer, pARROW); } +#line 835 "src/lexer.c" +yy85: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '.') goto yy155; + goto yy70; +yy86: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '=') goto yy90; + if (yych == '~') goto yy90; +yy87: +#line 135 "src/lexer.re" + { return rbs_next_token(lexer, tSYMBOL); } +#line 849 "src/lexer.c" +yy88: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '"') { + if (yych <= 0x00000000) goto yy70; + if (yych <= '!') goto yy88; + goto yy156; + } else { + if (yych == '\\') goto yy157; + goto yy88; + } +yy89: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= ')') { + if (yych <= 0x0000001F) { + if (yych <= '\n') { + if (yych <= 0x00000000) goto yy70; + if (yych <= 0x00000008) goto yy158; + goto yy70; + } else { + if (yych == '\r') goto yy70; + goto yy158; + } + } else { + if (yych <= '#') { + if (yych <= ' ') goto yy70; + if (yych <= '"') goto yy160; + goto yy158; + } else { + if (yych == '%') goto yy70; + if (yych <= '\'') goto yy160; + goto yy70; + } + } + } else { + if (yych <= 'Z') { + if (yych <= '/') { + if (yych == '-') goto yy158; + goto yy160; + } else { + if (yych <= '9') goto yy158; + if (yych <= '>') goto yy160; + goto yy158; + } + } else { + if (yych <= '^') { + if (yych == '\\') goto yy160; + goto yy70; + } else { + if (yych <= 'z') goto yy158; + if (yych <= '}') goto yy70; + if (yych <= '~') goto yy160; + goto yy158; + } + } + } +yy90: + rbs_skip(lexer); + goto yy87; +yy91: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '\'') { + if (yych <= 0x00000000) goto yy70; + if (yych <= '&') goto yy91; + goto yy161; + } else { + if (yych == '\\') goto yy163; + goto yy91; + } +yy92: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '*') goto yy90; + goto yy87; +yy93: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '@') goto yy90; + goto yy87; +yy94: + rbs_skip(lexer); #line 45 "src/lexer.re" - { - return rbs_next_token(lexer, pCOLON2); - } -#line 923 "src/lexer.c" - yy95: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= ';') goto yy87; - if (yych <= '<') goto yy90; - if (yych <= '=') goto yy164; - goto yy87; - yy96: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '=') goto yy165; - if (yych == '~') goto yy90; - goto yy70; - yy97: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '<') goto yy87; - if (yych <= '>') goto yy90; - goto yy87; - yy98: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '^') { - if (yych <= '?') goto yy70; - if (yych <= '@') goto yy166; - if (yych <= 'Z') goto yy167; - goto yy70; - } else { - if (yych == '`') goto yy70; - if (yych <= 'z') goto yy167; - goto yy70; - } - yy99: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '>') { - if (yych <= '/') { - if (yych == '!') goto yy169; - } else { - if (yych <= '9') goto yy99; - if (yych == '=') goto yy169; - } - } else { - if (yych <= '^') { - if (yych <= '?') goto yy169; - if (yych <= '@') goto yy100; - if (yych <= 'Z') goto yy99; - } else { - if (yych == '`') goto yy100; - if (yych <= 'z') goto yy99; - } - } - yy100: -#line 130 "src/lexer.re" - { - return rbs_next_token(lexer, tSYMBOL); - } -#line 979 "src/lexer.c" - yy101: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == ']') goto yy165; - goto yy70; - yy102: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '>') goto yy24; - goto yy8; - yy103: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '=') goto yy24; - goto yy8; - yy104: - rbs_skip(lexer); + { return rbs_next_token(lexer, pCOLON2); } +#line 935 "src/lexer.c" +yy95: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= ';') goto yy87; + if (yych <= '<') goto yy90; + if (yych <= '=') goto yy164; + goto yy87; +yy96: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '=') goto yy165; + if (yych == '~') goto yy90; + goto yy70; +yy97: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '<') goto yy87; + if (yych <= '>') goto yy90; + goto yy87; +yy98: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '^') { + if (yych <= '?') goto yy70; + if (yych <= '@') goto yy166; + if (yych <= 'Z') goto yy167; + goto yy70; + } else { + if (yych == '`') goto yy70; + if (yych <= 'z') goto yy167; + goto yy70; + } +yy99: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '>') { + if (yych <= '/') { + if (yych == '!') goto yy169; + } else { + if (yych <= '9') goto yy99; + if (yych == '=') goto yy169; + } + } else { + if (yych <= '^') { + if (yych <= '?') goto yy169; + if (yych <= '@') goto yy100; + if (yych <= 'Z') goto yy99; + } else { + if (yych == '`') goto yy100; + if (yych <= 'z') goto yy99; + } + } +yy100: +#line 131 "src/lexer.re" + { return rbs_next_token(lexer, tSYMBOL); } +#line 991 "src/lexer.c" +yy101: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == ']') goto yy165; + goto yy70; +yy102: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '>') goto yy24; + goto yy8; +yy103: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '=') goto yy24; + goto yy8; +yy104: + rbs_skip(lexer); #line 42 "src/lexer.re" - { - return rbs_next_token(lexer, pFATARROW); - } -#line 999 "src/lexer.c" - yy105: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '^') { - if (yych <= '@') goto yy70; - if (yych <= 'Z') goto yy170; - goto yy70; - } else { - if (yych == '`') goto yy70; - if (yych <= 'z') goto yy170; - goto yy70; - } - yy106: - rbs_skip(lexer); - yych = rbs_peek(lexer); - yy107: - if (yych <= 'Z') { - if (yych <= '/') goto yy108; - if (yych <= '9') goto yy106; - if (yych >= 'A') goto yy106; - } else { - if (yych <= '_') { - if (yych >= '_') goto yy106; - } else { - if (yych <= '`') goto yy108; - if (yych <= 'z') goto yy106; - } - } - yy108: -#line 144 "src/lexer.re" - { - return rbs_next_token(lexer, tAIDENT); - } -#line 1031 "src/lexer.c" - yy109: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'b') goto yy172; - goto yy107; - yy110: - rbs_skip(lexer); -#line 141 "src/lexer.re" - { - return rbs_next_token(lexer, tBANGIDENT); - } -#line 1041 "src/lexer.c" - yy111: - rbs_skip(lexer); + { return rbs_next_token(lexer, pFATARROW); } +#line 1011 "src/lexer.c" +yy105: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '^') { + if (yych <= '@') goto yy70; + if (yych <= 'Z') goto yy170; + goto yy70; + } else { + if (yych == '`') goto yy70; + if (yych <= 'z') goto yy170; + goto yy70; + } +yy106: + rbs_skip(lexer); + yych = rbs_peek(lexer); +yy107: + if (yych <= 'Z') { + if (yych <= '/') goto yy108; + if (yych <= '9') goto yy106; + if (yych >= 'A') goto yy106; + } else { + if (yych <= '_') { + if (yych >= '_') goto yy106; + } else { + if (yych <= '`') goto yy108; + if (yych <= 'z') goto yy106; + } + } +yy108: +#line 145 "src/lexer.re" + { return rbs_next_token(lexer, tAIDENT); } +#line 1043 "src/lexer.c" +yy109: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'b') goto yy172; + goto yy107; +yy110: + rbs_skip(lexer); #line 142 "src/lexer.re" - { - return rbs_next_token(lexer, tEQIDENT); - } -#line 1046 "src/lexer.c" - yy112: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '=') goto yy24; -#line 48 "src/lexer.re" - { - return rbs_next_token(lexer, pAREF_OPR); - } + { return rbs_next_token(lexer, tBANGIDENT); } #line 1053 "src/lexer.c" - yy113: - rbs_skip(lexer); - yych = rbs_peek(lexer); - yy114: - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy113; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy115; - if (yych <= 'Z') goto yy113; - } else { - if (yych == '`') goto yy115; - if (yych <= 'z') goto yy113; - } - } - yy115: -#line 138 "src/lexer.re" - { - return rbs_next_token(lexer, tULLIDENT); - } -#line 1077 "src/lexer.c" - yy116: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy116; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy117; - if (yych <= 'Z') goto yy116; - } else { - if (yych == '`') goto yy117; - if (yych <= 'z') goto yy116; - } - } - yy117: +yy111: + rbs_skip(lexer); +#line 143 "src/lexer.re" + { return rbs_next_token(lexer, tEQIDENT); } +#line 1058 "src/lexer.c" +yy112: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '=') goto yy24; +#line 48 "src/lexer.re" + { return rbs_next_token(lexer, pAREF_OPR); } +#line 1065 "src/lexer.c" +yy113: + rbs_skip(lexer); + yych = rbs_peek(lexer); +yy114: + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy113; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy115; + if (yych <= 'Z') goto yy113; + } else { + if (yych == '`') goto yy115; + if (yych <= 'z') goto yy113; + } + } +yy115: #line 139 "src/lexer.re" - { - return rbs_next_token(lexer, tULIDENT); - } -#line 1100 "src/lexer.c" - yy118: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 't') goto yy173; - goto yy114; - yy119: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 0x00000000) goto yy70; - if (yych == '`') goto yy174; - goto yy119; - yy120: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'i') goto yy175; - goto yy54; - yy121: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy122; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy122; - if (yych <= 'z') goto yy53; - } - } - yy122: -#line 101 "src/lexer.re" - { - return rbs_next_token(lexer, kAS); - } -#line 1139 "src/lexer.c" - yy123: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 't') goto yy176; - goto yy54; - yy124: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'o') goto yy177; - if (yych == 't') goto yy178; - goto yy54; - yy125: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy180; - goto yy54; - yy126: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'f') goto yy181; - goto yy54; - yy127: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy183; - goto yy54; - yy128: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 't') goto yy185; - goto yy54; - yy129: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy186; - goto yy54; - yy130: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '^') { - if (yych <= '9') { - if (yych == '!') goto yy110; - if (yych >= '0') goto yy53; - } else { - if (yych <= '=') { - if (yych >= '=') goto yy111; - } else { - if (yych <= '@') goto yy131; - if (yych <= 'Z') goto yy53; - } - } - } else { - if (yych <= 'c') { - if (yych == '`') goto yy131; - if (yych <= 'b') goto yy53; - goto yy187; - } else { - if (yych <= 's') { - if (yych <= 'r') goto yy53; - goto yy188; - } else { - if (yych <= 't') goto yy189; - if (yych <= 'z') goto yy53; - } - } - } - yy131: + { return rbs_next_token(lexer, tULLIDENT); } +#line 1089 "src/lexer.c" +yy116: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy116; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy117; + if (yych <= 'Z') goto yy116; + } else { + if (yych == '`') goto yy117; + if (yych <= 'z') goto yy116; + } + } +yy117: +#line 140 "src/lexer.re" + { return rbs_next_token(lexer, tULIDENT); } +#line 1112 "src/lexer.c" +yy118: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy173; + goto yy114; +yy119: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 0x00000000) goto yy70; + if (yych == '`') goto yy174; + goto yy119; +yy120: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'i') goto yy175; + goto yy54; +yy121: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy122; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy122; + if (yych <= 'z') goto yy53; + } + } +yy122: +#line 102 "src/lexer.re" + { return rbs_next_token(lexer, kAS); } +#line 1151 "src/lexer.c" +yy123: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy176; + goto yy54; +yy124: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'o') goto yy177; + if (yych == 't') goto yy178; + goto yy54; +yy125: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy180; + goto yy54; +yy126: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'f') goto yy181; + goto yy54; +yy127: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy183; + goto yy54; +yy128: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy185; + goto yy54; +yy129: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy186; + goto yy54; +yy130: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '^') { + if (yych <= '9') { + if (yych == '!') goto yy110; + if (yych >= '0') goto yy53; + } else { + if (yych <= '=') { + if (yych >= '=') goto yy111; + } else { + if (yych <= '@') goto yy131; + if (yych <= 'Z') goto yy53; + } + } + } else { + if (yych <= 'c') { + if (yych == '`') goto yy131; + if (yych <= 'b') goto yy53; + goto yy187; + } else { + if (yych <= 's') { + if (yych <= 'r') goto yy53; + goto yy188; + } else { + if (yych <= 't') goto yy189; + if (yych <= 'z') goto yy53; + } + } + } +yy131: #line 80 "src/lexer.re" - { - return rbs_next_token(lexer, kIN); - } -#line 1209 "src/lexer.c" - yy132: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy190; - goto yy54; - yy133: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy191; - goto yy54; - yy134: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 't') goto yy193; - goto yy54; - yy135: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy195; - if (yych == 'i') goto yy196; - goto yy54; - yy136: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'b') goto yy197; - goto yy54; - yy137: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 't') goto yy198; - goto yy54; - yy138: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy199; - goto yy54; - yy139: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'n') goto yy200; - goto yy54; - yy140: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'i') goto yy201; - goto yy54; - yy141: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'p') goto yy202; - goto yy54; - yy142: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'u') goto yy204; - goto yy54; - yy143: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'p') goto yy205; - goto yy54; - yy144: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'c') goto yy206; - if (yych == 't') goto yy207; - goto yy54; - yy145: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy208; - goto yy54; - yy146: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'i') goto yy210; - goto yy54; - yy147: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '@') { - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy211; - goto yy70; - } else { - if (yych <= 'F') goto yy211; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy211; - goto yy70; - } - yy148: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy68; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy68; - goto yy70; - yy149: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 0x00000000) goto yy70; - if (yych == ')') goto yy212; - goto yy149; - yy150: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 0x00000000) goto yy70; - if (yych == '>') goto yy213; - goto yy150; - yy151: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 0x00000000) goto yy70; - if (yych == ']') goto yy214; - goto yy151; - yy152: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 0x00000000) goto yy70; - if (yych == '}') goto yy215; - goto yy152; - yy153: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 0x00000000) goto yy70; - if (yych == '|') goto yy216; - goto yy153; - yy154: - yyaccept = 5; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych <= '\'') { - if (yych <= 0x00000000) goto yy80; - if (yych <= '&') goto yy77; - goto yy79; - } else { - if (yych == '\\') goto yy81; - goto yy77; - } - yy155: - rbs_skip(lexer); + { return rbs_next_token(lexer, kIN); } +#line 1221 "src/lexer.c" +yy132: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy190; + goto yy54; +yy133: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy191; + goto yy54; +yy134: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy193; + goto yy54; +yy135: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 'h') { + if (yych == 'e') goto yy195; + goto yy54; + } else { + if (yych <= 'i') goto yy196; + if (yych == 'o') goto yy197; + goto yy54; + } +yy136: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'b') goto yy198; + goto yy54; +yy137: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy199; + goto yy54; +yy138: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy200; + goto yy54; +yy139: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'n') goto yy201; + goto yy54; +yy140: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'i') goto yy202; + goto yy54; +yy141: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'p') goto yy203; + goto yy54; +yy142: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'u') goto yy205; + goto yy54; +yy143: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'p') goto yy206; + goto yy54; +yy144: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'c') goto yy207; + if (yych == 't') goto yy208; + goto yy54; +yy145: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy209; + goto yy54; +yy146: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'i') goto yy211; + goto yy54; +yy147: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '@') { + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy212; + goto yy70; + } else { + if (yych <= 'F') goto yy212; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy212; + goto yy70; + } +yy148: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy68; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy68; + goto yy70; +yy149: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 0x00000000) goto yy70; + if (yych == ')') goto yy213; + goto yy149; +yy150: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 0x00000000) goto yy70; + if (yych == '>') goto yy214; + goto yy150; +yy151: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 0x00000000) goto yy70; + if (yych == ']') goto yy215; + goto yy151; +yy152: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 0x00000000) goto yy70; + if (yych == '}') goto yy216; + goto yy152; +yy153: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 0x00000000) goto yy70; + if (yych == '|') goto yy217; + goto yy153; +yy154: + yyaccept = 5; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych <= '\'') { + if (yych <= 0x00000000) goto yy80; + if (yych <= '&') goto yy77; + goto yy79; + } else { + if (yych == '\\') goto yy81; + goto yy77; + } +yy155: + rbs_skip(lexer); #line 38 "src/lexer.re" - { - return rbs_next_token(lexer, pDOT3); - } -#line 1355 "src/lexer.c" - yy156: - rbs_skip(lexer); -#line 116 "src/lexer.re" - { - return rbs_next_token(lexer, tDQSYMBOL); - } -#line 1360 "src/lexer.c" - yy157: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'u') goto yy217; - if (yych == 'x') goto yy218; - goto yy88; - yy158: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= ',') { - if (yych <= '\f') { - if (yych <= 0x00000000) goto yy159; - if (yych <= 0x00000008) goto yy158; - if (yych >= '\v') goto yy158; - } else { - if (yych <= 0x0000001F) { - if (yych >= 0x0000000E) goto yy158; - } else { - if (yych == '#') goto yy158; - } - } - } else { - if (yych <= '>') { - if (yych <= '-') goto yy158; - if (yych <= '/') goto yy159; - if (yych <= '9') goto yy158; - } else { - if (yych <= '^') { - if (yych <= 'Z') goto yy158; - } else { - if (yych <= 'z') goto yy158; - if (yych >= 0x0000007F) goto yy158; - } - } - } - yy159: -#line 133 "src/lexer.re" - { - return rbs_next_token(lexer, tSYMBOL); - } -#line 1399 "src/lexer.c" - yy160: - rbs_skip(lexer); - goto yy159; - yy161: - rbs_skip(lexer); - yy162: + { return rbs_next_token(lexer, pDOT3); } +#line 1372 "src/lexer.c" +yy156: + rbs_skip(lexer); #line 117 "src/lexer.re" - { - return rbs_next_token(lexer, tSQSYMBOL); - } -#line 1408 "src/lexer.c" - yy163: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '\'') { - if (yych <= 0x00000000) goto yy70; - if (yych <= '&') goto yy91; - goto yy219; - } else { - if (yych == '\\') goto yy163; - goto yy91; - } - yy164: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '>') goto yy90; - goto yy87; - yy165: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '=') goto yy90; - goto yy87; - yy166: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '^') { - if (yych <= '@') goto yy70; - if (yych <= 'Z') goto yy220; - goto yy70; - } else { - if (yych == '`') goto yy70; - if (yych <= 'z') goto yy220; - goto yy70; - } - yy167: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '>') { - if (yych <= '/') { - if (yych == '!') goto yy222; - } else { - if (yych <= '9') goto yy167; - if (yych == '=') goto yy222; - } - } else { - if (yych <= '^') { - if (yych <= '?') goto yy222; - if (yych <= '@') goto yy168; - if (yych <= 'Z') goto yy167; - } else { - if (yych == '`') goto yy168; - if (yych <= 'z') goto yy167; - } - } - yy168: -#line 131 "src/lexer.re" - { - return rbs_next_token(lexer, tSYMBOL); - } -#line 1465 "src/lexer.c" - yy169: - rbs_skip(lexer); - goto yy100; - yy170: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 'Z') { - if (yych <= '/') goto yy171; - if (yych <= '9') goto yy170; - if (yych >= 'A') goto yy170; - } else { - if (yych <= '_') { - if (yych >= '_') goto yy170; - } else { - if (yych <= '`') goto yy171; - if (yych <= 'z') goto yy170; - } - } - yy171: -#line 145 "src/lexer.re" - { - return rbs_next_token(lexer, tA2IDENT); - } -#line 1487 "src/lexer.c" - yy172: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 's') goto yy223; - goto yy107; - yy173: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'o') goto yy225; - goto yy114; - yy174: - rbs_skip(lexer); + { return rbs_next_token(lexer, tDQSYMBOL); } +#line 1377 "src/lexer.c" +yy157: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'u') goto yy218; + if (yych == 'x') goto yy219; + goto yy88; +yy158: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= ',') { + if (yych <= '\f') { + if (yych <= 0x00000000) goto yy159; + if (yych <= 0x00000008) goto yy158; + if (yych >= '\v') goto yy158; + } else { + if (yych <= 0x0000001F) { + if (yych >= 0x0000000E) goto yy158; + } else { + if (yych == '#') goto yy158; + } + } + } else { + if (yych <= '>') { + if (yych <= '-') goto yy158; + if (yych <= '/') goto yy159; + if (yych <= '9') goto yy158; + } else { + if (yych <= '^') { + if (yych <= 'Z') goto yy158; + } else { + if (yych <= 'z') goto yy158; + if (yych >= 0x0000007F) goto yy158; + } + } + } +yy159: +#line 134 "src/lexer.re" + { return rbs_next_token(lexer, tSYMBOL); } +#line 1416 "src/lexer.c" +yy160: + rbs_skip(lexer); + goto yy159; +yy161: + rbs_skip(lexer); +yy162: +#line 118 "src/lexer.re" + { return rbs_next_token(lexer, tSQSYMBOL); } +#line 1425 "src/lexer.c" +yy163: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '\'') { + if (yych <= 0x00000000) goto yy70; + if (yych <= '&') goto yy91; + goto yy220; + } else { + if (yych == '\\') goto yy163; + goto yy91; + } +yy164: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '>') goto yy90; + goto yy87; +yy165: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '=') goto yy90; + goto yy87; +yy166: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '^') { + if (yych <= '@') goto yy70; + if (yych <= 'Z') goto yy221; + goto yy70; + } else { + if (yych == '`') goto yy70; + if (yych <= 'z') goto yy221; + goto yy70; + } +yy167: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '>') { + if (yych <= '/') { + if (yych == '!') goto yy223; + } else { + if (yych <= '9') goto yy167; + if (yych == '=') goto yy223; + } + } else { + if (yych <= '^') { + if (yych <= '?') goto yy223; + if (yych <= '@') goto yy168; + if (yych <= 'Z') goto yy167; + } else { + if (yych == '`') goto yy168; + if (yych <= 'z') goto yy167; + } + } +yy168: +#line 132 "src/lexer.re" + { return rbs_next_token(lexer, tSYMBOL); } +#line 1482 "src/lexer.c" +yy169: + rbs_skip(lexer); + goto yy100; +yy170: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 'Z') { + if (yych <= '/') goto yy171; + if (yych <= '9') goto yy170; + if (yych >= 'A') goto yy170; + } else { + if (yych <= '_') { + if (yych >= '_') goto yy170; + } else { + if (yych <= '`') goto yy171; + if (yych <= 'z') goto yy170; + } + } +yy171: +#line 146 "src/lexer.re" + { return rbs_next_token(lexer, tA2IDENT); } +#line 1504 "src/lexer.c" +yy172: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 's') goto yy224; + goto yy107; +yy173: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'o') goto yy226; + goto yy114; +yy174: + rbs_skip(lexer); #line 40 "src/lexer.re" - { - return rbs_next_token(lexer, tQIDENT); - } -#line 1502 "src/lexer.c" - yy175: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy226; - goto yy54; - yy176: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'r') goto yy227; - goto yy54; - yy177: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy228; - goto yy54; - yy178: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy179; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy179; - if (yych <= 'z') goto yy53; - } - } - yy179: + { return rbs_next_token(lexer, tQIDENT); } +#line 1519 "src/lexer.c" +yy175: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy227; + goto yy54; +yy176: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'r') goto yy228; + goto yy54; +yy177: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy229; + goto yy54; +yy178: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy179; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy179; + if (yych <= 'z') goto yy53; + } + } +yy179: #line 73 "src/lexer.re" - { - return rbs_next_token(lexer, kBOT); - } -#line 1540 "src/lexer.c" - yy180: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 's') goto yy230; - goto yy54; - yy181: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy182; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy182; - if (yych <= 'z') goto yy53; - } - } - yy182: + { return rbs_next_token(lexer, kBOT); } +#line 1557 "src/lexer.c" +yy180: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 's') goto yy231; + goto yy54; +yy181: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy182; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy182; + if (yych <= 'z') goto yy53; + } + } +yy182: #line 76 "src/lexer.re" - { - return rbs_next_token(lexer, kDEF); - } -#line 1568 "src/lexer.c" - yy183: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy184; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy184; - if (yych <= 'z') goto yy53; - } - } - yy184: + { return rbs_next_token(lexer, kDEF); } +#line 1585 "src/lexer.c" +yy183: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy184; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy184; + if (yych <= 'z') goto yy53; + } + } +yy184: #line 77 "src/lexer.re" - { - return rbs_next_token(lexer, kEND); - } -#line 1591 "src/lexer.c" - yy185: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy231; - goto yy54; - yy186: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 's') goto yy232; - goto yy54; - yy187: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy233; - goto yy54; - yy188: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 't') goto yy234; - goto yy54; - yy189: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy235; - goto yy54; - yy190: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'u') goto yy236; - goto yy54; - yy191: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy192; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy192; - if (yych <= 'z') goto yy53; - } - } - yy192: + { return rbs_next_token(lexer, kEND); } +#line 1608 "src/lexer.c" +yy185: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy232; + goto yy54; +yy186: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 's') goto yy233; + goto yy54; +yy187: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy234; + goto yy54; +yy188: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy235; + goto yy54; +yy189: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy236; + goto yy54; +yy190: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'u') goto yy237; + goto yy54; +yy191: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy192; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy192; + if (yych <= 'z') goto yy53; + } + } +yy192: #line 87 "src/lexer.re" - { - return rbs_next_token(lexer, kNIL); - } -#line 1644 "src/lexer.c" - yy193: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy194; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy194; - if (yych <= 'z') goto yy53; - } - } - yy194: + { return rbs_next_token(lexer, kNIL); } +#line 1661 "src/lexer.c" +yy193: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy194; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy194; + if (yych <= 'z') goto yy53; + } + } +yy194: #line 88 "src/lexer.re" - { - return rbs_next_token(lexer, kOUT); - } -#line 1667 "src/lexer.c" - yy195: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'p') goto yy237; - goto yy54; - yy196: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'v') goto yy238; - goto yy54; - yy197: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy239; - goto yy54; - yy198: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'u') goto yy240; - goto yy54; - yy199: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'f') goto yy241; - goto yy54; - yy200: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'g') goto yy243; - goto yy54; - yy201: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'p') goto yy244; - goto yy54; - yy202: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy203; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy203; - if (yych <= 'z') goto yy53; - } - } - yy203: -#line 94 "src/lexer.re" - { - return rbs_next_token(lexer, kTOP); - } -#line 1725 "src/lexer.c" - yy204: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy246; - goto yy54; - yy205: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy248; - goto yy54; - yy206: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'h') goto yy250; - goto yy54; - yy207: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'y') goto yy251; - goto yy54; - yy208: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy209; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy209; - if (yych <= 'z') goto yy53; - } - } - yy209: -#line 100 "src/lexer.re" - { - return rbs_next_token(lexer, kUSE); - } -#line 1768 "src/lexer.c" - yy210: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy252; - goto yy54; - yy211: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '@') { - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy254; - goto yy70; - } else { - if (yych <= 'F') goto yy254; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy254; - goto yy70; - } - yy212: - rbs_skip(lexer); + { return rbs_next_token(lexer, kOUT); } +#line 1684 "src/lexer.c" +yy195: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'p') goto yy238; + goto yy54; +yy196: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'v') goto yy239; + goto yy54; +yy197: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy240; + goto yy54; +yy198: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy241; + goto yy54; +yy199: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'u') goto yy242; + goto yy54; +yy200: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'f') goto yy243; + goto yy54; +yy201: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'g') goto yy245; + goto yy54; +yy202: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'p') goto yy246; + goto yy54; +yy203: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy204; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy204; + if (yych <= 'z') goto yy53; + } + } +yy204: +#line 95 "src/lexer.re" + { return rbs_next_token(lexer, kTOP); } +#line 1747 "src/lexer.c" +yy205: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy248; + goto yy54; +yy206: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy250; + goto yy54; +yy207: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'h') goto yy252; + goto yy54; +yy208: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'y') goto yy253; + goto yy54; +yy209: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy210; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy210; + if (yych <= 'z') goto yy53; + } + } +yy210: +#line 101 "src/lexer.re" + { return rbs_next_token(lexer, kUSE); } +#line 1790 "src/lexer.c" +yy211: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy254; + goto yy54; +yy212: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '@') { + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy256; + goto yy70; + } else { + if (yych <= 'F') goto yy256; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy256; + goto yy70; + } +yy213: + rbs_skip(lexer); #line 56 "src/lexer.re" - { - return rbs_next_token(lexer, tANNOTATION); - } -#line 1791 "src/lexer.c" - yy213: - rbs_skip(lexer); + { return rbs_next_token(lexer, tANNOTATION); } +#line 1813 "src/lexer.c" +yy214: + rbs_skip(lexer); #line 59 "src/lexer.re" - { - return rbs_next_token(lexer, tANNOTATION); - } -#line 1796 "src/lexer.c" - yy214: - rbs_skip(lexer); + { return rbs_next_token(lexer, tANNOTATION); } +#line 1818 "src/lexer.c" +yy215: + rbs_skip(lexer); #line 57 "src/lexer.re" - { - return rbs_next_token(lexer, tANNOTATION); - } -#line 1801 "src/lexer.c" - yy215: - rbs_skip(lexer); + { return rbs_next_token(lexer, tANNOTATION); } +#line 1823 "src/lexer.c" +yy216: + rbs_skip(lexer); #line 55 "src/lexer.re" - { - return rbs_next_token(lexer, tANNOTATION); - } -#line 1806 "src/lexer.c" - yy216: - rbs_skip(lexer); + { return rbs_next_token(lexer, tANNOTATION); } +#line 1828 "src/lexer.c" +yy217: + rbs_skip(lexer); #line 58 "src/lexer.re" - { - return rbs_next_token(lexer, tANNOTATION); - } -#line 1811 "src/lexer.c" - yy217: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '@') { - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy255; - goto yy70; - } else { - if (yych <= 'F') goto yy255; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy255; - goto yy70; - } - yy218: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy88; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy88; - goto yy70; - yy219: - yyaccept = 6; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych <= '\'') { - if (yych <= 0x00000000) goto yy162; - if (yych <= '&') goto yy91; - goto yy161; - } else { - if (yych == '\\') goto yy163; - goto yy91; - } - yy220: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '>') { - if (yych <= '/') { - if (yych == '!') goto yy256; - } else { - if (yych <= '9') goto yy220; - if (yych == '=') goto yy256; - } - } else { - if (yych <= '^') { - if (yych <= '?') goto yy256; - if (yych <= '@') goto yy221; - if (yych <= 'Z') goto yy220; - } else { - if (yych == '`') goto yy221; - if (yych <= 'z') goto yy220; - } - } - yy221: -#line 132 "src/lexer.re" - { - return rbs_next_token(lexer, tSYMBOL); - } -#line 1869 "src/lexer.c" - yy222: - rbs_skip(lexer); - goto yy168; - yy223: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 'Z') { - if (yych <= '/') goto yy224; - if (yych <= '9') goto yy106; - if (yych >= 'A') goto yy106; - } else { - if (yych <= '_') { - if (yych >= '_') goto yy106; - } else { - if (yych <= '`') goto yy224; - if (yych <= 'z') goto yy106; - } - } - yy224: -#line 103 "src/lexer.re" - { - return rbs_next_token(lexer, kATRBS); - } + { return rbs_next_token(lexer, tANNOTATION); } +#line 1833 "src/lexer.c" +yy218: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '@') { + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy257; + goto yy70; + } else { + if (yych <= 'F') goto yy257; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy257; + goto yy70; + } +yy219: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy88; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy88; + goto yy70; +yy220: + yyaccept = 6; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych <= '\'') { + if (yych <= 0x00000000) goto yy162; + if (yych <= '&') goto yy91; + goto yy161; + } else { + if (yych == '\\') goto yy163; + goto yy91; + } +yy221: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '>') { + if (yych <= '/') { + if (yych == '!') goto yy258; + } else { + if (yych <= '9') goto yy221; + if (yych == '=') goto yy258; + } + } else { + if (yych <= '^') { + if (yych <= '?') goto yy258; + if (yych <= '@') goto yy222; + if (yych <= 'Z') goto yy221; + } else { + if (yych == '`') goto yy222; + if (yych <= 'z') goto yy221; + } + } +yy222: +#line 133 "src/lexer.re" + { return rbs_next_token(lexer, tSYMBOL); } #line 1891 "src/lexer.c" - yy225: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy257; - goto yy114; - yy226: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 's') goto yy258; - goto yy54; - yy227: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '_') goto yy260; - goto yy54; - yy228: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy229; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy229; - if (yych <= 'z') goto yy53; - } - } - yy229: -#line 72 "src/lexer.re" - { - return rbs_next_token(lexer, kBOOL); - } -#line 1929 "src/lexer.c" - yy230: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 's') goto yy261; - goto yy54; - yy231: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'n') goto yy263; - goto yy54; - yy232: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy264; - goto yy54; - yy233: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'u') goto yy266; - goto yy54; - yy234: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy267; - goto yy54; - yy235: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'r') goto yy268; - goto yy54; - yy236: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy269; - goto yy54; - yy237: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy270; - goto yy54; - yy238: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy271; - goto yy54; - yy239: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'i') goto yy272; - goto yy54; - yy240: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'r') goto yy273; - goto yy54; - yy241: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy242; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy242; - if (yych <= 'z') goto yy53; - } - } - yy242: -#line 92 "src/lexer.re" - { - return rbs_next_token(lexer, kSELF); - } -#line 2007 "src/lexer.c" - yy243: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy274; - goto yy54; - yy244: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy245; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy245; - if (yych <= 'z') goto yy53; - } - } - yy245: +yy223: + rbs_skip(lexer); + goto yy168; +yy224: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 'Z') { + if (yych <= '/') goto yy225; + if (yych <= '9') goto yy106; + if (yych >= 'A') goto yy106; + } else { + if (yych <= '_') { + if (yych >= '_') goto yy106; + } else { + if (yych <= '`') goto yy225; + if (yych <= 'z') goto yy106; + } + } +yy225: #line 104 "src/lexer.re" - { - return rbs_next_token(lexer, kSKIP); - } -#line 2035 "src/lexer.c" - yy246: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy247; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy247; - if (yych <= 'z') goto yy53; - } - } - yy247: -#line 95 "src/lexer.re" - { - return rbs_next_token(lexer, kTRUE); - } -#line 2058 "src/lexer.c" - yy248: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy249; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy249; - if (yych <= 'z') goto yy53; - } - } - yy249: + { return rbs_next_token(lexer, kATRBS); } +#line 1913 "src/lexer.c" +yy226: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy259; + goto yy114; +yy227: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 's') goto yy260; + goto yy54; +yy228: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '_') goto yy262; + goto yy54; +yy229: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy230; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy230; + if (yych <= 'z') goto yy53; + } + } +yy230: +#line 72 "src/lexer.re" + { return rbs_next_token(lexer, kBOOL); } +#line 1951 "src/lexer.c" +yy231: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 's') goto yy263; + goto yy54; +yy232: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'n') goto yy265; + goto yy54; +yy233: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy266; + goto yy54; +yy234: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'u') goto yy268; + goto yy54; +yy235: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy269; + goto yy54; +yy236: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'r') goto yy270; + goto yy54; +yy237: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy271; + goto yy54; +yy238: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy272; + goto yy54; +yy239: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy273; + goto yy54; +yy240: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy274; + goto yy54; +yy241: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'i') goto yy275; + goto yy54; +yy242: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'r') goto yy276; + goto yy54; +yy243: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy244; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy244; + if (yych <= 'z') goto yy53; + } + } +yy244: +#line 93 "src/lexer.re" + { return rbs_next_token(lexer, kSELF); } +#line 2034 "src/lexer.c" +yy245: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy277; + goto yy54; +yy246: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy247; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy247; + if (yych <= 'z') goto yy53; + } + } +yy247: +#line 105 "src/lexer.re" + { return rbs_next_token(lexer, kSKIP); } +#line 2062 "src/lexer.c" +yy248: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy249; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy249; + if (yych <= 'z') goto yy53; + } + } +yy249: #line 96 "src/lexer.re" - { - return rbs_next_token(lexer, kTYPE); - } -#line 2081 "src/lexer.c" - yy250: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy275; - goto yy54; - yy251: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'p') goto yy276; - goto yy54; - yy252: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy253; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy253; - if (yych <= 'z') goto yy53; - } - } - yy253: -#line 99 "src/lexer.re" - { - return rbs_next_token(lexer, kVOID); - } -#line 2114 "src/lexer.c" - yy254: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '@') { - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy277; - goto yy70; - } else { - if (yych <= 'F') goto yy277; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy277; - goto yy70; - } - yy255: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '@') { - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy278; - goto yy70; - } else { - if (yych <= 'F') goto yy278; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy278; - goto yy70; - } - yy256: - rbs_skip(lexer); - goto yy221; - yy257: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'o') goto yy279; - goto yy114; - yy258: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy259; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy259; - if (yych <= 'z') goto yy53; - } - } - yy259: + { return rbs_next_token(lexer, kTRUE); } +#line 2085 "src/lexer.c" +yy250: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy251; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy251; + if (yych <= 'z') goto yy53; + } + } +yy251: +#line 97 "src/lexer.re" + { return rbs_next_token(lexer, kTYPE); } +#line 2108 "src/lexer.c" +yy252: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy278; + goto yy54; +yy253: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'p') goto yy279; + goto yy54; +yy254: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy255; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy255; + if (yych <= 'z') goto yy53; + } + } +yy255: +#line 100 "src/lexer.re" + { return rbs_next_token(lexer, kVOID); } +#line 2141 "src/lexer.c" +yy256: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '@') { + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy280; + goto yy70; + } else { + if (yych <= 'F') goto yy280; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy280; + goto yy70; + } +yy257: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '@') { + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy281; + goto yy70; + } else { + if (yych <= 'F') goto yy281; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy281; + goto yy70; + } +yy258: + rbs_skip(lexer); + goto yy222; +yy259: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'o') goto yy282; + goto yy114; +yy260: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy261; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy261; + if (yych <= 'z') goto yy53; + } + } +yy261: #line 68 "src/lexer.re" - { - return rbs_next_token(lexer, kALIAS); - } -#line 2171 "src/lexer.c" - yy260: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= 'q') { - if (yych == 'a') goto yy280; - goto yy54; - } else { - if (yych <= 'r') goto yy281; - if (yych == 'w') goto yy282; - goto yy54; - } - yy261: - yyaccept = 7; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych <= '<') { - if (yych <= ',') { - if (yych == '!') goto yy110; - } else { - if (yych <= '-') goto yy283; - if (yych <= '/') goto yy262; - if (yych <= '9') goto yy53; - } - } else { - if (yych <= '^') { - if (yych <= '=') goto yy111; - if (yych <= '@') goto yy262; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy262; - if (yych <= 'z') goto yy53; - } - } - yy262: + { return rbs_next_token(lexer, kALIAS); } +#line 2198 "src/lexer.c" +yy262: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= 'q') { + if (yych == 'a') goto yy283; + goto yy54; + } else { + if (yych <= 'r') goto yy284; + if (yych == 'w') goto yy285; + goto yy54; + } +yy263: + yyaccept = 7; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych <= '<') { + if (yych <= ',') { + if (yych == '!') goto yy110; + } else { + if (yych <= '-') goto yy286; + if (yych <= '/') goto yy264; + if (yych <= '9') goto yy53; + } + } else { + if (yych <= '^') { + if (yych <= '=') goto yy111; + if (yych <= '@') goto yy264; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy264; + if (yych <= 'z') goto yy53; + } + } +yy264: #line 74 "src/lexer.re" - { - return rbs_next_token(lexer, kCLASS); - } -#line 2209 "src/lexer.c" - yy263: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy284; - goto yy54; - yy264: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy265; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy265; - if (yych <= 'z') goto yy53; - } - } - yy265: + { return rbs_next_token(lexer, kCLASS); } +#line 2236 "src/lexer.c" +yy265: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy287; + goto yy54; +yy266: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy267; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy267; + if (yych <= 'z') goto yy53; + } + } +yy267: #line 79 "src/lexer.re" - { - return rbs_next_token(lexer, kFALSE); - } -#line 2237 "src/lexer.c" - yy266: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy286; - goto yy54; - yy267: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'n') goto yy287; - goto yy54; - yy268: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'f') goto yy288; - goto yy54; - yy269: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy289; - goto yy54; - yy270: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'n') goto yy291; - goto yy54; - yy271: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 't') goto yy292; - goto yy54; - yy272: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'c') goto yy293; - goto yy54; - yy273: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'n') goto yy295; - goto yy54; - yy274: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy297; - goto yy54; - yy275: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'c') goto yy298; - goto yy54; - yy276: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy299; - goto yy54; - yy277: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '@') { - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy68; - goto yy70; - } else { - if (yych <= 'F') goto yy68; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy68; - goto yy70; - } - yy278: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '@') { - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy300; - goto yy70; - } else { - if (yych <= 'F') goto yy300; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy300; - goto yy70; - } - yy279: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '_') goto yy301; - goto yy114; - yy280: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'c') goto yy302; - goto yy54; - yy281: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy303; - goto yy54; - yy282: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'r') goto yy304; - goto yy54; - yy283: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy305; - goto yy70; - yy284: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy285; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy285; - if (yych <= 'z') goto yy53; - } - } - yy285: + { return rbs_next_token(lexer, kFALSE); } +#line 2264 "src/lexer.c" +yy268: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy289; + goto yy54; +yy269: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'n') goto yy290; + goto yy54; +yy270: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'f') goto yy291; + goto yy54; +yy271: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy292; + goto yy54; +yy272: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'n') goto yy294; + goto yy54; +yy273: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy295; + goto yy54; +yy274: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'c') goto yy296; + goto yy54; +yy275: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'c') goto yy297; + goto yy54; +yy276: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'n') goto yy299; + goto yy54; +yy277: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy301; + goto yy54; +yy278: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'c') goto yy302; + goto yy54; +yy279: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy303; + goto yy54; +yy280: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '@') { + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy68; + goto yy70; + } else { + if (yych <= 'F') goto yy68; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy68; + goto yy70; + } +yy281: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '@') { + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy304; + goto yy70; + } else { + if (yych <= 'F') goto yy304; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy304; + goto yy70; + } +yy282: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '_') goto yy305; + goto yy114; +yy283: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'c') goto yy306; + goto yy54; +yy284: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy307; + goto yy54; +yy285: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'r') goto yy308; + goto yy54; +yy286: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy309; + goto yy70; +yy287: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy288; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy288; + if (yych <= 'z') goto yy53; + } + } +yy288: #line 78 "src/lexer.re" - { - return rbs_next_token(lexer, kEXTEND); - } -#line 2366 "src/lexer.c" - yy286: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy306; - goto yy54; - yy287: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'c') goto yy308; - goto yy54; - yy288: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy309; - goto yy54; - yy289: - yyaccept = 8; - rbs_skip(lexer); - backup = *lexer; - yych = rbs_peek(lexer); - if (yych <= '<') { - if (yych <= ',') { - if (yych == '!') goto yy110; - } else { - if (yych <= '-') goto yy310; - if (yych <= '/') goto yy290; - if (yych <= '9') goto yy53; - } - } else { - if (yych <= '^') { - if (yych <= '=') goto yy111; - if (yych <= '@') goto yy290; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy290; - if (yych <= 'z') goto yy53; - } - } - yy290: + { return rbs_next_token(lexer, kEXTEND); } +#line 2398 "src/lexer.c" +yy289: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy310; + goto yy54; +yy290: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'c') goto yy312; + goto yy54; +yy291: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy313; + goto yy54; +yy292: + yyaccept = 8; + rbs_skip(lexer); + backup = *lexer; + yych = rbs_peek(lexer); + if (yych <= '<') { + if (yych <= ',') { + if (yych == '!') goto yy110; + } else { + if (yych <= '-') goto yy314; + if (yych <= '/') goto yy293; + if (yych <= '9') goto yy53; + } + } else { + if (yych <= '^') { + if (yych <= '=') goto yy111; + if (yych <= '@') goto yy293; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy293; + if (yych <= 'z') goto yy53; + } + } +yy293: #line 84 "src/lexer.re" - { - return rbs_next_token(lexer, kMODULE); - } -#line 2408 "src/lexer.c" - yy291: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy311; - goto yy54; - yy292: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy313; - goto yy54; - yy293: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy294; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy294; - if (yych <= 'z') goto yy53; - } - } - yy294: -#line 91 "src/lexer.re" - { - return rbs_next_token(lexer, kPUBLIC); - } -#line 2441 "src/lexer.c" - yy295: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy296; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy296; - if (yych <= 'z') goto yy53; - } - } - yy296: -#line 105 "src/lexer.re" - { - return rbs_next_token(lexer, kRETURN); - } -#line 2464 "src/lexer.c" - yy297: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 't') goto yy315; - goto yy54; - yy298: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'k') goto yy316; - goto yy54; - yy299: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy317; - goto yy54; - yy300: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '@') { - if (yych <= '/') goto yy70; - if (yych <= '9') goto yy88; - goto yy70; - } else { - if (yych <= 'F') goto yy88; - if (yych <= '`') goto yy70; - if (yych <= 'f') goto yy88; - goto yy70; - } - yy301: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == '_') goto yy319; - goto yy114; - yy302: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'c') goto yy321; - goto yy54; - yy303: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy322; - goto yy54; - yy304: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'i') goto yy323; - goto yy54; - yy305: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy324; - goto yy70; - yy306: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy307; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy307; - if (yych <= 'z') goto yy53; - } - } - yy307: + { return rbs_next_token(lexer, kMODULE); } +#line 2440 "src/lexer.c" +yy294: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy315; + goto yy54; +yy295: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy317; + goto yy54; +yy296: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy319; + goto yy54; +yy297: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy298; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy298; + if (yych <= 'z') goto yy53; + } + } +yy298: +#line 92 "src/lexer.re" + { return rbs_next_token(lexer, kPUBLIC); } +#line 2478 "src/lexer.c" +yy299: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy300; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy300; + if (yych <= 'z') goto yy53; + } + } +yy300: +#line 106 "src/lexer.re" + { return rbs_next_token(lexer, kRETURN); } +#line 2501 "src/lexer.c" +yy301: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy320; + goto yy54; +yy302: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'k') goto yy321; + goto yy54; +yy303: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy322; + goto yy54; +yy304: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '@') { + if (yych <= '/') goto yy70; + if (yych <= '9') goto yy88; + goto yy70; + } else { + if (yych <= 'F') goto yy88; + if (yych <= '`') goto yy70; + if (yych <= 'f') goto yy88; + goto yy70; + } +yy305: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == '_') goto yy324; + goto yy114; +yy306: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'c') goto yy326; + goto yy54; +yy307: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy327; + goto yy54; +yy308: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'i') goto yy328; + goto yy54; +yy309: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy329; + goto yy70; +yy310: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy311; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy311; + if (yych <= 'z') goto yy53; + } + } +yy311: #line 81 "src/lexer.re" - { - return rbs_next_token(lexer, kINCLUDE); - } -#line 2540 "src/lexer.c" - yy308: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy325; - goto yy54; - yy309: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'c') goto yy327; - goto yy54; - yy310: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy328; - if (yych == 's') goto yy329; - goto yy70; - yy311: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy312; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy312; - if (yych <= 'z') goto yy53; - } - } - yy312: + { return rbs_next_token(lexer, kINCLUDE); } +#line 2577 "src/lexer.c" +yy312: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy330; + goto yy54; +yy313: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'c') goto yy332; + goto yy54; +yy314: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy333; + if (yych == 's') goto yy334; + goto yy70; +yy315: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy316; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy316; + if (yych <= 'z') goto yy53; + } + } +yy316: #line 89 "src/lexer.re" - { - return rbs_next_token(lexer, kPREPEND); - } -#line 2579 "src/lexer.c" - yy313: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy314; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy314; - if (yych <= 'z') goto yy53; - } - } - yy314: + { return rbs_next_token(lexer, kPREPEND); } +#line 2616 "src/lexer.c" +yy317: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy318; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy318; + if (yych <= 'z') goto yy53; + } + } +yy318: #line 90 "src/lexer.re" - { - return rbs_next_token(lexer, kPRIVATE); - } -#line 2602 "src/lexer.c" - yy315: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'o') goto yy330; - goto yy54; - yy316: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy331; - goto yy54; - yy317: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy318; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy318; - if (yych <= 'z') goto yy53; - } - } - yy318: -#line 98 "src/lexer.re" - { - return rbs_next_token(lexer, kUNTYPED); - } -#line 2635 "src/lexer.c" - yy319: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy113; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy320; - if (yych <= 'Z') goto yy113; - } else { - if (yych == '`') goto yy320; - if (yych <= 'z') goto yy113; - } - } - yy320: -#line 102 "src/lexer.re" - { - return rbs_next_token(lexer, k__TODO__); - } -#line 2658 "src/lexer.c" - yy321: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy332; - goto yy54; - yy322: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy333; - goto yy54; - yy323: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 't') goto yy334; - goto yy54; - yy324: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'i') goto yy335; - goto yy70; - yy325: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy326; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy326; - if (yych <= 'z') goto yy53; - } - } - yy326: + { return rbs_next_token(lexer, kPRIVATE); } +#line 2639 "src/lexer.c" +yy319: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy335; + goto yy54; +yy320: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'o') goto yy336; + goto yy54; +yy321: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy337; + goto yy54; +yy322: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy323; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy323; + if (yych <= 'z') goto yy53; + } + } +yy323: +#line 99 "src/lexer.re" + { return rbs_next_token(lexer, kUNTYPED); } +#line 2677 "src/lexer.c" +yy324: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy113; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy325; + if (yych <= 'Z') goto yy113; + } else { + if (yych == '`') goto yy325; + if (yych <= 'z') goto yy113; + } + } +yy325: +#line 103 "src/lexer.re" + { return rbs_next_token(lexer, k__TODO__); } +#line 2700 "src/lexer.c" +yy326: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy338; + goto yy54; +yy327: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy339; + goto yy54; +yy328: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 't') goto yy340; + goto yy54; +yy329: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'i') goto yy341; + goto yy70; +yy330: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy331; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy331; + if (yych <= 'z') goto yy53; + } + } +yy331: #line 82 "src/lexer.re" - { - return rbs_next_token(lexer, kINSTANCE); - } -#line 2701 "src/lexer.c" - yy327: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy336; - goto yy54; - yy328: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy338; - goto yy70; - yy329: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy339; - goto yy70; - yy330: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'n') goto yy340; - goto yy54; - yy331: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'd') goto yy342; - goto yy54; - yy332: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 's') goto yy344; - goto yy54; - yy333: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy345; - goto yy54; - yy334: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'e') goto yy346; - goto yy54; - yy335: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy347; - goto yy70; - yy336: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy337; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy337; - if (yych <= 'z') goto yy53; - } - } - yy337: + { return rbs_next_token(lexer, kINSTANCE); } +#line 2743 "src/lexer.c" +yy332: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy342; + goto yy54; +yy333: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy344; + goto yy70; +yy334: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy345; + goto yy70; +yy335: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy346; + goto yy54; +yy336: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'n') goto yy348; + goto yy54; +yy337: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'd') goto yy350; + goto yy54; +yy338: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 's') goto yy352; + goto yy54; +yy339: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy353; + goto yy54; +yy340: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'e') goto yy354; + goto yy54; +yy341: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy355; + goto yy70; +yy342: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy343; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy343; + if (yych <= 'z') goto yy53; + } + } +yy343: #line 83 "src/lexer.re" - { - return rbs_next_token(lexer, kINTERFACE); - } -#line 2769 "src/lexer.c" - yy338: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'i') goto yy348; - goto yy70; - yy339: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'l') goto yy349; - goto yy70; - yy340: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy341; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy341; - if (yych <= 'z') goto yy53; - } - } - yy341: -#line 93 "src/lexer.re" - { - return rbs_next_token(lexer, kSINGLETON); - } -#line 2802 "src/lexer.c" - yy342: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy343; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy343; - if (yych <= 'z') goto yy53; - } - } - yy343: -#line 97 "src/lexer.re" - { - return rbs_next_token(lexer, kUNCHECKED); - } -#line 2825 "src/lexer.c" - yy344: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 's') goto yy350; - goto yy54; - yy345: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'r') goto yy351; - goto yy54; - yy346: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'r') goto yy353; - goto yy54; - yy347: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 's') goto yy355; - goto yy70; - yy348: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'a') goto yy356; - goto yy70; - yy349: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'f') goto yy357; - goto yy70; - yy350: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'o') goto yy358; - goto yy54; - yy351: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy352; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy352; - if (yych <= 'z') goto yy53; - } - } - yy352: + { return rbs_next_token(lexer, kINTERFACE); } +#line 2816 "src/lexer.c" +yy344: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'i') goto yy356; + goto yy70; +yy345: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'l') goto yy357; + goto yy70; +yy346: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy347; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy347; + if (yych <= 'z') goto yy53; + } + } +yy347: +#line 91 "src/lexer.re" + { return rbs_next_token(lexer, kPROTECTED); } +#line 2849 "src/lexer.c" +yy348: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy349; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy349; + if (yych <= 'z') goto yy53; + } + } +yy349: +#line 94 "src/lexer.re" + { return rbs_next_token(lexer, kSINGLETON); } +#line 2872 "src/lexer.c" +yy350: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy351; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy351; + if (yych <= 'z') goto yy53; + } + } +yy351: +#line 98 "src/lexer.re" + { return rbs_next_token(lexer, kUNCHECKED); } +#line 2895 "src/lexer.c" +yy352: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 's') goto yy358; + goto yy54; +yy353: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'r') goto yy359; + goto yy54; +yy354: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'r') goto yy361; + goto yy54; +yy355: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 's') goto yy363; + goto yy70; +yy356: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'a') goto yy364; + goto yy70; +yy357: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'f') goto yy365; + goto yy70; +yy358: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'o') goto yy366; + goto yy54; +yy359: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy360; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy360; + if (yych <= 'z') goto yy53; + } + } +yy360: #line 70 "src/lexer.re" - { - return rbs_next_token(lexer, kATTRREADER); - } -#line 2883 "src/lexer.c" - yy353: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy354; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy354; - if (yych <= 'z') goto yy53; - } - } - yy354: + { return rbs_next_token(lexer, kATTRREADER); } +#line 2953 "src/lexer.c" +yy361: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy362; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy362; + if (yych <= 'z') goto yy53; + } + } +yy362: #line 71 "src/lexer.re" - { - return rbs_next_token(lexer, kATTRWRITER); - } -#line 2906 "src/lexer.c" - yy355: - rbs_skip(lexer); + { return rbs_next_token(lexer, kATTRWRITER); } +#line 2976 "src/lexer.c" +yy363: + rbs_skip(lexer); #line 75 "src/lexer.re" - { - return rbs_next_token(lexer, kCLASSALIAS); - } -#line 2911 "src/lexer.c" - yy356: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 's') goto yy359; - goto yy70; - yy357: - rbs_skip(lexer); + { return rbs_next_token(lexer, kCLASSALIAS); } +#line 2981 "src/lexer.c" +yy364: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 's') goto yy367; + goto yy70; +yy365: + rbs_skip(lexer); #line 86 "src/lexer.re" - { - return rbs_next_token(lexer, kMODULESELF); - } -#line 2921 "src/lexer.c" - yy358: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych == 'r') goto yy360; - goto yy54; - yy359: - rbs_skip(lexer); + { return rbs_next_token(lexer, kMODULESELF); } +#line 2991 "src/lexer.c" +yy366: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych == 'r') goto yy368; + goto yy54; +yy367: + rbs_skip(lexer); #line 85 "src/lexer.re" - { - return rbs_next_token(lexer, kMODULEALIAS); - } -#line 2931 "src/lexer.c" - yy360: - rbs_skip(lexer); - yych = rbs_peek(lexer); - if (yych <= '=') { - if (yych <= '/') { - if (yych == '!') goto yy110; - } else { - if (yych <= '9') goto yy53; - if (yych >= '=') goto yy111; - } - } else { - if (yych <= '^') { - if (yych <= '@') goto yy361; - if (yych <= 'Z') goto yy53; - } else { - if (yych == '`') goto yy361; - if (yych <= 'z') goto yy53; - } - } - yy361: + { return rbs_next_token(lexer, kMODULEALIAS); } +#line 3001 "src/lexer.c" +yy368: + rbs_skip(lexer); + yych = rbs_peek(lexer); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy110; + } else { + if (yych <= '9') goto yy53; + if (yych >= '=') goto yy111; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy369; + if (yych <= 'Z') goto yy53; + } else { + if (yych == '`') goto yy369; + if (yych <= 'z') goto yy53; + } + } +yy369: #line 69 "src/lexer.re" - { - return rbs_next_token(lexer, kATTRACCESSOR); - } -#line 2954 "src/lexer.c" - } -#line 154 "src/lexer.re" + { return rbs_next_token(lexer, kATTRACCESSOR); } +#line 3024 "src/lexer.c" +} +#line 155 "src/lexer.re" + } diff --git a/src/lexer.re b/src/lexer.re index 0604816c3c..12c983a8a8 100644 --- a/src/lexer.re +++ b/src/lexer.re @@ -88,6 +88,7 @@ rbs_token_t rbs_lexer_next_token(rbs_lexer_t *lexer) { "out" { return rbs_next_token(lexer, kOUT); } "prepend" { return rbs_next_token(lexer, kPREPEND); } "private" { return rbs_next_token(lexer, kPRIVATE); } + "protected" { return rbs_next_token(lexer, kPROTECTED); } "public" { return rbs_next_token(lexer, kPUBLIC); } "self" { return rbs_next_token(lexer, kSELF); } "singleton" { return rbs_next_token(lexer, kSINGLETON); } diff --git a/src/lexstate.c b/src/lexstate.c index f3d35b4350..3870abdd29 100644 --- a/src/lexstate.c +++ b/src/lexstate.c @@ -53,6 +53,7 @@ static const char *RBS_TOKENTYPE_NAMES[] = { "kOUT", /* out */ "kPREPEND", /* prepend */ "kPRIVATE", /* private */ + "kPROTECTED", /* protected */ "kPUBLIC", /* public */ "kSELF", /* self */ "kSINGLETON", /* singleton */ diff --git a/src/parser.c b/src/parser.c index b56970c93e..b08c016eec 100644 --- a/src/parser.c +++ b/src/parser.c @@ -52,6 +52,7 @@ case kATTRACCESSOR: \ case kPUBLIC: \ case kPRIVATE: \ + case kPROTECTED: \ case kUNTYPED: \ case kUSE: \ case kAS: \ @@ -89,6 +90,7 @@ case kATTRACCESSOR: \ case kPUBLIC: \ case kPRIVATE: \ + case kPROTECTED: \ case kUNTYPED: \ case kUSE: \ case kAS: \ @@ -199,8 +201,7 @@ static bool parse_type_name(rbs_parser_t *parser, TypeNameKind kind, rbs_range_t rbs_node_list_t *path = rbs_node_list_new(ALLOCATOR()); while ( - parser->current_token.type == tUIDENT && parser->next_token.type == pCOLON2 && parser->current_token.range.end.byte_pos == parser->next_token.range.start.byte_pos && parser->next_token.range.end.byte_pos == parser->next_token2.range.start.byte_pos - ) { + parser->current_token.type == tUIDENT && parser->next_token.type == pCOLON2 && parser->current_token.range.end.byte_pos == parser->next_token.range.start.byte_pos && parser->next_token.range.end.byte_pos == parser->next_token2.range.start.byte_pos) { rbs_constant_id_t symbol_value = INTERN_TOKEN(parser, parser->current_token); rbs_location_range symbol_range = RBS_RANGE_LEX2AST(parser->next_token.range); rbs_ast_symbol_t *symbol = rbs_ast_symbol_new(ALLOCATOR(), symbol_range, &parser->constant_pool, symbol_value); @@ -1914,6 +1915,7 @@ static InstanceSingletonKind parse_instance_singleton_kind(rbs_parser_t *parser, * def_member ::= {kDEF} method_name `:` * | {kPRIVATE} kDEF method_name `:` * | {kPUBLIC} kDEF method_name `:` + * | {kPROTECTED} kDEF method_name `:` * * method_types ::= {} * | {} <`...`> @@ -1947,6 +1949,13 @@ static bool parse_member_def(rbs_parser_t *parser, bool instance_only, bool acce rbs_parser_advance(parser); break; } + case kPROTECTED: { + visibility_range = parser->current_token.range; + visibility = RBS_METHOD_DEFINITION_VISIBILITY_PROTECTED; + member_range.start = visibility_range.start; + rbs_parser_advance(parser); + break; + } default: visibility_range = NULL_RANGE; visibility = RBS_METHOD_DEFINITION_VISIBILITY_UNSPECIFIED; @@ -2343,6 +2352,7 @@ static bool parse_variable_member(rbs_parser_t *parser, rbs_position_t comment_p /* visibility_member ::= {<`public`>} | {<`private`>} + | {<`protected`>} */ NODISCARD static bool parse_visibility_member(rbs_parser_t *parser, rbs_node_list_t *annotations, rbs_node_t **visibility_member) { @@ -2362,6 +2372,10 @@ static bool parse_visibility_member(rbs_parser_t *parser, rbs_node_list_t *annot *visibility_member = (rbs_node_t *) rbs_ast_members_private_new(ALLOCATOR(), location); return true; } + case kPROTECTED: { + *visibility_member = (rbs_node_t *) rbs_ast_members_protected_new(ALLOCATOR(), location); + return true; + } default: rbs_parser_set_error(parser, parser->current_token, false, "Unexpected error"); return false; @@ -2376,7 +2390,7 @@ static bool parse_visibility_member(rbs_parser_t *parser, rbs_node_list_t *annot attr_keyword ::= `attr_reader` | `attr_writer` | `attr_accessor` - visibility ::= `public` | `private` + visibility ::= `public` | `private` | `protected` attr_var ::= # empty | `(` tAIDENT `)` # Ivar name @@ -2406,6 +2420,12 @@ static bool parse_attribute_member(rbs_parser_t *parser, rbs_position_t comment_ rbs_parser_advance(parser); break; } + case kPROTECTED: { + visibility_range = parser->current_token.range; + visibility = RBS_ATTRIBUTE_VISIBILITY_PROTECTED; + rbs_parser_advance(parser); + break; + } default: visibility = RBS_ATTRIBUTE_VISIBILITY_UNSPECIFIED; visibility_range = NULL_RANGE; @@ -2655,6 +2675,7 @@ static bool parse_nested_decl(rbs_parser_t *parser, const char *nested_in, rbs_p | attribute_member | `public` | `private` + | `protected` */ NODISCARD static bool parse_module_members(rbs_parser_t *parser, rbs_node_list_t **members) { @@ -2705,6 +2726,7 @@ static bool parse_module_members(rbs_parser_t *parser, rbs_node_list_t **members case kPUBLIC: case kPRIVATE: + case kPROTECTED: if (parser->next_token.range.start.line == parser->current_token.range.start.line) { switch (parser->next_token.type) { case kDEF: { diff --git a/test/rbs/ast/visitor_test.rb b/test/rbs/ast/visitor_test.rb index 2f781f53c8..d9a576288b 100644 --- a/test/rbs/ast/visitor_test.rb +++ b/test/rbs/ast/visitor_test.rb @@ -59,6 +59,40 @@ def visit_member_method_definition(node) assert_equal(["RBS::AST::Members::MethodDefinition"], visitor.nodes.map(&:class).map(&:name)) end + def test_visit_member_protected + visitor_class = Class.new(RBS::AST::Visitor) do + attr_reader :nodes + + def initialize + super() + @nodes = [] + end + + def visit_member_protected(node) + @nodes << node + end + end + + rbs = <<~RBS + class Foo + public + + private + + protected + + def hello: () -> void + end + RBS + + declarations = parse_rbs_string(rbs) + visitor = visitor_class.new + visitor.visit_all(declarations) + + assert_equal(1, visitor.nodes.size) + assert_instance_of RBS::AST::Members::Protected, visitor.nodes[0] + end + private def parse_rbs_string(rbs) diff --git a/test/rbs/definition_builder_test.rb b/test/rbs/definition_builder_test.rb index 84d9e2b5f1..1097d9f014 100644 --- a/test/rbs/definition_builder_test.rb +++ b/test/rbs/definition_builder_test.rb @@ -2377,6 +2377,42 @@ module M end end + def test_protected_visibility + SignatureManager.new do |manager| + manager.files.merge!(Pathname("foo.rbs") => <<-EOF) +class C + protected + def a: () -> void + attr_accessor b: String + + public def c: () -> void + protected def d: () -> void + protected attr_accessor e: Integer + protected def self.f: () -> void + protected attr_reader self.g: String +end + EOF + manager.build do |env| + builder = DefinitionBuilder.new(env: env) + + builder.build_instance(type_name("::C")).tap do |definition| + assert_predicate definition.methods[:a], :protected? + assert_predicate definition.methods[:b], :protected? + assert_predicate definition.methods[:b=], :protected? + assert_predicate definition.methods[:c], :public? + assert_predicate definition.methods[:d], :protected? + assert_predicate definition.methods[:e], :protected? + assert_predicate definition.methods[:e=], :protected? + end + + builder.build_singleton(type_name("::C")).tap do |definition| + assert_predicate definition.methods[:f], :protected? + assert_predicate definition.methods[:g], :protected? + end + end + end + end + def test_new_alias SignatureManager.new do |manager| manager.files.merge!(Pathname("foo.rbs") => <<-EOF) diff --git a/test/rbs/schema_test.rb b/test/rbs/schema_test.rb index 457c7a8b90..d98c8e5493 100644 --- a/test/rbs/schema_test.rb +++ b/test/rbs/schema_test.rb @@ -161,8 +161,13 @@ def self?.foo: () -> Integer attr_accessor age (@age): Integer attr_writer email(): String? + protected attr_reader path: String + + protected def secret: () -> String + private public + protected alias foo bar alias self.foo self.bar @@ -183,11 +188,15 @@ def self?.foo: () -> Integer assert_member members[8], :attribute assert_member members[9], :attribute - assert_member members[10], :visibility - assert_member members[11], :visibility + assert_member members[10], :attribute + assert_member members[11], :methodDefinition + + assert_member members[12], :visibility + assert_member members[13], :visibility + assert_member members[14], :visibility - assert_member members[12], :alias - assert_member members[13], :alias + assert_member members[15], :alias + assert_member members[16], :alias end def test_class_decl diff --git a/test/rbs/signature_parsing_test.rb b/test/rbs/signature_parsing_test.rb index b67db74abb..94b08dcdae 100644 --- a/test/rbs/signature_parsing_test.rb +++ b/test/rbs/signature_parsing_test.rb @@ -655,6 +655,128 @@ class Foo SIG end + def test_protected + Parser.parse_signature(<<~SIG).tap do |_, _, decls| + class Foo + protected + end + SIG + + decls[0].yield_self do |decl| + assert_instance_of Declarations::Class, decl + + assert_equal 1, decl.members.size + + decl.members[0].yield_self do |m| + assert_instance_of Members::Protected, m + end + end + end + end + + def test_protected_def + Parser.parse_signature(<<~SIG).tap do |_, _, decls| + class Foo + protected def foo: () -> void + def bar: () -> void + end + SIG + + decls[0].tap do |decl| + assert_instance_of Declarations::Class, decl + + assert_equal 2, decl.members.size + + decl.members[0].tap do |m| + assert_instance_of Members::MethodDefinition, m + assert_equal :foo, m.name + assert_equal :protected, m.visibility + end + + decl.members[1].tap do |m| + assert_instance_of Members::MethodDefinition, m + assert_equal :bar, m.name + assert_nil m.visibility + end + end + end + end + + def test_protected_def_error + assert_raises RBS::ParsingError do + Parser.parse_signature(<<~SIG) + class Foo + protected def self?.foo: () -> void + end + SIG + end + end + + def test_protected_attr + Parser.parse_signature(<<~SIG).tap do |_, _, decls| + class Foo + protected attr_reader foo: String + protected attr_writer bar: String + protected attr_accessor baz: String + end + SIG + + decls[0].tap do |decl| + assert_instance_of Declarations::Class, decl + + assert_equal 3, decl.members.size + + decl.members[0].tap do |m| + assert_instance_of Members::AttrReader, m + assert_equal :foo, m.name + assert_equal :protected, m.visibility + end + + decl.members[1].tap do |m| + assert_instance_of Members::AttrWriter, m + assert_equal :bar, m.name + assert_equal :protected, m.visibility + end + + decl.members[2].tap do |m| + assert_instance_of Members::AttrAccessor, m + assert_equal :baz, m.name + assert_equal :protected, m.visibility + end + end + end + end + + def test_protected_modifier_error + assert_raises RBS::ParsingError do + Parser.parse_signature(<<~SIG) + class Foo + protected alias foo bar + end + SIG + end + end + + def test_public_private_protected_modifier + Parser.parse_signature(<<~SIG).tap do |_, _, decls| + class Foo + public + private + protected + end + SIG + + decls[0].tap do |decl| + assert_instance_of Declarations::Class, decl + assert_equal 3, decl.members.size + + assert_instance_of Members::Public, decl.members[0] + assert_instance_of Members::Private, decl.members[1] + assert_instance_of Members::Protected, decl.members[2] + end + end + end + def test_alias Parser.parse_signature(<<~SIG).tap do |_, _, decls| class Foo diff --git a/test/rbs/sorter_test.rb b/test/rbs/sorter_test.rb index 8803365e0e..f173a025d5 100644 --- a/test/rbs/sorter_test.rb +++ b/test/rbs/sorter_test.rb @@ -36,19 +36,18 @@ def self?.modfunc: () -> void attr_accessor self.a: String attr_reader self.b: String attr_writer self.c: String + protected attr_reader self.protected_attr: String def self.new: () -> instance alias self.bb self.xx def self.foo: () -> void def self.pub: () -> void - - private - - def self.prv: () -> void - - public + protected def self.prot: () -> void + private def self.prv: () -> void attr_accessor x: String + protected attr_reader y: String + private attr_writer z: String def initialize: () -> void def a: () -> void def b: () -> void @@ -56,6 +55,10 @@ def b: () -> void def c: () -> void def pub: () -> void + protected + + def prot: () -> void + private def prv: () -> void @@ -82,10 +85,16 @@ def self?.modfunc: () -> void attr_reader self.b: String + protected attr_reader self.protected_attr: String + attr_writer self.c: String attr_accessor x: String + private attr_writer z: String + + protected attr_reader y: String + def self.new: () -> instance def self.foo: () -> void @@ -122,6 +131,8 @@ module A private def prv: () -> void public def pub: () -> void private def self.prv: () -> void + protected def prot: () -> void + protected def self.prot: () -> void public def self.pub: () -> void end RUBY_ORIG diff --git a/test/rbs/writer_test.rb b/test/rbs/writer_test.rb index 44b4c3570d..d7982aeb7b 100644 --- a/test/rbs/writer_test.rb +++ b/test/rbs/writer_test.rb @@ -67,6 +67,8 @@ class Foo::Bar[X] < Array[String] private + protected + alias self.id self.identifier alias to_s to_str @@ -308,9 +310,15 @@ class Foo public def bar: () -> String + protected def qux: () -> String + def baz: () -> String private attr_reader name: String + + protected attr_writer secret: String + + protected attr_accessor data: Integer end SIG end diff --git a/test/stdlib/Pathname_test.rb b/test/stdlib/Pathname_test.rb index 50de3fcc28..b79f121215 100644 --- a/test/stdlib/Pathname_test.rb +++ b/test/stdlib/Pathname_test.rb @@ -799,6 +799,13 @@ def test_zero? assert_send_type '() -> bool', Pathname(File.expand_path(__FILE__)), :zero? end + + def test_path + # `path` is a protected attr_reader, so it must be invoked via `send` + # (or from another Pathname instance). + assert_send_type '() -> String', + Pathname('foo'), :path + end end class PathnameKernelTest < Test::Unit::TestCase diff --git a/test/typecheck/protected/Steepfile b/test/typecheck/protected/Steepfile new file mode 100644 index 0000000000..77b2334655 --- /dev/null +++ b/test/typecheck/protected/Steepfile @@ -0,0 +1,7 @@ +D = Steep::Diagnostic + +target :test do + signature "." + check "." + configure_code_diagnostics(D::Ruby.all_error) +end diff --git a/test/typecheck/protected/test.rb b/test/typecheck/protected/test.rb new file mode 100644 index 0000000000..4402c79fa7 --- /dev/null +++ b/test/typecheck/protected/test.rb @@ -0,0 +1,53 @@ +class Account + def initialize(name, balance) + @name = name + @balance = balance + @pin = 0 + end + + def name + @name + end + + protected def balance + @balance + end + + protected def pin + @pin + end + + protected def pin=(value) + @pin = value + end + + protected + + # Demonstrates accessing protected state on another instance of the same class. + def transfer_to(other, amount) + return if balance < amount + + @balance -= amount + other.instance_variable_set(:@balance, other.balance + amount) + end +end + +class CheckingAccount < Account + # Demonstrates accessing protected state on another instance from a subclass. + def richer_than?(other) + balance > other.balance + end +end + +a = Account.new("alice", 100) +b = Account.new("bob", 50) + +a.transfer_to(b, 25) + +c = CheckingAccount.new("carol", 200) +d = CheckingAccount.new("dave", 75) + +c.richer_than?(d) + +# Reading a public attr_reader still works. +a.name diff --git a/test/typecheck/protected/test.rbs b/test/typecheck/protected/test.rbs new file mode 100644 index 0000000000..b13c4b0076 --- /dev/null +++ b/test/typecheck/protected/test.rbs @@ -0,0 +1,28 @@ +# Acceptance test for the `protected` visibility modifier in all three forms: +# - standalone marker +# - `protected def ...` prefix +# - `protected attr_*` prefix + +class Account + @balance: Integer + @pin: Integer + + attr_reader name: String + + def initialize: (String name, Integer balance) -> void + + # `protected def` prefix + protected def balance: () -> Integer + + # `protected attr_*` prefix + protected attr_accessor pin: Integer + + # Standalone `protected` marker: methods after it inherit protected visibility. + protected + + def transfer_to: (Account other, Integer amount) -> void +end + +class CheckingAccount < Account + def richer_than?: (Account other) -> bool +end