summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rc/lex.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2020-11-01 11:56:26 -0800
committerOri Bernstein <ori@eigenstate.org>2020-11-01 11:56:26 -0800
commitd75d842cf576cb4785f89c5f5b73a4f73170001b (patch)
tree008a1cd386c97ee735ab2e1129eeda890093bcef /sys/src/cmd/rc/lex.c
parentdbd54342fd66fd372f5c2edd1597019814f41c9c (diff)
rc: show line numbers on error
This change provides a location for errors like 'null list in concatenation'.
Diffstat (limited to 'sys/src/cmd/rc/lex.c')
-rw-r--r--sys/src/cmd/rc/lex.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/src/cmd/rc/lex.c b/sys/src/cmd/rc/lex.c
index 662c1970a..52ded7769 100644
--- a/sys/src/cmd/rc/lex.c
+++ b/sys/src/cmd/rc/lex.c
@@ -25,6 +25,13 @@ int future = EOF;
int doprompt = 1;
int inquote;
int incomm;
+int lastc;
+int ndot;
+int nerror;
+int lexline;
+int nlexpath;
+int lexpathsz;
+
/*
* Look ahead in the input stream
*/
@@ -39,13 +46,14 @@ nextc(void)
/*
* Consume the lookahead character.
*/
-
int
advance(void)
{
int c = nextc();
lastc = future;
future = EOF;
+ if(c == '\n')
+ lexline++;
return c;
}
/*