Class: AdLint::TokenQueue

Inherits:
Array
  • Object
show all
Defined in:
lib/adlint/lexer.rb

Overview

DESCRIPTION

Token queue to interface to the parser.

Instance Method Summary collapse

Constructor Details

#initialize(tok_ary = nil) ⇒ TokenQueue

DESCRIPTION

Constructs an empty token queue or a solid token queue from specified token array.

PARAMETER

token_ary

TokenArray – Array of tokens.



48
49
50
51
52
53
54
# File 'lib/adlint/lexer.rb', line 48

def initialize(tok_ary = nil)
  if tok_ary
    super
  else
    super()
  end
end

Instance Method Details

#expect(tok_type) ⇒ Object



56
57
58
59
# File 'lib/adlint/lexer.rb', line 56

def expect(tok_type)
  tok = self.first
  tok && tok.type == tok_type ? true : false
end