half-arsed: 💩 half implement a proper parser engine class

This commit is contained in:
David Bailey 2023-04-11 15:53:45 +02:00
parent 38d0627394
commit 94b0288aa9
3 changed files with 24 additions and 17 deletions

View file

@ -5,8 +5,3 @@ require_relative "comfpile/version"
require_relative 'comfpile/core.rb'
require_relative 'comfpile/engines/filesource_engine.rb'
module Comfpile
class Error < StandardError; end
# Your code goes here...
end

View file

@ -11,7 +11,25 @@ module Comfpile
attr_reader :exit_state
attr_reader :stage, :target
attr_reader :linked_artefacts
# @return [Array<Comfpile::Artefact>] List of all artefacts
# included in this artefact.
# Included artefacts are also required, but will additionally
# update this Artefact's age.
attr_reader :included_artefacts
# @return [Array<Comfpile::Artefact] List of all artefacts
# required to build this artefact.
# Required artefacts are needed to build this artefact, but
# do not modify the artefact's age.
attr_reader :required_artefacts
# @return [Array<Comfpile::Artefact>] List of all artefacts
# potentially referenced by this artefact.
# Referenced artefacts are those that are potentially used
# by this artefact through e.g. function calls, but are
# not directly needed to build this artefact. Example being
# how sourcecode of a library is eventually needed for e.g.
# linking steps, but the objects can be built separately.
attr_reader :referenced_artefacts
# ARTEFACT STATES
#
@ -39,8 +57,8 @@ module Comfpile
@parent_artefact = nil
@required_artefacts = nil
@linked_artefacts = nil
@required_artefacts = []
@included_artefacts = []
@steps = []
@step_additions = nil
@ -132,7 +150,7 @@ module Comfpile
elsif item[:artefact].succeeded?
@waitlist.pop
else
skip! skip! "Failed artefact dependency: #{item[:artefact]}"
skip! "Failed artefact dependency: #{item[:artefact]}"
return true
end

View file

@ -1,14 +1,8 @@
module Compfile
class ParserArtefact < Artefact
attr_reader :included_files
attr_reader :required_files
def initialize(*args)
super(*args)
@included_files = []
@required_files = []
def initialize(*args, **opts)
super(*args, **opts)
parent_artefact :sourcefile, @target