Class: Issuesrc::TagFinders::BluntTagFinder::CommentFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/tag_finders/blunt_tag_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(body, comment_markers, string_markers) ⇒ CommentFinder

Returns a new instance of CommentFinder.



84
85
86
87
88
89
90
91
# File 'lib/tag_finders/blunt_tag_finder.rb', line 84

def initialize(body, comment_markers, string_markers)
  @body = body
  @comment_markers = comment_markers
  @string_markers = string_markers

  @pos = 0
  @nline = 1
end

Instance Method Details

#eachObject



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/tag_finders/blunt_tag_finder.rb', line 93

def each
  state = :init
  while !@body.empty?
    case state
    when :init
      consumed, state = consume_init()
      @pos += consumed
    when :string
      consumed, state = consume_string()
      @pos += consumed
    when :comment
      nline = @nline
      lex, consumed, state = read_comment()
      yield [lex, nline, @pos]
      @pos += consumed
    end
  end
end