aboutsummaryrefslogtreecommitdiff
path: root/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'scan.c')
-rw-r--r--scan.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/scan.c b/scan.c
index 22c1821..473400f 100644
--- a/scan.c
+++ b/scan.c
@@ -47,13 +47,25 @@ bufget(struct buffer *b)
static void
nextchar(struct scanner *s)
{
+ int c;
+
if (s->usebuf)
bufadd(&s->buf, s->chr);
- s->chr = getchar();
- if (s->chr == '\n')
+ for (;;) {
+ s->chr = getchar();
+ if (s->chr == '\n')
+ ++s->loc.line, s->loc.col = 1;
+ else
+ ++s->loc.col;
+ if (s->chr != '\\')
+ break;
+ c = getchar();
+ if (c != '\n') {
+ ungetc(c, stdin);
+ break;
+ }
++s->loc.line, s->loc.col = 1;
- else
- ++s->loc.col;
+ }
}
static int