Permalink
Browse files

Allow [] anywhere in tomdoc arguments

  • Loading branch information...
1 parent 5c0c24a commit 2f95bda659aec51bf6044c136b98977dc7855e34 @drbrain drbrain committed Jan 4, 2013
Showing with 5 additions and 5 deletions.
  1. +1 −1 lib/rdoc/tom_doc.rb
  2. +4 −4 test/test_rdoc_tom_doc.rb
View
@@ -218,7 +218,7 @@ def tokenize text
@tokens << [:HEADER, 3, *token_pos(pos)]
[:TEXT, @s[1], *token_pos(pos)]
- when @s.scan(/([:\w]\w*(?:\[\])?)[ ]+- /) then
+ when @s.scan(/([:\w][\w\[\]]*)[ ]+- /) then
[:NOTE, @s[1], *token_pos(pos)]
else
@s.scan(/.*/)
@@ -365,16 +365,16 @@ def test_tokenize_arguments_array
@td.tokenize <<-TEXT
Create new Arg object.
-names[] - names of arguments
+names[stuff] - names of arguments
TEXT
expected = [
[:TEXT, "Create new Arg object.", 0, 0],
[:NEWLINE, "\n", 22, 0],
[:NEWLINE, "\n", 0, 1],
- [:NOTE, "names[]", 0, 2],
- [:TEXT, "names of arguments", 10, 2],
- [:NEWLINE, "\n", 28, 2],
+ [:NOTE, "names[stuff]", 0, 2],
+ [:TEXT, "names of arguments", 15, 2],
+ [:NEWLINE, "\n", 33, 2],
]
assert_equal expected, @td.tokens

0 comments on commit 2f95bda

Please sign in to comment.