Skip to content

Commit 4f71fb0

Browse files
committed
fix(crystal): update reserved words, separate reserved keywords from methods
1 parent 840f769 commit 4f71fb0

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,24 @@ public CrystalClientCodegen() {
134134
hideGenerationTimestamp = Boolean.TRUE;
135135

136136
// reserved word. Ref:
137-
// https://github.com/crystal-lang/crystal/wiki/Crystal-for-Rubyists#available-keywords
137+
// https://crystal-lang.org/reference/1.18/crystal_for_rubyists/index.html#available-keywords
138138
// https://crystal-lang.org/api/1.18.2/Reference.html
139139
reservedWords = new HashSet<>(
140140
Arrays.asList(
141-
"abstract", "annotation", "do", "if", "nil?", "select", "union",
142-
"alias", "else", "in", "of", "self", "unless",
143-
"as", "elsif", "include", "out", "sizeof", "until",
144-
"as?", "end", "instance", "sizeof", "pointerof", "struct", "verbatim",
145-
"asm", "ensure", "is_a?", "private", "super", "when",
146-
"begin", "enum", "lib", "protected", "then", "while",
147-
"break", "extend", "macro", "require", "true", "with",
148-
"case", "false", "module", "rescue", "type", "yield",
149-
"class", "for", "next", "responds_to?", "typeof",
150-
"def", "fun", "nil", "return", "uninitialized", "object_id"));
141+
// language reserved words (keywords)
142+
"abstract", "do", "if", "nil?", "return", "uninitialized",
143+
"alias", "else", "in", "of", "select", "union",
144+
"as", "elsif", "include", "out", "self", "unless",
145+
"as?", "end", "instance_sizeof", "pointerof", "sizeof", "until",
146+
"asm", "ensure", "is_a?", "previous_def", "struct", "verbatim",
147+
"begin", "enum", "lib", "private", "super", "when",
148+
"break", "extend", "macro", "protected", "then", "while",
149+
"case", "false", "module", "require", "true", "with",
150+
"class", "for", "next", "rescue", "type", "yield",
151+
"def", "fun", "nil", "responds_to?", "typeof",
152+
// additional reserved words (methods)
153+
"annotation", "object_id"
154+
));
151155

152156
languageSpecificPrimitives.clear();
153157
languageSpecificPrimitives.add("String");

0 commit comments

Comments
 (0)