Changeset 164 for trunk/Rakefile
- Timestamp:
- 04/09/2008 22:32:36 (7 months ago)
- Files:
-
- 1 modified
-
trunk/Rakefile (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Rakefile
r163 r164 22 22 Dir.glob("{bin,doc,test,lib,extras}/**/*") + 23 23 Dir.glob("ext/**/*.{h,java,c,rb,rl}") + 24 %w[ext/hpricot_scan/hpricot_scan.c ext/hpricot_scan/HpricotScanService.java] # needed because it's generated later 24 %w[ext/hpricot_scan/hpricot_scan.c ext/hpricot_scan/HpricotScanService.java] # needed because they are generated later 25 RAGEL_C_CODE_GENERATION_STYLES = { 26 "table_driven" => 'T0', 27 "faster_table_driven" => 'T1', 28 "flat_table_driven" => 'F0', 29 "faster_flat_table_driven" => 'F1', 30 "goto_driven" => 'G0', 31 "faster_goto_driven" => 'G1', 32 "really_fast goto_driven" => 'G2' 33 # "n_way_split_really_fast_goto_driven" => 'P<N>' 34 } 35 DEFAULT_RAGEL_C_CODE_GENERATION = "really_fast goto_driven" 25 36 SPEC = 26 37 Gem::Specification.new do |s| … … 114 125 task :hpricot_scan => [:ragel] 115 126 116 desc " returns the ragel version"127 desc "Determines the Ragel version and displays it on the console along with the location of the Ragel binary." 117 128 task :ragel_version do 118 129 @ragel_v = `ragel -v`[/(version )(\S*)/,2].to_f 130 puts "Using ragel version: #{@ragel_v}, location: #{`which ragel`}" 131 @ragel_v 119 132 end 120 133 … … 122 135 task :ragel => [:ragel_version] do 123 136 if @ragel_v >= 6.1 124 sh %{ragel ext/hpricot_scan/hpricot_scan.rl -G2 -o ext/hpricot_scan/hpricot_scan.c} 137 @ragel_c_code_generation_style = RAGEL_C_CODE_GENERATION_STYLES[DEFAULT_RAGEL_C_CODE_GENERATION] 138 sh %{ragel ext/hpricot_scan/hpricot_scan.rl -#{@ragel_c_code_generation_style} -o ext/hpricot_scan/hpricot_scan.c} 125 139 else 126 140 STDERR.puts "Ragel 6.1 or greater is required." … … 129 143 end 130 144 131 desc "Generates the Java scanner code with Ragel." 145 # Java only supports the table-driven code 146 # generation style at this point. 147 desc "Generates the Java scanner code using the Ragel table-driven code generation style." 132 148 task :ragel_java => [:ragel_version] do 133 149 if @ragel_v >= 6.1 134 sh %{ragel -J ext/hpricot_scan/hpricot_scan.java.rl -G2 -o ext/hpricot_scan/HpricotScanService.java} 150 puts "compiling with ragel version #{@ragel_v}" 151 sh %{ragel -J -o ext/hpricot_scan/HpricotScanService.java ext/hpricot_scan/hpricot_scan.java.rl} 135 152 else 136 153 STDERR.puts "Ragel 6.1 or greater is required."
