aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Rakefile38
-rw-r--r--boot/stage24/cl.elna19
-rw-r--r--rakelib/ninja.rake10
3 files changed, 54 insertions, 13 deletions
diff --git a/Rakefile b/Rakefile
index 71d875a..e145b58 100644
--- a/Rakefile
+++ b/Rakefile
@@ -19,7 +19,10 @@ end
directory 'build'
-task default: :boot
+task :default do
+ Rake::Task["build/valid/#{STAGES.last}/cl"].invoke
+ Rake::Task["boot"].invoke
+end
desc 'Final stage'
task boot: "build/valid/#{STAGES.last}/cl"
@@ -34,11 +37,34 @@ task boot: "boot/#{STAGES.last}/cl.elna" do |t|
Open3.pipeline(cat_arguments, run(exe), diff_arguments)
end
-desc 'Convert previous stage language into the current stage language'
-task :convert do
- File.open('boot/stage25/cl.elna', 'w') do |current_stage|
- File.readlines('boot/stage24/cl.elna').each do |line|
- current_stage << line
+namespace :stage do
+ stage_number = STAGES.last.delete_prefix('stage').to_i
+
+ desc 'Create a new stabe by duplicating the last one'
+ task :new do
+ new_stage = "stage#{stage_number.succ}"
+ cp_r "boot/stage#{stage_number}", "boot/#{new_stage}"
+ STAGES << new_stage
+ Rake::Task['ninja'].invoke
+ end
+
+ desc 'Delete the last stage'
+ task :drop do
+ rm_r "boot/stage#{stage_number}"
+ STAGES.pop
+ Rake::Task['ninja'].invoke
+ end
+
+ desc 'Convert previous stage language into the current stage language'
+ task :convert do
+ from = "boot/stage#{stage_number.pred}/cl.elna"
+ to = "boot/stage#{stage_number}/cl.elna"
+ puts "Converting #{from} to #{to}."
+
+ File.open(to, 'w') do |current_stage|
+ File.readlines(from).each do |line|
+ current_stage << line
+ end
end
end
end
diff --git a/boot/stage24/cl.elna b/boot/stage24/cl.elna
index 3bc9d7d..3e17e07 100644
--- a/boot/stage24/cl.elna
+++ b/boot/stage24/cl.elna
@@ -274,7 +274,8 @@ type
kind: ElnaTreeKind;
position: ElnaPosition;
members: ^ElnaTreeField;
- length: Word
+ length: Word;
+ parent: String
end
ElnaTreeNamedTypeExpression = record
kind: ElnaTreeKind;
@@ -3941,6 +3942,22 @@ begin
result^.length := 0;
result^.position := token^.position;
+ token := elna_lexer_peek(cursor);
+ if token^.kind = ElnaLexerKind.left_paren then
+ elna_lexer_read(cursor);
+
+ token := elna_parser_expect(cursor, ElnaLexerKind.identifier, error_list);
+ if token = nil then
+ result := free_and_nil(result);
+ goto elna_parser_record_type_expression_end
+ end;
+ result^.parent := token^.start;
+ if elna_parser_expect(cursor, ElnaLexerKind.right_paren, error_list) = nil then
+ result := free_and_nil(result);
+ goto elna_parser_record_type_expression_end
+ end
+ end;
+
.elna_parser_record_type_expression_loop;
token := elna_lexer_read(cursor);
if token^.kind = ElnaLexerKind._end then
diff --git a/rakelib/ninja.rake b/rakelib/ninja.rake
index 3d9a994..2780f59 100644
--- a/rakelib/ninja.rake
+++ b/rakelib/ninja.rake
@@ -75,10 +75,8 @@ file "build/valid/#{STAGES.last}/cl" => 'build/build.ninja' do |t|
sh 'ninja', '-f', t.prerequisites.first
end
-namespace :ninja do
- desc 'Forces the regeneration of build/build.ninja'
- task :build do
- rm_f 'build/build.ninja'
- Rake::Task['build/build.ninja'].invoke
- end
+desc 'Forces the regeneration of build/build.ninja'
+task :ninja do
+ rm_f 'build/build.ninja'
+ Rake::Task['build/build.ninja'].invoke
end