diff --git a/lib/rivet/src/ast/comptime.ri b/lib/rivet/src/ast/comptime.ri index 06aa85422..828846a54 100644 --- a/lib/rivet/src/ast/comptime.ri +++ b/lib/rivet/src/ast/comptime.ri @@ -4,8 +4,7 @@ import std/sys; -import ../token; -import ../report; +import ../{ token, report }; pub struct ComptimeIf { mut branches: []mut ComptimeIfBranch; diff --git a/lib/rivet/src/parser/import.ri b/lib/rivet/src/parser/import.ri index 2937f01ae..ec95714c4 100644 --- a/lib/rivet/src/parser/import.ri +++ b/lib/rivet/src/parser/import.ri @@ -67,13 +67,20 @@ extend Parser { mut sb := strings.Builder.new(); if self.accept(.Dot) { sb.write_string("./"); - self.expect(.Div); + if self.peek_tok.kind != .Lbrace { + self.expect(.Div); + } } else { while self.accept(.DotDot) { sb.write_string("../"); - self.expect(.Div); + if self.peek_tok.kind != .Lbrace { + self.expect(.Div); + } } } + if self.tok.kind == .Div && self.peek_tok.kind == .Lbrace { + return sb.to_string(); + } sb.write_string(self.parse_name()); while self.tok.kind == .Div && self.peek_tok.kind != .Lbrace { self.expect(.Div); diff --git a/rivetc/src/parser.py b/rivetc/src/parser.py index 9d9457365..253d29f5c 100644 --- a/rivetc/src/parser.py +++ b/rivetc/src/parser.py @@ -523,11 +523,15 @@ def parse_import_path(self): res = "" if self.accept(Kind.Dot): res += "./" - self.expect(Kind.Div) + if self.peek_tok.kind != Kind.Lbrace: + self.expect(Kind.Div) else: while self.accept(Kind.DotDot): res += "../" - self.expect(Kind.Div) + if self.peek_tok.kind != Kind.Lbrace: + self.expect(Kind.Div) + if self.tok.kind == Kind.Div and self.peek_tok.kind == Kind.Lbrace: + return res res += self.parse_name() while self.tok.kind == Kind.Div and self.peek_tok.kind != Kind.Lbrace: self.next()