Remove need for trailing semicolons
This commit is contained in:
@@ -36,30 +36,19 @@ end
|
||||
|
||||
desc 'Convert previous stage language into the current stage language'
|
||||
task :convert do
|
||||
File.open('boot/stage22/cl.elna', 'w') do |current_stage|
|
||||
seen_proc = false
|
||||
seen_global_var = false
|
||||
File.readlines('boot/stage21/cl.elna').each do |line|
|
||||
seen_proc = true if line.start_with? 'proc'
|
||||
seen_proc = false if line.start_with? 'end'
|
||||
if line.start_with?('begin') && !seen_proc
|
||||
current_stage << <<~FUN
|
||||
proc f();
|
||||
var
|
||||
x: ElnaRtlObjectInfo;
|
||||
begin
|
||||
x.allocated := true
|
||||
end;
|
||||
File.open('boot/stage23/cl.elna', 'w') do |current_stage|
|
||||
seen_var = false
|
||||
|
||||
begin
|
||||
f();
|
||||
FUN
|
||||
elsif line.start_with?('var') && !seen_global_var
|
||||
current_stage << <<~FUN
|
||||
var
|
||||
FUN
|
||||
elsif line.end_with?("allocated: Word\n")
|
||||
current_stage << "\t\tallocated: Bool\n"
|
||||
File.readlines('boot/stage22/cl.elna').each do |line|
|
||||
if line.start_with? 'var'
|
||||
seen_var = true
|
||||
current_stage << "var\n"
|
||||
elsif line.start_with? 'begin'
|
||||
seen_var = false
|
||||
current_stage << "begin\n"
|
||||
elsif seen_var && line.end_with?(";\n")
|
||||
current_stage << line[0..-3]
|
||||
current_stage << "\n"
|
||||
else
|
||||
current_stage << line
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user