Skip to content

[fea] Track context when parsing include files#1634

Merged
cmyr merged 1 commit into
mainfrom
fea-parse-context
Sep 16, 2025
Merged

[fea] Track context when parsing include files#1634
cmyr merged 1 commit into
mainfrom
fea-parse-context

Conversation

@cmyr

@cmyr cmyr commented Sep 15, 2025

Copy link
Copy Markdown
Member

Previously we would always parse files (including files referenced via include statements) as if they were standalone FEA. This means that we would only accept statements that were valid at the top-level FEA scope.

Some sources, however, use include statements inside of feature blocks, where additional statements are permitted.

This patch keeps track of the type of the node in which an include statement is encountered, and picks an entry point for parsing that file based on this scope.

Currently we just support 'top level' and 'feature', which unblocks us; we can expand on this as needed.

This fixes another fontc crash.

Previously we would always parse files (including files referenced via
`include` statements) as if they were standalone FEA. This means that we
would only accept statements that were valid at the top-level FEA scope.

Some sources, however, use `include` statements inside of feature
blocks, where additional statements are permitted.

This patch keeps track of the type of the node in which an include
statement is encountered, and picks an entry point for parsing that file
based on this scope.

Currently we just support 'top level' and 'feature', which unblocks us;
we can expand on this as needed.
@cmyr cmyr added this pull request to the merge queue Sep 16, 2025
Merged via the queue into main with commit 8fbd7c2 Sep 16, 2025
12 checks passed
@cmyr cmyr deleted the fea-parse-context branch September 16, 2025 16:39
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.

fea-rs: retain context when parsing include statements

2 participants