/[bison]/bison/src/scan-skel.l
ViewVC logotype

Diff of /bison/src/scan-skel.l

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by akim, Wed Jan 9 13:03:45 2002 UTC revision 1.7 by akim, Tue Feb 5 10:08:59 2002 UTC
# Line 1  Line 1 
1                                                               /* -*- C -*- */  /* Scan Bison Skeletons.                                       -*- C -*-
2  /* Scan Bison Skeletons.     Copyright (C) 2001, 2002  Free Software Foundation, Inc.
    Copyright (C) 2001  Free Software Foundation, Inc.  
3    
4     This file is part of Bison, the GNU Compiler Compiler.     This file is part of Bison, the GNU Compiler Compiler.
5    
# Line 19  Line 18 
18     Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA     Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19     02111-1307, USA.  */     02111-1307, USA.  */
20    
21  %option debug nodefault noyywrap nounput  %option nodefault noyywrap nounput
22  %option prefix="skel_" outfile="lex.yy.c"  %option prefix="skel_" outfile="lex.yy.c"
23    
 /* If we enable  
   
    %option yylineno  
   
    Then we have warning: `yy_flex_realloc' defined but not used.  
    Seems like a Flex bug to me: Why the heck yylineno would trigger  
    the REJECT exception???  */  
   
24  %{  %{
25  #include "system.h"  #include "system.h"
26  #include "skeleton.h"  #include "files.h"
27  #include "parse-skel.h"  int skel_lex PARAMS ((void));
28  %}  static int yylineno = 1;
   
 %{  
 /* Each time we match a string, move the end cursor to its end. */  
 #define YY_USER_ACTION  yylloc->last_column += yyleng;  
29  %}  %}
30  %%  %%
31  %{    /* This is an approximation, but we don't need more. */
32    /* At each yylex invocation, mark the current position as the  ^"#output \""[^\"]+\"\n        {
33       start of the next token.  */       yytext[yyleng - 2] = '\0';
34    LOCATION_STEP (*yylloc);       skel_out = xfopen (yytext + strlen ("#output \""), "w");
35  %}       yylineno = 1;
36       }
37  "%%{line}"          { return LINE; }  
38  "%%{skeleton-line}" { return SLINE; }  "__oline__"      fprintf (yyout, "%d", yylineno);
39    [^_\n]+          ECHO;
40  "%%{section}" { return SECTION; }  \n+              yylineno += yyleng; ECHO;
41    .                ECHO;
 "%%{guards}"   { return GUARDS; }  
 "%%{actions}"  { return ACTIONS; }  
 "%%{tokendef}" { return TOKENS; }  
   
   /* Muscle.  */  
 "%%{"[a-zA-Z][0-9a-zA-Z_-]+"}" {  
   yylval->string = xstrndup (yytext + 3, yyleng - 4);  
   return MUSCLE;  
 }  
   
   /* String.  */  
 "%%\"".*"\"" {  
   yylval->string = xstrndup (yytext + 3, yyleng - 4);  
   return STRING;  
 }  
   
   /* End of line.  */  
 "\n" {  
   LOCATION_LINES (*yylloc, yyleng);  
   return '\n';  
 }  
   
   /* White spaces.  */  
 [\t ]+ {  
   yylval->string = yytext;  
   return BLANKS;  
 }  
   
   /* Plain Characters.  */  
 [^%\n]+ {  
   yylval->string = yytext;  
   return RAW;  
 }  
   
   /* Plain Character.  */  
 . {  
   yylval->character = *yytext;  
   return CHARACTER;  
 }  
42    
43  %%  %%

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26