Class: NTKSemantics

Inherits:
Semantics show all
Defined in:
lib/semantics.rb

Overview

Semantics for NTK Generated SITAC

Instance Attribute Summary

Attributes inherited from Semantics

#regexes, #sems

Instance Method Summary collapse

Methods inherited from Semantics

#sems_and_regexes

Constructor Details

#initializeNTKSemantics

Returns a new instance of NTKSemantics.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/semantics.rb', line 29

def initialize
  super
  @regexes = {
    body: %r{<figures>((.|\n)*)</figures>},
    figure: %r{<figure .*?>((.|\n)*?)</figure>},
    figType: %r{<figureType>(.*)</figureType>},
    figName: %r{<name>(.*)</name>},
    figHoriz: %r{<horizontal>(.*)</horizontal>},
    figVert: %r{<vertical>(.*)</vertical>},
    figPoints: %r{<points>((.|\n)*)</points>},
    figPoint: %r{<point>((.|\n)*?)</point>},
    ptLatitude: %r{<latitude>(.*)</latitude>},
    ptLongitude: %r{<longitude>(.*)</longitude>},
    bullseye: %r{<bullseye>(.*)</bullseye>},
    bullsRings: %r{<numberOfRings>(.*)</numberOfRings>},
    bullsDist: %r{<distanceBetweenRing>(.*)</distanceBetweenRing>}
  }
  @sems = {}
  @regexes.each do |key, value|
    @sems[key] = value.to_s.scan(/<(.*)>/).first.first.to_sym
  end
end