File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,8 +115,19 @@ pub fn generate(
115115 & node_parent_table_name,
116116 ) ) ,
117117 ql:: TopLevel :: Class ( ql_gen:: create_token_class( & token_name, & tokeninfo_name) ) ,
118- ql:: TopLevel :: Class ( ql_gen:: create_reserved_word_class( & reserved_word_name) ) ,
119118 ] ;
119+ // Only emit the ReservedWord class when there are actually unnamed token
120+ // types in the schema (i.e., @{prefix}_reserved_word exists in the dbscheme).
121+ // When converting from a YEAST YAML schema that has no unnamed tokens, this
122+ // type is absent and referencing it would cause a QL compilation error.
123+ let has_reserved_words = nodes
124+ . values ( )
125+ . any ( |n| n. dbscheme_name == reserved_word_name) ;
126+ if has_reserved_words {
127+ body. push ( ql:: TopLevel :: Class ( ql_gen:: create_reserved_word_class (
128+ & reserved_word_name,
129+ ) ) ) ;
130+ }
120131
121132 // Overlay discard predicates
122133 body. push ( ql:: TopLevel :: Predicate (
You can’t perform that action at this time.
0 commit comments