Permalink
Browse files

Use UTF-8 encoding for Citrus::DOT

  • Loading branch information...
1 parent 51cc887 commit 8d0ff78867e98a50c068570be1f42ec594511d95 @mjackson committed Jan 13, 2011
Showing with 19 additions and 1 deletion.
  1. +1 −1 lib/citrus.rb
  2. +18 −0 test/multibyte_test.rb
View
@@ -13,7 +13,7 @@ module Citrus
autoload :File, 'citrus/file'
# A pattern to match any character, including newline.
- DOT = /./m
+ DOT = /./mu
Infinity = 1.0 / 0
@@ -15,6 +15,10 @@ class MultibyteTest < Test::Unit::TestCase
rule :character_class do
/[ä]+/
end
+
+ rule :dot do
+ DOT
+ end
end
def test_multibyte_string
@@ -32,6 +36,11 @@ def test_multibyte_character_class
assert(m)
end
+ def test_multibyte_dot
+ m = Multibyte.parse("ä", :root => :dot)
+ assert(m)
+ end
+
Citrus.eval(<<-CITRUS)
grammar Multibyte2
rule string
@@ -45,6 +54,10 @@ def test_multibyte_character_class
rule character_class
[ä]+
end
+
+ rule dot
+ .+
+ end
end
CITRUS
@@ -62,4 +75,9 @@ def test_multibyte2_character_class
m = Multibyte2.parse("äää", :root => :character_class)
assert(m)
end
+
+ def test_multibyte2_dot
+ m = Multibyte2.parse("äää", :root => :dot)
+ assert(m)
+ end
end

0 comments on commit 8d0ff78

Please sign in to comment.