Add a command line parsing procedure
This commit is contained in:
17
Rakefile
17
Rakefile
@ -44,11 +44,12 @@ end
|
||||
.partition { |f| f.end_with? '.elna' }
|
||||
|
||||
File.open t.name, 'w' do |output|
|
||||
puts
|
||||
puts(compiler * ' ')
|
||||
compiler_command = compiler + sources
|
||||
|
||||
Open3.popen2(*compiler) do |cl_in, cl_out|
|
||||
cl_in.write File.read(*sources)
|
||||
puts
|
||||
puts(compiler_command * ' ')
|
||||
|
||||
Open3.popen2(*compiler_command) do |cl_in, cl_out|
|
||||
cl_in.close
|
||||
|
||||
IO.copy_stream cl_out, output
|
||||
@ -87,11 +88,11 @@ task default: 'source/Compiler.elna'
|
||||
task :default do |t|
|
||||
exe, previous_output, source = t.prerequisites
|
||||
|
||||
cat_arguments = ['cat', source]
|
||||
exe_arguments = [exe, source]
|
||||
diff_arguments = ['diff', '-Nur', '--text', previous_output, '-']
|
||||
|
||||
puts [cat_arguments * ' ', exe, diff_arguments * ' '].join(' | ')
|
||||
Open3.pipeline(cat_arguments, exe, diff_arguments)
|
||||
puts [exe, diff_arguments * ' '].join(' | ')
|
||||
Open3.pipeline exe_arguments, diff_arguments
|
||||
end
|
||||
|
||||
task :backport do
|
||||
@ -104,7 +105,7 @@ task :backport do
|
||||
source
|
||||
.gsub(/^(var|type|const|begin)/) { |match| match.upcase }
|
||||
.gsub(/^[[:alnum:]]* ?module/) { |match| match.upcase }
|
||||
.gsub(/\b(record|nil|or)\b/) { |match| match.upcase }
|
||||
.gsub(/\b(record|nil|or|false|true)\b/) { |match| match.upcase }
|
||||
.gsub(/proc\(/, 'PROCEDURE(')
|
||||
.gsub(/ & /, ' AND ')
|
||||
.gsub(/ -> /, ': ')
|
||||
|
Reference in New Issue
Block a user