Support tilde and minus character. Fix Rails Issue #5114. #19

Merged
merged 1 commit into from Feb 22, 2012
View
2 lib/journey/scanner.rb
@@ -47,7 +47,7 @@ def scan
[:DOT, text]
when text = @ss.scan(/:\w+/)
[:SYMBOL, text]
- when text = @ss.scan(/[\w%-]+/)
+ when text = @ss.scan(/[\w%\-~]+/)
[:LITERAL, text]
# any char
when text = @ss.scan(/./)
View
2 test/route/definition/test_scanner.rb
@@ -13,6 +13,8 @@ def test_tokens
['/', [[:SLASH, '/']]],
['*omg', [[:STAR, '*'], [:LITERAL, 'omg']]],
['/page', [[:SLASH, '/'], [:LITERAL, 'page']]],
+ ['/~page', [[:SLASH, '/'], [:LITERAL, '~page']]],
+ ['/pa-ge', [[:SLASH, '/'], [:LITERAL, 'pa-ge']]],
['/:page', [[:SLASH, '/'], [:SYMBOL, ':page']]],
['/(:page)', [
[:SLASH, '/'],