mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
* src/system.h: We don't need nor want bcopy.
Throw away MS-DOS crap: we don't need getpid. * configure.in: We don't need strndup. It was even causing problems: because Flex includes the headers *before* us, _GNU_SOURCE is not defined by config.h, and therefore strndup was not visible. * lib/xstrndup.c: New. * src/scan-skel.l: Use it. Be sure to initialize yylval.muscle member when scanning a MUSCLE. * src/parse-skel.y: Use %directives instead of #defines.
This commit is contained in:
@@ -20,11 +20,9 @@
|
||||
02111-1307, USA. */
|
||||
|
||||
%{
|
||||
|
||||
#include "system.h"
|
||||
#include "skeleton.h"
|
||||
#include "parse-skel.h"
|
||||
|
||||
%}
|
||||
|
||||
%option nounput
|
||||
@@ -49,31 +47,25 @@
|
||||
"%%{actions}" { return ACTIONS; }
|
||||
"%%{tokendef}" { return TOKENS; }
|
||||
|
||||
"%%{"[a-zA-Z][0-9a-zA-Z_-]+"}" { /* Muscle. */
|
||||
size_t len = strlen (yytext);
|
||||
yylval.string = (char*) malloc (len - 3);
|
||||
strncpy (yylval.string, yytext + 3, len - 4);
|
||||
yylval.string[len - 4] = 0;
|
||||
/* Muscle. */
|
||||
"%%{"[a-zA-Z][0-9a-zA-Z_-]+"}" {
|
||||
yylval.muscle = xstrndup (yytext + 3, yyleng - 4);
|
||||
return MUSCLE;
|
||||
}
|
||||
|
||||
"%%\"".*"\"" { /* String. */
|
||||
size_t len = strlen (yytext);
|
||||
yylval.string = (char*) malloc (len - 3);
|
||||
strncpy (yylval.string, yytext + 3, len - 4);
|
||||
yylval.string[len - 4] = 0;
|
||||
/* String. */
|
||||
"%%\"".*"\"" {
|
||||
yylval.string = xstrndup (yytext + 3, yyleng - 4);
|
||||
return STRING;
|
||||
}
|
||||
|
||||
<<EOF>> { /* End of file. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
"\n" { /* End of line. */
|
||||
/* End of line. */
|
||||
"\n" {
|
||||
return '\n';
|
||||
}
|
||||
|
||||
. { /* Character. */
|
||||
/* Plain Character. */
|
||||
. {
|
||||
yylval.character = *yytext;
|
||||
return CHARACTER;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user