From 74010389716f0389b873f610365bb43ab26e9948 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 29 May 2026 01:05:34 +0200 Subject: Implement 2 word argument support --- Rakefile | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index db9b0fa..4b0f566 100644 --- a/Rakefile +++ b/Rakefile @@ -37,18 +37,36 @@ end desc 'Convert previous stage language into the current stage language' task :convert do File.open('boot/stage23/cl.elna', 'w') do |current_stage| - seen_var = false + seen_proc = false File.readlines('boot/stage22/cl.elna').each do |line| - if line.start_with? 'var' - seen_var = true - current_stage << "var\n" - elsif line.start_with? 'begin' - seen_var = false - current_stage << "begin\n" - elsif seen_var && line.end_with?(";\n") - current_stage << line[0..-3] - current_stage << "\n" + if line.start_with? 'proc' + seen_proc = true + current_stage << line + elsif seen_proc && line.start_with?('begin') + seen_proc = false + current_stage << line + elsif !seen_proc && line.start_with?('begin') + current_stage << <<~CODE + proc g(location: ElnaLocation) + begin + \tprintf("# %i %i\\n\\0", location.line, location.column) + end + + proc f() + var + \tlocation: ElnaLocation + begin + \tlocation.line := 2; + \tlocation.column := 3; + \tg(location) + end + + CODE + current_stage << line + current_stage << <<~CODE + \tf(); + CODE else current_stage << line end -- cgit v1.2.3