Skip to content

Commit

Permalink
refactor: Use collect_breaking_versions from v2 directly in PG (Nomic…
Browse files Browse the repository at this point in the history
…Foundation#1002)

Part of NomicFoundation#638 

Follow-up to NomicFoundation#991

Pretty straightforward: instead of visiting the previously built v1
definition structure, we defer to `Language::collect_breaking_changes`
as the definitions overlap - the breaking changes are defined as
versions in which the syntax items may be evaluated differently, which
means that these are exactly the versions that will be referenced for
the conditional syntax item evaluation in the parser/lexer.
  • Loading branch information
Xanewok authored and OmarTawfik committed Aug 5, 2024
1 parent 12e0c18 commit 025037a
Show file tree
Hide file tree
Showing 67 changed files with 18,453 additions and 117 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"editor.rulers": [120],
"files.associations": {
"**/documentation/overrides/**/*.html": "jinja-html",
"*.ts.jinja2": "jinja-js" // until this is merged: https://github.com/samuelcolvin/jinjahtml-vscode/pull/148
"*.ts.jinja2": "jinja-js", // until this is merged: https://github.com/samuelcolvin/jinjahtml-vscode/pull/148
"*.wit.jinja2": "jinja" // until this is merged: https://github.com/samuelcolvin/jinjahtml-vscode/pull/148
},
"editor.unicodeHighlight.allowedCharacters": {
"꞉": true // used in CST snapshot tests
Expand Down
176 changes: 174 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ napi-derive = { version = "2.16.5" }
nom = { version = "7.1.3" }
num-format = { version = "0.4.4" }
once_cell = { version = "1.19.0" }
paste = { version = "1.0.15" }
proc-macro2 = { version = "1.0.84" }
quote = { version = "1.0.36" }
rayon = { version = "1.10.0" }
Expand Down Expand Up @@ -134,6 +135,8 @@ thiserror = { version = "1.0.61" }
trybuild = { version = "1.0.96" }
toml = { version = "0.8.13" }
url = { version = "2.3.1" }
wit-bindgen = { version = "0.26.0" }
wit-bindgen-cli = { version = "0.26.0" }

[workspace.lints.rust]
unused_crate_dependencies = "warn"
Expand Down
1 change: 0 additions & 1 deletion crates/codegen/ebnf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ codegen_language_definition = { workspace = true }
derive-new = { workspace = true }
indexmap = { workspace = true }
Inflector = { workspace = true }
strum_macros = { workspace = true }

[lints]
workspace = true
Expand Down
19 changes: 2 additions & 17 deletions crates/codegen/ebnf/src/builder.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::collections::HashMap;

use codegen_language_definition::model::{
EnumItem, EnumVariant, Field, FragmentItem, Identifier, Item, KeywordDefinition, KeywordItem,
KeywordValue, Language, OperatorModel, PrecedenceExpression, PrecedenceItem,
BuiltInLabel, EnumItem, EnumVariant, Field, FragmentItem, Identifier, Item, KeywordDefinition,
KeywordItem, KeywordValue, Language, OperatorModel, PrecedenceExpression, PrecedenceItem,
PrecedenceOperator, PrimaryExpression, RepeatedItem, Scanner, SeparatedItem, StructItem,
TokenDefinition, TokenItem, TriviaItem, VersionSpecifier,
};
Expand All @@ -11,21 +11,6 @@ use inflector::Inflector;

use crate::model::{Definition, DefinitionKind, Entry, Expression, Value};

#[allow(dead_code)]
#[derive(strum_macros::AsRefStr)]
#[strum(serialize_all = "snake_case")]
enum BuiltInLabel {
// _SLANG_INTERNAL_RESERVED_NODE_LABELS_ (keep in sync)
Item,
Variant,
Separator,
Operand,
LeftOperand,
RightOperand,
LeadingTrivia,
TrailingTrivia,
}

pub struct Builder {
section_index: usize,
topic_index: usize,
Expand Down
1 change: 1 addition & 0 deletions crates/codegen/language/definition/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ proc-macro2 = { workspace = true }
quote = { workspace = true }
semver = { workspace = true }
serde = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
syn = { workspace = true }
thiserror = { workspace = true }
Expand Down
Loading

0 comments on commit 025037a

Please sign in to comment.