Transpile the global var section
This commit is contained in:
17
Rakefile
17
Rakefile
@ -93,3 +93,20 @@ task :default do |t|
|
||||
puts [cat_arguments * ' ', exe, diff_arguments * ' '].join(' | ')
|
||||
Open3.pipeline(cat_arguments, exe, diff_arguments)
|
||||
end
|
||||
|
||||
task :backport do
|
||||
FileList['source/*.elna'].each do |file|
|
||||
source_path = Pathname.new file
|
||||
source = File.read source_path
|
||||
|
||||
target = source
|
||||
.gsub(/^(var|type|const)/) { |match| match.upcase }
|
||||
.gsub(/^[[:alnum:]]* ?module/) { |match| match.upcase }
|
||||
.gsub(/(procedure|record| pointer to )/) { |match| match.upcase }
|
||||
.gsub(/([[:space:]]*)end;/, '\1END;')
|
||||
.gsub(/^from ([[:alnum:]]+) import/, 'FROM \1 IMPORT')
|
||||
|
||||
target_path = Pathname.new('boot/stage1/source') + source_path.basename
|
||||
File.write target_path, target
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user