Top Level Namespace
Defined Under Namespace
Modules: Resyma
Classes: FieldVisualizer, LangDate, LangRubymoji, LangTOML, LangTOMLBuilder, LangTOMLNamespace, LangTimeline, Visualizer
Instance Method Summary
collapse
Instance Method Details
#date(&block) ⇒ Object
34
35
36
|
# File 'lib/resyma/nise/date.rb', line 34
def date(&block)
LangDate.load(&block)
end
|
#launch ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/resyma/program/traverse.rb', line 34
def launch
option = {
output_filename: "./resyma-traverse.png",
language: LangDate
}
available_languages = {
"date" => LangDate,
"toml" => LangTOML,
"rubymoji" => LangRubymoji
}
OptionParser.new do |opts|
opts.on("-o", "--output FILE",
"PNG containing the resulting tree") do |file|
option[:output_filename] = file
end
opts.on("-l", "--language LANG",
"Language used to traverse the tree") do |lang|
option[:language] = available_languages[lang]
if option[:language].nil?
raise "Unknown language #{lang}. " +
"Available languages are #{available_languages.keys}"
end
end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end.parse!
puts "Input source of #{option[:language]}"
source = $stdin.read
ast = Parser::CurrentRuby.parse(source)
pt = Resyma::Core::DEFAULT_CONVERTER.convert(ast)
lang = option[:language].new
lang.build_language(lang.method(:syntax))
engine = lang.engine
engine.traverse!(pt)
viz = FieldVisualizer.new
viz.viz!(pt)
viz.output(option[:output_filename])
end
|
#rumoji(&block) ⇒ Object
11
12
13
|
# File 'lib/resyma/nise/rubymoji.rb', line 11
def rumoji(&block)
LangRubymoji.load(&block)
end
|