module LucidTDL module AST class Node attr_reader :filename, :line def accept(visitor) name = self.class.name.split('::').last visitor.send("visit_#{name}".to_sym, self) end def pos(filename, line=nil) @filename = filename @line = line end end # class Node class Feature < Node include Enumerable attr_reader :name attr_accessor :description, :background, :scenarios, :tags def initialize(name, scenarios=[], tags=[], background=nil) @name = name @background = background @scenarios = scenarios @tags = tags end def each @scenarios.each end end # class Feature class Ability < Feature end class Responsibility < Feature end class Background < Node include Enumerable attr_accessor :steps def initialize(steps=[]) @steps = steps end def line @steps.first.line - 1 if @steps.any? end def each @steps.each end end # class Background class Scenario < Node include Enumerable attr_reader :name, :steps, :tags def initialize(name, steps=[], tags=[]) @name = name.to_s @steps = steps @tags = tags end def line @steps.first.line - 1 if @steps.any? end def each @steps.each end end # class Scenario class Test < Scenario end class Step < Node attr_reader :name attr_reader :keyword def initialize(name, keyword) @name = name.to_s @keyword = keyword.to_s end end # class Step class Tag < Node attr_reader :name def initialize(name) @name = name end end # class Tag end # module AST end # module LucidTDL