Class: Mulang::Language::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/mulang/language.rb

Direct Known Subclasses

External, Native

Instance Method Summary collapse

Instance Method Details

#ast(content, **options) ⇒ Object



23
24
25
# File 'lib/mulang/language.rb', line 23

def ast(content, **options)
  Mulang.analyse(ast_analysis(content, **options), **options)['outputAst'] rescue nil
end

#ast_analysis(content, **options) ⇒ Object



27
28
29
# File 'lib/mulang/language.rb', line 27

def ast_analysis(content, **options)
  base_analysis content, {includeOutputAst: true}, **options
end

#identifiers(content, **options) ⇒ Object



3
4
5
# File 'lib/mulang/language.rb', line 3

def identifiers(content, **options)
  Mulang.analyse(identifiers_analysis(content, **options), **options)['outputIdentifiers'] rescue nil
end

#identifiers_analysis(content, **options) ⇒ Object



7
8
9
# File 'lib/mulang/language.rb', line 7

def identifiers_analysis(content, **options)
  base_analysis content, {includeOutputIdentifiers: true}, **options
end

#normalization_options(**options) ⇒ Object



19
20
21
# File 'lib/mulang/language.rb', line 19

def normalization_options(**options)
  options.except(:serialization).presence
end

#transformed_asts(content, operations, **options) ⇒ Object



11
12
13
# File 'lib/mulang/language.rb', line 11

def transformed_asts(content, operations, **options)
  Mulang.analyse(transformed_asts_analysis(content, operations, **options), **options)['transformedAsts'] rescue nil
end

#transformed_asts_analysis(content, operations, **options) ⇒ Object



15
16
17
# File 'lib/mulang/language.rb', line 15

def transformed_asts_analysis(content, operations, **options)
  base_analysis content, {transformationSpecs: operations}, **options
end