forked from seattlerb/oedipus_lex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
88 lines (65 loc) · 1.8 KB
/
Rakefile
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
# -*- ruby -*-
require "rubygems"
require "hoe"
Hoe.plugin :isolate
Hoe.plugin :seattlerb
Hoe.spec "oedipus_lex" do
developer "Ryan Davis", "[email protected]"
license "MIT"
self.readme_file = "README.rdoc"
self.history_file = "History.rdoc"
end
Hoe.bad_plugins.each do |bad|
warn "BAD: Hoe.plugin :#{bad}"
end
task :bootstrap do
ruby "-Ilib lib/oedipus_lex.rb lib/oedipus_lex.rex > lib/oedipus_lex.rex.rb.new"
system "diff -uw lib/oedipus_lex.rex.rb lib/oedipus_lex.rex.rb.new"
sh "mv lib/oedipus_lex.rex.rb.new lib/oedipus_lex.rex.rb"
ruby "-S rake"
end
$: << "lib"
Rake.application.rake_require "oedipus_lex"
$rex_option[:stub] = true
task :demo => Dir["sample/*.rex"].map { |s| "#{s}.rb" }.sort
task :demo => :isolate do
Dir.chdir "sample" do
ruby "sample.rex.rb sample.html"
ruby "sample.rex.rb sample.xhtml"
ruby "sample1.rex.rb sample1.c"
ruby "sample2.rex.rb sample2.bas"
ruby "xhtmlparser.rex.rb xhtmlparser.html"
ruby "xhtmlparser.rex.rb xhtmlparser.xhtml"
cmd = "#{Gem.ruby} error1.rex.rb error1.txt"
warn cmd
system cmd
cmd = "#{Gem.ruby} error2.rex.rb error1.txt"
warn cmd
system cmd
end
end
task :raccdemo => :isolate do
$rex_option[:stub] = false
$rex_option[:do_parse] = false
rm_f "sample/calc3.rex.rb"
t = Rake.application["sample/calc3.rex.rb"]
t.reenable
t.invoke
ruby "-S racc sample/calc3.racc"
sh "echo 1 + 2 + 3 | #{Gem.ruby} -Isample sample/calc3.tab.rb"
end
task :clean do
rm Dir["sample/*.rb"]
end
task :debug do
require "oedipus_lex"
f = ENV["F"]
rex = OedipusLex.new $rex_option
rex.parse_file f
puts rex.generate
end
task :wtf => :isolate do
puts `~/.rbenv/versions/2.2.0/bin/ruby -S gem env`
puts `~/.rbenv/versions/2.2.0/bin/ruby -S gem list`
end
# vim: syntax=ruby