Parse the variable part to AST
This commit is contained in:
4
Rakefile
4
Rakefile
@ -101,6 +101,7 @@ task :backport do
|
||||
source = File.read source_path
|
||||
current_procedure = nil
|
||||
target = ''
|
||||
module_name = source_path.basename.sub_ext('')
|
||||
|
||||
source
|
||||
.gsub(/^(var|type|const|begin)/) { |match| match.upcase }
|
||||
@ -109,7 +110,8 @@ task :backport do
|
||||
.gsub(/proc\(/, 'PROCEDURE(')
|
||||
.gsub(/ & /, ' AND ')
|
||||
.gsub(/ -> /, ': ')
|
||||
.gsub(/end\./, "END #{source_path.basename.sub_ext('')}.")
|
||||
.gsub(/program;/, "MODULE #{module_name};")
|
||||
.gsub(/end\./, "END #{module_name}.")
|
||||
.gsub(/([[:space:]]*)end(;?)$/, '\1END\2')
|
||||
.gsub(/^([[:space:]]*)(while|return|if)\b/) { |match| match.upcase }
|
||||
.gsub(/^from ([[:alnum:]]+) import/, 'FROM \1 IMPORT')
|
||||
|
Reference in New Issue
Block a user