1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
Description: Remove Ruby 1.9 specific tests and gobbleup deps.
Author: Sebastien Badia <seb@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)
|