diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-05-29 01:05:34 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-05-29 01:05:34 +0200 |
| commit | 74010389716f0389b873f610365bb43ab26e9948 (patch) | |
| tree | ad1842094dc559b2bc1f6760f22458ae623d9d21 /Rakefile | |
| parent | b09ddfcbbedce37910daa6a1488a6e16a1be7c69 (diff) | |
| download | elna-74010389716f0389b873f610365bb43ab26e9948.tar.gz | |
Implement 2 word argument support
Diffstat (limited to 'Rakefile')
| -rw-r--r-- | Rakefile | 38 |
1 files changed, 28 insertions, 10 deletions
@@ -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 |
