Jamis Buck wrote:
Yes, it is not a complete YAML parser. A patch would be more than
welcome, though.
Puh-lease. Patches are so Last Millenium.
We shall do this via the most obnoxious implementation technique yet
discovered: Pair Programming Via USENET.
Here:
def test_list_of_lists
tok =
@yaml.tokenize( "- [ foo ]" ) { |t| tok << t }
assert_equal [ :punct, "-" ], [ tok.first.group, tok.shift ]
assert_equal [ :normal, " " ], [ tok.first.group, tok.shift ]
assert_equal [ :punct, "[" ], [ tok.first.group, tok.shift ]
assert_equal [ :normal, " foo " ], [ tok.first.group, tok.shift ]
assert_equal [ :punct, "]" ], [ tok.first.group, tok.shift ]
end
I got each assertion working except the last, by adding this:
class YAML < Tokenizer
....
when scan(/:\w+/)
start_group :symbol, matched
when scan(/(\s*)\[/)
start_group :normal, subgroup(1)
start_group :punct, "["
....
However, now I can't find where to get the closing ] out of the :normal
string " foo ]".
After we do that, we need , working, and we need [ at BOL, without the -.
···
--
Phlip
http://industrialxp.org/community/bin/view/Main/TestFirstUserInterfaces