[DRE-commits] [ruby-parslet] 02/03: Removed examples that requires ruby 1.9.x

Sebastien Badia sbadia-guest at moszumanska.debian.org
Wed Mar 2 21:10:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

sbadia-guest pushed a commit to branch master
in repository ruby-parslet.

commit 3da843a4ec1b1c6d9a996cdc0e84e056529f3c24
Author: Sebastien Badia <seb at sebian.fr>
Date:   Wed Mar 2 18:10:04 2016 -0300

    Removed examples that requires ruby 1.9.x
---
 .../001_remove-ruby1.9-specific-and-gobbleup.patch | 95 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 96 insertions(+)

diff --git a/debian/patches/001_remove-ruby1.9-specific-and-gobbleup.patch b/debian/patches/001_remove-ruby1.9-specific-and-gobbleup.patch
new file mode 100644
index 0000000..6195ecb
--- /dev/null
+++ b/debian/patches/001_remove-ruby1.9-specific-and-gobbleup.patch
@@ -0,0 +1,95 @@
+Description: Remove Ruby 1.9 specific tests and gobbleup deps.
+Author: Sebastien Badia <seb at sebian.fr>
+Last-Update: 2016-03-02
+
+diff --git i/example/optimized_erb.rb w/example/optimized_erb.rb
+deleted file mode 100644
+index 228619e..0000000
+--- i/example/optimized_erb.rb
++++ /dev/null
+@@ -1,42 +0,0 @@
+-# Please also look at the more naive 'erb.rb'. This shows how to optimize an
+-# ERB like parser using parslet. 
+-
+-$:.unshift File.join(File.dirname(__FILE__), "/../lib")
+-
+-require 'parslet'
+-require './qed/applique/gobbleup'
+-require 'parslet/accelerator'
+-
+-class ErbParser < Parslet::Parser
+-  rule(:ruby) { (str('%>').absent? >> any).repeat.as(:ruby) }
+-  
+-  rule(:expression) { (str('=') >> ruby).as(:expression) }
+-  rule(:comment) { (str('#') >> ruby).as(:comment) }
+-  rule(:code) { ruby.as(:code) }
+-  rule(:erb) { expression | comment | code }
+-  
+-  rule(:erb_with_tags) { str('<%') >> erb >> str('%>') }
+-  rule(:text) { (str('<%').absent? >> any).repeat(1) }
+-  
+-  rule(:text_with_ruby) { (text.as(:text) | erb_with_tags).repeat.as(:text) }
+-  root(:text_with_ruby)
+-end
+-
+-parser = ErbParser.new
+-
+-A = Parslet::Accelerator
+-optimized = A.apply(parser, 
+-  A.rule((A.str(:x).absent? >> A.any).repeat(1)) { GobbleUp.new(x, 1) }, 
+-  A.rule((A.str(:x).absent? >> A.any).repeat(0)) { GobbleUp.new(x, 0) })
+-
+-input = File.read(File.dirname(__FILE__) + "/big.erb")
+-
+-# Remove the comment marks here to see what difference the optimisation makes.
+-# Commented out for the acceptance tests to run. 
+-#
+-# require 'benchmark'
+-# Benchmark.bm(7) do |bm|
+-#   bm.report('original') { parser.parse(input) }
+-#   bm.report('gobble') { optimized.parse(input) }
+-# end
+-p optimized.parse(input)
+\ No newline at end of file
+diff --git i/example/sentence.rb w/example/sentence.rb
+deleted file mode 100644
+index b73d140..0000000
+--- i/example/sentence.rb
++++ /dev/null
+@@ -1,36 +0,0 @@
+-# encoding: UTF-8
+-
+-# A small example contributed by John Mettraux (jmettraux) that demonstrates
+-# working with Unicode. This only works on Ruby 1.9.
+-
+-$:.unshift File.dirname(__FILE__) + "/../lib"
+-
+-require 'parslet'
+-
+-class Parser < Parslet::Parser
+-  rule(:sentence) { (match('[^。]').repeat(1) >> str("。")).as(:sentence) }
+-  rule(:sentences) { sentence.repeat }
+-  root(:sentences)
+-end
+-
+-class Transformer < Parslet::Transform
+-  rule(:sentence => simple(:sen)) { sen.to_s }
+-end
+-
+-string =
+-  "RubyKaigi2009のテーマは、「変わる/変える」です。 前回の" +
+-  "RubyKaigi2008のテーマであった「多様性」の言葉の通り、 " +
+-  "2008年はRubyそのものに関しても、またRubyの活躍する舞台に関しても、 " +
+-  "ますます多様化が進みつつあります。RubyKaigi2008は、そのような " +
+-  "Rubyの生態系をあらためて認識する場となりました。 しかし、" +
+-  "こうした多様化が進む中、異なる者同士が単純に距離を 置いたままでは、" +
+-  "その違いを認識したところであまり意味がありません。 異なる実装、" +
+-  "異なる思想、異なる背景といった、様々な多様性を理解しつつ、 " +
+-  "すり合わせるべきものをすり合わせ、変えていくべきところを " +
+-  "変えていくことが、豊かな未来へとつながる道に違いありません。"
+-
+-parser = Parser.new
+-transformer = Transformer.new
+-
+-tree = parser.parse(string)
+-p transformer.apply(tree)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3ea5ead
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+001_remove-ruby1.9-specific-and-gobbleup.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-parslet.git



More information about the Pkg-ruby-extras-commits mailing list