Class: Yadriggy::ASTnode::GetLocation
Instance Method Summary
collapse
Methods inherited from EvalAll
#array, #array_ref, #begin_end, #binary, #block, #break_out, #call, #class_def, #conditional, #const_path_ref, #define, #exprs, #for_loop, #hash, #loop, #module_def, #nil_value, #paren, #program, #rescue_end, #return_values, #singular_class_def, #string_interpolation, #super_method, #unary
Methods inherited from Eval
#array, #array_ref, #array_ref_field, #assign, #astree, #being_end, #binary, #block, #break_out, #call, #class_def, #command, #conditional, #const, #const_path_field, #const_path_ref, #define, #dots, #evaluate, #exprs, #for_loop, #global_variable, #hash, #identifier, #identifier_or_call, #instance_variable, #label, #lambda_expr, #loop, #module_def, #nil_value, #paren, #program, #rescue_end, #reserved, #return_values, #singular_class_def, #string_interpolation, #super_method, #unary, #variable_call
Constructor Details
32
33
34
35
36
|
# File 'lib/yadriggy/ast_location.rb', line 32
def initialize
@unknown = true
@line_no = 0
@column = 0
end
|
Instance Method Details
#name(expr) ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/yadriggy/ast_location.rb', line 44
def name(expr)
super
if @unknown
@unknown = false
@line_no = expr.line_no
@column = expr.column
else
if expr.line_no < @line_no
@line_no = expr.line_no
@column = expr.column
elsif expr.line_no == @line_no && expr.column < @column
@column = expr.column
end
end
end
|
#number(expr) ⇒ Object
64
65
66
|
# File 'lib/yadriggy/ast_location.rb', line 64
def number(expr)
name(expr)
end
|
#result(file_name) ⇒ Object
40
41
42
|
# File 'lib/yadriggy/ast_location.rb', line 40
def result(file_name)
[file_name, @line_no, @column]
end
|
#string_literal(expr) ⇒ Object
68
69
70
|
# File 'lib/yadriggy/ast_location.rb', line 68
def string_literal(expr)
name(expr)
end
|
#symbol(expr) ⇒ Object
60
61
62
|
# File 'lib/yadriggy/ast_location.rb', line 60
def symbol(expr)
name(expr)
end
|
#unknown? ⇒ Boolean
38
|
# File 'lib/yadriggy/ast_location.rb', line 38
def unknown?() @unknown end
|