Class: Parser

Inherits:
Object
  • Object
show all
Includes:
SITACParser
Defined in:
lib/sitac_parser.rb

Overview

Generic Parser class

Author:

  • PRV

Version:

  • 1.0.0

Direct Known Subclasses

NorthropParser

Constant Summary

Constants included from LogUtils

LogUtils::Log

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tokens, semantics = 'ntk') ⇒ Parser

Returns a new instance of Parser.



27
28
29
30
31
32
33
# File 'lib/sitac_parser.rb', line 27

def initialize(tokens, semantics = 'ntk')
  @tokens = tokens
  @name = @tokens.find { |token| token.type == ':figName' }.value.first.first
  @figures = []
  semclass = semantics == 'ntk' ? NTKSemantics.new : MelissaSemantics.new
  @sems, @regexes = semclass.sems_and_regexes
end

Instance Attribute Details

#figuresObject (readonly)

Returns the value of attribute figures.



25
26
27
# File 'lib/sitac_parser.rb', line 25

def figures
  @figures
end

#nameObject (readonly)

Returns the value of attribute name.



25
26
27
# File 'lib/sitac_parser.rb', line 25

def name
  @name
end

#tokensObject (readonly)

Returns the value of attribute tokens.



25
26
27
# File 'lib/sitac_parser.rb', line 25

def tokens
  @tokens
end