Commit f2e52655 authored by Per Cederqvist's avatar Per Cederqvist

(lexer): Ignore @need, @reqexample and @anchor.

(lexer.__parse_userdefined_types): Handle @anchor.
(lexer.__parse_type): Requre @lt markup.
(lexer.__get_lt_token): New method.
(lexer.__get_token): Handle the new tokens '{' and '}'.
parent 6c7ca2ef
......@@ -374,6 +374,9 @@ class lexer:
toplevel_tex = ignore
toplevel_defcodeindex = ignore
toplevel_syncodeindex = ignore
toplevel_need = ignore
toplevel_reqexample = ignore
toplevel_anchor = ignore
def toplevel_node(self, arg, line_no):
if self.__findex != None:
......@@ -624,6 +627,19 @@ class lexer:
self.error(self.__reader.line_no(),
"``@end example'' expected")
break
if newtype == '@anchor':
if self.__get_token() != '{':
self.error(self.__reader.line_no(),
"@anchor must be followed by ``{''")
newtype = self.__get_token()
if self.__get_token() != '}':
self.error(self.__reader.line_no(),
"@anchor missing ``}''")
token = self.__get_token()
if token != newtype:
self.error(self.__reader.line_no(),
"@anchor mismatch -- ``%s'' or ``%s''?" % (
newtype, token))
token = self.__get_token()
if token != '::=':
self.error(self.__reader.line_no(), "``::='' expected")
......@@ -871,9 +887,9 @@ class lexer:
return
def __parse_type(self):
token = self.__get_token()
token = self.__get_lt_token()
if token == 'ARRAY':
token = self.__get_token()
token = self.__get_lt_token()
array = 1
else:
array = 0
......@@ -885,6 +901,25 @@ class lexer:
defined_types[token].use()
return (token, array)
def __get_lt_token(self):
token = self.__get_token()
if token != '@lt':
self.error(self.__reader.line_no(),
'expected @lt{}-enclosed token')
return token
token = self.__get_token()
if token != '{':
self.error(self.__reader.line_no(),
"expected ``{'', not ``%s''" % token)
return token
result = self.__get_token()
token = self.__get_token()
if token != '}':
self.error(self.__reader.line_no(),
"expected ``}'', not ``%s''" % token)
return result
def __bad_type(self, tp):
if tp in self.__builtin_types:
return 0
......@@ -990,7 +1025,7 @@ class lexer:
self.__reader.ungetc(':')
return c
return '::='
elif c in '[];|=':
elif c in '[];|={}':
return c
elif c in '()':
d = self.__reader.getc()
......
Markdown is supported
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