[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/geas/lib/classdefs lparser.l
From: |
Neil Tiffin |
Subject: |
gnue/geas/lib/classdefs lparser.l |
Date: |
Sat, 26 May 2001 07:23:33 -0700 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Neil Tiffin <address@hidden> 01/05/26 07:23:32
Modified files:
geas/lib/classdefs: lparser.l
Log message:
Format changes only.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/lparser.l.diff?cvsroot=OldCVS&tr1=1.20&tr2=1.21&r1=text&r2=text
Patches:
Index: gnue/geas/lib/classdefs/lparser.l
diff -u gnue/geas/lib/classdefs/lparser.l:1.20
gnue/geas/lib/classdefs/lparser.l:1.21
--- gnue/geas/lib/classdefs/lparser.l:1.20 Sat May 19 16:21:02 2001
+++ gnue/geas/lib/classdefs/lparser.l Sat May 26 07:23:32 2001
@@ -24,7 +24,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: lparser.l,v 1.20 2001/05/19 23:21:02 ntiffin Exp $
+ $Id: lparser.l,v 1.21 2001/05/26 14:23:32 ntiffin Exp $
*/
@@ -154,11 +154,19 @@
}
}
-<incl>{whitespace}{newline} { yywarn("No filename given for include
directive"); BEGIN(failinclude); }
+<incl>{whitespace}{newline} {
+ yywarn("No filename given for include
directive");
+ BEGIN(failinclude);
+ }
+
<incl>{whitespace}[^\"\n]+\n |
-<incl>{whitespace}[^\"\n]* { yywarn("Include filename must be quoted.\n");
BEGIN(failinclude); }
+<incl>{whitespace}[^\"\n]* {
+ yywarn("Include filename must be quoted.\n");
+ BEGIN(failinclude);
+ }
<endincl>{whitespace}* /* ignore whitespace */
+
<endincl>\n {
currentfile.line++;
BEGIN(FULLLINE); /* return to normal processing */
@@ -185,7 +193,7 @@
}
<FULLLINE>\n |
-<FULLLINE>[^\n]* { /* record the current line, truncating if necessary */
+<FULLLINE>[^\n]* { /* record the current line, truncating if necessary */
if (strlen( yytext) > LINEBUF_LENGTH)
{
yyerror( "Current line too long." );
@@ -197,14 +205,23 @@
token_pos = 1;
BEGIN(INITIAL);
yyless(0);
- }
+ }
^{whitespace}{newline} |
^{whitespace}{scomment}{newline} |
-{scomment}{newline} { /* blank lines */ currentfile.line++;
BEGIN(FULLLINE); }
+{scomment}{newline} { /* blank lines */
+ currentfile.line++;
+ BEGIN(FULLLINE);
+ }
+
+{newline} {
+ currentfile.line++;
+ BEGIN(FULLLINE);
+ }
-{newline} { currentfile.line++; BEGIN(FULLLINE); }
-{whitespace} { /* ignore whitespace*/ token_pos += yyleng; }
+{whitespace} { /* ignore whitespace*/
+ token_pos += yyleng;
+ }
{qstring} {
ST;
@@ -215,7 +232,9 @@
yylval.string = g_strdup(&yytext[1]);
return(STRING);
}
+
[+-]?[0-9]+ { ST; yylval.integer = atol(yytext); return(INTEGER); }
+
[+-]?[0-9]+.[0-9]+ { ST; yylval.floating = atof(yytext); return(DOUBLE); }
/* this set can be followed by more datatype fields, and the parser
must reset expecting_datatype */
@@ -228,12 +247,25 @@
singleton { ST; if( expecting_datatype == 1 ) return(SINGLETON);
else return(SYMBOL); }
readonly { ST; if( expecting_datatype == 1 ) return(READONLY);
else return(SYMBOL); }
- /* the same, except using expecting_fieldprop */
+ /* the same, except using expecting_fieldprop */
not { ST; if( expecting_fieldprop == 1 ) return(NOT); else
return(SYMBOL); }
null { ST; if( expecting_fieldprop == 1 ) return(NUL); else
return(SYMBOL); }
- /* this set is the final entry in a datatype, so can reset
expecting_datatype here */
-module { ST; if( expecting_datatype == 1 ) { expecting_datatype =
0; return(MODULE); } else { yylval.string=g_strdup(yytext); return(SYMBOL);
} }
+ /* this set is the final entry in a datatype,
+ so can reset expecting_datatype here */
+module {
+ ST;
+ if( expecting_datatype == 1 )
+ {
+ expecting_datatype = 0;
+ return(MODULE);
+ }
+ else
+ {
+ yylval.string=g_strdup(yytext);
+ return(SYMBOL);
+ }
+ }
class { ST; if( expecting_datatype == 1 ) { expecting_datatype =
0; return(CLASS); } else { yylval.string=g_strdup(yytext); return(SYMBOL);
} }
type { ST; if( expecting_datatype == 1 ) { expecting_datatype =
0; return(CTYPE); } else { yylval.string=g_strdup(yytext); return(SYMBOL);
} }
extend { ST; if( expecting_datatype == 1 ) { expecting_datatype =
0; return(EXTEND); } else { yylval.string=g_strdup(yytext); return(SYMBOL);
} }
@@ -250,45 +282,51 @@
order { ST; if( expecting_datatype == 1 ) { expecting_datatype =
0; return(ORDER); } else { yylval.string=g_strdup(yytext);
return(SYMBOL); } }
by { ST; if( expecting_datatype == 1 ) { expecting_datatype =
0; return(BY); } else { yylval.string=g_strdup(yytext); return(SYMBOL);
} }
-[a-zA-Z][a-zA-Z0-9]* { enum odl_datatype tmp;
+[a-zA-Z][a-zA-Z0-9]* { enum odl_datatype tmp;
ST;
- if( expecting_datatype == 1 ) {
+ if( expecting_datatype == 1 )
+ {
expecting_datatype = 0;
tmp = odl_datatype_id( yytext );
yylval.string = g_strdup( yytext );
if( tmp != DT_unknown ) return(DATATYPE);
- }
- else if(expect_triggertype == 1) {
+ }
+ else if(expect_triggertype == 1)
+ {
// yylval.integer = find_triggertype_id(
yytext );
// if( yylval.integer != TT_UNKNOWN )
// return(TRIGGERTYPE);
- }
- /* not expecting a datatype or trigger type, or
didn't get one */
+ }
+ /* not expecting a datatype or trigger type, or
didn't get one */
yylval.string = g_strdup( yytext );
return(SYMBOL);
}
+
[_a-zA-Z][_a-zA-Z0-9]* { enum odl_datatype tmp;
ST;
- if( expecting_datatype == 1 ) {
+ if( expecting_datatype == 1 )
+ {
expecting_datatype = 0;
tmp = odl_datatype_id( yytext );
yylval.string = g_strdup( yytext );
if( tmp != DT_unknown ) return(DATATYPE);
- }
- else if(expect_triggertype == 1) {
+ }
+ else if(expect_triggertype == 1)
+ {
/* not valid symbol, but not expecting a
symbol */
/* so the more useful syntax error will be
generated */
return(SYMBOL);
- }
+ }
/* not expecting a datatype or trigger type, or
didn't get one */
- if( current_pass == 1 ) {
+ if( current_pass == 1 )
+ {
if( strstr(yytext,"__") != NULL )
yyerror( "Double underscores are not
allowed in identifiers" );
else if( yytext[0] == '_' )
yyerror( "Leading underscores are not
allowed in identifiers" );
else if( yytext[ strlen(yytext)-1 ] == '_' )
yyerror( "Trailing underscores are not
allowed in identifiers" );
- }
+ }
yylval.string = g_strdup( yytext );
return(SYMBOL);
}
- gnue/geas/lib/classdefs lparser.l,
Neil Tiffin <=