1 /* Bison Grammar Scanner -*- C -*-
3 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 Free Software Foundation, Inc.
6 This file is part of Bison, the GNU Compiler Compiler.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 %option debug nodefault noinput nounput noyywrap never-interactive
22 %option prefix="gram_" outfile="lex.yy.c"
25 /* Work around a bug in flex 2.5.31. See Debian bug 333231
26 <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>. */
30 #define FLEX_PREFIX(Id) gram_ ## Id
31 #include <src/flex-scanner.h>
33 #include <src/complain.h>
34 #include <src/files.h>
37 #include <src/reader.h>
38 #include <src/uniqstr.h>
44 #include <src/scan-gram.h>
46 #define YY_DECL GRAM_LEX_DECL
48 #define YY_USER_INIT \
49 code_start = scanner_cursor = loc->start; \
51 /* Location of scanner cursor. */
52 static boundary scanner_cursor;
54 #define YY_USER_ACTION location_compute (loc, &scanner_cursor, yytext, yyleng);
56 static size_t no_cr_read (FILE *, char *, size_t);
57 #define YY_INPUT(buf, result, size) ((result) = no_cr_read (yyin, buf, size))
59 #define RETURN_PERCENT_FLAG(Value) \
61 val->uniqstr = uniqstr_new (Value); \
62 return PERCENT_FLAG; \
65 #define ROLLBACK_CURRENT_TOKEN \
67 scanner_cursor.column -= mbsnwidth (yytext, yyleng, 0); \
71 /* A string representing the most recently saved token. */
72 static char *last_string;
74 /* Bracketed identifier. */
75 static uniqstr bracketed_id_str = 0;
76 static location bracketed_id_loc;
77 static boundary bracketed_id_start;
78 static int bracketed_id_context_state = 0;
81 gram_scanner_last_string_free (void)
86 static void handle_syncline (char *, location);
87 static unsigned long int scan_integer (char const *p, int base, location loc);
88 static int convert_ucn_to_byte (char const *hex_text);
89 static void unexpected_eof (boundary, char const *);
90 static void unexpected_newline (boundary, char const *);
93 /* A C-like comment in directives/rules. */
95 /* Strings and characters in directives/rules. */
96 %x SC_ESCAPED_STRING SC_ESCAPED_CHARACTER
97 /* A identifier was just read in directives/rules. Special state
98 to capture the sequence `identifier :'. */
99 %x SC_AFTER_IDENTIFIER
100 /* A complex tag, with nested angles brackets. */
103 /* Three types of user code:
104 - prologue (code between `%{' `%}' in the first section, before %%);
105 - actions, printers, union, etc, (between braced in the middle section);
106 - epilogue (everything after the second %%). */
107 %x SC_PROLOGUE SC_BRACED_CODE SC_EPILOGUE
108 /* C and C++ comments in code. */
109 %x SC_COMMENT SC_LINE_COMMENT
110 /* Strings and characters in code. */
111 %x SC_STRING SC_CHARACTER
112 /* Bracketed identifiers support. */
113 %x SC_BRACKETED_ID SC_RETURN_BRACKETED_ID
115 letter [-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
116 id {letter}({letter}|[0-9])*
120 /* POSIX says that a tag must be both an id and a C union member, but
121 historically almost any character is allowed in a tag. We disallow
122 NUL, as this simplifies our implementation. We disallow angle
123 bracket to match them in nested pairs: several languages use them
124 for generics/template types. */
127 /* Zero or more instances of backslash-newline. Following GCC, allow
128 white space between the backslash and the newline. */
129 splice (\\[ \f\t\v]*\n)*
133 /* Nesting level. Either for nested braces, or nested angle brackets
135 int nesting IF_LINT (= 0);
137 /* Parent context state, when applicable. */
138 int context_state IF_LINT (= 0);
140 /* Location of most recent identifier, when applicable. */
141 location id_loc IF_LINT (= empty_location);
143 /* Where containing code started, when applicable. Its initial
144 value is relevant only when yylex is invoked in the SC_EPILOGUE
146 boundary code_start = scanner_cursor;
148 /* Where containing comment or string or character literal started,
150 boundary token_start IF_LINT (= scanner_cursor);
154 /*-----------------------.
155 | Scanning white space. |
156 `-----------------------*/
158 <INITIAL,SC_AFTER_IDENTIFIER,SC_BRACKETED_ID,SC_RETURN_BRACKETED_ID>
160 /* Comments and white space. */
161 "," warn_at (*loc, _("stray `,' treated as white space"));
165 token_start = loc->start;
166 context_state = YY_START;
167 BEGIN SC_YACC_COMMENT;
170 /* #line directives are not documented, and may be withdrawn or
171 modified in future versions of Bison. */
172 ^"#line "{int}" \"".*"\"\n" {
173 handle_syncline (yytext + sizeof "#line " - 1, *loc);
178 /*----------------------------.
179 | Scanning Bison directives. |
180 `----------------------------*/
182 /* For directives that are also command line options, the regex must be
184 after "[-_]"s are removed, and the directive must match the --long
185 option name, with a single string argument. Otherwise, add exceptions
186 to ../build-aux/cross-options.pl. */
190 "%binary" return PERCENT_NONASSOC;
191 "%code" return PERCENT_CODE;
192 "%debug" RETURN_PERCENT_FLAG("parse.trace");
193 "%default"[-_]"prec" return PERCENT_DEFAULT_PREC;
194 "%define" return PERCENT_DEFINE;
195 "%defines" return PERCENT_DEFINES;
196 "%destructor" return PERCENT_DESTRUCTOR;
197 "%dprec" return PERCENT_DPREC;
198 "%error"[-_]"verbose" return PERCENT_ERROR_VERBOSE;
199 "%expect" return PERCENT_EXPECT;
200 "%expect"[-_]"rr" return PERCENT_EXPECT_RR;
201 "%file-prefix" return PERCENT_FILE_PREFIX;
202 "%fixed"[-_]"output"[-_]"files" return PERCENT_YACC;
203 "%initial-action" return PERCENT_INITIAL_ACTION;
204 "%glr-parser" return PERCENT_GLR_PARSER;
205 "%language" return PERCENT_LANGUAGE;
206 "%left" return PERCENT_LEFT;
207 "%lex-param" return PERCENT_LEX_PARAM;
208 "%locations" RETURN_PERCENT_FLAG("locations");
209 "%merge" return PERCENT_MERGE;
210 "%name"[-_]"prefix" return PERCENT_NAME_PREFIX;
211 "%no"[-_]"default"[-_]"prec" return PERCENT_NO_DEFAULT_PREC;
212 "%no"[-_]"lines" return PERCENT_NO_LINES;
213 "%nonassoc" return PERCENT_NONASSOC;
214 "%nondeterministic-parser" return PERCENT_NONDETERMINISTIC_PARSER;
215 "%nterm" return PERCENT_NTERM;
216 "%output" return PERCENT_OUTPUT;
217 "%parse-param" return PERCENT_PARSE_PARAM;
218 "%prec" return PERCENT_PREC;
219 "%precedence" return PERCENT_PRECEDENCE;
220 "%printer" return PERCENT_PRINTER;
221 "%pure"[-_]"parser" RETURN_PERCENT_FLAG("api.pure");
222 "%require" return PERCENT_REQUIRE;
223 "%right" return PERCENT_RIGHT;
224 "%skeleton" return PERCENT_SKELETON;
225 "%start" return PERCENT_START;
226 "%term" return PERCENT_TOKEN;
227 "%token" return PERCENT_TOKEN;
228 "%token"[-_]"table" return PERCENT_TOKEN_TABLE;
229 "%type" return PERCENT_TYPE;
230 "%union" return PERCENT_UNION;
231 "%verbose" return PERCENT_VERBOSE;
232 "%yacc" return PERCENT_YACC;
235 complain_at (*loc, _("invalid directive: %s"), quote (yytext));
240 ";" return SEMICOLON;
243 val->uniqstr = uniqstr_new (yytext);
245 bracketed_id_str = NULL;
246 BEGIN SC_AFTER_IDENTIFIER;
250 val->integer = scan_integer (yytext, 10, *loc);
253 0[xX][0-9abcdefABCDEF]+ {
254 val->integer = scan_integer (yytext, 16, *loc);
258 /* Identifiers may not start with a digit. Yet, don't silently
259 accept "1FOO" as "1 FOO". */
261 complain_at (*loc, _("invalid identifier: %s"), quote (yytext));
265 "'" token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER;
268 "\"" token_start = loc->start; BEGIN SC_ESCAPED_STRING;
271 "%{" code_start = loc->start; BEGIN SC_PROLOGUE;
273 /* Code in between braces. */
277 code_start = loc->start;
278 BEGIN SC_BRACED_CODE;
282 "<*>" return TAG_ANY;
283 "<>" return TAG_NONE;
285 obstack_grow (&obstack_for_string, yytext + 1, yyleng - 2);
287 val->uniqstr = uniqstr_new (last_string);
293 token_start = loc->start;
298 static int percent_percent_count;
299 if (++percent_percent_count == 2)
301 return PERCENT_PERCENT;
305 bracketed_id_str = NULL;
306 bracketed_id_start = loc->start;
307 bracketed_id_context_state = YY_START;
308 BEGIN SC_BRACKETED_ID;
312 complain_at (*loc, _("invalid character: %s"), quote (yytext));
316 loc->start = loc->end = scanner_cursor;
322 /*--------------------------------------------------------------.
323 | Supporting \0 complexifies our implementation for no expected |
325 `--------------------------------------------------------------*/
327 <SC_ESCAPED_CHARACTER,SC_ESCAPED_STRING,SC_TAG>
329 \0 complain_at (*loc, _("invalid null character"));
333 /*-----------------------------------------------------------------.
334 | Scanning after an identifier, checking whether a colon is next. |
335 `-----------------------------------------------------------------*/
337 <SC_AFTER_IDENTIFIER>
340 if (bracketed_id_str)
342 ROLLBACK_CURRENT_TOKEN;
343 BEGIN SC_RETURN_BRACKETED_ID;
349 bracketed_id_start = loc->start;
350 bracketed_id_context_state = YY_START;
351 BEGIN SC_BRACKETED_ID;
355 BEGIN (bracketed_id_str ? SC_RETURN_BRACKETED_ID : INITIAL);
360 ROLLBACK_CURRENT_TOKEN;
361 BEGIN (bracketed_id_str ? SC_RETURN_BRACKETED_ID : INITIAL);
366 BEGIN (bracketed_id_str ? SC_RETURN_BRACKETED_ID : INITIAL);
372 /*--------------------------------.
373 | Scanning bracketed identifiers. |
374 `--------------------------------*/
379 if (bracketed_id_str)
381 complain_at (*loc, _("unexpected identifier in bracketed name: %s"),
386 bracketed_id_str = uniqstr_new (yytext);
387 bracketed_id_loc = *loc;
391 BEGIN bracketed_id_context_state;
392 if (bracketed_id_str)
394 if (INITIAL == bracketed_id_context_state)
396 val->uniqstr = bracketed_id_str;
397 bracketed_id_str = 0;
398 *loc = bracketed_id_loc;
403 complain_at (*loc, _("an identifier expected"));
406 complain_at (*loc, _("invalid character in bracketed name: %s"),
410 BEGIN bracketed_id_context_state;
411 unexpected_eof (bracketed_id_start, "]");
415 <SC_RETURN_BRACKETED_ID>
418 ROLLBACK_CURRENT_TOKEN;
419 val->uniqstr = bracketed_id_str;
420 bracketed_id_str = 0;
421 *loc = bracketed_id_loc;
428 /*---------------------------------------------------------------.
429 | Scanning a Yacc comment. The initial `/ *' is already eaten. |
430 `---------------------------------------------------------------*/
434 "*/" BEGIN context_state;
436 <<EOF>> unexpected_eof (token_start, "*/"); BEGIN context_state;
440 /*------------------------------------------------------------.
441 | Scanning a C comment. The initial `/ *' is already eaten. |
442 `------------------------------------------------------------*/
446 "*"{splice}"/" STRING_GROW; BEGIN context_state;
447 <<EOF>> unexpected_eof (token_start, "*/"); BEGIN context_state;
451 /*--------------------------------------------------------------.
452 | Scanning a line comment. The initial `//' is already eaten. |
453 `--------------------------------------------------------------*/
457 "\n" STRING_GROW; BEGIN context_state;
458 {splice} STRING_GROW;
459 <<EOF>> BEGIN context_state;
463 /*------------------------------------------------.
464 | Scanning a Bison string, including its escapes. |
465 | The initial quote is already eaten. |
466 `------------------------------------------------*/
471 if (yytext[0] == '\n')
472 unexpected_newline (token_start, "\"");
474 loc->start = token_start;
475 val->chars = last_string;
480 unexpected_eof (token_start, "\"");
482 loc->start = token_start;
483 val->chars = last_string;
489 /*----------------------------------------------------------.
490 | Scanning a Bison character literal, decoding its escapes. |
491 | The initial quote is already eaten. |
492 `----------------------------------------------------------*/
494 <SC_ESCAPED_CHARACTER>
498 loc->start = token_start;
499 val->character = last_string[0];
501 /* FIXME: Eventually, make these errors. */
502 if (last_string[0] == '\0')
504 warn_at (*loc, _("empty character literal"));
505 /* '\0' seems dangerous even if we are about to complain. */
506 val->character = '\'';
508 else if (last_string[1] != '\0')
509 warn_at (*loc, _("extra characters in character literal"));
511 if (yytext[0] == '\n')
512 unexpected_newline (token_start, "'");
519 loc->start = token_start;
520 val->character = last_string[0];
522 /* FIXME: Eventually, make these errors. */
523 if (last_string[0] == '\0')
525 warn_at (*loc, _("empty character literal"));
526 /* '\0' seems dangerous even if we are about to complain. */
527 val->character = '\'';
529 else if (last_string[1] != '\0')
530 warn_at (*loc, _("extra characters in character literal"));
532 unexpected_eof (token_start, "'");
539 /*-----------------------------------------------------------.
540 | Scanning a Bison nested tag. The initial angle bracket is |
542 `-----------------------------------------------------------*/
551 loc->start = token_start;
552 val->uniqstr = uniqstr_new (last_string);
561 "<"+ STRING_GROW; nesting += yyleng;
564 unexpected_eof (token_start, ">");
566 loc->start = token_start;
567 val->uniqstr = uniqstr_new (last_string);
574 /*----------------------------.
575 | Decode escaped characters. |
576 `----------------------------*/
578 <SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER>
581 unsigned long int c = strtoul (yytext + 1, NULL, 8);
582 if (!c || UCHAR_MAX < c)
583 complain_at (*loc, _("invalid number after \\-escape: %s"),
586 obstack_1grow (&obstack_for_string, c);
589 \\x[0-9abcdefABCDEF]+ {
590 verify (UCHAR_MAX < ULONG_MAX);
591 unsigned long int c = strtoul (yytext + 2, NULL, 16);
592 if (!c || UCHAR_MAX < c)
593 complain_at (*loc, _("invalid number after \\-escape: %s"),
596 obstack_1grow (&obstack_for_string, c);
599 \\a obstack_1grow (&obstack_for_string, '\a');
600 \\b obstack_1grow (&obstack_for_string, '\b');
601 \\f obstack_1grow (&obstack_for_string, '\f');
602 \\n obstack_1grow (&obstack_for_string, '\n');
603 \\r obstack_1grow (&obstack_for_string, '\r');
604 \\t obstack_1grow (&obstack_for_string, '\t');
605 \\v obstack_1grow (&obstack_for_string, '\v');
607 /* \\[\"\'?\\] would be shorter, but it confuses xgettext. */
608 \\("\""|"'"|"?"|"\\") obstack_1grow (&obstack_for_string, yytext[1]);
610 \\(u|U[0-9abcdefABCDEF]{4})[0-9abcdefABCDEF]{4} {
611 int c = convert_ucn_to_byte (yytext);
613 complain_at (*loc, _("invalid number after \\-escape: %s"),
616 obstack_1grow (&obstack_for_string, c);
619 char const *p = yytext + 1;
620 /* Quote only if escaping won't make the character visible. */
621 if (isspace ((unsigned char) *p) && isprint ((unsigned char) *p))
624 p = quotearg_style_mem (escape_quoting_style, p, 1);
625 complain_at (*loc, _("invalid character after \\-escape: %s"), p);
629 /*--------------------------------------------.
630 | Scanning user-code characters and strings. |
631 `--------------------------------------------*/
633 <SC_CHARACTER,SC_STRING>
635 {splice}|\\{splice}[^\n\[\]] STRING_GROW;
640 "'" STRING_GROW; BEGIN context_state;
641 \n unexpected_newline (token_start, "'"); BEGIN context_state;
642 <<EOF>> unexpected_eof (token_start, "'"); BEGIN context_state;
647 "\"" STRING_GROW; BEGIN context_state;
648 \n unexpected_newline (token_start, "\""); BEGIN context_state;
649 <<EOF>> unexpected_eof (token_start, "\""); BEGIN context_state;
653 /*---------------------------------------------------.
654 | Strings, comments etc. can be found in user code. |
655 `---------------------------------------------------*/
657 <SC_BRACED_CODE,SC_PROLOGUE,SC_EPILOGUE>
661 context_state = YY_START;
662 token_start = loc->start;
667 context_state = YY_START;
668 token_start = loc->start;
673 context_state = YY_START;
674 token_start = loc->start;
679 context_state = YY_START;
680 BEGIN SC_LINE_COMMENT;
686 /*-----------------------------------------------------------.
687 | Scanning some code in braces (actions). The initial "{" is |
689 `-----------------------------------------------------------*/
693 "{"|"<"{splice}"%" STRING_GROW; nesting++;
694 "%"{splice}">" STRING_GROW; nesting--;
696 obstack_1grow (&obstack_for_string, '}');
702 loc->start = code_start;
703 val->code = last_string;
709 /* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly
711 "<"{splice}"<" STRING_GROW;
714 unexpected_eof (code_start, "}");
716 loc->start = code_start;
717 val->code = last_string;
724 /*--------------------------------------------------------------.
725 | Scanning some prologue: from "%{" (already scanned) to "%}". |
726 `--------------------------------------------------------------*/
732 loc->start = code_start;
733 val->chars = last_string;
739 unexpected_eof (code_start, "%}");
741 loc->start = code_start;
742 val->chars = last_string;
749 /*---------------------------------------------------------------.
750 | Scanning the epilogue (everything after the second "%%", which |
751 | has already been eaten). |
752 `---------------------------------------------------------------*/
758 loc->start = code_start;
759 val->chars = last_string;
766 /*-----------------------------------------------------.
767 | By default, grow the string obstack with the input. |
768 `-----------------------------------------------------*/
770 <SC_COMMENT,SC_LINE_COMMENT,SC_BRACED_CODE,SC_PROLOGUE,SC_EPILOGUE,SC_STRING,SC_CHARACTER,SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER>. |
771 <SC_COMMENT,SC_LINE_COMMENT,SC_BRACED_CODE,SC_PROLOGUE,SC_EPILOGUE>\n STRING_GROW;
775 /* Read bytes from FP into buffer BUF of size SIZE. Return the
776 number of bytes read. Remove '\r' from input, treating \r\n
777 and isolated \r as \n. */
780 no_cr_read (FILE *fp, char *buf, size_t size)
782 size_t bytes_read = fread (buf, 1, size, fp);
785 char *w = memchr (buf, '\r', bytes_read);
789 char const *lim = buf + bytes_read;
793 /* Found an '\r'. Treat it like '\n', but ignore any
794 '\n' that immediately follows. */
799 if (ch != '\n' && ungetc (ch, fp) != ch)
805 /* Copy until the next '\r'. */
811 while ((*w++ = *r++) != '\r');
823 /*------------------------------------------------------.
824 | Scan NUMBER for a base-BASE integer at location LOC. |
825 `------------------------------------------------------*/
827 static unsigned long int
828 scan_integer (char const *number, int base, location loc)
830 verify (INT_MAX < ULONG_MAX);
831 unsigned long int num = strtoul (number, NULL, base);
835 complain_at (loc, _("integer out of range: %s"), quote (number));
843 /*------------------------------------------------------------------.
844 | Convert universal character name UCN to a single-byte character, |
845 | and return that character. Return -1 if UCN does not correspond |
846 | to a single-byte character. |
847 `------------------------------------------------------------------*/
850 convert_ucn_to_byte (char const *ucn)
852 verify (UCHAR_MAX <= INT_MAX);
853 unsigned long int code = strtoul (ucn + 2, NULL, 16);
855 /* FIXME: Currently we assume Unicode-compatible unibyte characters
856 on ASCII hosts (i.e., Latin-1 on hosts with 8-bit bytes). On
857 non-ASCII hosts we support only the portable C character set.
858 These limitations should be removed once we add support for
859 multibyte characters. */
861 if (UCHAR_MAX < code)
864 #if ! ('$' == 0x24 && '@' == 0x40 && '`' == 0x60 && '~' == 0x7e)
866 /* A non-ASCII host. Use CODE to index into a table of the C
867 basic execution character set, which is guaranteed to exist on
868 all Standard C platforms. This table also includes '$', '@',
869 and '`', which are not in the basic execution character set but
870 which are unibyte characters on all the platforms that we know
872 static signed char const table[] =
874 '\0', -1, -1, -1, -1, -1, -1, '\a',
875 '\b', '\t', '\n', '\v', '\f', '\r', -1, -1,
876 -1, -1, -1, -1, -1, -1, -1, -1,
877 -1, -1, -1, -1, -1, -1, -1, -1,
878 ' ', '!', '"', '#', '$', '%', '&', '\'',
879 '(', ')', '*', '+', ',', '-', '.', '/',
880 '0', '1', '2', '3', '4', '5', '6', '7',
881 '8', '9', ':', ';', '<', '=', '>', '?',
882 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
883 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
884 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
885 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
886 '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
887 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
888 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
889 'x', 'y', 'z', '{', '|', '}', '~'
892 code = code < sizeof table ? table[code] : -1;
900 /*----------------------------------------------------------------.
901 | Handle `#line INT "FILE"'. ARGS has already skipped `#line '. |
902 `----------------------------------------------------------------*/
905 handle_syncline (char *args, location loc)
908 unsigned long int lineno = strtoul (args, &after_num, 10);
909 char *file = strchr (after_num, '"') + 1;
910 *strchr (file, '"') = '\0';
911 if (INT_MAX <= lineno)
913 warn_at (loc, _("line number overflow"));
916 current_file = uniqstr_new (file);
917 boundary_set (&scanner_cursor, current_file, lineno, 1);
921 /*----------------------------------------------------------------.
922 | For a token or comment starting at START, report message MSGID, |
923 | which should say that an end marker was found before |
924 | the expected TOKEN_END. |
925 `----------------------------------------------------------------*/
928 unexpected_end (boundary start, char const *msgid, char const *token_end)
932 loc.end = scanner_cursor;
933 complain_at (loc, _(msgid), token_end);
937 /*------------------------------------------------------------------------.
938 | Report an unexpected EOF in a token or comment starting at START. |
939 | An end of file was encountered and the expected TOKEN_END was missing. |
940 `------------------------------------------------------------------------*/
943 unexpected_eof (boundary start, char const *token_end)
945 unexpected_end (start, N_("missing `%s' at end of file"), token_end);
949 /*----------------------------------------.
950 | Likewise, but for unexpected newlines. |
951 `----------------------------------------*/
954 unexpected_newline (boundary start, char const *token_end)
956 unexpected_end (start, N_("missing `%s' at end of line"), token_end);
960 /*-------------------------.
961 | Initialize the scanner. |
962 `-------------------------*/
965 gram_scanner_initialize (void)
967 obstack_init (&obstack_for_string);
971 /*-----------------------------------------------.
972 | Free all the memory allocated to the scanner. |
973 `-----------------------------------------------*/
976 gram_scanner_free (void)
978 obstack_free (&obstack_for_string, 0);
979 /* Reclaim Flex's buffers. */