summaryrefslogtreecommitdiff
path: root/parse/tok.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-07-23 15:40:14 -0400
committerOri Bernstein <ori@eigenstate.org>2013-07-23 15:40:14 -0400
commitf2afc8da2339dbfaaa7dd92abf63521ae38e6dd8 (patch)
treef3b3f09e742cc7a8514238e6fb9f18af5eaf927e /parse/tok.c
parent0f2de28c580dd78160230b5b973c903378527623 (diff)
downloadmc-f2afc8da2339dbfaaa7dd92abf63521ae38e6dd8.tar.gz
Allow splitting lines.
Diffstat (limited to 'parse/tok.c')
-rw-r--r--parse/tok.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/parse/tok.c b/parse/tok.c
index 0c323aa..7978e2e 100644
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -19,7 +19,6 @@
char *filename;
int line;
-int ignorenl;
Tok *curtok;
/* the file contents are stored globally */
@@ -130,17 +129,24 @@ static void eatcomment(void)
static void eatspace(void)
{
int c;
+ int ignorenl;
+ ignorenl = 0;
while (1) {
c = peek();
- if ((!ignorenl && c == '\n'))
+ if (!ignorenl && c == '\n') {
+ ignorenl = 0;
break;
- else if (isspace(c))
+ } else if (c == '\\') {
+ ignorenl = 1;
next();
- else if (c == '/' && peekn(1) == '*')
+ } else if (isspace(c) || (ignorenl && c == '\n')) {
+ next();
+ } else if (c == '/' && peekn(1) == '*') {
eatcomment();
- else
+ } else {
break;
+ }
}
}