Class: Wexpr::PrivateParserState

Inherits:
Object
  • Object
show all
Defined in:
lib/wexpr/private_parser_state.rb

Overview

Internal class which manges the parser state when parsing

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePrivateParserState

Returns a new instance of PrivateParserState.



12
13
14
15
16
17
18
# File 'lib/wexpr/private_parser_state.rb', line 12

def initialize()
	# start at beginning of file
	@line = 1
	@column = 1
	@internalReferenceMap = {}
	@externalReferenceMap = {}
end

Instance Attribute Details

#columnObject

Returns the value of attribute column.



8
9
10
# File 'lib/wexpr/private_parser_state.rb', line 8

def column
  @column
end

#externalReferenceMapObject

Returns the value of attribute externalReferenceMap.



10
11
12
# File 'lib/wexpr/private_parser_state.rb', line 10

def externalReferenceMap
  @externalReferenceMap
end

#internalReferenceMapObject

Returns the value of attribute internalReferenceMap.



9
10
11
# File 'lib/wexpr/private_parser_state.rb', line 9

def internalReferenceMap
  @internalReferenceMap
end

#lineObject

Returns the value of attribute line.



7
8
9
# File 'lib/wexpr/private_parser_state.rb', line 7

def line
  @line
end

Instance Method Details

#move_forward_based_on_string(str) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/wexpr/private_parser_state.rb', line 20

def move_forward_based_on_string(str)
	str.each_char do |c|
		if c == '\n' # newline
			@line += 1
			@column = 1
		else
			@column = 1
		end
	end
end