1 /* $NetBSD: scan.l,v 1.6 2014/10/30 18:44:05 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 */
37 __RCSID("$NetBSD: scan.l,v 1.6 2014/10/30 18:44:05 christos Exp $");
40 extern bool tablesverify, tablesext;
41 extern int trlcontxt; /* Set in parse.y for each rule. */
42 extern const char *escaped_qstart, *escaped_qend;
44 #define ACTION_ECHO add_action( yytext )
45 #define ACTION_IFDEF(def, should_define) \
47 if ( should_define ) \
48 action_define( def, 1 ); \
51 #define ACTION_ECHO_QSTART add_action (escaped_qstart)
52 #define ACTION_ECHO_QEND add_action (escaped_qend)
54 #define ACTION_M4_IFDEF(def, should_define) \
56 if ( should_define ) \
57 buf_m4_define( &m4defs_buf, def, NULL);\
59 buf_m4_undefine( &m4defs_buf, def);\
62 #define MARK_END_OF_PROLOG mark_prolog();
68 yylval = (unsigned char) yytext[0]; \
72 if(yyleng < MAXLINE) \
74 strlcpy( nmstr, yytext, sizeof(nmstr) ); \
78 synerr(_("Input line too long\n")); \
79 FLEX_EXIT(EXIT_FAILURE); \
83 #define PUT_BACK_STRING(str, start) \
84 for ( i = strlen( str ) - 1; i >= start; --i ) \
87 #define CHECK_RE_JECT(str) \
88 if ( all_upper( str ) ) \
91 #define CHECK_YYMORE(str) \
92 if ( all_lower( str ) ) \
95 #define YY_USER_INIT \
96 if ( getenv("POSIXLY_CORRECT") ) \
101 %option caseless nodefault stack noyy_top_state
104 %x SECT2 SECT2PROLOG SECT3 CODEBLOCK PICKUPDEF SC CARETISBOL NUM QUOTE
105 %x FIRSTCCL CCL ACTION RECOVER COMMENT ACTION_STRING PERCENT_BRACE_ACTION
106 %x OPTION LINEDIR CODEBLOCK_MATCH_BRACE
108 %x GROUP_MINUS_PARAMS
114 NOT_WS [^[:blank:]\r\n]
118 NAME ([[:alpha:]_][[:alnum:]_-]*)
119 NOT_NAME [^[:alpha:]_*\n]+
123 ESCSEQ (\\([^\n]|[0-7]{1,3}|x[[:xdigit:]]{1,2}))
125 FIRST_CCL_CHAR ([^\\\n]|{ESCSEQ})
126 CCL_CHAR ([^\\\n\]]|{ESCSEQ})
127 CCL_EXPR ("[:"^?[[:alpha:]]+":]")
135 static int bracelevel, didadef, indented_code;
136 static int doing_rule_action = false;
137 static int option_sense;
139 int doing_codeblock = false;
140 int i, brace_depth=0, brace_start_line=0;
145 ^{WS} indented_code = true; BEGIN(CODEBLOCK);
146 ^"/*" ACTION_ECHO; yy_push_state( COMMENT );
147 ^#{OPTWS}line{WS} yy_push_state( LINEDIR );
148 ^"%s"{NAME}? return SCDECL;
149 ^"%x"{NAME}? return XSCDECL;
152 line_directive_out( (FILE *) 0, 1 );
153 indented_code = false;
156 ^"%top"[[:blank:]]*"{"[[:blank:]]*{NL} {
157 brace_start_line = linenum;
159 buf_linedir( &top_buf, infilename?infilename:"<stdin>", linenum);
161 yy_push_state(CODEBLOCK_MATCH_BRACE);
164 ^"%top".* synerr( _("malformed '%top' directive") );
172 line_directive_out( (FILE *) 0, 1 );
177 ^"%pointer".*{NL} yytext_is_array = false; ++linenum;
178 ^"%array".*{NL} yytext_is_array = true; ++linenum;
180 ^"%option" BEGIN(OPTION); return OPTION_OP;
182 ^"%"{LEXOPT}{OPTWS}[[:digit:]]*{OPTWS}{NL} ++linenum; /* ignore */
183 ^"%"{LEXOPT}{WS}.*{NL} ++linenum; /* ignore */
185 /* xgettext: no-c-format */
186 ^"%"[^sxaceknopr{}].* synerr( _( "unrecognized '%' directive" ) );
191 strlcpy( nmstr, yytext, sizeof(nmstr) );
195 synerr( _("Definition name too long\n"));
196 FLEX_EXIT(EXIT_FAILURE);
204 ^{OPTWS}{NL} ++linenum; /* allows blank lines in section 1 */
205 {OPTWS}{NL} ACTION_ECHO; ++linenum; /* maybe end of comment line */
210 "*/" ACTION_ECHO; yy_pop_state();
212 {M4QSTART} ACTION_ECHO_QSTART;
213 {M4QEND} ACTION_ECHO_QEND;
215 {NL} ++linenum; ACTION_ECHO;
219 /* This is the same as COMMENT, but is discarded rather than output. */
234 [[:digit:]]+ linenum = myctoi( yytext );
237 flex_free( (void *) infilename );
238 infilename = copy_string( yytext + 1 );
239 infilename[strlen( infilename ) - 1] = '\0';
241 . /* ignore spurious characters */
245 ^"%}".*{NL} ++linenum; BEGIN(INITIAL);
247 {M4QSTART} ACTION_ECHO_QSTART;
248 {M4QEND} ACTION_ECHO_QEND;
259 <CODEBLOCK_MATCH_BRACE>{
261 if( --brace_depth == 0){
265 buf_strnappend(&top_buf, yytext, yyleng);
270 buf_strnappend(&top_buf, yytext, yyleng);
275 buf_strnappend(&top_buf, yytext, yyleng);
278 {M4QSTART} buf_strnappend(&top_buf, escaped_qstart, strlen(escaped_qstart));
279 {M4QEND} buf_strnappend(&top_buf, escaped_qend, strlen(escaped_qend));
282 buf_strnappend(&top_buf, yytext, yyleng);
286 linenum = brace_start_line;
287 synerr(_("Unmatched '{'"));
294 {WS} /* separates name and definition */
299 strlcpy( (char *) nmdef, yytext, sizeof(nmdef) );
303 format_synerr( _("Definition value for {%s} too long\n"), nmstr);
304 FLEX_EXIT(EXIT_FAILURE);
306 /* Skip trailing whitespace. */
307 for ( i = strlen( (char *) nmdef ) - 1;
308 i >= 0 && (nmdef[i] == ' ' || nmdef[i] == '\t');
314 ndinstal( nmstr, nmdef );
320 synerr( _( "incomplete name definition" ) );
328 {NL} ++linenum; BEGIN(INITIAL);
329 {WS} option_sense = true;
333 no option_sense = ! option_sense;
335 7bit csize = option_sense ? 128 : 256;
336 8bit csize = option_sense ? 256 : 128;
338 align long_align = option_sense;
340 ACTION_M4_IFDEF( "M4""_YY_ALWAYS_INTERACTIVE", option_sense );
341 interactive = option_sense;
343 array yytext_is_array = option_sense;
344 ansi-definitions ansi_func_defs = option_sense;
345 ansi-prototypes ansi_func_protos = option_sense;
346 backup backing_up_report = option_sense;
347 batch interactive = ! option_sense;
348 bison-bridge bison_bridge_lval = option_sense;
349 bison-locations { if((bison_bridge_lloc = option_sense))
350 bison_bridge_lval = true;
352 "c++" C_plus_plus = option_sense;
353 caseful|case-sensitive sf_set_case_ins(!option_sense);
354 caseless|case-insensitive sf_set_case_ins(option_sense);
355 debug ddebug = option_sense;
356 default spprdflt = ! option_sense;
357 ecs useecs = option_sense;
359 useecs = usemecs = false;
360 use_read = fullspd = true;
363 useecs = usemecs = false;
364 use_read = fulltbl = true;
366 input ACTION_IFDEF("YY_NO_INPUT", ! option_sense);
367 interactive interactive = option_sense;
368 lex-compat lex_compat = option_sense;
369 posix-compat posix_compat = option_sense;
371 ACTION_M4_IFDEF( "M4""_YY_MAIN", option_sense);
372 /* Override yywrap */
373 if( option_sense == true )
376 meta-ecs usemecs = option_sense;
378 ACTION_M4_IFDEF( "M4""_YY_NEVER_INTERACTIVE", option_sense );
379 interactive = !option_sense;
381 perf-report performance_report += option_sense ? 1 : -1;
382 pointer yytext_is_array = ! option_sense;
383 read use_read = option_sense;
384 reentrant reentrant = option_sense;
385 reject reject_really_used = option_sense;
386 stack ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
387 stdinit do_stdinit = option_sense;
388 stdout use_stdout = option_sense;
389 unistd ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
390 unput ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
391 verbose printstats = option_sense;
392 warn nowarn = ! option_sense;
393 yylineno do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense);
394 yymore yymore_really_used = option_sense;
395 yywrap do_yywrap = option_sense;
397 yy_push_state ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense);
398 yy_pop_state ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense);
399 yy_top_state ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense);
401 yy_scan_buffer ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense);
402 yy_scan_bytes ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense);
403 yy_scan_string ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense);
405 yyalloc ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense);
406 yyrealloc ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense);
407 yyfree ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense);
409 yyget_debug ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense);
410 yyset_debug ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense);
411 yyget_extra ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense);
412 yyset_extra ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense);
413 yyget_leng ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense);
414 yyget_text ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense);
415 yyget_lineno ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense);
416 yyset_lineno ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense);
417 yyget_in ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense);
418 yyset_in ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense);
419 yyget_out ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense);
420 yyset_out ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense);
421 yyget_lval ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense);
422 yyset_lval ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense);
423 yyget_lloc ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense);
424 yyset_lloc ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense);
426 extra-type return OPT_EXTRA_TYPE;
427 outfile return OPT_OUTFILE;
428 prefix return OPT_PREFIX;
429 yyclass return OPT_YYCLASS;
430 header(-file)? return OPT_HEADER;
431 tables-file return OPT_TABLES;
433 tablesverify = option_sense;
434 if(!tablesext && option_sense)
440 if(yyleng-1 < MAXLINE)
442 strlcpy( nmstr, yytext + 1, sizeof(nmstr) );
446 synerr( _("Option line too long\n"));
447 FLEX_EXIT(EXIT_FAILURE);
449 nmstr[strlen( nmstr ) - 1] = '\0';
453 (([a-mo-z]|n[a-np-z])[[:alpha:]\-+]*)|. {
454 format_synerr( _( "unrecognized %%option: %s" ),
460 <RECOVER>.*{NL} ++linenum; BEGIN(INITIAL);
464 ^"%{".* ++bracelevel; yyless( 2 ); /* eat only %{ */
465 ^"%}".* --bracelevel; yyless( 2 ); /* eat only %} */
467 ^{WS}.* ACTION_ECHO; /* indented code in prolog */
469 ^{NOT_WS}.* { /* non-indented code */
470 if ( bracelevel <= 0 )
471 { /* not in %{ ... %} */
472 yyless( 0 ); /* put it all back */
482 {NL} ++linenum; ACTION_ECHO;
487 yyterminate(); /* to stop the parser */
492 ^{OPTWS}{NL} ++linenum; /* allow blank lines in section 2 */
495 indented_code = false;
496 doing_codeblock = true;
498 BEGIN(PERCENT_BRACE_ACTION);
502 /* Allow "<" to appear in (?x) patterns. */
507 ^{OPTWS}"^" return '^';
508 \" BEGIN(QUOTE); return '"';
511 if ( lex_compat || posix_compat )
512 return BEGIN_REPEAT_POSIX;
514 return BEGIN_REPEAT_FLEX;
516 "$"/([[:blank:]]|{NL}) return '$';
520 BEGIN(PERCENT_BRACE_ACTION);
524 doing_rule_action = true;
531 /* We're in the middle of a (?x: ) pattern. */
532 /* Push back everything starting at the "|" */
534 amt = strchr (yytext, '|') - yytext;
538 continued_action = true;
547 /* We're in the middle of a (?x: ) pattern. */
548 yy_push_state(COMMENT_DISCARD);
551 yyless( yyleng - 2 ); /* put back '/', '*' */
553 continued_action = false;
558 ^{WS} /* allow indented rules */ ;
562 /* We're in the middle of a (?x: ) pattern. */
565 /* This rule is separate from the one below because
566 * otherwise we get variable trailing context, so
567 * we can't build the scanner using -{f,F}.
570 continued_action = false;
575 doing_rule_action = true;
584 /* We're in the middle of a (?x: ) pattern. */
589 continued_action = false;
591 unput( '\n' ); /* so <ACTION> sees it */
595 doing_rule_action = true;
603 "<<EOF>>" return EOF_OP;
608 outn("/* Begin user sect3 */");
609 yyterminate(); /* to stop the parser */
612 "["({FIRST_CCL_CHAR}|{CCL_EXPR})({CCL_CHAR}|{CCL_EXPR})* {
617 strlcpy( nmstr, yytext, sizeof(nmstr) );
621 synerr( _("Input line too long\n"));
622 FLEX_EXIT(EXIT_FAILURE);
625 /* Check to see if we've already encountered this
628 if (0 /* <--- This "0" effectively disables the reuse of a
629 * character class (purely based on its source text).
630 * The reason it was disabled is so yacc/bison can parse
631 * ccl operations, such as ccl difference and union.
633 && (cclval = ccllookup( (Char *) nmstr )) != 0 )
635 if ( input() != ']' )
636 synerr( _( "bad character class" ) );
644 /* We fudge a bit. We know that this ccl will
645 * soon be numbered as lastccl + 1 by cclinit.
647 cclinstal( (Char *) nmstr, lastccl + 1 );
649 /* Push back everything but the leading bracket
650 * so the ccl can be rescanned.
658 "{-}" return CCL_OP_DIFF;
659 "{+}" return CCL_OP_UNION;
662 /* Check for :space: at the end of the rule so we don't
663 * wrap the expanded regex in '(' ')' -- breaking trailing
666 "{"{NAME}"}"[[:space:]]? {
667 register Char *nmdefptr;
668 int end_is_ws, end_ch;
670 end_ch = yytext[yyleng-1];
671 end_is_ws = end_ch != '}' ? 1 : 0;
673 if(yyleng-1 < MAXLINE)
675 strlcpy( nmstr, yytext + 1, sizeof(nmstr) );
679 synerr( _("Input line too long\n"));
680 FLEX_EXIT(EXIT_FAILURE);
682 nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
684 if ( (nmdefptr = ndlookup( nmstr )) == 0 )
686 _( "undefined definition {%s}" ),
690 { /* push back name surrounded by ()'s */
691 int len = strlen( (char *) nmdefptr );
695 if ( lex_compat || nmdefptr[0] == '^' ||
696 (len > 0 && nmdefptr[len - 1] == '$')
697 || (end_is_ws && trlcontxt && !sf_skip_ws()))
698 { /* don't use ()'s after all */
699 PUT_BACK_STRING((char *) nmdefptr, 0);
701 if ( nmdefptr[0] == '^' )
708 PUT_BACK_STRING((char *) nmdefptr, 0);
716 yy_push_state(COMMENT_DISCARD);
718 /* Push back the "*" and return "/" as usual. */
725 if (lex_compat || posix_compat){
726 /* Push back the "?#" and treat it like a normal parens. */
732 yy_push_state(EXTENDED_COMMENT);
736 if (lex_compat || posix_compat)
737 /* Push back the "?" and treat it like a normal parens. */
740 BEGIN(GROUP_WITH_PARAMS);
743 "(" sf_push(); return '(';
744 ")" sf_pop(); return ')';
746 [/|*+?.(){}] return (unsigned char) yytext[0];
752 {OPTWS}{NL}{OPTWS} ++linenum; /* Allow blank lines & continuations */
753 [,*] return (unsigned char) yytext[0];
754 ">" BEGIN(SECT2); return '>';
755 ">"/^ BEGIN(CARETISBOL); return '>';
758 format_synerr( _( "bad <start condition>: %s" ),
763 <CARETISBOL>"^" BEGIN(SECT2); return '^';
768 \" BEGIN(SECT2); return '"';
771 synerr( _( "missing quote" ) );
780 "-" BEGIN(GROUP_MINUS_PARAMS);
781 i sf_set_case_ins(1);
785 <GROUP_MINUS_PARAMS>{
787 i sf_set_case_ins(0);
793 "^"/[^-\]\n] BEGIN(CCL); return '^';
794 "^"/("-"|"]") return '^';
795 . BEGIN(CCL); RETURNCHAR;
799 -/[^\]\n] return '-';
801 "]" BEGIN(SECT2); return ']';
803 synerr( _( "bad character class" ) );
810 "[:alnum:]" BEGIN(CCL); return CCE_ALNUM;
811 "[:alpha:]" BEGIN(CCL); return CCE_ALPHA;
812 "[:blank:]" BEGIN(CCL); return CCE_BLANK;
813 "[:cntrl:]" BEGIN(CCL); return CCE_CNTRL;
814 "[:digit:]" BEGIN(CCL); return CCE_DIGIT;
815 "[:graph:]" BEGIN(CCL); return CCE_GRAPH;
816 "[:lower:]" BEGIN(CCL); return CCE_LOWER;
817 "[:print:]" BEGIN(CCL); return CCE_PRINT;
818 "[:punct:]" BEGIN(CCL); return CCE_PUNCT;
819 "[:space:]" BEGIN(CCL); return CCE_SPACE;
820 "[:upper:]" BEGIN(CCL); return CCE_UPPER;
821 "[:xdigit:]" BEGIN(CCL); return CCE_XDIGIT;
823 "[:^alnum:]" BEGIN(CCL); return CCE_NEG_ALNUM;
824 "[:^alpha:]" BEGIN(CCL); return CCE_NEG_ALPHA;
825 "[:^blank:]" BEGIN(CCL); return CCE_NEG_BLANK;
826 "[:^cntrl:]" BEGIN(CCL); return CCE_NEG_CNTRL;
827 "[:^digit:]" BEGIN(CCL); return CCE_NEG_DIGIT;
828 "[:^graph:]" BEGIN(CCL); return CCE_NEG_GRAPH;
829 "[:^lower:]" BEGIN(CCL); return CCE_NEG_LOWER;
830 "[:^print:]" BEGIN(CCL); return CCE_NEG_PRINT;
831 "[:^punct:]" BEGIN(CCL); return CCE_NEG_PUNCT;
832 "[:^space:]" BEGIN(CCL); return CCE_NEG_SPACE;
833 "[:^upper:]" BEGIN(CCL); return CCE_NEG_UPPER;
834 "[:^xdigit:]" BEGIN(CCL); return CCE_NEG_XDIGIT;
837 _( "bad character class expression: %s" ),
839 BEGIN(CCL); return CCE_ALNUM;
845 yylval = myctoi( yytext );
852 if ( lex_compat || posix_compat )
853 return END_REPEAT_POSIX;
855 return END_REPEAT_FLEX;
859 synerr( _( "bad character inside {}'s" ) );
865 synerr( _( "missing }" ) );
873 <PERCENT_BRACE_ACTION>{
874 {OPTWS}"%}".* bracelevel = 0;
876 <ACTION>"/*" ACTION_ECHO; yy_push_state( COMMENT );
881 CHECK_RE_JECT(yytext);
885 CHECK_YYMORE(yytext);
889 {M4QSTART} ACTION_ECHO_QSTART;
890 {M4QEND} ACTION_ECHO_QEND;
895 if ( bracelevel == 0 ||
896 (doing_codeblock && indented_code) )
898 if ( doing_rule_action )
899 add_action( "\tYY_BREAK\n" );
901 doing_rule_action = doing_codeblock = false;
908 /* Reject and YYmore() are checked for above, in PERCENT_BRACE_ACTION */
910 "{" ACTION_ECHO; ++bracelevel;
911 "}" ACTION_ECHO; --bracelevel;
912 {M4QSTART} ACTION_ECHO_QSTART;
913 {M4QEND} ACTION_ECHO_QEND;
914 [^[:alpha:]_{}"'/\n\[\]]+ ACTION_ECHO;
917 "'"([^'\\\n]|\\.)*"'" ACTION_ECHO; /* character constant */
918 \" ACTION_ECHO; BEGIN(ACTION_STRING);
922 if ( bracelevel == 0 )
924 if ( doing_rule_action )
925 add_action( "\tYY_BREAK\n" );
927 doing_rule_action = false;
935 [^"\\\n]+ ACTION_ECHO;
937 {NL} ++linenum; ACTION_ECHO; BEGIN(ACTION);
938 \" ACTION_ECHO; BEGIN(ACTION);
942 <COMMENT,COMMENT_DISCARD,ACTION,ACTION_STRING><<EOF>> {
943 synerr( _( "EOF encountered inside an action" ) );
947 <EXTENDED_COMMENT,GROUP_WITH_PARAMS,GROUP_MINUS_PARAMS><<EOF>> {
948 synerr( _( "EOF encountered inside pattern" ) );
952 <SECT2,QUOTE,FIRSTCCL,CCL>{ESCSEQ} {
953 yylval = myesc( (Char *) yytext );
955 if ( YY_START == FIRSTCCL )
963 {M4QSTART} fwrite (escaped_qstart, 1, strlen(escaped_qstart), yyout);
964 {M4QEND} fwrite (escaped_qend, 1, strlen(escaped_qend), yyout);
965 [^\[\]\n]*(\n?) ECHO;
967 <<EOF>> sectnum = 0; yyterminate();
970 <*>.|\n format_synerr( _( "bad character: %s" ), yytext );
977 if ( --num_input_files > 0 )
979 set_input_file( *++input_files );
988 /* set_input_file - open the given file (if NULL, stdin) for scanning */
990 void set_input_file( file )
993 if ( file && strcmp( file, "-" ) )
995 infilename = copy_string( file );
996 yyin = fopen( infilename, "r" );
999 lerrsf( _( "can't open %s" ), file );
1005 infilename = copy_string( "<stdin>" );
1012 /* Wrapper routines for accessing the scanner's malloc routines. */
1014 void *flex_alloc( size )
1017 return (void *) malloc( size );
1020 void *flex_realloc( ptr, size )
1024 return (void *) realloc( ptr, size );
1027 void flex_free( ptr )