Added indent keyword

Added Replace token
Some fiddling which will hopefully fix a line counting bug
This commit is contained in:
Thomas Jensen 1999-04-04 16:11:39 +00:00
parent 1492da7251
commit 4c0375a015

View File

@ -4,14 +4,19 @@
* Date created: March 15, 1999 (Monday, 17:16h) * Date created: March 15, 1999 (Monday, 17:16h)
* Author: Thomas Jensen * Author: Thomas Jensen
* tsjensen@stud.informatik.uni-erlangen.de * tsjensen@stud.informatik.uni-erlangen.de
* Version: $Id$ * Version: $Id: lexer.l,v 1.2 1999/03/30 09:42:51 tsjensen Exp tsjensen $
* Language: lex (ANSI C) * Language: lex (ANSI C)
* Purpose: flex lexical analyzer for boxes configuration files * Purpose: flex lexical analyzer for boxes configuration files
* Remarks: --- * Remarks: ---
* *
* Revision History: * Revision History:
* *
* $Log$ * $Log: lexer.l,v $
* Revision 1.2 1999/03/30 09:42:51 tsjensen
* Added rcs keywords and standard file header.
*
* Revision 1.1 1999/03/18 15:09:48 tsjensen
* Initial revision
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/ */
@ -22,7 +27,7 @@
#include "boxes.h" #include "boxes.h"
#include "y.tab.h" #include "y.tab.h"
#ident "$Id$" #ident "$Id: lexer.l,v 1.2 1999/03/30 09:42:51 tsjensen Exp tsjensen $"
int yylineno = 1; int yylineno = 1;
@ -40,13 +45,6 @@ int yylineno = 1;
<SAMPLE1,SHAPES,OFFSETS,ELASTIC,INITIAL>\n yylineno++; <SAMPLE1,SHAPES,OFFSETS,ELASTIC,INITIAL>\n yylineno++;
#[^#].*$ {
/* ignore comments */
#ifdef DEBUG
fprintf (stderr, "\nCOMMENT: %s", yytext+1);
#endif
}
\"[^"\n]*$ { \"[^"\n]*$ {
yyerror ("Unterminated String at %s", yytext); yyerror ("Unterminated String at %s", yytext);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@ -174,6 +172,13 @@ Shapes {
return YSHAPES; return YSHAPES;
} }
Replace {
#ifdef DEBUG
fprintf (stderr, "\nYREPLACE: %s", yytext);
#endif
return YREPLACE;
}
<OFFSETS>nw-nnw { yylval.offset = NW_NNW; return OFFSET; } <OFFSETS>nw-nnw { yylval.offset = NW_NNW; return OFFSET; }
<OFFSETS>nnw-n { yylval.offset = NNW_N; return OFFSET; } <OFFSETS>nnw-n { yylval.offset = NNW_N; return OFFSET; }
<OFFSETS>n-nne { yylval.offset = N_NNE; return OFFSET; } <OFFSETS>n-nne { yylval.offset = N_NNE; return OFFSET; }
@ -224,9 +229,9 @@ Shapes {
return yytext[0]; return yytext[0];
} }
BOX|revision|author|created|revdate|END { BOX|revision|author|created|indent|revdate|END {
/* /*
* general key words followed by a string * general key words
*/ */
#ifdef DEBUG #ifdef DEBUG
fprintf (stderr, "\nKEYWORD: %s", yytext); fprintf (stderr, "\nKEYWORD: %s", yytext);
@ -258,6 +263,13 @@ BOX|revision|author|created|revdate|END {
return NUMBER; return NUMBER;
} }
#.*$ {
/* ignore comments */
#ifdef DEBUG
fprintf (stderr, "\nCOMMENT: %s", yytext+1);
#endif
}
. { . {
yyerror ("Unrecognized input at %s", yytext); yyerror ("Unrecognized input at %s", yytext);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);