hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit d517bc7f14e7c4344f20d0460971e7d84965c60c
parent 5e8b42336bdb6196dcac7ba5facf4a4fb1f98c88
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Fri, 28 May 2021 11:45:07 -0400

lex::mkloc: fix interaction with unlex

Signed-off-by: Eyal Sawady <ecs@d2evs.net>

Diffstat:
Mhare/lex/lex.ha | 15+++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/hare/lex/lex.ha b/hare/lex/lex.ha @@ -689,12 +689,15 @@ fn unget(lex: *lexer, r: ((rune, location) | io::EOF)) void = { lex.rb[0] = r; }; -export fn mkloc(lex: *lexer) location = match (lex.rb[0]) { - r: (rune, location) => r.1, - void => location { - path = lex.path, - line = lex.loc.0, - col = lex.loc.1, +export fn mkloc(lex: *lexer) location = match (lex.un) { + t: token => lex.prevunlocs[1].1, + void => match (lex.rb[0]) { + r: (rune, location) => r.1, + void => location { + path = lex.path, + line = lex.loc.0, + col = lex.loc.1, + }, }, };