Make procedure name after the end

This commit is contained in:
2025-05-29 14:59:56 +02:00
parent 192e7e40c8
commit 7b64f06c2a
5 changed files with 123 additions and 90 deletions

View File

@ -98,8 +98,10 @@ task :backport do
FileList['source/*.elna'].each do |file|
source_path = Pathname.new file
source = File.read source_path
current_procedure = nil
target = ''
target = source
source
.gsub(/^(var|type|const|begin)/) { |match| match.upcase }
.gsub(/^[[:alnum:]]* ?module/) { |match| match.upcase }
.gsub(/\brecord\b/) { |match| match.upcase }
@ -109,8 +111,22 @@ task :backport do
.gsub(/^from ([[:alnum:]]+) import/, 'FROM \1 IMPORT')
.gsub(/ \^([[:alnum:]])/, ' POINTER TO \1')
.gsub(/(then|do)$/) { |match| match.upcase }
.each_line do |line|
if line.start_with? 'PROCEDURE'
current_procedure = line[10...line.index('(')]
elsif line.start_with?('END;') && !current_procedure.nil?
line = "END #{current_procedure};"
current_proceure = nil
elsif line.start_with?('end')
line = 'END ' + line[4..]
end
target += line
end
target_path = Pathname.new('boot/stage1/source') + source_path.basename
File.write target_path, target
end
FileList['source/*.def'].each do |file|
cp file, File.join('boot/stage1/source', Pathname.new(file).basename)
end
end