From a94cdf08e48d93d92618905d8eecb7173341e9fd Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 31 Oct 2019 00:54:50 +0900 Subject: [PATCH 1/2] Strip trailing whitespaces at the last line of actions --- sample/calc-ja.y | 2 +- sample/calc.y | 2 +- sample/hash.y | 2 +- sample/syntax.y | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sample/calc-ja.y b/sample/calc-ja.y index 05f2137a..89c237de 100644 --- a/sample/calc-ja.y +++ b/sample/calc-ja.y @@ -26,7 +26,7 @@ end ---- header # ---- inner - + def evaluate(str) @tokens = [] until str.empty? diff --git a/sample/calc.y b/sample/calc.y index 8135731d..8b13131a 100644 --- a/sample/calc.y +++ b/sample/calc.y @@ -24,7 +24,7 @@ end ---- header # ---- inner - + def parse(str) @q = [] until str.empty? diff --git a/sample/hash.y b/sample/hash.y index 85348e4e..7cb6739d 100644 --- a/sample/hash.y +++ b/sample/hash.y @@ -7,7 +7,7 @@ class HashParser rule hash : '{' contents '}' { val[1] } | '{' '}' { Hash.new } - + # Racc can handle string over 2 bytes. contents: IDENT '=>' IDENT { {val[0] => val[2]} } | contents ',' IDENT '=>' IDENT { val[0][val[2]] = val[4]; val[0] } diff --git a/sample/syntax.y b/sample/syntax.y index dd4c6699..ca4cdf2d 100644 --- a/sample/syntax.y +++ b/sample/syntax.y @@ -28,7 +28,7 @@ rule print 'cba' } | cont - + cont : A c2 B c2 C c2 : C C C C C From 0b679e2f69d9286d4b5de9612d12972fa52afbd0 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 31 Oct 2019 01:09:18 +0900 Subject: [PATCH 2/2] Show diffs --- test/case.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/case.rb b/test/case.rb index f4240bfd..d917f3a4 100644 --- a/test/case.rb +++ b/test/case.rb @@ -90,8 +90,7 @@ def assert_output_unchanged(asset) actual = File.read("#{@TAB_DIR}/#{file}") result = (strip_version(expected) == strip_version(actual)) - assert(result, "Output of test/assets/#{file}.y differed from " \ - "expectation. Try compiling it and diff with test/regress/#{file}.") + assert(result, proc {`diff -u #{REGRESS_DIR}/#{file} #{@TAB_DIR}/#{file}`}) end def racc(*arg, **opt)