Implement if statements
This commit is contained in:
10
Rakefile
10
Rakefile
@ -1,5 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open3'
|
||||
require 'rake/clean'
|
||||
require 'term/ansicolor'
|
||||
|
||||
CLOBBER.include 'build'
|
||||
|
||||
@ -10,7 +13,7 @@ QEMU = 'qemu-riscv32'
|
||||
def assemble_stage(output, compiler, source)
|
||||
arguments = [QEMU, '-L', SYSROOT, *compiler]
|
||||
|
||||
puts(arguments * ' ')
|
||||
puts Term::ANSIColor.green(arguments * ' ')
|
||||
puts
|
||||
Open3.popen2(*arguments) do |qemu_in, qemu_out|
|
||||
qemu_in.write File.read(*source)
|
||||
@ -27,7 +30,7 @@ task default: ['build/stage2b', 'build/stage2b.s', 'boot/stage2.elna'] do |t|
|
||||
|
||||
cat_arguments = ['cat', source]
|
||||
compiler_arguments = [QEMU, '-L', SYSROOT, exe]
|
||||
diff_arguments = ['diff', '-Nur', previous_output, '-']
|
||||
diff_arguments = ['diff', '-Nur', '--text', previous_output, '-']
|
||||
Open3.pipeline(cat_arguments, compiler_arguments, diff_arguments)
|
||||
end
|
||||
|
||||
@ -70,7 +73,8 @@ task :statistics do
|
||||
word.start_with?('(*') ||
|
||||
word.start_with?('*)') ||
|
||||
('A'..'Z').include?(word[0]) ||
|
||||
/^[[:alpha:]][[:digit:]]$/.match(word)
|
||||
/^[[:alpha:]][[:digit:]]$/.match(word) ||
|
||||
['end', 'if'].include?(word)
|
||||
end
|
||||
|
||||
lines = File.read('boot/stage2.elna')
|
||||
|
Reference in New Issue
Block a user