Class: Riml::Compiler
- Inherits:
-
Object
show all
- Defined in:
- lib/compiler.rb
Defined Under Namespace
Modules: CompilerAccessible
Classes: AssignNodeVisitor, BinaryOperatorNodeVisitor, CallNodeVisitor, CatchNodeVisitor, ClassDefinitionNodeVisitor, DefNodeVisitor, DictGetBracketNodeVisitor, DictGetDotNodeVisitor, DrillDownVisitor, ElseNodeVisitor, ElseifNodeVisitor, EstablishScopeVisitor, ExplicitCallNodeVisitor, ForNodeVisitor, GetCurlyBraceNameNodeVisitor, GetSpecialVariableNodeVisitor, GetVariableByScopeAndDictNameNodeVisitor, GetVariableNodeVisitor, IfNodeVisitor, ListOrDictGetNodeVisitor, ListUnpackNodeVisitor, LiteralNodeVisitor, MultiAssignNodeVisitor, NodesVisitor, ObjectInstantiationNodeVisitor, ReturnNodeVisitor, RimlCommandNodeVisitor, ScopedVisitor, StringLiteralConcatNodeVisitor, TernaryOperatorNodeVisitor, TryNodeVisitor, UnaryOperatorNodeVisitor, UnletVariableNodeVisitor, Visitor, WhileNodeVisitor, WrapInParensNodeVisitor
Constant Summary
collapse
- UnlessNodeVisitor =
IfNodeVisitor
- UntilNodeVisitor =
WhileNodeVisitor
- SublistNodeVisitor =
NodesVisitor
- TrueNodeVisitor =
LiteralNodeVisitor
- FalseNodeVisitor =
LiteralNodeVisitor
- NumberNodeVisitor =
LiteralNodeVisitor
- StringNodeVisitor =
LiteralNodeVisitor
- RegexpNodeVisitor =
LiteralNodeVisitor
- ExLiteralNodeVisitor =
LiteralNodeVisitor
- ListNodeVisitor =
LiteralNodeVisitor
- DictionaryNodeVisitor =
LiteralNodeVisitor
- ScopeModifierLiteralNodeVisitor =
LiteralNodeVisitor
- FinishNodeVisitor =
LiteralNodeVisitor
- ContinueNodeVisitor =
LiteralNodeVisitor
- BreakNodeVisitor =
LiteralNodeVisitor
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#options ⇒ Object
11
12
13
|
# File 'lib/compiler.rb', line 11
def options
@options ||= {}
end
|
#parser ⇒ Object
Returns the value of attribute parser.
6
7
8
|
# File 'lib/compiler.rb', line 6
def parser
@parser
end
|
Instance Method Details
#compile(root_node) ⇒ Object
compiles nodes into output code
783
784
785
786
787
788
|
# File 'lib/compiler.rb', line 783
def compile(root_node)
root_node.extend CompilerAccessible
root_node.current_compiler = self
root_node.accept(NodesVisitor.new)
root_node.compiled_output
end
|
#compile_include(source, from_file) ⇒ Object
776
777
778
779
780
|
# File 'lib/compiler.rb', line 776
def compile_include(source, from_file)
root_node = parser.parse(source, parser.ast_rewriter, from_file, true)
output = compile(root_node)
(Riml::INCLUDE_COMMENT_FMT % from_file) + output
end
|
#compile_queue ⇒ Object
768
769
770
|
# File 'lib/compiler.rb', line 768
def compile_queue
@compile_queue ||= []
end
|
#output_dir ⇒ Object
15
16
17
|
# File 'lib/compiler.rb', line 15
def output_dir
options[:output_dir]
end
|
#readable ⇒ Object
19
20
21
|
# File 'lib/compiler.rb', line 19
def readable
options.has_key?(:readable) and options[:readable]
end
|
#sourced_files_compiled ⇒ Object
772
773
774
|
# File 'lib/compiler.rb', line 772
def sourced_files_compiled
@sourced_files_compiled ||= []
end
|