Class: CTokenizer::LexerBase

Inherits:
Object
  • Object
show all
Includes:
CTokenizer, Sourced, Enumerable
Defined in:
lib/caphir/ctokenizer.rb

Overview

wraps a lexer and uses that to produce new tokens

Constant Summary

Constants included from CTokenizer

CP_RESERVED, C_RESERVED, EOF_TOKEN

Instance Attribute Summary

Attributes included from Sourced

#source

Instance Method Summary collapse

Methods included from Sourced

#empty?, #file, #file=, #line, #line=, #match?, #scan, #shift

Methods included from CTokenizer

#collect, #each, #error, error, line_count, #parse_error, #to_a, #token_error, #unmatched_error, #warning

Constructor Details

#initialize(str, file = nil, line = 1) ⇒ LexerBase

Returns a new instance of LexerBase.


265
266
267
268
269
270
271
# File 'lib/caphir/ctokenizer.rb', line 265

def initialize(str, file=nil, line=1)
	if (str.class <= String)
		@source = Lexer.new(str, file, line)
	else
		@source = str
	end
end