Skip to content

Commit

Permalink
Merge pull request #18190 from github/redsun82/rust-array-expr
Browse files Browse the repository at this point in the history
Rust: distinguish `[a, b]` from `[a; b]`
  • Loading branch information
redsun82 authored Dec 4, 2024
2 parents 06b1d8e + 277c9f4 commit 4bf7bbb
Show file tree
Hide file tree
Showing 53 changed files with 767 additions and 149 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ repos:

- id: rust-codegen
name: Run Rust checked in code generation
files: ^misc/codegen/|^rust/(schema.py$|codegen/|.*/generated/|ql/lib/(rust\.dbscheme$|codeql/rust/elements)|\.generated.list)
files: ^misc/codegen/|^rust/(prefix\.dbscheme|schema/|codegen/|.*/generated/|ql/lib/(rust\.dbscheme$|codeql/rust/elements)|\.generated.list)
language: system
entry: bazel run //rust/codegen -- --quiet
pass_filenames: false
Expand Down
8 changes: 8 additions & 0 deletions rust/ast-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fn class_name(type_name: &str) -> String {
"Fn" => "Function",
"Literal" => "LiteralExpr",
"Type" => "TypeRef",
"ArrayExpr" => "ArrayExprInternal",
_ => type_name,
};
name.to_owned()
Expand Down Expand Up @@ -354,6 +355,13 @@ fn get_fields(node: &AstNodeSrc) -> Vec<FieldInfo> {
is_many: false,
});
}
"ArrayExpr" => {
result.push(FieldInfo {
name: "is_semicolon".to_string(),
tp: "predicate".to_string(),
is_many: false,
});
}
_ => {}
}

Expand Down
2 changes: 1 addition & 1 deletion rust/extractor/src/generated/.generated.list

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

44 changes: 24 additions & 20 deletions rust/extractor/src/generated/top.rs

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

8 changes: 5 additions & 3 deletions rust/extractor/src/translate/generated.rs

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

Loading

0 comments on commit 4bf7bbb

Please sign in to comment.