* src/reader.c (parse_dquoted_param): New.

(parse_skel_decl): Use it.
* src/lex.h: Add its prototype.
* src/lex.c (literalchar): Become not static.
This commit is contained in:
Marc Autret
2001-11-28 22:28:01 +00:00
parent ec93a21372
commit 426cf563bd
4 changed files with 56 additions and 2 deletions

View File

@@ -1,3 +1,10 @@
2001-11-28 Marc Autret <autret_m@epita.fr>
* src/reader.c (parse_dquoted_param): New.
(parse_skel_decl): Use it.
* src/lex.h: Add its prototype.
* src/lex.c (literalchar): Become not static.
2001-11-28 Marc Autret <autret_m@epita.fr>
* src/output.h: And put its extern declaration here.

View File

@@ -152,7 +152,7 @@ xgetc (FILE *f)
being, I prefer have literalchar behave like quotearg, and change
my mind later if I was wrong. */
static int
int
literalchar (struct obstack *out, int *pcode, char term)
{
int c;

View File

@@ -73,6 +73,7 @@ void read_type_name PARAMS ((FILE *fin));
entry found. */
token_t lex PARAMS ((void));
int literalchar PARAMS ((struct obstack *out, int *pcode, char term));
token_t parse_percent_token PARAMS ((void));

View File

@@ -964,6 +964,52 @@ parse_muscle_decl (void)
}
/*---------------------------------.
| Parse a double quoted parameter. |
`---------------------------------*/
static const char *
parse_dquoted_param (const char *from)
{
struct obstack param_obstack;
const char *param = NULL;
int c;
obstack_init (&param_obstack);
c = skip_white_space ();
if (c != '"')
{
complain (_("invalid %s declaration"), from);
ungetc (c, finput);
skip_to_char ('%');
return NULL;
}
for (;;)
{
if (literalchar (NULL, &c, '\"'))
obstack_1grow (&param_obstack, c);
else
break;
}
obstack_1grow (&param_obstack, '\0');
param = obstack_finish (&param_obstack);
if (c != '"' || strlen (param) == 0)
{
complain (_("invalid %s declaration"), from);
if (c != '"')
ungetc (c, finput);
skip_to_char ('%');
return NULL;
}
return param;
}
/*----------------------------------.
| Parse what comes after %skeleton. |
`----------------------------------*/
@@ -971,7 +1017,7 @@ parse_muscle_decl (void)
void
parse_skel_decl (void)
{
/* Complete with parse_dquoted_param () on the CVS branch 1.29. */
skeleton = parse_dquoted_param ("%skeleton");
}
/*----------------------------------------------------------------.