From 5ce121ab1cf38815cc39b8b212f8f8eaf8d59ee4 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Wed, 2 Nov 2005 21:49:52 +0000 Subject: [PATCH] Make the lexer work with Solaris' (10) default lex(1). While Solaris' lex understands start conditions, they cannot be grouped, so unfold the group. All actions need braces, even if they only consist of a comment. As the classic lex uses semi-static resource allocation, we need to bump the resource limits quite a bit. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@541 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 2 ++ avrdude/lexer.l | 35 +++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index 97ce4706..254c3592 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -2,6 +2,8 @@ * config.h: change YYSTYPE to be a single word, to work around a bug in Solaris' yacc. + * lexer.l: remove incompatibilities with Solaris' default lex, + bump resource limits for lex. 2005-11-01 Joerg Wunsch diff --git a/avrdude/lexer.l b/avrdude/lexer.l index 5afa6154..b99ad3a4 100644 --- a/avrdude/lexer.l +++ b/avrdude/lexer.l @@ -50,6 +50,11 @@ SIGN [+-] %x incl %x comment +/* Bump resources for classic lex. */ +%e2000 +%p5000 +%n1000 + %% {SIGN}*{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; } @@ -64,7 +69,7 @@ SIGN [+-] # { /* The following eats '#' style comments to end of line */ BEGIN(comment); } -[^\n] /* eat comments */ +[^\n] { /* eat comments */ } \n { lineno++; BEGIN(INITIAL); } @@ -99,21 +104,19 @@ SIGN [+-] } -{ - \" { *string_buf_ptr = 0; string_buf_ptr = string_buf; - yylval = string(string_buf_ptr); BEGIN(INITIAL); return TKN_STRING; } - \\n *string_buf_ptr++ = '\n'; - \\t *string_buf_ptr++ = '\t'; - \\r *string_buf_ptr++ = '\r'; - \\b *string_buf_ptr++ = '\b'; - \\f *string_buf_ptr++ = '\f'; - \\(.|\n) *(string_buf_ptr++) = yytext[1]; - [^\\\n\"]+ { char *yptr = yytext; while (*yptr) +\" { *string_buf_ptr = 0; string_buf_ptr = string_buf; + yylval = string(string_buf_ptr); BEGIN(INITIAL); return TKN_STRING; } +\\n *string_buf_ptr++ = '\n'; +\\t *string_buf_ptr++ = '\t'; +\\r *string_buf_ptr++ = '\r'; +\\b *string_buf_ptr++ = '\b'; +\\f *string_buf_ptr++ = '\f'; +\\(.|\n) *(string_buf_ptr++) = yytext[1]; +[^\\\n\"]+ { char *yptr = yytext; while (*yptr) *(string_buf_ptr++) = *(yptr++); } - \n { fprintf(stderr, "error at line %d: unterminated character constant\n", - lineno); - exit(1); } -} +\n { fprintf(stderr, "error at line %d: unterminated character constant\n", + lineno); + exit(1); } allowfullpagebitstream { yylval=NULL; return K_ALLOWFULLPAGEBITSTREAM; } avr910 { yylval=NULL; return K_AVR910; } @@ -216,7 +219,7 @@ yes { yylval=new_token(K_YES); return K_YES; } "~" { yylval = NULL; pyytext(); return TKN_TILDE; } "\n" { lineno++; } -[ \r\t]+ /* ignore whitespace */ +[ \r\t]+ { /* ignore whitespace */ } c: { fprintf(stderr, "error at %s:%d: possible old-style config file entry\n", infile, lineno);