Commit f33cdba8 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(lexer.run): It is not OK to reach EOF.

(lexer.ignore): Ignore @display.
(lexer.toplevel_bye): Exit when reaching "bye".
(lexer.__parse_userdefined_types): Ignore @need commands.
parent effeda85
...@@ -244,10 +244,7 @@ class lexer: ...@@ -244,10 +244,7 @@ class lexer:
def run(self): def run(self):
while 1: while 1:
c = self.__reader.getc_eofok() c = self.__reader.getc()
if c == None:
self.__reader.check_paren_null()
return self.__reader.errfound()
if c == '@': if c == '@':
self.__toplevel_at() self.__toplevel_at()
...@@ -379,6 +376,7 @@ class lexer: ...@@ -379,6 +376,7 @@ class lexer:
toplevel_reqexample = ignore toplevel_reqexample = ignore
toplevel_anchor = ignore toplevel_anchor = ignore
toplevel_appendix = ignore toplevel_appendix = ignore
toplevel_display = ignore #
def toplevel_node(self, arg, line_no): def toplevel_node(self, arg, line_no):
if self.__findex != None: if self.__findex != None:
...@@ -562,6 +560,14 @@ class lexer: ...@@ -562,6 +560,14 @@ class lexer:
self.error(self.__reader.line_no(), self.error(self.__reader.line_no(),
"asynchronous message ``%s'' not documented" % req) "asynchronous message ``%s'' not documented" % req)
self.__reader.check_paren_null()
# This is the normal exit of the program. It isn't nice to hide
# it deep in the code like this, but neither is having an EOF
# command before the real EOF of the file.
sys.exit(self.__reader.errfound())
def toplevel_reqdlink(self, arg, line_no): def toplevel_reqdlink(self, arg, line_no):
self.__assert_no_linkhere() self.__assert_no_linkhere()
...@@ -629,6 +635,9 @@ class lexer: ...@@ -629,6 +635,9 @@ class lexer:
self.error(self.__reader.line_no(), self.error(self.__reader.line_no(),
"``@end example'' expected") "``@end example'' expected")
break break
if newtype == '@need':
self.__get_token() # Skip the argument to @need.
newtype = self.__get_token()
if newtype == '@anchor': if newtype == '@anchor':
if self.__get_token() != '{': if self.__get_token() != '{':
self.error(self.__reader.line_no(), self.error(self.__reader.line_no(),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment