Class: Mulang::Language::External
- Inherits:
-
Base
- Object
- Base
- Mulang::Language::External
show all
- Defined in:
- lib/mulang/language.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#ast_analysis, #identifiers, #identifiers_analysis, #normalization_options, #transformed_asts, #transformed_asts_analysis
Constructor Details
#initialize(language_name = nil, &tool) ⇒ External
65
66
67
68
|
# File 'lib/mulang/language.rb', line 65
def initialize(language_name = nil, &tool)
@name = language_name
@tool = block_given? ? tool : proc { |it| it }
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
63
64
65
|
# File 'lib/mulang/language.rb', line 63
def name
@name
end
|
Instance Method Details
#ast(content, **args) ⇒ Object
70
71
72
73
74
75
76
|
# File 'lib/mulang/language.rb', line 70
def ast(content, **args)
if args[:serialization]
super
else
call_tool content
end
end
|
#base_analysis ⇒ Object
85
86
87
|
# File 'lib/mulang/language.rb', line 85
def base_analysis(*)
super.deep_merge(spec: {originalLanguage: @name}.compact)
end
|
#sample(content) ⇒ Object
78
79
80
81
82
83
|
# File 'lib/mulang/language.rb', line 78
def sample(content)
{
tag: 'MulangSample',
ast: call_tool(content)
}
end
|