commit f70dfa471cd3c2529e3b20bb7bb01e185c092837
parent d93249d007ec19ff0e3a549ada735992edcf4272
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 28 Oct 2023 02:34:28 -0400
hare::parse: export ident_trailing
Since identifiers referring to modules will have a trailing :: in some
places, it makes sense to export this.
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hare/parse/ident.ha b/hare/parse/ident.ha
@@ -9,7 +9,9 @@ use memio;
use strings;
use types;
-fn ident_trailing(lexer: *lex::lexer) ((ast::ident, bool) | error) = {
+// Parses a single identifier, possibly with a trailing ::, i.e. 'foo::bar::'.
+// Returns the identifier and whether there's a trailing ::.
+export fn ident_trailing(lexer: *lex::lexer) ((ast::ident, bool) | error) = {
let ident: []str = [];
let trailing = false;
const tok = want(lexer, ltok::NAME)?;