hare

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

commit d4ef660fb1a7680bf6fa59adba9fac2321108b5f
parent 112b75eb56d98c442094966fe59cbf3cd5feb909
Author: Ember Sawady <ecs@d2evs.net>
Date:   Thu, 15 Jun 2023 18:11:50 +0000

hare::parse::identstr: only parse full ident

in order to avoid eg. parsing "cmd/foo" as the ident "cmd"

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

Diffstat:
Mhare/parse/ident.ha | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hare/parse/ident.ha b/hare/parse/ident.ha @@ -51,5 +51,7 @@ export fn identstr(in: str) (ast::ident | error) = { const buf = bufio::fixed(strings::toutf8(in), io::mode::READ); const lexer = lex::init(&buf, "<string>"); defer lex::finish(&lexer); - return ident(&lexer); + let ret = ident(&lexer); + want(&lexer, ltok::EOF)?; + return ret; };