Implement if-else
This commit is contained in:
18
Rakefile
18
Rakefile
@@ -6,7 +6,9 @@
|
||||
require 'open3'
|
||||
require 'rake/clean'
|
||||
|
||||
STAGES = Dir.glob('boot/stage*.elna').collect { |stage| File.basename stage, '.elna' }.sort
|
||||
STAGES = Dir.glob('boot/stage*.elna')
|
||||
.collect { |stage| File.basename stage, '.elna' }
|
||||
.sort { |a, b| a.delete_prefix('stage').to_i <=> b.delete_prefix('stage').to_i }
|
||||
|
||||
CLEAN.include 'build/boot', 'build/valid'
|
||||
|
||||
@@ -39,17 +41,9 @@ end
|
||||
|
||||
desc 'Convert previous stage language into the current stage language'
|
||||
task :convert do
|
||||
File.open('boot/stage9.elna', 'w') do |current_stage|
|
||||
File.readlines('boot/stage8.elna').each do |line|
|
||||
comment_match = /^(\s*)#(.*)/.match line
|
||||
|
||||
if comment_match.nil?
|
||||
current_stage << line
|
||||
elsif comment_match[2].empty?
|
||||
current_stage << "\n"
|
||||
else
|
||||
current_stage << "#{comment_match[1]}(* #{comment_match[2].strip} *)\n"
|
||||
end
|
||||
File.open('boot/stage10.elna', 'w') do |current_stage|
|
||||
File.readlines('boot/stage9.elna').each do |line|
|
||||
current_stage << line
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user