summaryrefslogtreecommitdiff
path: root/crates/typst-syntax/src/parser.rs
diff options
context:
space:
mode:
authorTulio Martins <113527485+tulio240@users.noreply.github.com>2024-05-30 04:56:40 -0300
committerGitHub <noreply@github.com>2024-05-30 07:56:40 +0000
commit06a925a0ee0e1e7b93428d8b4952512a2e48ed79 (patch)
tree02725b8b534eff798ba96949073edc6766f45fa6 /crates/typst-syntax/src/parser.rs
parent5f6d942519b36eb839a0a11e4ef3f1ea4013a8b5 (diff)
Add nested import syntax (#4228)
Co-authored-by: LuizAugustoPapa <luiz.papa@aluno.puc-rio.br> Co-authored-by: PepinhoJp <pepinho.jp@gmail.com> Co-authored-by: PgBiel <9021226+PgBiel@users.noreply.github.com>
Diffstat (limited to 'crates/typst-syntax/src/parser.rs')
-rw-r--r--crates/typst-syntax/src/parser.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/typst-syntax/src/parser.rs b/crates/typst-syntax/src/parser.rs
index d8ac1198..d341bca2 100644
--- a/crates/typst-syntax/src/parser.rs
+++ b/crates/typst-syntax/src/parser.rs
@@ -1003,6 +1003,13 @@ fn import_items(p: &mut Parser) {
p.unexpected();
}
+ // Nested import path: `a.b.c`
+ while p.eat_if(SyntaxKind::Dot) {
+ p.expect(SyntaxKind::Ident);
+ }
+
+ p.wrap(item_marker, SyntaxKind::ImportItemPath);
+
// Rename imported item.
if p.eat_if(SyntaxKind::As) {
p.expect(SyntaxKind::Ident);