37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/lexer.rb', line 37
def next_token
return if @ss.eos?
result = false
while !result
result = case
when text = @ss.scan(SPACE) then
when text = @ss.scan(GTEQ) then [:GTEQ, text]
when text = @ss.scan(LTEQ) then [:LTEQ, text]
when text = @ss.scan(NEQ) then [:NEQ, text]
when text = @ss.scan(GT) then [:GT, text]
when text = @ss.scan(LT) then [:LT, text]
when text = @ss.scan(EQ) then [:EQ, text]
when text = @ss.scan(PLUS) then [:PLUS, text]
when text = @ss.scan(MATCH_OP) then [:MATCH_OP, text]
when text = @ss.scan(AND) then [:AND, text]
when text = @ss.scan(CHECK) then [:CHECK, text]
when text = @ss.scan(UNIQUE) then [:UNIQUE, text]
when text = @ss.scan(PRIMARY_KEY) then [:PRIMARY_KEY, text]
when text = @ss.scan(FOREIGN_KEY) then [:FOREIGN_KEY, text]
when text = @ss.scan(REFERENCES) then [:REFERENCES, text]
when text = @ss.scan(DELETE) then [:DELETE, text]
when text = @ss.scan(ON) then [:ON, text]
when text = @ss.scan(RESTRICT) then [:RESTRICT, text]
when text = @ss.scan(CASCADE) then [:CASCADE, text]
when text = @ss.scan(IDENT) then [:IDENT, text]
when text = @ss.scan(STRLIT) then [:STRLIT, text]
when text = @ss.scan(INT) then [:INT, text]
when text = @ss.scan(LPAREN) then [:LPAREN, text]
when text = @ss.scan(RPAREN) then [:RPAREN, text]
when text = @ss.scan(TYPE) then [:TYPE, text]
when text = @ss.scan(COMMA) then [:COMMA, text]
else
x = @ss.getch
[x, x]
end
end
result
end
|