Class: ExcelFormulaLexer

Inherits:
Object
  • Object
show all
Defined in:
lib/surpass/ExcelFormulaLexer.rb

Overview

ExcelFormulaLexer (ExcelFormula.g) Generated by ANTLR 3.1.2-2008-10-21 on 2009-06-15 23:03:59

Defined Under Namespace

Classes: CharStream, DFA, Token

Constant Summary collapse

COMMA =
25
TRUE_CONST =
12
PERCENT =
11
POWER =
10
FUNC_CHOOSE =
33
BANG =
28
EQ =
4
QUOTENAME =
31
LT =
19
NE =
21
GT =
20
FUNC_IF =
32
RP =
27
FALSE_CONST =
13
LP =
26
GE =
23
MUL =
8
NUM_CONST =
16
REF2D =
17
SEMICOLON =
24
CONCAT =
5
EOF =
-1
LE =
22
INT_CONST =
15
STR_CONST =
14
COLON =
18
DIV =
9
DIGIT =
29
SUB =
7
NAME =
30
ADD =
6

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ ExcelFormulaLexer

Returns a new instance of ExcelFormulaLexer.



39
40
41
42
43
44
45
# File 'lib/surpass/ExcelFormulaLexer.rb', line 39

def initialize(input)
    input = StringIO.new(input) if input.respond_to?(:to_str)
    @input = CharStream.new(input)
    @backtracking = 0
    @failed = false

end

Instance Method Details

#next_tokenObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/surpass/ExcelFormulaLexer.rb', line 47

def next_token
	# TODO: catch exceptions
		@token = nil
		@channel = nil
		@text = nil

		@start = @input.index
		@line = @input.line
		@pos = @input.column

		@type = nil
		@type_int = nil

		return :EOF if @input.look_ahead(1) == :EOF

		match_Tokens()

		if @token == nil
			@text ||= @input.substring(@start, @input.index - 1)
			@token = Token.new(@type, @type_int, @line, @pos, @text, @channel)
		end

    return @token
end

#special_state_transition(s) ⇒ Object



917
918
919
# File 'lib/surpass/ExcelFormulaLexer.rb', line 917

def special_state_transition(s)
		-1
end