Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
thiagoelg merged PR #3397: URL: https://github.com/apache/incubator-kie-tools/pull/3397 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2813695977
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
+["abs", BuiltInTypes.Number],
+["after", BuiltInTypes.Boolean],
+["all", BuiltInTypes.Boolean],
+["any", BuiltInTypes.Boolean],
+["append", BuiltInTypes.List],
+["before", BuiltInTypes.Boolean],
+["ceiling", BuiltInTypes.Number],
+["code", BuiltInTypes.Number],
+["coincides", BuiltInTypes.Boolean],
+["concatenate", BuiltInTypes.String],
+["contains", BuiltInTypes.Boolean],
+["context", BuiltInTypes.Context],
+["context put", BuiltInTypes.Context],
+["context merge", BuiltInTypes.Context],
+["count", BuiltInTypes.Number],
+["date", BuiltInTypes.Date],
+["date and time", BuiltInTypes.DateAndTime],
+["day of week", BuiltInTypes.String],
+["day of year", BuiltInTypes.Number],
+["decimal", BuiltInTypes.Number],
+["decision table", BuiltInTypes.Any],
+["distinct values", BuiltInTypes.List],
+["duration", BuiltInTypes.DaysAndTimeDuration],
Review Comment:
https://github.com/apache/incubator-kie-issues/issues/2250
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
jomarko commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2811197656
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
Review Comment:
I double checked:
- packages/feel-input-component/src/FeelConfigs.ts
- packages/feel-input-component/src/i18n/locales/en.ts
- packages/dmn-feel-antlr4-parser/src/parser/ReservedWords.ts
- packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts
it seems that first two listed files does not contain description for two
functions:
- `decision table`
- `invoke`
### decision table
Is so complex with the amount of parameters, that I am actually not sure how
the description should look like
### invoke
is marked as deprecated in
https://kiegroup.github.io/dmn-feel-handbook/#invoke-namespace-modelname-decisionname-parameters
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2805740828
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
Review Comment:
About the issue with "date and time" and "date", your expectation is
correct, but this is not an issue related to this PR. Can you create a new
ticket for it? @jomarko
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2805720565
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
Review Comment:
I just get the types from
[here](https://github.com/apache/incubator-kie-tools/blob/cae1c6fe2d21f8e37bb255ac1bc7d1bace4ea753/packages/dmn-feel-antlr4-parser/src/parser/ReservedWords.ts#L43)
and moved to another class adding the returning type. If we have anything that
was not being handled before, it is not the focus of this PR and we should
create a proper ticket for that, @jomarko
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
jomarko commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2773006805
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
Review Comment:
Are we sure we define return type for each DMN function? The list of dmn
functions in this file
Comparing the count of functions with
/home/jomarko/apache/kie-tools/packages/feel-input-component/src/i18n/locales/en.ts
seems to have more entries. That is reason for my question.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
ljmotta commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2768937255
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
+["abs", BuiltInTypes.Number],
+["after", BuiltInTypes.Boolean],
+["all", BuiltInTypes.Boolean],
+["any", BuiltInTypes.Boolean],
+["append", BuiltInTypes.List],
+["before", BuiltInTypes.Boolean],
+["ceiling", BuiltInTypes.Number],
+["code", BuiltInTypes.Number],
+["coincides", BuiltInTypes.Boolean],
+["concatenate", BuiltInTypes.String],
+["contains", BuiltInTypes.Boolean],
+["context", BuiltInTypes.Context],
+["context put", BuiltInTypes.Context],
+["context merge", BuiltInTypes.Context],
+["count", BuiltInTypes.Number],
+["date", BuiltInTypes.Date],
+["date and time", BuiltInTypes.DateAndTime],
+["day of week", BuiltInTypes.String],
+["day of year", BuiltInTypes.Number],
+["decimal", BuiltInTypes.Number],
+["decision table", BuiltInTypes.Any],
+["distinct values", BuiltInTypes.List],
+["duration", BuiltInTypes.DaysAndTimeDuration],
Review Comment:
Oh, okay. Could you please create a new issue to track this work? Also it
would be good to add a comment to this specific line with the issue link. For
now, I think it is okay to keep it `DaysAndTimeDuration`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
thiagoelg commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2766143256
##
packages/dmn-feel-antlr4-parser/src/parser/grammar/visitor/FeelVisitorImpl.ts:
##
@@ -0,0 +1,299 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import FEEL_1_1Visitor from "../generated-parser/FEEL_1_1Visitor";
+import {
+ AddExpressionContext,
+ FilterPathExpressionContext,
+ FnInvocationContext,
+ NameRefContext,
+ ParametersEmptyContext,
+ ParametersNamedContext,
+ ParametersPositionalContext,
+ PrimaryParensContext,
+ QualifiedNameContext,
+ UenpmPrimaryContext,
+} from "../generated-parser/FEEL_1_1Parser";
+import { SemanticToken } from "./SemanticToken";
+import { ParserRuleContext, ParseTree, TerminalNode } from "antlr4";
+import { FeelFunctionReturningTypes } from "../../FeelFunctionReturningTypes";
+import { FeelSyntacticSymbolNature } from "../../FeelSyntacticSymbolNature";
+import { VisitorResult } from "./VisitorResult";
+import { BuiltInTypes } from "../../BuiltInTypes";
+import { DataType } from "../../DataType";
+import FEEL_1_1Lexer from "../generated-parser/FEEL_1_1Lexer";
+
+export class FeelVisitorImpl extends FEEL_1_1Visitor {
+ private readonly handlers: Map VisitorResult>;
+ private readonly _semanticTokens: Array;
+ private readonly _normalizedFeelFunctionReturningTypes: ReadonlyMap;
+
+ public constructor() {
+super();
+this._semanticTokens = new Array();
+this.handlers = new Map VisitorResult>([
+ [FilterPathExpressionContext, this.visitFilterPathExpression.bind(this)],
+ [FnInvocationContext, this.visitFnInvocation.bind(this)],
+ [NameRefContext, this.visitNameRef.bind(this)],
+ [AddExpressionContext, this.visitAddExpression.bind(this)],
+ [PrimaryParensContext, this.visitPrimaryParens.bind(this)],
+ [UenpmPrimaryContext, this.visitUenpmPrimary.bind(this)],
+]);
+
+this._normalizedFeelFunctionReturningTypes = new Map(
+ Array.from(FeelFunctionReturningTypes.Index, ([key, value]) =>
[key.replaceAll(" ", ""), value])
+);
+ }
+
+ private getSpecializedHandlerIfPresent(tree: ParseTree) {
+for (const [klass, handler] of this.handlers) {
+ if (tree instanceof klass) {
+return handler;
+ }
+}
+ }
+
+ get semanticTokens(): Array {
+return this._semanticTokens;
+ }
+
+ private resolveNames(nameContext: QualifiedNameContext | NameRefContext) {
+const resolvedNames: VisitorResult[] = [];
+if (!nameContext.children) {
+ return resolvedNames;
+}
+
+for (let i = 0; i < nameContext.children.length; i++) {
+ const child = nameContext.getChild(i);
+ if (child instanceof NameRefContext || child instanceof
QualifiedNameContext) {
+resolvedNames.push(...this.resolveNames(child));
+ } else {
+resolvedNames.push(this.visit(child));
+ }
+}
+
+return resolvedNames;
+ }
+
+ public override visit = (tree: ParseTree) => {
+// If there is a specialized handler for that kind of node, we use it,
because it will know how to handle it.
+// Otherwise, we just go through they children.
+const specializedHandler = this.getSpecializedHandlerIfPresent(tree);
+if (specializedHandler) {
+ return specializedHandler(tree);
+} else if (tree instanceof ParserRuleContext) {
+ return this.visitChildren(tree);
+} else if (tree instanceof TerminalNode) {
+ return new VisitorResult({ text: tree.getText(), dataType:
this.getBuiltInTypeFromNodeType(tree.symbol.type) });
+}
+return undefined!;
+ };
+
+ public override visitChildren(ctx: ParserRuleContext) {
+if (!ctx.children) {
+ return undefined!;
+}
+
+const result = new Array();
+const count = ctx.children?.length ?? 0;
+for (let i = 0; i < count; i++) {
+ result.push(this.visit(ctx.children[i])!);
+}
+
+// In case of multiple children, probably we need a specialized handler to
deal with,
+// but we are not doing that now because is one of the cases that we don't
+// use in the autocomplete or colorize.
+return result[0];
+ }
+
+ public override visitUenpmPrimary = (ctx: UenpmPrimaryC
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2765592705
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -110,16 +110,16 @@ export class FeelFunctionReturningTypes {
["string", BuiltInTypes.String],
["string join", BuiltInTypes.String],
["string length", BuiltInTypes.Number],
-["subList", BuiltInTypes.List],
-["subString after", BuiltInTypes.String],
-["subString before", BuiltInTypes.String],
-["subString", BuiltInTypes.String],
+["sublist", BuiltInTypes.List],
+["substring after", BuiltInTypes.String],
+["substring before", BuiltInTypes.String],
+["substring", BuiltInTypes.String],
["sum", BuiltInTypes.Number],
["time", BuiltInTypes.Time],
["today", BuiltInTypes.Date],
["union", BuiltInTypes.List],
["upper case", BuiltInTypes.String],
["week of year", BuiltInTypes.Number],
-["years and months duration", BuiltInTypes.YearsAndMonthsDuration],
+["years and months duration", BuiltInTypes.Any],
Review Comment:
Probably I drink too much coffee. Fixed now! 😆
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2765592705
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -110,16 +110,16 @@ export class FeelFunctionReturningTypes {
["string", BuiltInTypes.String],
["string join", BuiltInTypes.String],
["string length", BuiltInTypes.Number],
-["subList", BuiltInTypes.List],
-["subString after", BuiltInTypes.String],
-["subString before", BuiltInTypes.String],
-["subString", BuiltInTypes.String],
+["sublist", BuiltInTypes.List],
+["substring after", BuiltInTypes.String],
+["substring before", BuiltInTypes.String],
+["substring", BuiltInTypes.String],
["sum", BuiltInTypes.Number],
["time", BuiltInTypes.Time],
["today", BuiltInTypes.Date],
["union", BuiltInTypes.List],
["upper case", BuiltInTypes.String],
["week of year", BuiltInTypes.Number],
-["years and months duration", BuiltInTypes.YearsAndMonthsDuration],
+["years and months duration", BuiltInTypes.Any],
Review Comment:
Probably I drink too much coffee.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2765590681
##
packages/dmn-feel-antlr4-parser/src/parser/grammar/visitor/FeelVisitorImpl.ts:
##
@@ -0,0 +1,299 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import FEEL_1_1Visitor from "../generated-parser/FEEL_1_1Visitor";
+import {
+ AddExpressionContext,
+ FilterPathExpressionContext,
+ FnInvocationContext,
+ NameRefContext,
+ ParametersEmptyContext,
+ ParametersNamedContext,
+ ParametersPositionalContext,
+ PrimaryParensContext,
+ QualifiedNameContext,
+ UenpmPrimaryContext,
+} from "../generated-parser/FEEL_1_1Parser";
+import { SemanticToken } from "./SemanticToken";
+import { ParserRuleContext, ParseTree, TerminalNode } from "antlr4";
+import { FeelFunctionReturningTypes } from "../../FeelFunctionReturningTypes";
+import { FeelSyntacticSymbolNature } from "../../FeelSyntacticSymbolNature";
+import { VisitorResult } from "./VisitorResult";
+import { BuiltInTypes } from "../../BuiltInTypes";
+import { DataType } from "../../DataType";
+import FEEL_1_1Lexer from "../generated-parser/FEEL_1_1Lexer";
+
+export class FeelVisitorImpl extends FEEL_1_1Visitor {
+ private readonly handlers: Map VisitorResult>;
+ private readonly _semanticTokens: Array;
+ private readonly _normalizedFeelFunctionReturningTypes: ReadonlyMap;
+
+ public constructor() {
+super();
+this._semanticTokens = new Array();
+this.handlers = new Map VisitorResult>([
+ [FilterPathExpressionContext, this.visitFilterPathExpression.bind(this)],
+ [FnInvocationContext, this.visitFnInvocation.bind(this)],
+ [NameRefContext, this.visitNameRef.bind(this)],
+ [AddExpressionContext, this.visitAddExpression.bind(this)],
+ [PrimaryParensContext, this.visitPrimaryParens.bind(this)],
+ [UenpmPrimaryContext, this.visitUenpmPrimary.bind(this)],
+]);
+
+this._normalizedFeelFunctionReturningTypes = new Map(
+ Array.from(FeelFunctionReturningTypes.Index, ([key, value]) =>
[key.replaceAll(" ", ""), value])
+);
+ }
+
+ private getSpecializedHandlerIfPresent(tree: ParseTree) {
+for (const [klass, handler] of this.handlers) {
+ if (tree instanceof klass) {
+return handler;
+ }
+}
+ }
+
+ get semanticTokens(): Array {
+return this._semanticTokens;
+ }
+
+ private resolveNames(nameContext: QualifiedNameContext | NameRefContext) {
+const resolvedNames: VisitorResult[] = [];
+if (!nameContext.children) {
+ return resolvedNames;
+}
+
+for (let i = 0; i < nameContext.children.length; i++) {
+ const child = nameContext.getChild(i);
+ if (child instanceof NameRefContext || child instanceof
QualifiedNameContext) {
+resolvedNames.push(...this.resolveNames(child));
+ } else {
+resolvedNames.push(this.visit(child));
+ }
+}
+
+return resolvedNames;
+ }
+
+ public override visit = (tree: ParseTree) => {
+// If there is a specialized handler for that kind of node, we use it,
because it will know how to handle it.
+// Otherwise, we just go through they children.
+const specializedHandler = this.getSpecializedHandlerIfPresent(tree);
+if (specializedHandler) {
+ return specializedHandler(tree);
+} else if (tree instanceof ParserRuleContext) {
+ return this.visitChildren(tree);
+} else if (tree instanceof TerminalNode) {
+ return new VisitorResult({ text: tree.getText(), dataType:
this.getBuiltInTypeFromNodeType(tree.symbol.type) });
+}
+return undefined!;
+ };
+
+ public override visitChildren(ctx: ParserRuleContext) {
+if (!ctx.children) {
+ return undefined!;
+}
+
+const result = new Array();
+const count = ctx.children?.length ?? 0;
+for (let i = 0; i < count; i++) {
+ result.push(this.visit(ctx.children[i])!);
+}
+
+// In case of multiple children, probably we need a specialized handler to
deal with,
+// but we are not doing that now because is one of the cases that we don't
+// use in the autocomplete or colorize.
+return result[0];
+ }
+
+ public override visitUenpmPrimary = (ctx: UenpmPrimaryC
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2765526592
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
+["abs", BuiltInTypes.Number],
+["after", BuiltInTypes.Boolean],
+["all", BuiltInTypes.Boolean],
+["any", BuiltInTypes.Boolean],
+["append", BuiltInTypes.List],
+["before", BuiltInTypes.Boolean],
+["ceiling", BuiltInTypes.Number],
+["code", BuiltInTypes.Number],
+["coincides", BuiltInTypes.Boolean],
+["concatenate", BuiltInTypes.String],
+["contains", BuiltInTypes.Boolean],
+["context", BuiltInTypes.Context],
+["context put", BuiltInTypes.Context],
+["context merge", BuiltInTypes.Context],
+["count", BuiltInTypes.Number],
+["date", BuiltInTypes.Date],
+["date and time", BuiltInTypes.DateAndTime],
+["day of week", BuiltInTypes.String],
+["day of year", BuiltInTypes.Number],
+["decimal", BuiltInTypes.Number],
+["decision table", BuiltInTypes.Any],
+["distinct values", BuiltInTypes.List],
+["duration", BuiltInTypes.DaysAndTimeDuration],
Review Comment:
The point here is that the only way to be sure what is the return is to
parsing the content of the expression. We can do it, but in another ticket
because this change wasn't even really required to be here, I'm just expanded
to cover more cases that is not in the ticket and prepared the code for future
changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
ljmotta commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2763993914
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -110,16 +110,16 @@ export class FeelFunctionReturningTypes {
["string", BuiltInTypes.String],
["string join", BuiltInTypes.String],
["string length", BuiltInTypes.Number],
-["subList", BuiltInTypes.List],
-["subString after", BuiltInTypes.String],
-["subString before", BuiltInTypes.String],
-["subString", BuiltInTypes.String],
+["sublist", BuiltInTypes.List],
+["substring after", BuiltInTypes.String],
+["substring before", BuiltInTypes.String],
+["substring", BuiltInTypes.String],
["sum", BuiltInTypes.Number],
["time", BuiltInTypes.Time],
["today", BuiltInTypes.Date],
["union", BuiltInTypes.List],
["upper case", BuiltInTypes.String],
["week of year", BuiltInTypes.Number],
-["years and months duration", BuiltInTypes.YearsAndMonthsDuration],
+["years and months duration", BuiltInTypes.Any],
Review Comment:
@danielzhe Why changing to `Any`? Shouldn't this be `YearsAndMonthsDuration`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
ljmotta commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2763975769
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
+["abs", BuiltInTypes.Number],
+["after", BuiltInTypes.Boolean],
+["all", BuiltInTypes.Boolean],
+["any", BuiltInTypes.Boolean],
+["append", BuiltInTypes.List],
+["before", BuiltInTypes.Boolean],
+["ceiling", BuiltInTypes.Number],
+["code", BuiltInTypes.Number],
+["coincides", BuiltInTypes.Boolean],
+["concatenate", BuiltInTypes.String],
+["contains", BuiltInTypes.Boolean],
+["context", BuiltInTypes.Context],
+["context put", BuiltInTypes.Context],
+["context merge", BuiltInTypes.Context],
+["count", BuiltInTypes.Number],
+["date", BuiltInTypes.Date],
+["date and time", BuiltInTypes.DateAndTime],
+["day of week", BuiltInTypes.String],
+["day of year", BuiltInTypes.Number],
+["decimal", BuiltInTypes.Number],
+["decision table", BuiltInTypes.Any],
+["distinct values", BuiltInTypes.List],
+["duration", BuiltInTypes.DaysAndTimeDuration],
Review Comment:
I'm not sure how to proceed here. Ideally, we would keep the `duration`
working as expected, for that we need to change `FeelFunctionReturningTypes` to
support multiple return types (`DataType[]`) instead of changing it to `any`.
Any ideas @thiagoelg ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
thiagoelg commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2760756812
##
packages/dmn-feel-antlr4-parser/src/parser/grammar/visitor/FeelVisitorImpl.ts:
##
@@ -0,0 +1,299 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import FEEL_1_1Visitor from "../generated-parser/FEEL_1_1Visitor";
+import {
+ AddExpressionContext,
+ FilterPathExpressionContext,
+ FnInvocationContext,
+ NameRefContext,
+ ParametersEmptyContext,
+ ParametersNamedContext,
+ ParametersPositionalContext,
+ PrimaryParensContext,
+ QualifiedNameContext,
+ UenpmPrimaryContext,
+} from "../generated-parser/FEEL_1_1Parser";
+import { SemanticToken } from "./SemanticToken";
+import { ParserRuleContext, ParseTree, TerminalNode } from "antlr4";
+import { FeelFunctionReturningTypes } from "../../FeelFunctionReturningTypes";
+import { FeelSyntacticSymbolNature } from "../../FeelSyntacticSymbolNature";
+import { VisitorResult } from "./VisitorResult";
+import { BuiltInTypes } from "../../BuiltInTypes";
+import { DataType } from "../../DataType";
+import FEEL_1_1Lexer from "../generated-parser/FEEL_1_1Lexer";
+
+export class FeelVisitorImpl extends FEEL_1_1Visitor {
+ private readonly handlers: Map VisitorResult>;
+ private readonly _semanticTokens: Array;
+ private readonly _normalizedFeelFunctionReturningTypes: ReadonlyMap;
+
+ public constructor() {
+super();
+this._semanticTokens = new Array();
+this.handlers = new Map VisitorResult>([
+ [FilterPathExpressionContext, this.visitFilterPathExpression.bind(this)],
+ [FnInvocationContext, this.visitFnInvocation.bind(this)],
+ [NameRefContext, this.visitNameRef.bind(this)],
+ [AddExpressionContext, this.visitAddExpression.bind(this)],
+ [PrimaryParensContext, this.visitPrimaryParens.bind(this)],
+ [UenpmPrimaryContext, this.visitUenpmPrimary.bind(this)],
+]);
+
+this._normalizedFeelFunctionReturningTypes = new Map(
+ Array.from(FeelFunctionReturningTypes.Index, ([key, value]) =>
[key.replaceAll(" ", ""), value])
+);
+ }
+
+ private getSpecializedHandlerIfPresent(tree: ParseTree) {
+for (const [klass, handler] of this.handlers) {
+ if (tree instanceof klass) {
+return handler;
+ }
+}
+ }
+
+ get semanticTokens(): Array {
+return this._semanticTokens;
+ }
+
+ private resolveNames(nameContext: QualifiedNameContext | NameRefContext) {
+const resolvedNames: VisitorResult[] = [];
+if (!nameContext.children) {
+ return resolvedNames;
+}
+
+for (let i = 0; i < nameContext.children.length; i++) {
+ const child = nameContext.getChild(i);
+ if (child instanceof NameRefContext || child instanceof
QualifiedNameContext) {
+resolvedNames.push(...this.resolveNames(child));
+ } else {
+resolvedNames.push(this.visit(child));
+ }
+}
+
+return resolvedNames;
+ }
+
+ public override visit = (tree: ParseTree) => {
+// If there is a specialized handler for that kind of node, we use it,
because it will know how to handle it.
+// Otherwise, we just go through they children.
+const specializedHandler = this.getSpecializedHandlerIfPresent(tree);
+if (specializedHandler) {
+ return specializedHandler(tree);
+} else if (tree instanceof ParserRuleContext) {
+ return this.visitChildren(tree);
+} else if (tree instanceof TerminalNode) {
+ return new VisitorResult({ text: tree.getText(), dataType:
this.getBuiltInTypeFromNodeType(tree.symbol.type) });
+}
+return undefined!;
+ };
+
+ public override visitChildren(ctx: ParserRuleContext) {
+if (!ctx.children) {
+ return undefined!;
+}
+
+const result = new Array();
+const count = ctx.children?.length ?? 0;
+for (let i = 0; i < count; i++) {
+ result.push(this.visit(ctx.children[i])!);
+}
+
+// In case of multiple children, probably we need a specialized handler to
deal with,
+// but we are not doing that now because is one of the cases that we don't
+// use in the autocomplete or colorize.
+return result[0];
+ }
+
+ public override visitUenpmPrimary = (ctx: UenpmPrimaryC
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on PR #3397: URL: https://github.com/apache/incubator-kie-tools/pull/3397#issuecomment-3843288694 @ljmotta Changes applied! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2760697745
##
packages/dmn-feel-antlr4-parser/src/parser/grammar/visitor/FeelVisitorImpl.ts:
##
@@ -0,0 +1,299 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import FEEL_1_1Visitor from "../generated-parser/FEEL_1_1Visitor";
+import {
+ AddExpressionContext,
+ FilterPathExpressionContext,
+ FnInvocationContext,
+ NameRefContext,
+ ParametersEmptyContext,
+ ParametersNamedContext,
+ ParametersPositionalContext,
+ PrimaryParensContext,
+ QualifiedNameContext,
+ UenpmPrimaryContext,
+} from "../generated-parser/FEEL_1_1Parser";
+import { SemanticToken } from "./SemanticToken";
+import { ParserRuleContext, ParseTree, TerminalNode } from "antlr4";
+import { FeelFunctionReturningTypes } from "../../FeelFunctionReturningTypes";
+import { FeelSyntacticSymbolNature } from "../../FeelSyntacticSymbolNature";
+import { VisitorResult } from "./VisitorResult";
+import { BuiltInTypes } from "../../BuiltInTypes";
+import { DataType } from "../../DataType";
+import FEEL_1_1Lexer from "../generated-parser/FEEL_1_1Lexer";
+
+export class FeelVisitorImpl extends FEEL_1_1Visitor {
+ private readonly handlers: Map VisitorResult>;
+ private readonly _semanticTokens: Array;
+ private readonly _normalizedFeelFunctionReturningTypes: ReadonlyMap;
+
+ public constructor() {
+super();
+this._semanticTokens = new Array();
+this.handlers = new Map VisitorResult>([
+ [FilterPathExpressionContext, this.visitFilterPathExpression.bind(this)],
+ [FnInvocationContext, this.visitFnInvocation.bind(this)],
+ [NameRefContext, this.visitNameRef.bind(this)],
+ [AddExpressionContext, this.visitAddExpression.bind(this)],
+ [PrimaryParensContext, this.visitPrimaryParens.bind(this)],
+ [UenpmPrimaryContext, this.visitUenpmPrimary.bind(this)],
+]);
+
+this._normalizedFeelFunctionReturningTypes = new Map(
+ Array.from(FeelFunctionReturningTypes.Index, ([key, value]) =>
[key.replaceAll(" ", ""), value])
+);
+ }
+
+ private getSpecializedHandlerIfPresent(tree: ParseTree) {
+for (const [klass, handler] of this.handlers) {
+ if (tree instanceof klass) {
+return handler;
+ }
+}
+ }
+
+ get semanticTokens(): Array {
+return this._semanticTokens;
+ }
+
+ private resolveNames(nameContext: QualifiedNameContext | NameRefContext) {
+const resolvedNames: VisitorResult[] = [];
+if (!nameContext.children) {
+ return resolvedNames;
+}
+
+for (let i = 0; i < nameContext.children.length; i++) {
+ const child = nameContext.getChild(i);
+ if (child instanceof NameRefContext || child instanceof
QualifiedNameContext) {
+resolvedNames.push(...this.resolveNames(child));
+ } else {
+resolvedNames.push(this.visit(child));
+ }
+}
+
+return resolvedNames;
+ }
+
+ public override visit = (tree: ParseTree) => {
+// If there is a specialized handler for that kind of node, we use it,
because it will know how to handle it.
+// Otherwise, we just go through they children.
+const specializedHandler = this.getSpecializedHandlerIfPresent(tree);
+if (specializedHandler) {
+ return specializedHandler(tree);
+} else if (tree instanceof ParserRuleContext) {
+ return this.visitChildren(tree);
+} else if (tree instanceof TerminalNode) {
+ return new VisitorResult({ text: tree.getText(), dataType:
this.getBuiltInTypeFromNodeType(tree.symbol.type) });
+}
+return undefined!;
+ };
+
+ public override visitChildren(ctx: ParserRuleContext) {
+if (!ctx.children) {
+ return undefined!;
+}
+
+const result = new Array();
+const count = ctx.children?.length ?? 0;
+for (let i = 0; i < count; i++) {
+ result.push(this.visit(ctx.children[i])!);
+}
+
+// In case of multiple children, probably we need a specialized handler to
deal with,
+// but we are not doing that now because is one of the cases that we don't
+// use in the autocomplete or colorize.
+return result[0];
+ }
+
+ public override visitUenpmPrimary = (ctx: UenpmPrimaryC
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2760668067
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
+["abs", BuiltInTypes.Number],
+["after", BuiltInTypes.Boolean],
+["all", BuiltInTypes.Boolean],
+["any", BuiltInTypes.Boolean],
+["append", BuiltInTypes.List],
+["before", BuiltInTypes.Boolean],
+["ceiling", BuiltInTypes.Number],
+["code", BuiltInTypes.Number],
+["coincides", BuiltInTypes.Boolean],
+["concatenate", BuiltInTypes.String],
+["contains", BuiltInTypes.Boolean],
+["context", BuiltInTypes.Context],
+["context put", BuiltInTypes.Context],
+["context merge", BuiltInTypes.Context],
+["count", BuiltInTypes.Number],
+["date", BuiltInTypes.Date],
+["date and time", BuiltInTypes.DateAndTime],
+["day of week", BuiltInTypes.String],
+["day of year", BuiltInTypes.Number],
+["decimal", BuiltInTypes.Number],
+["decision table", BuiltInTypes.Any],
+["distinct values", BuiltInTypes.List],
+["duration", BuiltInTypes.DaysAndTimeDuration],
+["during", BuiltInTypes.Boolean],
+["ends with", BuiltInTypes.Boolean],
+["even", BuiltInTypes.Boolean],
+["exp", BuiltInTypes.Number],
+["finished by", BuiltInTypes.Boolean],
+["finishes", BuiltInTypes.Boolean],
+["flatten", BuiltInTypes.List],
+["floor", BuiltInTypes.Number],
+["get entries", BuiltInTypes.List],
+["get value", BuiltInTypes.Any],
+["includes", BuiltInTypes.Boolean],
+["index of", BuiltInTypes.List],
+["insert before", BuiltInTypes.List],
+["invoke", BuiltInTypes.Any],
+["is", BuiltInTypes.Boolean],
+["list contains", BuiltInTypes.Boolean],
+["list replace", BuiltInTypes.List],
+["log", BuiltInTypes.Number],
+["lower case", BuiltInTypes.String],
+["matches", BuiltInTypes.Boolean],
+["max", BuiltInTypes.Number],
Review Comment:
humm, ok, changing it!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2760665933
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
+["abs", BuiltInTypes.Number],
+["after", BuiltInTypes.Boolean],
+["all", BuiltInTypes.Boolean],
+["any", BuiltInTypes.Boolean],
+["append", BuiltInTypes.List],
+["before", BuiltInTypes.Boolean],
+["ceiling", BuiltInTypes.Number],
+["code", BuiltInTypes.Number],
+["coincides", BuiltInTypes.Boolean],
+["concatenate", BuiltInTypes.String],
+["contains", BuiltInTypes.Boolean],
+["context", BuiltInTypes.Context],
+["context put", BuiltInTypes.Context],
+["context merge", BuiltInTypes.Context],
+["count", BuiltInTypes.Number],
+["date", BuiltInTypes.Date],
+["date and time", BuiltInTypes.DateAndTime],
+["day of week", BuiltInTypes.String],
+["day of year", BuiltInTypes.Number],
+["decimal", BuiltInTypes.Number],
+["decision table", BuiltInTypes.Any],
+["distinct values", BuiltInTypes.List],
+["duration", BuiltInTypes.DaysAndTimeDuration],
Review Comment:
Yes, can be both. I can change it to `any`, but the autocomplete will not
work for that specific case then.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
ljmotta commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2756161526
##
packages/dmn-feel-antlr4-parser/src/parser/FeelFunctionReturningTypes.ts:
##
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { DataType } from "./DataType";
+import { BuiltInTypes } from "./BuiltInTypes";
+
+export class FeelFunctionReturningTypes {
+ public static readonly Index: ReadonlyMap = new
Map([
+["abs", BuiltInTypes.Number],
+["after", BuiltInTypes.Boolean],
+["all", BuiltInTypes.Boolean],
+["any", BuiltInTypes.Boolean],
+["append", BuiltInTypes.List],
+["before", BuiltInTypes.Boolean],
+["ceiling", BuiltInTypes.Number],
+["code", BuiltInTypes.Number],
+["coincides", BuiltInTypes.Boolean],
+["concatenate", BuiltInTypes.String],
+["contains", BuiltInTypes.Boolean],
+["context", BuiltInTypes.Context],
+["context put", BuiltInTypes.Context],
+["context merge", BuiltInTypes.Context],
+["count", BuiltInTypes.Number],
+["date", BuiltInTypes.Date],
+["date and time", BuiltInTypes.DateAndTime],
+["day of week", BuiltInTypes.String],
+["day of year", BuiltInTypes.Number],
+["decimal", BuiltInTypes.Number],
+["decision table", BuiltInTypes.Any],
+["distinct values", BuiltInTypes.List],
+["duration", BuiltInTypes.DaysAndTimeDuration],
+["during", BuiltInTypes.Boolean],
+["ends with", BuiltInTypes.Boolean],
+["even", BuiltInTypes.Boolean],
+["exp", BuiltInTypes.Number],
+["finished by", BuiltInTypes.Boolean],
+["finishes", BuiltInTypes.Boolean],
+["flatten", BuiltInTypes.List],
+["floor", BuiltInTypes.Number],
+["get entries", BuiltInTypes.List],
+["get value", BuiltInTypes.Any],
+["includes", BuiltInTypes.Boolean],
+["index of", BuiltInTypes.List],
+["insert before", BuiltInTypes.List],
+["invoke", BuiltInTypes.Any],
+["is", BuiltInTypes.Boolean],
+["list contains", BuiltInTypes.Boolean],
+["list replace", BuiltInTypes.List],
+["log", BuiltInTypes.Number],
+["lower case", BuiltInTypes.String],
+["matches", BuiltInTypes.Boolean],
+["max", BuiltInTypes.Number],
+["mean", BuiltInTypes.Number],
+["median", BuiltInTypes.Number],
+["meets", BuiltInTypes.Boolean],
+["met by", BuiltInTypes.Boolean],
+["min", BuiltInTypes.Number],
+["mode", BuiltInTypes.Number],
+["modulo", BuiltInTypes.Number],
+["month of year", BuiltInTypes.String],
+["nn all", BuiltInTypes.Boolean],
+["nn any", BuiltInTypes.Boolean],
+["nn count", BuiltInTypes.Number],
+["nn max", BuiltInTypes.Number],
+["nn mean", BuiltInTypes.Number],
+["nn median", BuiltInTypes.Number],
+["nn min", BuiltInTypes.Number],
+["nn mode", BuiltInTypes.Number],
+["nn stddev", BuiltInTypes.Number],
+["nn sum", BuiltInTypes.Number],
+["not", BuiltInTypes.Boolean],
+["now", BuiltInTypes.DateAndTime],
+["Number", BuiltInTypes.Number],
+["odd", BuiltInTypes.Boolean],
+["overlaps after", BuiltInTypes.Boolean],
+["overlaps before", BuiltInTypes.Boolean],
+["overlaps", BuiltInTypes.Boolean],
+["product", BuiltInTypes.Number],
+["range", BuiltInTypes.Range],
+["remove", BuiltInTypes.List],
+["replace", BuiltInTypes.String],
+["reverse", BuiltInTypes.List],
+["round down", BuiltInTypes.Number],
+["round half down", BuiltInTypes.Number],
+["round half up", BuiltInTypes.Number],
+["round up", BuiltInTypes.Number],
+["sort", BuiltInTypes.List],
+["split", BuiltInTypes.List],
+["sqrt", BuiltInTypes.Number],
+["started by", BuiltInTypes.Boolean],
+["starts with", BuiltInTypes.Boolean],
+["starts", BuiltInTypes.Boolean],
+["stddev", BuiltInTypes.Number],
+["string", BuiltInTypes.String],
+["string join", BuiltInTypes.String],
+["string length", BuiltInTypes.Number],
+["subList", BuiltInTypes.List],
+["subString after", BuiltInTypes.String],
+["subString before", BuiltInTypes.String],
+["subString", BuiltInTypes.String],
Review Comment:
`substring`
##
packages/dmn-feel-a
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2722624067
##
packages/dmn-feel-antlr4-parser/src/parser/grammar/visitor/FeelVisitorImpl.ts:
##
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import FEEL_1_1Visitor from "../generated-parser/FEEL_1_1Visitor";
+import {
+ AddExpressionContext,
+ FilterPathExpressionContext,
+ FnInvocationContext,
+ NameRefContext,
+ ParametersEmptyContext,
+ ParametersNamedContext,
+ ParametersPositionalContext,
+ PrimaryParensContext,
+ QualifiedNameContext,
+ UenpmPrimaryContext,
+} from "../generated-parser/FEEL_1_1Parser";
+import { SemanticToken } from "./SemanticToken";
+import { ParserRuleContext, ParseTree, TerminalNode } from "antlr4";
+import { FeelFunctionReturningTypes } from "../../FeelFunctionReturningTypes";
+import { FeelSyntacticSymbolNature } from "../../FeelSyntacticSymbolNature";
+import { VisitorResult } from "./VisitorResult";
+import { BuiltInTypes } from "../../BuiltInTypes";
+import { DataType } from "../../DataType";
+
+export class FeelVisitorImpl extends FEEL_1_1Visitor {
+ private readonly handlers: Map VisitorResult>;
+ private readonly _semanticTokens: Array;
+ private readonly _normalizedFeelFunctionReturningTypes: ReadonlyMap;
+
+ public constructor() {
+super();
+this._semanticTokens = new Array();
+this.handlers = new Map VisitorResult>([
+ [FilterPathExpressionContext, this.visitFilterPathExpression.bind(this)],
+ [FnInvocationContext, this.visitFnInvocation.bind(this)],
+ [NameRefContext, this.visitNameRef.bind(this)],
+ [AddExpressionContext, this.visitAddExpression.bind(this)],
+ [PrimaryParensContext, this.visitPrimaryParens.bind(this)],
+ [UenpmPrimaryContext, this.visitUenpmPrimary.bind(this)],
+]);
+
+this._normalizedFeelFunctionReturningTypes = new Map(
+ Array.from(FeelFunctionReturningTypes.Index, ([key, value]) =>
[key.replaceAll(" ", ""), value])
+);
+ }
+
+ private getSpecializedHandlerIfPresent(tree: ParseTree) {
+for (const [klass, handler] of this.handlers) {
+ if (tree instanceof klass) {
+return handler;
+ }
+}
+ }
+
+ get semanticTokens(): Array {
+return this._semanticTokens;
+ }
+
+ private resolveNames(nameContext: QualifiedNameContext | NameRefContext) {
+const resolvedNames: VisitorResult[] = [];
+if (!nameContext.children) {
+ return resolvedNames;
+}
+
+for (let i = 0; i < nameContext.children.length; i++) {
+ const child = nameContext.getChild(i);
+ if (child instanceof NameRefContext || child instanceof
QualifiedNameContext) {
+resolvedNames.push(...this.resolveNames(child));
+ } else {
+resolvedNames.push(this.visit(child));
+ }
+}
+
+return resolvedNames;
+ }
+
+ public override visit = (tree: ParseTree) => {
+// If there is a specialized handler for that kind of node, we use it,
because it will know how to handle it.
+// Otherwise, we just go through they children.
+const specializedHandler = this.getSpecializedHandlerIfPresent(tree);
+if (specializedHandler) {
+ return specializedHandler(tree);
+} else if (tree instanceof ParserRuleContext) {
+ return this.visitChildren(tree);
+} else if (tree instanceof TerminalNode) {
+ return new VisitorResult({ text: tree.getText(), dataType:
this.getBuiltInTypeFromNodeType(tree.symbol.type) });
+}
+return undefined!;
+ };
+
+ public override visitChildren(ctx: ParserRuleContext) {
+if (!ctx.children) {
+ return undefined!;
+}
+
+const result = new Array();
+const count = ctx.children?.length ?? 0;
+for (let i = 0; i < count; i++) {
+ result.push(this.visit(ctx.children[i])!);
+}
+
+// In case of multiple children, probably we need a specialized handler to
deal with,
+// but we are not doing that now because is one of the cases that we don't
+// use in the autocomplete or colorize.
+return result[0];
+ }
+
+ public override visitUenpmPrimary = (ctx: UenpmPrimaryContext) => {
+if (ctx.primary() === null || ctx.qualifiedNam
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
danielzhe commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2722610312
##
packages/dmn-feel-antlr4-parser/src/parser/grammar/visitor/FeelVisitorImpl.ts:
##
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import FEEL_1_1Visitor from "../generated-parser/FEEL_1_1Visitor";
+import {
+ AddExpressionContext,
+ FilterPathExpressionContext,
+ FnInvocationContext,
+ NameRefContext,
+ ParametersEmptyContext,
+ ParametersNamedContext,
+ ParametersPositionalContext,
+ PrimaryParensContext,
+ QualifiedNameContext,
+ UenpmPrimaryContext,
+} from "../generated-parser/FEEL_1_1Parser";
+import { SemanticToken } from "./SemanticToken";
+import { ParserRuleContext, ParseTree, TerminalNode } from "antlr4";
+import { FeelFunctionReturningTypes } from "../../FeelFunctionReturningTypes";
+import { FeelSyntacticSymbolNature } from "../../FeelSyntacticSymbolNature";
+import { VisitorResult } from "./VisitorResult";
+import { BuiltInTypes } from "../../BuiltInTypes";
+import { DataType } from "../../DataType";
+
+export class FeelVisitorImpl extends FEEL_1_1Visitor {
+ private readonly handlers: Map VisitorResult>;
+ private readonly _semanticTokens: Array;
+ private readonly _normalizedFeelFunctionReturningTypes: ReadonlyMap;
+
+ public constructor() {
+super();
+this._semanticTokens = new Array();
+this.handlers = new Map VisitorResult>([
+ [FilterPathExpressionContext, this.visitFilterPathExpression.bind(this)],
+ [FnInvocationContext, this.visitFnInvocation.bind(this)],
+ [NameRefContext, this.visitNameRef.bind(this)],
+ [AddExpressionContext, this.visitAddExpression.bind(this)],
+ [PrimaryParensContext, this.visitPrimaryParens.bind(this)],
+ [UenpmPrimaryContext, this.visitUenpmPrimary.bind(this)],
+]);
+
+this._normalizedFeelFunctionReturningTypes = new Map(
+ Array.from(FeelFunctionReturningTypes.Index, ([key, value]) =>
[key.replaceAll(" ", ""), value])
+);
+ }
+
+ private getSpecializedHandlerIfPresent(tree: ParseTree) {
+for (const [klass, handler] of this.handlers) {
+ if (tree instanceof klass) {
+return handler;
+ }
+}
+ }
+
+ get semanticTokens(): Array {
+return this._semanticTokens;
+ }
+
+ private resolveNames(nameContext: QualifiedNameContext | NameRefContext) {
+const resolvedNames: VisitorResult[] = [];
+if (!nameContext.children) {
+ return resolvedNames;
+}
+
+for (let i = 0; i < nameContext.children.length; i++) {
+ const child = nameContext.getChild(i);
+ if (child instanceof NameRefContext || child instanceof
QualifiedNameContext) {
+resolvedNames.push(...this.resolveNames(child));
+ } else {
+resolvedNames.push(this.visit(child));
+ }
+}
+
+return resolvedNames;
+ }
+
+ public override visit = (tree: ParseTree) => {
+// If there is a specialized handler for that kind of node, we use it,
because it will know how to handle it.
+// Otherwise, we just go through they children.
+const specializedHandler = this.getSpecializedHandlerIfPresent(tree);
+if (specializedHandler) {
+ return specializedHandler(tree);
+} else if (tree instanceof ParserRuleContext) {
+ return this.visitChildren(tree);
+} else if (tree instanceof TerminalNode) {
+ return new VisitorResult({ text: tree.getText(), dataType:
this.getBuiltInTypeFromNodeType(tree.symbol.type) });
+}
+return undefined!;
+ };
+
+ public override visitChildren(ctx: ParserRuleContext) {
+if (!ctx.children) {
+ return undefined!;
+}
+
+const result = new Array();
+const count = ctx.children?.length ?? 0;
+for (let i = 0; i < count; i++) {
+ result.push(this.visit(ctx.children[i])!);
+}
+
+// In case of multiple children, probably we need a specialized handler to
deal with,
+// but we are not doing that now because is one of the cases that we don't
+// use in the autocomplete or colorize.
+return result[0];
+ }
+
+ public override visitUenpmPrimary = (ctx: UenpmPrimaryContext) => {
+if (ctx.primary() === null || ctx.qualifiedNam
Re: [PR] kie-issue#1192: On the DMN Editor's Boxed Expression Editor, FEEL autocompletion does not suggest the type properties - Part 2 of 2 [incubator-kie-tools]
thiagoelg commented on code in PR #3397:
URL:
https://github.com/apache/incubator-kie-tools/pull/3397#discussion_r2722193430
##
packages/dmn-feel-antlr4-parser/src/parser/grammar/visitor/FeelVisitorImpl.ts:
##
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import FEEL_1_1Visitor from "../generated-parser/FEEL_1_1Visitor";
+import {
+ AddExpressionContext,
+ FilterPathExpressionContext,
+ FnInvocationContext,
+ NameRefContext,
+ ParametersEmptyContext,
+ ParametersNamedContext,
+ ParametersPositionalContext,
+ PrimaryParensContext,
+ QualifiedNameContext,
+ UenpmPrimaryContext,
+} from "../generated-parser/FEEL_1_1Parser";
+import { SemanticToken } from "./SemanticToken";
+import { ParserRuleContext, ParseTree, TerminalNode } from "antlr4";
+import { FeelFunctionReturningTypes } from "../../FeelFunctionReturningTypes";
+import { FeelSyntacticSymbolNature } from "../../FeelSyntacticSymbolNature";
+import { VisitorResult } from "./VisitorResult";
+import { BuiltInTypes } from "../../BuiltInTypes";
+import { DataType } from "../../DataType";
+
+export class FeelVisitorImpl extends FEEL_1_1Visitor {
+ private readonly handlers: Map VisitorResult>;
+ private readonly _semanticTokens: Array;
+ private readonly _normalizedFeelFunctionReturningTypes: ReadonlyMap;
+
+ public constructor() {
+super();
+this._semanticTokens = new Array();
+this.handlers = new Map VisitorResult>([
+ [FilterPathExpressionContext, this.visitFilterPathExpression.bind(this)],
+ [FnInvocationContext, this.visitFnInvocation.bind(this)],
+ [NameRefContext, this.visitNameRef.bind(this)],
+ [AddExpressionContext, this.visitAddExpression.bind(this)],
+ [PrimaryParensContext, this.visitPrimaryParens.bind(this)],
+ [UenpmPrimaryContext, this.visitUenpmPrimary.bind(this)],
+]);
+
+this._normalizedFeelFunctionReturningTypes = new Map(
+ Array.from(FeelFunctionReturningTypes.Index, ([key, value]) =>
[key.replaceAll(" ", ""), value])
+);
+ }
+
+ private getSpecializedHandlerIfPresent(tree: ParseTree) {
+for (const [klass, handler] of this.handlers) {
+ if (tree instanceof klass) {
+return handler;
+ }
+}
+ }
+
+ get semanticTokens(): Array {
+return this._semanticTokens;
+ }
+
+ private resolveNames(nameContext: QualifiedNameContext | NameRefContext) {
+const resolvedNames: VisitorResult[] = [];
+if (!nameContext.children) {
+ return resolvedNames;
+}
+
+for (let i = 0; i < nameContext.children.length; i++) {
+ const child = nameContext.getChild(i);
+ if (child instanceof NameRefContext || child instanceof
QualifiedNameContext) {
+resolvedNames.push(...this.resolveNames(child));
+ } else {
+resolvedNames.push(this.visit(child));
+ }
+}
+
+return resolvedNames;
+ }
+
+ public override visit = (tree: ParseTree) => {
+// If there is a specialized handler for that kind of node, we use it,
because it will know how to handle it.
+// Otherwise, we just go through they children.
+const specializedHandler = this.getSpecializedHandlerIfPresent(tree);
+if (specializedHandler) {
+ return specializedHandler(tree);
+} else if (tree instanceof ParserRuleContext) {
+ return this.visitChildren(tree);
+} else if (tree instanceof TerminalNode) {
+ return new VisitorResult({ text: tree.getText(), dataType:
this.getBuiltInTypeFromNodeType(tree.symbol.type) });
+}
+return undefined!;
+ };
+
+ public override visitChildren(ctx: ParserRuleContext) {
+if (!ctx.children) {
+ return undefined!;
+}
+
+const result = new Array();
+const count = ctx.children?.length ?? 0;
+for (let i = 0; i < count; i++) {
+ result.push(this.visit(ctx.children[i])!);
+}
+
+// In case of multiple children, probably we need a specialized handler to
deal with,
+// but we are not doing that now because is one of the cases that we don't
+// use in the autocomplete or colorize.
+return result[0];
+ }
+
+ public override visitUenpmPrimary = (ctx: UenpmPrimaryContext) => {
+if (ctx.primary() === null || ctx.qualifiedNam
