nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src: reduce warnings and spelling errors
[nit.git]
/
src
/
parser
/
lexer_work.nit
diff --git
a/src/parser/lexer_work.nit
b/src/parser/lexer_work.nit
index
253be72
..
d8c287a
100644
(file)
--- a/
src/parser/lexer_work.nit
+++ b/
src/parser/lexer_work.nit
@@
-19,34
+19,29
@@
intrude import parser_nodes
private import tables
redef class Token
private import tables
redef class Token
- var _text: nullable String
+ private var cached_text: nullable String
redef fun text
do
redef fun text
do
- var res = _text
+ var res = _cached_text
if res != null then return res
res = location.text
if res != null then return res
res = location.text
- _text = res
+ _cached_text = res
return res
end
redef fun text=(text)
do
return res
end
redef fun text=(text)
do
- _text = text
+ _cached_text = text
end
fun parser_index: Int is abstract
end
redef class EOF
end
fun parser_index: Int is abstract
end
redef class EOF
- redef fun parser_index: Int
- do
- return 97
- end
-
init init_tk(loc: Location)
do
init init_tk(loc: Location)
do
- _text = ""
+ _cached_text = ""
_location = loc
end
end
_location = loc
end
end
@@
-86,25
+81,25
@@
end
class Lexer
super TablesCapable
# Last peeked token
class Lexer
super TablesCapable
# Last peeked token
- var _token: nullable Token
+ var token: nullable Token
# Lexer current state
# Lexer current state
- var _state: Int = 0
+ private var state: Int = 0
# The source file
var file: SourceFile
# Current character in the stream
# The source file
var file: SourceFile
# Current character in the stream
- var _stream_pos: Int = 0
+ var stream_pos: Int = 0
# Current line number in the input stream
# Current line number in the input stream
- var _line: Int = 0
+ var line: Int = 0
# Current column in the input stream
# Current column in the input stream
- var _pos: Int = 0
+ var pos: Int = 0
- # Was the last character a cariage-return?
- var _cr: Bool = false
+ # Was the last character a carriage-return?
+ var cr: Bool = false
# Constante state values
private fun state_initial: Int do return 0 end
# Constante state values
private fun state_initial: Int do return 0 end
@@
-127,7
+122,7
@@
class Lexer
t = get_token
while t == null do t = get_token
t = get_token
while t == null do t = get_token
- if t._location != null then
+ if isset t._location then
var l = last_token
if l != null then
l.next_token = t
var l = last_token
if l != null then
l.next_token = t
@@
-174,7
+169,7
@@
class Lexer
if sp >= string_len then
dfa_state = -1
else
if sp >= string_len then
dfa_state = -1
else
- var c = string.chars[sp].ascii
+ var c = string[sp].ascii
sp += 1
var cr = _cr
sp += 1
var cr = _cr