Skip to content

Commit

Permalink
Update generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
mjoerussell committed Dec 30, 2024
1 parent b018180 commit b12b4c1
Show file tree
Hide file tree
Showing 259 changed files with 434 additions and 397 deletions.

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

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

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

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

9 changes: 5 additions & 4 deletions crates/metaslang/cst/generated/public_api.txt

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

4 changes: 4 additions & 0 deletions crates/metaslang/cst/src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ impl<T: KindTypes> Cursor<T> {
self.node.clone()
}

pub fn has_open_parent(&self) -> bool {
matches!(self.parent, Parent::Open(_))
}

pub fn label(&self) -> T::EdgeLabel {
if let Some(parent) = self.parent.get_readable() {
let this = &parent.nonterminal_node.children[self.child_number];
Expand Down
3 changes: 3 additions & 0 deletions crates/solidity/outputs/cargo/crate/generated/public_api.txt

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

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use anyhow::Result;
use codegen_language_definition::model::Item;
use inflector::Inflector;
use once_cell::sync::Lazy;
use slang_solidity::cst::{Cursor, Node, NonterminalKind, TextRangeExtensions};
use slang_solidity::cst::{Cursor, KindTypes, Node, NonterminalKind, TextRangeExtensions};
use solidity_language::SolidityDefinition;

pub fn render(source: &str, errors: &Vec<String>, cursor: Cursor) -> Result<String> {
Expand Down Expand Up @@ -132,8 +132,11 @@ fn render_key(cursor: &mut Cursor) -> String {
Node::Terminal(terminal) => terminal.kind.to_string(),
};

if let Some(label) = cursor.label() {
format!("({label}꞉ {kind})", label = label.as_ref().to_snake_case())
if cursor.has_open_parent() {
format!(
"({label}꞉ {kind})",
label = cursor.label().as_ref().to_snake_case()
)
} else {
format!("({kind})")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use infra_utils::paths::PathExtensions;
fn using_the_cursor() -> Result<()> {
// --8<-- [start:imports]
use semver::Version;
use slang_solidity::cst::{EdgeLabel, NonterminalKind, TerminalKind, TextRangeExtensions};
use slang_solidity::cst::{NonterminalKind, TerminalKind, TextRangeExtensions};
use slang_solidity::parser::Parser;
// --8<-- [end:imports]

Expand Down Expand Up @@ -108,7 +108,6 @@ fn using_the_cursor() -> Result<()> {
.tree()
.clone()
.descendants()
.filter(|edge| edge.label == Some(EdgeLabel::Name))
.filter(|edge| edge.is_terminal_with_kind(TerminalKind::Identifier))
.map(|identifier| identifier.unparse())
.collect();
Expand Down

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

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Tree:
- (item꞉ Identifier): "a" # (101..102)
- (separator꞉ Period): "." # (102..103)
- (item꞉ Identifier): "b" # (103..104)
- (UNRECOGNIZED): "('\n }')" # (104..118)
- (root꞉ UNRECOGNIZED): "('\n }')" # (104..118)
- (semicolon꞉ Semicolon): ";" # (118..119)
- (trailing_trivia꞉ EndOfLine): "\n" # (119..120)
- (close_brace꞉ CloseBrace): "}" # (120..121)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Tree:
- (item꞉ Identifier): "a" # (101..102)
- (separator꞉ Period): "." # (102..103)
- (item꞉ Identifier): "b" # (103..104)
- (UNRECOGNIZED): "('\n }')" # (104..118)
- (root꞉ UNRECOGNIZED): "('\n }')" # (104..118)
- (semicolon꞉ Semicolon): ";" # (118..119)
- (trailing_trivia꞉ EndOfLine): "\n" # (119..120)
- (close_brace꞉ CloseBrace): "}" # (120..121)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ Tree:
- (leading_trivia꞉ Whitespace): " " # (1..2)
- (item꞉ Identifier): "unchecked" # (2..11)
- (leading_trivia꞉ Whitespace): " " # (11..12)
- (UNRECOGNIZED): "{ x = 1; } " # (12..23)
- (root꞉ UNRECOGNIZED): "{ x = 1; } " # (12..23)
- (close_brace꞉ CloseBrace): "}" # (23..24)
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Tree:
- (open_brace꞉ OpenBrace): "{" # (0..1)
- (statements꞉ Statements): [] # (1..1)
- (leading_trivia꞉ Whitespace): " " # (1..2)
- (UNRECOGNIZED): "unchecked { x = 1; } " # (2..23)
- (root꞉ UNRECOGNIZED): "unchecked { x = 1; } " # (2..23)
- (close_brace꞉ CloseBrace): "}" # (23..24)
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Tree:
- (open_brace꞉ OpenBrace): "{" # (0..1)
- (statements꞉ Statements): [] # (1..1)
- (leading_trivia꞉ Whitespace): " " # (1..2)
- (UNRECOGNIZED): "unchecked { x = 1; } " # (2..23)
- (root꞉ UNRECOGNIZED): "unchecked { x = 1; } " # (2..23)
- (close_brace꞉ CloseBrace): "}" # (23..24)
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Tree:
- (open_brace꞉ OpenBrace): "{" # (0..1)
- (statements꞉ Statements): [] # (1..1)
- (leading_trivia꞉ Whitespace): " " # (1..2)
- (UNRECOGNIZED): "unchecked { x = 1; } " # (2..23)
- (root꞉ UNRECOGNIZED): "unchecked { x = 1; } " # (2..23)
- (close_brace꞉ CloseBrace): "}" # (23..24)
Loading

0 comments on commit b12b4c1

Please sign in to comment.