Commit 6aad8cc6 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(lexer.pushback): New function. Use it for @w. Also use it, intstead

	of lexer.ignore, for @code, @uref, @footnote, @email, @asis,
	@samp, @pxref, @var, @emph, @xref, @badspell, @holl and @file.
(lexer.__read_arg): Handle nested braces properly.
parent 9e9d6f8b
......@@ -294,7 +294,6 @@ class lexer:
toplevel_setchapternewpage = ignore
toplevel_set = ignore
toplevel_macro = ignore
toplevel_code = ignore
toplevel_end = ignore
toplevel_ifinfo = ignore
toplevel_value = ignore
......@@ -320,16 +319,11 @@ class lexer:
toplevel_html = ignore
toplevel_ifnottex = ignore
toplevel_top = ignore
toplevel_uref = ignore
toplevel_menu = ignore
toplevel_chapter = ignore
toplevel_uref = ignore
toplevel_footnote = ignore
toplevel_email = ignore
toplevel_penalty = ignore
toplevel_section = ignore
toplevel_table = ignore
toplevel_asis = ignore
toplevel_item = ignore
toplevel_req = ignore
toplevel_reqlink = ignore
......@@ -340,8 +334,6 @@ class lexer:
toplevel_multitable = ignore
toplevel_tab = ignore
toplevel_aux = ignore
toplevel_samp = ignore
toplevel_pxref = ignore
toplevel_errorcode = ignore
toplevel_misc = ignore
toplevel_type = ignore
......@@ -350,12 +342,9 @@ class lexer:
toplevel_conftype = ignore
toplevel_command = ignore
toplevel_ref = ignore
toplevel_var = ignore
toplevel_subsubsection = ignore
toplevel_priv = ignore
toplevel_emph = ignore
toplevel_enumerate = ignore
toplevel_xref = ignore
toplevel_itemx = ignore
toplevel_ae = ignore
toplevel_i = ignore
......@@ -377,12 +366,30 @@ class lexer:
toplevel_anchor = ignore
toplevel_appendix = ignore
toplevel_display = ignore
toplevel_badspell = ignore
toplevel_holl = ignore
toplevel_daemon = ignore
toplevel_file = ignore
toplevel_TeX = ignore
def pushback(self, arg, line_no):
lst = list(arg)
lst.reverse()
for char in lst:
self.__reader.ungetc(char)
toplevel_w = pushback
toplevel_code = pushback
toplevel_uref = pushback
toplevel_footnote = pushback
toplevel_email = pushback
toplevel_asis = pushback
toplevel_samp = pushback
toplevel_pxref = pushback
toplevel_var = pushback
toplevel_emph = pushback
toplevel_xref = pushback
toplevel_badspell = pushback
toplevel_holl = pushback
toplevel_file = pushback
def toplevel_node(self, arg, line_no):
if self.__findex != None:
self.__findex = None
......@@ -1100,12 +1107,23 @@ class lexer:
def __read_arg(self):
arg = ""
level = 0
while 1:
c = self.__reader.getc()
if c == '}':
return arg
else:
if c == '@':
# Handle '@{', '@}', and '@@' (and everything else
# that starts with `@').
arg = arg + c
c = self.__reader.getc()
elif c == '{':
level = level + 1
elif c == '}':
if level == 0:
return arg
level = level - 1
arg = arg + c
def error(self, line_no, errmsg):
self.__reader.error(line_no, errmsg)
......
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