projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* src/pic16/glue.c, src/SDCCast.c, src/SDCCast.h, src/SDCCBBlock.c,
[fw/sdcc]
/
src
/
SDCC.lex
diff --git
a/src/SDCC.lex
b/src/SDCC.lex
index fbabe7031115955c54d871984f7c21ab0f1348ff..e0038cc65202abf5aa30a0557481a7cfa8a14573 100644
(file)
--- a/
src/SDCC.lex
+++ b/
src/SDCC.lex
@@
-1,6
+1,6
@@
/*-----------------------------------------------------------------------
/*-----------------------------------------------------------------------
- SDCC.lex - lexical analyser for use with sdcc (
a freeware compiler for
- 8/16 bit microcontrollers)
+ SDCC.lex - lexical analyser for use with sdcc (
free open source
+
compiler for
8/16 bit microcontrollers)
Written by : Sandeep Dutta . sandeep.dutta@usa.net (1997)
This program is free software; you can redistribute it and/or modify it
Written by : Sandeep Dutta . sandeep.dutta@usa.net (1997)
This program is free software; you can redistribute it and/or modify it
@@
-23,8
+23,7
@@
-------------------------------------------------------------------------*/
D [0-9]
-------------------------------------------------------------------------*/
D [0-9]
-L [a-zA-Z_]
-L_DOLL [a-zA-Z_$]
+L [a-zA-Z_$]
H [a-fA-F0-9]
E [Ee][+-]?{D}+
FS (f|F|l|L)
H [a-fA-F0-9]
E [Ee][+-]?{D}+
FS (f|F|l|L)
@@
-58,6
+57,7
@@
int lexLineno = 1;
static struct dbuf_s asmbuff; /* reusable _asm buffer */
/* forward declarations */
static struct dbuf_s asmbuff; /* reusable _asm buffer */
/* forward declarations */
+int yyerror(char *s);
static const char *stringLiteral(void);
static void count(void);
static void count_char(int);
static const char *stringLiteral(void);
static void count(void);
static void count_char(int);
@@
-191,15
+191,13
@@
_?"_asm" {
"__overlay" { count(); TKEYWORD(OVERLAY); }
"inline" { count(); TKEYWORD99(INLINE); }
"restrict" { count(); TKEYWORD99(RESTRICT); }
"__overlay" { count(); TKEYWORD(OVERLAY); }
"inline" { count(); TKEYWORD99(INLINE); }
"restrict" { count(); TKEYWORD99(RESTRICT); }
-{L}({L}|{D})* { count(); return(check_type()); }
-{L_DOLL}({L_DOLL}|{D})* {
- if (options.dollars_in_ident)
+{L}({L}|{D})* {
+ if (!options.dollars_in_ident && strchr(yytext, '$'))
{
{
- count();
- return(check_type());
+ yyerror("stray '$' in program");
}
}
- else
-
REJECT
;
+ count();
+
return(check_type())
;
}
0[xX]{H}+{IS}? { count(); yylval.val = constVal(yytext); return(CONSTANT); }
0[0-7]*{IS}? { count(); yylval.val = constVal(yytext); return(CONSTANT); }
}
0[xX]{H}+{IS}? { count(); yylval.val = constVal(yytext); return(CONSTANT); }
0[0-7]*{IS}? { count(); yylval.val = constVal(yytext); return(CONSTANT); }
@@
-332,14
+330,18
@@
static int checkCurrFile (const char *s)
else
{
const char *sb = s;
else
{
const char *sb = s;
+ char *tmpFname;
/* find the end of the file name */
while (*s && *s != '"')
++s;
/* find the end of the file name */
while (*s && *s != '"')
++s;
+ tmpFname = Safe_malloc(s - sb + 1);
+ memcpy(tmpFname, sb, s - sb);
+ tmpFname[s - sb] = '\0';
+
lexFilename = Safe_malloc(s - sb + 1);
lexFilename = Safe_malloc(s - sb + 1);
- memcpy(lexFilename, sb, s - sb);
- lexFilename[s - sb] = '\0';
+ copyStr(lexFilename, tmpFname);
}
filename = lexFilename;
}
filename = lexFilename;
@@
-499,8
+501,10
@@
static const char *stringLiteral(void)
dbuf_destroy(&linebuf);
}
else
dbuf_destroy(&linebuf);
}
else
- unput(ch);
- break;
+ {
+ unput(ch);
+ goto out;
+ }
default:
count_char(ch);
default:
count_char(ch);