Class: ATP::Processor
- Inherits:
-
Object
show all
- Includes:
- AST::Processor::Mixin
- Defined in:
- lib/atp/processor.rb
Overview
The base processor, this provides a default handler for all node types and will not make any changes to the AST, i.e. an equivalent AST will be returned by the process method.
Child classes of this should be used to implement additional processors to modify or otherwise work with the AST.
Direct Known Subclasses
Formatter, ATP::Processors::AddIDs, ATP::Processors::Condition, ATP::Processors::ConditionExtractor, ATP::Processors::FlowID, ATP::Processors::Marshal, ATP::Processors::PostCleaner, ATP::Processors::PostCleaner::ExtractTestIDs, ATP::Processors::PreCleaner, ATP::Processors::Relationship, ATP::Processors::Relationship::ExtractTestResults, Runner, Validator
Instance Method Summary
collapse
Instance Method Details
#handler_missing(node) ⇒ Object
26
27
28
|
# File 'lib/atp/processor.rb', line 26
def handler_missing(node)
node.updated(nil, process_all(node.children))
end
|
#n(type, children) ⇒ Object
30
31
32
|
# File 'lib/atp/processor.rb', line 30
def n(type, children)
ATP::AST::Node.new(type, children)
end
|
#n0(type) ⇒ Object
34
35
36
|
# File 'lib/atp/processor.rb', line 34
def n0(type)
n(type, [])
end
|
#n1(type, arg) ⇒ Object
38
39
40
|
# File 'lib/atp/processor.rb', line 38
def n1(type, arg)
n(type, [arg])
end
|
#process(node) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/atp/processor.rb', line 18
def process(node)
if node.respond_to?(:to_ast)
super(node)
else
node
end
end
|
#run(node) ⇒ Object
14
15
16
|
# File 'lib/atp/processor.rb', line 14
def run(node)
process(node)
end
|