diff options
| author | Eugen Wissner <belka@caraus.de> | 2025-09-13 21:15:09 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2025-09-13 21:15:09 +0200 |
| commit | ee3b733a81f3136494e612a0d748f4d029064845 (patch) | |
| tree | 10a6d7534dc3efd11562f28ce9b1a581530ebb5e /Rakefile | |
| parent | 216dc59f0b1507a7529ce34332463f9443a05cd4 (diff) | |
| download | elna-ee3b733a81f3136494e612a0d748f4d029064845.tar.gz | |
Implement if-else
Diffstat (limited to 'Rakefile')
| -rw-r--r-- | Rakefile | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -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 |
