1 /* $NetBSD: scan.l,v 1.1.1.1 2009/10/26 00:26:55 christos Exp $ */
3 /* scan.l - scanner for flex input -*-C-*- */
6 /* Copyright (c) 1990 The Regents of the University of California. */
7 /* All rights reserved. */
9 /* This code is derived from software contributed to Berkeley by */
12 /* The United States Government has rights in this work pursuant */
13 /* to contract no. DE-AC03-76SF00098 between the United States */
14 /* Department of Energy and the University of California. */
16 /* This file is part of flex. */
18 /* Redistribution and use in source and binary forms, with or without */
19 /* modification, are permitted provided that the following conditions */
22 /* 1. Redistributions of source code must retain the above copyright */
23 /* notice, this list of conditions and the following disclaimer. */
24 /* 2. Redistributions in binary form must reproduce the above copyright */
25 /* notice, this list of conditions and the following disclaimer in the */
26 /* documentation and/or other materials provided with the distribution. */
28 /* Neither the name of the University nor the names of its contributors */
29 /* may be used to endorse or promote products derived from this software */
30 /* without specific prior written permission. */
32 /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
33 /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
34 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
39 extern bool tablesverify, tablesext;
40 extern int trlcontxt; /* Set in parse.y for each rule. */
41 extern const char *escaped_qstart, *escaped_qend;
43 #define ACTION_ECHO add_action( yytext )
44 #define ACTION_IFDEF(def, should_define) \
46 if ( should_define ) \
47 action_define( def, 1 ); \
50 #define ACTION_ECHO_QSTART add_action (escaped_qstart)
51 #define ACTION_ECHO_QEND add_action (escaped_qend)
53 #define ACTION_M4_IFDEF(def, should_define) \
55 if ( should_define ) \
56 buf_m4_define( &m4defs_buf, def, NULL);\
58 buf_m4_undefine( &m4defs_buf, def);\
61 #define MARK_END_OF_PROLOG mark_prolog();
67 yylval = (unsigned char) yytext[0]; \
71 if(yyleng < MAXLINE) \
73 strlcpy( nmstr, yytext, sizeof(nmstr) ); \
77 synerr(_("Input line too long\n")); \
78 FLEX_EXIT(EXIT_FAILURE); \
82 #define PUT_BACK_STRING(str, start) \
83 for ( i = strlen( str ) - 1; i >= start; --i ) \
86 #define CHECK_REJECT(str) \
87 if ( all_upper( str ) ) \
90 #define CHECK_YYMORE(str) \
91 if ( all_lower( str ) ) \
94 #define YY_USER_INIT \
95 if ( getenv("POSIXLY_CORRECT") ) \
100 %option caseless nodefault stack noyy_top_state
103 %x SECT2 SECT2PROLOG SECT3 CODEBLOCK PICKUPDEF SC CARETISBOL NUM QUOTE
104 %x FIRSTCCL CCL ACTION RECOVER COMMENT ACTION_STRING PERCENT_BRACE_ACTION
105 %x OPTION LINEDIR CODEBLOCK_MATCH_BRACE
107 %x GROUP_MINUS_PARAMS
113 NOT_WS [^[:blank:]\r\n]
117 NAME ([[:alpha:]_][[:alnum:]_-]*)
118 NOT_NAME [^[:alpha:]_*\n]+
122 ESCSEQ (\\([^\n]|[0-7]{1,3}|x[[:xdigit:]]{1,2}))
124 FIRST_CCL_CHAR ([^\\\n]|{ESCSEQ})
125 CCL_CHAR ([^\\\n\]]|{ESCSEQ})
126 CCL_EXPR ("[:"^?[[:alpha:]]+":]")
134 static int bracelevel, didadef, indented_code;
135 static int doing_rule_action = false;
136 static int option_sense;
138 int doing_codeblock = false;
139 int i, brace_depth=0, brace_start_line=0;
144 ^{WS} indented_code = true; BEGIN(CODEBLOCK);
145 ^"/*" ACTION_ECHO; yy_push_state( COMMENT );
146 ^#{OPTWS}line{WS} yy_push_state( LINEDIR );
147 ^"%s"{NAME}? return SCDECL;
148 ^"%x"{NAME}? return XSCDECL;
151 line_directive_out( (FILE *) 0, 1 );
152 indented_code = false;
155 ^"%top"[[:blank:]]*"{"[[:blank:]]*{NL} {
156 brace_start_line = linenum;
158 buf_linedir( &top_buf, infilename?infilename:"<stdin>", linenum);
160 yy_push_state(CODEBLOCK_MATCH_BRACE);
163 ^"%top".* synerr( _("malformed '%top' directive") );
171 line_directive_out( (FILE *) 0, 1 );
176 ^"%pointer".*{NL} yytext_is_array = false; ++linenum;
177 ^"%array".*{NL} yytext_is_array = true; ++linenum;
179 ^"%option" BEGIN(OPTION); return OPTION_OP;
181 ^"%"{LEXOPT}{OPTWS}[[:digit:]]*{OPTWS}{NL} ++linenum; /* ignore */
182 ^"%"{LEXOPT}{WS}.*{NL} ++linenum; /* ignore */
184 /* xgettext: no-c-format */
185 ^"%"[^sxaceknopr{}].* synerr( _( "unrecognized '%' directive" ) );
190 strlcpy( nmstr, yytext, sizeof(nmstr) );
194 synerr( _("Input line too long\n"));
195 FLEX_EXIT(EXIT_FAILURE);
203 ^{OPTWS}{NL} ++linenum; /* allows blank lines in section 1 */
204 {OPTWS}{NL} ACTION_ECHO; ++linenum; /* maybe end of comment line */
209 "*/" ACTION_ECHO; yy_pop_state();
211 {M4QSTART} ACTION_ECHO_QSTART;
212 {M4QEND} ACTION_ECHO_QEND;
214 {NL} ++linenum; ACTION_ECHO;
218 /* This is the same as COMMENT, but is discarded rather than output. */
233 [[:digit:]]+ linenum = myctoi( yytext );
236 flex_free( (void *) infilename );
237 infilename = copy_string( yytext + 1 );
238 infilename[strlen( infilename ) - 1] = '\0';
240 . /* ignore spurious characters */
244 ^"%}".*{NL} ++linenum; BEGIN(INITIAL);
246 {M4QSTART} ACTION_ECHO_QSTART;
247 {M4QEND} ACTION_ECHO_QEND;
258 <CODEBLOCK_MATCH_BRACE>{
260 if( --brace_depth == 0){
264 buf_strnappend(&top_buf, yytext, yyleng);
269 buf_strnappend(&top_buf, yytext, yyleng);
274 buf_strnappend(&top_buf, yytext, yyleng);
277 {M4QSTART} buf_strnappend(&top_buf, escaped_qstart, strlen(escaped_qstart));
278 {M4QEND} buf_strnappend(&top_buf, escaped_qend, strlen(escaped_qend));
281 buf_strnappend(&top_buf, yytext, yyleng);
285 linenum = brace_start_line;
286 synerr(_("Unmatched '{'"));
293 {WS} /* separates name and definition */
298 strlcpy( (char *) nmdef, yytext, sizeof(nmdef) );
302 synerr( _("Input line too long\n"));
303 FLEX_EXIT(EXIT_FAILURE);
305 /* Skip trailing whitespace. */
306 for ( i = strlen( (char *) nmdef ) - 1;
307 i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t');
313 ndinstal( nmstr, nmdef );
319 synerr( _( "incomplete name definition" ) );
327 {NL} ++linenum; BEGIN(INITIAL);
328 {WS} option_sense = true;
332 no option_sense = ! option_sense;
334 7bit csize = option_sense ? 128 : 256;
335 8bit csize = option_sense ? 256 : 128;
337 align long_align = option_sense;
339 ACTION_M4_IFDEF( "M4""_YY_ALWAYS_INTERACTIVE", option_sense );
340 interactive = option_sense;
342 array yytext_is_array = option_sense;
343 ansi-definitions ansi_func_defs = option_sense;
344 ansi-prototypes ansi_func_protos = option_sense;
345 backup backing_up_report = option_sense;
346 batch interactive = ! option_sense;
347 bison-bridge bison_bridge_lval = option_sense;
348 bison-locations { if((bison_bridge_lloc = option_sense))
349 bison_bridge_lval = true;
351 "c++" C_plus_plus = option_sense;
352 caseful|case-sensitive sf_set_case_ins(!option_sense);
353 caseless|case-insensitive sf_set_case_ins(option_sense);
354 debug ddebug = option_sense;
355 default spprdflt = ! option_sense;
356 ecs useecs = option_sense;
358 useecs = usemecs = false;
359 use_read = fullspd = true;
362 useecs = usemecs = false;
363 use_read = fulltbl = true;
365 input ACTION_IFDEF("YY_NO_INPUT", ! option_sense);
366 interactive interactive = option_sense;
367 lex-compat lex_compat = option_sense;
368 posix-compat posix_compat = option_sense;
370 ACTION_M4_IFDEF( "M4""_YY_MAIN", option_sense);
371 /* Override yywrap */
372 if( option_sense == true )
375 meta-ecs usemecs = option_sense;
377 ACTION_M4_IFDEF( "M4""_YY_NEVER_INTERACTIVE", option_sense );
378 interactive = !option_sense;
380 perf-report performance_report += option_sense ? 1 : -1;
381 pointer yytext_is_array = ! option_sense;
382 read use_read = option_sense;
383 reentrant reentrant = option_sense;
384 reject reject_really_used = option_sense;
385 stack ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
386 stdinit do_stdinit = option_sense;
387 stdout use_stdout = option_sense;
388 unistd ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
389 unput ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
390 verbose printstats = option_sense;
391 warn nowarn = ! option_sense;
392 yylineno do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense);
393 yymore yymore_really_used = option_sense;
394 yywrap do_yywrap = option_sense;
396 yy_push_state ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense);
397 yy_pop_state ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense);
398 yy_top_state ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense);
400 yy_scan_buffer ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense);
401 yy_scan_bytes ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense);
402 yy_scan_string ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense);
404 yyalloc ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense);
405 yyrealloc ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense);
406 yyfree ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense);
408 yyget_debug ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense);
409 yyset_debug ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense);
410 yyget_extra ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense);
411 yyset_extra ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense);
412 yyget_leng ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense);
413 yyget_text ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense);
414 yyget_lineno ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense);
415 yyset_lineno ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense);
416 yyget_in ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense);
417 yyset_in ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense);
418 yyget_out ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense);
419 yyset_out ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense);
420 yyget_lval ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense);
421 yyset_lval ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense);
422 yyget_lloc ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense);
423 yyset_lloc ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense);
425 extra-type return OPT_EXTRA_TYPE;
426 outfile return OPT_OUTFILE;
427 prefix return OPT_PREFIX;
428 yyclass return OPT_YYCLASS;
429 header(-file)? return OPT_HEADER;
430 tables-file return OPT_TABLES;
432 tablesverify = option_sense;
433 if(!tablesext && option_sense)
439 if(yyleng-1 < MAXLINE)
441 strlcpy( nmstr, yytext + 1, sizeof(nmstr) );
445 synerr( _("Input line too long\n"));
446 FLEX_EXIT(EXIT_FAILURE);
448 nmstr[strlen( nmstr ) - 1] = '\0';
452 (([a-mo-z]|n[a-np-z])[[:alpha:]\-+]*)|. {
453 format_synerr( _( "unrecognized %%option: %s" ),
459 <RECOVER>.*{NL} ++linenum; BEGIN(INITIAL);
463 ^"%{".* ++bracelevel; yyless( 2 ); /* eat only %{ */
464 ^"%}".* --bracelevel; yyless( 2 ); /* eat only %} */
466 ^{WS}.* ACTION_ECHO; /* indented code in prolog */
468 ^{NOT_WS}.* { /* non-indented code */
469 if ( bracelevel <= 0 )
470 { /* not in %{ ... %} */
471 yyless( 0 ); /* put it all back */
481 {NL} ++linenum; ACTION_ECHO;
486 yyterminate(); /* to stop the parser */
491 ^{OPTWS}{NL} ++linenum; /* allow blank lines in section 2 */
494 indented_code = false;
495 doing_codeblock = true;
497 BEGIN(PERCENT_BRACE_ACTION);
501 /* Allow "<" to appear in (?x) patterns. */
506 ^{OPTWS}"^" return '^';
507 \" BEGIN(QUOTE); return '"';
510 if ( lex_compat || posix_compat )
511 return BEGIN_REPEAT_POSIX;
513 return BEGIN_REPEAT_FLEX;
515 "$"/([[:blank:]]|{NL}) return '$';
519 BEGIN(PERCENT_BRACE_ACTION);
523 doing_rule_action = true;
530 /* We're in the middle of a (?x: ) pattern. */
531 /* Push back everything starting at the "|" */
533 amt = strchr (yytext, '|') - yytext;
537 continued_action = true;
546 /* We're in the middle of a (?x: ) pattern. */
547 yy_push_state(COMMENT_DISCARD);
550 yyless( yyleng - 2 ); /* put back '/', '*' */
552 continued_action = false;
557 ^{WS} /* allow indented rules */ ;
561 /* We're in the middle of a (?x: ) pattern. */
564 /* This rule is separate from the one below because
565 * otherwise we get variable trailing context, so
566 * we can't build the scanner using -{f,F}.
569 continued_action = false;
574 doing_rule_action = true;
583 /* We're in the middle of a (?x: ) pattern. */
588 continued_action = false;
590 unput( '\n' ); /* so <ACTION> sees it */
594 doing_rule_action = true;
602 "<<EOF>>" return EOF_OP;
607 outn("/* Begin user sect3 */");
608 yyterminate(); /* to stop the parser */
611 "["({FIRST_CCL_CHAR}|{CCL_EXPR})({CCL_CHAR}|{CCL_EXPR})* {
616 strlcpy( nmstr, yytext, sizeof(nmstr) );
620 synerr( _("Input line too long\n"));
621 FLEX_EXIT(EXIT_FAILURE);
624 /* Check to see if we've already encountered this
627 if (0 /* <--- This "0" effectively disables the reuse of a
628 * character class (purely based on its source text).
629 * The reason it was disabled is so yacc/bison can parse
630 * ccl operations, such as ccl difference and union.
632 && (cclval = ccllookup( (Char *) nmstr )) != 0 )
634 if ( input() != ']' )
635 synerr( _( "bad character class" ) );
643 /* We fudge a bit. We know that this ccl will
644 * soon be numbered as lastccl + 1 by cclinit.
646 cclinstal( (Char *) nmstr, lastccl + 1 );
648 /* Push back everything but the leading bracket
649 * so the ccl can be rescanned.
657 "{-}" return CCL_OP_DIFF;
658 "{+}" return CCL_OP_UNION;
661 /* Check for :space: at the end of the rule so we don't
662 * wrap the expanded regex in '(' ')' -- breaking trailing
665 "{"{NAME}"}"[[:space:]]? {
666 register Char *nmdefptr;
667 int end_is_ws, end_ch;
669 end_ch = yytext[yyleng-1];
670 end_is_ws = end_ch != '}' ? 1 : 0;
672 if(yyleng-1 < MAXLINE)
674 strlcpy( nmstr, yytext + 1, sizeof(nmstr) );
678 synerr( _("Input line too long\n"));
679 FLEX_EXIT(EXIT_FAILURE);
681 nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
683 if ( (nmdefptr = ndlookup( nmstr )) == 0 )
685 _( "undefined definition {%s}" ),
689 { /* push back name surrounded by ()'s */
690 int len = strlen( (char *) nmdefptr );
694 if ( lex_compat || nmdefptr[0] == '^' ||
695 (len > 0 && nmdefptr[len - 1] == '$')
696 || (end_is_ws && trlcontxt && !sf_skip_ws()))
697 { /* don't use ()'s after all */
698 PUT_BACK_STRING((char *) nmdefptr, 0);
700 if ( nmdefptr[0] == '^' )
707 PUT_BACK_STRING((char *) nmdefptr, 0);
715 yy_push_state(COMMENT_DISCARD);
717 /* Push back the "*" and return "/" as usual. */
724 if (lex_compat || posix_compat){
725 /* Push back the "?#" and treat it like a normal parens. */
731 yy_push_state(EXTENDED_COMMENT);
735 if (lex_compat || posix_compat)
736 /* Push back the "?" and treat it like a normal parens. */
739 BEGIN(GROUP_WITH_PARAMS);
742 "(" sf_push(); return '(';
743 ")" sf_pop(); return ')';
745 [/|*+?.(){}] return (unsigned char) yytext[0];
751 {OPTWS}{NL}{OPTWS} ++linenum; /* Allow blank lines & continuations */
752 [,*] return (unsigned char) yytext[0];
753 ">" BEGIN(SECT2); return '>';
754 ">"/^ BEGIN(CARETISBOL); return '>';
757 format_synerr( _( "bad <start condition>: %s" ),
762 <CARETISBOL>"^" BEGIN(SECT2); return '^';
767 \" BEGIN(SECT2); return '"';
770 synerr( _( "missing quote" ) );
779 "-" BEGIN(GROUP_MINUS_PARAMS);
780 i sf_set_case_ins(1);
784 <GROUP_MINUS_PARAMS>{
786 i sf_set_case_ins(0);
792 "^"/[^-\]\n] BEGIN(CCL); return '^';
793 "^"/("-"|"]") return '^';
794 . BEGIN(CCL); RETURNCHAR;
798 -/[^\]\n] return '-';
800 "]" BEGIN(SECT2); return ']';
802 synerr( _( "bad character class" ) );
809 "[:alnum:]" BEGIN(CCL); return CCE_ALNUM;
810 "[:alpha:]" BEGIN(CCL); return CCE_ALPHA;
811 "[:blank:]" BEGIN(CCL); return CCE_BLANK;
812 "[:cntrl:]" BEGIN(CCL); return CCE_CNTRL;
813 "[:digit:]" BEGIN(CCL); return CCE_DIGIT;
814 "[:graph:]" BEGIN(CCL); return CCE_GRAPH;
815 "[:lower:]" BEGIN(CCL); return CCE_LOWER;
816 "[:print:]" BEGIN(CCL); return CCE_PRINT;
817 "[:punct:]" BEGIN(CCL); return CCE_PUNCT;
818 "[:space:]" BEGIN(CCL); return CCE_SPACE;
819 "[:upper:]" BEGIN(CCL); return CCE_UPPER;
820 "[:xdigit:]" BEGIN(CCL); return CCE_XDIGIT;
822 "[:^alnum:]" BEGIN(CCL); return CCE_NEG_ALNUM;
823 "[:^alpha:]" BEGIN(CCL); return CCE_NEG_ALPHA;
824 "[:^blank:]" BEGIN(CCL); return CCE_NEG_BLANK;
825 "[:^cntrl:]" BEGIN(CCL); return CCE_NEG_CNTRL;
826 "[:^digit:]" BEGIN(CCL); return CCE_NEG_DIGIT;
827 "[:^graph:]" BEGIN(CCL); return CCE_NEG_GRAPH;
828 "[:^lower:]" BEGIN(CCL); return CCE_NEG_LOWER;
829 "[:^print:]" BEGIN(CCL); return CCE_NEG_PRINT;
830 "[:^punct:]" BEGIN(CCL); return CCE_NEG_PUNCT;
831 "[:^space:]" BEGIN(CCL); return CCE_NEG_SPACE;
832 "[:^upper:]" BEGIN(CCL); return CCE_NEG_UPPER;
833 "[:^xdigit:]" BEGIN(CCL); return CCE_NEG_XDIGIT;
836 _( "bad character class expression: %s" ),
838 BEGIN(CCL); return CCE_ALNUM;
844 yylval = myctoi( yytext );
851 if ( lex_compat || posix_compat )
852 return END_REPEAT_POSIX;
854 return END_REPEAT_FLEX;
858 synerr( _( "bad character inside {}'s" ) );
864 synerr( _( "missing }" ) );
872 <PERCENT_BRACE_ACTION>{
873 {OPTWS}"%}".* bracelevel = 0;
875 <ACTION>"/*" ACTION_ECHO; yy_push_state( COMMENT );
880 CHECK_REJECT(yytext);
884 CHECK_YYMORE(yytext);
888 {M4QSTART} ACTION_ECHO_QEND;
889 {M4QEND} ACTION_ECHO_QEND;
894 if ( bracelevel == 0 ||
895 (doing_codeblock && indented_code) )
897 if ( doing_rule_action )
898 add_action( "\tYY_BREAK\n" );
900 doing_rule_action = doing_codeblock = false;
907 /* Reject and YYmore() are checked for above, in PERCENT_BRACE_ACTION */
909 "{" ACTION_ECHO; ++bracelevel;
910 "}" ACTION_ECHO; --bracelevel;
911 {M4QSTART} ACTION_ECHO_QEND;
912 {M4QEND} ACTION_ECHO_QEND;
913 [^[:alpha:]_{}"'/\n\[\]]+ ACTION_ECHO;
916 "'"([^'\\\n]|\\.)*"'" ACTION_ECHO; /* character constant */
917 \" ACTION_ECHO; BEGIN(ACTION_STRING);
921 if ( bracelevel == 0 )
923 if ( doing_rule_action )
924 add_action( "\tYY_BREAK\n" );
926 doing_rule_action = false;
934 [^"\\\n]+ ACTION_ECHO;
936 {NL} ++linenum; ACTION_ECHO; BEGIN(ACTION);
937 \" ACTION_ECHO; BEGIN(ACTION);
941 <COMMENT,COMMENT_DISCARD,ACTION,ACTION_STRING><<EOF>> {
942 synerr( _( "EOF encountered inside an action" ) );
946 <EXTENDED_COMMENT,GROUP_WITH_PARAMS,GROUP_MINUS_PARAMS><<EOF>> {
947 synerr( _( "EOF encountered inside pattern" ) );
951 <SECT2,QUOTE,FIRSTCCL,CCL>{ESCSEQ} {
952 yylval = myesc( (Char *) yytext );
954 if ( YY_START == FIRSTCCL )
962 {M4QSTART} fwrite (escaped_qstart, 1, strlen(escaped_qstart), yyout);
963 {M4QEND} fwrite (escaped_qend, 1, strlen(escaped_qend), yyout);
964 [^\[\]\n]*(\n?) ECHO;
966 <<EOF>> sectnum = 0; yyterminate();
969 <*>.|\n format_synerr( _( "bad character: %s" ), yytext );
976 if ( --num_input_files > 0 )
978 set_input_file( *++input_files );
987 /* set_input_file - open the given file (if NULL, stdin) for scanning */
989 void set_input_file( file )
992 if ( file && strcmp( file, "-" ) )
994 infilename = copy_string( file );
995 yyin = fopen( infilename, "r" );
998 lerrsf( _( "can't open %s" ), file );
1004 infilename = copy_string( "<stdin>" );
1011 /* Wrapper routines for accessing the scanner's malloc routines. */
1013 void *flex_alloc( size )
1016 return (void *) malloc( size );
1019 void *flex_realloc( ptr, size )
1023 return (void *) realloc( ptr, size );
1026 void flex_free( ptr )