nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'update_syntax' into next
[nit.git]
/
src
/
parser
/
lexer.nit
diff --git
a/src/parser/lexer.nit
b/src/parser/lexer.nit
index
3c0f81c
..
e66dc87
100644
(file)
--- a/
src/parser/lexer.nit
+++ b/
src/parser/lexer.nit
@@
-41,15
+41,15
@@
redef class TComment
end
end
end
end
-redef class TKwpackage
+redef class TKwmodule
redef fun parser_index: Int
do
return 2
end
redef fun parser_index: Int
do
return 2
end
- init init_tk(loc: Location)
+ init init_tk(text: String, loc: Location)
do
do
- _text = once "package"
+ _text = text
_location = loc
end
end
_location = loc
end
end
@@
-106,15
+106,15
@@
redef class TKwinterface
end
end
end
end
-redef class TKwuniversal
+redef class TKwenum
redef fun parser_index: Int
do
return 7
end
redef fun parser_index: Int
do
return 7
end
- init init_tk(loc: Location)
+ init init_tk(text: String, loc: Location)
do
do
- _text = once "universal"
+ _text = text
_location = loc
end
end
_location = loc
end
end
@@
-1200,7
+1200,7
@@
end
# The lexer extract NIT tokens from an input stream.
# It is better user with the Parser
class Lexer
# The lexer extract NIT tokens from an input stream.
# It is better user with the Parser
class Lexer
-special TablesCapable
+ super TablesCapable
# Last peeked token
var _token: nullable Token
# Last peeked token
var _token: nullable Token
@@
-1264,7
+1264,7
@@
special TablesCapable
result = get_token
end
_token = null
result = get_token
end
_token = null
- return result.as(not null)
+ return result
end
# Get a token, or null if it is discarded
end
# Get a token, or null if it is discarded
@@
-1372,7
+1372,8
@@
special TablesCapable
return new TComment.init_tk(token_text, location)
end
if accept_token == 3 then
return new TComment.init_tk(token_text, location)
end
if accept_token == 3 then
- return new TKwpackage.init_tk(location)
+ var token_text = text.substring(0, accept_length)
+ return new TKwmodule.init_tk(token_text, location)
end
if accept_token == 4 then
return new TKwimport.init_tk(location)
end
if accept_token == 4 then
return new TKwimport.init_tk(location)
@@
-1387,7
+1388,8
@@
special TablesCapable
return new TKwinterface.init_tk(location)
end
if accept_token == 8 then
return new TKwinterface.init_tk(location)
end
if accept_token == 8 then
- return new TKwuniversal.init_tk(location)
+ var token_text = text.substring(0, accept_length)
+ return new TKwenum.init_tk(token_text, location)
end
if accept_token == 9 then
return new TKwspecial.init_tk(location)
end
if accept_token == 9 then
return new TKwspecial.init_tk(location)
@@
-1653,9
+1655,7
@@
special TablesCapable
end
end
end
end
end
end
- if false then break # FIXME remove once unreach loop exits are in c_src
end
end
- return null # FIXME remove once unreach loop exits are in c_src
end
# Read the next character.
end
# Read the next character.