add missing fie_access to html converter

This commit is contained in:
Torsten Ruger 2015-11-10 11:50:28 +02:00
parent dee9eb4dca
commit 0a67fc38e4
1 changed files with 13 additions and 0 deletions

View File

@ -8,6 +8,7 @@ class HtmlConverter < AST::Processor
end
def handler_missing s
puts "Missing: " + s.type
"Missing #{s.type}"
end
def div statement , html
"<div class='statement' id='i#{statement.object_id}'>" + html + "</div>"
@ -34,6 +35,18 @@ class HtmlConverter < AST::Processor
def on_string s
span(s, "'" + s.first + "'")
end
def on_receiver expression
span expression , process(expression.first)
end
def on_field expression
span expression , process(expression.first)
end
def on_field_access statement
receiver_ast , field_ast = *statement
receiver = process(receiver_ast)
field = process(field_ast)
span( statement , receiver + "." + field)
end
def on_field_def statement
type , name , value = *statement
str = span(type, type) + " " + process(name)