projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bug fix #458744 is confirmed
[fw/sdcc]
/
src
/
SDCC.lex
diff --git
a/src/SDCC.lex
b/src/SDCC.lex
index 9607a9d4595b2e58cf5d547e687902b75dd3072f..cc81d1ec66dbc392e99f7ae16cdafbfb83fb581e 100644
(file)
--- a/
src/SDCC.lex
+++ b/
src/SDCC.lex
@@
-44,7
+44,6
@@
extern char *filename ;
extern char *fullSrcFileName ;
int yylineno = 1 ;
void count() ;
extern char *fullSrcFileName ;
int yylineno = 1 ;
void count() ;
-void comment();
int process_pragma(char *);
#undef yywrap
int process_pragma(char *);
#undef yywrap
@@
-118,7
+117,6
@@
struct options save_options ;
}
*asmp++ = '\n' ;
}
}
*asmp++ = '\n' ;
}
-"/*" { comment(); }
"at" { count(); TKEYWORD(AT) ; }
"auto" { count(); return(AUTO); }
"bit" { count(); TKEYWORD(BIT) ; }
"at" { count(); TKEYWORD(AT) ; }
"auto" { count(); return(AUTO); }
"bit" { count(); TKEYWORD(BIT) ; }
@@
-248,6
+246,7
@@
struct options save_options ;
\\ {
char ch=input();
if (ch!='\n') {
\\ {
char ch=input();
if (ch!='\n') {
+ // that could have been removed by the preprocessor anyway
werror (W_STRAY_BACKSLASH, column);
unput(ch);
}
werror (W_STRAY_BACKSLASH, column);
unput(ch);
}
@@
-282,8
+281,8
@@
int checkCurrFile ( char *s)
/* set the current line number to */
/* line number if printFlag is on */
if (!*s) {
/* set the current line number to */
/* line number if printFlag is on */
if (!*s) {
- yylineno = lNum ;
-
return 0;
+
lineno =
yylineno = lNum ;
+ return 0;
}
/* if we have a filename then check */
}
/* if we have a filename then check */
@@
-292,8
+291,8
@@
int checkCurrFile ( char *s)
s++ ;
if ( strncmp(s,fullSrcFileName,strlen(fullSrcFileName)) == 0) {
s++ ;
if ( strncmp(s,fullSrcFileName,strlen(fullSrcFileName)) == 0) {
-
yylineno = lNum - 2
;
-
currFname = fullSrcFileName ;
+
lineno = yylineno = lNum
;
+ currFname = fullSrcFileName ;
} else {
char *sb = s;
/* mark the end of the filename */
} else {
char *sb = s;
/* mark the end of the filename */
@@
-301,31
+300,12
@@
int checkCurrFile ( char *s)
*s = '\0';
currFname = Safe_calloc(1,strlen(sb)+1);
strcpy(currFname,sb);
*s = '\0';
currFname = Safe_calloc(1,strlen(sb)+1);
strcpy(currFname,sb);
-
yylineno = lNum - 2
;
+
lineno = yylineno = lNum
;
}
filename = currFname ;
return 0;
}
}
filename = currFname ;
return 0;
}
-void comment()
-{
- char c, c1;
-
- loop:
- while ((c = input()) != '*' && c) {
- if ( c == '\n') {
- lineno=++yylineno;
- }
- }
-
- if (c && (c1 = input()) != '/') {
- unput(c1);
- goto loop;
- }
-}
-
-
-
int column = 0;
int plineIdx=0;
int column = 0;
int plineIdx=0;
@@
-382,13
+362,10
@@
char *stringLiteral () {
/* if it is a \ then escape char's are allowed */
if (ch == '\\') {
ch=input();
/* if it is a \ then escape char's are allowed */
if (ch == '\\') {
ch=input();
- if (ch=='\r') {
- // input() translates \n into \r\n
- if ((ch=input())!='\n') {
- unput (ch);
- }
+ if (ch=='\n') {
/* \<newline> is a continuator */
lineno=++yylineno;
/* \<newline> is a continuator */
lineno=++yylineno;
+ column=0;
continue;
}
*str++ = '\\'; /* backslash in place */
continue;
}
*str++ = '\\'; /* backslash in place */
@@
-397,14
+374,11
@@
char *stringLiteral () {
}
/* if new line we have a new line break, which is illegal */
}
/* if new line we have a new line break, which is illegal */
- if (ch == '\r') {
- // input() translates \n into \r\n
- if ((ch=input())!='\n') {
- unput (ch);
- }
+ if (ch == '\n') {
werror (W_NEWLINE_IN_STRING);
*str++ = '\n';
lineno=++yylineno;
werror (W_NEWLINE_IN_STRING);
*str++ = '\n';
lineno=++yylineno;
+ column=0;
continue;
}
continue;
}
@@
-419,6
+393,9
@@
char *stringLiteral () {
if ((ch=input())!='\n') {
werror (W_STRAY_BACKSLASH, column);
unput(ch);
if ((ch=input())!='\n') {
werror (W_STRAY_BACKSLASH, column);
unput(ch);
+ } else {
+ lineno=++yylineno;
+ column=0;
}
break;
case '\n':
}
break;
case '\n':
@@
-429,7
+406,7
@@
char *stringLiteral () {
if (!ch)
break;
if (!ch)
break;
-
+
if (ch != '\"') {
unput(ch) ;
break ;
if (ch != '\"') {
unput(ch) ;
break ;
@@
-570,7
+547,7
@@
int process_pragma(char *s)
}
if (strncmp(cp,PRAGMA_NOLOOPREV,strlen(PRAGMA_NOLOOPREV)) == 0) {
}
if (strncmp(cp,PRAGMA_NOLOOPREV,strlen(PRAGMA_NOLOOPREV)) == 0) {
- doPragma(P_
EXCLUDE
,NULL);
+ doPragma(P_
LOOPREV
,NULL);
return 0;
}
return 0;
}