Class: RBlade::CompilesStatements
- Inherits:
-
Object
- Object
- RBlade::CompilesStatements
show all
- Defined in:
- lib/rblade/compiler/compiles_statements.rb,
lib/rblade/compiler/statements/compiles_loops.rb,
lib/rblade/compiler/statements/compiles_stacks.rb,
lib/rblade/compiler/statements/compiles_inline_ruby.rb,
lib/rblade/compiler/statements/compiles_conditionals.rb
Defined Under Namespace
Classes: CompilesConditionals, CompilesInlineRuby, CompilesLoops, CompilesStacks
Instance Method Summary
collapse
Instance Method Details
#compile!(tokens) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/rblade/compiler/compiles_statements.rb', line 8
def compile!(tokens)
token_index = 0
while token_index < tokens.count
token = tokens[token_index]
if token.type != :statement
token_index += 1
next
end
name = token.value[:name]
arguments = token.value[:arguments]
handler = getHandler(name)
handler_arguments = []
handler.parameters.each do |parameter|
case parameter.last
when :args
handler_arguments.push arguments
when :tokens
handler_arguments.push tokens
when :token_index
handler_arguments.push token_index
end
end
token.value = handler.call(*handler_arguments)
token_index += 1
end
end
|
#compileEnd ⇒ Object
38
39
40
|
# File 'lib/rblade/compiler/compiles_statements.rb', line 38
def compileEnd
"end;"
end
|