[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7242] parsetexi update
From: |
gavinsmith0123 |
Subject: |
[7242] parsetexi update |
Date: |
Sun, 3 Jul 2016 15:49:22 +0000 (UTC) |
Revision: 7242
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7242
Author: gavin
Date: 2016-07-03 15:49:22 +0000 (Sun, 03 Jul 2016)
Log Message:
-----------
parsetexi update
Modified Paths:
--------------
trunk/tp/parsetexi/parser.c
trunk/tp/parsetexi/separator.c
Modified: trunk/tp/parsetexi/parser.c
===================================================================
--- trunk/tp/parsetexi/parser.c 2016-07-03 14:01:44 UTC (rev 7241)
+++ trunk/tp/parsetexi/parser.c 2016-07-03 15:49:22 UTC (rev 7242)
@@ -784,6 +784,7 @@
{
ELEMENT *last_child;
ELEMENT *raw_command = current;
+ char *tmp = 0;
last_child = last_contents_child (current);
@@ -812,6 +813,26 @@
}
}
+ // 3779
+ /* 'line' is now advanced past the "@end ...". Check if
+ there's anything after it. */
+ p = line + strspn (line, whitespace_chars);
+ if (*p && *p != '@')
+ goto superfluous_arg;
+ p++;
+ tmp = read_command_name (&p);
+ if (tmp && !strcmp (tmp, "c") && !strcmp (tmp, "comment"))
+ {
+ }
+ else if (0)
+ {
+superfluous_arg:
+ line_warn ("superfluous argument to @end %s: %s",
+ command_name (current->cmd), line);
+ }
+ free (tmp);
+
+
/* For macros, define a new macro (unless we are in a nested
macro definition). */
if ((end_cmd == CM_macro || end_cmd == CM_rmacro)
@@ -1326,6 +1347,8 @@
|| cmd == CM_clear
|| cmd == CM_end) // 373
ok = 1;
+ else if (cmd_flags & CF_format_raw)
+ ok = 1; // 379
if (outer == CM_center
|| outer == CM_exdent
Modified: trunk/tp/parsetexi/separator.c
===================================================================
--- trunk/tp/parsetexi/separator.c 2016-07-03 14:01:44 UTC (rev 7241)
+++ trunk/tp/parsetexi/separator.c 2016-07-03 15:49:22 UTC (rev 7242)
@@ -179,18 +179,11 @@
{
current->type = ET_brace_command_arg;
- if (command_data(command).flags & CF_inline)
- {
- // 4956
-
- if (command == CM_inlineraw)
- push_context (ct_inlineraw);
- }
/* Commands which are said to take a positive number of arguments
disregard leading and trailing whitespace. In
'handle_close_brace', the 'brace_command_contents' array
is set. */
- else if (command_data(command).data > 0)
+ if (command_data(command).data > 0)
{
ELEMENT *e;
e = new_element (ET_empty_spaces_before_argument);
@@ -199,6 +192,9 @@
add_to_element_contents (current, e);
add_extra_element (current->parent,
"spaces_before_argument", e);
+
+ if (command == CM_inlineraw)
+ push_context (ct_inlineraw);
}
}
debug ("OPENED");
@@ -372,12 +368,17 @@
|| closed_command == CM_abbr
|| closed_command == CM_acronym)
{ // 5129
+ KEY_PAIR *k;
if (current->parent->cmd == CM_inlineraw)
{
if (ct_inlineraw != pop_context ())
abort ();
}
- if (current->parent->args.number == 0)
+ if (current->parent->args.number == 0
+ || !(k = lookup_extra_key (current->parent,
+ "brace_command_contents"))
+ || !k->value || k->value->contents.number == 0
+ || !k->value->contents.list[0])
{
line_warn ("@%s missing first argument",
command_name(current->parent->cmd));
@@ -639,7 +640,7 @@
|| current->cmd == CM_inlineifclear)
{
expandp = 0;
- if (fetch_value (current, inline_type, strlen (inline_type)))
+ if (fetch_value (inline_type, strlen (inline_type)))
expandp = 1;
if (current->cmd == CM_inlineifclear)
expandp = !expandp;
@@ -652,10 +653,55 @@
/* Skip first argument for a false @inlinefmtifelse */
if (!expandp && current->cmd == CM_inlinefmtifelse)
{
- // TODO
+ ELEMENT *e;
+ int brace_count = 1;
+
+ add_extra_string (current, "expand_index", "2");
+
+ /* Add a dummy argument for the first argument. */
+ e = new_element (ET_elided);
+ add_to_element_args (current, e);
+ register_command_arg (e, "brace_command_contents");
+
+ /* Scan forward to get the next argument. */
+ while (brace_count > 0)
+ {
+ line += strcspn (line, "{},");
+ switch (*line)
+ {
+ case ',':
+ if (brace_count == 1)
+ {
+ line++;
+ goto inlinefmtifelse_done;
+ }
+ break;
+ case '{':
+ brace_count++;
+ break;
+ case '}':
+ brace_count--;
+ break;
+ default:
+ line = next_text ();
+ if (!line)
+ {
+ /* ERROR - unbalanced brace */
+ }
+ continue;
+ }
+ line++;
+ }
+inlinefmtifelse_done:
+ /* Check if the second argument is missing. */
+ if (brace_count == 0)
+ {
+ line--; /* on '}' */
+ }
+
+ counter_dec (&count_remaining_args);
+ expandp = 1;
}
- counter_dec (&count_remaining_args);
- expandp = 1;
}
else if (current->cmd == CM_inlinefmtifelse)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7242] parsetexi update,
gavinsmith0123 <=