summaryrefslogtreecommitdiff
path: root/bcc/scan.c
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1996-11-03 22:33:35 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:33:35 +0200
commitc218c617b5be443b7968308506969ad2b726d73c (patch)
tree0051f396af56133d24fcf2ab757fabc78c1a09bf /bcc/scan.c
parent0936b9aeab611665645a4e6bafaded7ca76dd189 (diff)
parent0d2fbe9b1bd284ce2cad55be17e8f2c896031a25 (diff)
downloaddev86-c218c617b5be443b7968308506969ad2b726d73c.tar.gz
Import Dev86src-0.0.8.tar.gzv0.0.8
Diffstat (limited to 'bcc/scan.c')
-rw-r--r--bcc/scan.c52
1 files changed, 39 insertions, 13 deletions
diff --git a/bcc/scan.c b/bcc/scan.c
index 9ff697d..2254e4a 100644
--- a/bcc/scan.c
+++ b/bcc/scan.c
@@ -135,11 +135,35 @@ PUBLIC void blanks()
}
}
-PUBLIC void cppscan()
+PUBLIC void cppscan(asm_only)
+int asm_only;
{
- while (TRUE)
+ int start_of_line = 1;
+#ifndef ASM_BARE
+ virtual_nl = 1;
+#endif
+ while (!asm_only || asmmode)
{
- switch (SYMOFCHAR(ch))
+ int sym = SYMOFCHAR(ch);
+ switch (sym)
+ {
+ case CONTROL:
+ if( !start_of_line ) sym=BADCHAR;
+ break;
+ case WHITESPACE:
+ break;
+ case SPECIALCHAR:
+ if( ch == '\\' ) sym=BADCHAR;
+ start_of_line = 1;
+ break;
+ case CHARCONST:
+ case STRINGCONST:
+ if( asmmode ) sym=BADCHAR;
+ default:
+ start_of_line = 0;
+ }
+
+ switch (sym)
{
case CHARCONST:
case STRINGCONST:
@@ -157,9 +181,7 @@ PUBLIC void cppscan()
}
else
{
- cppmode = FALSE;
docontrol();
- cppmode = TRUE;
break;
}
case SLASH:
@@ -227,10 +249,17 @@ PUBLIC void cppscan()
break; /* specialchar advanced the input */
/* must be '\\' */
default:
+ /* Allow for multi-instruction lines in asm */
+ if( ch == '^' && !orig_cppmode && asmmode ) ch='\n';
+
OUTBYTE(ch);
- GCH1();
+ ch = *++lineptr;
+ if (SYMOFCHAR(ch) == SPECIALCHAR && ch != '\\') specialchar();
break;
}
+#ifndef ASM_BARE
+ virtual_nl = 0;
+#endif
}
}
@@ -383,10 +412,6 @@ PRIVATE void intconst()
break;
++digptr;
}
- if (lcount > 1)
- error("more than one 'L' in integer constant");
- if (ucount > 1)
- error("more than one 'U' in integer constant");
if (constant.value.v <= maxintto && lcount == 0 && ucount == 0)
constant.type = itype;
else if (constant.value.v <= maxuintto && lcount == 0
@@ -396,7 +421,8 @@ PRIVATE void intconst()
constant.type = ltype;
else
constant.type = ultype;
- if (*digptr != 0)
+
+ if (lcount > 1 || ucount > 1 || *digptr != 0)
error("junk at end of integer constant");
}
@@ -716,7 +742,7 @@ PUBLIC void stringorcharconst()
GCH1();
if (ch == EOL)
{
- if (!orig_cppmode)
+ if (!orig_cppmode && ifcheck() )
error(terminator == '"' ? "end of line in string constant"
: "end of line in character constant");
break;
@@ -726,7 +752,7 @@ PUBLIC void stringorcharconst()
*charptr++ = terminator;
/* This adds ansi string concatenation BUT only on one line */
- do { gch1(); } while(SYMOFCHAR(ch) == WHITESPACE);
+ do { ch = *++lineptr; } while(SYMOFCHAR(ch) == WHITESPACE);
if( ch == terminator ) /* Hang on .. that's another string ... */
{
charptr--; /* Stick it together */