Commit 534a687a authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Inlined comment predicates.

skip_white_and_comments makes now less method calls.
parent 9930b8f7
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -152,24 +152,20 @@ module JsDuck

    def skip_white_and_comments
      skip_white
      while multiline_comment? || line_comment? do
        if multiline_comment?
      while true do
        if @input.check(/\/\*[^*]/)
          # skip multiline comment
          @input.scan_until(/\*\/|\Z/)
        elsif line_comment?
        elsif @input.check(/\/\//)
          # skip line comment
          @input.scan_until(/\n|\Z/)
        else
          break
        end
        skip_white
      end
    end

    def multiline_comment?
      @input.check(/\/\*[^*]/)
    end

    def line_comment?
      @input.check(/\/\//)
    end

    def skip_white
      @input.scan(/\s+/)
    end