Make the lexer work with Solaris' (10) default lex(1).
While Solaris' lex understands start conditions, they cannot be grouped, so unfold the <strng> 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/avrdude@541 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
af52c74def
commit
811dd7d614
|
@ -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 <j@uriah.heep.sax.de>
|
||||
|
||||
|
|
35
lexer.l
35
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); }
|
||||
<comment>[^\n] /* eat comments */
|
||||
<comment>[^\n] { /* eat comments */ }
|
||||
<comment>\n { lineno++; BEGIN(INITIAL); }
|
||||
|
||||
|
||||
|
@ -99,21 +104,19 @@ SIGN [+-]
|
|||
}
|
||||
|
||||
|
||||
<strng>{
|
||||
\" { *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)
|
||||
<strng>\" { *string_buf_ptr = 0; string_buf_ptr = string_buf;
|
||||
yylval = string(string_buf_ptr); BEGIN(INITIAL); return TKN_STRING; }
|
||||
<strng>\\n *string_buf_ptr++ = '\n';
|
||||
<strng>\\t *string_buf_ptr++ = '\t';
|
||||
<strng>\\r *string_buf_ptr++ = '\r';
|
||||
<strng>\\b *string_buf_ptr++ = '\b';
|
||||
<strng>\\f *string_buf_ptr++ = '\f';
|
||||
<strng>\\(.|\n) *(string_buf_ptr++) = yytext[1];
|
||||
<strng>[^\\\n\"]+ { char *yptr = yytext; while (*yptr)
|
||||
*(string_buf_ptr++) = *(yptr++); }
|
||||
\n { fprintf(stderr, "error at line %d: unterminated character constant\n",
|
||||
lineno);
|
||||
exit(1); }
|
||||
}
|
||||
<strng>\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);
|
||||
|
|
Loading…
Reference in New Issue