lib/lazydoc/utils.rb in lazydoc-0.3.0 vs lib/lazydoc/utils.rb in lazydoc-0.3.1

- old
+ new

@@ -83,11 +83,12 @@ scanner.skip(/\s*\(?\s*/) args = [] brakets = braces = parens = 0 start = scanner.pos - broke = while scanner.skip(/.*?['"#,\(\)\{\}\[\]]/) + broke = false + while scanner.skip(/.*?['"#,\(\)\{\}\[\]]/) pos = scanner.pos - 1 case str[pos] when ?,,nil # skip if in brakets, braces, or parenthesis @@ -95,16 +96,18 @@ # ok, found an arg args << str[start, pos-start].strip start = pos + 1 - when ?# then break(true) # break on a comment + when ?# then broke = true; break # break on a comment when ?' then skip_quote(scanner, /'/) # parse over quoted strings when ?" then skip_quote(scanner, /"/) # parse over double-quoted string when ?( then parens += 1 # for brakets, braces, and parenthesis when ?) # simply track the nesting EXCEPT for - break(true) if parens == 0 # RPAREN. If the closing parenthesis + if parens == 0 # RPAREN. If the closing parenthesis + broke = true; break + end parens -= 1 # is found, break. when ?[ then braces += 1 when ?] then braces -= 1 when ?{ then brakets += 1 when ?} then brakets -= 1 \ No newline at end of file