Class: Rley::Syntax::MatchClosest

Inherits:
Object
  • Object
show all
Defined in:
lib/rley/syntax/match_closest.rb

Overview

A constraint that indicates that a given rhs member must match the closest given terminal symbol in that rhs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aSymbolSeq, idxSymbol, nameClosest) ⇒ MatchClosest

Returns a new instance of MatchClosest.

Parameters:

  • aSymbolSeq (Rley::Syntax::SymbolSeq)

    a sequence of grammar symbols

  • idxSymbol (Integer)

    index of symbol

  • nameClosest (String)

    Terminal symbol name



20
21
22
23
# File 'lib/rley/syntax/match_closest.rb', line 20

def initialize(aSymbolSeq, idxSymbol, nameClosest)
  @idx_symbol = valid_idx_symbol(idxSymbol, aSymbolSeq)
  @closest_symb = valid_name_closest(nameClosest)
end

Instance Attribute Details

#closest_symbString (readonly)

Returns name of closest preceding symbol to pair.

Returns:

  • (String)

    name of closest preceding symbol to pair



12
13
14
# File 'lib/rley/syntax/match_closest.rb', line 12

def closest_symb
  @closest_symb
end

#entriesNilClass, Array<Parser::ParseEntry>

Returns set of entries with closest symbol.

Returns:



15
16
17
# File 'lib/rley/syntax/match_closest.rb', line 15

def entries
  @entries
end

#idx_symbolInteger (readonly)

Returns index of constrained symbol to match.

Returns:

  • (Integer)

    index of constrained symbol to match



9
10
11
# File 'lib/rley/syntax/match_closest.rb', line 9

def idx_symbol
  @idx_symbol
end