From 566894961d861e14044f52755a87efda3d019074 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 8 Apr 2025 16:17:04 +0900 Subject: [PATCH 01/48] Introduce sub buffer A sub buffer is a buffer that contains slices of a buffer. --- lib/rbs/buffer.rb | 128 ++++++++++++++++++++++++++++++++-------- sig/buffer.rbs | 64 +++++++++++++++++++- test/rbs/buffer_test.rb | 37 ++++++++++-- test/rbs/parser_test.rb | 2 +- 4 files changed, 199 insertions(+), 32 deletions(-) diff --git a/lib/rbs/buffer.rb b/lib/rbs/buffer.rb index c5f48dcfe..7990a07d2 100644 --- a/lib/rbs/buffer.rb +++ b/lib/rbs/buffer.rb @@ -4,39 +4,53 @@ module RBS class Buffer attr_reader :name attr_reader :content + attr_reader :parent - def initialize(name:, content:) - @name = name - @content = content + def initialize(name: nil, content:, parent: nil) + case + when name && content + @name = name + @content = content + @parent = nil + when parent && content + @name = parent[0].name + @content = content + @parent = parent + end end def lines - @lines ||= content.lines + ranges.map { self.content[_1] || raise } #$ String + end + + def line_count + ranges.size end def ranges - @ranges ||= - begin - @ranges = [] - offset = 0 - lines.each do |line| - size = line.size - range = offset...(offset+size) - @ranges << range - offset += size - end - - if !content.end_with?("\n") && content.size > 0 - @ranges[-1] = @ranges[-1].begin...(@ranges[-1].end+1) - end - - @ranges + @ranges ||= begin + lines = content.lines + lines << "" if content.end_with?("\n") + + ranges = [] #: Array[Range[Integer]] + offset = 0 + + lines.each do |line| + size0 = line.size + line = line.chomp + range = offset...(offset+line.size) + ranges << range + + offset += size0 end + + ranges + end end def pos_to_loc(pos) index = ranges.bsearch_index do |range| - pos < range.end ? true : false + pos <= range.end ? true : false end if index @@ -49,7 +63,7 @@ def pos_to_loc(pos) def loc_to_pos(loc) line, column = loc - if range = ranges[line - 1] + if range = ranges.fetch(line - 1, nil) range.begin + column else last_position @@ -57,11 +71,77 @@ def loc_to_pos(loc) end def last_position - content.size + if ranges.empty? + 0 + else + ranges[-1].end + end end def inspect - "#" + "#" + end + + def rbs_location(location, loc2=nil) + if loc2 + Location.new(self, location.start_character_offset, loc2.end_character_offset) + else + Location.new(self, location.start_character_offset, location.end_character_offset) + end + end + + def sub_buffer(lines:) + buf = +"" + lines.each_with_index do |range, index| + start_pos = range.begin + end_pos = range.end + slice = content[start_pos...end_pos] or raise + if slice.include?("\n") + raise "Line #{index + 1} cannot contain newline character." + end + buf << slice + buf << "\n" + end + + buf.chomp! + + Buffer.new(content: buf, parent: [self, lines]) + end + + def parent_buffer + if parent + parent[0] + end + end + + def parent_position(position) + parent or raise "#parent_position is unavailable with buffer without parent" + return nil unless position <= last_position + + line, column = pos_to_loc(position) + parent_range = parent[1][line - 1] + parent_range.begin + column + end + + def absolute_position(position) + if parent_buffer + pos = parent_position(position) or return + parent_buffer.absolute_position(pos) + else + position + end + end + + def top_buffer + if parent_buffer + parent_buffer.top_buffer + else + self + end + end + + def detach + Buffer.new(name: name, content: content) end end end diff --git a/sig/buffer.rbs b/sig/buffer.rbs index 9d23ad6aa..31230c39a 100644 --- a/sig/buffer.rbs +++ b/sig/buffer.rbs @@ -11,16 +11,40 @@ module RBS # The content of the buffer. attr_reader content: String - @lines: Array[String] - - @ranges: Array[Range[Integer]] + attr_reader parent: [Buffer, Array[Range[Integer]]]? def initialize: (name: Pathname name, content: String content) -> void + | (content: String content, parent: [Buffer, Array[Range[Integer]]] parent) -> void + # Array of lines of the content, without the EOL + # + # ```rb + # buffer = Buffer.new(name: name, content: "123\nabc") + # buffer.lines # => ["123", "abc"] + # ``` + # + # If the input has EOL at the end of the file, the `lines` has an empty string at the end. + # + # ```rb + # buffer = Buffer.new(name: name, content: "123\nabc\n") + # buffer.lines # => ["123", "abc", ""] + # ``` + # def lines: () -> Array[String] + @ranges: Array[Range[Integer]]? + # Array of ranges that stores the ranges of the each line, without the EOL + # + # ```rb + # buffer = Buffer.new(name: name, content: "123\nabc\n") + # buffer.ranges # => [0...3, 4...7, 8...8] + # ``` + # def ranges: () -> Array[Range[Integer]] + # Returns the number of the lines + def line_count: () -> Integer + # Translate position to location. def pos_to_loc: (Integer pos) -> loc @@ -28,5 +52,39 @@ module RBS def loc_to_pos: (loc loc) -> Integer def last_position: () -> Integer + + # Translate `Prism::Location` to `RBS::Location` attached to this buffer + # + # It assumes the `Prism::Location` has a source which is equivalent to `self`. + # + def rbs_location: (Prism::Location) -> Location + | (Prism::Location, Prism::Location) -> Location + + # Construct a buffer from substrings of this buffer. + # + # The returned buffer contains lines from given ranges. + # + # ```rb + # buffer = Buffer.new(name: name, content: < Buffer with content = 1\n34 + # buffer.sub_buffer(lines: [5..7]) # => Raises an error because the range contains newline + # ``` + # + %a{pure} def sub_buffer: (lines: Array[Range[Integer]]) -> Buffer + + %a{pure} def parent_buffer: () -> Buffer? + + %a{pure} def parent_position: (Integer) -> Integer? + + %a{pure} def absolute_position: (Integer) -> Integer? + + %a{pure} def top_buffer: () -> Buffer + + %a{pure} def detach: () -> Buffer end end diff --git a/test/rbs/buffer_test.rb b/test/rbs/buffer_test.rb index a3fbc01c6..03bb1baad 100644 --- a/test/rbs/buffer_test.rb +++ b/test/rbs/buffer_test.rb @@ -9,8 +9,8 @@ def test_buffer abc CONTENT - assert_equal ["123\n", "abc\n"], buffer.lines - assert_equal [0...4, 4...8], buffer.ranges + assert_equal ["123", "abc", ""], buffer.lines + assert_equal [0...3, 4...7, 8...8], buffer.ranges assert_equal [1, 0], buffer.pos_to_loc(0) assert_equal [1, 1], buffer.pos_to_loc(1) @@ -41,8 +41,8 @@ def test_buffer def test_buffer_with_no_eol buffer = Buffer.new(name: Pathname("foo.rbs"), content: "123\nabc") - assert_equal ["123\n", "abc"], buffer.lines - assert_equal [0...4, 4...8], buffer.ranges + assert_equal ["123", "abc"], buffer.lines + assert_equal [0...3, 4...7], buffer.ranges assert_equal [1, 0], buffer.pos_to_loc(0) assert_equal [1, 1], buffer.pos_to_loc(1) @@ -67,4 +67,33 @@ def test_buffer_with_no_eol assert_equal 7, buffer.last_position end + + def test_sub_buffer + buffer = Buffer.new(name: Pathname("foo.rbs"), content: <<~CONTENT) + 123 + abc + CONTENT + + buffer.sub_buffer(lines: [1...3, 5...7]).tap do |sub_buffer| + assert_equal <<~CONTENT.chomp, sub_buffer.content + 23 + bc + CONTENT + + assert_equal 1, sub_buffer.parent_position(0) + assert_equal 2, sub_buffer.parent_position(1) + assert_equal 3, sub_buffer.parent_position(2) + assert_equal 5, sub_buffer.parent_position(3) + assert_equal 6, sub_buffer.parent_position(4) + assert_equal 7, sub_buffer.parent_position(5) + + assert_equal [1, 0], sub_buffer.pos_to_loc(0) + assert_equal [1, 1], sub_buffer.pos_to_loc(1) + assert_equal [1, 2], sub_buffer.pos_to_loc(2) + assert_equal [2, 0], sub_buffer.pos_to_loc(3) + assert_equal [2, 1], sub_buffer.pos_to_loc(4) + assert_equal [2, 2], sub_buffer.pos_to_loc(5) + assert_equal [3, 0], sub_buffer.pos_to_loc(6) + end + end end diff --git a/test/rbs/parser_test.rb b/test/rbs/parser_test.rb index 5de729450..dd5bc1848 100644 --- a/test/rbs/parser_test.rb +++ b/test/rbs/parser_test.rb @@ -62,7 +62,7 @@ def test_interface_mixin end def test_type_error_for_content - buffer = RBS::Buffer.new(content: 1, name: nil) + buffer = RBS::Buffer.new(content: 1, name: Pathname("a.rbs")) assert_raises TypeError do RBS::Parser.parse_signature(buffer) end From cbff9ec11bedb98a7bf71af100b96f6015a06466 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 8 Apr 2025 17:17:57 +0900 Subject: [PATCH 02/48] Let `Location` support sub buffers * Position APIs returns the absolute position of the buffer * Use `#local_location` to access the local positions of a sub-buffer --- ext/rbs_extension/location.c | 4 +- lib/rbs/location_aux.rb | 38 +++++++++++++++++-- sig/location.rbs | 37 +++++++++++++++--- test/rbs/location_test.rb | 72 ++++++++++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+), 11 deletions(-) diff --git a/ext/rbs_extension/location.c b/ext/rbs_extension/location.c index 5b251bbc6..ed9073a33 100644 --- a/ext/rbs_extension/location.c +++ b/ext/rbs_extension/location.c @@ -314,8 +314,8 @@ void rbs__init_location(void) { rb_define_private_method(RBS_Location, "initialize", location_initialize, 3); rb_define_private_method(RBS_Location, "initialize_copy", location_initialize_copy, 1); rb_define_method(RBS_Location, "buffer", location_buffer, 0); - rb_define_method(RBS_Location, "start_pos", location_start_pos, 0); - rb_define_method(RBS_Location, "end_pos", location_end_pos, 0); + rb_define_method(RBS_Location, "_start_pos", location_start_pos, 0); + rb_define_method(RBS_Location, "_end_pos", location_end_pos, 0); rb_define_method(RBS_Location, "_add_required_child", location_add_required_child, 3); rb_define_method(RBS_Location, "_add_optional_child", location_add_optional_child, 3); rb_define_method(RBS_Location, "_add_optional_no_child", location_add_optional_no_child, 1); diff --git a/lib/rbs/location_aux.rb b/lib/rbs/location_aux.rb index de0413686..7a5cf7988 100644 --- a/lib/rbs/location_aux.rb +++ b/lib/rbs/location_aux.rb @@ -28,6 +28,14 @@ def self.new(buffer_ = nil, start_pos_ = nil, end_pos_ = nil, buffer: nil, start WithChildren = self + def start_pos + buffer.absolute_position(_start_pos) || raise + end + + def end_pos + buffer.absolute_position(_end_pos) || raise + end + def name buffer.name end @@ -49,11 +57,11 @@ def end_column end def start_loc - @start_loc ||= buffer.pos_to_loc(start_pos) + @start_loc ||= buffer.top_buffer.pos_to_loc(start_pos) end def end_loc - @end_loc ||= buffer.pos_to_loc(end_pos) + @end_loc ||= buffer.top_buffer.pos_to_loc(end_pos) end def range @@ -61,7 +69,7 @@ def range end def source - @source ||= (buffer.content[range] || raise) + @source ||= (buffer.top_buffer.content[range] || raise) end def to_s @@ -134,5 +142,29 @@ def optional_key?(name) def required_key?(name) _required_keys.include?(name) end + + def local_location + loc = Location.new(buffer.detach, _start_pos, _end_pos) + + each_optional_key do |key| + value = self[key] + if value + loc.add_optional_child(key, value._start_pos...value._end_pos) + else + loc.add_optional_child(key, nil) + end + end + + each_required_key do |key| + value = self[key] or raise + loc.add_required_child(key, value._start_pos...value._end_pos) + end + + loc #: self + end + + def local_source + local_location.source + end end end diff --git a/sig/location.rbs b/sig/location.rbs index e6d7fac45..d27bb616b 100644 --- a/sig/location.rbs +++ b/sig/location.rbs @@ -8,10 +8,16 @@ module RBS # The buffer this location points on. attr_reader buffer (): Buffer - # The index of character the range starts from. + # The absolute start index of character the range starts from + # + # It returns the index in the `buffer.top_buffer`. + # attr_reader start_pos (): Integer - # The index of character the range ends at. + # The absolute end index of character the range ends at + # + # It returns the index in the `buffer.top_buffer`. + # attr_reader end_pos (): Integer def initialize: (Buffer, Integer start_pos, Integer end_pos) -> void @@ -24,26 +30,37 @@ module RBS # Returns the name of the buffer. def name: () -> untyped - # Line of the `start_pos` (1 origin) + # The *raw* index of character the range starts from. + attr_reader _start_pos (): Integer + + # The *raw* index of character the range ends at. + attr_reader _end_pos (): Integer + + # Line of the `start_pos` (1 origin, absolute) attr_reader start_line (): Integer - # Column of the `start_pos` (0 origin) + # Column of the `start_pos` (0 origin, absolute) attr_reader start_column (): Integer - # Line of the `end_pos` (1 origin) + # Line of the `end_pos` (1 origin, absolute) attr_reader end_line (): Integer - # Column of the `end_pos` (0 origin) + # Column of the `end_pos` (0 origin, absolute) attr_reader end_column (): Integer + # The absolute line-column pair of the start position + # attr_reader start_loc (): Buffer::loc @start_loc: Buffer::loc? + # The absolute line-column pair of the end position + # attr_reader end_loc (): Buffer::loc @end_loc: Buffer::loc? + # The absolute range of the start and end position attr_reader range (): Range[Integer] @range: Range[Integer]? @@ -97,6 +114,14 @@ module RBS def key?: (Symbol) -> bool + # Returns the location of the buffer, but the buffer is detached from the parent buffer + # + def local_location: () -> self + + # Returns the source of `#local_location` + # + def local_source: () -> String + private def _add_required_child: (RequiredChildKeys name, Integer start_pos, Integer end_pos) -> void diff --git a/test/rbs/location_test.rb b/test/rbs/location_test.rb index ffcbe2b44..5d8e8e4d2 100644 --- a/test/rbs/location_test.rb +++ b/test/rbs/location_test.rb @@ -89,6 +89,78 @@ def test_location_inspect assert_include loc.inspect, "source=\"class Foo\"" end + def test_sub_buffer_location + buffer = buffer() + # 01 + # bc + buffer = buffer.sub_buffer(lines: [0...2, 5...7]) + + loc = Location.new(buffer, 0, 5) + + # Raw positions + assert_equal 0, loc._start_pos + assert_equal 5, loc._end_pos + + # Absolute positions + assert_equal 0, loc.start_pos + assert_equal 7, loc.end_pos + assert_equal [1, 0], loc.start_loc + assert_equal [2, 3], loc.end_loc + + assert_equal "123\nabc", loc.source + + loc.add_optional_child(:opt, 0...2) + loc[:opt].tap do |loc| + assert_equal 0, loc.start_pos + assert_equal 2, loc.end_pos + assert_equal "12", loc.source + end + + loc.add_required_child(:req, 1...4) + loc[:req].tap do |loc| + assert_equal 1, loc.start_pos + assert_equal 6, loc.end_pos + assert_equal "23\nab", loc.source + end + end + + def test_sub_buffer_local_location + buffer = buffer() + # 01 + # bc + buffer = buffer.sub_buffer(lines: [0...2, 5...7]) + + loc = Location.new(buffer, 0, 5) + loc.add_optional_child(:opt, 0...2) + loc.add_required_child(:req, 1...4) + + loc = loc.local_location + + # Raw positions + assert_equal 0, loc._start_pos + assert_equal 5, loc._end_pos + + # Absolute positions in sub buffer + assert_equal 0, loc.start_pos + assert_equal 5, loc.end_pos + assert_equal [1, 0], loc.start_loc + assert_equal [2, 2], loc.end_loc + + assert_equal "12\nbc", loc.source + + loc[:opt].tap do |loc| + assert_equal 0, loc.start_pos + assert_equal 2, loc.end_pos + assert_equal "12", loc.source + end + + loc[:req].tap do |loc| + assert_equal 1, loc.start_pos + assert_equal 4, loc.end_pos + assert_equal "2\nb", loc.source + end + end + private def buffer(content: nil) From 4a9d257d8bbc5c8acb07230170dadbed688dcb56 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Wed, 9 Apr 2025 16:53:30 +0900 Subject: [PATCH 03/48] Add inline annotation AST --- lib/rbs.rb | 1 + lib/rbs/ast/ruby/annotations.rb | 78 +++++++++++++++++++++++++++++++++ sig/ast/ruby/annotations.rbs | 69 +++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 lib/rbs/ast/ruby/annotations.rb create mode 100644 sig/ast/ruby/annotations.rbs diff --git a/lib/rbs.rb b/lib/rbs.rb index 2a98abc6d..9d8cc4377 100644 --- a/lib/rbs.rb +++ b/lib/rbs.rb @@ -27,6 +27,7 @@ require "rbs/ast/visitor" require "rbs/ast/ruby/helpers/constant_helper" require "rbs/ast/ruby/helpers/location_helper" +require "rbs/ast/ruby/annotations" require "rbs/ast/ruby/declarations" require "rbs/ast/ruby/members" require "rbs/source" diff --git a/lib/rbs/ast/ruby/annotations.rb b/lib/rbs/ast/ruby/annotations.rb new file mode 100644 index 000000000..34f8c1b83 --- /dev/null +++ b/lib/rbs/ast/ruby/annotations.rb @@ -0,0 +1,78 @@ +module RBS + module AST + module Ruby + module Annotations + class Base + attr_reader :location, :prefix_location + + def initialize(location, prefix_location) + @location = location + @prefix_location = prefix_location + end + + def buffer + location.buffer + end + end + + class NodeTypeAssertion < Base + attr_reader :type + + def initialize(location:, prefix_location:, type:) + super(location, prefix_location) + @type = type + end + + def map_type_name + self.class.new( + location:, prefix_location:, + type: type.map_type_name { yield _1 } + ) #: self + end + end + + class ColonMethodTypeAnnotation < Base + attr_reader :annotations, :method_type + + def initialize(location:, prefix_location:, annotations:, method_type:) + super(location, prefix_location) + @annotations = annotations + @method_type = method_type + end + + def map_type_name + self.class.new( + location:, + prefix_location:, + annotations: annotations, + method_type: method_type.map_type {|type| type.map_type_name { yield _1 }} + ) #: self + end + end + + class MethodTypesAnnotation < Base + Overload = AST::Members::MethodDefinition::Overload + + attr_reader :overloads, :vertical_bar_locations + + def initialize(location:, prefix_location:, overloads:, vertical_bar_locations:) + super(location, prefix_location) + @overloads = overloads + @vertical_bar_locations = vertical_bar_locations + end + + def map_type_name(&block) + ovs = overloads.map do |overload| + Overload.new( + method_type: overload.method_type.map_type {|type| type.map_type_name { yield _1 } }, + annotations: overload.annotations + ) + end + + self.class.new(location:, prefix_location:, overloads: ovs, vertical_bar_locations:) #: self + end + end + end + end + end +end diff --git a/sig/ast/ruby/annotations.rbs b/sig/ast/ruby/annotations.rbs new file mode 100644 index 000000000..433047f92 --- /dev/null +++ b/sig/ast/ruby/annotations.rbs @@ -0,0 +1,69 @@ +module RBS + module AST + module Ruby + module Annotations + type leading_annotation = ColonMethodTypeAnnotation + | MethodTypesAnnotation + + type trailing_annotation = NodeTypeAssertion + + type t = leading_annotation | trailing_annotation + + class Base + # Location that covers all of the annotation + # + attr_reader location: Location + + # Location of `@rbs`, `@rbs!`, or `:` prefix + # + attr_reader prefix_location: Location + + def initialize: (Location location, Location prefix_location) -> void + + def buffer: () -> Buffer + end + + # `: TYPE` annotation attached to nodes + # + class NodeTypeAssertion < Base + attr_reader type: Types::t + + def initialize: (location: Location, prefix_location: Location, type: Types::t) -> void + + def map_type_name: () { (TypeName) -> TypeName } -> self + end + + # `: METHOD-TYPE` annotation in leading comments + # + class ColonMethodTypeAnnotation < Base + attr_reader annotations: Array[AST::Annotation] + + attr_reader method_type: MethodType + + def initialize: (location: Location, prefix_location: Location, annotations: Array[AST::Annotation], method_type: MethodType) -> void + + def map_type_name: () { (TypeName) -> TypeName } -> self + end + + # `@rbs METHOD-TYPEs` annotation in leading comments + # + # ``` + # @rbs () -> void | %a{foo} () -> String + # ^^^^ -- prefix_location + # ^ -- vertical_bar_locations[0] + # ``` + class MethodTypesAnnotation < Base + class Overload = AST::Members::MethodDefinition::Overload + + attr_reader overloads: Array[Overload] + + attr_reader vertical_bar_locations: Array[Location] + + def initialize: (location: Location, prefix_location: Location, overloads: Array[Overload], vertical_bar_locations: Array[Location]) -> void + + def map_type_name: () { (TypeName) -> TypeName } -> self + end + end + end + end +end From 7211c18eb6ffe6b13cb6cce2567fc257a8e34e46 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Wed, 9 Apr 2025 17:06:40 +0900 Subject: [PATCH 04/48] Add `@rbs` token --- ext/rbs_extension/lexer.c | 1503 ++++++++++++++-------------- ext/rbs_extension/lexer.h | 1 + ext/rbs_extension/lexer.re | 1 + ext/rbs_extension/lexstate.c | 1 + ext/rbs_extension/parser.c | 16 +- test/rbs/signature_parsing_test.rb | 12 + 6 files changed, 799 insertions(+), 735 deletions(-) diff --git a/ext/rbs_extension/lexer.c b/ext/rbs_extension/lexer.c index 73984cf84..880786046 100644 --- a/ext/rbs_extension/lexer.c +++ b/ext/rbs_extension/lexer.c @@ -115,13 +115,13 @@ token rbsparser_next_token(lexstate *state) { } yy1: rbs_skip(state); -#line 144 "ext/rbs_extension/lexer.re" +#line 145 "ext/rbs_extension/lexer.re" { return next_eof_token(state); } #line 121 "ext/rbs_extension/lexer.c" yy2: rbs_skip(state); yy3: -#line 145 "ext/rbs_extension/lexer.re" +#line 146 "ext/rbs_extension/lexer.re" { return next_token(state, ErrorToken); } #line 127 "ext/rbs_extension/lexer.c" yy4: @@ -130,7 +130,7 @@ token rbsparser_next_token(lexstate *state) { if (yych == '\t') goto yy4; if (yych == ' ') goto yy4; yy5: -#line 143 "ext/rbs_extension/lexer.re" +#line 144 "ext/rbs_extension/lexer.re" { return next_token(state, tTRIVIA); } #line 136 "ext/rbs_extension/lexer.c" yy6: @@ -420,25 +420,34 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); backup = *state; yych = peek(state); - if (yych <= '^') { - if (yych <= '?') goto yy3; - if (yych <= '@') goto yy102; - if (yych <= 'Z') goto yy103; - goto yy3; + if (yych <= '_') { + if (yych <= '@') { + if (yych <= '?') goto yy3; + goto yy102; + } else { + if (yych <= 'Z') goto yy103; + if (yych <= '^') goto yy3; + goto yy103; + } } else { - if (yych == '`') goto yy3; - if (yych <= 'z') goto yy103; - goto yy3; + if (yych <= 'q') { + if (yych <= '`') goto yy3; + goto yy103; + } else { + if (yych <= 'r') goto yy106; + if (yych <= 'z') goto yy103; + goto yy3; + } } yy36: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy36; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { @@ -450,50 +459,50 @@ token rbsparser_next_token(lexstate *state) { } } yy37: -#line 129 "ext/rbs_extension/lexer.re" +#line 130 "ext/rbs_extension/lexer.re" { return next_token(state, tUIDENT); } -#line 456 "ext/rbs_extension/lexer.c" +#line 465 "ext/rbs_extension/lexer.c" yy38: rbs_skip(state); yych = peek(state); - if (yych == ']') goto yy107; + if (yych == ']') goto yy109; #line 26 "ext/rbs_extension/lexer.re" { return next_token(state, pLBRACKET); } -#line 463 "ext/rbs_extension/lexer.c" +#line 472 "ext/rbs_extension/lexer.c" yy39: rbs_skip(state); #line 27 "ext/rbs_extension/lexer.re" { return next_token(state, pRBRACKET); } -#line 468 "ext/rbs_extension/lexer.c" +#line 477 "ext/rbs_extension/lexer.c" yy40: rbs_skip(state); #line 32 "ext/rbs_extension/lexer.re" { return next_token(state, pHAT); } -#line 473 "ext/rbs_extension/lexer.c" +#line 482 "ext/rbs_extension/lexer.c" yy41: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { - if (yych <= '9') goto yy108; - if (yych >= '=') goto yy106; + if (yych <= '9') goto yy110; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { if (yych <= '@') goto yy42; - if (yych <= 'Z') goto yy111; + if (yych <= 'Z') goto yy113; } else { - if (yych <= '_') goto yy113; + if (yych <= '_') goto yy115; if (yych <= '`') goto yy42; - if (yych <= 'z') goto yy108; + if (yych <= 'z') goto yy110; } } yy42: -#line 132 "ext/rbs_extension/lexer.re" +#line 133 "ext/rbs_extension/lexer.re" { return next_token(state, tULLIDENT); } -#line 497 "ext/rbs_extension/lexer.c" +#line 506 "ext/rbs_extension/lexer.c" yy43: yyaccept = 4; rbs_skip(state); @@ -501,54 +510,54 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= ' ') { if (yych <= 0x00000000) goto yy44; - if (yych <= 0x0000001F) goto yy114; + if (yych <= 0x0000001F) goto yy116; } else { - if (yych != ':') goto yy114; + if (yych != ':') goto yy116; } yy44: #line 39 "ext/rbs_extension/lexer.re" { return next_token(state, tOPERATOR); } -#line 512 "ext/rbs_extension/lexer.c" +#line 521 "ext/rbs_extension/lexer.c" yy45: rbs_skip(state); yych = peek(state); if (yych <= 'r') { - if (yych == 'l') goto yy115; + if (yych == 'l') goto yy117; goto yy53; } else { - if (yych <= 's') goto yy116; - if (yych <= 't') goto yy118; + if (yych <= 's') goto yy118; + if (yych <= 't') goto yy120; goto yy53; } yy46: -#line 128 "ext/rbs_extension/lexer.re" +#line 129 "ext/rbs_extension/lexer.re" { return next_token(state, tLIDENT); } -#line 527 "ext/rbs_extension/lexer.c" +#line 536 "ext/rbs_extension/lexer.c" yy47: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy119; + if (yych == 'o') goto yy121; goto yy53; yy48: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy120; + if (yych == 'l') goto yy122; goto yy53; yy49: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy121; + if (yych == 'e') goto yy123; goto yy53; yy50: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy122; - if (yych == 'x') goto yy123; + if (yych == 'n') goto yy124; + if (yych == 'x') goto yy125; goto yy53; yy51: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy124; + if (yych == 'a') goto yy126; goto yy53; yy52: rbs_skip(state); @@ -556,12 +565,12 @@ token rbsparser_next_token(lexstate *state) { yy53: if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; goto yy46; } else { if (yych <= '9') goto yy52; if (yych <= '<') goto yy46; - goto yy106; + goto yy108; } } else { if (yych <= '^') { @@ -577,72 +586,72 @@ token rbsparser_next_token(lexstate *state) { yy54: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy125; + if (yych == 'n') goto yy127; goto yy53; yy55: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy127; + if (yych == 'o') goto yy129; goto yy53; yy56: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy128; + if (yych == 'i') goto yy130; goto yy53; yy57: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy129; + if (yych == 'u') goto yy131; goto yy53; yy58: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy130; - if (yych == 'u') goto yy131; + if (yych == 'r') goto yy132; + if (yych == 'u') goto yy133; goto yy53; yy59: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy132; - if (yych == 'i') goto yy133; + if (yych == 'e') goto yy134; + if (yych == 'i') goto yy135; goto yy53; yy60: rbs_skip(state); yych = peek(state); if (yych <= 'q') { - if (yych == 'o') goto yy134; + if (yych == 'o') goto yy136; goto yy53; } else { - if (yych <= 'r') goto yy135; - if (yych == 'y') goto yy136; + if (yych <= 'r') goto yy137; + if (yych == 'y') goto yy138; goto yy53; } yy61: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy137; - if (yych == 's') goto yy138; + if (yych == 'n') goto yy139; + if (yych == 's') goto yy140; goto yy53; yy62: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy139; + if (yych == 'o') goto yy141; goto yy53; yy63: rbs_skip(state); #line 28 "ext/rbs_extension/lexer.re" { return next_token(state, pLBRACE); } -#line 636 "ext/rbs_extension/lexer.c" +#line 645 "ext/rbs_extension/lexer.c" yy64: rbs_skip(state); #line 31 "ext/rbs_extension/lexer.re" { return next_token(state, pBAR); } -#line 641 "ext/rbs_extension/lexer.c" +#line 650 "ext/rbs_extension/lexer.c" yy65: rbs_skip(state); #line 29 "ext/rbs_extension/lexer.re" { return next_token(state, pRBRACE); } -#line 646 "ext/rbs_extension/lexer.c" +#line 655 "ext/rbs_extension/lexer.c" yy66: rbs_skip(state); yych = peek(state); @@ -679,19 +688,19 @@ token rbsparser_next_token(lexstate *state) { goto yy78; } } else { - goto yy155; + goto yy157; } } yy69: rbs_skip(state); -#line 106 "ext/rbs_extension/lexer.re" +#line 107 "ext/rbs_extension/lexer.re" { return next_token(state, tDQSTRING); } -#line 690 "ext/rbs_extension/lexer.c" +#line 699 "ext/rbs_extension/lexer.c" yy70: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy140; - if (yych == 'x') goto yy141; + if (yych == 'u') goto yy142; + if (yych == 'x') goto yy143; goto yy66; yy71: rbs_skip(state); @@ -723,9 +732,9 @@ token rbsparser_next_token(lexstate *state) { } } yy72: -#line 139 "ext/rbs_extension/lexer.re" +#line 140 "ext/rbs_extension/lexer.re" { return next_token(state, tGIDENT); } -#line 729 "ext/rbs_extension/lexer.c" +#line 738 "ext/rbs_extension/lexer.c" yy73: rbs_skip(state); goto yy72; @@ -735,18 +744,18 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 'Z') { if (yych <= '(') { if (yych <= '\'') goto yy68; - goto yy142; + goto yy144; } else { - if (yych == '<') goto yy143; + if (yych == '<') goto yy145; goto yy68; } } else { if (yych <= 'z') { - if (yych <= '[') goto yy144; + if (yych <= '[') goto yy146; goto yy68; } else { - if (yych <= '{') goto yy145; - if (yych <= '|') goto yy146; + if (yych <= '{') goto yy147; + if (yych <= '|') goto yy148; goto yy68; } } @@ -764,16 +773,16 @@ token rbsparser_next_token(lexstate *state) { yy77: rbs_skip(state); yy78: -#line 107 "ext/rbs_extension/lexer.re" +#line 108 "ext/rbs_extension/lexer.re" { return next_token(state, tSQSTRING); } -#line 770 "ext/rbs_extension/lexer.c" +#line 779 "ext/rbs_extension/lexer.c" yy79: rbs_skip(state); yych = peek(state); if (yych <= '\'') { if (yych <= 0x00000000) goto yy68; if (yych <= '&') goto yy75; - goto yy147; + goto yy149; } else { if (yych == '\\') goto yy79; goto yy75; @@ -782,16 +791,16 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); #line 36 "ext/rbs_extension/lexer.re" { return next_token(state, pSTAR2); } -#line 786 "ext/rbs_extension/lexer.c" +#line 795 "ext/rbs_extension/lexer.c" yy81: rbs_skip(state); #line 41 "ext/rbs_extension/lexer.re" { return next_token(state, pARROW); } -#line 791 "ext/rbs_extension/lexer.c" +#line 800 "ext/rbs_extension/lexer.c" yy82: rbs_skip(state); yych = peek(state); - if (yych == '.') goto yy148; + if (yych == '.') goto yy150; goto yy68; yy83: rbs_skip(state); @@ -799,18 +808,18 @@ token rbsparser_next_token(lexstate *state) { if (yych == '=') goto yy87; if (yych == '~') goto yy87; yy84: -#line 126 "ext/rbs_extension/lexer.re" +#line 127 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 805 "ext/rbs_extension/lexer.c" +#line 814 "ext/rbs_extension/lexer.c" yy85: rbs_skip(state); yych = peek(state); if (yych <= '"') { if (yych <= 0x00000000) goto yy68; if (yych <= '!') goto yy85; - goto yy149; + goto yy151; } else { - if (yych == '\\') goto yy150; + if (yych == '\\') goto yy152; goto yy85; } yy86: @@ -820,42 +829,42 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 0x0000001F) { if (yych <= '\n') { if (yych <= 0x00000000) goto yy68; - if (yych <= 0x00000008) goto yy151; + if (yych <= 0x00000008) goto yy153; goto yy68; } else { if (yych == '\r') goto yy68; - goto yy151; + goto yy153; } } else { if (yych <= '#') { if (yych <= ' ') goto yy68; - if (yych <= '"') goto yy153; - goto yy151; + if (yych <= '"') goto yy155; + goto yy153; } else { if (yych == '%') goto yy68; - if (yych <= '\'') goto yy153; + if (yych <= '\'') goto yy155; goto yy68; } } } else { if (yych <= 'Z') { if (yych <= '/') { - if (yych == '-') goto yy151; - goto yy153; + if (yych == '-') goto yy153; + goto yy155; } else { - if (yych <= '9') goto yy151; - if (yych <= '>') goto yy153; - goto yy151; + if (yych <= '9') goto yy153; + if (yych <= '>') goto yy155; + goto yy153; } } else { if (yych <= '^') { - if (yych == '\\') goto yy153; + if (yych == '\\') goto yy155; goto yy68; } else { - if (yych <= 'z') goto yy151; + if (yych <= 'z') goto yy153; if (yych <= '}') goto yy68; - if (yych <= '~') goto yy153; - goto yy151; + if (yych <= '~') goto yy155; + goto yy153; } } } @@ -868,9 +877,9 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '\'') { if (yych <= 0x00000000) goto yy68; if (yych <= '&') goto yy88; - goto yy154; + goto yy156; } else { - if (yych == '\\') goto yy156; + if (yych == '\\') goto yy158; goto yy88; } yy89: @@ -887,18 +896,18 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); #line 45 "ext/rbs_extension/lexer.re" { return next_token(state, pCOLON2); } -#line 891 "ext/rbs_extension/lexer.c" +#line 900 "ext/rbs_extension/lexer.c" yy92: rbs_skip(state); yych = peek(state); if (yych <= ';') goto yy84; if (yych <= '<') goto yy87; - if (yych <= '=') goto yy157; + if (yych <= '=') goto yy159; goto yy84; yy93: rbs_skip(state); yych = peek(state); - if (yych == '=') goto yy158; + if (yych == '=') goto yy160; if (yych == '~') goto yy87; goto yy68; yy94: @@ -912,12 +921,12 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '^') { if (yych <= '?') goto yy68; - if (yych <= '@') goto yy159; - if (yych <= 'Z') goto yy160; + if (yych <= '@') goto yy161; + if (yych <= 'Z') goto yy162; goto yy68; } else { if (yych == '`') goto yy68; - if (yych <= 'z') goto yy160; + if (yych <= 'z') goto yy162; goto yy68; } yy96: @@ -925,14 +934,14 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy162; + if (yych == '!') goto yy164; } else { if (yych <= '9') goto yy96; - if (yych == '=') goto yy162; + if (yych == '=') goto yy164; } } else { if (yych <= '^') { - if (yych <= '?') goto yy162; + if (yych <= '?') goto yy164; if (yych <= '@') goto yy97; if (yych <= 'Z') goto yy96; } else { @@ -941,13 +950,13 @@ token rbsparser_next_token(lexstate *state) { } } yy97: -#line 122 "ext/rbs_extension/lexer.re" +#line 123 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 947 "ext/rbs_extension/lexer.c" +#line 956 "ext/rbs_extension/lexer.c" yy98: rbs_skip(state); yych = peek(state); - if (yych == ']') goto yy158; + if (yych == ']') goto yy160; goto yy68; yy99: rbs_skip(state); @@ -963,256 +972,252 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); #line 42 "ext/rbs_extension/lexer.re" { return next_token(state, pFATARROW); } -#line 967 "ext/rbs_extension/lexer.c" +#line 976 "ext/rbs_extension/lexer.c" yy102: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '@') goto yy68; - if (yych <= 'Z') goto yy163; + if (yych <= 'Z') goto yy165; goto yy68; } else { if (yych == '`') goto yy68; - if (yych <= 'z') goto yy163; + if (yych <= 'z') goto yy165; goto yy68; } yy103: rbs_skip(state); yych = peek(state); +yy104: if (yych <= 'Z') { - if (yych <= '/') goto yy104; + if (yych <= '/') goto yy105; if (yych <= '9') goto yy103; if (yych >= 'A') goto yy103; } else { if (yych <= '_') { if (yych >= '_') goto yy103; } else { - if (yych <= '`') goto yy104; + if (yych <= '`') goto yy105; if (yych <= 'z') goto yy103; } } -yy104: -#line 136 "ext/rbs_extension/lexer.re" - { return next_token(state, tAIDENT); } -#line 998 "ext/rbs_extension/lexer.c" yy105: - rbs_skip(state); -#line 133 "ext/rbs_extension/lexer.re" - { return next_token(state, tBANGIDENT); } -#line 1003 "ext/rbs_extension/lexer.c" +#line 137 "ext/rbs_extension/lexer.re" + { return next_token(state, tAIDENT); } +#line 1008 "ext/rbs_extension/lexer.c" yy106: rbs_skip(state); + yych = peek(state); + if (yych == 'b') goto yy167; + goto yy104; +yy107: + rbs_skip(state); #line 134 "ext/rbs_extension/lexer.re" + { return next_token(state, tBANGIDENT); } +#line 1018 "ext/rbs_extension/lexer.c" +yy108: + rbs_skip(state); +#line 135 "ext/rbs_extension/lexer.re" { return next_token(state, tEQIDENT); } -#line 1008 "ext/rbs_extension/lexer.c" -yy107: +#line 1023 "ext/rbs_extension/lexer.c" +yy109: rbs_skip(state); yych = peek(state); if (yych == '=') goto yy24; #line 47 "ext/rbs_extension/lexer.re" { return next_token(state, pAREF_OPR); } -#line 1015 "ext/rbs_extension/lexer.c" -yy108: +#line 1030 "ext/rbs_extension/lexer.c" +yy110: rbs_skip(state); yych = peek(state); -yy109: +yy111: if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { - if (yych <= '9') goto yy108; - if (yych >= '=') goto yy106; + if (yych <= '9') goto yy110; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy110; - if (yych <= 'Z') goto yy108; + if (yych <= '@') goto yy112; + if (yych <= 'Z') goto yy110; } else { - if (yych == '`') goto yy110; - if (yych <= 'z') goto yy108; + if (yych == '`') goto yy112; + if (yych <= 'z') goto yy110; } } -yy110: -#line 130 "ext/rbs_extension/lexer.re" +yy112: +#line 131 "ext/rbs_extension/lexer.re" { return next_token(state, tULLIDENT); } -#line 1039 "ext/rbs_extension/lexer.c" -yy111: +#line 1054 "ext/rbs_extension/lexer.c" +yy113: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { - if (yych <= '9') goto yy111; - if (yych >= '=') goto yy106; + if (yych <= '9') goto yy113; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy112; - if (yych <= 'Z') goto yy111; + if (yych <= '@') goto yy114; + if (yych <= 'Z') goto yy113; } else { - if (yych == '`') goto yy112; - if (yych <= 'z') goto yy111; + if (yych == '`') goto yy114; + if (yych <= 'z') goto yy113; } } -yy112: -#line 131 "ext/rbs_extension/lexer.re" +yy114: +#line 132 "ext/rbs_extension/lexer.re" { return next_token(state, tULIDENT); } -#line 1062 "ext/rbs_extension/lexer.c" -yy113: +#line 1077 "ext/rbs_extension/lexer.c" +yy115: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy165; - goto yy109; -yy114: + if (yych == 't') goto yy168; + goto yy111; +yy116: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '`') goto yy166; - goto yy114; -yy115: + if (yych == '`') goto yy169; + goto yy116; +yy117: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy167; + if (yych == 'i') goto yy170; goto yy53; -yy116: +yy118: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy117; + if (yych <= '@') goto yy119; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy117; + if (yych == '`') goto yy119; if (yych <= 'z') goto yy52; } } -yy117: +yy119: #line 96 "ext/rbs_extension/lexer.re" { return next_token(state, kAS); } -#line 1101 "ext/rbs_extension/lexer.c" -yy118: - rbs_skip(state); - yych = peek(state); - if (yych == 't') goto yy168; - goto yy53; -yy119: - rbs_skip(state); - yych = peek(state); - if (yych == 'o') goto yy169; - if (yych == 't') goto yy170; - goto yy53; +#line 1116 "ext/rbs_extension/lexer.c" yy120: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy172; + if (yych == 't') goto yy171; goto yy53; yy121: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy173; + if (yych == 'o') goto yy172; + if (yych == 't') goto yy173; goto yy53; yy122: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy175; + if (yych == 'a') goto yy175; goto yy53; yy123: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy177; + if (yych == 'f') goto yy176; goto yy53; yy124: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy178; + if (yych == 'd') goto yy178; goto yy53; yy125: + rbs_skip(state); + yych = peek(state); + if (yych == 't') goto yy180; + goto yy53; +yy126: + rbs_skip(state); + yych = peek(state); + if (yych == 'l') goto yy181; + goto yy53; +yy127: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '9') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; if (yych >= '0') goto yy52; } else { if (yych <= '=') { - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } else { - if (yych <= '@') goto yy126; + if (yych <= '@') goto yy128; if (yych <= 'Z') goto yy52; } } } else { if (yych <= 'c') { - if (yych == '`') goto yy126; + if (yych == '`') goto yy128; if (yych <= 'b') goto yy52; - goto yy179; + goto yy182; } else { if (yych <= 's') { if (yych <= 'r') goto yy52; - goto yy180; + goto yy183; } else { - if (yych <= 't') goto yy181; + if (yych <= 't') goto yy184; if (yych <= 'z') goto yy52; } } } -yy126: +yy128: #line 77 "ext/rbs_extension/lexer.re" { return next_token(state, kIN); } -#line 1171 "ext/rbs_extension/lexer.c" -yy127: - rbs_skip(state); - yych = peek(state); - if (yych == 'd') goto yy182; - goto yy53; -yy128: - rbs_skip(state); - yych = peek(state); - if (yych == 'l') goto yy183; - goto yy53; +#line 1186 "ext/rbs_extension/lexer.c" yy129: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy185; + if (yych == 'd') goto yy185; goto yy53; yy130: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy187; - if (yych == 'i') goto yy188; + if (yych == 'l') goto yy186; goto yy53; yy131: rbs_skip(state); yych = peek(state); - if (yych == 'b') goto yy189; + if (yych == 't') goto yy188; goto yy53; yy132: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy190; + if (yych == 'e') goto yy190; + if (yych == 'i') goto yy191; goto yy53; yy133: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy191; + if (yych == 'b') goto yy192; goto yy53; yy134: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy192; + if (yych == 'l') goto yy193; goto yy53; yy135: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy194; + if (yych == 'n') goto yy194; goto yy53; yy136: rbs_skip(state); @@ -1222,33 +1227,43 @@ token rbsparser_next_token(lexstate *state) { yy137: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy196; - if (yych == 't') goto yy197; + if (yych == 'u') goto yy197; goto yy53; yy138: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy198; + if (yych == 'p') goto yy198; goto yy53; yy139: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy200; + if (yych == 'c') goto yy199; + if (yych == 't') goto yy200; goto yy53; yy140: + rbs_skip(state); + yych = peek(state); + if (yych == 'e') goto yy201; + goto yy53; +yy141: + rbs_skip(state); + yych = peek(state); + if (yych == 'i') goto yy203; + goto yy53; +yy142: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy201; + if (yych <= '9') goto yy204; goto yy68; } else { - if (yych <= 'F') goto yy201; + if (yych <= 'F') goto yy204; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy201; + if (yych <= 'f') goto yy204; goto yy68; } -yy141: +yy143: rbs_skip(state); yych = peek(state); if (yych <= '/') goto yy68; @@ -1256,37 +1271,37 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '`') goto yy68; if (yych <= 'f') goto yy66; goto yy68; -yy142: - rbs_skip(state); - yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == ')') goto yy202; - goto yy142; -yy143: - rbs_skip(state); - yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == '>') goto yy203; - goto yy143; yy144: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == ']') goto yy204; + if (yych == ')') goto yy205; goto yy144; yy145: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '}') goto yy205; + if (yych == '>') goto yy206; goto yy145; yy146: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '|') goto yy206; + if (yych == ']') goto yy207; goto yy146; yy147: + rbs_skip(state); + yych = peek(state); + if (yych <= 0x00000000) goto yy68; + if (yych == '}') goto yy208; + goto yy147; +yy148: + rbs_skip(state); + yych = peek(state); + if (yych <= 0x00000000) goto yy68; + if (yych == '|') goto yy209; + goto yy148; +yy149: yyaccept = 5; rbs_skip(state); backup = *state; @@ -1299,466 +1314,471 @@ token rbsparser_next_token(lexstate *state) { if (yych == '\\') goto yy79; goto yy75; } -yy148: +yy150: rbs_skip(state); #line 38 "ext/rbs_extension/lexer.re" { return next_token(state, pDOT3); } -#line 1307 "ext/rbs_extension/lexer.c" -yy149: +#line 1322 "ext/rbs_extension/lexer.c" +yy151: rbs_skip(state); -#line 108 "ext/rbs_extension/lexer.re" +#line 109 "ext/rbs_extension/lexer.re" { return next_token(state, tDQSYMBOL); } -#line 1312 "ext/rbs_extension/lexer.c" -yy150: +#line 1327 "ext/rbs_extension/lexer.c" +yy152: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy207; - if (yych == 'x') goto yy208; + if (yych == 'u') goto yy210; + if (yych == 'x') goto yy211; goto yy85; -yy151: +yy153: rbs_skip(state); yych = peek(state); if (yych <= ',') { if (yych <= '\f') { - if (yych <= 0x00000000) goto yy152; - if (yych <= 0x00000008) goto yy151; - if (yych >= '\v') goto yy151; + if (yych <= 0x00000000) goto yy154; + if (yych <= 0x00000008) goto yy153; + if (yych >= '\v') goto yy153; } else { if (yych <= 0x0000001F) { - if (yych >= 0x0000000E) goto yy151; + if (yych >= 0x0000000E) goto yy153; } else { - if (yych == '#') goto yy151; + if (yych == '#') goto yy153; } } } else { if (yych <= '>') { - if (yych <= '-') goto yy151; - if (yych <= '/') goto yy152; - if (yych <= '9') goto yy151; + if (yych <= '-') goto yy153; + if (yych <= '/') goto yy154; + if (yych <= '9') goto yy153; } else { if (yych <= '^') { - if (yych <= 'Z') goto yy151; + if (yych <= 'Z') goto yy153; } else { - if (yych <= 'z') goto yy151; - if (yych >= 0x0000007F) goto yy151; + if (yych <= 'z') goto yy153; + if (yych >= 0x0000007F) goto yy153; } } } -yy152: -#line 125 "ext/rbs_extension/lexer.re" +yy154: +#line 126 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 1351 "ext/rbs_extension/lexer.c" -yy153: +#line 1366 "ext/rbs_extension/lexer.c" +yy155: rbs_skip(state); - goto yy152; -yy154: + goto yy154; +yy156: rbs_skip(state); -yy155: -#line 109 "ext/rbs_extension/lexer.re" +yy157: +#line 110 "ext/rbs_extension/lexer.re" { return next_token(state, tSQSYMBOL); } -#line 1360 "ext/rbs_extension/lexer.c" -yy156: +#line 1375 "ext/rbs_extension/lexer.c" +yy158: rbs_skip(state); yych = peek(state); if (yych <= '\'') { if (yych <= 0x00000000) goto yy68; if (yych <= '&') goto yy88; - goto yy209; + goto yy212; } else { - if (yych == '\\') goto yy156; + if (yych == '\\') goto yy158; goto yy88; } -yy157: +yy159: rbs_skip(state); yych = peek(state); if (yych == '>') goto yy87; goto yy84; -yy158: +yy160: rbs_skip(state); yych = peek(state); if (yych == '=') goto yy87; goto yy84; -yy159: +yy161: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '@') goto yy68; - if (yych <= 'Z') goto yy210; + if (yych <= 'Z') goto yy213; goto yy68; } else { if (yych == '`') goto yy68; - if (yych <= 'z') goto yy210; + if (yych <= 'z') goto yy213; goto yy68; } -yy160: +yy162: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy212; + if (yych == '!') goto yy215; } else { - if (yych <= '9') goto yy160; - if (yych == '=') goto yy212; + if (yych <= '9') goto yy162; + if (yych == '=') goto yy215; } } else { if (yych <= '^') { - if (yych <= '?') goto yy212; - if (yych <= '@') goto yy161; - if (yych <= 'Z') goto yy160; + if (yych <= '?') goto yy215; + if (yych <= '@') goto yy163; + if (yych <= 'Z') goto yy162; } else { - if (yych == '`') goto yy161; - if (yych <= 'z') goto yy160; + if (yych == '`') goto yy163; + if (yych <= 'z') goto yy162; } } -yy161: -#line 123 "ext/rbs_extension/lexer.re" +yy163: +#line 124 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 1417 "ext/rbs_extension/lexer.c" -yy162: +#line 1432 "ext/rbs_extension/lexer.c" +yy164: rbs_skip(state); goto yy97; -yy163: +yy165: rbs_skip(state); yych = peek(state); if (yych <= 'Z') { - if (yych <= '/') goto yy164; - if (yych <= '9') goto yy163; - if (yych >= 'A') goto yy163; + if (yych <= '/') goto yy166; + if (yych <= '9') goto yy165; + if (yych >= 'A') goto yy165; } else { if (yych <= '_') { - if (yych >= '_') goto yy163; + if (yych >= '_') goto yy165; } else { - if (yych <= '`') goto yy164; - if (yych <= 'z') goto yy163; + if (yych <= '`') goto yy166; + if (yych <= 'z') goto yy165; } } -yy164: -#line 137 "ext/rbs_extension/lexer.re" +yy166: +#line 138 "ext/rbs_extension/lexer.re" { return next_token(state, tA2IDENT); } -#line 1439 "ext/rbs_extension/lexer.c" -yy165: +#line 1454 "ext/rbs_extension/lexer.c" +yy167: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy213; - goto yy109; -yy166: + if (yych == 's') goto yy216; + goto yy104; +yy168: + rbs_skip(state); + yych = peek(state); + if (yych == 'o') goto yy218; + goto yy111; +yy169: rbs_skip(state); #line 40 "ext/rbs_extension/lexer.re" { return next_token(state, tQIDENT); } -#line 1449 "ext/rbs_extension/lexer.c" -yy167: +#line 1469 "ext/rbs_extension/lexer.c" +yy170: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy214; + if (yych == 'a') goto yy219; goto yy53; -yy168: +yy171: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy215; + if (yych == 'r') goto yy220; goto yy53; -yy169: +yy172: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy216; + if (yych == 'l') goto yy221; goto yy53; -yy170: +yy173: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy171; + if (yych <= '@') goto yy174; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy171; + if (yych == '`') goto yy174; if (yych <= 'z') goto yy52; } } -yy171: +yy174: #line 71 "ext/rbs_extension/lexer.re" { return next_token(state, kBOT); } -#line 1487 "ext/rbs_extension/lexer.c" -yy172: +#line 1507 "ext/rbs_extension/lexer.c" +yy175: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy218; + if (yych == 's') goto yy223; goto yy53; -yy173: +yy176: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy174; + if (yych <= '@') goto yy177; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy174; + if (yych == '`') goto yy177; if (yych <= 'z') goto yy52; } } -yy174: +yy177: #line 73 "ext/rbs_extension/lexer.re" { return next_token(state, kDEF); } -#line 1515 "ext/rbs_extension/lexer.c" -yy175: +#line 1535 "ext/rbs_extension/lexer.c" +yy178: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy176; + if (yych <= '@') goto yy179; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy176; + if (yych == '`') goto yy179; if (yych <= 'z') goto yy52; } } -yy176: +yy179: #line 74 "ext/rbs_extension/lexer.re" { return next_token(state, kEND); } -#line 1538 "ext/rbs_extension/lexer.c" -yy177: +#line 1558 "ext/rbs_extension/lexer.c" +yy180: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy219; + if (yych == 'e') goto yy224; goto yy53; -yy178: +yy181: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy220; + if (yych == 's') goto yy225; goto yy53; -yy179: +yy182: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy221; + if (yych == 'l') goto yy226; goto yy53; -yy180: +yy183: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy222; + if (yych == 't') goto yy227; goto yy53; -yy181: +yy184: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy223; + if (yych == 'e') goto yy228; goto yy53; -yy182: +yy185: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy224; + if (yych == 'u') goto yy229; goto yy53; -yy183: +yy186: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy184; + if (yych <= '@') goto yy187; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy184; + if (yych == '`') goto yy187; if (yych <= 'z') goto yy52; } } -yy184: +yy187: #line 82 "ext/rbs_extension/lexer.re" { return next_token(state, kNIL); } -#line 1591 "ext/rbs_extension/lexer.c" -yy185: +#line 1611 "ext/rbs_extension/lexer.c" +yy188: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy186; + if (yych <= '@') goto yy189; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy186; + if (yych == '`') goto yy189; if (yych <= 'z') goto yy52; } } -yy186: +yy189: #line 83 "ext/rbs_extension/lexer.re" { return next_token(state, kOUT); } -#line 1614 "ext/rbs_extension/lexer.c" -yy187: +#line 1634 "ext/rbs_extension/lexer.c" +yy190: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy225; + if (yych == 'p') goto yy230; goto yy53; -yy188: +yy191: rbs_skip(state); yych = peek(state); - if (yych == 'v') goto yy226; + if (yych == 'v') goto yy231; goto yy53; -yy189: +yy192: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy227; + if (yych == 'l') goto yy232; goto yy53; -yy190: +yy193: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy228; + if (yych == 'f') goto yy233; goto yy53; -yy191: +yy194: rbs_skip(state); yych = peek(state); - if (yych == 'g') goto yy230; + if (yych == 'g') goto yy235; goto yy53; -yy192: +yy195: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy193; + if (yych <= '@') goto yy196; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy193; + if (yych == '`') goto yy196; if (yych <= 'z') goto yy52; } } -yy193: +yy196: #line 89 "ext/rbs_extension/lexer.re" { return next_token(state, kTOP); } -#line 1662 "ext/rbs_extension/lexer.c" -yy194: +#line 1682 "ext/rbs_extension/lexer.c" +yy197: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy231; + if (yych == 'e') goto yy236; goto yy53; -yy195: +yy198: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy233; + if (yych == 'e') goto yy238; goto yy53; -yy196: +yy199: rbs_skip(state); yych = peek(state); - if (yych == 'h') goto yy235; + if (yych == 'h') goto yy240; goto yy53; -yy197: +yy200: rbs_skip(state); yych = peek(state); - if (yych == 'y') goto yy236; + if (yych == 'y') goto yy241; goto yy53; -yy198: +yy201: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy199; + if (yych <= '@') goto yy202; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy199; + if (yych == '`') goto yy202; if (yych <= 'z') goto yy52; } } -yy199: +yy202: #line 95 "ext/rbs_extension/lexer.re" { return next_token(state, kUSE); } -#line 1705 "ext/rbs_extension/lexer.c" -yy200: +#line 1725 "ext/rbs_extension/lexer.c" +yy203: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy237; + if (yych == 'd') goto yy242; goto yy53; -yy201: +yy204: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy239; + if (yych <= '9') goto yy244; goto yy68; } else { - if (yych <= 'F') goto yy239; + if (yych <= 'F') goto yy244; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy239; + if (yych <= 'f') goto yy244; goto yy68; } -yy202: +yy205: rbs_skip(state); #line 54 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1728 "ext/rbs_extension/lexer.c" -yy203: +#line 1748 "ext/rbs_extension/lexer.c" +yy206: rbs_skip(state); #line 57 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1733 "ext/rbs_extension/lexer.c" -yy204: +#line 1753 "ext/rbs_extension/lexer.c" +yy207: rbs_skip(state); #line 55 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1738 "ext/rbs_extension/lexer.c" -yy205: +#line 1758 "ext/rbs_extension/lexer.c" +yy208: rbs_skip(state); #line 53 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1743 "ext/rbs_extension/lexer.c" -yy206: +#line 1763 "ext/rbs_extension/lexer.c" +yy209: rbs_skip(state); #line 56 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1748 "ext/rbs_extension/lexer.c" -yy207: +#line 1768 "ext/rbs_extension/lexer.c" +yy210: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy240; + if (yych <= '9') goto yy245; goto yy68; } else { - if (yych <= 'F') goto yy240; + if (yych <= 'F') goto yy245; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy240; + if (yych <= 'f') goto yy245; goto yy68; } -yy208: +yy211: rbs_skip(state); yych = peek(state); if (yych <= '/') goto yy68; @@ -1766,411 +1786,430 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '`') goto yy68; if (yych <= 'f') goto yy85; goto yy68; -yy209: +yy212: yyaccept = 6; rbs_skip(state); backup = *state; yych = peek(state); if (yych <= '\'') { - if (yych <= 0x00000000) goto yy155; + if (yych <= 0x00000000) goto yy157; if (yych <= '&') goto yy88; - goto yy154; + goto yy156; } else { - if (yych == '\\') goto yy156; + if (yych == '\\') goto yy158; goto yy88; } -yy210: +yy213: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy241; + if (yych == '!') goto yy246; } else { - if (yych <= '9') goto yy210; - if (yych == '=') goto yy241; + if (yych <= '9') goto yy213; + if (yych == '=') goto yy246; } } else { if (yych <= '^') { - if (yych <= '?') goto yy241; - if (yych <= '@') goto yy211; - if (yych <= 'Z') goto yy210; + if (yych <= '?') goto yy246; + if (yych <= '@') goto yy214; + if (yych <= 'Z') goto yy213; } else { - if (yych == '`') goto yy211; - if (yych <= 'z') goto yy210; + if (yych == '`') goto yy214; + if (yych <= 'z') goto yy213; } } -yy211: -#line 124 "ext/rbs_extension/lexer.re" +yy214: +#line 125 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 1806 "ext/rbs_extension/lexer.c" -yy212: +#line 1826 "ext/rbs_extension/lexer.c" +yy215: rbs_skip(state); - goto yy161; -yy213: + goto yy163; +yy216: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy242; - goto yy109; -yy214: + if (yych <= 'Z') { + if (yych <= '/') goto yy217; + if (yych <= '9') goto yy103; + if (yych >= 'A') goto yy103; + } else { + if (yych <= '_') { + if (yych >= '_') goto yy103; + } else { + if (yych <= '`') goto yy217; + if (yych <= 'z') goto yy103; + } + } +yy217: +#line 98 "ext/rbs_extension/lexer.re" + { return next_token(state, kATRBS); } +#line 1848 "ext/rbs_extension/lexer.c" +yy218: + rbs_skip(state); + yych = peek(state); + if (yych == 'd') goto yy247; + goto yy111; +yy219: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy243; + if (yych == 's') goto yy248; goto yy53; -yy215: +yy220: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy245; + if (yych == '_') goto yy250; goto yy53; -yy216: +yy221: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy217; + if (yych <= '@') goto yy222; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy217; + if (yych == '`') goto yy222; if (yych <= 'z') goto yy52; } } -yy217: +yy222: #line 70 "ext/rbs_extension/lexer.re" { return next_token(state, kBOOL); } -#line 1847 "ext/rbs_extension/lexer.c" -yy218: +#line 1886 "ext/rbs_extension/lexer.c" +yy223: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy246; + if (yych == 's') goto yy251; goto yy53; -yy219: +yy224: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy248; + if (yych == 'n') goto yy253; goto yy53; -yy220: +yy225: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy249; + if (yych == 'e') goto yy254; goto yy53; -yy221: +yy226: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy251; + if (yych == 'u') goto yy256; goto yy53; -yy222: +yy227: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy252; + if (yych == 'a') goto yy257; goto yy53; -yy223: +yy228: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy253; + if (yych == 'r') goto yy258; goto yy53; -yy224: +yy229: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy254; + if (yych == 'l') goto yy259; goto yy53; -yy225: +yy230: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy255; + if (yych == 'e') goto yy260; goto yy53; -yy226: +yy231: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy256; + if (yych == 'a') goto yy261; goto yy53; -yy227: +yy232: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy257; + if (yych == 'i') goto yy262; goto yy53; -yy228: +yy233: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy229; + if (yych <= '@') goto yy234; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy229; + if (yych == '`') goto yy234; if (yych <= 'z') goto yy52; } } -yy229: +yy234: #line 87 "ext/rbs_extension/lexer.re" { return next_token(state, kSELF); } -#line 1920 "ext/rbs_extension/lexer.c" -yy230: +#line 1959 "ext/rbs_extension/lexer.c" +yy235: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy258; + if (yych == 'l') goto yy263; goto yy53; -yy231: +yy236: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy232; + if (yych <= '@') goto yy237; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy232; + if (yych == '`') goto yy237; if (yych <= 'z') goto yy52; } } -yy232: +yy237: #line 90 "ext/rbs_extension/lexer.re" { return next_token(state, kTRUE); } -#line 1948 "ext/rbs_extension/lexer.c" -yy233: +#line 1987 "ext/rbs_extension/lexer.c" +yy238: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy234; + if (yych <= '@') goto yy239; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy234; + if (yych == '`') goto yy239; if (yych <= 'z') goto yy52; } } -yy234: +yy239: #line 91 "ext/rbs_extension/lexer.re" { return next_token(state, kTYPE); } -#line 1971 "ext/rbs_extension/lexer.c" -yy235: +#line 2010 "ext/rbs_extension/lexer.c" +yy240: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy259; + if (yych == 'e') goto yy264; goto yy53; -yy236: +yy241: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy260; + if (yych == 'p') goto yy265; goto yy53; -yy237: +yy242: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy238; + if (yych <= '@') goto yy243; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy238; + if (yych == '`') goto yy243; if (yych <= 'z') goto yy52; } } -yy238: +yy243: #line 94 "ext/rbs_extension/lexer.re" { return next_token(state, kVOID); } -#line 2004 "ext/rbs_extension/lexer.c" -yy239: +#line 2043 "ext/rbs_extension/lexer.c" +yy244: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy261; + if (yych <= '9') goto yy266; goto yy68; } else { - if (yych <= 'F') goto yy261; + if (yych <= 'F') goto yy266; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy261; + if (yych <= 'f') goto yy266; goto yy68; } -yy240: +yy245: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy262; + if (yych <= '9') goto yy267; goto yy68; } else { - if (yych <= 'F') goto yy262; + if (yych <= 'F') goto yy267; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy262; + if (yych <= 'f') goto yy267; goto yy68; } -yy241: +yy246: rbs_skip(state); - goto yy211; -yy242: + goto yy214; +yy247: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy263; - goto yy109; -yy243: + if (yych == 'o') goto yy268; + goto yy111; +yy248: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy244; + if (yych <= '@') goto yy249; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy244; + if (yych == '`') goto yy249; if (yych <= 'z') goto yy52; } } -yy244: +yy249: #line 66 "ext/rbs_extension/lexer.re" { return next_token(state, kALIAS); } -#line 2061 "ext/rbs_extension/lexer.c" -yy245: +#line 2100 "ext/rbs_extension/lexer.c" +yy250: rbs_skip(state); yych = peek(state); if (yych <= 'q') { - if (yych == 'a') goto yy264; + if (yych == 'a') goto yy269; goto yy53; } else { - if (yych <= 'r') goto yy265; - if (yych == 'w') goto yy266; + if (yych <= 'r') goto yy270; + if (yych == 'w') goto yy271; goto yy53; } -yy246: +yy251: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy247; + if (yych <= '@') goto yy252; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy247; + if (yych == '`') goto yy252; if (yych <= 'z') goto yy52; } } -yy247: +yy252: #line 72 "ext/rbs_extension/lexer.re" { return next_token(state, kCLASS); } -#line 2095 "ext/rbs_extension/lexer.c" -yy248: +#line 2134 "ext/rbs_extension/lexer.c" +yy253: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy267; + if (yych == 'd') goto yy272; goto yy53; -yy249: +yy254: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy250; + if (yych <= '@') goto yy255; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy250; + if (yych == '`') goto yy255; if (yych <= 'z') goto yy52; } } -yy250: +yy255: #line 76 "ext/rbs_extension/lexer.re" { return next_token(state, kFALSE); } -#line 2123 "ext/rbs_extension/lexer.c" -yy251: +#line 2162 "ext/rbs_extension/lexer.c" +yy256: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy269; + if (yych == 'd') goto yy274; goto yy53; -yy252: +yy257: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy270; + if (yych == 'n') goto yy275; goto yy53; -yy253: +yy258: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy271; + if (yych == 'f') goto yy276; goto yy53; -yy254: +yy259: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy272; + if (yych == 'e') goto yy277; goto yy53; -yy255: +yy260: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy274; + if (yych == 'n') goto yy279; goto yy53; -yy256: +yy261: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy275; + if (yych == 't') goto yy280; goto yy53; -yy257: +yy262: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy276; + if (yych == 'c') goto yy281; goto yy53; -yy258: +yy263: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy278; + if (yych == 'e') goto yy283; goto yy53; -yy259: +yy264: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy279; + if (yych == 'c') goto yy284; goto yy53; -yy260: +yy265: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy280; + if (yych == 'e') goto yy285; goto yy53; -yy261: +yy266: rbs_skip(state); yych = peek(state); if (yych <= '@') { @@ -2183,149 +2222,149 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 'f') goto yy66; goto yy68; } -yy262: +yy267: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy281; + if (yych <= '9') goto yy286; goto yy68; } else { - if (yych <= 'F') goto yy281; + if (yych <= 'F') goto yy286; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy281; + if (yych <= 'f') goto yy286; goto yy68; } -yy263: +yy268: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy282; - goto yy109; -yy264: + if (yych == '_') goto yy287; + goto yy111; +yy269: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy283; + if (yych == 'c') goto yy288; goto yy53; -yy265: +yy270: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy284; + if (yych == 'e') goto yy289; goto yy53; -yy266: +yy271: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy285; + if (yych == 'r') goto yy290; goto yy53; -yy267: +yy272: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy268; + if (yych <= '@') goto yy273; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy268; + if (yych == '`') goto yy273; if (yych <= 'z') goto yy52; } } -yy268: +yy273: #line 75 "ext/rbs_extension/lexer.re" { return next_token(state, kEXTEND); } -#line 2242 "ext/rbs_extension/lexer.c" -yy269: +#line 2281 "ext/rbs_extension/lexer.c" +yy274: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy286; + if (yych == 'e') goto yy291; goto yy53; -yy270: +yy275: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy288; + if (yych == 'c') goto yy293; goto yy53; -yy271: +yy276: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy289; + if (yych == 'a') goto yy294; goto yy53; -yy272: +yy277: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy273; + if (yych <= '@') goto yy278; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy273; + if (yych == '`') goto yy278; if (yych <= 'z') goto yy52; } } -yy273: +yy278: #line 81 "ext/rbs_extension/lexer.re" { return next_token(state, kMODULE); } -#line 2280 "ext/rbs_extension/lexer.c" -yy274: +#line 2319 "ext/rbs_extension/lexer.c" +yy279: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy290; + if (yych == 'd') goto yy295; goto yy53; -yy275: +yy280: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy292; + if (yych == 'e') goto yy297; goto yy53; -yy276: +yy281: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy277; + if (yych <= '@') goto yy282; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy277; + if (yych == '`') goto yy282; if (yych <= 'z') goto yy52; } } -yy277: +yy282: #line 86 "ext/rbs_extension/lexer.re" { return next_token(state, kPUBLIC); } -#line 2313 "ext/rbs_extension/lexer.c" -yy278: +#line 2352 "ext/rbs_extension/lexer.c" +yy283: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy294; + if (yych == 't') goto yy299; goto yy53; -yy279: +yy284: rbs_skip(state); yych = peek(state); - if (yych == 'k') goto yy295; + if (yych == 'k') goto yy300; goto yy53; -yy280: +yy285: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy296; + if (yych == 'd') goto yy301; goto yy53; -yy281: +yy286: rbs_skip(state); yych = peek(state); if (yych <= '@') { @@ -2338,365 +2377,365 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 'f') goto yy85; goto yy68; } -yy282: +yy287: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy298; - goto yy109; -yy283: + if (yych == '_') goto yy303; + goto yy111; +yy288: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy300; + if (yych == 'c') goto yy305; goto yy53; -yy284: +yy289: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy301; + if (yych == 'a') goto yy306; goto yy53; -yy285: +yy290: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy302; + if (yych == 'i') goto yy307; goto yy53; -yy286: +yy291: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy287; + if (yych <= '@') goto yy292; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy287; + if (yych == '`') goto yy292; if (yych <= 'z') goto yy52; } } -yy287: +yy292: #line 78 "ext/rbs_extension/lexer.re" { return next_token(state, kINCLUDE); } -#line 2384 "ext/rbs_extension/lexer.c" -yy288: +#line 2423 "ext/rbs_extension/lexer.c" +yy293: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy303; + if (yych == 'e') goto yy308; goto yy53; -yy289: +yy294: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy305; + if (yych == 'c') goto yy310; goto yy53; -yy290: +yy295: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy291; + if (yych <= '@') goto yy296; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy291; + if (yych == '`') goto yy296; if (yych <= 'z') goto yy52; } } -yy291: +yy296: #line 84 "ext/rbs_extension/lexer.re" { return next_token(state, kPREPEND); } -#line 2417 "ext/rbs_extension/lexer.c" -yy292: +#line 2456 "ext/rbs_extension/lexer.c" +yy297: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy293; + if (yych <= '@') goto yy298; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy293; + if (yych == '`') goto yy298; if (yych <= 'z') goto yy52; } } -yy293: +yy298: #line 85 "ext/rbs_extension/lexer.re" { return next_token(state, kPRIVATE); } -#line 2440 "ext/rbs_extension/lexer.c" -yy294: +#line 2479 "ext/rbs_extension/lexer.c" +yy299: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy306; + if (yych == 'o') goto yy311; goto yy53; -yy295: +yy300: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy307; + if (yych == 'e') goto yy312; goto yy53; -yy296: +yy301: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy297; + if (yych <= '@') goto yy302; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy297; + if (yych == '`') goto yy302; if (yych <= 'z') goto yy52; } } -yy297: +yy302: #line 93 "ext/rbs_extension/lexer.re" { return next_token(state, kUNTYPED); } -#line 2473 "ext/rbs_extension/lexer.c" -yy298: +#line 2512 "ext/rbs_extension/lexer.c" +yy303: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { - if (yych <= '9') goto yy108; - if (yych >= '=') goto yy106; + if (yych <= '9') goto yy110; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy299; - if (yych <= 'Z') goto yy108; + if (yych <= '@') goto yy304; + if (yych <= 'Z') goto yy110; } else { - if (yych == '`') goto yy299; - if (yych <= 'z') goto yy108; + if (yych == '`') goto yy304; + if (yych <= 'z') goto yy110; } } -yy299: +yy304: #line 97 "ext/rbs_extension/lexer.re" { return next_token(state, k__TODO__); } -#line 2496 "ext/rbs_extension/lexer.c" -yy300: +#line 2535 "ext/rbs_extension/lexer.c" +yy305: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy308; + if (yych == 'e') goto yy313; goto yy53; -yy301: +yy306: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy309; + if (yych == 'd') goto yy314; goto yy53; -yy302: +yy307: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy310; + if (yych == 't') goto yy315; goto yy53; -yy303: +yy308: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy304; + if (yych <= '@') goto yy309; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy304; + if (yych == '`') goto yy309; if (yych <= 'z') goto yy52; } } -yy304: +yy309: #line 79 "ext/rbs_extension/lexer.re" { return next_token(state, kINSTANCE); } -#line 2534 "ext/rbs_extension/lexer.c" -yy305: +#line 2573 "ext/rbs_extension/lexer.c" +yy310: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy311; + if (yych == 'e') goto yy316; goto yy53; -yy306: +yy311: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy313; + if (yych == 'n') goto yy318; goto yy53; -yy307: +yy312: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy315; + if (yych == 'd') goto yy320; goto yy53; -yy308: +yy313: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy317; + if (yych == 's') goto yy322; goto yy53; -yy309: +yy314: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy318; + if (yych == 'e') goto yy323; goto yy53; -yy310: +yy315: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy319; + if (yych == 'e') goto yy324; goto yy53; -yy311: +yy316: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy312; + if (yych <= '@') goto yy317; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy312; + if (yych == '`') goto yy317; if (yych <= 'z') goto yy52; } } -yy312: +yy317: #line 80 "ext/rbs_extension/lexer.re" { return next_token(state, kINTERFACE); } -#line 2587 "ext/rbs_extension/lexer.c" -yy313: +#line 2626 "ext/rbs_extension/lexer.c" +yy318: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy314; + if (yych <= '@') goto yy319; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy314; + if (yych == '`') goto yy319; if (yych <= 'z') goto yy52; } } -yy314: +yy319: #line 88 "ext/rbs_extension/lexer.re" { return next_token(state, kSINGLETON); } -#line 2610 "ext/rbs_extension/lexer.c" -yy315: +#line 2649 "ext/rbs_extension/lexer.c" +yy320: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy316; + if (yych <= '@') goto yy321; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy316; + if (yych == '`') goto yy321; if (yych <= 'z') goto yy52; } } -yy316: +yy321: #line 92 "ext/rbs_extension/lexer.re" { return next_token(state, kUNCHECKED); } -#line 2633 "ext/rbs_extension/lexer.c" -yy317: +#line 2672 "ext/rbs_extension/lexer.c" +yy322: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy320; + if (yych == 's') goto yy325; goto yy53; -yy318: +yy323: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy321; + if (yych == 'r') goto yy326; goto yy53; -yy319: +yy324: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy323; + if (yych == 'r') goto yy328; goto yy53; -yy320: +yy325: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy325; + if (yych == 'o') goto yy330; goto yy53; -yy321: +yy326: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy322; + if (yych <= '@') goto yy327; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy322; + if (yych == '`') goto yy327; if (yych <= 'z') goto yy52; } } -yy322: +yy327: #line 68 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRREADER); } -#line 2676 "ext/rbs_extension/lexer.c" -yy323: +#line 2715 "ext/rbs_extension/lexer.c" +yy328: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy324; + if (yych <= '@') goto yy329; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy324; + if (yych == '`') goto yy329; if (yych <= 'z') goto yy52; } } -yy324: +yy329: #line 69 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRWRITER); } -#line 2699 "ext/rbs_extension/lexer.c" -yy325: +#line 2738 "ext/rbs_extension/lexer.c" +yy330: rbs_skip(state); yych = peek(state); if (yych != 'r') goto yy53; @@ -2704,25 +2743,25 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy105; + if (yych == '!') goto yy107; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy106; + if (yych >= '=') goto yy108; } } else { if (yych <= '^') { - if (yych <= '@') goto yy326; + if (yych <= '@') goto yy331; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy326; + if (yych == '`') goto yy331; if (yych <= 'z') goto yy52; } } -yy326: +yy331: #line 67 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRACCESSOR); } -#line 2725 "ext/rbs_extension/lexer.c" +#line 2764 "ext/rbs_extension/lexer.c" } -#line 146 "ext/rbs_extension/lexer.re" +#line 147 "ext/rbs_extension/lexer.re" } diff --git a/ext/rbs_extension/lexer.h b/ext/rbs_extension/lexer.h index 55a8a3994..f5eb7bb5e 100644 --- a/ext/rbs_extension/lexer.h +++ b/ext/rbs_extension/lexer.h @@ -61,6 +61,7 @@ enum TokenType { kUSE, /* use */ kAS, /* as */ k__TODO__, /* __todo__ */ + kATRBS, /* @rbs */ tLIDENT, /* Identifiers starting with lower case */ tUIDENT, /* Identifiers starting with upper case */ diff --git a/ext/rbs_extension/lexer.re b/ext/rbs_extension/lexer.re index aa1b94746..4d58b5295 100644 --- a/ext/rbs_extension/lexer.re +++ b/ext/rbs_extension/lexer.re @@ -95,6 +95,7 @@ token rbsparser_next_token(lexstate *state) { "use" { return next_token(state, kUSE); } "as" { return next_token(state, kAS); } "__todo__" { return next_token(state, k__TODO__); } + "@rbs" { return next_token(state, kATRBS); } unicode_char = "\\u" [0-9a-fA-F]{4}; oct_char = "\\x" [0-9a-f]{1,2}; diff --git a/ext/rbs_extension/lexstate.c b/ext/rbs_extension/lexstate.c index ed32fd06a..c7389df80 100644 --- a/ext/rbs_extension/lexstate.c +++ b/ext/rbs_extension/lexstate.c @@ -60,6 +60,7 @@ static const char *RBS_TOKENTYPE_NAMES[] = { "kUSE", /* use */ "kAS", /* as */ "k__TODO__", /* __todo__ */ + "kATRBS", /* @rbs */ "tLIDENT", /* Identifiers starting with lower case */ "tUIDENT", /* Identifiers starting with upper case */ diff --git a/ext/rbs_extension/parser.c b/ext/rbs_extension/parser.c index 77f583c41..d4722caa4 100644 --- a/ext/rbs_extension/parser.c +++ b/ext/rbs_extension/parser.c @@ -1942,7 +1942,8 @@ static VALUE parse_variable_member(parserstate *state, position comment_pos, VAL switch (state->current_token.type) { - case tAIDENT: { + case tAIDENT: + case kATRBS: { range name_range = state->current_token.range; VALUE name = ID2SYM(INTERN_TOKEN(state, state->current_token)); @@ -1989,7 +1990,15 @@ static VALUE parse_variable_member(parserstate *state, position comment_pos, VAL }; parser_advance_assert(state, pDOT); - parser_advance_assert(state, tAIDENT); + if (state->next_token.type == tAIDENT || state->next_token.type == kATRBS) { + parser_advance(state); + } else { + raise_syntax_error( + state, + state->current_token, + "expected a instance variable name" + ); + } range name_range = state->current_token.range; VALUE name = ID2SYM(INTERN_TOKEN(state, state->current_token)); @@ -2098,7 +2107,7 @@ static VALUE parse_attribute_member(parserstate *state, position comment_pos, VA parser_advance_assert(state, pLPAREN); ivar_range.start = state->current_token.range.start; - if (parser_advance_if(state, tAIDENT)) { + if (parser_advance_if(state, tAIDENT) || parser_advance_if(state, kATRBS)) { ivar_name = ID2SYM(INTERN_TOKEN(state, state->current_token)); ivar_name_range = state->current_token.range; } else { @@ -2331,6 +2340,7 @@ static VALUE parse_module_members(parserstate *state) { case tAIDENT: case tA2IDENT: + case kATRBS: case kSELF: { member = parse_variable_member(state, annot_pos, annotations); break; diff --git a/test/rbs/signature_parsing_test.rb b/test/rbs/signature_parsing_test.rb index 96e082ca8..193c32726 100644 --- a/test/rbs/signature_parsing_test.rb +++ b/test/rbs/signature_parsing_test.rb @@ -2279,4 +2279,16 @@ def foo: (?) { () -> void } -> void end end end + + def test_inline_keyword__rbs + Parser.parse_signature(<<~RBS) + class Foo + @rbs: untyped + self.@rbs: untyped + + attr_reader rbs (@rbs): untyped + attr_reader self.rbs (@rbs): untyped + end + RBS + end end From d0b2e36f412839d3e481c2365365db36795b3012 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Wed, 9 Apr 2025 17:27:11 +0900 Subject: [PATCH 05/48] Setup bridge between parser and AST --- config.yml | 17 +++++++++++ include/rbs/constants.h | 5 ++++ include/rbs/ruby_objs.h | 3 ++ src/constants.c | 10 +++++++ src/ruby_objs.c | 41 +++++++++++++++++++++++++++ templates/include/rbs/constants.h.erb | 2 ++ templates/src/constants.c.erb | 4 +++ 7 files changed, 82 insertions(+) diff --git a/config.yml b/config.yml index b17f864a7..ba28eb2a2 100644 --- a/config.yml +++ b/config.yml @@ -315,3 +315,20 @@ nodes: fields: - name: name - name: location + - name: RBS::AST::Ruby::Annotations::NodeTypeAssertion + fields: + - name: location + - name: prefix_location + - name: type + - name: RBS::AST::Ruby::Annotations::ColonMethodTypeAnnotation + fields: + - name: location + - name: prefix_location + - name: annotations + - name: method_type + - name: RBS::AST::Ruby::Annotations::MethodTypesAnnotation + fields: + - name: location + - name: prefix_location + - name: overloads + - name: vertical_bar_locations diff --git a/include/rbs/constants.h b/include/rbs/constants.h index 995f5f923..8792debe4 100644 --- a/include/rbs/constants.h +++ b/include/rbs/constants.h @@ -14,6 +14,8 @@ extern VALUE RBS_AST; extern VALUE RBS_AST_Declarations; extern VALUE RBS_AST_Directives; extern VALUE RBS_AST_Members; +extern VALUE RBS_AST_Ruby; +extern VALUE RBS_AST_Ruby_Annotations; extern VALUE RBS_Types; extern VALUE RBS_Types_Bases; extern VALUE RBS_ParsingError; @@ -47,6 +49,9 @@ extern VALUE RBS_AST_Members_MethodDefinition_Overload; extern VALUE RBS_AST_Members_Prepend; extern VALUE RBS_AST_Members_Private; extern VALUE RBS_AST_Members_Public; +extern VALUE RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation; +extern VALUE RBS_AST_Ruby_Annotations_MethodTypesAnnotation; +extern VALUE RBS_AST_Ruby_Annotations_NodeTypeAssertion; extern VALUE RBS_AST_TypeParam; extern VALUE RBS_MethodType; extern VALUE RBS_Namespace; diff --git a/include/rbs/ruby_objs.h b/include/rbs/ruby_objs.h index 102e57d40..47a284e5a 100644 --- a/include/rbs/ruby_objs.h +++ b/include/rbs/ruby_objs.h @@ -39,6 +39,9 @@ VALUE rbs_ast_members_method_definition_overload(VALUE annotations, VALUE method VALUE rbs_ast_members_prepend(VALUE name, VALUE args, VALUE annotations, VALUE location, VALUE comment); VALUE rbs_ast_members_private(VALUE location); VALUE rbs_ast_members_public(VALUE location); +VALUE rbs_ast_ruby_annotations_colon_method_type_annotation(VALUE location, VALUE prefix_location, VALUE annotations, VALUE method_type); +VALUE rbs_ast_ruby_annotations_method_types_annotation(VALUE location, VALUE prefix_location, VALUE overloads, VALUE vertical_bar_locations); +VALUE rbs_ast_ruby_annotations_node_type_assertion(VALUE location, VALUE prefix_location, VALUE type); VALUE rbs_ast_type_param(VALUE name, VALUE variance, VALUE upper_bound, VALUE default_type, VALUE unchecked, VALUE location); VALUE rbs_method_type(VALUE type_params, VALUE type, VALUE block, VALUE location); VALUE rbs_namespace(VALUE path, VALUE absolute); diff --git a/src/constants.c b/src/constants.c index dd1e2ee5c..139201a08 100644 --- a/src/constants.c +++ b/src/constants.c @@ -14,6 +14,8 @@ VALUE RBS_AST; VALUE RBS_AST_Declarations; VALUE RBS_AST_Directives; VALUE RBS_AST_Members; +VALUE RBS_AST_Ruby; +VALUE RBS_AST_Ruby_Annotations; VALUE RBS_Parser; VALUE RBS_Types; VALUE RBS_Types_Bases; @@ -47,6 +49,9 @@ VALUE RBS_AST_Members_MethodDefinition_Overload; VALUE RBS_AST_Members_Prepend; VALUE RBS_AST_Members_Private; VALUE RBS_AST_Members_Public; +VALUE RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation; +VALUE RBS_AST_Ruby_Annotations_MethodTypesAnnotation; +VALUE RBS_AST_Ruby_Annotations_NodeTypeAssertion; VALUE RBS_AST_TypeParam; VALUE RBS_MethodType; VALUE RBS_Namespace; @@ -89,6 +94,8 @@ void rbs__init_constants(void) { IMPORT_CONSTANT(RBS_AST_Declarations, RBS_AST, "Declarations"); IMPORT_CONSTANT(RBS_AST_Directives, RBS_AST, "Directives"); IMPORT_CONSTANT(RBS_AST_Members, RBS_AST, "Members"); + IMPORT_CONSTANT(RBS_AST_Ruby, RBS_AST, "Ruby"); + IMPORT_CONSTANT(RBS_AST_Ruby_Annotations, RBS_AST_Ruby, "Annotations"); IMPORT_CONSTANT(RBS_Types, RBS, "Types"); IMPORT_CONSTANT(RBS_Types_Bases, RBS_Types, "Bases"); @@ -121,6 +128,9 @@ void rbs__init_constants(void) { 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_Public, RBS_AST_Members, "Public"); + IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation, RBS_AST_Ruby_Annotations, "ColonMethodTypeAnnotation"); + IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_MethodTypesAnnotation, RBS_AST_Ruby_Annotations, "MethodTypesAnnotation"); + IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_NodeTypeAssertion, RBS_AST_Ruby_Annotations, "NodeTypeAssertion"); IMPORT_CONSTANT(RBS_AST_TypeParam, RBS_AST, "TypeParam"); IMPORT_CONSTANT(RBS_MethodType, RBS, "MethodType"); IMPORT_CONSTANT(RBS_Namespace, RBS, "Namespace"); diff --git a/src/ruby_objs.c b/src/ruby_objs.c index be3e717f8..027b6eb01 100644 --- a/src/ruby_objs.c +++ b/src/ruby_objs.c @@ -439,6 +439,47 @@ VALUE rbs_ast_members_public(VALUE location) { ); } +VALUE rbs_ast_ruby_annotations_colon_method_type_annotation(VALUE location, VALUE prefix_location, VALUE annotations, VALUE method_type) { + VALUE _init_kwargs = rb_hash_new(); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("prefix_location")), prefix_location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("annotations")), annotations); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("method_type")), method_type); + + return CLASS_NEW_INSTANCE( + RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation, + 1, + &_init_kwargs + ); +} + +VALUE rbs_ast_ruby_annotations_method_types_annotation(VALUE location, VALUE prefix_location, VALUE overloads, VALUE vertical_bar_locations) { + VALUE _init_kwargs = rb_hash_new(); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("prefix_location")), prefix_location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("overloads")), overloads); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("vertical_bar_locations")), vertical_bar_locations); + + return CLASS_NEW_INSTANCE( + RBS_AST_Ruby_Annotations_MethodTypesAnnotation, + 1, + &_init_kwargs + ); +} + +VALUE rbs_ast_ruby_annotations_node_type_assertion(VALUE location, VALUE prefix_location, VALUE type) { + VALUE _init_kwargs = rb_hash_new(); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("prefix_location")), prefix_location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("type")), type); + + return CLASS_NEW_INSTANCE( + RBS_AST_Ruby_Annotations_NodeTypeAssertion, + 1, + &_init_kwargs + ); +} + VALUE rbs_ast_type_param(VALUE name, VALUE variance, VALUE upper_bound, VALUE default_type, VALUE unchecked, VALUE location) { VALUE _init_kwargs = rb_hash_new(); rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name); diff --git a/templates/include/rbs/constants.h.erb b/templates/include/rbs/constants.h.erb index 7be88cdfa..8810c4b5c 100644 --- a/templates/include/rbs/constants.h.erb +++ b/templates/include/rbs/constants.h.erb @@ -7,6 +7,8 @@ extern VALUE RBS_AST; extern VALUE RBS_AST_Declarations; extern VALUE RBS_AST_Directives; extern VALUE RBS_AST_Members; +extern VALUE RBS_AST_Ruby; +extern VALUE RBS_AST_Ruby_Annotations; extern VALUE RBS_Types; extern VALUE RBS_Types_Bases; extern VALUE RBS_ParsingError; diff --git a/templates/src/constants.c.erb b/templates/src/constants.c.erb index 1a6ff9400..186ef0143 100644 --- a/templates/src/constants.c.erb +++ b/templates/src/constants.c.erb @@ -7,6 +7,8 @@ VALUE RBS_AST; VALUE RBS_AST_Declarations; VALUE RBS_AST_Directives; VALUE RBS_AST_Members; +VALUE RBS_AST_Ruby; +VALUE RBS_AST_Ruby_Annotations; VALUE RBS_Parser; VALUE RBS_Types; VALUE RBS_Types_Bases; @@ -27,6 +29,8 @@ void rbs__init_constants(void) { IMPORT_CONSTANT(RBS_AST_Declarations, RBS_AST, "Declarations"); IMPORT_CONSTANT(RBS_AST_Directives, RBS_AST, "Directives"); IMPORT_CONSTANT(RBS_AST_Members, RBS_AST, "Members"); + IMPORT_CONSTANT(RBS_AST_Ruby, RBS_AST, "Ruby"); + IMPORT_CONSTANT(RBS_AST_Ruby_Annotations, RBS_AST_Ruby, "Annotations"); IMPORT_CONSTANT(RBS_Types, RBS, "Types"); IMPORT_CONSTANT(RBS_Types_Bases, RBS_Types, "Bases"); From 41da42e954e037555b8acc1adef3dc080c656818 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Wed, 9 Apr 2025 17:27:48 +0900 Subject: [PATCH 06/48] Parse inline trailing `: TYPE` annotation --- ext/rbs_extension/parser.c | 44 ++++++++++++++++++++++ lib/rbs/parser_aux.rb | 5 +++ sig/parser.rbs | 8 ++++ test/rbs/inline_annotation_parsing_test.rb | 30 +++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 test/rbs/inline_annotation_parsing_test.rb diff --git a/ext/rbs_extension/parser.c b/ext/rbs_extension/parser.c index d4722caa4..63205305e 100644 --- a/ext/rbs_extension/parser.c +++ b/ext/rbs_extension/parser.c @@ -2863,6 +2863,31 @@ VALUE parse_signature(parserstate *state) { return ret; } +static VALUE parse_inline_trailing_annotation(parserstate *state) { + range prefix_range = state->next_token.range; + + switch (state->next_token.type) { + case pCOLON: { + parser_advance(state); + + VALUE type = parse_type(state); + + return rbs_ast_ruby_annotations_node_type_assertion( + rbs_new_location(state->buffer, (range) { .start = prefix_range.start, .end = state->current_token.range.end }), + rbs_new_location(state->buffer, prefix_range), + type + ); + } + default: { + raise_syntax_error( + state, + state->next_token, + "unexpected token for inline trailing annotation" + ); + } + } +} + struct parse_type_arg { parserstate *parser; VALUE require_eof; @@ -2973,6 +2998,24 @@ rbsparser_lex(VALUE self, VALUE buffer, VALUE end_pos) { return results; } +static VALUE parse_inline_trailing_try(VALUE a) { + parserstate *parser = (parserstate *)a; + VALUE annotation = parse_inline_trailing_annotation(parser); + + parser_advance_assert(parser, pEOF); + + return annotation; +} + +static VALUE rbsparser_parse_inline_trailing_annotation(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos, VALUE variables) { + VALUE string = rb_funcall(buffer, rb_intern("content"), 0); + StringValue(string); + lexstate *lexer = alloc_lexer(string, FIX2INT(start_pos), FIX2INT(end_pos)); + parserstate *parser = alloc_parser(buffer, lexer, FIX2INT(start_pos), FIX2INT(end_pos), variables); + + return rb_ensure(parse_inline_trailing_try, (VALUE)parser, ensure_free_parser, (VALUE)parser); +} + void rbs__init_parser(void) { RBS_Parser = rb_define_class_under(RBS, "Parser", rb_cObject); rb_gc_register_mark_object(RBS_Parser); @@ -2988,5 +3031,6 @@ void rbs__init_parser(void) { rb_define_singleton_method(RBS_Parser, "_parse_type", rbsparser_parse_type, 5); rb_define_singleton_method(RBS_Parser, "_parse_method_type", rbsparser_parse_method_type, 5); rb_define_singleton_method(RBS_Parser, "_parse_signature", rbsparser_parse_signature, 3); + rb_define_singleton_method(RBS_Parser, "_parse_inline_trailing_annotation", rbsparser_parse_inline_trailing_annotation, 4); rb_define_singleton_method(RBS_Parser, "_lex", rbsparser_lex, 2); } diff --git a/lib/rbs/parser_aux.rb b/lib/rbs/parser_aux.rb index 8b746d39b..b624b8ae8 100644 --- a/lib/rbs/parser_aux.rb +++ b/lib/rbs/parser_aux.rb @@ -110,5 +110,10 @@ def self.buffer(source) ).each_with_object({}) do |keyword, hash| #$ Hash[String, bot] hash[keyword] = _ = nil end + + def self.parse_inline_trailing_annotation(source, range, variables: []) + buf = buffer(source) + _parse_inline_trailing_annotation(buf, range.begin || 0, range.end || buf.last_position, variables) + end end end diff --git a/sig/parser.rbs b/sig/parser.rbs index da9e94692..e4945eda8 100644 --- a/sig/parser.rbs +++ b/sig/parser.rbs @@ -82,6 +82,12 @@ module RBS KEYWORDS: Hash[String, bot] + # Parse a leading annotation and return it + # + # Raises an exception if the source text contains a syntax error. + # + def self.parse_inline_trailing_annotation: (Buffer | String, Range[Integer?], ?variables: Array[Symbol]) -> AST::Ruby::Annotations::trailing_annotation + private def self.buffer: (String | Buffer source) -> Buffer @@ -94,6 +100,8 @@ module RBS def self._lex: (Buffer, Integer end_pos) -> Array[[Symbol, Location[untyped, untyped]]] + def self._parse_inline_trailing_annotation: (Buffer, Integer start_pos, Integer end_pos, Array[Symbol] variables) -> AST::Ruby::Annotations::trailing_annotation + class LocatedValue end end diff --git a/test/rbs/inline_annotation_parsing_test.rb b/test/rbs/inline_annotation_parsing_test.rb new file mode 100644 index 000000000..d9e4218dd --- /dev/null +++ b/test/rbs/inline_annotation_parsing_test.rb @@ -0,0 +1,30 @@ +require "test_helper" + +class RBS::InlineAnnotationParsingTest < Test::Unit::TestCase + include RBS + + include TestHelper + + def test_parse__trailing_assertion + Parser.parse_inline_trailing_annotation(": String", 0...).tap do |annot| + assert_instance_of AST::Ruby::Annotations::NodeTypeAssertion, annot + assert_equal ": String", annot.location.source + assert_equal ":", annot.prefix_location.source + assert_equal "String", annot.type.location.source + end + end + + def test_error__trailing_assertion + assert_raises RBS::ParsingError do + Parser.parse_inline_trailing_annotation(": String[", 0...) + end + + assert_raises RBS::ParsingError do + Parser.parse_inline_trailing_annotation(":", 0...) + end + + assert_raises RBS::ParsingError do + Parser.parse_inline_trailing_annotation(": String is a ", 0...) + end + end +end From 7ac54d48cf3ea6800f6b97911015ec5b3ad9ab87 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Wed, 9 Apr 2025 17:38:08 +0900 Subject: [PATCH 07/48] Parser inline leading `: METHOD-TYPE` annotation --- ext/rbs_extension/parser.c | 59 ++++++++++++++++++++++ lib/rbs/parser_aux.rb | 5 ++ sig/parser.rbs | 8 +++ test/rbs/inline_annotation_parsing_test.rb | 18 +++++++ 4 files changed, 90 insertions(+) diff --git a/ext/rbs_extension/parser.c b/ext/rbs_extension/parser.c index 63205305e..494714b1a 100644 --- a/ext/rbs_extension/parser.c +++ b/ext/rbs_extension/parser.c @@ -2863,6 +2863,46 @@ VALUE parse_signature(parserstate *state) { return ret; } +/** + * @brief + * overload ::= {} annotations + */ +static void parse_method_overload(parserstate *state, VALUE *annotations, VALUE *method_type) { + position pos; + + parse_annotations(state, annotations, &pos); + *method_type = parse_method_type(state); +} + +static VALUE parse_inline_leading_annotation(parserstate *state) { + switch (state->next_token.type) { + case pCOLON: { + // : + range colon_range = state->next_token.range; + parser_advance(state); + + VALUE annotations = EMPTY_ARRAY; + VALUE method_type; + + parse_method_overload(state, &annotations, &method_type); + + return rbs_ast_ruby_annotations_colon_method_type_annotation( + rbs_new_location(state->buffer, (range) { .start = colon_range.start, .end = state->current_token.range.end }), + rbs_new_location(state->buffer, colon_range), + annotations, + method_type + ); + } + default: { + raise_syntax_error( + state, + state->next_token, + "unexpected token for inline leading annotation" + ); + } + } +} + static VALUE parse_inline_trailing_annotation(parserstate *state) { range prefix_range = state->next_token.range; @@ -2998,6 +3038,24 @@ rbsparser_lex(VALUE self, VALUE buffer, VALUE end_pos) { return results; } +static VALUE parse_inline_leading_try(VALUE a) { + parserstate *parser = (parserstate *)a; + VALUE annotation = parse_inline_leading_annotation(parser); + + parser_advance_assert(parser, pEOF); + + return annotation; +} + +static VALUE rbsparser_parse_inline_leading_annotation(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos, VALUE variables) { + VALUE string = rb_funcall(buffer, rb_intern("content"), 0); + StringValue(string); + lexstate *lexer = alloc_lexer(string, FIX2INT(start_pos), FIX2INT(end_pos)); + parserstate *parser = alloc_parser(buffer, lexer, FIX2INT(start_pos), FIX2INT(end_pos), variables); + + return rb_ensure(parse_inline_leading_try, (VALUE)parser, ensure_free_parser, (VALUE)parser); +} + static VALUE parse_inline_trailing_try(VALUE a) { parserstate *parser = (parserstate *)a; VALUE annotation = parse_inline_trailing_annotation(parser); @@ -3031,6 +3089,7 @@ void rbs__init_parser(void) { rb_define_singleton_method(RBS_Parser, "_parse_type", rbsparser_parse_type, 5); rb_define_singleton_method(RBS_Parser, "_parse_method_type", rbsparser_parse_method_type, 5); rb_define_singleton_method(RBS_Parser, "_parse_signature", rbsparser_parse_signature, 3); + rb_define_singleton_method(RBS_Parser, "_parse_inline_leading_annotation", rbsparser_parse_inline_leading_annotation, 4); rb_define_singleton_method(RBS_Parser, "_parse_inline_trailing_annotation", rbsparser_parse_inline_trailing_annotation, 4); rb_define_singleton_method(RBS_Parser, "_lex", rbsparser_lex, 2); } diff --git a/lib/rbs/parser_aux.rb b/lib/rbs/parser_aux.rb index b624b8ae8..cb81cd204 100644 --- a/lib/rbs/parser_aux.rb +++ b/lib/rbs/parser_aux.rb @@ -111,6 +111,11 @@ def self.buffer(source) hash[keyword] = _ = nil end + def self.parse_inline_leading_annotation(source, range, variables: []) + buf = buffer(source) + _parse_inline_leading_annotation(buf, range.begin || 0, range.end || buf.last_position, variables) + end + def self.parse_inline_trailing_annotation(source, range, variables: []) buf = buffer(source) _parse_inline_trailing_annotation(buf, range.begin || 0, range.end || buf.last_position, variables) diff --git a/sig/parser.rbs b/sig/parser.rbs index e4945eda8..c19c09de3 100644 --- a/sig/parser.rbs +++ b/sig/parser.rbs @@ -82,6 +82,12 @@ module RBS KEYWORDS: Hash[String, bot] + # Parse a leading annotation and return it + # + # Raises an exception if the source text contains a syntax error. + # + def self.parse_inline_leading_annotation: (Buffer | String, Range[Integer?], ?variables: Array[Symbol]) -> AST::Ruby::Annotations::leading_annotation + # Parse a leading annotation and return it # # Raises an exception if the source text contains a syntax error. @@ -100,6 +106,8 @@ module RBS def self._lex: (Buffer, Integer end_pos) -> Array[[Symbol, Location[untyped, untyped]]] + def self._parse_inline_leading_annotation: (Buffer, Integer start_pos, Integer end_pos, Array[Symbol] variables) -> AST::Ruby::Annotations::leading_annotation + def self._parse_inline_trailing_annotation: (Buffer, Integer start_pos, Integer end_pos, Array[Symbol] variables) -> AST::Ruby::Annotations::trailing_annotation class LocatedValue diff --git a/test/rbs/inline_annotation_parsing_test.rb b/test/rbs/inline_annotation_parsing_test.rb index d9e4218dd..1765e99d4 100644 --- a/test/rbs/inline_annotation_parsing_test.rb +++ b/test/rbs/inline_annotation_parsing_test.rb @@ -27,4 +27,22 @@ def test_error__trailing_assertion Parser.parse_inline_trailing_annotation(": String is a ", 0...) end end + + def test_parse__colon_method_type_annotation + Parser.parse_inline_leading_annotation(": (String) -> void", 0...).tap do |annot| + assert_instance_of AST::Ruby::Annotations::ColonMethodTypeAnnotation, annot + assert_equal ": (String) -> void", annot.location.source + assert_equal ":", annot.prefix_location.source + assert_equal "(String) -> void", annot.method_type.location.source + assert_empty annot.annotations + end + + Parser.parse_inline_leading_annotation(": %a{a} %a{b} (String) -> void", 0...).tap do |annot| + assert_instance_of AST::Ruby::Annotations::ColonMethodTypeAnnotation, annot + assert_equal ": %a{a} %a{b} (String) -> void", annot.location.source + assert_equal ":", annot.prefix_location.source + assert_equal "(String) -> void", annot.method_type.location.source + assert_equal ["a", "b"], annot.annotations.map(&:string) + end + end end From 94facd805b38aebbfd35ff3245370ff6edbdd641 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Thu, 10 Apr 2025 16:45:22 +0900 Subject: [PATCH 08/48] Parser inline leading `@rbs METHOD-TYPEs` annotation --- ext/rbs_extension/parser.c | 63 ++++++++++++++++++++++ test/rbs/inline_annotation_parsing_test.rb | 28 ++++++++++ 2 files changed, 91 insertions(+) diff --git a/ext/rbs_extension/parser.c b/ext/rbs_extension/parser.c index 494714b1a..4cec458ed 100644 --- a/ext/rbs_extension/parser.c +++ b/ext/rbs_extension/parser.c @@ -2874,6 +2874,39 @@ static void parse_method_overload(parserstate *state, VALUE *annotations, VALUE *method_type = parse_method_type(state); } +/** + * @brief Parses inline method overload definitions and updates `overloads` and `bar_locations` + * + * inline_method_overloads ::= {} -- returns true + * | {} overload `|` ... `|` overload -- returns true + * | {<>} -- returns false + * + * + * @param state + * @param overloads + * @param bar_location + */ +static void parse_inline_method_overloads(parserstate *state, VALUE *overloads, VALUE *bar_locations) { + while (true) { + VALUE annotations = EMPTY_ARRAY; + VALUE method_type; + + parse_method_overload(state, &annotations, &method_type); + + VALUE overload = rbs_ast_members_method_definition_overload(annotations, method_type); + + rb_ary_push(*overloads, overload); + + if (state->next_token.type == pBAR) { + parser_advance(state); + melt_array(bar_locations); + rb_ary_push(*bar_locations, rbs_new_location(state->buffer, state->current_token.range)); + } else { + return; + } + } +} + static VALUE parse_inline_leading_annotation(parserstate *state) { switch (state->next_token.type) { case pCOLON: { @@ -2893,6 +2926,36 @@ static VALUE parse_inline_leading_annotation(parserstate *state) { method_type ); } + case kATRBS: { + range rbs_range = state->next_token.range; + parser_advance(state); + + switch (state->next_token.type) { + case pLPAREN: + case pLBRACKET: + case pLBRACE: + case tANNOTATION: { + VALUE overloads = rb_ary_new(); + VALUE bar_locations = EMPTY_ARRAY; + + parse_inline_method_overloads(state, &overloads, &bar_locations); + + return rbs_ast_ruby_annotations_method_types_annotation( + rbs_new_location(state->buffer, (range) { .start = rbs_range.start, .end = state->current_token.range.end }), + rbs_new_location(state->buffer, rbs_range), + overloads, + bar_locations + ); + } + default: { + raise_syntax_error( + state, + state->next_token, + "unexpected token for @rbs annotation" + ); + } + } + } default: { raise_syntax_error( state, diff --git a/test/rbs/inline_annotation_parsing_test.rb b/test/rbs/inline_annotation_parsing_test.rb index 1765e99d4..d4545aa02 100644 --- a/test/rbs/inline_annotation_parsing_test.rb +++ b/test/rbs/inline_annotation_parsing_test.rb @@ -45,4 +45,32 @@ def test_parse__colon_method_type_annotation assert_equal ["a", "b"], annot.annotations.map(&:string) end end + + def test_parse__rbs_method_types_annotation + Parser.parse_inline_leading_annotation("@rbs %a{a} (String) -> void", 0...).tap do |annot| + assert_instance_of AST::Ruby::Annotations::MethodTypesAnnotation, annot + assert_equal "@rbs %a{a} (String) -> void", annot.location.source + assert_equal "@rbs", annot.prefix_location.source + annot.overloads[0].tap do |overload| + assert_equal "(String) -> void", overload.method_type.location.source + assert_equal ["a"], overload.annotations.map(&:string) + end + assert_empty annot.vertical_bar_locations + end + + Parser.parse_inline_leading_annotation("@rbs %a{a} (String) -> void | [T] (T) -> T", 0...).tap do |annot| + assert_instance_of AST::Ruby::Annotations::MethodTypesAnnotation, annot + assert_equal "@rbs %a{a} (String) -> void | [T] (T) -> T", annot.location.source + assert_equal "@rbs", annot.prefix_location.source + annot.overloads[0].tap do |overload| + assert_equal "(String) -> void", overload.method_type.location.source + assert_equal ["a"], overload.annotations.map(&:string) + end + annot.overloads[1].tap do |overload| + assert_equal "[T] (T) -> T", overload.method_type.location.source + assert_equal [], overload.annotations.map(&:string) + end + assert_equal ["|"], annot.vertical_bar_locations.map(&:source) + end + end end From 13478cf4c9eeab9841547b3b2723b37658c44169 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Thu, 10 Apr 2025 16:46:18 +0900 Subject: [PATCH 09/48] Add parsing error test --- test/rbs/inline_annotation_parsing_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/rbs/inline_annotation_parsing_test.rb b/test/rbs/inline_annotation_parsing_test.rb index d4545aa02..4a2444f63 100644 --- a/test/rbs/inline_annotation_parsing_test.rb +++ b/test/rbs/inline_annotation_parsing_test.rb @@ -73,4 +73,10 @@ def test_parse__rbs_method_types_annotation assert_equal ["|"], annot.vertical_bar_locations.map(&:source) end end + + def test_error__unknown_annotation + assert_raises RBS::ParsingError do + Parser.parse_inline_leading_annotation("@rbs super String", 0...) + end + end end From 15d2614598bfba855e9ec86bea0de1a5141dfb5b Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Fri, 11 Apr 2025 16:04:13 +0900 Subject: [PATCH 10/48] Add `CommentBlock` --- lib/rbs.rb | 1 + lib/rbs/ast/ruby/comment_block.rb | 221 ++++++++++++++++++++++++ sig/ast/ruby/comment_block.rbs | 119 +++++++++++++ test/rbs/ast/ruby/comment_block_test.rb | 204 ++++++++++++++++++++++ 4 files changed, 545 insertions(+) create mode 100644 lib/rbs/ast/ruby/comment_block.rb create mode 100644 sig/ast/ruby/comment_block.rbs create mode 100644 test/rbs/ast/ruby/comment_block_test.rb diff --git a/lib/rbs.rb b/lib/rbs.rb index 9d8cc4377..8c735f37c 100644 --- a/lib/rbs.rb +++ b/lib/rbs.rb @@ -25,6 +25,7 @@ require "rbs/ast/members" require "rbs/ast/annotation" require "rbs/ast/visitor" +require "rbs/ast/ruby/comment_block" require "rbs/ast/ruby/helpers/constant_helper" require "rbs/ast/ruby/helpers/location_helper" require "rbs/ast/ruby/annotations" diff --git a/lib/rbs/ast/ruby/comment_block.rb b/lib/rbs/ast/ruby/comment_block.rb new file mode 100644 index 000000000..db94210a4 --- /dev/null +++ b/lib/rbs/ast/ruby/comment_block.rb @@ -0,0 +1,221 @@ +# frozen_string_literal: true + +module RBS + module AST + module Ruby + class CommentBlock + attr_reader :name, :offsets, :comment_buffer + + def initialize(source_buffer, comments) + @name = source_buffer.name + + @offsets = [] + + # Assume the comment starts with a prefix whitespace + prefix_str = "# " + + ranges = [] #: Array[Range[Integer]] + + comments.each do |comment| + tuple = [comment, 2] #: [Prism::Comment, Integer] + + unless comment.location.slice.start_with?(prefix_str) + tuple[1] = 1 + end + + offsets << tuple + + start_char = comment.location.start_character_offset + tuple[1] + end_char = comment.location.end_character_offset + ranges << (start_char ... end_char) + end + + @comment_buffer = source_buffer.sub_buffer(lines: ranges) + end + + def leading? + comment = offsets[0][0] or raise + comment.location.start_line_slice.index(/\S/) ? false : true + end + + def trailing? + comment = offsets[0][0] or raise + comment.location.start_line_slice.index(/\S/) ? true : false + end + + def start_line + comments[0].location.start_line + end + + def end_line + comments[-1].location.end_line + end + + def line_starts + offsets.map do |comment, prefix_size| + comment.location.start_character_offset + prefix_size + end + end + + def self.build(buffer, comments) + blocks = [] #: Array[CommentBlock] + + comments = comments.filter {|comment| comment.is_a?(Prism::InlineComment) } + + until comments.empty? + block_comments = [] #: Array[Prism::Comment] + + until comments.empty? + comment = comments.first or raise + last_comment = block_comments.last + + if last_comment + if last_comment.location.end_line + 1 == comment.location.start_line + if last_comment.location.start_column == comment.location.start_column + unless comment.location.start_line_slice.index(/\S/) + block_comments << comments.shift + next + end + end + end + + break + else + block_comments << comments.shift + end + end + + unless block_comments.empty? + blocks << CommentBlock.new(buffer, block_comments.dup) + end + end + + blocks + end + + AnnotationSyntaxError = _ = Data.define(:location, :error) + + def each_paragraph(variables, &block) + if block + if leading_annotation?(0) + yield_annotation(0, 0, 0, variables, &block) + else + yield_paragraph(0, 0, variables, &block) + end + else + enum_for :each_paragraph, variables + end + end + + def yield_paragraph(start_line, current_line, variables, &block) + # We already know at start_line..current_line are paragraph. + + while true + next_line = current_line + 1 + + if next_line >= comment_buffer.line_count + yield line_location(start_line, current_line) + return + end + + if leading_annotation?(next_line) + yield line_location(start_line, current_line) + return yield_annotation(next_line, next_line, next_line, variables, &block) + else + current_line = next_line + end + end + end + + def yield_annotation(start_line, end_line, current_line, variables, &block) + # We already know at start_line..end_line are annotation. + while true + next_line = current_line + 1 + + if next_line >= comment_buffer.line_count + annotation = parse_annotation_lines(start_line, end_line, variables) + yield annotation + + if end_line > current_line + yield_paragraph(end_line + 1, end_line + 1, variables, &block) + end + + return + end + + line_text = text(next_line) + if leading_spaces = line_text.index(/\S/) + if leading_spaces == 0 + # End of annotation + yield parse_annotation_lines(start_line, end_line, variables) + + if leading_annotation?(end_line + 1) + yield_annotation(end_line + 1, end_line + 1, end_line + 1, variables, &block) + else + yield_paragraph(end_line + 1, end_line + 1, variables, &block) + end + + return + else + current_line = next_line + end_line = next_line + end + else + current_line = next_line + end + end + end + + def text(comment_index) + range = comment_buffer.ranges[comment_index] + comment_buffer.content[range] or raise + end + + def line_location(start_line, end_line) + start_offset = comment_buffer.ranges[start_line].begin + end_offset = comment_buffer.ranges[end_line].end + Location.new(comment_buffer, start_offset, end_offset) + end + + def parse_annotation_lines(start_line, end_line, variables) + start_pos = comment_buffer.ranges[start_line].begin + end_pos = comment_buffer.ranges[end_line].end + begin + Parser.parse_inline_leading_annotation(comment_buffer, start_pos...end_pos, variables: variables) + rescue ParsingError => error + AnnotationSyntaxError.new(line_location(start_line, end_line), error) + end + end + + def trailing_annotation(variables) + if trailing? + comment = comments[0] or raise + if comment.location.slice.start_with?(/#[:\[]/) + begin + Parser.parse_inline_trailing_annotation(comment_buffer, 0...comment_buffer.last_position, variables: variables) + rescue ParsingError => error + location = line_location(0, offsets.size - 1) + AnnotationSyntaxError.new(location, error) + end + end + end + end + + def comments + offsets.map { _1[0]} + end + + def leading_annotation?(index) + if index < comment_buffer.line_count + text(index).start_with?(/@rbs\b/) and return true + + comment = offsets[index][0] + comment.location.slice.start_with?(/\#:/) and return true + end + + false + end + end + end + end +end diff --git a/sig/ast/ruby/comment_block.rbs b/sig/ast/ruby/comment_block.rbs new file mode 100644 index 000000000..7dd7bde03 --- /dev/null +++ b/sig/ast/ruby/comment_block.rbs @@ -0,0 +1,119 @@ +use Prism::Comment + +module RBS + module AST + module Ruby + # CommentBlock is a collection of comments + # + # ```ruby + # # Comment1 < block1 + # # Comment2 < + # + # # Comment3 < block2 + # ``` + # + # A comment block is a *leading* block or *trailing* block. + # + # ```ruby + # # This is leading block. + # # This is the second line of the leading block. + # + # foo # This is trailing block. + # # This is second line of the trailing block. + # ``` + # + # A leading block is a comment block where all of the comments are at the start of the line content. + # A trailing block is a comment block where the first comment of the block has something at the line before the comment. + # + class CommentBlock + attr_reader name: Pathname + + # Sub buffer of the contents of the comments + # + attr_reader comment_buffer: Buffer + + attr_reader offsets: Array[ + [ + Comment, + Integer, # -- prefix size + ] + ] + + def initialize: (Buffer source_buffer, Array[Comment]) -> void + + # Build comment block instances + def self.build: (Buffer, Array[Comment]) -> Array[instance] + + # Returns true if the comment block is a *leading* comment, which is attached to the successor node + def leading?: () -> bool + + # Returns true if the comment block is a *trailing* comment, which is attached to the predecessor node + def trailing?: () -> bool + + # The line number of the first comment in the block + def start_line: () -> Integer + + # The line number of the last comment in the block + def end_line: () -> Integer + + # The character index of `#comment_buffer` at the start of the lines + # + def line_starts: () -> Array[Integer] + + # Returns the text content of the comment + def text: (Integer index) -> String + + # Yields paragraph and annotation + # + # A paragraph is a sequence of lines that are separated by annotations. + # An annotation starts with a line starting with `@rbs` or `:`, and may continue with lines that has more leading spaces. + # + # ``` + # # Line 1 ^ Paragraph 1 + # # Line 2 | + # # | + # # Line 3 v + # # @rbs ... < Annotation 1 + # # @rbs ... ^ Annotation 2 + # # ... | + # # | + # # ... v + # # ^ Paragraph 2 + # # Line 4 | + # # Line 5 v + # ``` + # + def each_paragraph: (Array[Symbol] variables) { (Location | AST::Ruby::Annotations::leading_annotation | AnnotationSyntaxError) -> void } -> void + | (Array[Symbol] variables) -> Enumerator[Location | AST::Ruby::Annotations::leading_annotation | AnnotationSyntaxError] + + # Returns a trailing annotation if it exists + # + # * Returns `nil` if the block is not a type annotation + # * Returns an annotation if the block has a type annotation + # * Returns AnnotationSyntaxError if the annotation has a syntax error + # + def trailing_annotation: (Array[Symbol] variables) -> (AST::Ruby::Annotations::trailing_annotation | AnnotationSyntaxError | nil) + + class AnnotationSyntaxError + attr_reader location: Location + + attr_reader error: ParsingError + + def initialize: (Location, ParsingError) -> void + end + + private def yield_paragraph: (Integer start_line, Integer current_line, Array[Symbol] variables) { (Location | AST::Ruby::Annotations::leading_annotation | AnnotationSyntaxError) -> void } -> void + + private def yield_annotation: (Integer start_line, Integer end_line, Integer current_line, Array[Symbol] variables) { (Location | AST::Ruby::Annotations::leading_annotation | AnnotationSyntaxError) -> void } -> void + + private def parse_annotation_lines: (Integer start_line, Integer end_line, Array[Symbol] variables) -> (AST::Ruby::Annotations::leading_annotation | AnnotationSyntaxError) + + def comments: () -> Array[Comment] + + def line_location: (Integer start_line, Integer end_line) -> Location + + private def leading_annotation?: (Integer index) -> bool + end + end + end +end diff --git a/test/rbs/ast/ruby/comment_block_test.rb b/test/rbs/ast/ruby/comment_block_test.rb new file mode 100644 index 000000000..2072de1b0 --- /dev/null +++ b/test/rbs/ast/ruby/comment_block_test.rb @@ -0,0 +1,204 @@ +require "test_helper" + +class RBS::AST::Ruby::CommentBlockTest < Test::Unit::TestCase + include TestHelper + + include RBS::AST::Ruby + + def parse_comments(source) + buffer = RBS::Buffer.new(name: Pathname("a.rb"), content: source) + [buffer, Prism.parse_comments(source)] + end + + def test__buffer__single_line + buffer, comments = parse_comments(<<~RUBY) + # Hello, world! + RUBY + + block = CommentBlock.new(buffer, comments) + + assert_equal "Hello, world!", block.comment_buffer.content + assert_equal [[comments[0], 2]], block.offsets + end + + def test__buffer__multi_line_prefix + buffer, comments = parse_comments(<<~RUBY) + # Hello, world! + # This is the second line. + RUBY + + block = CommentBlock.new(buffer, comments) + + assert_equal "Hello, world!\nThis is the second line.", block.comment_buffer.content + assert_equal [[comments[0], 2], [comments[1], 2]], block.offsets + end + + def test__buffer__multi_line_prefix_inconsistent + buffer, comments = parse_comments(<<~RUBY) + # Hello, world! + # This is the second line. + #This is the third line. + RUBY + + block = CommentBlock.new(buffer, comments) + + assert_equal "Hello, world!\n This is the second line.\nThis is the third line.", block.comment_buffer.content + assert_equal [[comments[0], 2], [comments[1], 2], [comments[2], 1]], block.offsets + end + + def test__buffer__multi_line_prefix_header_line + buffer, comments = parse_comments(<<~RUBY) + #### + # Hello, world! + # This is the second line. + RUBY + + block = CommentBlock.new(buffer, comments) + + assert_equal "###\nHello, world!\nThis is the second line.", block.comment_buffer.content + assert_equal [[comments[0], 1], [comments[1], 2], [comments[2], 2]], block.offsets + end + + def test_build + buffer, comments = parse_comments(<<~RUBY) + # Comment1 + # Comment2 + + # Comment3 + foo() # Comment4 + # Comment5 + + bar() # Comment6 + baz() # Comment7 + RUBY + + blocks = CommentBlock.build(buffer, comments) + + assert_equal 5, blocks.size + + assert_equal <<~COMMENT.chomp, blocks[0].comment_buffer.content + Comment1 + Comment2 + COMMENT + assert_equal <<~COMMENT.chomp, blocks[1].comment_buffer.content + Comment3 + COMMENT + assert_equal <<~COMMENT.chomp, blocks[2].comment_buffer.content + Comment4 + Comment5 + COMMENT + assert_equal <<~COMMENT.chomp, blocks[3].comment_buffer.content + Comment6 + COMMENT + assert_equal <<~COMMENT.chomp, blocks[4].comment_buffer.content + Comment7 + COMMENT + end + + def test_each_paragraph + buffer, comments = parse_comments(<<~RUBY) + # Line 1 + # + # @rbs () -> void + # @rbs () + # -> Array[ + # String + # + # ] + # + # Line 2 + # Line 3 + # + # @rbs () + # + # Line 4 + RUBY + + block = CommentBlock.new(buffer, comments) + + paragraphs = block.each_paragraph([]).to_a + + paragraphs[0].tap do |paragraph| + assert_instance_of RBS::Location, paragraph + assert_equal "Line 1\n", paragraph.local_source + end + paragraphs[1].tap do |paragraph| + assert_instance_of RBS::AST::Ruby::Annotations::MethodTypesAnnotation, paragraph + assert_equal "@rbs () -> void", paragraph.location.local_source + end + paragraphs[2].tap do |paragraph| + assert_instance_of RBS::AST::Ruby::Annotations::MethodTypesAnnotation, paragraph + assert_equal "@rbs ()\n -> Array[\n String\n\n ]", paragraph.location.local_source + end + paragraphs[3].tap do |paragraph| + assert_instance_of RBS::Location, paragraph + assert_equal "\nLine 2\nLine 3\n", paragraph.local_source + end + paragraphs[4].tap do |paragraph| + assert_instance_of RBS::AST::Ruby::CommentBlock::AnnotationSyntaxError, paragraph + assert_equal "@rbs ()", paragraph.location.local_source + end + paragraphs[5].tap do |paragraph| + assert_instance_of RBS::Location, paragraph + assert_equal "\nLine 4", paragraph.local_source + end + end + + def test_each_paragraph_colon + buffer, comments = parse_comments(<<~RUBY) + # : Foo + # + #: %a{foo} + # () -> Bar + # + # Bar + RUBY + + block = CommentBlock.new(buffer, comments) + + paragraphs = block.each_paragraph([]).to_a + + paragraphs[0].tap do |paragraph| + assert_instance_of RBS::Location, paragraph + assert_equal ": Foo\n", paragraph.local_source + end + paragraphs[1].tap do |paragraph| + assert_instance_of RBS::AST::Ruby::Annotations::ColonMethodTypeAnnotation, paragraph + assert_equal ": %a{foo}\n () -> Bar", paragraph.location.local_source + end + paragraphs[2].tap do |paragraph| + assert_instance_of RBS::Location, paragraph + assert_equal "\nBar", paragraph.local_source + end + end + + def test_trailing_annotation + buffer, comments = parse_comments(<<~RUBY) + foo #: String + + foo #: String[ + + foo # This is some comment + + #: String + RUBY + + blocks = CommentBlock.build(buffer, comments) + + blocks[0].trailing_annotation([]).tap do |annotation| + assert_instance_of RBS::AST::Ruby::Annotations::NodeTypeAssertion, annotation + end + + blocks[1].trailing_annotation([]).tap do |annotation| + assert_instance_of CommentBlock::AnnotationSyntaxError, annotation + end + + blocks[2].trailing_annotation([]).tap do |annotation| + assert_nil annotation + end + + blocks[3].trailing_annotation([]).tap do |annotation| + assert_nil annotation + end + end +end From 0f4fd2cf9b4ab3b92399da398faf948cce9f2048 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Fri, 11 Apr 2025 16:49:16 +0900 Subject: [PATCH 11/48] Add `CommentAssociation` --- lib/rbs.rb | 1 + lib/rbs/inline_parser/comment_association.rb | 115 +++++++++++++++++++ sig/inline_parser/comment_association.rbs | 71 ++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 lib/rbs/inline_parser/comment_association.rb create mode 100644 sig/inline_parser/comment_association.rbs diff --git a/lib/rbs.rb b/lib/rbs.rb index 8c735f37c..b4a8b6aa5 100644 --- a/lib/rbs.rb +++ b/lib/rbs.rb @@ -33,6 +33,7 @@ require "rbs/ast/ruby/members" require "rbs/source" require "rbs/inline_parser" +require "rbs/inline_parser/comment_association" require "rbs/environment" require "rbs/environment/use_map" require "rbs/environment/class_entry" diff --git a/lib/rbs/inline_parser/comment_association.rb b/lib/rbs/inline_parser/comment_association.rb new file mode 100644 index 000000000..1bb00f409 --- /dev/null +++ b/lib/rbs/inline_parser/comment_association.rb @@ -0,0 +1,115 @@ +module RBS + class InlineParser + class CommentAssociation + attr_reader :blocks, :associated_blocks, :start_line_map, :end_line_map + + def initialize(blocks) + @blocks = blocks.sort_by {|block| block.start_line } + @associated_blocks = Set[].compare_by_identity + + @start_line_map = {} + @end_line_map = {} + + blocks.each do |block| + if block.leading? + end_line_map[block.end_line] = block + else + start_line_map[block.start_line] = block + end + end + end + + def self.build(buffer, result) + blocks = AST::Ruby::CommentBlock.build(buffer, result.comments) + new(blocks) + end + + class Reference + attr_reader :block + + def initialize(block, association) + @block = block + @associated_blocks = association + end + + def associate! + @associated_blocks << block + self + end + + def associated? + @associated_blocks.include?(block) + end + end + + def leading_block(node) + start_line = node.location.start_line + + if block = end_line_map.fetch(start_line - 1, nil) + Reference.new(block, associated_blocks) + end + end + + def leading_block!(node) + if ref = leading_block(node) + unless ref.associated? + ref.associate!.block + end + end + end + + def trailing_block(node) + location = + if node.is_a?(Prism::Node) + node.location + else + node + end #: Prism::Location + end_line = location.end_line + if block = start_line_map.fetch(end_line, nil) + Reference.new(block, associated_blocks) + end + end + + def trailing_block!(node) + if ref = trailing_block(node) + unless ref.associated? + ref.associate!.block + end + end + end + + def each_enclosed_block(node) + if block_given? + start_line = node.location.start_line + end_line = node.location.end_line + + if start_line+1 < end_line + ((start_line + 1)...end_line).each do |line| + if block = end_line_map.fetch(line, nil) + unless associated_blocks.include?(block) + associated_blocks << block + yield block + end + end + end + end + else + enum_for :each_enclosed_block, node + end + end + + def each_unassociated_block + if block_given? + blocks.each do |block| + unless associated_blocks.include?(block) + yield block + end + end + else + enum_for :each_unassociated_block + end + end + end + end +end diff --git a/sig/inline_parser/comment_association.rbs b/sig/inline_parser/comment_association.rbs new file mode 100644 index 000000000..00826469e --- /dev/null +++ b/sig/inline_parser/comment_association.rbs @@ -0,0 +1,71 @@ +use RBS::AST::Ruby::CommentBlock + +module RBS + class InlineParser + # CommentAssociation manages the association between `Prism::Node` and `CommentBlock` + # + class CommentAssociation + attr_reader blocks: Array[CommentBlock] + + attr_reader start_line_map: Hash[Integer, CommentBlock] + + attr_reader end_line_map: Hash[Integer, CommentBlock] + + # CommentBlocks that are already associated to a node, which cannot be associated to another node again + # + attr_reader associated_blocks: Set[CommentBlock] + + def self.build: (Buffer, Prism::Result) -> instance + + def initialize: (Array[CommentBlock]) -> void + + class Reference + attr_reader block: CommentBlock + + @associated_blocks: Set[CommentBlock] + + def initialize: (CommentBlock, Set[CommentBlock]) -> void + + def associate!: () -> self + + def associated?: () -> bool + end + + # Returns an unassociated CommentBlock that can be associated to given node + # + # Automatically updates association status. + # + def leading_block!: (Prism::Node) -> CommentBlock? + + # Returns a Reference that is associated to given node + # + # Updates association explicitly through the reference. + # + def leading_block: (Prism::Node) -> Reference? + + # Returns a CommentBlock that is associated to given node, or by its location + # + # Update association status. + # + def trailing_block!: (Prism::Node | Prism::Location) -> CommentBlock? + + # Returns a Reference that is associated to given node, or by its location + # + # Updates association explicitly through the reference. + # + def trailing_block: (Prism::Node | Prism::Location) -> Reference? + + # Yields leading CommentBlocks that is enclosed in the given node + # + # Note that `enclosed_blocks` works only after all of the *leading* blocks inside the node is associated. + # + # Update association status. + # + def each_enclosed_block: (Prism::Node) { (CommentBlock) -> void } -> void + | (Prism::Node) -> Enumerator[CommentBlock] + + def each_unassociated_block: () { (CommentBlock) -> void } -> void + | () -> Enumerator[CommentBlock] + end + end +end From ab5a5ce5abf2903673b0860f08199ae88e0e75ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 06:18:21 +0000 Subject: [PATCH 12/48] Bump csv from 3.3.3 to 3.3.4 in /steep Bumps [csv](https://github.com/ruby/csv) from 3.3.3 to 3.3.4. - [Release notes](https://github.com/ruby/csv/releases) - [Changelog](https://github.com/ruby/csv/blob/main/NEWS.md) - [Commits](https://github.com/ruby/csv/compare/v3.3.3...v3.3.4) --- updated-dependencies: - dependency-name: csv dependency-version: 3.3.4 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index db306ab6e..7cb32c8a5 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -20,7 +20,7 @@ GEM bigdecimal (3.1.9) concurrent-ruby (1.3.5) connection_pool (2.5.0) - csv (3.3.3) + csv (3.3.4) drb (2.2.1) ffi (1.17.1) fileutils (1.7.3) From 2f88c884a517ae047a74a35e970f6062b69a2326 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 06:18:39 +0000 Subject: [PATCH 13/48] Bump strscan from 3.1.2 to 3.1.3 in /steep Bumps [strscan](https://github.com/ruby/strscan) from 3.1.2 to 3.1.3. - [Release notes](https://github.com/ruby/strscan/releases) - [Changelog](https://github.com/ruby/strscan/blob/master/NEWS.md) - [Commits](https://github.com/ruby/strscan/compare/v3.1.2...v3.1.3) --- updated-dependencies: - dependency-name: strscan dependency-version: 3.1.3 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index db306ab6e..e9b75c62b 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -70,7 +70,7 @@ GEM strscan (>= 1.0.0) terminal-table (>= 2, < 5) uri (>= 0.12.0) - strscan (3.1.2) + strscan (3.1.3) terminal-table (4.0.0) unicode-display_width (>= 1.1.1, < 4) test-unit (3.6.8) From e552526435e62ed84e18ef122d3bd7549e36a239 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 06:40:15 +0000 Subject: [PATCH 14/48] Bump rubocop-ast from 1.44.0 to 1.44.1 Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.44.0 to 1.44.1. - [Release notes](https://github.com/rubocop/rubocop-ast/releases) - [Changelog](https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-ast/compare/v1.44.0...v1.44.1) --- updated-dependencies: - dependency-name: rubocop-ast dependency-version: 1.44.1 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0dd2f94e5..86cbe0495 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,7 +74,7 @@ GEM racc (~> 1.4) ostruct (0.6.1) parallel (1.26.3) - parser (3.3.7.4) + parser (3.3.8.0) ast (~> 2.4.1) racc pathname (0.4.0) @@ -122,7 +122,7 @@ GEM rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.44.0) + rubocop-ast (1.44.1) parser (>= 3.3.7.2) prism (~> 1.4) rubocop-on-rbs (1.5.0) @@ -157,7 +157,7 @@ GEM uri (>= 0.12.0) stringio (3.1.6) strong_json (2.1.2) - strscan (3.1.2) + strscan (3.1.3) tempfile (0.3.1) terminal-table (4.0.0) unicode-display_width (>= 1.1.1, < 4) From c75520763b7373024a4d354b90bef279e7b1e5ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 06:40:47 +0000 Subject: [PATCH 15/48] Bump parser from 3.3.7.4 to 3.3.8.0 Bumps [parser](https://github.com/whitequark/parser) from 3.3.7.4 to 3.3.8.0. - [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/whitequark/parser/compare/v3.3.7.4...v3.3.8.0) --- updated-dependencies: - dependency-name: parser dependency-version: 3.3.8.0 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0dd2f94e5..0c899e676 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,7 +74,7 @@ GEM racc (~> 1.4) ostruct (0.6.1) parallel (1.26.3) - parser (3.3.7.4) + parser (3.3.8.0) ast (~> 2.4.1) racc pathname (0.4.0) @@ -157,7 +157,7 @@ GEM uri (>= 0.12.0) stringio (3.1.6) strong_json (2.1.2) - strscan (3.1.2) + strscan (3.1.3) tempfile (0.3.1) terminal-table (4.0.0) unicode-display_width (>= 1.1.1, < 4) From 594ee7d3dfeac378e0dd38bb22e2456835dfdc2b Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 14 Apr 2025 15:57:02 +0900 Subject: [PATCH 16/48] Add `MethodTypeAnnotation` class --- lib/rbs/ast/ruby/members.rb | 71 +++++++++++++++++++++++++++++++++++++ sig/ast/ruby/members.rbs | 23 ++++++++++++ 2 files changed, 94 insertions(+) diff --git a/lib/rbs/ast/ruby/members.rb b/lib/rbs/ast/ruby/members.rb index 03903b342..bfa2911c8 100644 --- a/lib/rbs/ast/ruby/members.rb +++ b/lib/rbs/ast/ruby/members.rb @@ -14,6 +14,77 @@ def initialize(buffer) include Helpers::LocationHelper end + class MethodTypeAnnotation + attr_reader :type_annotations + + def initialize(type_annotations:) + @type_annotations = type_annotations + end + + def map_type_name(&block) + case type_annotations + when Array + updated_annots = type_annotations.map do |annotation| + annotation.map_type_name(&block) + end + when Annotations::NodeTypeAssertion + updated_annots = type_annotations.map_type_name(&block) + end + + MethodTypeAnnotation.new(type_annotations: updated_annots) #: self + end + + def self.build(leading_block, trailing_block, variables) + unused_annotations = [] #: Array[Annotations::leading_annotation | CommentBlock::AnnotationSyntaxError] + unused_trailing_annotation = nil #: Annotations::trailing_annotation | CommentBlock::AnnotationSyntaxError | nil + + type_annotations = nil #: type_annotations + + if trailing_block + case annotation = trailing_block.trailing_annotation(variables) + when Annotations::NodeTypeAssertion + type_annotations = annotation + else + unused_trailing_annotation = annotation + end + end + + if leading_block + leading_block.each_paragraph(variables) do |paragraph| + next if paragraph.is_a?(Location) + + if paragraph.is_a?(CommentBlock::AnnotationSyntaxError) + unused_annotations << paragraph + next + end + + case paragraph + when Annotations::MethodTypesAnnotation, Annotations::ColonMethodTypeAnnotation + type_annotations = [] unless type_annotations + if type_annotations.is_a?(Array) + type_annotations << paragraph + next + end + end + + unused_annotations << paragraph + end + end + + [ + MethodTypeAnnotation.new( + type_annotations: type_annotations + ), + unused_annotations, + unused_trailing_annotation + ] + end + + def empty? + type_annotations.nil? + end + end + class DefMember < Base Overload = AST::Members::MethodDefinition::Overload diff --git a/sig/ast/ruby/members.rbs b/sig/ast/ruby/members.rbs index d737d25f7..6a06c2072 100644 --- a/sig/ast/ruby/members.rbs +++ b/sig/ast/ruby/members.rbs @@ -12,6 +12,29 @@ module RBS type t = DefMember + class MethodTypeAnnotation + type type_annotations = Annotations::NodeTypeAssertion | Array[Annotations::ColonMethodTypeAnnotation | Annotations::MethodTypesAnnotation] | nil + + attr_reader type_annotations: type_annotations + + def initialize: (type_annotations: type_annotations) -> void + + def map_type_name: { (TypeName) -> TypeName } -> self + + # Returns the method type annotations from the comment block + # + # Returns a tuple of `DefAnnotations` object, array of unused leading annotations, and unused trailing annotation. + # + def self.build: (CommentBlock? leading_block, CommentBlock? trailing_block, Array[Symbol]) -> [ + MethodTypeAnnotation, + Array[Annotations::leading_annotation | CommentBlock::AnnotationSyntaxError], + Annotations::trailing_annotation | CommentBlock::AnnotationSyntaxError | nil + ] + + # Returns `true` if it doesn't have any annotation + def empty?: () -> bool + end + class DefMember < Base class Overload = AST::Members::MethodDefinition::Overload From 3178cfcb44b0fa3a4491649cb20175c032b87866 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 14 Apr 2025 16:40:12 +0900 Subject: [PATCH 17/48] Implement inline parser with method type annotations --- lib/rbs/ast/ruby/members.rb | 56 +++++++++++++---- lib/rbs/environment.rb | 18 +++++- lib/rbs/inline_parser.rb | 57 ++++++++++++++++- sig/ast/ruby/members.rbs | 7 ++- sig/environment.rbs | 6 +- sig/inline_parser.rbs | 13 ++++ test/rbs/definition_builder_test.rb | 29 ++++++++- test/rbs/inline_parser_test.rb | 96 +++++++++++++++++++++++++++++ 8 files changed, 263 insertions(+), 19 deletions(-) diff --git a/lib/rbs/ast/ruby/members.rb b/lib/rbs/ast/ruby/members.rb index bfa2911c8..082d11713 100644 --- a/lib/rbs/ast/ruby/members.rb +++ b/lib/rbs/ast/ruby/members.rb @@ -83,6 +83,47 @@ def self.build(leading_block, trailing_block, variables) def empty? type_annotations.nil? end + + def overloads + case type_annotations + when Annotations::NodeTypeAssertion + method_type = MethodType.new( + type_params: [], + type: Types::Function.empty(type_annotations.type), + block: nil, + location: nil + ) + + [ + AST::Members::MethodDefinition::Overload.new(annotations: [], method_type: method_type) + ] + when Array + type_annotations.flat_map do |annotation| + case annotation + when Annotations::ColonMethodTypeAnnotation + [ + AST::Members::MethodDefinition::Overload.new( + annotations: annotation.annotations, + method_type: annotation.method_type + ) + ] + when Annotations::MethodTypesAnnotation + annotation.overloads + end + end + when nil + method_type = MethodType.new( + type_params: [], + type: Types::UntypedFunction.new(return_type: Types::Bases::Any.new(location: nil)), + block: nil, + location: nil + ) + + [ + AST::Members::MethodDefinition::Overload.new(method_type: method_type, annotations: []) + ] + end + end end class DefMember < Base @@ -90,11 +131,13 @@ class DefMember < Base attr_reader :name attr_reader :node + attr_reader :method_type - def initialize(buffer, name, node) + def initialize(buffer, name, node, method_type) super(buffer) @name = name @node = node + @method_type = method_type end def location @@ -102,16 +145,7 @@ def location end def overloads - method_type = MethodType.new( - type_params: [], - type: Types::UntypedFunction.new(return_type: Types::Bases::Any.new(location: nil)), - block: nil, - location: nil - ) - - [ - Overload.new(method_type: method_type, annotations: []) - ] + method_type.overloads end def overloading? diff --git a/lib/rbs/environment.rb b/lib/rbs/environment.rb index e013c3529..a6475fa1e 100644 --- a/lib/rbs/environment.rb +++ b/lib/rbs/environment.rb @@ -673,7 +673,7 @@ def resolve_ruby_decl(resolver, decl, context:, prefix:) when AST::Ruby::Declarations::Base resolved.members << resolve_ruby_decl(resolver, member, context: inner_context, prefix: inner_prefix) when AST::Ruby::Members::Base - resolved.members << member + resolved.members << resolve_ruby_member(resolver, member, context: inner_context) else raise "Unknown member type: #{member.class}" end @@ -701,6 +701,20 @@ def resolve_ruby_decl(resolver, decl, context:, prefix:) end end + def resolve_ruby_member(resolver, member, context:) + case member + when AST::Ruby::Members::DefMember + AST::Ruby::Members::DefMember.new( + member.buffer, + member.name, + member.node, + member.method_type.map_type_name {|name, _, _| absolute_type_name(resolver, nil, name, context: context) } + ) + else + raise "Unknown member type: #{member.class}" + end + end + def resolve_member(resolver, map, member, context:) case member when AST::Members::MethodDefinition @@ -816,7 +830,7 @@ def resolve_type_params(resolver, map, params, context:) end def absolute_type_name(resolver, map, type_name, context:) - type_name = map.resolve(type_name) + type_name = map.resolve(type_name) if map resolver.resolve(type_name, context: context) || type_name end diff --git a/lib/rbs/inline_parser.rb b/lib/rbs/inline_parser.rb index 26348a8f3..a7a746024 100644 --- a/lib/rbs/inline_parser.rb +++ b/lib/rbs/inline_parser.rb @@ -27,6 +27,8 @@ def initialize(location, message) NonConstantClassName = _ = Class.new(Base) NonConstantModuleName = _ = Class.new(Base) TopLevelMethodDefinition = _ = Class.new(Base) + UnusedInlineAnnotation = _ = Class.new(Base) + AnnotationSyntaxError = _ = Class.new(Base) end def self.parse(buffer, prism) @@ -38,7 +40,7 @@ def self.parse(buffer, prism) end class Parser < Prism::Visitor - attr_reader :module_nesting, :result + attr_reader :module_nesting, :result, :comments include AST::Ruby::Helpers::ConstantHelper include AST::Ruby::Helpers::LocationHelper @@ -46,6 +48,7 @@ class Parser < Prism::Visitor def initialize(result) @result = result @module_nesting = [] + @comments = CommentAssociation.build(result.buffer, result.prism_result) end def buffer @@ -85,6 +88,10 @@ def visit_class_node(node) push_module_nesting(class_decl) do visit_child_nodes(node) end + + comments.each_enclosed_block(node) do |block| + report_unused_block(block) + end end def visit_module_node(node) @@ -101,6 +108,10 @@ def visit_module_node(node) push_module_nesting(module_decl) do visit_child_nodes(node) end + + comments.each_enclosed_block(node) do |block| + report_unused_block(block) + end end def visit_def_node(node) @@ -114,8 +125,24 @@ def visit_def_node(node) case current = current_module when AST::Ruby::Declarations::ClassDecl, AST::Ruby::Declarations::ModuleDecl - defn = AST::Ruby::Members::DefMember.new(buffer, node.name, node) + leading_block = comments.leading_block!(node) + + if node.end_keyword_loc + # Not an end-less def + end_loc = node.rparen_loc || node.parameters&.location || node.name_loc + trailing_block = comments.trailing_block!(end_loc) + end + + method_type, leading_unuseds, trailing_unused = AST::Ruby::Members::MethodTypeAnnotation.build(leading_block, trailing_block, []) + report_unused_annotation(trailing_unused, *leading_unuseds) + + defn = AST::Ruby::Members::DefMember.new(buffer, node.name, node, method_type) current.members << defn + + # Skip other comments in `def` node + comments.each_enclosed_block(node) do |block| + comments.associated_blocks << block + end else diagnostics << Diagnostic::TopLevelMethodDefinition.new( rbs_location(node.name_loc), @@ -131,6 +158,32 @@ def insert_declaration(decl) result.declarations << decl end end + + def report_unused_annotation(*annotations) + annotations.each do |annotation| + case annotation + when AST::Ruby::CommentBlock::AnnotationSyntaxError + diagnostics << Diagnostic::AnnotationSyntaxError.new( + annotation.location, "Syntax error: " + annotation.error.error_message + ) + when AST::Ruby::Annotations::Base + diagnostics << Diagnostic::UnusedInlineAnnotation.new( + annotation.location, "Unused inline rbs annotation" + ) + end + end + end + + def report_unused_block(block) + block.each_paragraph([]) do |paragraph| + case paragraph + when Location + # noop + else + report_unused_annotation(paragraph) + end + end + end end end end diff --git a/sig/ast/ruby/members.rbs b/sig/ast/ruby/members.rbs index 6a06c2072..cf3cebd68 100644 --- a/sig/ast/ruby/members.rbs +++ b/sig/ast/ruby/members.rbs @@ -33,6 +33,10 @@ module RBS # Returns `true` if it doesn't have any annotation def empty?: () -> bool + + # Returns the method type overloads + # + def overloads: () -> Array[AST::Members::MethodDefinition::Overload] end class DefMember < Base @@ -40,8 +44,9 @@ module RBS attr_reader name: Symbol attr_reader node: Prism::DefNode + attr_reader method_type: MethodTypeAnnotation - def initialize: (Buffer, Symbol name, Prism::DefNode node) -> void + def initialize: (Buffer, Symbol name, Prism::DefNode node, MethodTypeAnnotation) -> void def location: () -> Location diff --git a/sig/environment.rbs b/sig/environment.rbs index 0d7e783aa..ec6f90fac 100644 --- a/sig/environment.rbs +++ b/sig/environment.rbs @@ -216,8 +216,10 @@ module RBS def resolve_ruby_decl: (Resolver::TypeNameResolver, AST::Ruby::Declarations::t, context: Resolver::context, prefix: Namespace) -> AST::Ruby::Declarations::t - def absolute_type: (Resolver::TypeNameResolver, UseMap map, Types::t, context: Resolver::context) -> Types::t + def resolve_ruby_member: (Resolver::TypeNameResolver, AST::Ruby::Members::t, context: Resolver::context) -> AST::Ruby::Members::t - def absolute_type_name: (Resolver::TypeNameResolver, UseMap map, TypeName, context: Resolver::context) -> TypeName + def absolute_type: (Resolver::TypeNameResolver, UseMap? map, Types::t, context: Resolver::context) -> Types::t + + def absolute_type_name: (Resolver::TypeNameResolver, UseMap? map, TypeName, context: Resolver::context) -> TypeName end end diff --git a/sig/inline_parser.rbs b/sig/inline_parser.rbs index a7d05a14f..9783d41bd 100644 --- a/sig/inline_parser.rbs +++ b/sig/inline_parser.rbs @@ -32,9 +32,16 @@ module RBS class TopLevelMethodDefinition < Base end + class UnusedInlineAnnotation < Base + end + + class AnnotationSyntaxError < Base + end + type t = NotImplementedYet | NonConstantClassName | NonConstantModuleName | TopLevelMethodDefinition + | UnusedInlineAnnotation | AnnotationSyntaxError end def self.parse: (Buffer, Prism::ParseResult) -> Result @@ -46,6 +53,8 @@ module RBS include AST::Ruby::Helpers::LocationHelper + attr_reader comments: CommentAssociation + attr_reader result: Result attr_reader module_nesting: Array[module_context] @@ -63,6 +72,10 @@ module RBS def push_module_nesting: [T] (module_context) { () -> T } -> T def insert_declaration: (module_context) -> void + + def report_unused_annotation: (*AST::Ruby::Annotations::t | nil | AST::Ruby::CommentBlock::AnnotationSyntaxError) -> void + + def report_unused_block: (AST::Ruby::CommentBlock) -> void end end end diff --git a/test/rbs/definition_builder_test.rb b/test/rbs/definition_builder_test.rb index 62509636b..9aa9ac20b 100644 --- a/test/rbs/definition_builder_test.rb +++ b/test/rbs/definition_builder_test.rb @@ -3201,7 +3201,7 @@ module A end end - def test_inline_decl__class_def + def test_inline_decl__class_def__untyped SignatureManager.new do |manager| manager.add_ruby_file("inherited.rbs", <<~RUBY) class A @@ -3226,4 +3226,31 @@ def hello(x) = 123 end end end + + def test_inline_decl__class_def__typed + SignatureManager.new do |manager| + manager.add_ruby_file("inherited.rbs", <<~RUBY) + class A + # @rbs (String) -> Integer + def hello(x) = 123 + end + RUBY + + manager.build do |env| + builder = DefinitionBuilder.new(env: env) + + builder.build_instance(type_name("::A")).tap do |definition| + definition.methods[:hello].tap do |method| + assert_equal type_name("::A"), method.defined_in + assert_equal type_name("::A"), method.implemented_in + + assert_equal [parse_method_type("(::String) -> ::Integer")], method.method_types + assert_equal [parse_method_type("(::String) -> ::Integer")], method.defs.map(&:type) + + assert_equal [], method.annotations + end + end + end + end + end end diff --git a/test/rbs/inline_parser_test.rb b/test/rbs/inline_parser_test.rb index 0386f4f7b..444a8e017 100644 --- a/test/rbs/inline_parser_test.rb +++ b/test/rbs/inline_parser_test.rb @@ -139,4 +139,100 @@ def self.foo; end assert_equal "Singleton method definition is not supported yet", diagnostic.message end end + + def test_parse__def_return_type_assertion + result = parse(<<~RUBY) + class Foo + def foo #: void + "" + end + + def bar = "" #: void + end + RUBY + + assert_empty result.diagnostics + + result.declarations[0].tap do |decl| + decl.members[0].tap do |member| + assert_instance_of RBS::AST::Ruby::Members::DefMember, member + assert_instance_of Array, member.annotations + assert_equal ["() -> void"], member.overloads.map { _1.method_type.to_s } + end + + decl.members[1].tap do |member| + assert_instance_of RBS::AST::Ruby::Members::DefMember, member + assert_instance_of Array, member.annotations + assert_equal ["(?) -> untyped"], member.overloads.map { _1.method_type.to_s } + end + end + end + + def test_error__def_return_type_assertion + result = parse(<<~RUBY) + class Foo + def foo #: void[ + "" + end + end + RUBY + + assert_any!(result.diagnostics) do |diagnostic| + assert_instance_of RBS::InlineParser::Diagnostic::AnnotationSyntaxError, diagnostic + assert_equal ": void[", diagnostic.location.source + assert_equal "Syntax error: expected a token `pEOF`", diagnostic.message + end + + result.declarations[0].tap do |decl| + decl.members[0].tap do |member| + assert_instance_of RBS::AST::Ruby::Members::DefMember, member + assert_instance_of Array, member.annotations + assert_equal ["(?) -> untyped"], member.overloads.map { _1.method_type.to_s } + end + end + end + + def test_parse__def_colon_method_type + result = parse(<<~RUBY) + class Foo + #: () -> void + # + def foo + "" + end + end + RUBY + + assert_empty result.diagnostics + + result.declarations[0].tap do |decl| + decl.members[0].tap do |member| + assert_instance_of RBS::AST::Ruby::Members::DefMember, member + assert_instance_of Array, member.annotations + assert_equal ["() -> void"], member.overloads.map { _1.method_type.to_s } + end + end + end + + def test_parse__def_method_types + result = parse(<<~RUBY) + class Foo + # @rbs () -> void + # | (String) -> bot + def foo(x = nil) + "" + end + end + RUBY + + assert_empty result.diagnostics + + result.declarations[0].tap do |decl| + decl.members[0].tap do |member| + assert_instance_of RBS::AST::Ruby::Members::DefMember, member + assert_instance_of Array, member.annotations + assert_equal ["() -> void", "(String) -> bot"], member.overloads.map { _1.method_type.to_s } + end + end + end end From b0173c23cd335d89a9963f19da601a4f1fc62741 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 14 Apr 2025 17:18:20 +0900 Subject: [PATCH 18/48] Use `Struct` instead of `Data` --- lib/rbs/ast/ruby/comment_block.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rbs/ast/ruby/comment_block.rb b/lib/rbs/ast/ruby/comment_block.rb index db94210a4..72a07ea5d 100644 --- a/lib/rbs/ast/ruby/comment_block.rb +++ b/lib/rbs/ast/ruby/comment_block.rb @@ -93,7 +93,7 @@ def self.build(buffer, comments) blocks end - AnnotationSyntaxError = _ = Data.define(:location, :error) + AnnotationSyntaxError = _ = Struct.new(:location, :error) def each_paragraph(variables, &block) if block From de06b013b55edbd251cc5abd4d7da164f3ebac60 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 14 Apr 2025 17:19:20 +0900 Subject: [PATCH 19/48] Add `frozen_string_literal` comment --- lib/rbs/ast/ruby/annotations.rb | 2 ++ lib/rbs/inline_parser/comment_association.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/rbs/ast/ruby/annotations.rb b/lib/rbs/ast/ruby/annotations.rb index 34f8c1b83..442989182 100644 --- a/lib/rbs/ast/ruby/annotations.rb +++ b/lib/rbs/ast/ruby/annotations.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module AST module Ruby diff --git a/lib/rbs/inline_parser/comment_association.rb b/lib/rbs/inline_parser/comment_association.rb index 1bb00f409..91db2cd5a 100644 --- a/lib/rbs/inline_parser/comment_association.rb +++ b/lib/rbs/inline_parser/comment_association.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class InlineParser class CommentAssociation From c8b7fce20a928cfd97b36f169ba003edeb21e04d Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Fri, 11 Apr 2025 15:45:44 +0900 Subject: [PATCH 20/48] Add `SkipAnnotation` AST --- config.yml | 6 ++++++ include/rbs/constants.h | 1 + include/rbs/ruby_objs.h | 1 + lib/rbs/ast/ruby/annotations.rb | 10 ++++++++++ sig/ast/ruby/annotations.rbs | 10 ++++++++++ src/constants.c | 2 ++ src/ruby_objs.c | 14 ++++++++++++++ 7 files changed, 44 insertions(+) diff --git a/config.yml b/config.yml index ba28eb2a2..a760020e8 100644 --- a/config.yml +++ b/config.yml @@ -332,3 +332,9 @@ nodes: - name: prefix_location - name: overloads - name: vertical_bar_locations + - name: RBS::AST::Ruby::Annotations::SkipAnnotation + fields: + - name: location + - name: prefix_location + - name: skip_location + - name: comment_location diff --git a/include/rbs/constants.h b/include/rbs/constants.h index 8792debe4..48f5b5457 100644 --- a/include/rbs/constants.h +++ b/include/rbs/constants.h @@ -52,6 +52,7 @@ extern VALUE RBS_AST_Members_Public; extern VALUE RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation; extern VALUE RBS_AST_Ruby_Annotations_MethodTypesAnnotation; extern VALUE RBS_AST_Ruby_Annotations_NodeTypeAssertion; +extern VALUE RBS_AST_Ruby_Annotations_SkipAnnotation; extern VALUE RBS_AST_TypeParam; extern VALUE RBS_MethodType; extern VALUE RBS_Namespace; diff --git a/include/rbs/ruby_objs.h b/include/rbs/ruby_objs.h index 47a284e5a..084391107 100644 --- a/include/rbs/ruby_objs.h +++ b/include/rbs/ruby_objs.h @@ -42,6 +42,7 @@ VALUE rbs_ast_members_public(VALUE location); VALUE rbs_ast_ruby_annotations_colon_method_type_annotation(VALUE location, VALUE prefix_location, VALUE annotations, VALUE method_type); VALUE rbs_ast_ruby_annotations_method_types_annotation(VALUE location, VALUE prefix_location, VALUE overloads, VALUE vertical_bar_locations); VALUE rbs_ast_ruby_annotations_node_type_assertion(VALUE location, VALUE prefix_location, VALUE type); +VALUE rbs_ast_ruby_annotations_skip_annotation(VALUE location, VALUE prefix_location, VALUE skip_location, VALUE comment_location); VALUE rbs_ast_type_param(VALUE name, VALUE variance, VALUE upper_bound, VALUE default_type, VALUE unchecked, VALUE location); VALUE rbs_method_type(VALUE type_params, VALUE type, VALUE block, VALUE location); VALUE rbs_namespace(VALUE path, VALUE absolute); diff --git a/lib/rbs/ast/ruby/annotations.rb b/lib/rbs/ast/ruby/annotations.rb index 442989182..ffb03a180 100644 --- a/lib/rbs/ast/ruby/annotations.rb +++ b/lib/rbs/ast/ruby/annotations.rb @@ -74,6 +74,16 @@ def map_type_name(&block) self.class.new(location:, prefix_location:, overloads: ovs, vertical_bar_locations:) #: self end end + + class SkipAnnotation < Base + attr_reader :skip_location, :comment_location + + def initialize(location:, prefix_location:, skip_location:, comment_location:) + super(location, prefix_location) + @skip_location = skip_location + @comment_location = comment_location + end + end end end end diff --git a/sig/ast/ruby/annotations.rbs b/sig/ast/ruby/annotations.rbs index 433047f92..a27d0146f 100644 --- a/sig/ast/ruby/annotations.rbs +++ b/sig/ast/ruby/annotations.rbs @@ -4,6 +4,7 @@ module RBS module Annotations type leading_annotation = ColonMethodTypeAnnotation | MethodTypesAnnotation + | SkipAnnotation type trailing_annotation = NodeTypeAssertion @@ -63,6 +64,15 @@ module RBS def map_type_name: () { (TypeName) -> TypeName } -> self end + + # `@rbs skip -- comment` annotation in leading comments + # + class SkipAnnotation < Base + attr_reader skip_location: Location + attr_reader comment_location: Location? + + def initialize: (location: Location, prefix_location: Location, skip_location: Location, comment_location: Location?) -> void + end end end end diff --git a/src/constants.c b/src/constants.c index 139201a08..df5d72679 100644 --- a/src/constants.c +++ b/src/constants.c @@ -52,6 +52,7 @@ VALUE RBS_AST_Members_Public; VALUE RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation; VALUE RBS_AST_Ruby_Annotations_MethodTypesAnnotation; VALUE RBS_AST_Ruby_Annotations_NodeTypeAssertion; +VALUE RBS_AST_Ruby_Annotations_SkipAnnotation; VALUE RBS_AST_TypeParam; VALUE RBS_MethodType; VALUE RBS_Namespace; @@ -131,6 +132,7 @@ void rbs__init_constants(void) { IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation, RBS_AST_Ruby_Annotations, "ColonMethodTypeAnnotation"); IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_MethodTypesAnnotation, RBS_AST_Ruby_Annotations, "MethodTypesAnnotation"); IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_NodeTypeAssertion, RBS_AST_Ruby_Annotations, "NodeTypeAssertion"); + IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_SkipAnnotation, RBS_AST_Ruby_Annotations, "SkipAnnotation"); IMPORT_CONSTANT(RBS_AST_TypeParam, RBS_AST, "TypeParam"); IMPORT_CONSTANT(RBS_MethodType, RBS, "MethodType"); IMPORT_CONSTANT(RBS_Namespace, RBS, "Namespace"); diff --git a/src/ruby_objs.c b/src/ruby_objs.c index 027b6eb01..f7e9dd0b2 100644 --- a/src/ruby_objs.c +++ b/src/ruby_objs.c @@ -480,6 +480,20 @@ VALUE rbs_ast_ruby_annotations_node_type_assertion(VALUE location, VALUE prefix_ ); } +VALUE rbs_ast_ruby_annotations_skip_annotation(VALUE location, VALUE prefix_location, VALUE skip_location, VALUE comment_location) { + VALUE _init_kwargs = rb_hash_new(); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("prefix_location")), prefix_location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("skip_location")), skip_location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment_location")), comment_location); + + return CLASS_NEW_INSTANCE( + RBS_AST_Ruby_Annotations_SkipAnnotation, + 1, + &_init_kwargs + ); +} + VALUE rbs_ast_type_param(VALUE name, VALUE variance, VALUE upper_bound, VALUE default_type, VALUE unchecked, VALUE location) { VALUE _init_kwargs = rb_hash_new(); rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("name")), name); From 1ceb7af3d67af17578c5c65e15b04e2974fda7ae Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Fri, 11 Apr 2025 15:52:52 +0900 Subject: [PATCH 21/48] Add `skip` keyword --- ext/rbs_extension/lexer.c | 1158 ++++++++++++++-------------- ext/rbs_extension/lexer.h | 1 + ext/rbs_extension/lexer.re | 1 + ext/rbs_extension/lexstate.c | 1 + ext/rbs_extension/parser.c | 31 +- test/rbs/signature_parsing_test.rb | 13 + 6 files changed, 637 insertions(+), 568 deletions(-) diff --git a/ext/rbs_extension/lexer.c b/ext/rbs_extension/lexer.c index 880786046..dfdd14e47 100644 --- a/ext/rbs_extension/lexer.c +++ b/ext/rbs_extension/lexer.c @@ -115,13 +115,13 @@ token rbsparser_next_token(lexstate *state) { } yy1: rbs_skip(state); -#line 145 "ext/rbs_extension/lexer.re" +#line 146 "ext/rbs_extension/lexer.re" { return next_eof_token(state); } #line 121 "ext/rbs_extension/lexer.c" yy2: rbs_skip(state); yy3: -#line 146 "ext/rbs_extension/lexer.re" +#line 147 "ext/rbs_extension/lexer.re" { return next_token(state, ErrorToken); } #line 127 "ext/rbs_extension/lexer.c" yy4: @@ -130,7 +130,7 @@ token rbsparser_next_token(lexstate *state) { if (yych == '\t') goto yy4; if (yych == ' ') goto yy4; yy5: -#line 144 "ext/rbs_extension/lexer.re" +#line 145 "ext/rbs_extension/lexer.re" { return next_token(state, tTRIVIA); } #line 136 "ext/rbs_extension/lexer.c" yy6: @@ -459,7 +459,7 @@ token rbsparser_next_token(lexstate *state) { } } yy37: -#line 130 "ext/rbs_extension/lexer.re" +#line 131 "ext/rbs_extension/lexer.re" { return next_token(state, tUIDENT); } #line 465 "ext/rbs_extension/lexer.c" yy38: @@ -500,7 +500,7 @@ token rbsparser_next_token(lexstate *state) { } } yy42: -#line 133 "ext/rbs_extension/lexer.re" +#line 134 "ext/rbs_extension/lexer.re" { return next_token(state, tULLIDENT); } #line 506 "ext/rbs_extension/lexer.c" yy43: @@ -530,7 +530,7 @@ token rbsparser_next_token(lexstate *state) { goto yy53; } yy46: -#line 129 "ext/rbs_extension/lexer.re" +#line 130 "ext/rbs_extension/lexer.re" { return next_token(state, tLIDENT); } #line 536 "ext/rbs_extension/lexer.c" yy47: @@ -612,46 +612,51 @@ token rbsparser_next_token(lexstate *state) { yy59: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy134; - if (yych == 'i') goto yy135; - goto yy53; + if (yych <= 'h') { + if (yych == 'e') goto yy134; + goto yy53; + } else { + if (yych <= 'i') goto yy135; + if (yych == 'k') goto yy136; + goto yy53; + } yy60: rbs_skip(state); yych = peek(state); if (yych <= 'q') { - if (yych == 'o') goto yy136; + if (yych == 'o') goto yy137; goto yy53; } else { - if (yych <= 'r') goto yy137; - if (yych == 'y') goto yy138; + if (yych <= 'r') goto yy138; + if (yych == 'y') goto yy139; goto yy53; } yy61: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy139; - if (yych == 's') goto yy140; + if (yych == 'n') goto yy140; + if (yych == 's') goto yy141; goto yy53; yy62: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy141; + if (yych == 'o') goto yy142; goto yy53; yy63: rbs_skip(state); #line 28 "ext/rbs_extension/lexer.re" { return next_token(state, pLBRACE); } -#line 645 "ext/rbs_extension/lexer.c" +#line 650 "ext/rbs_extension/lexer.c" yy64: rbs_skip(state); #line 31 "ext/rbs_extension/lexer.re" { return next_token(state, pBAR); } -#line 650 "ext/rbs_extension/lexer.c" +#line 655 "ext/rbs_extension/lexer.c" yy65: rbs_skip(state); #line 29 "ext/rbs_extension/lexer.re" { return next_token(state, pRBRACE); } -#line 655 "ext/rbs_extension/lexer.c" +#line 660 "ext/rbs_extension/lexer.c" yy66: rbs_skip(state); yych = peek(state); @@ -688,19 +693,19 @@ token rbsparser_next_token(lexstate *state) { goto yy78; } } else { - goto yy157; + goto yy158; } } yy69: rbs_skip(state); -#line 107 "ext/rbs_extension/lexer.re" +#line 108 "ext/rbs_extension/lexer.re" { return next_token(state, tDQSTRING); } -#line 699 "ext/rbs_extension/lexer.c" +#line 704 "ext/rbs_extension/lexer.c" yy70: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy142; - if (yych == 'x') goto yy143; + if (yych == 'u') goto yy143; + if (yych == 'x') goto yy144; goto yy66; yy71: rbs_skip(state); @@ -732,9 +737,9 @@ token rbsparser_next_token(lexstate *state) { } } yy72: -#line 140 "ext/rbs_extension/lexer.re" +#line 141 "ext/rbs_extension/lexer.re" { return next_token(state, tGIDENT); } -#line 738 "ext/rbs_extension/lexer.c" +#line 743 "ext/rbs_extension/lexer.c" yy73: rbs_skip(state); goto yy72; @@ -744,18 +749,18 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 'Z') { if (yych <= '(') { if (yych <= '\'') goto yy68; - goto yy144; + goto yy145; } else { - if (yych == '<') goto yy145; + if (yych == '<') goto yy146; goto yy68; } } else { if (yych <= 'z') { - if (yych <= '[') goto yy146; + if (yych <= '[') goto yy147; goto yy68; } else { - if (yych <= '{') goto yy147; - if (yych <= '|') goto yy148; + if (yych <= '{') goto yy148; + if (yych <= '|') goto yy149; goto yy68; } } @@ -773,16 +778,16 @@ token rbsparser_next_token(lexstate *state) { yy77: rbs_skip(state); yy78: -#line 108 "ext/rbs_extension/lexer.re" +#line 109 "ext/rbs_extension/lexer.re" { return next_token(state, tSQSTRING); } -#line 779 "ext/rbs_extension/lexer.c" +#line 784 "ext/rbs_extension/lexer.c" yy79: rbs_skip(state); yych = peek(state); if (yych <= '\'') { if (yych <= 0x00000000) goto yy68; if (yych <= '&') goto yy75; - goto yy149; + goto yy150; } else { if (yych == '\\') goto yy79; goto yy75; @@ -791,16 +796,16 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); #line 36 "ext/rbs_extension/lexer.re" { return next_token(state, pSTAR2); } -#line 795 "ext/rbs_extension/lexer.c" +#line 800 "ext/rbs_extension/lexer.c" yy81: rbs_skip(state); #line 41 "ext/rbs_extension/lexer.re" { return next_token(state, pARROW); } -#line 800 "ext/rbs_extension/lexer.c" +#line 805 "ext/rbs_extension/lexer.c" yy82: rbs_skip(state); yych = peek(state); - if (yych == '.') goto yy150; + if (yych == '.') goto yy151; goto yy68; yy83: rbs_skip(state); @@ -808,18 +813,18 @@ token rbsparser_next_token(lexstate *state) { if (yych == '=') goto yy87; if (yych == '~') goto yy87; yy84: -#line 127 "ext/rbs_extension/lexer.re" +#line 128 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 814 "ext/rbs_extension/lexer.c" +#line 819 "ext/rbs_extension/lexer.c" yy85: rbs_skip(state); yych = peek(state); if (yych <= '"') { if (yych <= 0x00000000) goto yy68; if (yych <= '!') goto yy85; - goto yy151; + goto yy152; } else { - if (yych == '\\') goto yy152; + if (yych == '\\') goto yy153; goto yy85; } yy86: @@ -829,42 +834,42 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 0x0000001F) { if (yych <= '\n') { if (yych <= 0x00000000) goto yy68; - if (yych <= 0x00000008) goto yy153; + if (yych <= 0x00000008) goto yy154; goto yy68; } else { if (yych == '\r') goto yy68; - goto yy153; + goto yy154; } } else { if (yych <= '#') { if (yych <= ' ') goto yy68; - if (yych <= '"') goto yy155; - goto yy153; + if (yych <= '"') goto yy156; + goto yy154; } else { if (yych == '%') goto yy68; - if (yych <= '\'') goto yy155; + if (yych <= '\'') goto yy156; goto yy68; } } } else { if (yych <= 'Z') { if (yych <= '/') { - if (yych == '-') goto yy153; - goto yy155; + if (yych == '-') goto yy154; + goto yy156; } else { - if (yych <= '9') goto yy153; - if (yych <= '>') goto yy155; - goto yy153; + if (yych <= '9') goto yy154; + if (yych <= '>') goto yy156; + goto yy154; } } else { if (yych <= '^') { - if (yych == '\\') goto yy155; + if (yych == '\\') goto yy156; goto yy68; } else { - if (yych <= 'z') goto yy153; + if (yych <= 'z') goto yy154; if (yych <= '}') goto yy68; - if (yych <= '~') goto yy155; - goto yy153; + if (yych <= '~') goto yy156; + goto yy154; } } } @@ -877,9 +882,9 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '\'') { if (yych <= 0x00000000) goto yy68; if (yych <= '&') goto yy88; - goto yy156; + goto yy157; } else { - if (yych == '\\') goto yy158; + if (yych == '\\') goto yy159; goto yy88; } yy89: @@ -896,18 +901,18 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); #line 45 "ext/rbs_extension/lexer.re" { return next_token(state, pCOLON2); } -#line 900 "ext/rbs_extension/lexer.c" +#line 905 "ext/rbs_extension/lexer.c" yy92: rbs_skip(state); yych = peek(state); if (yych <= ';') goto yy84; if (yych <= '<') goto yy87; - if (yych <= '=') goto yy159; + if (yych <= '=') goto yy160; goto yy84; yy93: rbs_skip(state); yych = peek(state); - if (yych == '=') goto yy160; + if (yych == '=') goto yy161; if (yych == '~') goto yy87; goto yy68; yy94: @@ -921,12 +926,12 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '^') { if (yych <= '?') goto yy68; - if (yych <= '@') goto yy161; - if (yych <= 'Z') goto yy162; + if (yych <= '@') goto yy162; + if (yych <= 'Z') goto yy163; goto yy68; } else { if (yych == '`') goto yy68; - if (yych <= 'z') goto yy162; + if (yych <= 'z') goto yy163; goto yy68; } yy96: @@ -934,14 +939,14 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy164; + if (yych == '!') goto yy165; } else { if (yych <= '9') goto yy96; - if (yych == '=') goto yy164; + if (yych == '=') goto yy165; } } else { if (yych <= '^') { - if (yych <= '?') goto yy164; + if (yych <= '?') goto yy165; if (yych <= '@') goto yy97; if (yych <= 'Z') goto yy96; } else { @@ -950,13 +955,13 @@ token rbsparser_next_token(lexstate *state) { } } yy97: -#line 123 "ext/rbs_extension/lexer.re" +#line 124 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 956 "ext/rbs_extension/lexer.c" +#line 961 "ext/rbs_extension/lexer.c" yy98: rbs_skip(state); yych = peek(state); - if (yych == ']') goto yy160; + if (yych == ']') goto yy161; goto yy68; yy99: rbs_skip(state); @@ -972,17 +977,17 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); #line 42 "ext/rbs_extension/lexer.re" { return next_token(state, pFATARROW); } -#line 976 "ext/rbs_extension/lexer.c" +#line 981 "ext/rbs_extension/lexer.c" yy102: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '@') goto yy68; - if (yych <= 'Z') goto yy165; + if (yych <= 'Z') goto yy166; goto yy68; } else { if (yych == '`') goto yy68; - if (yych <= 'z') goto yy165; + if (yych <= 'z') goto yy166; goto yy68; } yy103: @@ -1002,31 +1007,31 @@ token rbsparser_next_token(lexstate *state) { } } yy105: -#line 137 "ext/rbs_extension/lexer.re" +#line 138 "ext/rbs_extension/lexer.re" { return next_token(state, tAIDENT); } -#line 1008 "ext/rbs_extension/lexer.c" +#line 1013 "ext/rbs_extension/lexer.c" yy106: rbs_skip(state); yych = peek(state); - if (yych == 'b') goto yy167; + if (yych == 'b') goto yy168; goto yy104; yy107: rbs_skip(state); -#line 134 "ext/rbs_extension/lexer.re" +#line 135 "ext/rbs_extension/lexer.re" { return next_token(state, tBANGIDENT); } -#line 1018 "ext/rbs_extension/lexer.c" +#line 1023 "ext/rbs_extension/lexer.c" yy108: rbs_skip(state); -#line 135 "ext/rbs_extension/lexer.re" +#line 136 "ext/rbs_extension/lexer.re" { return next_token(state, tEQIDENT); } -#line 1023 "ext/rbs_extension/lexer.c" +#line 1028 "ext/rbs_extension/lexer.c" yy109: rbs_skip(state); yych = peek(state); if (yych == '=') goto yy24; #line 47 "ext/rbs_extension/lexer.re" { return next_token(state, pAREF_OPR); } -#line 1030 "ext/rbs_extension/lexer.c" +#line 1035 "ext/rbs_extension/lexer.c" yy110: rbs_skip(state); yych = peek(state); @@ -1048,9 +1053,9 @@ token rbsparser_next_token(lexstate *state) { } } yy112: -#line 131 "ext/rbs_extension/lexer.re" +#line 132 "ext/rbs_extension/lexer.re" { return next_token(state, tULLIDENT); } -#line 1054 "ext/rbs_extension/lexer.c" +#line 1059 "ext/rbs_extension/lexer.c" yy113: rbs_skip(state); yych = peek(state); @@ -1071,24 +1076,24 @@ token rbsparser_next_token(lexstate *state) { } } yy114: -#line 132 "ext/rbs_extension/lexer.re" +#line 133 "ext/rbs_extension/lexer.re" { return next_token(state, tULIDENT); } -#line 1077 "ext/rbs_extension/lexer.c" +#line 1082 "ext/rbs_extension/lexer.c" yy115: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy168; + if (yych == 't') goto yy169; goto yy111; yy116: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '`') goto yy169; + if (yych == '`') goto yy170; goto yy116; yy117: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy170; + if (yych == 'i') goto yy171; goto yy53; yy118: rbs_skip(state); @@ -1112,42 +1117,42 @@ token rbsparser_next_token(lexstate *state) { yy119: #line 96 "ext/rbs_extension/lexer.re" { return next_token(state, kAS); } -#line 1116 "ext/rbs_extension/lexer.c" +#line 1121 "ext/rbs_extension/lexer.c" yy120: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy171; + if (yych == 't') goto yy172; goto yy53; yy121: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy172; - if (yych == 't') goto yy173; + if (yych == 'o') goto yy173; + if (yych == 't') goto yy174; goto yy53; yy122: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy175; + if (yych == 'a') goto yy176; goto yy53; yy123: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy176; + if (yych == 'f') goto yy177; goto yy53; yy124: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy178; + if (yych == 'd') goto yy179; goto yy53; yy125: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy180; + if (yych == 't') goto yy181; goto yy53; yy126: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy181; + if (yych == 'l') goto yy182; goto yy53; yy127: rbs_skip(state); @@ -1168,13 +1173,13 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 'c') { if (yych == '`') goto yy128; if (yych <= 'b') goto yy52; - goto yy182; + goto yy183; } else { if (yych <= 's') { if (yych <= 'r') goto yy52; - goto yy183; + goto yy184; } else { - if (yych <= 't') goto yy184; + if (yych <= 't') goto yy185; if (yych <= 'z') goto yy52; } } @@ -1182,88 +1187,93 @@ token rbsparser_next_token(lexstate *state) { yy128: #line 77 "ext/rbs_extension/lexer.re" { return next_token(state, kIN); } -#line 1186 "ext/rbs_extension/lexer.c" +#line 1191 "ext/rbs_extension/lexer.c" yy129: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy185; + if (yych == 'd') goto yy186; goto yy53; yy130: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy186; + if (yych == 'l') goto yy187; goto yy53; yy131: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy188; + if (yych == 't') goto yy189; goto yy53; yy132: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy190; - if (yych == 'i') goto yy191; + if (yych == 'e') goto yy191; + if (yych == 'i') goto yy192; goto yy53; yy133: rbs_skip(state); yych = peek(state); - if (yych == 'b') goto yy192; + if (yych == 'b') goto yy193; goto yy53; yy134: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy193; + if (yych == 'l') goto yy194; goto yy53; yy135: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy194; + if (yych == 'n') goto yy195; goto yy53; yy136: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy195; + if (yych == 'i') goto yy196; goto yy53; yy137: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy197; + if (yych == 'p') goto yy197; goto yy53; yy138: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy198; + if (yych == 'u') goto yy199; goto yy53; yy139: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy199; - if (yych == 't') goto yy200; + if (yych == 'p') goto yy200; goto yy53; yy140: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy201; + if (yych == 'c') goto yy201; + if (yych == 't') goto yy202; goto yy53; yy141: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy203; + if (yych == 'e') goto yy203; goto yy53; yy142: + rbs_skip(state); + yych = peek(state); + if (yych == 'i') goto yy205; + goto yy53; +yy143: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy204; + if (yych <= '9') goto yy206; goto yy68; } else { - if (yych <= 'F') goto yy204; + if (yych <= 'F') goto yy206; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy204; + if (yych <= 'f') goto yy206; goto yy68; } -yy143: +yy144: rbs_skip(state); yych = peek(state); if (yych <= '/') goto yy68; @@ -1271,37 +1281,37 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '`') goto yy68; if (yych <= 'f') goto yy66; goto yy68; -yy144: - rbs_skip(state); - yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == ')') goto yy205; - goto yy144; yy145: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '>') goto yy206; + if (yych == ')') goto yy207; goto yy145; yy146: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == ']') goto yy207; + if (yych == '>') goto yy208; goto yy146; yy147: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '}') goto yy208; + if (yych == ']') goto yy209; goto yy147; yy148: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '|') goto yy209; + if (yych == '}') goto yy210; goto yy148; yy149: + rbs_skip(state); + yych = peek(state); + if (yych <= 0x00000000) goto yy68; + if (yych == '|') goto yy211; + goto yy149; +yy150: yyaccept = 5; rbs_skip(state); backup = *state; @@ -1314,174 +1324,174 @@ token rbsparser_next_token(lexstate *state) { if (yych == '\\') goto yy79; goto yy75; } -yy150: +yy151: rbs_skip(state); #line 38 "ext/rbs_extension/lexer.re" { return next_token(state, pDOT3); } -#line 1322 "ext/rbs_extension/lexer.c" -yy151: +#line 1332 "ext/rbs_extension/lexer.c" +yy152: rbs_skip(state); -#line 109 "ext/rbs_extension/lexer.re" +#line 110 "ext/rbs_extension/lexer.re" { return next_token(state, tDQSYMBOL); } -#line 1327 "ext/rbs_extension/lexer.c" -yy152: +#line 1337 "ext/rbs_extension/lexer.c" +yy153: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy210; - if (yych == 'x') goto yy211; + if (yych == 'u') goto yy212; + if (yych == 'x') goto yy213; goto yy85; -yy153: +yy154: rbs_skip(state); yych = peek(state); if (yych <= ',') { if (yych <= '\f') { - if (yych <= 0x00000000) goto yy154; - if (yych <= 0x00000008) goto yy153; - if (yych >= '\v') goto yy153; + if (yych <= 0x00000000) goto yy155; + if (yych <= 0x00000008) goto yy154; + if (yych >= '\v') goto yy154; } else { if (yych <= 0x0000001F) { - if (yych >= 0x0000000E) goto yy153; + if (yych >= 0x0000000E) goto yy154; } else { - if (yych == '#') goto yy153; + if (yych == '#') goto yy154; } } } else { if (yych <= '>') { - if (yych <= '-') goto yy153; - if (yych <= '/') goto yy154; - if (yych <= '9') goto yy153; + if (yych <= '-') goto yy154; + if (yych <= '/') goto yy155; + if (yych <= '9') goto yy154; } else { if (yych <= '^') { - if (yych <= 'Z') goto yy153; + if (yych <= 'Z') goto yy154; } else { - if (yych <= 'z') goto yy153; - if (yych >= 0x0000007F) goto yy153; + if (yych <= 'z') goto yy154; + if (yych >= 0x0000007F) goto yy154; } } } -yy154: -#line 126 "ext/rbs_extension/lexer.re" - { return next_token(state, tSYMBOL); } -#line 1366 "ext/rbs_extension/lexer.c" yy155: - rbs_skip(state); - goto yy154; +#line 127 "ext/rbs_extension/lexer.re" + { return next_token(state, tSYMBOL); } +#line 1376 "ext/rbs_extension/lexer.c" yy156: rbs_skip(state); + goto yy155; yy157: -#line 110 "ext/rbs_extension/lexer.re" - { return next_token(state, tSQSYMBOL); } -#line 1375 "ext/rbs_extension/lexer.c" + rbs_skip(state); yy158: +#line 111 "ext/rbs_extension/lexer.re" + { return next_token(state, tSQSYMBOL); } +#line 1385 "ext/rbs_extension/lexer.c" +yy159: rbs_skip(state); yych = peek(state); if (yych <= '\'') { if (yych <= 0x00000000) goto yy68; if (yych <= '&') goto yy88; - goto yy212; + goto yy214; } else { - if (yych == '\\') goto yy158; + if (yych == '\\') goto yy159; goto yy88; } -yy159: +yy160: rbs_skip(state); yych = peek(state); if (yych == '>') goto yy87; goto yy84; -yy160: +yy161: rbs_skip(state); yych = peek(state); if (yych == '=') goto yy87; goto yy84; -yy161: +yy162: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '@') goto yy68; - if (yych <= 'Z') goto yy213; + if (yych <= 'Z') goto yy215; goto yy68; } else { if (yych == '`') goto yy68; - if (yych <= 'z') goto yy213; + if (yych <= 'z') goto yy215; goto yy68; } -yy162: +yy163: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy215; + if (yych == '!') goto yy217; } else { - if (yych <= '9') goto yy162; - if (yych == '=') goto yy215; + if (yych <= '9') goto yy163; + if (yych == '=') goto yy217; } } else { if (yych <= '^') { - if (yych <= '?') goto yy215; - if (yych <= '@') goto yy163; - if (yych <= 'Z') goto yy162; + if (yych <= '?') goto yy217; + if (yych <= '@') goto yy164; + if (yych <= 'Z') goto yy163; } else { - if (yych == '`') goto yy163; - if (yych <= 'z') goto yy162; + if (yych == '`') goto yy164; + if (yych <= 'z') goto yy163; } } -yy163: -#line 124 "ext/rbs_extension/lexer.re" - { return next_token(state, tSYMBOL); } -#line 1432 "ext/rbs_extension/lexer.c" yy164: +#line 125 "ext/rbs_extension/lexer.re" + { return next_token(state, tSYMBOL); } +#line 1442 "ext/rbs_extension/lexer.c" +yy165: rbs_skip(state); goto yy97; -yy165: +yy166: rbs_skip(state); yych = peek(state); if (yych <= 'Z') { - if (yych <= '/') goto yy166; - if (yych <= '9') goto yy165; - if (yych >= 'A') goto yy165; + if (yych <= '/') goto yy167; + if (yych <= '9') goto yy166; + if (yych >= 'A') goto yy166; } else { if (yych <= '_') { - if (yych >= '_') goto yy165; + if (yych >= '_') goto yy166; } else { - if (yych <= '`') goto yy166; - if (yych <= 'z') goto yy165; + if (yych <= '`') goto yy167; + if (yych <= 'z') goto yy166; } } -yy166: -#line 138 "ext/rbs_extension/lexer.re" - { return next_token(state, tA2IDENT); } -#line 1454 "ext/rbs_extension/lexer.c" yy167: +#line 139 "ext/rbs_extension/lexer.re" + { return next_token(state, tA2IDENT); } +#line 1464 "ext/rbs_extension/lexer.c" +yy168: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy216; + if (yych == 's') goto yy218; goto yy104; -yy168: +yy169: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy218; + if (yych == 'o') goto yy220; goto yy111; -yy169: +yy170: rbs_skip(state); #line 40 "ext/rbs_extension/lexer.re" { return next_token(state, tQIDENT); } -#line 1469 "ext/rbs_extension/lexer.c" -yy170: - rbs_skip(state); - yych = peek(state); - if (yych == 'a') goto yy219; - goto yy53; +#line 1479 "ext/rbs_extension/lexer.c" yy171: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy220; + if (yych == 'a') goto yy221; goto yy53; yy172: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy221; + if (yych == 'r') goto yy222; goto yy53; yy173: + rbs_skip(state); + yych = peek(state); + if (yych == 'l') goto yy223; + goto yy53; +yy174: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1493,23 +1503,23 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy174; + if (yych <= '@') goto yy175; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy174; + if (yych == '`') goto yy175; if (yych <= 'z') goto yy52; } } -yy174: +yy175: #line 71 "ext/rbs_extension/lexer.re" { return next_token(state, kBOT); } -#line 1507 "ext/rbs_extension/lexer.c" -yy175: +#line 1517 "ext/rbs_extension/lexer.c" +yy176: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy223; + if (yych == 's') goto yy225; goto yy53; -yy176: +yy177: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1521,18 +1531,18 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy177; + if (yych <= '@') goto yy178; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy177; + if (yych == '`') goto yy178; if (yych <= 'z') goto yy52; } } -yy177: +yy178: #line 73 "ext/rbs_extension/lexer.re" { return next_token(state, kDEF); } -#line 1535 "ext/rbs_extension/lexer.c" -yy178: +#line 1545 "ext/rbs_extension/lexer.c" +yy179: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1544,48 +1554,48 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy179; + if (yych <= '@') goto yy180; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy179; + if (yych == '`') goto yy180; if (yych <= 'z') goto yy52; } } -yy179: +yy180: #line 74 "ext/rbs_extension/lexer.re" { return next_token(state, kEND); } -#line 1558 "ext/rbs_extension/lexer.c" -yy180: - rbs_skip(state); - yych = peek(state); - if (yych == 'e') goto yy224; - goto yy53; +#line 1568 "ext/rbs_extension/lexer.c" yy181: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy225; + if (yych == 'e') goto yy226; goto yy53; yy182: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy226; + if (yych == 's') goto yy227; goto yy53; yy183: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy227; + if (yych == 'l') goto yy228; goto yy53; yy184: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy228; + if (yych == 't') goto yy229; goto yy53; yy185: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy229; + if (yych == 'e') goto yy230; goto yy53; yy186: + rbs_skip(state); + yych = peek(state); + if (yych == 'u') goto yy231; + goto yy53; +yy187: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1597,18 +1607,18 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy187; + if (yych <= '@') goto yy188; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy187; + if (yych == '`') goto yy188; if (yych <= 'z') goto yy52; } } -yy187: +yy188: #line 82 "ext/rbs_extension/lexer.re" { return next_token(state, kNIL); } -#line 1611 "ext/rbs_extension/lexer.c" -yy188: +#line 1621 "ext/rbs_extension/lexer.c" +yy189: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1620,43 +1630,48 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy189; + if (yych <= '@') goto yy190; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy189; + if (yych == '`') goto yy190; if (yych <= 'z') goto yy52; } } -yy189: +yy190: #line 83 "ext/rbs_extension/lexer.re" { return next_token(state, kOUT); } -#line 1634 "ext/rbs_extension/lexer.c" -yy190: - rbs_skip(state); - yych = peek(state); - if (yych == 'p') goto yy230; - goto yy53; +#line 1644 "ext/rbs_extension/lexer.c" yy191: rbs_skip(state); yych = peek(state); - if (yych == 'v') goto yy231; + if (yych == 'p') goto yy232; goto yy53; yy192: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy232; + if (yych == 'v') goto yy233; goto yy53; yy193: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy233; + if (yych == 'l') goto yy234; goto yy53; yy194: rbs_skip(state); yych = peek(state); - if (yych == 'g') goto yy235; + if (yych == 'f') goto yy235; goto yy53; yy195: + rbs_skip(state); + yych = peek(state); + if (yych == 'g') goto yy237; + goto yy53; +yy196: + rbs_skip(state); + yych = peek(state); + if (yych == 'p') goto yy238; + goto yy53; +yy197: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1668,38 +1683,38 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy196; + if (yych <= '@') goto yy198; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy196; + if (yych == '`') goto yy198; if (yych <= 'z') goto yy52; } } -yy196: +yy198: #line 89 "ext/rbs_extension/lexer.re" { return next_token(state, kTOP); } -#line 1682 "ext/rbs_extension/lexer.c" -yy197: +#line 1697 "ext/rbs_extension/lexer.c" +yy199: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy236; + if (yych == 'e') goto yy240; goto yy53; -yy198: +yy200: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy238; + if (yych == 'e') goto yy242; goto yy53; -yy199: +yy201: rbs_skip(state); yych = peek(state); - if (yych == 'h') goto yy240; + if (yych == 'h') goto yy244; goto yy53; -yy200: +yy202: rbs_skip(state); yych = peek(state); - if (yych == 'y') goto yy241; + if (yych == 'y') goto yy245; goto yy53; -yy201: +yy203: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1711,74 +1726,74 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy202; + if (yych <= '@') goto yy204; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy202; + if (yych == '`') goto yy204; if (yych <= 'z') goto yy52; } } -yy202: +yy204: #line 95 "ext/rbs_extension/lexer.re" { return next_token(state, kUSE); } -#line 1725 "ext/rbs_extension/lexer.c" -yy203: +#line 1740 "ext/rbs_extension/lexer.c" +yy205: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy242; + if (yych == 'd') goto yy246; goto yy53; -yy204: +yy206: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy244; + if (yych <= '9') goto yy248; goto yy68; } else { - if (yych <= 'F') goto yy244; + if (yych <= 'F') goto yy248; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy244; + if (yych <= 'f') goto yy248; goto yy68; } -yy205: +yy207: rbs_skip(state); #line 54 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1748 "ext/rbs_extension/lexer.c" -yy206: +#line 1763 "ext/rbs_extension/lexer.c" +yy208: rbs_skip(state); #line 57 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1753 "ext/rbs_extension/lexer.c" -yy207: +#line 1768 "ext/rbs_extension/lexer.c" +yy209: rbs_skip(state); #line 55 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1758 "ext/rbs_extension/lexer.c" -yy208: +#line 1773 "ext/rbs_extension/lexer.c" +yy210: rbs_skip(state); #line 53 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1763 "ext/rbs_extension/lexer.c" -yy209: +#line 1778 "ext/rbs_extension/lexer.c" +yy211: rbs_skip(state); #line 56 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1768 "ext/rbs_extension/lexer.c" -yy210: +#line 1783 "ext/rbs_extension/lexer.c" +yy212: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy245; + if (yych <= '9') goto yy249; goto yy68; } else { - if (yych <= 'F') goto yy245; + if (yych <= 'F') goto yy249; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy245; + if (yych <= 'f') goto yy249; goto yy68; } -yy211: +yy213: rbs_skip(state); yych = peek(state); if (yych <= '/') goto yy68; @@ -1786,81 +1801,81 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '`') goto yy68; if (yych <= 'f') goto yy85; goto yy68; -yy212: +yy214: yyaccept = 6; rbs_skip(state); backup = *state; yych = peek(state); if (yych <= '\'') { - if (yych <= 0x00000000) goto yy157; + if (yych <= 0x00000000) goto yy158; if (yych <= '&') goto yy88; - goto yy156; + goto yy157; } else { - if (yych == '\\') goto yy158; + if (yych == '\\') goto yy159; goto yy88; } -yy213: +yy215: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy246; + if (yych == '!') goto yy250; } else { - if (yych <= '9') goto yy213; - if (yych == '=') goto yy246; + if (yych <= '9') goto yy215; + if (yych == '=') goto yy250; } } else { if (yych <= '^') { - if (yych <= '?') goto yy246; - if (yych <= '@') goto yy214; - if (yych <= 'Z') goto yy213; + if (yych <= '?') goto yy250; + if (yych <= '@') goto yy216; + if (yych <= 'Z') goto yy215; } else { - if (yych == '`') goto yy214; - if (yych <= 'z') goto yy213; + if (yych == '`') goto yy216; + if (yych <= 'z') goto yy215; } } -yy214: -#line 125 "ext/rbs_extension/lexer.re" +yy216: +#line 126 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 1826 "ext/rbs_extension/lexer.c" -yy215: +#line 1841 "ext/rbs_extension/lexer.c" +yy217: rbs_skip(state); - goto yy163; -yy216: + goto yy164; +yy218: rbs_skip(state); yych = peek(state); if (yych <= 'Z') { - if (yych <= '/') goto yy217; + if (yych <= '/') goto yy219; if (yych <= '9') goto yy103; if (yych >= 'A') goto yy103; } else { if (yych <= '_') { if (yych >= '_') goto yy103; } else { - if (yych <= '`') goto yy217; + if (yych <= '`') goto yy219; if (yych <= 'z') goto yy103; } } -yy217: +yy219: #line 98 "ext/rbs_extension/lexer.re" { return next_token(state, kATRBS); } -#line 1848 "ext/rbs_extension/lexer.c" -yy218: +#line 1863 "ext/rbs_extension/lexer.c" +yy220: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy247; + if (yych == 'd') goto yy251; goto yy111; -yy219: +yy221: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy248; + if (yych == 's') goto yy252; goto yy53; -yy220: +yy222: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy250; + if (yych == '_') goto yy254; goto yy53; -yy221: +yy223: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1872,68 +1887,68 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy222; + if (yych <= '@') goto yy224; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy222; + if (yych == '`') goto yy224; if (yych <= 'z') goto yy52; } } -yy222: +yy224: #line 70 "ext/rbs_extension/lexer.re" { return next_token(state, kBOOL); } -#line 1886 "ext/rbs_extension/lexer.c" -yy223: - rbs_skip(state); - yych = peek(state); - if (yych == 's') goto yy251; - goto yy53; -yy224: - rbs_skip(state); - yych = peek(state); - if (yych == 'n') goto yy253; - goto yy53; +#line 1901 "ext/rbs_extension/lexer.c" yy225: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy254; + if (yych == 's') goto yy255; goto yy53; yy226: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy256; + if (yych == 'n') goto yy257; goto yy53; yy227: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy257; + if (yych == 'e') goto yy258; goto yy53; yy228: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy258; + if (yych == 'u') goto yy260; goto yy53; yy229: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy259; + if (yych == 'a') goto yy261; goto yy53; yy230: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy260; + if (yych == 'r') goto yy262; goto yy53; yy231: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy261; + if (yych == 'l') goto yy263; goto yy53; yy232: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy262; + if (yych == 'e') goto yy264; goto yy53; yy233: + rbs_skip(state); + yych = peek(state); + if (yych == 'a') goto yy265; + goto yy53; +yy234: + rbs_skip(state); + yych = peek(state); + if (yych == 'i') goto yy266; + goto yy53; +yy235: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1945,23 +1960,23 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy234; + if (yych <= '@') goto yy236; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy234; + if (yych == '`') goto yy236; if (yych <= 'z') goto yy52; } } -yy234: +yy236: #line 87 "ext/rbs_extension/lexer.re" { return next_token(state, kSELF); } -#line 1959 "ext/rbs_extension/lexer.c" -yy235: +#line 1974 "ext/rbs_extension/lexer.c" +yy237: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy263; + if (yych == 'l') goto yy267; goto yy53; -yy236: +yy238: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1973,18 +1988,41 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy237; + if (yych <= '@') goto yy239; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy237; + if (yych == '`') goto yy239; if (yych <= 'z') goto yy52; } } -yy237: +yy239: +#line 99 "ext/rbs_extension/lexer.re" + { return next_token(state, kSKIP); } +#line 2002 "ext/rbs_extension/lexer.c" +yy240: + rbs_skip(state); + yych = peek(state); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy107; + } else { + if (yych <= '9') goto yy52; + if (yych >= '=') goto yy108; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy241; + if (yych <= 'Z') goto yy52; + } else { + if (yych == '`') goto yy241; + if (yych <= 'z') goto yy52; + } + } +yy241: #line 90 "ext/rbs_extension/lexer.re" { return next_token(state, kTRUE); } -#line 1987 "ext/rbs_extension/lexer.c" -yy238: +#line 2025 "ext/rbs_extension/lexer.c" +yy242: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -1996,28 +2034,28 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy239; + if (yych <= '@') goto yy243; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy239; + if (yych == '`') goto yy243; if (yych <= 'z') goto yy52; } } -yy239: +yy243: #line 91 "ext/rbs_extension/lexer.re" { return next_token(state, kTYPE); } -#line 2010 "ext/rbs_extension/lexer.c" -yy240: +#line 2048 "ext/rbs_extension/lexer.c" +yy244: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy264; + if (yych == 'e') goto yy268; goto yy53; -yy241: +yy245: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy265; + if (yych == 'p') goto yy269; goto yy53; -yy242: +yy246: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2029,52 +2067,52 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy243; + if (yych <= '@') goto yy247; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy243; + if (yych == '`') goto yy247; if (yych <= 'z') goto yy52; } } -yy243: +yy247: #line 94 "ext/rbs_extension/lexer.re" { return next_token(state, kVOID); } -#line 2043 "ext/rbs_extension/lexer.c" -yy244: +#line 2081 "ext/rbs_extension/lexer.c" +yy248: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy266; + if (yych <= '9') goto yy270; goto yy68; } else { - if (yych <= 'F') goto yy266; + if (yych <= 'F') goto yy270; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy266; + if (yych <= 'f') goto yy270; goto yy68; } -yy245: +yy249: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy267; + if (yych <= '9') goto yy271; goto yy68; } else { - if (yych <= 'F') goto yy267; + if (yych <= 'F') goto yy271; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy267; + if (yych <= 'f') goto yy271; goto yy68; } -yy246: +yy250: rbs_skip(state); - goto yy214; -yy247: + goto yy216; +yy251: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy268; + if (yych == 'o') goto yy272; goto yy111; -yy248: +yy252: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2086,29 +2124,29 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy249; + if (yych <= '@') goto yy253; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy249; + if (yych == '`') goto yy253; if (yych <= 'z') goto yy52; } } -yy249: +yy253: #line 66 "ext/rbs_extension/lexer.re" { return next_token(state, kALIAS); } -#line 2100 "ext/rbs_extension/lexer.c" -yy250: +#line 2138 "ext/rbs_extension/lexer.c" +yy254: rbs_skip(state); yych = peek(state); if (yych <= 'q') { - if (yych == 'a') goto yy269; + if (yych == 'a') goto yy273; goto yy53; } else { - if (yych <= 'r') goto yy270; - if (yych == 'w') goto yy271; + if (yych <= 'r') goto yy274; + if (yych == 'w') goto yy275; goto yy53; } -yy251: +yy255: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2120,23 +2158,23 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy252; + if (yych <= '@') goto yy256; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy252; + if (yych == '`') goto yy256; if (yych <= 'z') goto yy52; } } -yy252: +yy256: #line 72 "ext/rbs_extension/lexer.re" { return next_token(state, kCLASS); } -#line 2134 "ext/rbs_extension/lexer.c" -yy253: +#line 2172 "ext/rbs_extension/lexer.c" +yy257: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy272; + if (yych == 'd') goto yy276; goto yy53; -yy254: +yy258: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2148,68 +2186,68 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy255; + if (yych <= '@') goto yy259; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy255; + if (yych == '`') goto yy259; if (yych <= 'z') goto yy52; } } -yy255: +yy259: #line 76 "ext/rbs_extension/lexer.re" { return next_token(state, kFALSE); } -#line 2162 "ext/rbs_extension/lexer.c" -yy256: +#line 2200 "ext/rbs_extension/lexer.c" +yy260: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy274; + if (yych == 'd') goto yy278; goto yy53; -yy257: +yy261: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy275; + if (yych == 'n') goto yy279; goto yy53; -yy258: +yy262: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy276; + if (yych == 'f') goto yy280; goto yy53; -yy259: +yy263: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy277; + if (yych == 'e') goto yy281; goto yy53; -yy260: +yy264: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy279; + if (yych == 'n') goto yy283; goto yy53; -yy261: +yy265: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy280; + if (yych == 't') goto yy284; goto yy53; -yy262: +yy266: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy281; + if (yych == 'c') goto yy285; goto yy53; -yy263: +yy267: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy283; + if (yych == 'e') goto yy287; goto yy53; -yy264: +yy268: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy284; + if (yych == 'c') goto yy288; goto yy53; -yy265: +yy269: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy285; + if (yych == 'e') goto yy289; goto yy53; -yy266: +yy270: rbs_skip(state); yych = peek(state); if (yych <= '@') { @@ -2222,40 +2260,40 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 'f') goto yy66; goto yy68; } -yy267: +yy271: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy286; + if (yych <= '9') goto yy290; goto yy68; } else { - if (yych <= 'F') goto yy286; + if (yych <= 'F') goto yy290; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy286; + if (yych <= 'f') goto yy290; goto yy68; } -yy268: +yy272: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy287; + if (yych == '_') goto yy291; goto yy111; -yy269: +yy273: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy288; + if (yych == 'c') goto yy292; goto yy53; -yy270: +yy274: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy289; + if (yych == 'e') goto yy293; goto yy53; -yy271: +yy275: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy290; + if (yych == 'r') goto yy294; goto yy53; -yy272: +yy276: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2267,33 +2305,33 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy273; + if (yych <= '@') goto yy277; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy273; + if (yych == '`') goto yy277; if (yych <= 'z') goto yy52; } } -yy273: +yy277: #line 75 "ext/rbs_extension/lexer.re" { return next_token(state, kEXTEND); } -#line 2281 "ext/rbs_extension/lexer.c" -yy274: +#line 2319 "ext/rbs_extension/lexer.c" +yy278: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy291; + if (yych == 'e') goto yy295; goto yy53; -yy275: +yy279: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy293; + if (yych == 'c') goto yy297; goto yy53; -yy276: +yy280: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy294; + if (yych == 'a') goto yy298; goto yy53; -yy277: +yy281: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2305,28 +2343,28 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy278; + if (yych <= '@') goto yy282; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy278; + if (yych == '`') goto yy282; if (yych <= 'z') goto yy52; } } -yy278: +yy282: #line 81 "ext/rbs_extension/lexer.re" { return next_token(state, kMODULE); } -#line 2319 "ext/rbs_extension/lexer.c" -yy279: +#line 2357 "ext/rbs_extension/lexer.c" +yy283: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy295; + if (yych == 'd') goto yy299; goto yy53; -yy280: +yy284: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy297; + if (yych == 'e') goto yy301; goto yy53; -yy281: +yy285: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2338,33 +2376,33 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy282; + if (yych <= '@') goto yy286; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy282; + if (yych == '`') goto yy286; if (yych <= 'z') goto yy52; } } -yy282: +yy286: #line 86 "ext/rbs_extension/lexer.re" { return next_token(state, kPUBLIC); } -#line 2352 "ext/rbs_extension/lexer.c" -yy283: +#line 2390 "ext/rbs_extension/lexer.c" +yy287: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy299; + if (yych == 't') goto yy303; goto yy53; -yy284: +yy288: rbs_skip(state); yych = peek(state); - if (yych == 'k') goto yy300; + if (yych == 'k') goto yy304; goto yy53; -yy285: +yy289: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy301; + if (yych == 'd') goto yy305; goto yy53; -yy286: +yy290: rbs_skip(state); yych = peek(state); if (yych <= '@') { @@ -2377,27 +2415,27 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 'f') goto yy85; goto yy68; } -yy287: +yy291: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy303; + if (yych == '_') goto yy307; goto yy111; -yy288: +yy292: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy305; + if (yych == 'c') goto yy309; goto yy53; -yy289: +yy293: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy306; + if (yych == 'a') goto yy310; goto yy53; -yy290: +yy294: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy307; + if (yych == 'i') goto yy311; goto yy53; -yy291: +yy295: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2409,28 +2447,28 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy292; + if (yych <= '@') goto yy296; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy292; + if (yych == '`') goto yy296; if (yych <= 'z') goto yy52; } } -yy292: +yy296: #line 78 "ext/rbs_extension/lexer.re" { return next_token(state, kINCLUDE); } -#line 2423 "ext/rbs_extension/lexer.c" -yy293: +#line 2461 "ext/rbs_extension/lexer.c" +yy297: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy308; + if (yych == 'e') goto yy312; goto yy53; -yy294: +yy298: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy310; + if (yych == 'c') goto yy314; goto yy53; -yy295: +yy299: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2442,18 +2480,18 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy296; + if (yych <= '@') goto yy300; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy296; + if (yych == '`') goto yy300; if (yych <= 'z') goto yy52; } } -yy296: +yy300: #line 84 "ext/rbs_extension/lexer.re" { return next_token(state, kPREPEND); } -#line 2456 "ext/rbs_extension/lexer.c" -yy297: +#line 2494 "ext/rbs_extension/lexer.c" +yy301: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2465,28 +2503,28 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy298; + if (yych <= '@') goto yy302; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy298; + if (yych == '`') goto yy302; if (yych <= 'z') goto yy52; } } -yy298: +yy302: #line 85 "ext/rbs_extension/lexer.re" { return next_token(state, kPRIVATE); } -#line 2479 "ext/rbs_extension/lexer.c" -yy299: +#line 2517 "ext/rbs_extension/lexer.c" +yy303: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy311; + if (yych == 'o') goto yy315; goto yy53; -yy300: +yy304: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy312; + if (yych == 'e') goto yy316; goto yy53; -yy301: +yy305: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2498,18 +2536,18 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy302; + if (yych <= '@') goto yy306; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy302; + if (yych == '`') goto yy306; if (yych <= 'z') goto yy52; } } -yy302: +yy306: #line 93 "ext/rbs_extension/lexer.re" { return next_token(state, kUNTYPED); } -#line 2512 "ext/rbs_extension/lexer.c" -yy303: +#line 2550 "ext/rbs_extension/lexer.c" +yy307: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2521,33 +2559,33 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy304; + if (yych <= '@') goto yy308; if (yych <= 'Z') goto yy110; } else { - if (yych == '`') goto yy304; + if (yych == '`') goto yy308; if (yych <= 'z') goto yy110; } } -yy304: +yy308: #line 97 "ext/rbs_extension/lexer.re" { return next_token(state, k__TODO__); } -#line 2535 "ext/rbs_extension/lexer.c" -yy305: +#line 2573 "ext/rbs_extension/lexer.c" +yy309: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy313; + if (yych == 'e') goto yy317; goto yy53; -yy306: +yy310: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy314; + if (yych == 'd') goto yy318; goto yy53; -yy307: +yy311: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy315; + if (yych == 't') goto yy319; goto yy53; -yy308: +yy312: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2559,48 +2597,48 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy309; + if (yych <= '@') goto yy313; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy309; + if (yych == '`') goto yy313; if (yych <= 'z') goto yy52; } } -yy309: +yy313: #line 79 "ext/rbs_extension/lexer.re" { return next_token(state, kINSTANCE); } -#line 2573 "ext/rbs_extension/lexer.c" -yy310: +#line 2611 "ext/rbs_extension/lexer.c" +yy314: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy316; + if (yych == 'e') goto yy320; goto yy53; -yy311: +yy315: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy318; + if (yych == 'n') goto yy322; goto yy53; -yy312: +yy316: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy320; + if (yych == 'd') goto yy324; goto yy53; -yy313: +yy317: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy322; + if (yych == 's') goto yy326; goto yy53; -yy314: +yy318: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy323; + if (yych == 'e') goto yy327; goto yy53; -yy315: +yy319: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy324; + if (yych == 'e') goto yy328; goto yy53; -yy316: +yy320: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2612,18 +2650,18 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy317; + if (yych <= '@') goto yy321; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy317; + if (yych == '`') goto yy321; if (yych <= 'z') goto yy52; } } -yy317: +yy321: #line 80 "ext/rbs_extension/lexer.re" { return next_token(state, kINTERFACE); } -#line 2626 "ext/rbs_extension/lexer.c" -yy318: +#line 2664 "ext/rbs_extension/lexer.c" +yy322: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2635,18 +2673,18 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy319; + if (yych <= '@') goto yy323; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy319; + if (yych == '`') goto yy323; if (yych <= 'z') goto yy52; } } -yy319: +yy323: #line 88 "ext/rbs_extension/lexer.re" { return next_token(state, kSINGLETON); } -#line 2649 "ext/rbs_extension/lexer.c" -yy320: +#line 2687 "ext/rbs_extension/lexer.c" +yy324: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2658,38 +2696,38 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy321; + if (yych <= '@') goto yy325; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy321; + if (yych == '`') goto yy325; if (yych <= 'z') goto yy52; } } -yy321: +yy325: #line 92 "ext/rbs_extension/lexer.re" { return next_token(state, kUNCHECKED); } -#line 2672 "ext/rbs_extension/lexer.c" -yy322: +#line 2710 "ext/rbs_extension/lexer.c" +yy326: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy325; + if (yych == 's') goto yy329; goto yy53; -yy323: +yy327: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy326; + if (yych == 'r') goto yy330; goto yy53; -yy324: +yy328: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy328; + if (yych == 'r') goto yy332; goto yy53; -yy325: +yy329: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy330; + if (yych == 'o') goto yy334; goto yy53; -yy326: +yy330: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2701,18 +2739,18 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy327; + if (yych <= '@') goto yy331; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy327; + if (yych == '`') goto yy331; if (yych <= 'z') goto yy52; } } -yy327: +yy331: #line 68 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRREADER); } -#line 2715 "ext/rbs_extension/lexer.c" -yy328: +#line 2753 "ext/rbs_extension/lexer.c" +yy332: rbs_skip(state); yych = peek(state); if (yych <= '=') { @@ -2724,18 +2762,18 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy329; + if (yych <= '@') goto yy333; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy329; + if (yych == '`') goto yy333; if (yych <= 'z') goto yy52; } } -yy329: +yy333: #line 69 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRWRITER); } -#line 2738 "ext/rbs_extension/lexer.c" -yy330: +#line 2776 "ext/rbs_extension/lexer.c" +yy334: rbs_skip(state); yych = peek(state); if (yych != 'r') goto yy53; @@ -2750,18 +2788,18 @@ token rbsparser_next_token(lexstate *state) { } } else { if (yych <= '^') { - if (yych <= '@') goto yy331; + if (yych <= '@') goto yy335; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy331; + if (yych == '`') goto yy335; if (yych <= 'z') goto yy52; } } -yy331: +yy335: #line 67 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRACCESSOR); } -#line 2764 "ext/rbs_extension/lexer.c" +#line 2802 "ext/rbs_extension/lexer.c" } -#line 147 "ext/rbs_extension/lexer.re" +#line 148 "ext/rbs_extension/lexer.re" } diff --git a/ext/rbs_extension/lexer.h b/ext/rbs_extension/lexer.h index f5eb7bb5e..f3ca3d2f5 100644 --- a/ext/rbs_extension/lexer.h +++ b/ext/rbs_extension/lexer.h @@ -62,6 +62,7 @@ enum TokenType { kAS, /* as */ k__TODO__, /* __todo__ */ kATRBS, /* @rbs */ + kSKIP, /* skip */ tLIDENT, /* Identifiers starting with lower case */ tUIDENT, /* Identifiers starting with upper case */ diff --git a/ext/rbs_extension/lexer.re b/ext/rbs_extension/lexer.re index 4d58b5295..3ee463bd1 100644 --- a/ext/rbs_extension/lexer.re +++ b/ext/rbs_extension/lexer.re @@ -96,6 +96,7 @@ token rbsparser_next_token(lexstate *state) { "as" { return next_token(state, kAS); } "__todo__" { return next_token(state, k__TODO__); } "@rbs" { return next_token(state, kATRBS); } + "skip" { return next_token(state, kSKIP); } unicode_char = "\\u" [0-9a-fA-F]{4}; oct_char = "\\x" [0-9a-f]{1,2}; diff --git a/ext/rbs_extension/lexstate.c b/ext/rbs_extension/lexstate.c index c7389df80..2f56b1ca4 100644 --- a/ext/rbs_extension/lexstate.c +++ b/ext/rbs_extension/lexstate.c @@ -61,6 +61,7 @@ static const char *RBS_TOKENTYPE_NAMES[] = { "kAS", /* as */ "k__TODO__", /* __todo__ */ "kATRBS", /* @rbs */ + "kSKIP", /* skip */ "tLIDENT", /* Identifiers starting with lower case */ "tUIDENT", /* Identifiers starting with upper case */ diff --git a/ext/rbs_extension/parser.c b/ext/rbs_extension/parser.c index 4cec458ed..aa1d49939 100644 --- a/ext/rbs_extension/parser.c +++ b/ext/rbs_extension/parser.c @@ -48,6 +48,7 @@ case kUSE: \ case kAS: \ case k__TODO__: \ + case kSKIP: \ /* nop */ typedef struct { @@ -188,6 +189,7 @@ static VALUE parse_type_name(parserstate *state, TypeNameKind kind, range *rg) { switch (state->current_token.type) { case tLIDENT: + case kSKIP: if (kind & ALIAS_NAME) goto success; goto error; case tULIDENT: @@ -889,14 +891,26 @@ static VALUE parse_instance_type(parserstate *state, bool parse_alias) { VALUE types = EMPTY_ARRAY; TypeNameKind kind; - if (state->current_token.type == tUIDENT) { - kind = CLASS_NAME; - } else if (state->current_token.type == tULIDENT) { - kind = INTERFACE_NAME; - } else if (state->current_token.type == tLIDENT) { - kind = ALIAS_NAME; - } else { - rbs_abort(); + switch (state->current_token.type) { + case tUIDENT: { + kind = CLASS_NAME; + break; + } + case tULIDENT: { + kind = INTERFACE_NAME; + break; + } + case kSKIP: + case tLIDENT: { + kind = ALIAS_NAME; + break; + } + default: + raise_syntax_error( + state, + state->current_token, + "unexpected token for type name" + ); } range args_range; @@ -1050,6 +1064,7 @@ static VALUE parse_simple(parserstate *state) { } case tULIDENT: // fallthrough case tLIDENT: // fallthrough + case kSKIP: // fallthrough case pCOLON2: { return parse_instance_type(state, true); } diff --git a/test/rbs/signature_parsing_test.rb b/test/rbs/signature_parsing_test.rb index 193c32726..f8eb0f974 100644 --- a/test/rbs/signature_parsing_test.rb +++ b/test/rbs/signature_parsing_test.rb @@ -2291,4 +2291,17 @@ class Foo end RBS end + + def test_inline_keyword__skip + Parser.parse_signature(<<~RBS) + class Foo + def skip: (untyped skip) -> void + attr_reader skip: untyped + + type skip = untyped + + @foo: Array[skip] + end + RBS + end end From 0795a233ee7b2a900696310dbbb0039c5969dcda Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 14 Apr 2025 17:42:47 +0900 Subject: [PATCH 22/48] Implement parser --- ext/rbs_extension/lexer.c | 1714 ++++++++++---------- ext/rbs_extension/lexer.h | 1 + ext/rbs_extension/lexer.re | 1 + ext/rbs_extension/lexstate.c | 1 + ext/rbs_extension/parser.c | 26 + test/rbs/inline_annotation_parsing_test.rb | 16 + 6 files changed, 909 insertions(+), 850 deletions(-) diff --git a/ext/rbs_extension/lexer.c b/ext/rbs_extension/lexer.c index dfdd14e47..82e530725 100644 --- a/ext/rbs_extension/lexer.c +++ b/ext/rbs_extension/lexer.c @@ -115,13 +115,13 @@ token rbsparser_next_token(lexstate *state) { } yy1: rbs_skip(state); -#line 146 "ext/rbs_extension/lexer.re" +#line 147 "ext/rbs_extension/lexer.re" { return next_eof_token(state); } #line 121 "ext/rbs_extension/lexer.c" yy2: rbs_skip(state); yy3: -#line 147 "ext/rbs_extension/lexer.re" +#line 148 "ext/rbs_extension/lexer.re" { return next_token(state, ErrorToken); } #line 127 "ext/rbs_extension/lexer.c" yy4: @@ -130,7 +130,7 @@ token rbsparser_next_token(lexstate *state) { if (yych == '\t') goto yy4; if (yych == ' ') goto yy4; yy5: -#line 145 "ext/rbs_extension/lexer.re" +#line 146 "ext/rbs_extension/lexer.re" { return next_token(state, tTRIVIA); } #line 136 "ext/rbs_extension/lexer.c" yy6: @@ -158,7 +158,7 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 0x00000000) goto yy11; if (yych != '\n') goto yy10; yy11: -#line 59 "ext/rbs_extension/lexer.re" +#line 60 "ext/rbs_extension/lexer.re" { return next_token( state, @@ -263,25 +263,32 @@ token rbsparser_next_token(lexstate *state) { yy21: rbs_skip(state); yych = peek(state); - if (yych <= '=') { - if (yych <= '/') goto yy8; - if (yych <= '9') goto yy25; - goto yy8; - } else { - if (yych <= '>') goto yy81; - if (yych == '@') goto yy24; - goto yy8; + switch (yych) { + case '-': goto yy81; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy25; + case '>': goto yy82; + case '@': goto yy24; + default: goto yy8; } yy22: yyaccept = 2; rbs_skip(state); backup = *state; yych = peek(state); - if (yych == '.') goto yy82; + if (yych == '.') goto yy83; yy23: #line 37 "ext/rbs_extension/lexer.re" { return next_token(state, pDOT); } -#line 285 "ext/rbs_extension/lexer.c" +#line 292 "ext/rbs_extension/lexer.c" yy24: rbs_skip(state); goto yy8; @@ -292,34 +299,34 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '9') goto yy25; if (yych == '_') goto yy25; yy26: -#line 51 "ext/rbs_extension/lexer.re" +#line 52 "ext/rbs_extension/lexer.re" { return next_token(state, tINTEGER); } -#line 298 "ext/rbs_extension/lexer.c" +#line 305 "ext/rbs_extension/lexer.c" yy27: yyaccept = 3; rbs_skip(state); backup = *state; yych = peek(state); switch (yych) { - case '!': goto yy83; - case '"': goto yy85; - case '$': goto yy86; + case '!': goto yy84; + case '"': goto yy86; + case '$': goto yy87; case '%': case '&': case '/': case '^': case '`': case '|': - case '~': goto yy87; - case '\'': goto yy88; - case '*': goto yy89; + case '~': goto yy88; + case '\'': goto yy89; + case '*': goto yy90; case '+': - case '-': goto yy90; - case ':': goto yy91; - case '<': goto yy92; - case '=': goto yy93; - case '>': goto yy94; - case '@': goto yy95; + case '-': goto yy91; + case ':': goto yy92; + case '<': goto yy93; + case '=': goto yy94; + case '>': goto yy95; + case '@': goto yy96; case 'A': case 'B': case 'C': @@ -372,38 +379,38 @@ token rbsparser_next_token(lexstate *state) { case 'w': case 'x': case 'y': - case 'z': goto yy96; - case '[': goto yy98; + case 'z': goto yy97; + case '[': goto yy99; default: goto yy28; } yy28: #line 44 "ext/rbs_extension/lexer.re" { return next_token(state, pCOLON); } -#line 383 "ext/rbs_extension/lexer.c" +#line 390 "ext/rbs_extension/lexer.c" yy29: rbs_skip(state); yych = peek(state); if (yych <= ';') goto yy30; if (yych <= '<') goto yy24; - if (yych <= '=') goto yy99; + if (yych <= '=') goto yy100; yy30: #line 46 "ext/rbs_extension/lexer.re" { return next_token(state, pLT); } -#line 393 "ext/rbs_extension/lexer.c" +#line 400 "ext/rbs_extension/lexer.c" yy31: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '<') goto yy32; - if (yych <= '=') goto yy100; - goto yy101; + if (yych <= '=') goto yy101; + goto yy102; } else { if (yych == '~') goto yy24; } yy32: #line 43 "ext/rbs_extension/lexer.re" { return next_token(state, pEQ); } -#line 407 "ext/rbs_extension/lexer.c" +#line 414 "ext/rbs_extension/lexer.c" yy33: rbs_skip(state); yych = peek(state); @@ -414,7 +421,7 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); #line 34 "ext/rbs_extension/lexer.re" { return next_token(state, pQUESTION); } -#line 418 "ext/rbs_extension/lexer.c" +#line 425 "ext/rbs_extension/lexer.c" yy35: yyaccept = 0; rbs_skip(state); @@ -423,19 +430,19 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '_') { if (yych <= '@') { if (yych <= '?') goto yy3; - goto yy102; + goto yy103; } else { - if (yych <= 'Z') goto yy103; + if (yych <= 'Z') goto yy104; if (yych <= '^') goto yy3; - goto yy103; + goto yy104; } } else { if (yych <= 'q') { if (yych <= '`') goto yy3; - goto yy103; + goto yy104; } else { - if (yych <= 'r') goto yy106; - if (yych <= 'z') goto yy103; + if (yych <= 'r') goto yy107; + if (yych <= 'z') goto yy104; goto yy3; } } @@ -444,10 +451,10 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy36; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { @@ -459,50 +466,50 @@ token rbsparser_next_token(lexstate *state) { } } yy37: -#line 131 "ext/rbs_extension/lexer.re" +#line 132 "ext/rbs_extension/lexer.re" { return next_token(state, tUIDENT); } -#line 465 "ext/rbs_extension/lexer.c" +#line 472 "ext/rbs_extension/lexer.c" yy38: rbs_skip(state); yych = peek(state); - if (yych == ']') goto yy109; + if (yych == ']') goto yy110; #line 26 "ext/rbs_extension/lexer.re" { return next_token(state, pLBRACKET); } -#line 472 "ext/rbs_extension/lexer.c" +#line 479 "ext/rbs_extension/lexer.c" yy39: rbs_skip(state); #line 27 "ext/rbs_extension/lexer.re" { return next_token(state, pRBRACKET); } -#line 477 "ext/rbs_extension/lexer.c" +#line 484 "ext/rbs_extension/lexer.c" yy40: rbs_skip(state); #line 32 "ext/rbs_extension/lexer.re" { return next_token(state, pHAT); } -#line 482 "ext/rbs_extension/lexer.c" +#line 489 "ext/rbs_extension/lexer.c" yy41: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { - if (yych <= '9') goto yy110; - if (yych >= '=') goto yy108; + if (yych <= '9') goto yy111; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { if (yych <= '@') goto yy42; - if (yych <= 'Z') goto yy113; + if (yych <= 'Z') goto yy114; } else { - if (yych <= '_') goto yy115; + if (yych <= '_') goto yy116; if (yych <= '`') goto yy42; - if (yych <= 'z') goto yy110; + if (yych <= 'z') goto yy111; } } yy42: -#line 134 "ext/rbs_extension/lexer.re" +#line 135 "ext/rbs_extension/lexer.re" { return next_token(state, tULLIDENT); } -#line 506 "ext/rbs_extension/lexer.c" +#line 513 "ext/rbs_extension/lexer.c" yy43: yyaccept = 4; rbs_skip(state); @@ -510,54 +517,54 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= ' ') { if (yych <= 0x00000000) goto yy44; - if (yych <= 0x0000001F) goto yy116; + if (yych <= 0x0000001F) goto yy117; } else { - if (yych != ':') goto yy116; + if (yych != ':') goto yy117; } yy44: #line 39 "ext/rbs_extension/lexer.re" { return next_token(state, tOPERATOR); } -#line 521 "ext/rbs_extension/lexer.c" +#line 528 "ext/rbs_extension/lexer.c" yy45: rbs_skip(state); yych = peek(state); if (yych <= 'r') { - if (yych == 'l') goto yy117; + if (yych == 'l') goto yy118; goto yy53; } else { - if (yych <= 's') goto yy118; - if (yych <= 't') goto yy120; + if (yych <= 's') goto yy119; + if (yych <= 't') goto yy121; goto yy53; } yy46: -#line 130 "ext/rbs_extension/lexer.re" +#line 131 "ext/rbs_extension/lexer.re" { return next_token(state, tLIDENT); } -#line 536 "ext/rbs_extension/lexer.c" +#line 543 "ext/rbs_extension/lexer.c" yy47: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy121; + if (yych == 'o') goto yy122; goto yy53; yy48: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy122; + if (yych == 'l') goto yy123; goto yy53; yy49: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy123; + if (yych == 'e') goto yy124; goto yy53; yy50: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy124; - if (yych == 'x') goto yy125; + if (yych == 'n') goto yy125; + if (yych == 'x') goto yy126; goto yy53; yy51: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy126; + if (yych == 'a') goto yy127; goto yy53; yy52: rbs_skip(state); @@ -565,12 +572,12 @@ token rbsparser_next_token(lexstate *state) { yy53: if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; goto yy46; } else { if (yych <= '9') goto yy52; if (yych <= '<') goto yy46; - goto yy108; + goto yy109; } } else { if (yych <= '^') { @@ -586,77 +593,77 @@ token rbsparser_next_token(lexstate *state) { yy54: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy127; + if (yych == 'n') goto yy128; goto yy53; yy55: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy129; + if (yych == 'o') goto yy130; goto yy53; yy56: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy130; + if (yych == 'i') goto yy131; goto yy53; yy57: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy131; + if (yych == 'u') goto yy132; goto yy53; yy58: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy132; - if (yych == 'u') goto yy133; + if (yych == 'r') goto yy133; + if (yych == 'u') goto yy134; goto yy53; yy59: rbs_skip(state); yych = peek(state); if (yych <= 'h') { - if (yych == 'e') goto yy134; + if (yych == 'e') goto yy135; goto yy53; } else { - if (yych <= 'i') goto yy135; - if (yych == 'k') goto yy136; + if (yych <= 'i') goto yy136; + if (yych == 'k') goto yy137; goto yy53; } yy60: rbs_skip(state); yych = peek(state); if (yych <= 'q') { - if (yych == 'o') goto yy137; + if (yych == 'o') goto yy138; goto yy53; } else { - if (yych <= 'r') goto yy138; - if (yych == 'y') goto yy139; + if (yych <= 'r') goto yy139; + if (yych == 'y') goto yy140; goto yy53; } yy61: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy140; - if (yych == 's') goto yy141; + if (yych == 'n') goto yy141; + if (yych == 's') goto yy142; goto yy53; yy62: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy142; + if (yych == 'o') goto yy143; goto yy53; yy63: rbs_skip(state); #line 28 "ext/rbs_extension/lexer.re" { return next_token(state, pLBRACE); } -#line 650 "ext/rbs_extension/lexer.c" +#line 657 "ext/rbs_extension/lexer.c" yy64: rbs_skip(state); #line 31 "ext/rbs_extension/lexer.re" { return next_token(state, pBAR); } -#line 655 "ext/rbs_extension/lexer.c" +#line 662 "ext/rbs_extension/lexer.c" yy65: rbs_skip(state); #line 29 "ext/rbs_extension/lexer.re" { return next_token(state, pRBRACE); } -#line 660 "ext/rbs_extension/lexer.c" +#line 667 "ext/rbs_extension/lexer.c" yy66: rbs_skip(state); yych = peek(state); @@ -693,19 +700,19 @@ token rbsparser_next_token(lexstate *state) { goto yy78; } } else { - goto yy158; + goto yy159; } } yy69: rbs_skip(state); -#line 108 "ext/rbs_extension/lexer.re" +#line 109 "ext/rbs_extension/lexer.re" { return next_token(state, tDQSTRING); } -#line 704 "ext/rbs_extension/lexer.c" +#line 711 "ext/rbs_extension/lexer.c" yy70: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy143; - if (yych == 'x') goto yy144; + if (yych == 'u') goto yy144; + if (yych == 'x') goto yy145; goto yy66; yy71: rbs_skip(state); @@ -737,9 +744,9 @@ token rbsparser_next_token(lexstate *state) { } } yy72: -#line 141 "ext/rbs_extension/lexer.re" +#line 142 "ext/rbs_extension/lexer.re" { return next_token(state, tGIDENT); } -#line 743 "ext/rbs_extension/lexer.c" +#line 750 "ext/rbs_extension/lexer.c" yy73: rbs_skip(state); goto yy72; @@ -749,18 +756,18 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 'Z') { if (yych <= '(') { if (yych <= '\'') goto yy68; - goto yy145; + goto yy146; } else { - if (yych == '<') goto yy146; + if (yych == '<') goto yy147; goto yy68; } } else { if (yych <= 'z') { - if (yych <= '[') goto yy147; + if (yych <= '[') goto yy148; goto yy68; } else { - if (yych <= '{') goto yy148; - if (yych <= '|') goto yy149; + if (yych <= '{') goto yy149; + if (yych <= '|') goto yy150; goto yy68; } } @@ -778,16 +785,16 @@ token rbsparser_next_token(lexstate *state) { yy77: rbs_skip(state); yy78: -#line 109 "ext/rbs_extension/lexer.re" +#line 110 "ext/rbs_extension/lexer.re" { return next_token(state, tSQSTRING); } -#line 784 "ext/rbs_extension/lexer.c" +#line 791 "ext/rbs_extension/lexer.c" yy79: rbs_skip(state); yych = peek(state); if (yych <= '\'') { if (yych <= 0x00000000) goto yy68; if (yych <= '&') goto yy75; - goto yy150; + goto yy151; } else { if (yych == '\\') goto yy79; goto yy75; @@ -796,484 +803,491 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); #line 36 "ext/rbs_extension/lexer.re" { return next_token(state, pSTAR2); } -#line 800 "ext/rbs_extension/lexer.c" +#line 807 "ext/rbs_extension/lexer.c" yy81: rbs_skip(state); + yych = peek(state); + if (yych >= 0x00000001) goto yy81; +#line 49 "ext/rbs_extension/lexer.re" + { return next_token(state, tINLINECOMMENT); } +#line 814 "ext/rbs_extension/lexer.c" +yy82: + rbs_skip(state); #line 41 "ext/rbs_extension/lexer.re" { return next_token(state, pARROW); } -#line 805 "ext/rbs_extension/lexer.c" -yy82: +#line 819 "ext/rbs_extension/lexer.c" +yy83: rbs_skip(state); yych = peek(state); - if (yych == '.') goto yy151; + if (yych == '.') goto yy152; goto yy68; -yy83: +yy84: rbs_skip(state); yych = peek(state); - if (yych == '=') goto yy87; - if (yych == '~') goto yy87; -yy84: -#line 128 "ext/rbs_extension/lexer.re" - { return next_token(state, tSYMBOL); } -#line 819 "ext/rbs_extension/lexer.c" + if (yych == '=') goto yy88; + if (yych == '~') goto yy88; yy85: +#line 129 "ext/rbs_extension/lexer.re" + { return next_token(state, tSYMBOL); } +#line 833 "ext/rbs_extension/lexer.c" +yy86: rbs_skip(state); yych = peek(state); if (yych <= '"') { if (yych <= 0x00000000) goto yy68; - if (yych <= '!') goto yy85; - goto yy152; + if (yych <= '!') goto yy86; + goto yy153; } else { - if (yych == '\\') goto yy153; - goto yy85; + if (yych == '\\') goto yy154; + goto yy86; } -yy86: +yy87: rbs_skip(state); yych = peek(state); if (yych <= ')') { if (yych <= 0x0000001F) { if (yych <= '\n') { if (yych <= 0x00000000) goto yy68; - if (yych <= 0x00000008) goto yy154; + if (yych <= 0x00000008) goto yy155; goto yy68; } else { if (yych == '\r') goto yy68; - goto yy154; + goto yy155; } } else { if (yych <= '#') { if (yych <= ' ') goto yy68; - if (yych <= '"') goto yy156; - goto yy154; + if (yych <= '"') goto yy157; + goto yy155; } else { if (yych == '%') goto yy68; - if (yych <= '\'') goto yy156; + if (yych <= '\'') goto yy157; goto yy68; } } } else { if (yych <= 'Z') { if (yych <= '/') { - if (yych == '-') goto yy154; - goto yy156; + if (yych == '-') goto yy155; + goto yy157; } else { - if (yych <= '9') goto yy154; - if (yych <= '>') goto yy156; - goto yy154; + if (yych <= '9') goto yy155; + if (yych <= '>') goto yy157; + goto yy155; } } else { if (yych <= '^') { - if (yych == '\\') goto yy156; + if (yych == '\\') goto yy157; goto yy68; } else { - if (yych <= 'z') goto yy154; + if (yych <= 'z') goto yy155; if (yych <= '}') goto yy68; - if (yych <= '~') goto yy156; - goto yy154; + if (yych <= '~') goto yy157; + goto yy155; } } } -yy87: - rbs_skip(state); - goto yy84; yy88: + rbs_skip(state); + goto yy85; +yy89: rbs_skip(state); yych = peek(state); if (yych <= '\'') { if (yych <= 0x00000000) goto yy68; - if (yych <= '&') goto yy88; - goto yy157; + if (yych <= '&') goto yy89; + goto yy158; } else { - if (yych == '\\') goto yy159; - goto yy88; + if (yych == '\\') goto yy160; + goto yy89; } -yy89: - rbs_skip(state); - yych = peek(state); - if (yych == '*') goto yy87; - goto yy84; yy90: rbs_skip(state); yych = peek(state); - if (yych == '@') goto yy87; - goto yy84; + if (yych == '*') goto yy88; + goto yy85; yy91: rbs_skip(state); -#line 45 "ext/rbs_extension/lexer.re" - { return next_token(state, pCOLON2); } -#line 905 "ext/rbs_extension/lexer.c" + yych = peek(state); + if (yych == '@') goto yy88; + goto yy85; yy92: rbs_skip(state); - yych = peek(state); - if (yych <= ';') goto yy84; - if (yych <= '<') goto yy87; - if (yych <= '=') goto yy160; - goto yy84; +#line 45 "ext/rbs_extension/lexer.re" + { return next_token(state, pCOLON2); } +#line 919 "ext/rbs_extension/lexer.c" yy93: rbs_skip(state); yych = peek(state); - if (yych == '=') goto yy161; - if (yych == '~') goto yy87; - goto yy68; + if (yych <= ';') goto yy85; + if (yych <= '<') goto yy88; + if (yych <= '=') goto yy161; + goto yy85; yy94: rbs_skip(state); yych = peek(state); - if (yych <= '<') goto yy84; - if (yych <= '>') goto yy87; - goto yy84; + if (yych == '=') goto yy162; + if (yych == '~') goto yy88; + goto yy68; yy95: + rbs_skip(state); + yych = peek(state); + if (yych <= '<') goto yy85; + if (yych <= '>') goto yy88; + goto yy85; +yy96: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '?') goto yy68; - if (yych <= '@') goto yy162; - if (yych <= 'Z') goto yy163; + if (yych <= '@') goto yy163; + if (yych <= 'Z') goto yy164; goto yy68; } else { if (yych == '`') goto yy68; - if (yych <= 'z') goto yy163; + if (yych <= 'z') goto yy164; goto yy68; } -yy96: +yy97: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy165; + if (yych == '!') goto yy166; } else { - if (yych <= '9') goto yy96; - if (yych == '=') goto yy165; + if (yych <= '9') goto yy97; + if (yych == '=') goto yy166; } } else { if (yych <= '^') { - if (yych <= '?') goto yy165; - if (yych <= '@') goto yy97; - if (yych <= 'Z') goto yy96; + if (yych <= '?') goto yy166; + if (yych <= '@') goto yy98; + if (yych <= 'Z') goto yy97; } else { - if (yych == '`') goto yy97; - if (yych <= 'z') goto yy96; + if (yych == '`') goto yy98; + if (yych <= 'z') goto yy97; } } -yy97: -#line 124 "ext/rbs_extension/lexer.re" - { return next_token(state, tSYMBOL); } -#line 961 "ext/rbs_extension/lexer.c" yy98: +#line 125 "ext/rbs_extension/lexer.re" + { return next_token(state, tSYMBOL); } +#line 975 "ext/rbs_extension/lexer.c" +yy99: rbs_skip(state); yych = peek(state); - if (yych == ']') goto yy161; + if (yych == ']') goto yy162; goto yy68; -yy99: +yy100: rbs_skip(state); yych = peek(state); if (yych == '>') goto yy24; goto yy8; -yy100: +yy101: rbs_skip(state); yych = peek(state); if (yych == '=') goto yy24; goto yy8; -yy101: +yy102: rbs_skip(state); #line 42 "ext/rbs_extension/lexer.re" { return next_token(state, pFATARROW); } -#line 981 "ext/rbs_extension/lexer.c" -yy102: +#line 995 "ext/rbs_extension/lexer.c" +yy103: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '@') goto yy68; - if (yych <= 'Z') goto yy166; + if (yych <= 'Z') goto yy167; goto yy68; } else { if (yych == '`') goto yy68; - if (yych <= 'z') goto yy166; + if (yych <= 'z') goto yy167; goto yy68; } -yy103: +yy104: rbs_skip(state); yych = peek(state); -yy104: +yy105: if (yych <= 'Z') { - if (yych <= '/') goto yy105; - if (yych <= '9') goto yy103; - if (yych >= 'A') goto yy103; + if (yych <= '/') goto yy106; + if (yych <= '9') goto yy104; + if (yych >= 'A') goto yy104; } else { if (yych <= '_') { - if (yych >= '_') goto yy103; + if (yych >= '_') goto yy104; } else { - if (yych <= '`') goto yy105; - if (yych <= 'z') goto yy103; + if (yych <= '`') goto yy106; + if (yych <= 'z') goto yy104; } } -yy105: -#line 138 "ext/rbs_extension/lexer.re" - { return next_token(state, tAIDENT); } -#line 1013 "ext/rbs_extension/lexer.c" yy106: - rbs_skip(state); - yych = peek(state); - if (yych == 'b') goto yy168; - goto yy104; +#line 139 "ext/rbs_extension/lexer.re" + { return next_token(state, tAIDENT); } +#line 1027 "ext/rbs_extension/lexer.c" yy107: rbs_skip(state); -#line 135 "ext/rbs_extension/lexer.re" - { return next_token(state, tBANGIDENT); } -#line 1023 "ext/rbs_extension/lexer.c" + yych = peek(state); + if (yych == 'b') goto yy169; + goto yy105; yy108: rbs_skip(state); #line 136 "ext/rbs_extension/lexer.re" - { return next_token(state, tEQIDENT); } -#line 1028 "ext/rbs_extension/lexer.c" + { return next_token(state, tBANGIDENT); } +#line 1037 "ext/rbs_extension/lexer.c" yy109: rbs_skip(state); +#line 137 "ext/rbs_extension/lexer.re" + { return next_token(state, tEQIDENT); } +#line 1042 "ext/rbs_extension/lexer.c" +yy110: + rbs_skip(state); yych = peek(state); if (yych == '=') goto yy24; #line 47 "ext/rbs_extension/lexer.re" { return next_token(state, pAREF_OPR); } -#line 1035 "ext/rbs_extension/lexer.c" -yy110: +#line 1049 "ext/rbs_extension/lexer.c" +yy111: rbs_skip(state); yych = peek(state); -yy111: +yy112: if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { - if (yych <= '9') goto yy110; - if (yych >= '=') goto yy108; + if (yych <= '9') goto yy111; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy112; - if (yych <= 'Z') goto yy110; + if (yych <= '@') goto yy113; + if (yych <= 'Z') goto yy111; } else { - if (yych == '`') goto yy112; - if (yych <= 'z') goto yy110; + if (yych == '`') goto yy113; + if (yych <= 'z') goto yy111; } } -yy112: -#line 132 "ext/rbs_extension/lexer.re" - { return next_token(state, tULLIDENT); } -#line 1059 "ext/rbs_extension/lexer.c" yy113: +#line 133 "ext/rbs_extension/lexer.re" + { return next_token(state, tULLIDENT); } +#line 1073 "ext/rbs_extension/lexer.c" +yy114: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { - if (yych <= '9') goto yy113; - if (yych >= '=') goto yy108; + if (yych <= '9') goto yy114; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy114; - if (yych <= 'Z') goto yy113; + if (yych <= '@') goto yy115; + if (yych <= 'Z') goto yy114; } else { - if (yych == '`') goto yy114; - if (yych <= 'z') goto yy113; + if (yych == '`') goto yy115; + if (yych <= 'z') goto yy114; } } -yy114: -#line 133 "ext/rbs_extension/lexer.re" - { return next_token(state, tULIDENT); } -#line 1082 "ext/rbs_extension/lexer.c" yy115: +#line 134 "ext/rbs_extension/lexer.re" + { return next_token(state, tULIDENT); } +#line 1096 "ext/rbs_extension/lexer.c" +yy116: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy169; - goto yy111; -yy116: + if (yych == 't') goto yy170; + goto yy112; +yy117: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '`') goto yy170; - goto yy116; -yy117: + if (yych == '`') goto yy171; + goto yy117; +yy118: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy171; + if (yych == 'i') goto yy172; goto yy53; -yy118: +yy119: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy119; + if (yych <= '@') goto yy120; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy119; + if (yych == '`') goto yy120; if (yych <= 'z') goto yy52; } } -yy119: -#line 96 "ext/rbs_extension/lexer.re" - { return next_token(state, kAS); } -#line 1121 "ext/rbs_extension/lexer.c" yy120: - rbs_skip(state); - yych = peek(state); - if (yych == 't') goto yy172; - goto yy53; +#line 97 "ext/rbs_extension/lexer.re" + { return next_token(state, kAS); } +#line 1135 "ext/rbs_extension/lexer.c" yy121: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy173; - if (yych == 't') goto yy174; + if (yych == 't') goto yy173; goto yy53; yy122: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy176; + if (yych == 'o') goto yy174; + if (yych == 't') goto yy175; goto yy53; yy123: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy177; + if (yych == 'a') goto yy177; goto yy53; yy124: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy179; + if (yych == 'f') goto yy178; goto yy53; yy125: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy181; + if (yych == 'd') goto yy180; goto yy53; yy126: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy182; + if (yych == 't') goto yy182; goto yy53; yy127: + rbs_skip(state); + yych = peek(state); + if (yych == 'l') goto yy183; + goto yy53; +yy128: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '9') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; if (yych >= '0') goto yy52; } else { if (yych <= '=') { - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } else { - if (yych <= '@') goto yy128; + if (yych <= '@') goto yy129; if (yych <= 'Z') goto yy52; } } } else { if (yych <= 'c') { - if (yych == '`') goto yy128; + if (yych == '`') goto yy129; if (yych <= 'b') goto yy52; - goto yy183; + goto yy184; } else { if (yych <= 's') { if (yych <= 'r') goto yy52; - goto yy184; + goto yy185; } else { - if (yych <= 't') goto yy185; + if (yych <= 't') goto yy186; if (yych <= 'z') goto yy52; } } } -yy128: -#line 77 "ext/rbs_extension/lexer.re" - { return next_token(state, kIN); } -#line 1191 "ext/rbs_extension/lexer.c" yy129: - rbs_skip(state); - yych = peek(state); - if (yych == 'd') goto yy186; - goto yy53; +#line 78 "ext/rbs_extension/lexer.re" + { return next_token(state, kIN); } +#line 1205 "ext/rbs_extension/lexer.c" yy130: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy187; + if (yych == 'd') goto yy187; goto yy53; yy131: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy189; + if (yych == 'l') goto yy188; goto yy53; yy132: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy191; - if (yych == 'i') goto yy192; + if (yych == 't') goto yy190; goto yy53; yy133: rbs_skip(state); yych = peek(state); - if (yych == 'b') goto yy193; + if (yych == 'e') goto yy192; + if (yych == 'i') goto yy193; goto yy53; yy134: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy194; + if (yych == 'b') goto yy194; goto yy53; yy135: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy195; + if (yych == 'l') goto yy195; goto yy53; yy136: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy196; + if (yych == 'n') goto yy196; goto yy53; yy137: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy197; + if (yych == 'i') goto yy197; goto yy53; yy138: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy199; + if (yych == 'p') goto yy198; goto yy53; yy139: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy200; + if (yych == 'u') goto yy200; goto yy53; yy140: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy201; - if (yych == 't') goto yy202; + if (yych == 'p') goto yy201; goto yy53; yy141: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy203; + if (yych == 'c') goto yy202; + if (yych == 't') goto yy203; goto yy53; yy142: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy205; + if (yych == 'e') goto yy204; goto yy53; yy143: + rbs_skip(state); + yych = peek(state); + if (yych == 'i') goto yy206; + goto yy53; +yy144: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy206; + if (yych <= '9') goto yy207; goto yy68; } else { - if (yych <= 'F') goto yy206; + if (yych <= 'F') goto yy207; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy206; + if (yych <= 'f') goto yy207; goto yy68; } -yy144: +yy145: rbs_skip(state); yych = peek(state); if (yych <= '/') goto yy68; @@ -1281,37 +1295,37 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '`') goto yy68; if (yych <= 'f') goto yy66; goto yy68; -yy145: - rbs_skip(state); - yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == ')') goto yy207; - goto yy145; yy146: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '>') goto yy208; + if (yych == ')') goto yy208; goto yy146; yy147: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == ']') goto yy209; + if (yych == '>') goto yy209; goto yy147; yy148: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '}') goto yy210; + if (yych == ']') goto yy210; goto yy148; yy149: rbs_skip(state); yych = peek(state); if (yych <= 0x00000000) goto yy68; - if (yych == '|') goto yy211; + if (yych == '}') goto yy211; goto yy149; yy150: + rbs_skip(state); + yych = peek(state); + if (yych <= 0x00000000) goto yy68; + if (yych == '|') goto yy212; + goto yy150; +yy151: yyaccept = 5; rbs_skip(state); backup = *state; @@ -1324,930 +1338,930 @@ token rbsparser_next_token(lexstate *state) { if (yych == '\\') goto yy79; goto yy75; } -yy151: +yy152: rbs_skip(state); #line 38 "ext/rbs_extension/lexer.re" { return next_token(state, pDOT3); } -#line 1332 "ext/rbs_extension/lexer.c" -yy152: +#line 1346 "ext/rbs_extension/lexer.c" +yy153: rbs_skip(state); -#line 110 "ext/rbs_extension/lexer.re" +#line 111 "ext/rbs_extension/lexer.re" { return next_token(state, tDQSYMBOL); } -#line 1337 "ext/rbs_extension/lexer.c" -yy153: +#line 1351 "ext/rbs_extension/lexer.c" +yy154: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy212; - if (yych == 'x') goto yy213; - goto yy85; -yy154: + if (yych == 'u') goto yy213; + if (yych == 'x') goto yy214; + goto yy86; +yy155: rbs_skip(state); yych = peek(state); if (yych <= ',') { if (yych <= '\f') { - if (yych <= 0x00000000) goto yy155; - if (yych <= 0x00000008) goto yy154; - if (yych >= '\v') goto yy154; + if (yych <= 0x00000000) goto yy156; + if (yych <= 0x00000008) goto yy155; + if (yych >= '\v') goto yy155; } else { if (yych <= 0x0000001F) { - if (yych >= 0x0000000E) goto yy154; + if (yych >= 0x0000000E) goto yy155; } else { - if (yych == '#') goto yy154; + if (yych == '#') goto yy155; } } } else { if (yych <= '>') { - if (yych <= '-') goto yy154; - if (yych <= '/') goto yy155; - if (yych <= '9') goto yy154; + if (yych <= '-') goto yy155; + if (yych <= '/') goto yy156; + if (yych <= '9') goto yy155; } else { if (yych <= '^') { - if (yych <= 'Z') goto yy154; + if (yych <= 'Z') goto yy155; } else { - if (yych <= 'z') goto yy154; - if (yych >= 0x0000007F) goto yy154; + if (yych <= 'z') goto yy155; + if (yych >= 0x0000007F) goto yy155; } } } -yy155: -#line 127 "ext/rbs_extension/lexer.re" - { return next_token(state, tSYMBOL); } -#line 1376 "ext/rbs_extension/lexer.c" yy156: - rbs_skip(state); - goto yy155; +#line 128 "ext/rbs_extension/lexer.re" + { return next_token(state, tSYMBOL); } +#line 1390 "ext/rbs_extension/lexer.c" yy157: rbs_skip(state); + goto yy156; yy158: -#line 111 "ext/rbs_extension/lexer.re" - { return next_token(state, tSQSYMBOL); } -#line 1385 "ext/rbs_extension/lexer.c" + rbs_skip(state); yy159: +#line 112 "ext/rbs_extension/lexer.re" + { return next_token(state, tSQSYMBOL); } +#line 1399 "ext/rbs_extension/lexer.c" +yy160: rbs_skip(state); yych = peek(state); if (yych <= '\'') { if (yych <= 0x00000000) goto yy68; - if (yych <= '&') goto yy88; - goto yy214; + if (yych <= '&') goto yy89; + goto yy215; } else { - if (yych == '\\') goto yy159; - goto yy88; + if (yych == '\\') goto yy160; + goto yy89; } -yy160: - rbs_skip(state); - yych = peek(state); - if (yych == '>') goto yy87; - goto yy84; yy161: rbs_skip(state); yych = peek(state); - if (yych == '=') goto yy87; - goto yy84; + if (yych == '>') goto yy88; + goto yy85; yy162: + rbs_skip(state); + yych = peek(state); + if (yych == '=') goto yy88; + goto yy85; +yy163: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '@') goto yy68; - if (yych <= 'Z') goto yy215; + if (yych <= 'Z') goto yy216; goto yy68; } else { if (yych == '`') goto yy68; - if (yych <= 'z') goto yy215; + if (yych <= 'z') goto yy216; goto yy68; } -yy163: +yy164: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy217; + if (yych == '!') goto yy218; } else { - if (yych <= '9') goto yy163; - if (yych == '=') goto yy217; + if (yych <= '9') goto yy164; + if (yych == '=') goto yy218; } } else { if (yych <= '^') { - if (yych <= '?') goto yy217; - if (yych <= '@') goto yy164; - if (yych <= 'Z') goto yy163; + if (yych <= '?') goto yy218; + if (yych <= '@') goto yy165; + if (yych <= 'Z') goto yy164; } else { - if (yych == '`') goto yy164; - if (yych <= 'z') goto yy163; + if (yych == '`') goto yy165; + if (yych <= 'z') goto yy164; } } -yy164: -#line 125 "ext/rbs_extension/lexer.re" - { return next_token(state, tSYMBOL); } -#line 1442 "ext/rbs_extension/lexer.c" yy165: - rbs_skip(state); - goto yy97; +#line 126 "ext/rbs_extension/lexer.re" + { return next_token(state, tSYMBOL); } +#line 1456 "ext/rbs_extension/lexer.c" yy166: + rbs_skip(state); + goto yy98; +yy167: rbs_skip(state); yych = peek(state); if (yych <= 'Z') { - if (yych <= '/') goto yy167; - if (yych <= '9') goto yy166; - if (yych >= 'A') goto yy166; + if (yych <= '/') goto yy168; + if (yych <= '9') goto yy167; + if (yych >= 'A') goto yy167; } else { if (yych <= '_') { - if (yych >= '_') goto yy166; + if (yych >= '_') goto yy167; } else { - if (yych <= '`') goto yy167; - if (yych <= 'z') goto yy166; + if (yych <= '`') goto yy168; + if (yych <= 'z') goto yy167; } } -yy167: -#line 139 "ext/rbs_extension/lexer.re" - { return next_token(state, tA2IDENT); } -#line 1464 "ext/rbs_extension/lexer.c" yy168: - rbs_skip(state); - yych = peek(state); - if (yych == 's') goto yy218; - goto yy104; +#line 140 "ext/rbs_extension/lexer.re" + { return next_token(state, tA2IDENT); } +#line 1478 "ext/rbs_extension/lexer.c" yy169: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy220; - goto yy111; + if (yych == 's') goto yy219; + goto yy105; yy170: rbs_skip(state); -#line 40 "ext/rbs_extension/lexer.re" - { return next_token(state, tQIDENT); } -#line 1479 "ext/rbs_extension/lexer.c" + yych = peek(state); + if (yych == 'o') goto yy221; + goto yy112; yy171: rbs_skip(state); - yych = peek(state); - if (yych == 'a') goto yy221; - goto yy53; +#line 40 "ext/rbs_extension/lexer.re" + { return next_token(state, tQIDENT); } +#line 1493 "ext/rbs_extension/lexer.c" yy172: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy222; + if (yych == 'a') goto yy222; goto yy53; yy173: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy223; + if (yych == 'r') goto yy223; goto yy53; yy174: + rbs_skip(state); + yych = peek(state); + if (yych == 'l') goto yy224; + goto yy53; +yy175: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy175; + if (yych <= '@') goto yy176; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy175; + if (yych == '`') goto yy176; if (yych <= 'z') goto yy52; } } -yy175: -#line 71 "ext/rbs_extension/lexer.re" - { return next_token(state, kBOT); } -#line 1517 "ext/rbs_extension/lexer.c" yy176: +#line 72 "ext/rbs_extension/lexer.re" + { return next_token(state, kBOT); } +#line 1531 "ext/rbs_extension/lexer.c" +yy177: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy225; + if (yych == 's') goto yy226; goto yy53; -yy177: +yy178: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy178; + if (yych <= '@') goto yy179; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy178; + if (yych == '`') goto yy179; if (yych <= 'z') goto yy52; } } -yy178: -#line 73 "ext/rbs_extension/lexer.re" - { return next_token(state, kDEF); } -#line 1545 "ext/rbs_extension/lexer.c" yy179: +#line 74 "ext/rbs_extension/lexer.re" + { return next_token(state, kDEF); } +#line 1559 "ext/rbs_extension/lexer.c" +yy180: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy180; + if (yych <= '@') goto yy181; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy180; + if (yych == '`') goto yy181; if (yych <= 'z') goto yy52; } } -yy180: -#line 74 "ext/rbs_extension/lexer.re" - { return next_token(state, kEND); } -#line 1568 "ext/rbs_extension/lexer.c" yy181: - rbs_skip(state); - yych = peek(state); - if (yych == 'e') goto yy226; - goto yy53; +#line 75 "ext/rbs_extension/lexer.re" + { return next_token(state, kEND); } +#line 1582 "ext/rbs_extension/lexer.c" yy182: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy227; + if (yych == 'e') goto yy227; goto yy53; yy183: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy228; + if (yych == 's') goto yy228; goto yy53; yy184: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy229; + if (yych == 'l') goto yy229; goto yy53; yy185: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy230; + if (yych == 't') goto yy230; goto yy53; yy186: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy231; + if (yych == 'e') goto yy231; goto yy53; yy187: + rbs_skip(state); + yych = peek(state); + if (yych == 'u') goto yy232; + goto yy53; +yy188: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy188; + if (yych <= '@') goto yy189; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy188; + if (yych == '`') goto yy189; if (yych <= 'z') goto yy52; } } -yy188: -#line 82 "ext/rbs_extension/lexer.re" - { return next_token(state, kNIL); } -#line 1621 "ext/rbs_extension/lexer.c" yy189: +#line 83 "ext/rbs_extension/lexer.re" + { return next_token(state, kNIL); } +#line 1635 "ext/rbs_extension/lexer.c" +yy190: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy190; + if (yych <= '@') goto yy191; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy190; + if (yych == '`') goto yy191; if (yych <= 'z') goto yy52; } } -yy190: -#line 83 "ext/rbs_extension/lexer.re" - { return next_token(state, kOUT); } -#line 1644 "ext/rbs_extension/lexer.c" yy191: - rbs_skip(state); - yych = peek(state); - if (yych == 'p') goto yy232; - goto yy53; +#line 84 "ext/rbs_extension/lexer.re" + { return next_token(state, kOUT); } +#line 1658 "ext/rbs_extension/lexer.c" yy192: rbs_skip(state); yych = peek(state); - if (yych == 'v') goto yy233; + if (yych == 'p') goto yy233; goto yy53; yy193: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy234; + if (yych == 'v') goto yy234; goto yy53; yy194: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy235; + if (yych == 'l') goto yy235; goto yy53; yy195: rbs_skip(state); yych = peek(state); - if (yych == 'g') goto yy237; + if (yych == 'f') goto yy236; goto yy53; yy196: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy238; + if (yych == 'g') goto yy238; goto yy53; yy197: + rbs_skip(state); + yych = peek(state); + if (yych == 'p') goto yy239; + goto yy53; +yy198: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy198; + if (yych <= '@') goto yy199; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy198; + if (yych == '`') goto yy199; if (yych <= 'z') goto yy52; } } -yy198: -#line 89 "ext/rbs_extension/lexer.re" - { return next_token(state, kTOP); } -#line 1697 "ext/rbs_extension/lexer.c" yy199: - rbs_skip(state); - yych = peek(state); - if (yych == 'e') goto yy240; - goto yy53; +#line 90 "ext/rbs_extension/lexer.re" + { return next_token(state, kTOP); } +#line 1711 "ext/rbs_extension/lexer.c" yy200: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy242; + if (yych == 'e') goto yy241; goto yy53; yy201: rbs_skip(state); yych = peek(state); - if (yych == 'h') goto yy244; + if (yych == 'e') goto yy243; goto yy53; yy202: rbs_skip(state); yych = peek(state); - if (yych == 'y') goto yy245; + if (yych == 'h') goto yy245; goto yy53; yy203: + rbs_skip(state); + yych = peek(state); + if (yych == 'y') goto yy246; + goto yy53; +yy204: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy204; + if (yych <= '@') goto yy205; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy204; + if (yych == '`') goto yy205; if (yych <= 'z') goto yy52; } } -yy204: -#line 95 "ext/rbs_extension/lexer.re" - { return next_token(state, kUSE); } -#line 1740 "ext/rbs_extension/lexer.c" yy205: +#line 96 "ext/rbs_extension/lexer.re" + { return next_token(state, kUSE); } +#line 1754 "ext/rbs_extension/lexer.c" +yy206: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy246; + if (yych == 'd') goto yy247; goto yy53; -yy206: +yy207: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy248; + if (yych <= '9') goto yy249; goto yy68; } else { - if (yych <= 'F') goto yy248; + if (yych <= 'F') goto yy249; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy248; + if (yych <= 'f') goto yy249; goto yy68; } -yy207: - rbs_skip(state); -#line 54 "ext/rbs_extension/lexer.re" - { return next_token(state, tANNOTATION); } -#line 1763 "ext/rbs_extension/lexer.c" yy208: rbs_skip(state); -#line 57 "ext/rbs_extension/lexer.re" +#line 55 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1768 "ext/rbs_extension/lexer.c" +#line 1777 "ext/rbs_extension/lexer.c" yy209: rbs_skip(state); -#line 55 "ext/rbs_extension/lexer.re" +#line 58 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1773 "ext/rbs_extension/lexer.c" +#line 1782 "ext/rbs_extension/lexer.c" yy210: rbs_skip(state); -#line 53 "ext/rbs_extension/lexer.re" +#line 56 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1778 "ext/rbs_extension/lexer.c" +#line 1787 "ext/rbs_extension/lexer.c" yy211: rbs_skip(state); -#line 56 "ext/rbs_extension/lexer.re" +#line 54 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1783 "ext/rbs_extension/lexer.c" +#line 1792 "ext/rbs_extension/lexer.c" yy212: rbs_skip(state); +#line 57 "ext/rbs_extension/lexer.re" + { return next_token(state, tANNOTATION); } +#line 1797 "ext/rbs_extension/lexer.c" +yy213: + rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy249; + if (yych <= '9') goto yy250; goto yy68; } else { - if (yych <= 'F') goto yy249; + if (yych <= 'F') goto yy250; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy249; + if (yych <= 'f') goto yy250; goto yy68; } -yy213: +yy214: rbs_skip(state); yych = peek(state); if (yych <= '/') goto yy68; - if (yych <= '9') goto yy85; + if (yych <= '9') goto yy86; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy85; + if (yych <= 'f') goto yy86; goto yy68; -yy214: +yy215: yyaccept = 6; rbs_skip(state); backup = *state; yych = peek(state); if (yych <= '\'') { - if (yych <= 0x00000000) goto yy158; - if (yych <= '&') goto yy88; - goto yy157; + if (yych <= 0x00000000) goto yy159; + if (yych <= '&') goto yy89; + goto yy158; } else { - if (yych == '\\') goto yy159; - goto yy88; + if (yych == '\\') goto yy160; + goto yy89; } -yy215: +yy216: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy250; + if (yych == '!') goto yy251; } else { - if (yych <= '9') goto yy215; - if (yych == '=') goto yy250; + if (yych <= '9') goto yy216; + if (yych == '=') goto yy251; } } else { if (yych <= '^') { - if (yych <= '?') goto yy250; - if (yych <= '@') goto yy216; - if (yych <= 'Z') goto yy215; + if (yych <= '?') goto yy251; + if (yych <= '@') goto yy217; + if (yych <= 'Z') goto yy216; } else { - if (yych == '`') goto yy216; - if (yych <= 'z') goto yy215; + if (yych == '`') goto yy217; + if (yych <= 'z') goto yy216; } } -yy216: -#line 126 "ext/rbs_extension/lexer.re" - { return next_token(state, tSYMBOL); } -#line 1841 "ext/rbs_extension/lexer.c" yy217: - rbs_skip(state); - goto yy164; +#line 127 "ext/rbs_extension/lexer.re" + { return next_token(state, tSYMBOL); } +#line 1855 "ext/rbs_extension/lexer.c" yy218: + rbs_skip(state); + goto yy165; +yy219: rbs_skip(state); yych = peek(state); if (yych <= 'Z') { - if (yych <= '/') goto yy219; - if (yych <= '9') goto yy103; - if (yych >= 'A') goto yy103; + if (yych <= '/') goto yy220; + if (yych <= '9') goto yy104; + if (yych >= 'A') goto yy104; } else { if (yych <= '_') { - if (yych >= '_') goto yy103; + if (yych >= '_') goto yy104; } else { - if (yych <= '`') goto yy219; - if (yych <= 'z') goto yy103; + if (yych <= '`') goto yy220; + if (yych <= 'z') goto yy104; } } -yy219: -#line 98 "ext/rbs_extension/lexer.re" - { return next_token(state, kATRBS); } -#line 1863 "ext/rbs_extension/lexer.c" yy220: - rbs_skip(state); - yych = peek(state); - if (yych == 'd') goto yy251; - goto yy111; +#line 99 "ext/rbs_extension/lexer.re" + { return next_token(state, kATRBS); } +#line 1877 "ext/rbs_extension/lexer.c" yy221: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy252; - goto yy53; + if (yych == 'd') goto yy252; + goto yy112; yy222: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy254; + if (yych == 's') goto yy253; goto yy53; yy223: + rbs_skip(state); + yych = peek(state); + if (yych == '_') goto yy255; + goto yy53; +yy224: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy224; + if (yych <= '@') goto yy225; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy224; + if (yych == '`') goto yy225; if (yych <= 'z') goto yy52; } } -yy224: -#line 70 "ext/rbs_extension/lexer.re" - { return next_token(state, kBOOL); } -#line 1901 "ext/rbs_extension/lexer.c" yy225: - rbs_skip(state); - yych = peek(state); - if (yych == 's') goto yy255; - goto yy53; +#line 71 "ext/rbs_extension/lexer.re" + { return next_token(state, kBOOL); } +#line 1915 "ext/rbs_extension/lexer.c" yy226: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy257; + if (yych == 's') goto yy256; goto yy53; yy227: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy258; + if (yych == 'n') goto yy258; goto yy53; yy228: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy260; + if (yych == 'e') goto yy259; goto yy53; yy229: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy261; + if (yych == 'u') goto yy261; goto yy53; yy230: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy262; + if (yych == 'a') goto yy262; goto yy53; yy231: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy263; + if (yych == 'r') goto yy263; goto yy53; yy232: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy264; + if (yych == 'l') goto yy264; goto yy53; yy233: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy265; + if (yych == 'e') goto yy265; goto yy53; yy234: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy266; + if (yych == 'a') goto yy266; goto yy53; yy235: + rbs_skip(state); + yych = peek(state); + if (yych == 'i') goto yy267; + goto yy53; +yy236: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy236; + if (yych <= '@') goto yy237; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy236; + if (yych == '`') goto yy237; if (yych <= 'z') goto yy52; } } -yy236: -#line 87 "ext/rbs_extension/lexer.re" - { return next_token(state, kSELF); } -#line 1974 "ext/rbs_extension/lexer.c" yy237: +#line 88 "ext/rbs_extension/lexer.re" + { return next_token(state, kSELF); } +#line 1988 "ext/rbs_extension/lexer.c" +yy238: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy267; + if (yych == 'l') goto yy268; goto yy53; -yy238: +yy239: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy239; + if (yych <= '@') goto yy240; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy239; + if (yych == '`') goto yy240; if (yych <= 'z') goto yy52; } } -yy239: -#line 99 "ext/rbs_extension/lexer.re" - { return next_token(state, kSKIP); } -#line 2002 "ext/rbs_extension/lexer.c" yy240: +#line 100 "ext/rbs_extension/lexer.re" + { return next_token(state, kSKIP); } +#line 2016 "ext/rbs_extension/lexer.c" +yy241: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy241; + if (yych <= '@') goto yy242; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy241; + if (yych == '`') goto yy242; if (yych <= 'z') goto yy52; } } -yy241: -#line 90 "ext/rbs_extension/lexer.re" - { return next_token(state, kTRUE); } -#line 2025 "ext/rbs_extension/lexer.c" yy242: +#line 91 "ext/rbs_extension/lexer.re" + { return next_token(state, kTRUE); } +#line 2039 "ext/rbs_extension/lexer.c" +yy243: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy243; + if (yych <= '@') goto yy244; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy243; + if (yych == '`') goto yy244; if (yych <= 'z') goto yy52; } } -yy243: -#line 91 "ext/rbs_extension/lexer.re" - { return next_token(state, kTYPE); } -#line 2048 "ext/rbs_extension/lexer.c" yy244: +#line 92 "ext/rbs_extension/lexer.re" + { return next_token(state, kTYPE); } +#line 2062 "ext/rbs_extension/lexer.c" +yy245: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy268; + if (yych == 'e') goto yy269; goto yy53; -yy245: +yy246: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy269; + if (yych == 'p') goto yy270; goto yy53; -yy246: +yy247: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy247; + if (yych <= '@') goto yy248; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy247; + if (yych == '`') goto yy248; if (yych <= 'z') goto yy52; } } -yy247: -#line 94 "ext/rbs_extension/lexer.re" - { return next_token(state, kVOID); } -#line 2081 "ext/rbs_extension/lexer.c" yy248: +#line 95 "ext/rbs_extension/lexer.re" + { return next_token(state, kVOID); } +#line 2095 "ext/rbs_extension/lexer.c" +yy249: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy270; + if (yych <= '9') goto yy271; goto yy68; } else { - if (yych <= 'F') goto yy270; + if (yych <= 'F') goto yy271; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy270; + if (yych <= 'f') goto yy271; goto yy68; } -yy249: +yy250: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy271; + if (yych <= '9') goto yy272; goto yy68; } else { - if (yych <= 'F') goto yy271; + if (yych <= 'F') goto yy272; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy271; + if (yych <= 'f') goto yy272; goto yy68; } -yy250: - rbs_skip(state); - goto yy216; yy251: rbs_skip(state); - yych = peek(state); - if (yych == 'o') goto yy272; - goto yy111; + goto yy217; yy252: + rbs_skip(state); + yych = peek(state); + if (yych == 'o') goto yy273; + goto yy112; +yy253: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy253; + if (yych <= '@') goto yy254; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy253; + if (yych == '`') goto yy254; if (yych <= 'z') goto yy52; } } -yy253: -#line 66 "ext/rbs_extension/lexer.re" - { return next_token(state, kALIAS); } -#line 2138 "ext/rbs_extension/lexer.c" yy254: +#line 67 "ext/rbs_extension/lexer.re" + { return next_token(state, kALIAS); } +#line 2152 "ext/rbs_extension/lexer.c" +yy255: rbs_skip(state); yych = peek(state); if (yych <= 'q') { - if (yych == 'a') goto yy273; + if (yych == 'a') goto yy274; goto yy53; } else { - if (yych <= 'r') goto yy274; - if (yych == 'w') goto yy275; + if (yych <= 'r') goto yy275; + if (yych == 'w') goto yy276; goto yy53; } -yy255: +yy256: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy256; + if (yych <= '@') goto yy257; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy256; + if (yych == '`') goto yy257; if (yych <= 'z') goto yy52; } } -yy256: -#line 72 "ext/rbs_extension/lexer.re" - { return next_token(state, kCLASS); } -#line 2172 "ext/rbs_extension/lexer.c" yy257: +#line 73 "ext/rbs_extension/lexer.re" + { return next_token(state, kCLASS); } +#line 2186 "ext/rbs_extension/lexer.c" +yy258: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy276; + if (yych == 'd') goto yy277; goto yy53; -yy258: +yy259: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy259; + if (yych <= '@') goto yy260; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy259; + if (yych == '`') goto yy260; if (yych <= 'z') goto yy52; } } -yy259: -#line 76 "ext/rbs_extension/lexer.re" - { return next_token(state, kFALSE); } -#line 2200 "ext/rbs_extension/lexer.c" yy260: - rbs_skip(state); - yych = peek(state); - if (yych == 'd') goto yy278; - goto yy53; +#line 77 "ext/rbs_extension/lexer.re" + { return next_token(state, kFALSE); } +#line 2214 "ext/rbs_extension/lexer.c" yy261: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy279; + if (yych == 'd') goto yy279; goto yy53; yy262: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy280; + if (yych == 'n') goto yy280; goto yy53; yy263: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy281; + if (yych == 'f') goto yy281; goto yy53; yy264: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy283; + if (yych == 'e') goto yy282; goto yy53; yy265: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy284; + if (yych == 'n') goto yy284; goto yy53; yy266: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy285; + if (yych == 't') goto yy285; goto yy53; yy267: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy287; + if (yych == 'c') goto yy286; goto yy53; yy268: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy288; + if (yych == 'e') goto yy288; goto yy53; yy269: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy289; + if (yych == 'c') goto yy289; goto yy53; yy270: + rbs_skip(state); + yych = peek(state); + if (yych == 'e') goto yy290; + goto yy53; +yy271: rbs_skip(state); yych = peek(state); if (yych <= '@') { @@ -2260,378 +2274,373 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 'f') goto yy66; goto yy68; } -yy271: +yy272: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy290; + if (yych <= '9') goto yy291; goto yy68; } else { - if (yych <= 'F') goto yy290; + if (yych <= 'F') goto yy291; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy290; + if (yych <= 'f') goto yy291; goto yy68; } -yy272: - rbs_skip(state); - yych = peek(state); - if (yych == '_') goto yy291; - goto yy111; yy273: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy292; - goto yy53; + if (yych == '_') goto yy292; + goto yy112; yy274: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy293; + if (yych == 'c') goto yy293; goto yy53; yy275: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy294; + if (yych == 'e') goto yy294; goto yy53; yy276: + rbs_skip(state); + yych = peek(state); + if (yych == 'r') goto yy295; + goto yy53; +yy277: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy277; + if (yych <= '@') goto yy278; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy277; + if (yych == '`') goto yy278; if (yych <= 'z') goto yy52; } } -yy277: -#line 75 "ext/rbs_extension/lexer.re" - { return next_token(state, kEXTEND); } -#line 2319 "ext/rbs_extension/lexer.c" yy278: - rbs_skip(state); - yych = peek(state); - if (yych == 'e') goto yy295; - goto yy53; +#line 76 "ext/rbs_extension/lexer.re" + { return next_token(state, kEXTEND); } +#line 2333 "ext/rbs_extension/lexer.c" yy279: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy297; + if (yych == 'e') goto yy296; goto yy53; yy280: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy298; + if (yych == 'c') goto yy298; goto yy53; yy281: + rbs_skip(state); + yych = peek(state); + if (yych == 'a') goto yy299; + goto yy53; +yy282: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy282; + if (yych <= '@') goto yy283; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy282; + if (yych == '`') goto yy283; if (yych <= 'z') goto yy52; } } -yy282: -#line 81 "ext/rbs_extension/lexer.re" - { return next_token(state, kMODULE); } -#line 2357 "ext/rbs_extension/lexer.c" yy283: +#line 82 "ext/rbs_extension/lexer.re" + { return next_token(state, kMODULE); } +#line 2371 "ext/rbs_extension/lexer.c" +yy284: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy299; + if (yych == 'd') goto yy300; goto yy53; -yy284: +yy285: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy301; + if (yych == 'e') goto yy302; goto yy53; -yy285: +yy286: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy286; + if (yych <= '@') goto yy287; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy286; + if (yych == '`') goto yy287; if (yych <= 'z') goto yy52; } } -yy286: -#line 86 "ext/rbs_extension/lexer.re" - { return next_token(state, kPUBLIC); } -#line 2390 "ext/rbs_extension/lexer.c" yy287: - rbs_skip(state); - yych = peek(state); - if (yych == 't') goto yy303; - goto yy53; +#line 87 "ext/rbs_extension/lexer.re" + { return next_token(state, kPUBLIC); } +#line 2404 "ext/rbs_extension/lexer.c" yy288: rbs_skip(state); yych = peek(state); - if (yych == 'k') goto yy304; + if (yych == 't') goto yy304; goto yy53; yy289: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy305; + if (yych == 'k') goto yy305; goto yy53; yy290: + rbs_skip(state); + yych = peek(state); + if (yych == 'd') goto yy306; + goto yy53; +yy291: rbs_skip(state); yych = peek(state); if (yych <= '@') { if (yych <= '/') goto yy68; - if (yych <= '9') goto yy85; + if (yych <= '9') goto yy86; goto yy68; } else { - if (yych <= 'F') goto yy85; + if (yych <= 'F') goto yy86; if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy85; + if (yych <= 'f') goto yy86; goto yy68; } -yy291: - rbs_skip(state); - yych = peek(state); - if (yych == '_') goto yy307; - goto yy111; yy292: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy309; - goto yy53; + if (yych == '_') goto yy308; + goto yy112; yy293: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy310; + if (yych == 'c') goto yy310; goto yy53; yy294: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy311; + if (yych == 'a') goto yy311; goto yy53; yy295: + rbs_skip(state); + yych = peek(state); + if (yych == 'i') goto yy312; + goto yy53; +yy296: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy296; + if (yych <= '@') goto yy297; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy296; + if (yych == '`') goto yy297; if (yych <= 'z') goto yy52; } } -yy296: -#line 78 "ext/rbs_extension/lexer.re" - { return next_token(state, kINCLUDE); } -#line 2461 "ext/rbs_extension/lexer.c" yy297: +#line 79 "ext/rbs_extension/lexer.re" + { return next_token(state, kINCLUDE); } +#line 2475 "ext/rbs_extension/lexer.c" +yy298: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy312; + if (yych == 'e') goto yy313; goto yy53; -yy298: +yy299: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy314; + if (yych == 'c') goto yy315; goto yy53; -yy299: +yy300: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy300; + if (yych <= '@') goto yy301; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy300; + if (yych == '`') goto yy301; if (yych <= 'z') goto yy52; } } -yy300: -#line 84 "ext/rbs_extension/lexer.re" - { return next_token(state, kPREPEND); } -#line 2494 "ext/rbs_extension/lexer.c" yy301: +#line 85 "ext/rbs_extension/lexer.re" + { return next_token(state, kPREPEND); } +#line 2508 "ext/rbs_extension/lexer.c" +yy302: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy302; + if (yych <= '@') goto yy303; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy302; + if (yych == '`') goto yy303; if (yych <= 'z') goto yy52; } } -yy302: -#line 85 "ext/rbs_extension/lexer.re" - { return next_token(state, kPRIVATE); } -#line 2517 "ext/rbs_extension/lexer.c" yy303: +#line 86 "ext/rbs_extension/lexer.re" + { return next_token(state, kPRIVATE); } +#line 2531 "ext/rbs_extension/lexer.c" +yy304: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy315; + if (yych == 'o') goto yy316; goto yy53; -yy304: +yy305: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy316; + if (yych == 'e') goto yy317; goto yy53; -yy305: +yy306: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy306; + if (yych <= '@') goto yy307; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy306; + if (yych == '`') goto yy307; if (yych <= 'z') goto yy52; } } -yy306: -#line 93 "ext/rbs_extension/lexer.re" - { return next_token(state, kUNTYPED); } -#line 2550 "ext/rbs_extension/lexer.c" yy307: +#line 94 "ext/rbs_extension/lexer.re" + { return next_token(state, kUNTYPED); } +#line 2564 "ext/rbs_extension/lexer.c" +yy308: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { - if (yych <= '9') goto yy110; - if (yych >= '=') goto yy108; + if (yych <= '9') goto yy111; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy308; - if (yych <= 'Z') goto yy110; + if (yych <= '@') goto yy309; + if (yych <= 'Z') goto yy111; } else { - if (yych == '`') goto yy308; - if (yych <= 'z') goto yy110; + if (yych == '`') goto yy309; + if (yych <= 'z') goto yy111; } } -yy308: -#line 97 "ext/rbs_extension/lexer.re" - { return next_token(state, k__TODO__); } -#line 2573 "ext/rbs_extension/lexer.c" yy309: - rbs_skip(state); - yych = peek(state); - if (yych == 'e') goto yy317; - goto yy53; +#line 98 "ext/rbs_extension/lexer.re" + { return next_token(state, k__TODO__); } +#line 2587 "ext/rbs_extension/lexer.c" yy310: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy318; + if (yych == 'e') goto yy318; goto yy53; yy311: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy319; + if (yych == 'd') goto yy319; goto yy53; yy312: + rbs_skip(state); + yych = peek(state); + if (yych == 't') goto yy320; + goto yy53; +yy313: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy313; + if (yych <= '@') goto yy314; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy313; + if (yych == '`') goto yy314; if (yych <= 'z') goto yy52; } } -yy313: -#line 79 "ext/rbs_extension/lexer.re" - { return next_token(state, kINSTANCE); } -#line 2611 "ext/rbs_extension/lexer.c" yy314: - rbs_skip(state); - yych = peek(state); - if (yych == 'e') goto yy320; - goto yy53; +#line 80 "ext/rbs_extension/lexer.re" + { return next_token(state, kINSTANCE); } +#line 2625 "ext/rbs_extension/lexer.c" yy315: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy322; + if (yych == 'e') goto yy321; goto yy53; yy316: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy324; + if (yych == 'n') goto yy323; goto yy53; yy317: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy326; + if (yych == 'd') goto yy325; goto yy53; yy318: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy327; + if (yych == 's') goto yy327; goto yy53; yy319: rbs_skip(state); @@ -2639,141 +2648,146 @@ token rbsparser_next_token(lexstate *state) { if (yych == 'e') goto yy328; goto yy53; yy320: + rbs_skip(state); + yych = peek(state); + if (yych == 'e') goto yy329; + goto yy53; +yy321: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy321; + if (yych <= '@') goto yy322; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy321; + if (yych == '`') goto yy322; if (yych <= 'z') goto yy52; } } -yy321: -#line 80 "ext/rbs_extension/lexer.re" - { return next_token(state, kINTERFACE); } -#line 2664 "ext/rbs_extension/lexer.c" yy322: +#line 81 "ext/rbs_extension/lexer.re" + { return next_token(state, kINTERFACE); } +#line 2678 "ext/rbs_extension/lexer.c" +yy323: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy323; + if (yych <= '@') goto yy324; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy323; + if (yych == '`') goto yy324; if (yych <= 'z') goto yy52; } } -yy323: -#line 88 "ext/rbs_extension/lexer.re" - { return next_token(state, kSINGLETON); } -#line 2687 "ext/rbs_extension/lexer.c" yy324: +#line 89 "ext/rbs_extension/lexer.re" + { return next_token(state, kSINGLETON); } +#line 2701 "ext/rbs_extension/lexer.c" +yy325: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy325; + if (yych <= '@') goto yy326; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy325; + if (yych == '`') goto yy326; if (yych <= 'z') goto yy52; } } -yy325: -#line 92 "ext/rbs_extension/lexer.re" - { return next_token(state, kUNCHECKED); } -#line 2710 "ext/rbs_extension/lexer.c" yy326: - rbs_skip(state); - yych = peek(state); - if (yych == 's') goto yy329; - goto yy53; +#line 93 "ext/rbs_extension/lexer.re" + { return next_token(state, kUNCHECKED); } +#line 2724 "ext/rbs_extension/lexer.c" yy327: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy330; + if (yych == 's') goto yy330; goto yy53; yy328: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy332; + if (yych == 'r') goto yy331; goto yy53; yy329: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy334; + if (yych == 'r') goto yy333; goto yy53; yy330: + rbs_skip(state); + yych = peek(state); + if (yych == 'o') goto yy335; + goto yy53; +yy331: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy331; + if (yych <= '@') goto yy332; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy331; + if (yych == '`') goto yy332; if (yych <= 'z') goto yy52; } } -yy331: -#line 68 "ext/rbs_extension/lexer.re" - { return next_token(state, kATTRREADER); } -#line 2753 "ext/rbs_extension/lexer.c" yy332: +#line 69 "ext/rbs_extension/lexer.re" + { return next_token(state, kATTRREADER); } +#line 2767 "ext/rbs_extension/lexer.c" +yy333: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy333; + if (yych <= '@') goto yy334; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy333; + if (yych == '`') goto yy334; if (yych <= 'z') goto yy52; } } -yy333: -#line 69 "ext/rbs_extension/lexer.re" - { return next_token(state, kATTRWRITER); } -#line 2776 "ext/rbs_extension/lexer.c" yy334: +#line 70 "ext/rbs_extension/lexer.re" + { return next_token(state, kATTRWRITER); } +#line 2790 "ext/rbs_extension/lexer.c" +yy335: rbs_skip(state); yych = peek(state); if (yych != 'r') goto yy53; @@ -2781,25 +2795,25 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy107; + if (yych == '!') goto yy108; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy108; + if (yych >= '=') goto yy109; } } else { if (yych <= '^') { - if (yych <= '@') goto yy335; + if (yych <= '@') goto yy336; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy335; + if (yych == '`') goto yy336; if (yych <= 'z') goto yy52; } } -yy335: -#line 67 "ext/rbs_extension/lexer.re" +yy336: +#line 68 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRACCESSOR); } -#line 2802 "ext/rbs_extension/lexer.c" +#line 2816 "ext/rbs_extension/lexer.c" } -#line 148 "ext/rbs_extension/lexer.re" +#line 149 "ext/rbs_extension/lexer.re" } diff --git a/ext/rbs_extension/lexer.h b/ext/rbs_extension/lexer.h index f3ca3d2f5..6a0d71b8b 100644 --- a/ext/rbs_extension/lexer.h +++ b/ext/rbs_extension/lexer.h @@ -79,6 +79,7 @@ enum TokenType { tCOMMENT, /* Comment */ tLINECOMMENT, /* Comment of all line */ + tINLINECOMMENT, /* Comment in inline decl starting with -- */ tTRIVIA, /* Trivia tokens -- space and new line */ diff --git a/ext/rbs_extension/lexer.re b/ext/rbs_extension/lexer.re index 3ee463bd1..ef0e09503 100644 --- a/ext/rbs_extension/lexer.re +++ b/ext/rbs_extension/lexer.re @@ -46,6 +46,7 @@ token rbsparser_next_token(lexstate *state) { "<" { return next_token(state, pLT); } "[]" { return next_token(state, pAREF_OPR); } operator { return next_token(state, tOPERATOR); } + "--" [^\x00]* { return next_token(state, tINLINECOMMENT); } number = [0-9] [0-9_]*; ("-"|"+")? number { return next_token(state, tINTEGER); } diff --git a/ext/rbs_extension/lexstate.c b/ext/rbs_extension/lexstate.c index 2f56b1ca4..cb1cc7234 100644 --- a/ext/rbs_extension/lexstate.c +++ b/ext/rbs_extension/lexstate.c @@ -78,6 +78,7 @@ static const char *RBS_TOKENTYPE_NAMES[] = { "tCOMMENT", "tLINECOMMENT", + "tINLINECOMMENT", "tTRIVIA", diff --git a/ext/rbs_extension/parser.c b/ext/rbs_extension/parser.c index aa1d49939..9b2758a73 100644 --- a/ext/rbs_extension/parser.c +++ b/ext/rbs_extension/parser.c @@ -2922,6 +2922,19 @@ static void parse_inline_method_overloads(parserstate *state, VALUE *overloads, } } +static VALUE parse_inline_comment(parserstate *state) { + VALUE comment = Qnil; + + if (state->next_token.type == tINLINECOMMENT) { + range comment_range = state->next_token.range; + parser_advance(state); + + comment = rbs_new_location(state->buffer, comment_range); + } + + return comment; +} + static VALUE parse_inline_leading_annotation(parserstate *state) { switch (state->next_token.type) { case pCOLON: { @@ -2962,6 +2975,19 @@ static VALUE parse_inline_leading_annotation(parserstate *state) { bar_locations ); } + case kSKIP: { + parser_advance(state); + + range skip_loc = state->current_token.range; + VALUE comment_loc = parse_inline_comment(state); + + return rbs_ast_ruby_annotations_skip_annotation( + rbs_new_location(state->buffer, (range) { .start = rbs_range.start, .end = state->current_token.range.end }), + rbs_new_location(state->buffer, rbs_range), + rbs_new_location(state->buffer, skip_loc), + comment_loc + ); + } default: { raise_syntax_error( state, diff --git a/test/rbs/inline_annotation_parsing_test.rb b/test/rbs/inline_annotation_parsing_test.rb index 4a2444f63..336e152ca 100644 --- a/test/rbs/inline_annotation_parsing_test.rb +++ b/test/rbs/inline_annotation_parsing_test.rb @@ -79,4 +79,20 @@ def test_error__unknown_annotation Parser.parse_inline_leading_annotation("@rbs super String", 0...) end end + + def test_parse__skip + Parser.parse_inline_leading_annotation("@rbs skip", 0...).tap do |annot| + assert_instance_of AST::Ruby::Annotations::SkipAnnotation, annot + assert_equal "@rbs skip", annot.location.source + assert_equal "skip", annot.skip_location.source + assert_nil annot.comment_location + end + + Parser.parse_inline_leading_annotation("@rbs skip -- some comment here", 0...).tap do |annot| + assert_instance_of AST::Ruby::Annotations::SkipAnnotation, annot + assert_equal "@rbs skip -- some comment here", annot.location.source + assert_equal "skip", annot.skip_location.source + assert_equal "-- some comment here", annot.comment_location.source + end + end end From 76e1b469bf1ee5199372dfa33c50efb49fcb27f2 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Mon, 14 Apr 2025 17:54:10 +0900 Subject: [PATCH 23/48] Update parser to support `skip` annotation --- lib/rbs/inline_parser.rb | 17 +++++++++++++++++ sig/inline_parser.rbs | 6 ++++++ test/rbs/inline_parser_test.rb | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/lib/rbs/inline_parser.rb b/lib/rbs/inline_parser.rb index a7a746024..2e9863012 100644 --- a/lib/rbs/inline_parser.rb +++ b/lib/rbs/inline_parser.rb @@ -74,7 +74,20 @@ def push_module_nesting(mod) module_nesting.pop() end + def skip_node?(node) + if ref = comments.leading_block(node) + if ref.block.each_paragraph([]).any? { _1.is_a?(AST::Ruby::Annotations::SkipAnnotation) } + ref.associate! + return true + end + end + + false + end + def visit_class_node(node) + return if skip_node?(node) + unless class_name = constant_as_type_name(node.constant_path) diagnostics << Diagnostic::NonConstantClassName.new( rbs_location(node.constant_path.location), @@ -95,6 +108,8 @@ def visit_class_node(node) end def visit_module_node(node) + return if skip_node?(node) + unless module_name = constant_as_type_name(node.constant_path) diagnostics << Diagnostic::NonConstantModuleName.new( rbs_location(node.constant_path.location), @@ -115,6 +130,8 @@ def visit_module_node(node) end def visit_def_node(node) + return if skip_node?(node) + if node.receiver diagnostics << Diagnostic::NotImplementedYet.new( rbs_location(node.receiver.location), diff --git a/sig/inline_parser.rbs b/sig/inline_parser.rbs index 9783d41bd..bf2861434 100644 --- a/sig/inline_parser.rbs +++ b/sig/inline_parser.rbs @@ -71,6 +71,12 @@ module RBS def push_module_nesting: [T] (module_context) { () -> T } -> T + # Returns `true` if the node is a comment block including `@rbs skip` annotation + # + # Doesn't update the `association` flag if returning `false`. + # + def skip_node?: (Prism::Node) -> bool + def insert_declaration: (module_context) -> void def report_unused_annotation: (*AST::Ruby::Annotations::t | nil | AST::Ruby::CommentBlock::AnnotationSyntaxError) -> void diff --git a/test/rbs/inline_parser_test.rb b/test/rbs/inline_parser_test.rb index 444a8e017..32d4b4393 100644 --- a/test/rbs/inline_parser_test.rb +++ b/test/rbs/inline_parser_test.rb @@ -235,4 +235,36 @@ def foo(x = nil) end end end + + def test_parse__skip_class_module + result = parse(<<~RUBY) + # @rbs skip -- not a constant + class (c::)Foo + end + + # @rbs skip + module Bar + end + RUBY + + assert_empty result.diagnostics + + assert_empty result.declarations + end + + def test_parse__skip_def + result = parse(<<~RUBY) + class Foo + # @rbs skip + def foo + end + end + RUBY + + assert_empty result.diagnostics + + result.declarations[0].tap do |decl| + assert_empty decl.members + end + end end From 30af9cb2127e10aec3f7adf94bafcd809c8afa16 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 15 Apr 2025 12:48:58 +0900 Subject: [PATCH 24/48] Add annotation AST --- lib/rbs/ast/ruby/annotations.rb | 29 +++++++++++++++++++++++++++++ sig/ast/ruby/annotations.rbs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/lib/rbs/ast/ruby/annotations.rb b/lib/rbs/ast/ruby/annotations.rb index ffb03a180..4de877a25 100644 --- a/lib/rbs/ast/ruby/annotations.rb +++ b/lib/rbs/ast/ruby/annotations.rb @@ -84,6 +84,35 @@ def initialize(location:, prefix_location:, skip_location:, comment_location:) @comment_location = comment_location end end + + class ReturnTypeAnnotation < Base + attr_reader :return_location + + attr_reader :colon_location + + attr_reader :return_type + + attr_reader :comment_location + + def initialize(location:, prefix_location:, return_location:, colon_location:, return_type:, comment_location:) + super(location, prefix_location) + @return_location = return_location + @colon_location = colon_location + @return_type = return_type + @comment_location = comment_location + end + + def map_type_name(&block) + self.class.new( + location:, + prefix_location:, + return_location: return_location, + colon_location: colon_location, + return_type: return_type.map_type_name { yield _1 }, + comment_location: comment_location + ) #: self + end + end end end end diff --git a/sig/ast/ruby/annotations.rbs b/sig/ast/ruby/annotations.rbs index a27d0146f..18a8cbb9c 100644 --- a/sig/ast/ruby/annotations.rbs +++ b/sig/ast/ruby/annotations.rbs @@ -5,6 +5,7 @@ module RBS type leading_annotation = ColonMethodTypeAnnotation | MethodTypesAnnotation | SkipAnnotation + | ReturnTypeAnnotation type trailing_annotation = NodeTypeAssertion @@ -73,6 +74,36 @@ module RBS def initialize: (location: Location, prefix_location: Location, skip_location: Location, comment_location: Location?) -> void end + + # `@rbs return: T -- comment` annotation in leading comments + # + # ``` + # @rbs return: String -- Returns a string + # ^^^ -- prefix_location + # ^^^^^^ -- return_location + # ^ -- colon_location + # ^^^^^^^^^^^^^^^^^^^ -- comment + # ``` + class ReturnTypeAnnotation < Base + attr_reader return_location: Location + + attr_reader colon_location: Location + + attr_reader return_type: Types::t + + attr_reader comment_location: Location? + + def initialize: ( + location: Location, + prefix_location: Location, + return_location: Location, + colon_location: Location, + return_type: Types::t, + comment_location: Location?, + ) -> void + + def map_type_name: () { (TypeName) -> TypeName } -> self + end end end end From af34588b88283d2ff70a3d0b1ad398330ff1a509 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 15 Apr 2025 12:50:32 +0900 Subject: [PATCH 25/48] Add ast constructor --- config.yml | 8 ++++++++ include/rbs/constants.h | 1 + include/rbs/ruby_objs.h | 1 + src/constants.c | 2 ++ src/ruby_objs.c | 16 ++++++++++++++++ 5 files changed, 28 insertions(+) diff --git a/config.yml b/config.yml index a760020e8..d6a3cdb6c 100644 --- a/config.yml +++ b/config.yml @@ -338,3 +338,11 @@ nodes: - name: prefix_location - name: skip_location - name: comment_location + - name: RBS::AST::Ruby::Annotations::ReturnTypeAnnotation + fields: + - name: location + - name: prefix_location + - name: return_location + - name: colon_location + - name: return_type + - name: comment_location diff --git a/include/rbs/constants.h b/include/rbs/constants.h index 48f5b5457..7fc878e65 100644 --- a/include/rbs/constants.h +++ b/include/rbs/constants.h @@ -52,6 +52,7 @@ extern VALUE RBS_AST_Members_Public; extern VALUE RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation; extern VALUE RBS_AST_Ruby_Annotations_MethodTypesAnnotation; extern VALUE RBS_AST_Ruby_Annotations_NodeTypeAssertion; +extern VALUE RBS_AST_Ruby_Annotations_ReturnTypeAnnotation; extern VALUE RBS_AST_Ruby_Annotations_SkipAnnotation; extern VALUE RBS_AST_TypeParam; extern VALUE RBS_MethodType; diff --git a/include/rbs/ruby_objs.h b/include/rbs/ruby_objs.h index 084391107..b57a21675 100644 --- a/include/rbs/ruby_objs.h +++ b/include/rbs/ruby_objs.h @@ -42,6 +42,7 @@ VALUE rbs_ast_members_public(VALUE location); VALUE rbs_ast_ruby_annotations_colon_method_type_annotation(VALUE location, VALUE prefix_location, VALUE annotations, VALUE method_type); VALUE rbs_ast_ruby_annotations_method_types_annotation(VALUE location, VALUE prefix_location, VALUE overloads, VALUE vertical_bar_locations); VALUE rbs_ast_ruby_annotations_node_type_assertion(VALUE location, VALUE prefix_location, VALUE type); +VALUE rbs_ast_ruby_annotations_return_type_annotation(VALUE location, VALUE prefix_location, VALUE return_location, VALUE colon_location, VALUE return_type, VALUE comment_location); VALUE rbs_ast_ruby_annotations_skip_annotation(VALUE location, VALUE prefix_location, VALUE skip_location, VALUE comment_location); VALUE rbs_ast_type_param(VALUE name, VALUE variance, VALUE upper_bound, VALUE default_type, VALUE unchecked, VALUE location); VALUE rbs_method_type(VALUE type_params, VALUE type, VALUE block, VALUE location); diff --git a/src/constants.c b/src/constants.c index df5d72679..185c4f8ed 100644 --- a/src/constants.c +++ b/src/constants.c @@ -52,6 +52,7 @@ VALUE RBS_AST_Members_Public; VALUE RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation; VALUE RBS_AST_Ruby_Annotations_MethodTypesAnnotation; VALUE RBS_AST_Ruby_Annotations_NodeTypeAssertion; +VALUE RBS_AST_Ruby_Annotations_ReturnTypeAnnotation; VALUE RBS_AST_Ruby_Annotations_SkipAnnotation; VALUE RBS_AST_TypeParam; VALUE RBS_MethodType; @@ -132,6 +133,7 @@ void rbs__init_constants(void) { IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_ColonMethodTypeAnnotation, RBS_AST_Ruby_Annotations, "ColonMethodTypeAnnotation"); IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_MethodTypesAnnotation, RBS_AST_Ruby_Annotations, "MethodTypesAnnotation"); IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_NodeTypeAssertion, RBS_AST_Ruby_Annotations, "NodeTypeAssertion"); + IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_ReturnTypeAnnotation, RBS_AST_Ruby_Annotations, "ReturnTypeAnnotation"); IMPORT_CONSTANT(RBS_AST_Ruby_Annotations_SkipAnnotation, RBS_AST_Ruby_Annotations, "SkipAnnotation"); IMPORT_CONSTANT(RBS_AST_TypeParam, RBS_AST, "TypeParam"); IMPORT_CONSTANT(RBS_MethodType, RBS, "MethodType"); diff --git a/src/ruby_objs.c b/src/ruby_objs.c index f7e9dd0b2..1d9fc4753 100644 --- a/src/ruby_objs.c +++ b/src/ruby_objs.c @@ -480,6 +480,22 @@ VALUE rbs_ast_ruby_annotations_node_type_assertion(VALUE location, VALUE prefix_ ); } +VALUE rbs_ast_ruby_annotations_return_type_annotation(VALUE location, VALUE prefix_location, VALUE return_location, VALUE colon_location, VALUE return_type, VALUE comment_location) { + VALUE _init_kwargs = rb_hash_new(); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("prefix_location")), prefix_location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("return_location")), return_location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("colon_location")), colon_location); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("return_type")), return_type); + rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("comment_location")), comment_location); + + return CLASS_NEW_INSTANCE( + RBS_AST_Ruby_Annotations_ReturnTypeAnnotation, + 1, + &_init_kwargs + ); +} + VALUE rbs_ast_ruby_annotations_skip_annotation(VALUE location, VALUE prefix_location, VALUE skip_location, VALUE comment_location) { VALUE _init_kwargs = rb_hash_new(); rb_hash_aset(_init_kwargs, ID2SYM(rb_intern("location")), location); From 7573afafe9502a7bc459ba697a9ffe77f2165a8a Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 15 Apr 2025 12:52:57 +0900 Subject: [PATCH 26/48] Add `return` keyword --- ext/rbs_extension/lexer.c | 2006 ++++++++++++++-------------- ext/rbs_extension/lexer.h | 1 + ext/rbs_extension/lexer.re | 1 + ext/rbs_extension/lexstate.c | 1 + ext/rbs_extension/parser.c | 4 + test/rbs/signature_parsing_test.rb | 13 + 6 files changed, 1047 insertions(+), 979 deletions(-) diff --git a/ext/rbs_extension/lexer.c b/ext/rbs_extension/lexer.c index 82e530725..1a525657f 100644 --- a/ext/rbs_extension/lexer.c +++ b/ext/rbs_extension/lexer.c @@ -94,7 +94,6 @@ token rbsparser_next_token(lexstate *state) { case 'k': case 'l': case 'q': - case 'r': case 'w': case 'x': case 'y': @@ -104,24 +103,25 @@ token rbsparser_next_token(lexstate *state) { case 'n': goto yy56; case 'o': goto yy57; case 'p': goto yy58; - case 's': goto yy59; - case 't': goto yy60; - case 'u': goto yy61; - case 'v': goto yy62; - case '{': goto yy63; - case '|': goto yy64; - case '}': goto yy65; + case 'r': goto yy59; + case 's': goto yy60; + case 't': goto yy61; + case 'u': goto yy62; + case 'v': goto yy63; + case '{': goto yy64; + case '|': goto yy65; + case '}': goto yy66; default: goto yy2; } yy1: rbs_skip(state); -#line 147 "ext/rbs_extension/lexer.re" +#line 148 "ext/rbs_extension/lexer.re" { return next_eof_token(state); } #line 121 "ext/rbs_extension/lexer.c" yy2: rbs_skip(state); yy3: -#line 148 "ext/rbs_extension/lexer.re" +#line 149 "ext/rbs_extension/lexer.re" { return next_token(state, ErrorToken); } #line 127 "ext/rbs_extension/lexer.c" yy4: @@ -130,7 +130,7 @@ token rbsparser_next_token(lexstate *state) { if (yych == '\t') goto yy4; if (yych == ' ') goto yy4; yy5: -#line 146 "ext/rbs_extension/lexer.re" +#line 147 "ext/rbs_extension/lexer.re" { return next_token(state, tTRIVIA); } #line 136 "ext/rbs_extension/lexer.c" yy6: @@ -151,7 +151,7 @@ token rbsparser_next_token(lexstate *state) { backup = *state; yych = peek(state); if (yych <= 0x00000000) goto yy3; - goto yy67; + goto yy68; yy10: rbs_skip(state); yych = peek(state); @@ -173,42 +173,42 @@ token rbsparser_next_token(lexstate *state) { if (yych <= 0x0000001F) { if (yych <= '\n') { if (yych <= 0x00000000) goto yy3; - if (yych <= 0x00000008) goto yy71; + if (yych <= 0x00000008) goto yy72; goto yy3; } else { if (yych == '\r') goto yy3; - goto yy71; + goto yy72; } } else { if (yych <= '#') { if (yych <= ' ') goto yy3; - if (yych <= '"') goto yy73; - goto yy71; + if (yych <= '"') goto yy74; + goto yy72; } else { if (yych == '%') goto yy3; - if (yych <= '\'') goto yy73; + if (yych <= '\'') goto yy74; goto yy3; } } } else { if (yych <= 'Z') { if (yych <= '/') { - if (yych == '-') goto yy71; - goto yy73; + if (yych == '-') goto yy72; + goto yy74; } else { - if (yych <= '9') goto yy71; - if (yych <= '>') goto yy73; - goto yy71; + if (yych <= '9') goto yy72; + if (yych <= '>') goto yy74; + goto yy72; } } else { if (yych <= '^') { - if (yych == '\\') goto yy73; + if (yych == '\\') goto yy74; goto yy3; } else { - if (yych <= 'z') goto yy71; + if (yych <= 'z') goto yy72; if (yych <= '}') goto yy3; - if (yych <= '~') goto yy73; - goto yy71; + if (yych <= '~') goto yy74; + goto yy72; } } } @@ -217,7 +217,7 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); backup = *state; yych = peek(state); - if (yych == 'a') goto yy74; + if (yych == 'a') goto yy75; goto yy8; yy14: rbs_skip(state); @@ -230,7 +230,7 @@ token rbsparser_next_token(lexstate *state) { backup = *state; yych = peek(state); if (yych <= 0x00000000) goto yy3; - goto yy76; + goto yy77; yy16: rbs_skip(state); #line 24 "ext/rbs_extension/lexer.re" @@ -244,7 +244,7 @@ token rbsparser_next_token(lexstate *state) { yy18: rbs_skip(state); yych = peek(state); - if (yych == '*') goto yy80; + if (yych == '*') goto yy81; #line 35 "ext/rbs_extension/lexer.re" { return next_token(state, pSTAR); } #line 251 "ext/rbs_extension/lexer.c" @@ -264,7 +264,7 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); yych = peek(state); switch (yych) { - case '-': goto yy81; + case '-': goto yy82; case '0': case '1': case '2': @@ -275,7 +275,7 @@ token rbsparser_next_token(lexstate *state) { case '7': case '8': case '9': goto yy25; - case '>': goto yy82; + case '>': goto yy83; case '@': goto yy24; default: goto yy8; } @@ -284,7 +284,7 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); backup = *state; yych = peek(state); - if (yych == '.') goto yy83; + if (yych == '.') goto yy84; yy23: #line 37 "ext/rbs_extension/lexer.re" { return next_token(state, pDOT); } @@ -308,25 +308,25 @@ token rbsparser_next_token(lexstate *state) { backup = *state; yych = peek(state); switch (yych) { - case '!': goto yy84; - case '"': goto yy86; - case '$': goto yy87; + case '!': goto yy85; + case '"': goto yy87; + case '$': goto yy88; case '%': case '&': case '/': case '^': case '`': case '|': - case '~': goto yy88; - case '\'': goto yy89; - case '*': goto yy90; + case '~': goto yy89; + case '\'': goto yy90; + case '*': goto yy91; case '+': - case '-': goto yy91; - case ':': goto yy92; - case '<': goto yy93; - case '=': goto yy94; - case '>': goto yy95; - case '@': goto yy96; + case '-': goto yy92; + case ':': goto yy93; + case '<': goto yy94; + case '=': goto yy95; + case '>': goto yy96; + case '@': goto yy97; case 'A': case 'B': case 'C': @@ -379,8 +379,8 @@ token rbsparser_next_token(lexstate *state) { case 'w': case 'x': case 'y': - case 'z': goto yy97; - case '[': goto yy99; + case 'z': goto yy98; + case '[': goto yy100; default: goto yy28; } yy28: @@ -392,7 +392,7 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= ';') goto yy30; if (yych <= '<') goto yy24; - if (yych <= '=') goto yy100; + if (yych <= '=') goto yy101; yy30: #line 46 "ext/rbs_extension/lexer.re" { return next_token(state, pLT); } @@ -402,8 +402,8 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '>') { if (yych <= '<') goto yy32; - if (yych <= '=') goto yy101; - goto yy102; + if (yych <= '=') goto yy102; + goto yy103; } else { if (yych == '~') goto yy24; } @@ -430,19 +430,19 @@ token rbsparser_next_token(lexstate *state) { if (yych <= '_') { if (yych <= '@') { if (yych <= '?') goto yy3; - goto yy103; + goto yy104; } else { - if (yych <= 'Z') goto yy104; + if (yych <= 'Z') goto yy105; if (yych <= '^') goto yy3; - goto yy104; + goto yy105; } } else { if (yych <= 'q') { if (yych <= '`') goto yy3; - goto yy104; + goto yy105; } else { - if (yych <= 'r') goto yy107; - if (yych <= 'z') goto yy104; + if (yych <= 'r') goto yy108; + if (yych <= 'z') goto yy105; goto yy3; } } @@ -451,10 +451,10 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy36; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { @@ -466,13 +466,13 @@ token rbsparser_next_token(lexstate *state) { } } yy37: -#line 132 "ext/rbs_extension/lexer.re" +#line 133 "ext/rbs_extension/lexer.re" { return next_token(state, tUIDENT); } #line 472 "ext/rbs_extension/lexer.c" yy38: rbs_skip(state); yych = peek(state); - if (yych == ']') goto yy110; + if (yych == ']') goto yy111; #line 26 "ext/rbs_extension/lexer.re" { return next_token(state, pLBRACKET); } #line 479 "ext/rbs_extension/lexer.c" @@ -491,23 +491,23 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { - if (yych <= '9') goto yy111; - if (yych >= '=') goto yy109; + if (yych <= '9') goto yy112; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { if (yych <= '@') goto yy42; - if (yych <= 'Z') goto yy114; + if (yych <= 'Z') goto yy115; } else { - if (yych <= '_') goto yy116; + if (yych <= '_') goto yy117; if (yych <= '`') goto yy42; - if (yych <= 'z') goto yy111; + if (yych <= 'z') goto yy112; } } yy42: -#line 135 "ext/rbs_extension/lexer.re" +#line 136 "ext/rbs_extension/lexer.re" { return next_token(state, tULLIDENT); } #line 513 "ext/rbs_extension/lexer.c" yy43: @@ -517,9 +517,9 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= ' ') { if (yych <= 0x00000000) goto yy44; - if (yych <= 0x0000001F) goto yy117; + if (yych <= 0x0000001F) goto yy118; } else { - if (yych != ':') goto yy117; + if (yych != ':') goto yy118; } yy44: #line 39 "ext/rbs_extension/lexer.re" @@ -529,42 +529,42 @@ token rbsparser_next_token(lexstate *state) { rbs_skip(state); yych = peek(state); if (yych <= 'r') { - if (yych == 'l') goto yy118; + if (yych == 'l') goto yy119; goto yy53; } else { - if (yych <= 's') goto yy119; - if (yych <= 't') goto yy121; + if (yych <= 's') goto yy120; + if (yych <= 't') goto yy122; goto yy53; } yy46: -#line 131 "ext/rbs_extension/lexer.re" +#line 132 "ext/rbs_extension/lexer.re" { return next_token(state, tLIDENT); } #line 543 "ext/rbs_extension/lexer.c" yy47: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy122; + if (yych == 'o') goto yy123; goto yy53; yy48: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy123; + if (yych == 'l') goto yy124; goto yy53; yy49: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy124; + if (yych == 'e') goto yy125; goto yy53; yy50: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy125; - if (yych == 'x') goto yy126; + if (yych == 'n') goto yy126; + if (yych == 'x') goto yy127; goto yy53; yy51: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy127; + if (yych == 'a') goto yy128; goto yy53; yy52: rbs_skip(state); @@ -572,12 +572,12 @@ token rbsparser_next_token(lexstate *state) { yy53: if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; goto yy46; } else { if (yych <= '9') goto yy52; if (yych <= '<') goto yy46; - goto yy109; + goto yy110; } } else { if (yych <= '^') { @@ -593,90 +593,95 @@ token rbsparser_next_token(lexstate *state) { yy54: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy128; + if (yych == 'n') goto yy129; goto yy53; yy55: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy130; + if (yych == 'o') goto yy131; goto yy53; yy56: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy131; + if (yych == 'i') goto yy132; goto yy53; yy57: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy132; + if (yych == 'u') goto yy133; goto yy53; yy58: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy133; - if (yych == 'u') goto yy134; + if (yych == 'r') goto yy134; + if (yych == 'u') goto yy135; goto yy53; yy59: + rbs_skip(state); + yych = peek(state); + if (yych == 'e') goto yy136; + goto yy53; +yy60: rbs_skip(state); yych = peek(state); if (yych <= 'h') { - if (yych == 'e') goto yy135; + if (yych == 'e') goto yy137; goto yy53; } else { - if (yych <= 'i') goto yy136; - if (yych == 'k') goto yy137; + if (yych <= 'i') goto yy138; + if (yych == 'k') goto yy139; goto yy53; } -yy60: +yy61: rbs_skip(state); yych = peek(state); if (yych <= 'q') { - if (yych == 'o') goto yy138; + if (yych == 'o') goto yy140; goto yy53; } else { - if (yych <= 'r') goto yy139; - if (yych == 'y') goto yy140; + if (yych <= 'r') goto yy141; + if (yych == 'y') goto yy142; goto yy53; } -yy61: +yy62: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy141; - if (yych == 's') goto yy142; + if (yych == 'n') goto yy143; + if (yych == 's') goto yy144; goto yy53; -yy62: +yy63: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy143; + if (yych == 'o') goto yy145; goto yy53; -yy63: +yy64: rbs_skip(state); #line 28 "ext/rbs_extension/lexer.re" { return next_token(state, pLBRACE); } -#line 657 "ext/rbs_extension/lexer.c" -yy64: +#line 662 "ext/rbs_extension/lexer.c" +yy65: rbs_skip(state); #line 31 "ext/rbs_extension/lexer.re" { return next_token(state, pBAR); } -#line 662 "ext/rbs_extension/lexer.c" -yy65: +#line 667 "ext/rbs_extension/lexer.c" +yy66: rbs_skip(state); #line 29 "ext/rbs_extension/lexer.re" { return next_token(state, pRBRACE); } -#line 667 "ext/rbs_extension/lexer.c" -yy66: +#line 672 "ext/rbs_extension/lexer.c" +yy67: rbs_skip(state); yych = peek(state); -yy67: +yy68: if (yych <= '"') { - if (yych <= 0x00000000) goto yy68; - if (yych <= '!') goto yy66; - goto yy69; + if (yych <= 0x00000000) goto yy69; + if (yych <= '!') goto yy67; + goto yy70; } else { - if (yych == '\\') goto yy70; - goto yy66; + if (yych == '\\') goto yy71; + goto yy67; } -yy68: +yy69: *state = backup; if (yyaccept <= 3) { if (yyaccept <= 1) { @@ -697,561 +702,556 @@ token rbsparser_next_token(lexstate *state) { if (yyaccept == 4) { goto yy44; } else { - goto yy78; + goto yy79; } } else { - goto yy159; + goto yy161; } } -yy69: +yy70: rbs_skip(state); -#line 109 "ext/rbs_extension/lexer.re" +#line 110 "ext/rbs_extension/lexer.re" { return next_token(state, tDQSTRING); } -#line 711 "ext/rbs_extension/lexer.c" -yy70: +#line 716 "ext/rbs_extension/lexer.c" +yy71: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy144; - if (yych == 'x') goto yy145; - goto yy66; -yy71: + if (yych == 'u') goto yy146; + if (yych == 'x') goto yy147; + goto yy67; +yy72: rbs_skip(state); yych = peek(state); if (yych <= ',') { if (yych <= '\f') { - if (yych <= 0x00000000) goto yy72; - if (yych <= 0x00000008) goto yy71; - if (yych >= '\v') goto yy71; + if (yych <= 0x00000000) goto yy73; + if (yych <= 0x00000008) goto yy72; + if (yych >= '\v') goto yy72; } else { if (yych <= 0x0000001F) { - if (yych >= 0x0000000E) goto yy71; + if (yych >= 0x0000000E) goto yy72; } else { - if (yych == '#') goto yy71; + if (yych == '#') goto yy72; } } } else { if (yych <= '>') { - if (yych <= '-') goto yy71; - if (yych <= '/') goto yy72; - if (yych <= '9') goto yy71; + if (yych <= '-') goto yy72; + if (yych <= '/') goto yy73; + if (yych <= '9') goto yy72; } else { if (yych <= '^') { - if (yych <= 'Z') goto yy71; + if (yych <= 'Z') goto yy72; } else { - if (yych <= 'z') goto yy71; - if (yych >= 0x0000007F) goto yy71; + if (yych <= 'z') goto yy72; + if (yych >= 0x0000007F) goto yy72; } } } -yy72: -#line 142 "ext/rbs_extension/lexer.re" - { return next_token(state, tGIDENT); } -#line 750 "ext/rbs_extension/lexer.c" yy73: - rbs_skip(state); - goto yy72; +#line 143 "ext/rbs_extension/lexer.re" + { return next_token(state, tGIDENT); } +#line 755 "ext/rbs_extension/lexer.c" yy74: + rbs_skip(state); + goto yy73; +yy75: rbs_skip(state); yych = peek(state); if (yych <= 'Z') { if (yych <= '(') { - if (yych <= '\'') goto yy68; - goto yy146; + if (yych <= '\'') goto yy69; + goto yy148; } else { - if (yych == '<') goto yy147; - goto yy68; + if (yych == '<') goto yy149; + goto yy69; } } else { if (yych <= 'z') { - if (yych <= '[') goto yy148; - goto yy68; + if (yych <= '[') goto yy150; + goto yy69; } else { - if (yych <= '{') goto yy149; - if (yych <= '|') goto yy150; - goto yy68; + if (yych <= '{') goto yy151; + if (yych <= '|') goto yy152; + goto yy69; } } -yy75: +yy76: rbs_skip(state); yych = peek(state); -yy76: +yy77: if (yych <= '\'') { - if (yych <= 0x00000000) goto yy68; - if (yych <= '&') goto yy75; + if (yych <= 0x00000000) goto yy69; + if (yych <= '&') goto yy76; } else { - if (yych == '\\') goto yy79; - goto yy75; + if (yych == '\\') goto yy80; + goto yy76; } -yy77: - rbs_skip(state); yy78: -#line 110 "ext/rbs_extension/lexer.re" - { return next_token(state, tSQSTRING); } -#line 791 "ext/rbs_extension/lexer.c" + rbs_skip(state); yy79: +#line 111 "ext/rbs_extension/lexer.re" + { return next_token(state, tSQSTRING); } +#line 796 "ext/rbs_extension/lexer.c" +yy80: rbs_skip(state); yych = peek(state); if (yych <= '\'') { - if (yych <= 0x00000000) goto yy68; - if (yych <= '&') goto yy75; - goto yy151; + if (yych <= 0x00000000) goto yy69; + if (yych <= '&') goto yy76; + goto yy153; } else { - if (yych == '\\') goto yy79; - goto yy75; + if (yych == '\\') goto yy80; + goto yy76; } -yy80: +yy81: rbs_skip(state); #line 36 "ext/rbs_extension/lexer.re" { return next_token(state, pSTAR2); } -#line 807 "ext/rbs_extension/lexer.c" -yy81: +#line 812 "ext/rbs_extension/lexer.c" +yy82: rbs_skip(state); yych = peek(state); - if (yych >= 0x00000001) goto yy81; + if (yych >= 0x00000001) goto yy82; #line 49 "ext/rbs_extension/lexer.re" { return next_token(state, tINLINECOMMENT); } -#line 814 "ext/rbs_extension/lexer.c" -yy82: - rbs_skip(state); -#line 41 "ext/rbs_extension/lexer.re" - { return next_token(state, pARROW); } #line 819 "ext/rbs_extension/lexer.c" yy83: rbs_skip(state); - yych = peek(state); - if (yych == '.') goto yy152; - goto yy68; +#line 41 "ext/rbs_extension/lexer.re" + { return next_token(state, pARROW); } +#line 824 "ext/rbs_extension/lexer.c" yy84: rbs_skip(state); yych = peek(state); - if (yych == '=') goto yy88; - if (yych == '~') goto yy88; + if (yych == '.') goto yy154; + goto yy69; yy85: -#line 129 "ext/rbs_extension/lexer.re" - { return next_token(state, tSYMBOL); } -#line 833 "ext/rbs_extension/lexer.c" + rbs_skip(state); + yych = peek(state); + if (yych == '=') goto yy89; + if (yych == '~') goto yy89; yy86: +#line 130 "ext/rbs_extension/lexer.re" + { return next_token(state, tSYMBOL); } +#line 838 "ext/rbs_extension/lexer.c" +yy87: rbs_skip(state); yych = peek(state); if (yych <= '"') { - if (yych <= 0x00000000) goto yy68; - if (yych <= '!') goto yy86; - goto yy153; + if (yych <= 0x00000000) goto yy69; + if (yych <= '!') goto yy87; + goto yy155; } else { - if (yych == '\\') goto yy154; - goto yy86; + if (yych == '\\') goto yy156; + goto yy87; } -yy87: +yy88: rbs_skip(state); yych = peek(state); if (yych <= ')') { if (yych <= 0x0000001F) { if (yych <= '\n') { - if (yych <= 0x00000000) goto yy68; - if (yych <= 0x00000008) goto yy155; - goto yy68; + if (yych <= 0x00000000) goto yy69; + if (yych <= 0x00000008) goto yy157; + goto yy69; } else { - if (yych == '\r') goto yy68; - goto yy155; + if (yych == '\r') goto yy69; + goto yy157; } } else { if (yych <= '#') { - if (yych <= ' ') goto yy68; - if (yych <= '"') goto yy157; - goto yy155; + if (yych <= ' ') goto yy69; + if (yych <= '"') goto yy159; + goto yy157; } else { - if (yych == '%') goto yy68; - if (yych <= '\'') goto yy157; - goto yy68; + if (yych == '%') goto yy69; + if (yych <= '\'') goto yy159; + goto yy69; } } } else { if (yych <= 'Z') { if (yych <= '/') { - if (yych == '-') goto yy155; - goto yy157; + if (yych == '-') goto yy157; + goto yy159; } else { - if (yych <= '9') goto yy155; - if (yych <= '>') goto yy157; - goto yy155; + if (yych <= '9') goto yy157; + if (yych <= '>') goto yy159; + goto yy157; } } else { if (yych <= '^') { - if (yych == '\\') goto yy157; - goto yy68; + if (yych == '\\') goto yy159; + goto yy69; } else { - if (yych <= 'z') goto yy155; - if (yych <= '}') goto yy68; - if (yych <= '~') goto yy157; - goto yy155; + if (yych <= 'z') goto yy157; + if (yych <= '}') goto yy69; + if (yych <= '~') goto yy159; + goto yy157; } } } -yy88: - rbs_skip(state); - goto yy85; yy89: + rbs_skip(state); + goto yy86; +yy90: rbs_skip(state); yych = peek(state); if (yych <= '\'') { - if (yych <= 0x00000000) goto yy68; - if (yych <= '&') goto yy89; - goto yy158; + if (yych <= 0x00000000) goto yy69; + if (yych <= '&') goto yy90; + goto yy160; } else { - if (yych == '\\') goto yy160; - goto yy89; + if (yych == '\\') goto yy162; + goto yy90; } -yy90: - rbs_skip(state); - yych = peek(state); - if (yych == '*') goto yy88; - goto yy85; yy91: rbs_skip(state); yych = peek(state); - if (yych == '@') goto yy88; - goto yy85; + if (yych == '*') goto yy89; + goto yy86; yy92: rbs_skip(state); -#line 45 "ext/rbs_extension/lexer.re" - { return next_token(state, pCOLON2); } -#line 919 "ext/rbs_extension/lexer.c" + yych = peek(state); + if (yych == '@') goto yy89; + goto yy86; yy93: rbs_skip(state); - yych = peek(state); - if (yych <= ';') goto yy85; - if (yych <= '<') goto yy88; - if (yych <= '=') goto yy161; - goto yy85; +#line 45 "ext/rbs_extension/lexer.re" + { return next_token(state, pCOLON2); } +#line 924 "ext/rbs_extension/lexer.c" yy94: rbs_skip(state); yych = peek(state); - if (yych == '=') goto yy162; - if (yych == '~') goto yy88; - goto yy68; + if (yych <= ';') goto yy86; + if (yych <= '<') goto yy89; + if (yych <= '=') goto yy163; + goto yy86; yy95: rbs_skip(state); yych = peek(state); - if (yych <= '<') goto yy85; - if (yych <= '>') goto yy88; - goto yy85; + if (yych == '=') goto yy164; + if (yych == '~') goto yy89; + goto yy69; yy96: + rbs_skip(state); + yych = peek(state); + if (yych <= '<') goto yy86; + if (yych <= '>') goto yy89; + goto yy86; +yy97: rbs_skip(state); yych = peek(state); if (yych <= '^') { - if (yych <= '?') goto yy68; - if (yych <= '@') goto yy163; - if (yych <= 'Z') goto yy164; - goto yy68; + if (yych <= '?') goto yy69; + if (yych <= '@') goto yy165; + if (yych <= 'Z') goto yy166; + goto yy69; } else { - if (yych == '`') goto yy68; - if (yych <= 'z') goto yy164; - goto yy68; + if (yych == '`') goto yy69; + if (yych <= 'z') goto yy166; + goto yy69; } -yy97: +yy98: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy166; + if (yych == '!') goto yy168; } else { - if (yych <= '9') goto yy97; - if (yych == '=') goto yy166; + if (yych <= '9') goto yy98; + if (yych == '=') goto yy168; } } else { if (yych <= '^') { - if (yych <= '?') goto yy166; - if (yych <= '@') goto yy98; - if (yych <= 'Z') goto yy97; + if (yych <= '?') goto yy168; + if (yych <= '@') goto yy99; + if (yych <= 'Z') goto yy98; } else { - if (yych == '`') goto yy98; - if (yych <= 'z') goto yy97; + if (yych == '`') goto yy99; + if (yych <= 'z') goto yy98; } } -yy98: -#line 125 "ext/rbs_extension/lexer.re" - { return next_token(state, tSYMBOL); } -#line 975 "ext/rbs_extension/lexer.c" yy99: +#line 126 "ext/rbs_extension/lexer.re" + { return next_token(state, tSYMBOL); } +#line 980 "ext/rbs_extension/lexer.c" +yy100: rbs_skip(state); yych = peek(state); - if (yych == ']') goto yy162; - goto yy68; -yy100: + if (yych == ']') goto yy164; + goto yy69; +yy101: rbs_skip(state); yych = peek(state); if (yych == '>') goto yy24; goto yy8; -yy101: +yy102: rbs_skip(state); yych = peek(state); if (yych == '=') goto yy24; goto yy8; -yy102: +yy103: rbs_skip(state); #line 42 "ext/rbs_extension/lexer.re" { return next_token(state, pFATARROW); } -#line 995 "ext/rbs_extension/lexer.c" -yy103: +#line 1000 "ext/rbs_extension/lexer.c" +yy104: rbs_skip(state); yych = peek(state); if (yych <= '^') { - if (yych <= '@') goto yy68; - if (yych <= 'Z') goto yy167; - goto yy68; + if (yych <= '@') goto yy69; + if (yych <= 'Z') goto yy169; + goto yy69; } else { - if (yych == '`') goto yy68; - if (yych <= 'z') goto yy167; - goto yy68; + if (yych == '`') goto yy69; + if (yych <= 'z') goto yy169; + goto yy69; } -yy104: +yy105: rbs_skip(state); yych = peek(state); -yy105: +yy106: if (yych <= 'Z') { - if (yych <= '/') goto yy106; - if (yych <= '9') goto yy104; - if (yych >= 'A') goto yy104; + if (yych <= '/') goto yy107; + if (yych <= '9') goto yy105; + if (yych >= 'A') goto yy105; } else { if (yych <= '_') { - if (yych >= '_') goto yy104; + if (yych >= '_') goto yy105; } else { - if (yych <= '`') goto yy106; - if (yych <= 'z') goto yy104; + if (yych <= '`') goto yy107; + if (yych <= 'z') goto yy105; } } -yy106: -#line 139 "ext/rbs_extension/lexer.re" - { return next_token(state, tAIDENT); } -#line 1027 "ext/rbs_extension/lexer.c" yy107: - rbs_skip(state); - yych = peek(state); - if (yych == 'b') goto yy169; - goto yy105; +#line 140 "ext/rbs_extension/lexer.re" + { return next_token(state, tAIDENT); } +#line 1032 "ext/rbs_extension/lexer.c" yy108: rbs_skip(state); -#line 136 "ext/rbs_extension/lexer.re" - { return next_token(state, tBANGIDENT); } -#line 1037 "ext/rbs_extension/lexer.c" + yych = peek(state); + if (yych == 'b') goto yy171; + goto yy106; yy109: rbs_skip(state); #line 137 "ext/rbs_extension/lexer.re" - { return next_token(state, tEQIDENT); } + { return next_token(state, tBANGIDENT); } #line 1042 "ext/rbs_extension/lexer.c" yy110: rbs_skip(state); +#line 138 "ext/rbs_extension/lexer.re" + { return next_token(state, tEQIDENT); } +#line 1047 "ext/rbs_extension/lexer.c" +yy111: + rbs_skip(state); yych = peek(state); if (yych == '=') goto yy24; #line 47 "ext/rbs_extension/lexer.re" { return next_token(state, pAREF_OPR); } -#line 1049 "ext/rbs_extension/lexer.c" -yy111: +#line 1054 "ext/rbs_extension/lexer.c" +yy112: rbs_skip(state); yych = peek(state); -yy112: +yy113: if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { - if (yych <= '9') goto yy111; - if (yych >= '=') goto yy109; + if (yych <= '9') goto yy112; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy113; - if (yych <= 'Z') goto yy111; + if (yych <= '@') goto yy114; + if (yych <= 'Z') goto yy112; } else { - if (yych == '`') goto yy113; - if (yych <= 'z') goto yy111; + if (yych == '`') goto yy114; + if (yych <= 'z') goto yy112; } } -yy113: -#line 133 "ext/rbs_extension/lexer.re" - { return next_token(state, tULLIDENT); } -#line 1073 "ext/rbs_extension/lexer.c" yy114: +#line 134 "ext/rbs_extension/lexer.re" + { return next_token(state, tULLIDENT); } +#line 1078 "ext/rbs_extension/lexer.c" +yy115: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { - if (yych <= '9') goto yy114; - if (yych >= '=') goto yy109; + if (yych <= '9') goto yy115; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy115; - if (yych <= 'Z') goto yy114; + if (yych <= '@') goto yy116; + if (yych <= 'Z') goto yy115; } else { - if (yych == '`') goto yy115; - if (yych <= 'z') goto yy114; + if (yych == '`') goto yy116; + if (yych <= 'z') goto yy115; } } -yy115: -#line 134 "ext/rbs_extension/lexer.re" - { return next_token(state, tULIDENT); } -#line 1096 "ext/rbs_extension/lexer.c" yy116: - rbs_skip(state); - yych = peek(state); - if (yych == 't') goto yy170; - goto yy112; +#line 135 "ext/rbs_extension/lexer.re" + { return next_token(state, tULIDENT); } +#line 1101 "ext/rbs_extension/lexer.c" yy117: rbs_skip(state); yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == '`') goto yy171; - goto yy117; + if (yych == 't') goto yy172; + goto yy113; yy118: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy172; - goto yy53; + if (yych <= 0x00000000) goto yy69; + if (yych == '`') goto yy173; + goto yy118; yy119: + rbs_skip(state); + yych = peek(state); + if (yych == 'i') goto yy174; + goto yy53; +yy120: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy120; + if (yych <= '@') goto yy121; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy120; + if (yych == '`') goto yy121; if (yych <= 'z') goto yy52; } } -yy120: +yy121: #line 97 "ext/rbs_extension/lexer.re" { return next_token(state, kAS); } -#line 1135 "ext/rbs_extension/lexer.c" -yy121: - rbs_skip(state); - yych = peek(state); - if (yych == 't') goto yy173; - goto yy53; +#line 1140 "ext/rbs_extension/lexer.c" yy122: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy174; if (yych == 't') goto yy175; goto yy53; yy123: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy177; + if (yych == 'o') goto yy176; + if (yych == 't') goto yy177; goto yy53; yy124: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy178; + if (yych == 'a') goto yy179; goto yy53; yy125: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy180; + if (yych == 'f') goto yy180; goto yy53; yy126: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy182; + if (yych == 'd') goto yy182; goto yy53; yy127: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy183; + if (yych == 't') goto yy184; goto yy53; yy128: + rbs_skip(state); + yych = peek(state); + if (yych == 'l') goto yy185; + goto yy53; +yy129: rbs_skip(state); yych = peek(state); if (yych <= '^') { if (yych <= '9') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; if (yych >= '0') goto yy52; } else { if (yych <= '=') { - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } else { - if (yych <= '@') goto yy129; + if (yych <= '@') goto yy130; if (yych <= 'Z') goto yy52; } } } else { if (yych <= 'c') { - if (yych == '`') goto yy129; + if (yych == '`') goto yy130; if (yych <= 'b') goto yy52; - goto yy184; + goto yy186; } else { if (yych <= 's') { if (yych <= 'r') goto yy52; - goto yy185; + goto yy187; } else { - if (yych <= 't') goto yy186; + if (yych <= 't') goto yy188; if (yych <= 'z') goto yy52; } } } -yy129: +yy130: #line 78 "ext/rbs_extension/lexer.re" { return next_token(state, kIN); } -#line 1205 "ext/rbs_extension/lexer.c" -yy130: - rbs_skip(state); - yych = peek(state); - if (yych == 'd') goto yy187; - goto yy53; +#line 1210 "ext/rbs_extension/lexer.c" yy131: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy188; + if (yych == 'd') goto yy189; goto yy53; yy132: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy190; + if (yych == 'l') goto yy190; goto yy53; yy133: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy192; - if (yych == 'i') goto yy193; + if (yych == 't') goto yy192; goto yy53; yy134: rbs_skip(state); yych = peek(state); - if (yych == 'b') goto yy194; + if (yych == 'e') goto yy194; + if (yych == 'i') goto yy195; goto yy53; yy135: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy195; + if (yych == 'b') goto yy196; goto yy53; yy136: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy196; + if (yych == 't') goto yy197; goto yy53; yy137: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy197; + if (yych == 'l') goto yy198; goto yy53; yy138: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy198; + if (yych == 'n') goto yy199; goto yy53; yy139: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy200; + if (yych == 'i') goto yy200; goto yy53; yy140: rbs_skip(state); @@ -1261,1533 +1261,1581 @@ token rbsparser_next_token(lexstate *state) { yy141: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy202; - if (yych == 't') goto yy203; + if (yych == 'u') goto yy203; goto yy53; yy142: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy204; + if (yych == 'p') goto yy204; goto yy53; yy143: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy206; + if (yych == 'c') goto yy205; + if (yych == 't') goto yy206; goto yy53; yy144: rbs_skip(state); yych = peek(state); - if (yych <= '@') { - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy207; - goto yy68; - } else { - if (yych <= 'F') goto yy207; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy207; - goto yy68; - } + if (yych == 'e') goto yy207; + goto yy53; yy145: rbs_skip(state); yych = peek(state); - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy66; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy66; - goto yy68; + if (yych == 'i') goto yy209; + goto yy53; yy146: rbs_skip(state); yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == ')') goto yy208; - goto yy146; + if (yych <= '@') { + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy210; + goto yy69; + } else { + if (yych <= 'F') goto yy210; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy210; + goto yy69; + } yy147: rbs_skip(state); yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == '>') goto yy209; - goto yy147; + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy67; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy67; + goto yy69; yy148: rbs_skip(state); yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == ']') goto yy210; + if (yych <= 0x00000000) goto yy69; + if (yych == ')') goto yy211; goto yy148; yy149: rbs_skip(state); yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == '}') goto yy211; + if (yych <= 0x00000000) goto yy69; + if (yych == '>') goto yy212; goto yy149; yy150: rbs_skip(state); yych = peek(state); - if (yych <= 0x00000000) goto yy68; - if (yych == '|') goto yy212; + if (yych <= 0x00000000) goto yy69; + if (yych == ']') goto yy213; goto yy150; yy151: + rbs_skip(state); + yych = peek(state); + if (yych <= 0x00000000) goto yy69; + if (yych == '}') goto yy214; + goto yy151; +yy152: + rbs_skip(state); + yych = peek(state); + if (yych <= 0x00000000) goto yy69; + if (yych == '|') goto yy215; + goto yy152; +yy153: yyaccept = 5; rbs_skip(state); backup = *state; yych = peek(state); if (yych <= '\'') { - if (yych <= 0x00000000) goto yy78; - if (yych <= '&') goto yy75; - goto yy77; + if (yych <= 0x00000000) goto yy79; + if (yych <= '&') goto yy76; + goto yy78; } else { - if (yych == '\\') goto yy79; - goto yy75; + if (yych == '\\') goto yy80; + goto yy76; } -yy152: +yy154: rbs_skip(state); #line 38 "ext/rbs_extension/lexer.re" { return next_token(state, pDOT3); } -#line 1346 "ext/rbs_extension/lexer.c" -yy153: +#line 1356 "ext/rbs_extension/lexer.c" +yy155: rbs_skip(state); -#line 111 "ext/rbs_extension/lexer.re" +#line 112 "ext/rbs_extension/lexer.re" { return next_token(state, tDQSYMBOL); } -#line 1351 "ext/rbs_extension/lexer.c" -yy154: +#line 1361 "ext/rbs_extension/lexer.c" +yy156: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy213; - if (yych == 'x') goto yy214; - goto yy86; -yy155: + if (yych == 'u') goto yy216; + if (yych == 'x') goto yy217; + goto yy87; +yy157: rbs_skip(state); yych = peek(state); if (yych <= ',') { if (yych <= '\f') { - if (yych <= 0x00000000) goto yy156; - if (yych <= 0x00000008) goto yy155; - if (yych >= '\v') goto yy155; + if (yych <= 0x00000000) goto yy158; + if (yych <= 0x00000008) goto yy157; + if (yych >= '\v') goto yy157; } else { if (yych <= 0x0000001F) { - if (yych >= 0x0000000E) goto yy155; + if (yych >= 0x0000000E) goto yy157; } else { - if (yych == '#') goto yy155; + if (yych == '#') goto yy157; } } } else { if (yych <= '>') { - if (yych <= '-') goto yy155; - if (yych <= '/') goto yy156; - if (yych <= '9') goto yy155; + if (yych <= '-') goto yy157; + if (yych <= '/') goto yy158; + if (yych <= '9') goto yy157; } else { if (yych <= '^') { - if (yych <= 'Z') goto yy155; + if (yych <= 'Z') goto yy157; } else { - if (yych <= 'z') goto yy155; - if (yych >= 0x0000007F) goto yy155; + if (yych <= 'z') goto yy157; + if (yych >= 0x0000007F) goto yy157; } } } -yy156: -#line 128 "ext/rbs_extension/lexer.re" +yy158: +#line 129 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 1390 "ext/rbs_extension/lexer.c" -yy157: +#line 1400 "ext/rbs_extension/lexer.c" +yy159: rbs_skip(state); - goto yy156; -yy158: + goto yy158; +yy160: rbs_skip(state); -yy159: -#line 112 "ext/rbs_extension/lexer.re" +yy161: +#line 113 "ext/rbs_extension/lexer.re" { return next_token(state, tSQSYMBOL); } -#line 1399 "ext/rbs_extension/lexer.c" -yy160: +#line 1409 "ext/rbs_extension/lexer.c" +yy162: rbs_skip(state); yych = peek(state); if (yych <= '\'') { - if (yych <= 0x00000000) goto yy68; - if (yych <= '&') goto yy89; - goto yy215; + if (yych <= 0x00000000) goto yy69; + if (yych <= '&') goto yy90; + goto yy218; } else { - if (yych == '\\') goto yy160; - goto yy89; + if (yych == '\\') goto yy162; + goto yy90; } -yy161: +yy163: rbs_skip(state); yych = peek(state); - if (yych == '>') goto yy88; - goto yy85; -yy162: + if (yych == '>') goto yy89; + goto yy86; +yy164: rbs_skip(state); yych = peek(state); - if (yych == '=') goto yy88; - goto yy85; -yy163: + if (yych == '=') goto yy89; + goto yy86; +yy165: rbs_skip(state); yych = peek(state); if (yych <= '^') { - if (yych <= '@') goto yy68; - if (yych <= 'Z') goto yy216; - goto yy68; + if (yych <= '@') goto yy69; + if (yych <= 'Z') goto yy219; + goto yy69; } else { - if (yych == '`') goto yy68; - if (yych <= 'z') goto yy216; - goto yy68; + if (yych == '`') goto yy69; + if (yych <= 'z') goto yy219; + goto yy69; } -yy164: +yy166: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy218; + if (yych == '!') goto yy221; } else { - if (yych <= '9') goto yy164; - if (yych == '=') goto yy218; + if (yych <= '9') goto yy166; + if (yych == '=') goto yy221; } } else { if (yych <= '^') { - if (yych <= '?') goto yy218; - if (yych <= '@') goto yy165; - if (yych <= 'Z') goto yy164; + if (yych <= '?') goto yy221; + if (yych <= '@') goto yy167; + if (yych <= 'Z') goto yy166; } else { - if (yych == '`') goto yy165; - if (yych <= 'z') goto yy164; + if (yych == '`') goto yy167; + if (yych <= 'z') goto yy166; } } -yy165: -#line 126 "ext/rbs_extension/lexer.re" +yy167: +#line 127 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 1456 "ext/rbs_extension/lexer.c" -yy166: +#line 1466 "ext/rbs_extension/lexer.c" +yy168: rbs_skip(state); - goto yy98; -yy167: + goto yy99; +yy169: rbs_skip(state); yych = peek(state); if (yych <= 'Z') { - if (yych <= '/') goto yy168; - if (yych <= '9') goto yy167; - if (yych >= 'A') goto yy167; + if (yych <= '/') goto yy170; + if (yych <= '9') goto yy169; + if (yych >= 'A') goto yy169; } else { if (yych <= '_') { - if (yych >= '_') goto yy167; + if (yych >= '_') goto yy169; } else { - if (yych <= '`') goto yy168; - if (yych <= 'z') goto yy167; + if (yych <= '`') goto yy170; + if (yych <= 'z') goto yy169; } } -yy168: -#line 140 "ext/rbs_extension/lexer.re" +yy170: +#line 141 "ext/rbs_extension/lexer.re" { return next_token(state, tA2IDENT); } -#line 1478 "ext/rbs_extension/lexer.c" -yy169: +#line 1488 "ext/rbs_extension/lexer.c" +yy171: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy219; - goto yy105; -yy170: + if (yych == 's') goto yy222; + goto yy106; +yy172: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy221; - goto yy112; -yy171: + if (yych == 'o') goto yy224; + goto yy113; +yy173: rbs_skip(state); #line 40 "ext/rbs_extension/lexer.re" { return next_token(state, tQIDENT); } -#line 1493 "ext/rbs_extension/lexer.c" -yy172: +#line 1503 "ext/rbs_extension/lexer.c" +yy174: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy222; + if (yych == 'a') goto yy225; goto yy53; -yy173: +yy175: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy223; + if (yych == 'r') goto yy226; goto yy53; -yy174: +yy176: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy224; + if (yych == 'l') goto yy227; goto yy53; -yy175: +yy177: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy176; + if (yych <= '@') goto yy178; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy176; + if (yych == '`') goto yy178; if (yych <= 'z') goto yy52; } } -yy176: +yy178: #line 72 "ext/rbs_extension/lexer.re" { return next_token(state, kBOT); } -#line 1531 "ext/rbs_extension/lexer.c" -yy177: +#line 1541 "ext/rbs_extension/lexer.c" +yy179: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy226; + if (yych == 's') goto yy229; goto yy53; -yy178: +yy180: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy179; + if (yych <= '@') goto yy181; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy179; + if (yych == '`') goto yy181; if (yych <= 'z') goto yy52; } } -yy179: +yy181: #line 74 "ext/rbs_extension/lexer.re" { return next_token(state, kDEF); } -#line 1559 "ext/rbs_extension/lexer.c" -yy180: +#line 1569 "ext/rbs_extension/lexer.c" +yy182: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy181; + if (yych <= '@') goto yy183; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy181; + if (yych == '`') goto yy183; if (yych <= 'z') goto yy52; } } -yy181: +yy183: #line 75 "ext/rbs_extension/lexer.re" { return next_token(state, kEND); } -#line 1582 "ext/rbs_extension/lexer.c" -yy182: +#line 1592 "ext/rbs_extension/lexer.c" +yy184: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy227; + if (yych == 'e') goto yy230; goto yy53; -yy183: +yy185: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy228; + if (yych == 's') goto yy231; goto yy53; -yy184: +yy186: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy229; + if (yych == 'l') goto yy232; goto yy53; -yy185: +yy187: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy230; + if (yych == 't') goto yy233; goto yy53; -yy186: +yy188: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy231; + if (yych == 'e') goto yy234; goto yy53; -yy187: +yy189: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy232; + if (yych == 'u') goto yy235; goto yy53; -yy188: +yy190: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy189; + if (yych <= '@') goto yy191; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy189; + if (yych == '`') goto yy191; if (yych <= 'z') goto yy52; } } -yy189: +yy191: #line 83 "ext/rbs_extension/lexer.re" { return next_token(state, kNIL); } -#line 1635 "ext/rbs_extension/lexer.c" -yy190: +#line 1645 "ext/rbs_extension/lexer.c" +yy192: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy191; + if (yych <= '@') goto yy193; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy191; + if (yych == '`') goto yy193; if (yych <= 'z') goto yy52; } } -yy191: +yy193: #line 84 "ext/rbs_extension/lexer.re" { return next_token(state, kOUT); } -#line 1658 "ext/rbs_extension/lexer.c" -yy192: +#line 1668 "ext/rbs_extension/lexer.c" +yy194: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy233; + if (yych == 'p') goto yy236; goto yy53; -yy193: +yy195: rbs_skip(state); yych = peek(state); - if (yych == 'v') goto yy234; + if (yych == 'v') goto yy237; goto yy53; -yy194: +yy196: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy235; + if (yych == 'l') goto yy238; goto yy53; -yy195: +yy197: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy236; + if (yych == 'u') goto yy239; goto yy53; -yy196: +yy198: rbs_skip(state); yych = peek(state); - if (yych == 'g') goto yy238; + if (yych == 'f') goto yy240; goto yy53; -yy197: +yy199: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy239; + if (yych == 'g') goto yy242; goto yy53; -yy198: +yy200: + rbs_skip(state); + yych = peek(state); + if (yych == 'p') goto yy243; + goto yy53; +yy201: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy199; + if (yych <= '@') goto yy202; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy199; + if (yych == '`') goto yy202; if (yych <= 'z') goto yy52; } } -yy199: +yy202: #line 90 "ext/rbs_extension/lexer.re" { return next_token(state, kTOP); } -#line 1711 "ext/rbs_extension/lexer.c" -yy200: +#line 1726 "ext/rbs_extension/lexer.c" +yy203: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy241; + if (yych == 'e') goto yy245; goto yy53; -yy201: +yy204: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy243; + if (yych == 'e') goto yy247; goto yy53; -yy202: +yy205: rbs_skip(state); yych = peek(state); - if (yych == 'h') goto yy245; + if (yych == 'h') goto yy249; goto yy53; -yy203: +yy206: rbs_skip(state); yych = peek(state); - if (yych == 'y') goto yy246; + if (yych == 'y') goto yy250; goto yy53; -yy204: +yy207: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy205; + if (yych <= '@') goto yy208; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy205; + if (yych == '`') goto yy208; if (yych <= 'z') goto yy52; } } -yy205: +yy208: #line 96 "ext/rbs_extension/lexer.re" { return next_token(state, kUSE); } -#line 1754 "ext/rbs_extension/lexer.c" -yy206: +#line 1769 "ext/rbs_extension/lexer.c" +yy209: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy247; + if (yych == 'd') goto yy251; goto yy53; -yy207: +yy210: rbs_skip(state); yych = peek(state); if (yych <= '@') { - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy249; - goto yy68; + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy253; + goto yy69; } else { - if (yych <= 'F') goto yy249; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy249; - goto yy68; + if (yych <= 'F') goto yy253; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy253; + goto yy69; } -yy208: +yy211: rbs_skip(state); #line 55 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1777 "ext/rbs_extension/lexer.c" -yy209: +#line 1792 "ext/rbs_extension/lexer.c" +yy212: rbs_skip(state); #line 58 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1782 "ext/rbs_extension/lexer.c" -yy210: +#line 1797 "ext/rbs_extension/lexer.c" +yy213: rbs_skip(state); #line 56 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1787 "ext/rbs_extension/lexer.c" -yy211: +#line 1802 "ext/rbs_extension/lexer.c" +yy214: rbs_skip(state); #line 54 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1792 "ext/rbs_extension/lexer.c" -yy212: +#line 1807 "ext/rbs_extension/lexer.c" +yy215: rbs_skip(state); #line 57 "ext/rbs_extension/lexer.re" { return next_token(state, tANNOTATION); } -#line 1797 "ext/rbs_extension/lexer.c" -yy213: +#line 1812 "ext/rbs_extension/lexer.c" +yy216: rbs_skip(state); yych = peek(state); if (yych <= '@') { - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy250; - goto yy68; + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy254; + goto yy69; } else { - if (yych <= 'F') goto yy250; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy250; - goto yy68; + if (yych <= 'F') goto yy254; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy254; + goto yy69; } -yy214: +yy217: rbs_skip(state); yych = peek(state); - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy86; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy86; - goto yy68; -yy215: + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy87; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy87; + goto yy69; +yy218: yyaccept = 6; rbs_skip(state); backup = *state; yych = peek(state); if (yych <= '\'') { - if (yych <= 0x00000000) goto yy159; - if (yych <= '&') goto yy89; - goto yy158; + if (yych <= 0x00000000) goto yy161; + if (yych <= '&') goto yy90; + goto yy160; } else { - if (yych == '\\') goto yy160; - goto yy89; + if (yych == '\\') goto yy162; + goto yy90; } -yy216: +yy219: rbs_skip(state); yych = peek(state); if (yych <= '>') { if (yych <= '/') { - if (yych == '!') goto yy251; + if (yych == '!') goto yy255; } else { - if (yych <= '9') goto yy216; - if (yych == '=') goto yy251; + if (yych <= '9') goto yy219; + if (yych == '=') goto yy255; } } else { if (yych <= '^') { - if (yych <= '?') goto yy251; - if (yych <= '@') goto yy217; - if (yych <= 'Z') goto yy216; + if (yych <= '?') goto yy255; + if (yych <= '@') goto yy220; + if (yych <= 'Z') goto yy219; } else { - if (yych == '`') goto yy217; - if (yych <= 'z') goto yy216; + if (yych == '`') goto yy220; + if (yych <= 'z') goto yy219; } } -yy217: -#line 127 "ext/rbs_extension/lexer.re" +yy220: +#line 128 "ext/rbs_extension/lexer.re" { return next_token(state, tSYMBOL); } -#line 1855 "ext/rbs_extension/lexer.c" -yy218: +#line 1870 "ext/rbs_extension/lexer.c" +yy221: rbs_skip(state); - goto yy165; -yy219: + goto yy167; +yy222: rbs_skip(state); yych = peek(state); if (yych <= 'Z') { - if (yych <= '/') goto yy220; - if (yych <= '9') goto yy104; - if (yych >= 'A') goto yy104; + if (yych <= '/') goto yy223; + if (yych <= '9') goto yy105; + if (yych >= 'A') goto yy105; } else { if (yych <= '_') { - if (yych >= '_') goto yy104; + if (yych >= '_') goto yy105; } else { - if (yych <= '`') goto yy220; - if (yych <= 'z') goto yy104; + if (yych <= '`') goto yy223; + if (yych <= 'z') goto yy105; } } -yy220: +yy223: #line 99 "ext/rbs_extension/lexer.re" { return next_token(state, kATRBS); } -#line 1877 "ext/rbs_extension/lexer.c" -yy221: +#line 1892 "ext/rbs_extension/lexer.c" +yy224: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy252; - goto yy112; -yy222: + if (yych == 'd') goto yy256; + goto yy113; +yy225: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy253; + if (yych == 's') goto yy257; goto yy53; -yy223: +yy226: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy255; + if (yych == '_') goto yy259; goto yy53; -yy224: +yy227: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy225; + if (yych <= '@') goto yy228; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy225; + if (yych == '`') goto yy228; if (yych <= 'z') goto yy52; } } -yy225: +yy228: #line 71 "ext/rbs_extension/lexer.re" { return next_token(state, kBOOL); } -#line 1915 "ext/rbs_extension/lexer.c" -yy226: +#line 1930 "ext/rbs_extension/lexer.c" +yy229: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy256; + if (yych == 's') goto yy260; goto yy53; -yy227: +yy230: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy258; + if (yych == 'n') goto yy262; goto yy53; -yy228: +yy231: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy259; + if (yych == 'e') goto yy263; goto yy53; -yy229: +yy232: rbs_skip(state); yych = peek(state); - if (yych == 'u') goto yy261; + if (yych == 'u') goto yy265; goto yy53; -yy230: +yy233: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy262; + if (yych == 'a') goto yy266; goto yy53; -yy231: +yy234: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy263; + if (yych == 'r') goto yy267; goto yy53; -yy232: +yy235: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy264; + if (yych == 'l') goto yy268; goto yy53; -yy233: +yy236: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy265; + if (yych == 'e') goto yy269; goto yy53; -yy234: +yy237: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy266; + if (yych == 'a') goto yy270; goto yy53; -yy235: +yy238: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy267; + if (yych == 'i') goto yy271; goto yy53; -yy236: +yy239: + rbs_skip(state); + yych = peek(state); + if (yych == 'r') goto yy272; + goto yy53; +yy240: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy237; + if (yych <= '@') goto yy241; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy237; + if (yych == '`') goto yy241; if (yych <= 'z') goto yy52; } } -yy237: +yy241: #line 88 "ext/rbs_extension/lexer.re" { return next_token(state, kSELF); } -#line 1988 "ext/rbs_extension/lexer.c" -yy238: +#line 2008 "ext/rbs_extension/lexer.c" +yy242: rbs_skip(state); yych = peek(state); - if (yych == 'l') goto yy268; + if (yych == 'l') goto yy273; goto yy53; -yy239: +yy243: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy240; + if (yych <= '@') goto yy244; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy240; + if (yych == '`') goto yy244; if (yych <= 'z') goto yy52; } } -yy240: +yy244: #line 100 "ext/rbs_extension/lexer.re" { return next_token(state, kSKIP); } -#line 2016 "ext/rbs_extension/lexer.c" -yy241: +#line 2036 "ext/rbs_extension/lexer.c" +yy245: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy242; + if (yych <= '@') goto yy246; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy242; + if (yych == '`') goto yy246; if (yych <= 'z') goto yy52; } } -yy242: +yy246: #line 91 "ext/rbs_extension/lexer.re" { return next_token(state, kTRUE); } -#line 2039 "ext/rbs_extension/lexer.c" -yy243: +#line 2059 "ext/rbs_extension/lexer.c" +yy247: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy244; + if (yych <= '@') goto yy248; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy244; + if (yych == '`') goto yy248; if (yych <= 'z') goto yy52; } } -yy244: +yy248: #line 92 "ext/rbs_extension/lexer.re" { return next_token(state, kTYPE); } -#line 2062 "ext/rbs_extension/lexer.c" -yy245: +#line 2082 "ext/rbs_extension/lexer.c" +yy249: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy269; + if (yych == 'e') goto yy274; goto yy53; -yy246: +yy250: rbs_skip(state); yych = peek(state); - if (yych == 'p') goto yy270; + if (yych == 'p') goto yy275; goto yy53; -yy247: +yy251: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy248; + if (yych <= '@') goto yy252; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy248; + if (yych == '`') goto yy252; if (yych <= 'z') goto yy52; } } -yy248: +yy252: #line 95 "ext/rbs_extension/lexer.re" { return next_token(state, kVOID); } -#line 2095 "ext/rbs_extension/lexer.c" -yy249: +#line 2115 "ext/rbs_extension/lexer.c" +yy253: rbs_skip(state); yych = peek(state); if (yych <= '@') { - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy271; - goto yy68; + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy276; + goto yy69; } else { - if (yych <= 'F') goto yy271; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy271; - goto yy68; + if (yych <= 'F') goto yy276; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy276; + goto yy69; } -yy250: +yy254: rbs_skip(state); yych = peek(state); if (yych <= '@') { - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy272; - goto yy68; + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy277; + goto yy69; } else { - if (yych <= 'F') goto yy272; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy272; - goto yy68; + if (yych <= 'F') goto yy277; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy277; + goto yy69; } -yy251: +yy255: rbs_skip(state); - goto yy217; -yy252: + goto yy220; +yy256: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy273; - goto yy112; -yy253: + if (yych == 'o') goto yy278; + goto yy113; +yy257: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy254; + if (yych <= '@') goto yy258; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy254; + if (yych == '`') goto yy258; if (yych <= 'z') goto yy52; } } -yy254: +yy258: #line 67 "ext/rbs_extension/lexer.re" { return next_token(state, kALIAS); } -#line 2152 "ext/rbs_extension/lexer.c" -yy255: +#line 2172 "ext/rbs_extension/lexer.c" +yy259: rbs_skip(state); yych = peek(state); if (yych <= 'q') { - if (yych == 'a') goto yy274; + if (yych == 'a') goto yy279; goto yy53; } else { - if (yych <= 'r') goto yy275; - if (yych == 'w') goto yy276; + if (yych <= 'r') goto yy280; + if (yych == 'w') goto yy281; goto yy53; } -yy256: +yy260: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy257; + if (yych <= '@') goto yy261; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy257; + if (yych == '`') goto yy261; if (yych <= 'z') goto yy52; } } -yy257: +yy261: #line 73 "ext/rbs_extension/lexer.re" { return next_token(state, kCLASS); } -#line 2186 "ext/rbs_extension/lexer.c" -yy258: +#line 2206 "ext/rbs_extension/lexer.c" +yy262: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy277; + if (yych == 'd') goto yy282; goto yy53; -yy259: +yy263: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy260; + if (yych <= '@') goto yy264; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy260; + if (yych == '`') goto yy264; if (yych <= 'z') goto yy52; } } -yy260: +yy264: #line 77 "ext/rbs_extension/lexer.re" { return next_token(state, kFALSE); } -#line 2214 "ext/rbs_extension/lexer.c" -yy261: +#line 2234 "ext/rbs_extension/lexer.c" +yy265: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy279; + if (yych == 'd') goto yy284; goto yy53; -yy262: +yy266: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy280; + if (yych == 'n') goto yy285; goto yy53; -yy263: +yy267: rbs_skip(state); yych = peek(state); - if (yych == 'f') goto yy281; + if (yych == 'f') goto yy286; goto yy53; -yy264: +yy268: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy282; + if (yych == 'e') goto yy287; goto yy53; -yy265: +yy269: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy284; + if (yych == 'n') goto yy289; goto yy53; -yy266: +yy270: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy285; + if (yych == 't') goto yy290; goto yy53; -yy267: +yy271: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy286; + if (yych == 'c') goto yy291; goto yy53; -yy268: +yy272: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy288; + if (yych == 'n') goto yy293; goto yy53; -yy269: +yy273: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy289; + if (yych == 'e') goto yy295; goto yy53; -yy270: +yy274: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy290; + if (yych == 'c') goto yy296; goto yy53; -yy271: +yy275: + rbs_skip(state); + yych = peek(state); + if (yych == 'e') goto yy297; + goto yy53; +yy276: rbs_skip(state); yych = peek(state); if (yych <= '@') { - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy66; - goto yy68; + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy67; + goto yy69; } else { - if (yych <= 'F') goto yy66; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy66; - goto yy68; + if (yych <= 'F') goto yy67; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy67; + goto yy69; } -yy272: +yy277: rbs_skip(state); yych = peek(state); if (yych <= '@') { - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy291; - goto yy68; + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy298; + goto yy69; } else { - if (yych <= 'F') goto yy291; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy291; - goto yy68; + if (yych <= 'F') goto yy298; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy298; + goto yy69; } -yy273: +yy278: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy292; - goto yy112; -yy274: + if (yych == '_') goto yy299; + goto yy113; +yy279: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy293; + if (yych == 'c') goto yy300; goto yy53; -yy275: +yy280: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy294; + if (yych == 'e') goto yy301; goto yy53; -yy276: +yy281: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy295; + if (yych == 'r') goto yy302; goto yy53; -yy277: +yy282: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy278; + if (yych <= '@') goto yy283; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy278; + if (yych == '`') goto yy283; if (yych <= 'z') goto yy52; } } -yy278: +yy283: #line 76 "ext/rbs_extension/lexer.re" { return next_token(state, kEXTEND); } -#line 2333 "ext/rbs_extension/lexer.c" -yy279: +#line 2358 "ext/rbs_extension/lexer.c" +yy284: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy296; + if (yych == 'e') goto yy303; goto yy53; -yy280: +yy285: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy298; + if (yych == 'c') goto yy305; goto yy53; -yy281: +yy286: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy299; + if (yych == 'a') goto yy306; goto yy53; -yy282: +yy287: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy283; + if (yych <= '@') goto yy288; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy283; + if (yych == '`') goto yy288; if (yych <= 'z') goto yy52; } } -yy283: +yy288: #line 82 "ext/rbs_extension/lexer.re" { return next_token(state, kMODULE); } -#line 2371 "ext/rbs_extension/lexer.c" -yy284: +#line 2396 "ext/rbs_extension/lexer.c" +yy289: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy300; + if (yych == 'd') goto yy307; goto yy53; -yy285: +yy290: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy302; + if (yych == 'e') goto yy309; goto yy53; -yy286: +yy291: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy287; + if (yych <= '@') goto yy292; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy287; + if (yych == '`') goto yy292; if (yych <= 'z') goto yy52; } } -yy287: +yy292: #line 87 "ext/rbs_extension/lexer.re" { return next_token(state, kPUBLIC); } -#line 2404 "ext/rbs_extension/lexer.c" -yy288: +#line 2429 "ext/rbs_extension/lexer.c" +yy293: + rbs_skip(state); + yych = peek(state); + if (yych <= '=') { + if (yych <= '/') { + if (yych == '!') goto yy109; + } else { + if (yych <= '9') goto yy52; + if (yych >= '=') goto yy110; + } + } else { + if (yych <= '^') { + if (yych <= '@') goto yy294; + if (yych <= 'Z') goto yy52; + } else { + if (yych == '`') goto yy294; + if (yych <= 'z') goto yy52; + } + } +yy294: +#line 101 "ext/rbs_extension/lexer.re" + { return next_token(state, kRETURN); } +#line 2452 "ext/rbs_extension/lexer.c" +yy295: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy304; + if (yych == 't') goto yy311; goto yy53; -yy289: +yy296: rbs_skip(state); yych = peek(state); - if (yych == 'k') goto yy305; + if (yych == 'k') goto yy312; goto yy53; -yy290: +yy297: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy306; + if (yych == 'd') goto yy313; goto yy53; -yy291: +yy298: rbs_skip(state); yych = peek(state); if (yych <= '@') { - if (yych <= '/') goto yy68; - if (yych <= '9') goto yy86; - goto yy68; + if (yych <= '/') goto yy69; + if (yych <= '9') goto yy87; + goto yy69; } else { - if (yych <= 'F') goto yy86; - if (yych <= '`') goto yy68; - if (yych <= 'f') goto yy86; - goto yy68; + if (yych <= 'F') goto yy87; + if (yych <= '`') goto yy69; + if (yych <= 'f') goto yy87; + goto yy69; } -yy292: +yy299: rbs_skip(state); yych = peek(state); - if (yych == '_') goto yy308; - goto yy112; -yy293: + if (yych == '_') goto yy315; + goto yy113; +yy300: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy310; + if (yych == 'c') goto yy317; goto yy53; -yy294: +yy301: rbs_skip(state); yych = peek(state); - if (yych == 'a') goto yy311; + if (yych == 'a') goto yy318; goto yy53; -yy295: +yy302: rbs_skip(state); yych = peek(state); - if (yych == 'i') goto yy312; + if (yych == 'i') goto yy319; goto yy53; -yy296: +yy303: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy297; + if (yych <= '@') goto yy304; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy297; + if (yych == '`') goto yy304; if (yych <= 'z') goto yy52; } } -yy297: +yy304: #line 79 "ext/rbs_extension/lexer.re" { return next_token(state, kINCLUDE); } -#line 2475 "ext/rbs_extension/lexer.c" -yy298: +#line 2523 "ext/rbs_extension/lexer.c" +yy305: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy313; + if (yych == 'e') goto yy320; goto yy53; -yy299: +yy306: rbs_skip(state); yych = peek(state); - if (yych == 'c') goto yy315; + if (yych == 'c') goto yy322; goto yy53; -yy300: +yy307: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy301; + if (yych <= '@') goto yy308; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy301; + if (yych == '`') goto yy308; if (yych <= 'z') goto yy52; } } -yy301: +yy308: #line 85 "ext/rbs_extension/lexer.re" { return next_token(state, kPREPEND); } -#line 2508 "ext/rbs_extension/lexer.c" -yy302: +#line 2556 "ext/rbs_extension/lexer.c" +yy309: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy303; + if (yych <= '@') goto yy310; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy303; + if (yych == '`') goto yy310; if (yych <= 'z') goto yy52; } } -yy303: +yy310: #line 86 "ext/rbs_extension/lexer.re" { return next_token(state, kPRIVATE); } -#line 2531 "ext/rbs_extension/lexer.c" -yy304: +#line 2579 "ext/rbs_extension/lexer.c" +yy311: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy316; + if (yych == 'o') goto yy323; goto yy53; -yy305: +yy312: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy317; + if (yych == 'e') goto yy324; goto yy53; -yy306: +yy313: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy307; + if (yych <= '@') goto yy314; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy307; + if (yych == '`') goto yy314; if (yych <= 'z') goto yy52; } } -yy307: +yy314: #line 94 "ext/rbs_extension/lexer.re" { return next_token(state, kUNTYPED); } -#line 2564 "ext/rbs_extension/lexer.c" -yy308: +#line 2612 "ext/rbs_extension/lexer.c" +yy315: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { - if (yych <= '9') goto yy111; - if (yych >= '=') goto yy109; + if (yych <= '9') goto yy112; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy309; - if (yych <= 'Z') goto yy111; + if (yych <= '@') goto yy316; + if (yych <= 'Z') goto yy112; } else { - if (yych == '`') goto yy309; - if (yych <= 'z') goto yy111; + if (yych == '`') goto yy316; + if (yych <= 'z') goto yy112; } } -yy309: +yy316: #line 98 "ext/rbs_extension/lexer.re" { return next_token(state, k__TODO__); } -#line 2587 "ext/rbs_extension/lexer.c" -yy310: +#line 2635 "ext/rbs_extension/lexer.c" +yy317: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy318; + if (yych == 'e') goto yy325; goto yy53; -yy311: +yy318: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy319; + if (yych == 'd') goto yy326; goto yy53; -yy312: +yy319: rbs_skip(state); yych = peek(state); - if (yych == 't') goto yy320; + if (yych == 't') goto yy327; goto yy53; -yy313: +yy320: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy314; + if (yych <= '@') goto yy321; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy314; + if (yych == '`') goto yy321; if (yych <= 'z') goto yy52; } } -yy314: +yy321: #line 80 "ext/rbs_extension/lexer.re" { return next_token(state, kINSTANCE); } -#line 2625 "ext/rbs_extension/lexer.c" -yy315: +#line 2673 "ext/rbs_extension/lexer.c" +yy322: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy321; + if (yych == 'e') goto yy328; goto yy53; -yy316: +yy323: rbs_skip(state); yych = peek(state); - if (yych == 'n') goto yy323; + if (yych == 'n') goto yy330; goto yy53; -yy317: +yy324: rbs_skip(state); yych = peek(state); - if (yych == 'd') goto yy325; + if (yych == 'd') goto yy332; goto yy53; -yy318: +yy325: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy327; + if (yych == 's') goto yy334; goto yy53; -yy319: +yy326: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy328; + if (yych == 'e') goto yy335; goto yy53; -yy320: +yy327: rbs_skip(state); yych = peek(state); - if (yych == 'e') goto yy329; + if (yych == 'e') goto yy336; goto yy53; -yy321: +yy328: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy322; + if (yych <= '@') goto yy329; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy322; + if (yych == '`') goto yy329; if (yych <= 'z') goto yy52; } } -yy322: +yy329: #line 81 "ext/rbs_extension/lexer.re" { return next_token(state, kINTERFACE); } -#line 2678 "ext/rbs_extension/lexer.c" -yy323: +#line 2726 "ext/rbs_extension/lexer.c" +yy330: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy324; + if (yych <= '@') goto yy331; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy324; + if (yych == '`') goto yy331; if (yych <= 'z') goto yy52; } } -yy324: +yy331: #line 89 "ext/rbs_extension/lexer.re" { return next_token(state, kSINGLETON); } -#line 2701 "ext/rbs_extension/lexer.c" -yy325: +#line 2749 "ext/rbs_extension/lexer.c" +yy332: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy326; + if (yych <= '@') goto yy333; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy326; + if (yych == '`') goto yy333; if (yych <= 'z') goto yy52; } } -yy326: +yy333: #line 93 "ext/rbs_extension/lexer.re" { return next_token(state, kUNCHECKED); } -#line 2724 "ext/rbs_extension/lexer.c" -yy327: +#line 2772 "ext/rbs_extension/lexer.c" +yy334: rbs_skip(state); yych = peek(state); - if (yych == 's') goto yy330; + if (yych == 's') goto yy337; goto yy53; -yy328: +yy335: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy331; + if (yych == 'r') goto yy338; goto yy53; -yy329: +yy336: rbs_skip(state); yych = peek(state); - if (yych == 'r') goto yy333; + if (yych == 'r') goto yy340; goto yy53; -yy330: +yy337: rbs_skip(state); yych = peek(state); - if (yych == 'o') goto yy335; + if (yych == 'o') goto yy342; goto yy53; -yy331: +yy338: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy332; + if (yych <= '@') goto yy339; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy332; + if (yych == '`') goto yy339; if (yych <= 'z') goto yy52; } } -yy332: +yy339: #line 69 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRREADER); } -#line 2767 "ext/rbs_extension/lexer.c" -yy333: +#line 2815 "ext/rbs_extension/lexer.c" +yy340: rbs_skip(state); yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy334; + if (yych <= '@') goto yy341; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy334; + if (yych == '`') goto yy341; if (yych <= 'z') goto yy52; } } -yy334: +yy341: #line 70 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRWRITER); } -#line 2790 "ext/rbs_extension/lexer.c" -yy335: +#line 2838 "ext/rbs_extension/lexer.c" +yy342: rbs_skip(state); yych = peek(state); if (yych != 'r') goto yy53; @@ -2795,25 +2843,25 @@ token rbsparser_next_token(lexstate *state) { yych = peek(state); if (yych <= '=') { if (yych <= '/') { - if (yych == '!') goto yy108; + if (yych == '!') goto yy109; } else { if (yych <= '9') goto yy52; - if (yych >= '=') goto yy109; + if (yych >= '=') goto yy110; } } else { if (yych <= '^') { - if (yych <= '@') goto yy336; + if (yych <= '@') goto yy343; if (yych <= 'Z') goto yy52; } else { - if (yych == '`') goto yy336; + if (yych == '`') goto yy343; if (yych <= 'z') goto yy52; } } -yy336: +yy343: #line 68 "ext/rbs_extension/lexer.re" { return next_token(state, kATTRACCESSOR); } -#line 2816 "ext/rbs_extension/lexer.c" +#line 2864 "ext/rbs_extension/lexer.c" } -#line 149 "ext/rbs_extension/lexer.re" +#line 150 "ext/rbs_extension/lexer.re" } diff --git a/ext/rbs_extension/lexer.h b/ext/rbs_extension/lexer.h index 6a0d71b8b..b073f373d 100644 --- a/ext/rbs_extension/lexer.h +++ b/ext/rbs_extension/lexer.h @@ -63,6 +63,7 @@ enum TokenType { k__TODO__, /* __todo__ */ kATRBS, /* @rbs */ kSKIP, /* skip */ + kRETURN, /* return */ tLIDENT, /* Identifiers starting with lower case */ tUIDENT, /* Identifiers starting with upper case */ diff --git a/ext/rbs_extension/lexer.re b/ext/rbs_extension/lexer.re index ef0e09503..cbcef13bd 100644 --- a/ext/rbs_extension/lexer.re +++ b/ext/rbs_extension/lexer.re @@ -98,6 +98,7 @@ token rbsparser_next_token(lexstate *state) { "__todo__" { return next_token(state, k__TODO__); } "@rbs" { return next_token(state, kATRBS); } "skip" { return next_token(state, kSKIP); } + "return" { return next_token(state, kRETURN); } unicode_char = "\\u" [0-9a-fA-F]{4}; oct_char = "\\x" [0-9a-f]{1,2}; diff --git a/ext/rbs_extension/lexstate.c b/ext/rbs_extension/lexstate.c index cb1cc7234..1d20a3f81 100644 --- a/ext/rbs_extension/lexstate.c +++ b/ext/rbs_extension/lexstate.c @@ -62,6 +62,7 @@ static const char *RBS_TOKENTYPE_NAMES[] = { "k__TODO__", /* __todo__ */ "kATRBS", /* @rbs */ "kSKIP", /* skip */ + "kRETURN", /* return */ "tLIDENT", /* Identifiers starting with lower case */ "tUIDENT", /* Identifiers starting with upper case */ diff --git a/ext/rbs_extension/parser.c b/ext/rbs_extension/parser.c index 9b2758a73..8249de4e1 100644 --- a/ext/rbs_extension/parser.c +++ b/ext/rbs_extension/parser.c @@ -49,6 +49,7 @@ case kAS: \ case k__TODO__: \ case kSKIP: \ + case kRETURN: \ /* nop */ typedef struct { @@ -190,6 +191,7 @@ static VALUE parse_type_name(parserstate *state, TypeNameKind kind, range *rg) { switch (state->current_token.type) { case tLIDENT: case kSKIP: + case kRETURN: if (kind & ALIAS_NAME) goto success; goto error; case tULIDENT: @@ -901,6 +903,7 @@ static VALUE parse_instance_type(parserstate *state, bool parse_alias) { break; } case kSKIP: + case kRETURN: case tLIDENT: { kind = ALIAS_NAME; break; @@ -1065,6 +1068,7 @@ static VALUE parse_simple(parserstate *state) { case tULIDENT: // fallthrough case tLIDENT: // fallthrough case kSKIP: // fallthrough + case kRETURN: // fallthrough case pCOLON2: { return parse_instance_type(state, true); } diff --git a/test/rbs/signature_parsing_test.rb b/test/rbs/signature_parsing_test.rb index f8eb0f974..de7ac56ea 100644 --- a/test/rbs/signature_parsing_test.rb +++ b/test/rbs/signature_parsing_test.rb @@ -2304,4 +2304,17 @@ def skip: (untyped skip) -> void end RBS end + + def test_inline_keyword__return + Parser.parse_signature(<<~RBS) + class Foo + def return: (untyped return) -> void + attr_reader return: untyped + + type return = untyped + + @foo: Array[return] + end + RBS + end end From b657e8038edaf1d7fc5a33d2ea63eab89c5448f1 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 15 Apr 2025 12:56:21 +0900 Subject: [PATCH 27/48] Implement parser --- ext/rbs_extension/parser.c | 20 ++++++++++++++++++++ test/rbs/inline_annotation_parsing_test.rb | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/ext/rbs_extension/parser.c b/ext/rbs_extension/parser.c index 8249de4e1..78b50b0b8 100644 --- a/ext/rbs_extension/parser.c +++ b/ext/rbs_extension/parser.c @@ -2992,6 +2992,26 @@ static VALUE parse_inline_leading_annotation(parserstate *state) { comment_loc ); } + case kRETURN: { + parser_advance(state); + + range return_loc = state->current_token.range; + parser_advance_assert(state, pCOLON); + range colon_loc = state->current_token.range; + + VALUE return_type = parse_type(state); + + VALUE comment_loc = parse_inline_comment(state); + + return rbs_ast_ruby_annotations_return_type_annotation( + rbs_new_location(state->buffer, (range) { .start = rbs_range.start, .end = state->current_token.range.end }), + rbs_new_location(state->buffer, rbs_range), + rbs_new_location(state->buffer, return_loc), + rbs_new_location(state->buffer, colon_loc), + return_type, + comment_loc + ); + } default: { raise_syntax_error( state, diff --git a/test/rbs/inline_annotation_parsing_test.rb b/test/rbs/inline_annotation_parsing_test.rb index 336e152ca..1fef5ff51 100644 --- a/test/rbs/inline_annotation_parsing_test.rb +++ b/test/rbs/inline_annotation_parsing_test.rb @@ -95,4 +95,24 @@ def test_parse__skip assert_equal "-- some comment here", annot.comment_location.source end end + + def test_parse__return + Parser.parse_inline_leading_annotation("@rbs return: untyped", 0...).tap do |annot| + assert_instance_of AST::Ruby::Annotations::ReturnTypeAnnotation, annot + assert_equal "@rbs return: untyped", annot.location.source + assert_equal "return", annot.return_location.source + assert_equal ":", annot.colon_location.source + assert_equal "untyped", annot.return_type.location.source + assert_nil annot.comment_location + end + + Parser.parse_inline_leading_annotation("@rbs return: untyped -- some comment here", 0...).tap do |annot| + assert_instance_of AST::Ruby::Annotations::ReturnTypeAnnotation, annot + assert_equal "@rbs return: untyped -- some comment here", annot.location.source + assert_equal "return", annot.return_location.source + assert_equal ":", annot.colon_location.source + assert_equal "untyped", annot.return_type.location.source + assert_equal "-- some comment here", annot.comment_location.source + end + end end From 8be0331ba744aa26abf90d298ac6de5d7745df21 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 15 Apr 2025 13:08:21 +0900 Subject: [PATCH 28/48] Update members --- lib/rbs/ast/ruby/members.rb | 69 +++++++++++++++++++++++++++++----- sig/ast/ruby/members.rbs | 12 +++++- test/rbs/inline_parser_test.rb | 20 ++++++++++ 3 files changed, 91 insertions(+), 10 deletions(-) diff --git a/lib/rbs/ast/ruby/members.rb b/lib/rbs/ast/ruby/members.rb index 082d11713..e4cf7d00b 100644 --- a/lib/rbs/ast/ruby/members.rb +++ b/lib/rbs/ast/ruby/members.rb @@ -15,6 +15,50 @@ def initialize(buffer) end class MethodTypeAnnotation + class DocStyle + attr_accessor :return_type_annotation + + def initialize + @return_type_annotation = nil + end + + def map_type_name(&block) + DocStyle.new.tap do |new| + new.return_type_annotation = return_type_annotation&.map_type_name(&block) + end #: self + end + + def method_type + return_type = + case return_type_annotation + when Annotations::NodeTypeAssertion + return_type_annotation.type + when Annotations::ReturnTypeAnnotation + return_type_annotation.return_type + else + Types::Bases::Any.new(location: nil) + end + + type = Types::Function.new( + required_positionals: [], + optional_positionals: [], + rest_positionals: nil, + trailing_positionals: [], + required_keywords: {}, + optional_keywords: {}, + rest_keywords: nil, + return_type: return_type + ) + + MethodType.new( + type_params: [], + type: type, + block: nil, + location: nil + ) + end + end + attr_reader :type_annotations def initialize(type_annotations:) @@ -27,7 +71,7 @@ def map_type_name(&block) updated_annots = type_annotations.map do |annotation| annotation.map_type_name(&block) end - when Annotations::NodeTypeAssertion + when DocStyle updated_annots = type_annotations.map_type_name(&block) end @@ -43,7 +87,8 @@ def self.build(leading_block, trailing_block, variables) if trailing_block case annotation = trailing_block.trailing_annotation(variables) when Annotations::NodeTypeAssertion - type_annotations = annotation + type_annotations = DocStyle.new() + type_annotations.return_type_annotation = annotation else unused_trailing_annotation = annotation end @@ -65,6 +110,17 @@ def self.build(leading_block, trailing_block, variables) type_annotations << paragraph next end + when Annotations::ReturnTypeAnnotation + unless type_annotations + type_annotations = DocStyle.new() + end + + if type_annotations.is_a?(DocStyle) + unless type_annotations.return_type_annotation + type_annotations.return_type_annotation = paragraph + next + end + end end unused_annotations << paragraph @@ -86,13 +142,8 @@ def empty? def overloads case type_annotations - when Annotations::NodeTypeAssertion - method_type = MethodType.new( - type_params: [], - type: Types::Function.empty(type_annotations.type), - block: nil, - location: nil - ) + when DocStyle + method_type = type_annotations.method_type [ AST::Members::MethodDefinition::Overload.new(annotations: [], method_type: method_type) diff --git a/sig/ast/ruby/members.rbs b/sig/ast/ruby/members.rbs index cf3cebd68..82452460f 100644 --- a/sig/ast/ruby/members.rbs +++ b/sig/ast/ruby/members.rbs @@ -13,7 +13,17 @@ module RBS type t = DefMember class MethodTypeAnnotation - type type_annotations = Annotations::NodeTypeAssertion | Array[Annotations::ColonMethodTypeAnnotation | Annotations::MethodTypesAnnotation] | nil + class DocStyle + attr_accessor return_type_annotation: Annotations::ReturnTypeAnnotation | Annotations::NodeTypeAssertion | nil + + def initialize: () -> void + + def map_type_name: () { (TypeName) -> TypeName } -> self + + def method_type: () -> MethodType + end + + type type_annotations = DocStyle | Array[Annotations::ColonMethodTypeAnnotation | Annotations::MethodTypesAnnotation] | nil attr_reader type_annotations: type_annotations diff --git a/test/rbs/inline_parser_test.rb b/test/rbs/inline_parser_test.rb index 32d4b4393..2090b42a1 100644 --- a/test/rbs/inline_parser_test.rb +++ b/test/rbs/inline_parser_test.rb @@ -267,4 +267,24 @@ def foo assert_empty decl.members end end + + def test_parse__return_type + result = parse(<<~RUBY) + class Foo + # @rbs return: void + def foo + end + end + RUBY + + assert_empty result.diagnostics + + result.declarations[0].tap do |decl| + decl.members[0].tap do |member| + assert_instance_of RBS::AST::Ruby::Members::DefMember, member + assert_instance_of Array, member.annotations + assert_equal ["() -> void"], member.overloads.map { _1.method_type.to_s } + end + end + end end From f8f94e2ce5cbd5f4382d040c5e7f0a64ef7918cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 06:07:45 +0000 Subject: [PATCH 29/48] Bump rake-compiler from 1.2.9 to 1.3.0 Bumps [rake-compiler](https://github.com/luislavena/rake-compiler) from 1.2.9 to 1.3.0. - [Release notes](https://github.com/luislavena/rake-compiler/releases) - [Changelog](https://github.com/rake-compiler/rake-compiler/blob/master/History.md) - [Commits](https://github.com/luislavena/rake-compiler/compare/v1.2.9...v1.3.0) --- updated-dependencies: - dependency-name: rake-compiler dependency-version: 1.3.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 86cbe0495..5cc62e61f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,7 +90,7 @@ GEM racc (1.8.1) rainbow (3.1.1) rake (13.2.1) - rake-compiler (1.2.9) + rake-compiler (1.3.0) rake rb-fsevent (0.11.2) rb-inotify (0.11.1) From c7cbf428b93e6744db855f96d703c25e81d3d11f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 06:07:54 +0000 Subject: [PATCH 30/48] Bump csv from 3.3.3 to 3.3.4 Bumps [csv](https://github.com/ruby/csv) from 3.3.3 to 3.3.4. - [Release notes](https://github.com/ruby/csv/releases) - [Changelog](https://github.com/ruby/csv/blob/main/NEWS.md) - [Commits](https://github.com/ruby/csv/compare/v3.3.3...v3.3.4) --- updated-dependencies: - dependency-name: csv dependency-version: 3.3.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 86cbe0495..42f36bef7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -35,7 +35,7 @@ GEM bigdecimal (3.1.9) concurrent-ruby (1.3.5) connection_pool (2.5.0) - csv (3.3.3) + csv (3.3.4) dbm (1.1.0) diff-lcs (1.6.1) digest (3.2.0) From d17c2c4ae42f0ba30fce70d5b9293acf1185ebc6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 06:28:57 +0000 Subject: [PATCH 31/48] Bump parser from 3.3.7.4 to 3.3.8.0 in /steep Bumps [parser](https://github.com/whitequark/parser) from 3.3.7.4 to 3.3.8.0. - [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/whitequark/parser/compare/v3.3.7.4...v3.3.8.0) --- updated-dependencies: - dependency-name: parser dependency-version: 3.3.8.0 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index e6d100053..783519ccb 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -34,7 +34,7 @@ GEM logger (1.7.0) minitest (5.25.5) mutex_m (0.3.0) - parser (3.3.7.4) + parser (3.3.8.0) ast (~> 2.4.1) racc power_assert (2.0.5) From 8f9e78b26669aea1bd359db94794c0180d2a6a5d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 06:29:18 +0000 Subject: [PATCH 32/48] Bump sorbet-runtime from 0.5.12003 to 0.5.12016 in /steep Bumps [sorbet-runtime](https://github.com/sorbet/sorbet) from 0.5.12003 to 0.5.12016. - [Release notes](https://github.com/sorbet/sorbet/releases) - [Commits](https://github.com/sorbet/sorbet/commits) --- updated-dependencies: - dependency-name: sorbet-runtime dependency-version: 0.5.12016 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index e6d100053..96c7edbac 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -52,7 +52,7 @@ GEM rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) securerandom (0.4.1) - sorbet-runtime (0.5.12003) + sorbet-runtime (0.5.12016) steep (1.10.0) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) From f42da4f3dccf01c87276be1c0777b551f2ab4f1c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 06:48:27 +0000 Subject: [PATCH 33/48] Bump ffi from 1.17.1 to 1.17.2 Bumps [ffi](https://github.com/ffi/ffi) from 1.17.1 to 1.17.2. - [Changelog](https://github.com/ffi/ffi/blob/master/CHANGELOG.md) - [Commits](https://github.com/ffi/ffi/compare/v1.17.1...v1.17.2) --- updated-dependencies: - dependency-name: ffi dependency-version: 1.17.2 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0cc98e7b7..fa6f8eabd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,7 +40,7 @@ GEM diff-lcs (1.6.1) digest (3.2.0) drb (2.2.1) - ffi (1.17.1) + ffi (1.17.2) fileutils (1.7.3) goodcheck (3.1.0) marcel (>= 1.0, < 2.0) From 8aa70f9126cce86b2e5751f45136a271ed113ca2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 06:51:46 +0000 Subject: [PATCH 34/48] Bump ffi from 1.17.1 to 1.17.2 in /steep Bumps [ffi](https://github.com/ffi/ffi) from 1.17.1 to 1.17.2. - [Changelog](https://github.com/ffi/ffi/blob/master/CHANGELOG.md) - [Commits](https://github.com/ffi/ffi/compare/v1.17.1...v1.17.2) --- updated-dependencies: - dependency-name: ffi dependency-version: 1.17.2 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index 146ebca76..5b13e1388 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -22,7 +22,7 @@ GEM connection_pool (2.5.0) csv (3.3.4) drb (2.2.1) - ffi (1.17.1) + ffi (1.17.2) fileutils (1.7.3) i18n (1.14.7) concurrent-ruby (~> 1.0) From 80fd00f41756bbdb65c13a17199bd1b2084ac831 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 06:51:58 +0000 Subject: [PATCH 35/48] Bump sorbet-runtime from 0.5.12016 to 0.5.12017 in /steep Bumps [sorbet-runtime](https://github.com/sorbet/sorbet) from 0.5.12016 to 0.5.12017. - [Release notes](https://github.com/sorbet/sorbet/releases) - [Commits](https://github.com/sorbet/sorbet/commits) --- updated-dependencies: - dependency-name: sorbet-runtime dependency-version: 0.5.12017 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index 146ebca76..9c31ac096 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -52,7 +52,7 @@ GEM rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) securerandom (0.4.1) - sorbet-runtime (0.5.12016) + sorbet-runtime (0.5.12017) steep (1.10.0) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) From 3a8999900042a2c7ab6f44fe9aeb1cfe8759fbc9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 06:41:56 +0000 Subject: [PATCH 36/48] Bump sorbet-runtime from 0.5.12017 to 0.5.12020 in /steep Bumps [sorbet-runtime](https://github.com/sorbet/sorbet) from 0.5.12017 to 0.5.12020. - [Release notes](https://github.com/sorbet/sorbet/releases) - [Commits](https://github.com/sorbet/sorbet/commits) --- updated-dependencies: - dependency-name: sorbet-runtime dependency-version: 0.5.12020 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index 3982492ce..05cc723f8 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -52,7 +52,7 @@ GEM rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) securerandom (0.4.1) - sorbet-runtime (0.5.12017) + sorbet-runtime (0.5.12020) steep (1.10.0) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) From 8fe40cca868bf36b3f25438f224e79340e35a76b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 06:42:01 +0000 Subject: [PATCH 37/48] Bump connection_pool from 2.5.0 to 2.5.1 in /steep Bumps [connection_pool](https://github.com/mperham/connection_pool) from 2.5.0 to 2.5.1. - [Changelog](https://github.com/mperham/connection_pool/blob/main/Changes.md) - [Commits](https://github.com/mperham/connection_pool/compare/v2.5.0...v2.5.1) --- updated-dependencies: - dependency-name: connection_pool dependency-version: 2.5.1 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index 3982492ce..bff6d0afb 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -19,7 +19,7 @@ GEM benchmark (0.4.0) bigdecimal (3.1.9) concurrent-ruby (1.3.5) - connection_pool (2.5.0) + connection_pool (2.5.1) csv (3.3.4) drb (2.2.1) ffi (1.17.2) From dc95f43a86fd5863f4fd9458055a855b7def0efa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 06:52:46 +0000 Subject: [PATCH 38/48] Bump connection_pool from 2.5.0 to 2.5.1 Bumps [connection_pool](https://github.com/mperham/connection_pool) from 2.5.0 to 2.5.1. - [Changelog](https://github.com/mperham/connection_pool/blob/main/Changes.md) - [Commits](https://github.com/mperham/connection_pool/compare/v2.5.0...v2.5.1) --- updated-dependencies: - dependency-name: connection_pool dependency-version: 2.5.1 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index fa6f8eabd..491016426 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,7 +34,7 @@ GEM benchmark-ips (2.14.0) bigdecimal (3.1.9) concurrent-ruby (1.3.5) - connection_pool (2.5.0) + connection_pool (2.5.1) csv (3.3.4) dbm (1.1.0) diff-lcs (1.6.1) From 2ce069da3138919b4a826fc54c4055f1bfb6374c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 06:40:56 +0000 Subject: [PATCH 39/48] Bump sorbet-runtime from 0.5.12020 to 0.5.12024 in /steep Bumps [sorbet-runtime](https://github.com/sorbet/sorbet) from 0.5.12020 to 0.5.12024. - [Release notes](https://github.com/sorbet/sorbet/releases) - [Commits](https://github.com/sorbet/sorbet/commits) --- updated-dependencies: - dependency-name: sorbet-runtime dependency-version: 0.5.12024 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index 2f50d394c..6bef1664e 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -52,7 +52,7 @@ GEM rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) securerandom (0.4.1) - sorbet-runtime (0.5.12020) + sorbet-runtime (0.5.12024) steep (1.10.0) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) From 09aaa3fcb41d7eff3431ca926f9d35499ecc6cfb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 07:30:51 +0000 Subject: [PATCH 40/48] Bump sorbet-runtime from 0.5.12024 to 0.5.12026 in /steep Bumps [sorbet-runtime](https://github.com/sorbet/sorbet) from 0.5.12024 to 0.5.12026. - [Release notes](https://github.com/sorbet/sorbet/releases) - [Commits](https://github.com/sorbet/sorbet/commits) --- updated-dependencies: - dependency-name: sorbet-runtime dependency-version: 0.5.12026 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index 6bef1664e..91e40d9f2 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -52,7 +52,7 @@ GEM rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) securerandom (0.4.1) - sorbet-runtime (0.5.12024) + sorbet-runtime (0.5.12026) steep (1.10.0) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) From 269476e979454bcbdcfba97851fecff7e3401df1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 07:45:36 +0000 Subject: [PATCH 41/48] Bump stringio from 3.1.6 to 3.1.7 Bumps [stringio](https://github.com/ruby/stringio) from 3.1.6 to 3.1.7. - [Release notes](https://github.com/ruby/stringio/releases) - [Changelog](https://github.com/ruby/stringio/blob/master/NEWS.md) - [Commits](https://github.com/ruby/stringio/compare/v3.1.6...v3.1.7) --- updated-dependencies: - dependency-name: stringio dependency-version: 3.1.7 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 491016426..99c192f63 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -155,7 +155,7 @@ GEM strscan (>= 1.0.0) terminal-table (>= 2, < 5) uri (>= 0.12.0) - stringio (3.1.6) + stringio (3.1.7) strong_json (2.1.2) strscan (3.1.3) tempfile (0.3.1) From 1086df328dd4dcfff2a0d98f3a3ece6cd31ec775 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 04:57:18 +0000 Subject: [PATCH 42/48] Bump nokogiri from 1.18.7 to 1.18.8 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.7 to 1.18.8. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.7...v1.18.8) --- updated-dependencies: - dependency-name: nokogiri dependency-version: 1.18.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 99c192f63..9791d5a94 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -69,7 +69,7 @@ GEM net-smtp (0.5.1) net-protocol nkf (0.2.0) - nokogiri (1.18.7) + nokogiri (1.18.8) mini_portile2 (~> 2.8.2) racc (~> 1.4) ostruct (0.6.1) From ba8b2d474ee778d98009cfd4c0fdb3e3302f79b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 06:13:50 +0000 Subject: [PATCH 43/48] Bump sorbet-runtime from 0.5.12026 to 0.5.12028 in /steep Bumps [sorbet-runtime](https://github.com/sorbet/sorbet) from 0.5.12026 to 0.5.12028. - [Release notes](https://github.com/sorbet/sorbet/releases) - [Commits](https://github.com/sorbet/sorbet/commits) --- updated-dependencies: - dependency-name: sorbet-runtime dependency-version: 0.5.12028 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index 91e40d9f2..96937eb45 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -52,7 +52,7 @@ GEM rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) securerandom (0.4.1) - sorbet-runtime (0.5.12026) + sorbet-runtime (0.5.12028) steep (1.10.0) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) From 8bb5f050643b94dea5e4d77e3f3b1c5053b2c494 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 06:10:01 +0000 Subject: [PATCH 44/48] Bump sorbet-runtime from 0.5.12028 to 0.5.12032 in /steep Bumps [sorbet-runtime](https://github.com/sorbet/sorbet) from 0.5.12028 to 0.5.12032. - [Release notes](https://github.com/sorbet/sorbet/releases) - [Commits](https://github.com/sorbet/sorbet/commits) --- updated-dependencies: - dependency-name: sorbet-runtime dependency-version: 0.5.12032 dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- steep/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steep/Gemfile.lock b/steep/Gemfile.lock index 96937eb45..2ea4724aa 100644 --- a/steep/Gemfile.lock +++ b/steep/Gemfile.lock @@ -52,7 +52,7 @@ GEM rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) securerandom (0.4.1) - sorbet-runtime (0.5.12028) + sorbet-runtime (0.5.12032) steep (1.10.0) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) From 4301777532e9ee9443bc00e346de7f296523523b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 06:34:20 +0000 Subject: [PATCH 45/48] Bump rubocop from 1.75.2 to 1.75.3 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.75.2 to 1.75.3. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.75.2...v1.75.3) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.75.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9791d5a94..cf1190bbe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,7 +73,7 @@ GEM mini_portile2 (~> 2.8.2) racc (~> 1.4) ostruct (0.6.1) - parallel (1.26.3) + parallel (1.27.0) parser (3.3.8.0) ast (~> 2.4.1) racc @@ -111,7 +111,7 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.2) - rubocop (1.75.2) + rubocop (1.75.3) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) From 0a8a4c52a7f3a8b7ed69b81a36f5eda1b326e80b Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Wed, 30 Apr 2025 21:23:00 +0800 Subject: [PATCH 46/48] Apply suggestions from code review Co-authored-by: Alexander Momchilov --- ext/rbs_extension/main.c | 10 +++++----- src/parser.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ext/rbs_extension/main.c b/ext/rbs_extension/main.c index 9dbb3747c..8ab04615d 100644 --- a/ext/rbs_extension/main.c +++ b/ext/rbs_extension/main.c @@ -273,7 +273,7 @@ static VALUE rbsparser_parse_signature(VALUE self, VALUE buffer, VALUE start_pos } static VALUE parse_inline_leading_annotation_try(VALUE a) { - struct parse_type_arg *arg = (struct parse_type_arg *)a; + struct parse_type_arg *arg = (struct parse_type_arg *) a; rbs_parser_t *parser = arg->parser; rbs_ast_ruby_annotations_t *annotation = NULL; @@ -291,7 +291,7 @@ static VALUE parse_inline_leading_annotation_try(VALUE a) { arg->encoding ); - return rbs_struct_to_ruby_value(ctx, (rbs_node_t *)annotation); + return rbs_struct_to_ruby_value(ctx, (rbs_node_t *) annotation); } static VALUE rbsparser_parse_inline_leading_annotation(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos, VALUE variables) { @@ -316,7 +316,7 @@ static VALUE rbsparser_parse_inline_leading_annotation(VALUE self, VALUE buffer, } static VALUE parse_inline_trailing_annotation_try(VALUE a) { - struct parse_type_arg *arg = (struct parse_type_arg *)a; + struct parse_type_arg *arg = (struct parse_type_arg *) a; rbs_parser_t *parser = arg->parser; rbs_ast_ruby_annotations_t *annotation = NULL; @@ -334,7 +334,7 @@ static VALUE parse_inline_trailing_annotation_try(VALUE a) { arg->encoding ); - return rbs_struct_to_ruby_value(ctx, (rbs_node_t *)annotation); + return rbs_struct_to_ruby_value(ctx, (rbs_node_t *) annotation); } static VALUE rbsparser_parse_inline_trailing_annotation(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos, VALUE variables) { @@ -351,7 +351,7 @@ static VALUE rbsparser_parse_inline_trailing_annotation(VALUE self, VALUE buffer .require_eof = Qfalse }; - VALUE result = rb_ensure(parse_inline_trailing_annotation_try, (VALUE)&arg, ensure_free_parser, (VALUE)parser); + VALUE result = rb_ensure(parse_inline_trailing_annotation_try, (VALUE) &arg, ensure_free_parser, (VALUE) parser); RB_GC_GUARD(string); diff --git a/src/parser.c b/src/parser.c index ced60ead1..557edcd18 100644 --- a/src/parser.c +++ b/src/parser.c @@ -3509,9 +3509,9 @@ static bool parse_inline_method_overloads(rbs_parser_t *parser, rbs_node_list_t ALLOCATOR(), location, annotations, - (rbs_node_t*)method_type + (rbs_node_t *) method_type ); - rbs_node_list_append(overloads, (rbs_node_t*)overload); + rbs_node_list_append(overloads, (rbs_node_t *) overload); if (parser->next_token.type == pBAR) { rbs_location_t *bar_location = rbs_location_new(ALLOCATOR(), parser->next_token.range); @@ -3564,12 +3564,12 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a rbs_location_t *full_loc = rbs_location_new(ALLOCATOR(), full_range); rbs_location_t *colon_loc = rbs_location_new(ALLOCATOR(), colon_range); - *annotation = (rbs_ast_ruby_annotations_t*)rbs_ast_ruby_annotations_colon_method_type_annotation_new( + *annotation = (rbs_ast_ruby_annotations_t *) rbs_ast_ruby_annotations_colon_method_type_annotation_new( ALLOCATOR(), full_loc, colon_loc, annotations, - (rbs_node_t*)method_type + (rbs_node_t *) method_type ); return true; } @@ -3597,7 +3597,7 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a rbs_location_t *full_loc = rbs_location_new(ALLOCATOR(), full_range); rbs_location_t *rbs_loc = rbs_location_new(ALLOCATOR(), rbs_range); - *annotation = (rbs_ast_ruby_annotations_t*)rbs_ast_ruby_annotations_method_types_annotation_new( + *annotation = (rbs_ast_ruby_annotations_t *) rbs_ast_ruby_annotations_method_types_annotation_new( ALLOCATOR(), full_loc, rbs_loc, @@ -3625,7 +3625,7 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a rbs_location_t *full_loc = rbs_location_new(ALLOCATOR(), full_range); rbs_location_t *rbs_loc = rbs_location_new(ALLOCATOR(), rbs_range); - *annotation = (rbs_ast_ruby_annotations_t*)rbs_ast_ruby_annotations_skip_annotation_new( + *annotation = (rbs_ast_ruby_annotations_t *) rbs_ast_ruby_annotations_skip_annotation_new( ALLOCATOR(), full_loc, rbs_loc, @@ -3663,7 +3663,7 @@ static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_a rbs_location_t *full_loc = rbs_location_new(ALLOCATOR(), full_range); rbs_location_t *rbs_loc = rbs_location_new(ALLOCATOR(), rbs_range); - *annotation = (rbs_ast_ruby_annotations_t*)rbs_ast_ruby_annotations_return_type_annotation_new( + *annotation = (rbs_ast_ruby_annotations_t *) rbs_ast_ruby_annotations_return_type_annotation_new( ALLOCATOR(), full_loc, rbs_loc, @@ -3708,7 +3708,7 @@ static bool parse_inline_trailing_annotation(rbs_parser_t *parser, rbs_ast_ruby_ rbs_location_t *full_loc = rbs_location_new(ALLOCATOR(), full_range); rbs_location_t *prefix_loc = rbs_location_new(ALLOCATOR(), prefix_range); - *annotation = (rbs_ast_ruby_annotations_t*)rbs_ast_ruby_annotations_node_type_assertion_new( + *annotation = (rbs_ast_ruby_annotations_t *) rbs_ast_ruby_annotations_node_type_assertion_new( ALLOCATOR(), full_loc, prefix_loc, From a9e77021ee01723ea905d1756ad7f5af5b8a4205 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Wed, 30 Apr 2025 21:23:30 +0800 Subject: [PATCH 47/48] Update src/parser.c Co-authored-by: Alexander Momchilov --- src/parser.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/parser.c b/src/parser.c index 557edcd18..505c677f5 100644 --- a/src/parser.c +++ b/src/parser.c @@ -3529,15 +3529,15 @@ static bool parse_inline_method_overloads(rbs_parser_t *parser, rbs_node_list_t NODISCARD static bool parse_inline_comment(rbs_parser_t *parser, rbs_location_t **comment) { - if (parser->next_token.type == tINLINECOMMENT) { - rbs_range_t comment_range = parser->next_token.range; - rbs_parser_advance(parser); - - *comment = rbs_location_new(ALLOCATOR(), comment_range); + if (parser->next_token.type != tINLINECOMMENT) { + *comment = NULL; return true; } - *comment = NULL; + rbs_range_t comment_range = parser->next_token.range; + rbs_parser_advance(parser); + + *comment = rbs_location_new(ALLOCATOR(), comment_range); return true; } From 514745b3789d5d8ad6e69794c4746a4e831d25db Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Wed, 30 Apr 2025 21:24:11 +0800 Subject: [PATCH 48/48] Update src/parser.c --- src/parser.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/parser.c b/src/parser.c index 505c677f5..5b559e40a 100644 --- a/src/parser.c +++ b/src/parser.c @@ -3545,7 +3545,6 @@ NODISCARD static bool parse_inline_leading_annotation(rbs_parser_t *parser, rbs_ast_ruby_annotations_t **annotation) { switch (parser->next_token.type) { case pCOLON: { - // : rbs_range_t colon_range = parser->next_token.range; rbs_parser_advance(parser);