public final class MsgSubstUnitBaseVarNameUtils extends Object
Important: Do not use outside of Soy code (treat as superpackage-private).
| Modifier and Type | Method and Description |
|---|---|
static String |
genNaiveBaseNameForExpr(ExprNode exprNode,
String fallbackBaseName)
Helper function to generate a base placeholder (or plural/select var) name from an expression,
using the naive algorithm.
|
static List<String> |
genNoncollidingBaseNamesForExprs(List<ExprNode> exprNodes,
String fallbackBaseName,
ErrorReporter errorReporter)
Generates base names for all the expressions in a list, where for each expression, we use the
shortest candidate base name that does not collide with any of the candidate base names
generated from other expressions in the list.
|
static String |
genShortestBaseNameForExpr(ExprNode exprNode,
String fallbackBaseName)
The equivalent of
genNaiveBaseNameForExpr() in our new algorithm for generating base
name. |
public static String genNaiveBaseNameForExpr(ExprNode exprNode, String fallbackBaseName)
exprNode - The root node for an expression.fallbackBaseName - The fallback base name.public static String genShortestBaseNameForExpr(ExprNode exprNode, String fallbackBaseName)
genNaiveBaseNameForExpr() in our new algorithm for generating base
name.
Examples: $aaaBbb -> AAA_BBB; $aaa_bbb -> AAA_BBB; $aaa.bbb -> BBB; $ij.aaa -> AAA;
aaa.BBB -> BBB; $aaa.0 -> AAA_0; $aaa[0] -> AAA_0; $aaa[0].bbb -> BBB; length($aaa) ->
fallback; $aaa + 1 -> fallbackexprNode - The expr root of the expression to generate the shortest base name for.fallbackBaseName - The fallback base name to use if the given expression doesn't generate
any base names.public static List<String> genNoncollidingBaseNamesForExprs(List<ExprNode> exprNodes, String fallbackBaseName, ErrorReporter errorReporter)
exprNodes - The expr nodes of the expressions to generate noncolliding base names for.fallbackBaseName - The fallback base name.errorReporter - For reporting collision errors.