Class: BuildTool::Cfg::BuildSystemDeclarationNodeVisitor
- Inherits:
-
ListVisitor
- Object
- MJ::VisitorBase
- ListVisitor
- BuildTool::Cfg::BuildSystemDeclarationNodeVisitor
- Defined in:
- lib/build-tool/cfg/visitor.rb
Overview
Build System Declaration Visitor.
Instance Attribute Summary
Attributes inherited from MJ::VisitorBase
Instance Method Summary collapse
-
#initialize(configuration, build_system) ⇒ BuildSystemDeclarationNodeVisitor
constructor
Initialize a build system.
- #visit_BuildSystemDeclarationNode(node) ⇒ Object
- #visit_BuildSystemInplaceNode(node) ⇒ Object
- #visit_BuildSystemOptionNode(node) ⇒ Object
Methods inherited from ListVisitor
Methods inherited from MJ::VisitorBase
Constructor Details
#initialize(configuration, build_system) ⇒ BuildSystemDeclarationNodeVisitor
Initialize a build system. If no build system is provided we will create a new one. Which is not registered with the configuration.
44 45 46 47 |
# File 'lib/build-tool/cfg/visitor.rb', line 44 def initialize( configuration, build_system ) super( configuration ) @build_system = build_system end |
Instance Method Details
#visit_BuildSystemDeclarationNode(node) ⇒ Object
49 50 51 52 |
# File 'lib/build-tool/cfg/visitor.rb', line 49 def visit_BuildSystemDeclarationNode( node ) visit_nodes( node.values[1] ) return @build_system end |
#visit_BuildSystemInplaceNode(node) ⇒ Object
54 55 56 |
# File 'lib/build-tool/cfg/visitor.rb', line 54 def visit_BuildSystemInplaceNode( node ) @build_system.out_of_source = false end |
#visit_BuildSystemOptionNode(node) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/build-tool/cfg/visitor.rb', line 58 def visit_BuildSystemOptionNode( node ) case node.values.length when 3 case node.values[1] when 'append'; @build_system.append( node.values[0], node.values[2] ) when 'prepend'; @build_system.prepend( node.values[0], node.values[2] ) when 'set'; @build_system.set( node.values[0], node.values[2] ) else raise StandardError, "Unexpected token #{node.values[1]}!" end when 2 case node.values[1] when 'unset'; @build_system.set( node.values[0], nil ) else @build_system.set( node.values[0], node.values[1] ) end else raise StandardError, "Unexpected number of tokens #{node.values.length} #{node.values.join(', ')}" end end |