Class: BOAST::While
Constant Summary
collapse
- ANNOTATIONS =
[ :condition ]
Instance Attribute Summary collapse
#args
Instance Method Summary
collapse
Methods included from Annotation
#annotate_array, #annotate_indepth?, #annotate_scalar, #annotate_var, #annotation, #annotation_identifier
private_boolean_state_accessor, private_state_accessor
#[], #get_strings, inherited, token_string_generator
#inspect
Constructor Details
#initialize(condition, &block) ⇒ While
Returns a new instance of While.
9
10
11
12
|
# File 'lib/BOAST/Language/While.rb', line 9
def initialize(condition, &block)
@condition = condition
@block = block
end
|
Instance Attribute Details
#condition ⇒ Object
Returns the value of attribute condition.
7
8
9
|
# File 'lib/BOAST/Language/While.rb', line 7
def condition
@condition
end
|
Instance Method Details
#close ⇒ Object
53
54
55
56
57
58
59
60
|
# File 'lib/BOAST/Language/While.rb', line 53
def close
decrement_indent_level
s = ""
s += indent
s += end_string
output.puts s
return self
end
|
#get_c_strings ⇒ Object
Also known as:
get_cl_strings, get_cuda_strings
14
15
16
17
|
# File 'lib/BOAST/Language/While.rb', line 14
def get_c_strings
return { :while => '"while (#{cond}) {"',
:end => '"}"' }
end
|
#get_fortran_strings ⇒ Object
19
20
21
22
|
# File 'lib/BOAST/Language/While.rb', line 19
def get_fortran_strings
return { :while => '"do while (#{cond})"',
:end => '"end do"' }
end
|
#open ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/BOAST/Language/While.rb', line 34
def open
s=""
s += indent
s += to_s
output.puts s
increment_indent_level
return self
end
|
#pr(*args) ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/BOAST/Language/While.rb', line 43
def pr(*args)
args = @args if args.length == 0 and @args
open
if @block then
@block.call(*args)
close
end
return self
end
|
#to_s ⇒ Object
30
31
32
|
# File 'lib/BOAST/Language/While.rb', line 30
def to_s
return while_string(@condition)
end
|