Skip to content

Add nested import syntax#4228

Merged
laurmaedje merged 10 commits intotypst:mainfrom
tulio240:nested-imports
May 30, 2024
Merged

Add nested import syntax#4228
laurmaedje merged 10 commits intotypst:mainfrom
tulio240:nested-imports

Conversation

@tulio240
Copy link
Copy Markdown
Contributor

Closes #2148

PR co-authored by @PgBiel, @LuizAugustoPapa, @PepinhoJp

Adds the syntax below to import names from submodules more easily (supports any amount of submodule nesting):

#import "@preview/cetz:0.2.2": draw.rect
#import std: array.zip as azip

// that's almost equivalent to
// (but without creating the 'draw' and 'array' variables)

#import "@preview/cetz:0.2.2": draw
#import std: array

#let rect = draw.rect
#let azip = array.zip

laurmaedje added a commit that referenced this pull request May 29, 2024
This moves the special tokens and comments up because comments are used in the SyntaxSet, which can only hold kinds with discriminator <= 127. This gives us some breathing room to introduce new SyntaxKinds, as in #4228.
@laurmaedje laurmaedje mentioned this pull request May 29, 2024
@laurmaedje laurmaedje added this pull request to the merge queue May 30, 2024
@laurmaedje
Copy link
Copy Markdown
Member

Thank you all!

Merged via the queue into typst:main with commit 06a925a May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convenient syntax for nested import

5 participants