File tree Expand file tree Collapse file tree 6 files changed +18
-19
lines changed
wasm/src/runtime/interface
generator/src/parser/codegen Expand file tree Collapse file tree 6 files changed +18
-19
lines changed Original file line number Diff line number Diff line change 7474 let variant = helper.accept_label(EdgeLabel::Variant)?;
7575 let item = match variant.kind() {
7676 {% for type in choice .nonterminal_types -%}
77- NodeKind::Nonterminal(NonterminalKind::{{ type }}) => {{ parent_type }}::{{ type | pascal_case }}(build_{{ type | snake_case }}(nonterminal_node(variant))?),
77+ NodeKind::Nonterminal(NonterminalKind::{{ type }}) => {{ parent_type }}::{{ type }}(build_{{ type | snake_case }}(nonterminal_node(variant))?),
7878 {% - endfor -%}
7979
8080 {% for type in choice .non_unique_terminal_types -%}
8181 NodeKind::Terminal(TerminalKind::{{ type }}) => {
82- {{ parent_type }}::{{ type | pascal_case }}(terminal_node_cloned(variant))
82+ {{ parent_type }}::{{ type }}(terminal_node_cloned(variant))
8383 },
8484 {% - endfor -%}
8585
8686 {% for type in choice .unique_terminal_types -%}
8787 NodeKind::Terminal(TerminalKind::{{ type }}) => {
88- {{ parent_type }}::{{ type | pascal_case }}
88+ {{ parent_type }}::{{ type }}
8989 },
9090 {% - endfor -%}
9191
Original file line number Diff line number Diff line change 2626 {% - endif -%}
2727 {% - else -%}
2828 {% - if field .is_optional -%}
29- Option<{{ field.type | pascal_case }}>,
29+ Option<{{ field.type }}>,
3030 {% - else -%}
31- {{ field.type | pascal_case }},
31+ {{ field.type }},
3232 {% - endif -%}
3333 {% - endif -%}
3434 {% endfor -%}
4444 #[derive(Debug)]
4545 pub enum {{ parent_type }} {
4646 {% for nonterminal in choice .nonterminal_types -%}
47- {{ nonterminal }}({{ nonterminal | pascal_case }}),
47+ {{ nonterminal }}({{ nonterminal }}),
4848 {% - endfor -%}
4949 {% for terminal in choice .non_unique_terminal_types -%}
5050 {{ terminal }}(Rc<TerminalNode >),
6464 {% - if collection .is_terminal -%}
6565 Rc<TerminalNode >
6666 {% - else -%}
67- {{ collection.item_type | pascal_case }}
67+ {{ collection.item_type }}
6868 {% - endif -%}
6969 >;
7070 {% endfor %}
Original file line number Diff line number Diff line change @@ -24,14 +24,14 @@ pub enum NonterminalKind {
2424 Stub3,
2525 {% - else -%}
2626 {% - for variant in model .kinds .nonterminal_kinds -%}
27- /// Represents a node with kind `{{ variant.id | pascal_case }}`, having the following structure:
27+ /// Represents a node with kind `{{ variant.id }}`, having the following structure:
2828 ///
2929 /// ```ebnf
3030 {% - for line in variant .documentation | split (pat ="\n" ) %}
3131 /// {{ line }}
3232 {% - endfor %}
3333 /// ```
34- {{ variant.id | pascal_case }},
34+ {{ variant.id }},
3535 {% - endfor -%}
3636 {% - endif -%}
3737}
Original file line number Diff line number Diff line change @@ -31,14 +31,14 @@ pub enum TerminalKind {
3131 Stub3,
3232 {% - else -%}
3333 {% - for variant in model .kinds .terminal_kinds -%}
34- /// Represents a node with kind `{{ variant.id | pascal_case }}`, having the following structure:
34+ /// Represents a node with kind `{{ variant.id }}`, having the following structure:
3535 ///
3636 /// ```ebnf
3737 {% - for line in variant .documentation | split (pat ="\n" ) %}
3838 /// {{ line }}
3939 {% - endfor %}
4040 /// ```
41- {{ variant.id | pascal_case }},
41+ {{ variant.id }},
4242 {% - endfor -%}
4343 {% - endif -%}
4444}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ interface cst {
1111 stub3,
1212 {% - else %}
1313 {% - for variant in model .kinds .nonterminal_kinds %}
14- /// Represents a node with kind `{{ variant.id | pascal_case }}`, having the following structure:
14+ /// Represents a node with kind `{{ variant.id }}`, having the following structure:
1515 ///
1616 /// ```ebnf
1717 {% - for line in variant .documentation | split (pat ="\n" ) %}
@@ -42,7 +42,7 @@ interface cst {
4242 stub3,
4343 {% - else %}
4444 {% - for variant in model .kinds .terminal_kinds %}
45- /// Represents a node with kind `{{ variant.id | pascal_case }}`, having the following structure:
45+ /// Represents a node with kind `{{ variant.id }}`, having the following structure:
4646 ///
4747 /// ```ebnf
4848 {% - for line in variant .documentation | split (pat ="\n" ) %}
Original file line number Diff line number Diff line change @@ -20,21 +20,20 @@ pub trait PrecedenceParserDefinitionCodegen {
2020
2121impl PrecedenceParserDefinitionCodegen for PrecedenceParserDefinitionRef {
2222 fn to_parser_code ( & self ) -> TokenStream {
23- let code = self . node ( ) . to_parser_code (
24- self . context ( ) ,
25- format_ident ! ( "{name}" , name = self . name( ) . to_pascal_case( ) ) ,
26- ) ;
23+ let code = self
24+ . node ( )
25+ . to_parser_code ( self . context ( ) , format_ident ! ( "{}" , self . name( ) ) ) ;
2726
2827 let nonterminal_kind = format_ident ! ( "{}" , self . name( ) ) ;
2928 quote ! { #code. with_kind( NonterminalKind :: #nonterminal_kind) }
3029 }
3130
3231 fn to_precedence_expression_parser_code ( & self ) -> Vec < ( Identifier , TokenStream ) > {
3332 let parser_name = format_ident ! ( "{}" , self . name( ) . to_snake_case( ) ) ;
34- let nonterminal_name = format_ident ! ( "{}" , self . name( ) . to_pascal_case ( ) ) ;
33+ let nonterminal_name = format_ident ! ( "{}" , self . name( ) ) ;
3534
3635 self . node ( ) . precedence_expression_names . iter ( ) . map ( |name| {
37- let op_nonterminal_name = format_ident ! ( "{}" , name . to_pascal_case ( ) ) ;
36+ let op_nonterminal_name = format_ident ! ( "{name}" ) ;
3837
3938 // Ensure that the parser correctly identifies a single node of the expected type,
4039 // which contains a single child node representing the expected precedence operator.
You can’t perform that action at this time.
0 commit comments