tkobayas commented on code in PR #5790:
URL: 
https://github.com/apache/incubator-kie-drools/pull/5790#discussion_r1527721762


##########
drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/util/ParserStringUtils.java:
##########
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+package org.drools.drl.parser.util;
+
+/**
+ * String utilities used by DRL Parser. Not dependent on ANTLR version.
+ */
+public class ParserStringUtils {
+
+    private ParserStringUtils() {
+        // Private constructor to prevent instantiation.
+    }
+
+    /**
+     * Append a prefix to a grouped constraint.
+     * Even if the constraint contains || and/or &&, append the prefix to each 
element.
+     */
+    public static String appendPrefix(String prefix, String expr) {

Review Comment:
   I moved this method from `DRL6Parser` (antlr3 based), because this logic is 
pure String manipulation. And this is used by both antlr3 based `DRL6Parser` 
and antlr4 based `DRLVisitorImpl`.
   
   `DRLVisitorImpl` might be able to implement this in another way using more 
visit methods, but it would likely be complex than this method, so I decided to 
reuse this method.



-- 
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]

Reply via email to