lkishalmi commented on code in PR #7286:
URL: https://github.com/apache/netbeans/pull/7286#discussion_r1574201509


##########
ide/languages.hcl/src/org/netbeans/modules/languages/hcl/ast/HCLExpression.java:
##########
@@ -36,17 +36,18 @@ public sealed interface HCLExpression extends HCLElement 
permits
         HCLConditionalOperation,
         HCLForExpression,
         HCLFunction,
+        HCLIdentifier,
         HCLLiteral,
         HCLResolveOperation,
         HCLTemplate,
         HCLVariable {
 
-    public static HCLExpression parse(String expr) {
-        HCLLexer lexer = new HCLLexer(CharStreams.fromString(expr));
-        HCLParser parser = new HCLParser(new CommonTokenStream(lexer));
-        return new HCLExpressionFactory().process(parser.expression());
+
+    public static String asString(HCLExpression expr) {
+        return expr != null ? expr.asString() : "";
     }

Review Comment:
   Well, there is a reason why this is not a public API yet. I would like to 
chew on these.
   
   My original thought was to utilize `toString()`, then found the default ones 
useful, hence the `asString()`.
   
   Now, I've been thinking of a formatter with a separate set of rules, so 
`asString()` would go, however I intend to keep the `toString()` as it is. 



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

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to