X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/a1a867fb1c1e2901c238afa76abb2f2168efca20..a2320c4fc025a6262bc6cfa6e420d85fe8d60bd6:/macro.c diff --git a/macro.c b/macro.c index d87e2dd7..4c24c01f 100644 --- a/macro.c +++ b/macro.c @@ -1,4 +1,4 @@ -/* $Id: macro.c,v 1.38 2009/01/16 11:50:54 kristaps Exp $ */ +/* $Id: macro.c,v 1.40 2009/01/17 16:15:27 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -577,7 +577,7 @@ macro_text(MACRO_PROT_ARGS) return(mdoc_perr(mdoc, line, ppos, "too many arguments")); } - c = mdoc_elem_alloc(mdoc, line, la, tok, argc, argv); + c = mdoc_elem_alloc(mdoc, line, ppos, tok, argc, argv); if (0 == c) { mdoc_argv_free(argc, argv); @@ -629,7 +629,7 @@ macro_text(MACRO_PROT_ARGS) lastpunct = 1; } else if (lastpunct) { c = mdoc_elem_alloc(mdoc, line, - la, tok, argc, argv); + ppos, tok, argc, argv); if (0 == c) { mdoc_argv_free(argc, argv); return(0); @@ -950,6 +950,8 @@ macro_constant_delimited(MACRO_PROT_ARGS) /* FALLTHROUGH */ case (MDOC_Ns): /* FALLTHROUGH */ + case (MDOC_Pf): + /* FALLTHROUGH */ case (MDOC_Ux): /* FALLTHROUGH */ case (MDOC_St): @@ -974,7 +976,7 @@ macro_constant_delimited(MACRO_PROT_ARGS) return(0); } - c = mdoc_elem_alloc(mdoc, line, lastarg, tok, argc, argv); + c = mdoc_elem_alloc(mdoc, line, ppos, tok, argc, argv); mdoc_argv_free(argc, argv); if (0 == c) @@ -1044,8 +1046,6 @@ macro_constant(MACRO_PROT_ARGS) struct mdoc_arg argv[MDOC_LINEARG_MAX]; char *p; - /* FIXME: parsing macros! */ - fl = 0; if (MDOC_QUOTABLE & mdoc_macros[tok].flags) fl = ARGS_QUOTED; @@ -1084,6 +1084,15 @@ macro_constant(MACRO_PROT_ARGS) if (ARGS_EOLN == c) break; + if (-1 == (c = lookup(mdoc, line, lastarg, tok, p))) + return(0); + else if (MDOC_MAX != c) { + if ( ! rewind_elem(mdoc, tok)) + return(0); + return(mdoc_macro(mdoc, c, line, + lastarg, pos, buf)); + } + if ( ! mdoc_word_alloc(mdoc, line, lastarg, p)) return(0); mdoc->next = MDOC_NEXT_SIBLING;