Package org.intellij.grammar.generator
Class ParserGeneratorUtil
- java.lang.Object
-
- org.intellij.grammar.generator.ParserGeneratorUtil
-
public class ParserGeneratorUtil extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParserGeneratorUtil.NameFormatstatic classParserGeneratorUtil.PinMatcherstatic classParserGeneratorUtil.Rule
-
Constructor Summary
Constructors Constructor Description ParserGeneratorUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidappendTokenTypes(java.lang.StringBuilder sb, java.util.List<java.lang.String> tokenTypes)static java.util.Map<java.lang.String,java.lang.String>collectTokenPattern2Name(@NotNull BnfFile file, boolean createTokenIfMissing, @NotNull java.util.Map<java.lang.String,java.lang.String> map, @Nullable java.util.Set<java.lang.String> usedInGrammar)static @Nullable java.util.regex.PatterncompilePattern(java.lang.String text)static <T extends java.lang.Enum<T>>
TenumFromString(@Nullable java.lang.String value, T def)static <T> @Nullable BnfAttrfindAttribute(@NotNull BnfRule rule, @NotNull KnownAttribute<T> attribute)static @NotNull java.util.List<com.intellij.psi.NavigatablePsiElement>findRuleImplMethods(@NotNull JavaHelper helper, @Nullable java.lang.String psiImplUtilClass, @Nullable java.lang.String methodName, @Nullable BnfRule rule)static @Nullable java.util.regex.PatterngetAllTokenPattern(java.util.Map<java.lang.String,java.lang.String> tokens)static <T> TgetAttribute(@NotNull BnfRule rule, @NotNull KnownAttribute<T> attribute)static <T> TgetAttribute(@NotNull BnfRule rule, @NotNull KnownAttribute<T> attribute, @Nullable java.lang.String match)static java.lang.ObjectgetAttributeValue(BnfExpression value)static java.util.List<BnfExpression>getChildExpressions(@Nullable BnfExpression node)static com.intellij.psi.tree.IElementTypegetEffectiveType(com.intellij.psi.PsiElement tree)static java.lang.StringgetElementType(BnfRule rule, @NotNull Case cas)static java.lang.StringgetFuncName(@NotNull BnfRule r)static <T> TgetGenerateOption(@NotNull com.intellij.psi.PsiElement node, @NotNull KnownAttribute<T> attribute, @NotNull java.util.Map<java.lang.String,java.lang.String> genOptions, java.lang.String... genOptionKeys)static java.lang.StringgetGenericClauseString(java.util.List<JavaHelper.TypeParameterInfo> genericParameters, NameShortener shortener)static @NotNull java.lang.StringgetGetterName(@NotNull java.lang.String text)static <T> TgetLiteralValue(BnfLiteralExpression child)static @Nullable java.lang.StringgetLiteralValue(BnfStringLiteralExpression child)static java.lang.StringgetNextName(@NotNull java.lang.String funcName, int i)static BnfExpressiongetNonTrivialNode(BnfExpression initialNode)static java.lang.StringgetParametersString(java.util.List<java.lang.String> paramsTypes, int offset, int mask, com.intellij.util.Function<java.lang.String,java.lang.String> substitutor, com.intellij.util.Function<java.lang.Integer,java.util.List<java.lang.String>> annoProvider, NameShortener shortener)static @NotNull ParserGeneratorUtil.NameFormatgetPsiClassFormat(BnfFile file)static @NotNull ParserGeneratorUtil.NameFormatgetPsiImplClassFormat(BnfFile file)static com.intellij.openapi.util.Couple<java.lang.String>getQualifiedRuleClassName(BnfRule rule)static java.lang.StringgetRegexpTokenRegexp(@NotNull java.lang.String tokenText)static <T> TgetRootAttribute(@NotNull com.intellij.psi.PsiElement node, @NotNull KnownAttribute<T> attribute)static <T> TgetRootAttribute(@NotNull com.intellij.psi.PsiElement node, @NotNull KnownAttribute<T> attribute, @Nullable java.lang.String match)static @NotNull java.util.Set<java.lang.String>getRuleClasses(@NotNull BnfRule rule)static @Nullable java.lang.StringgetRuleDisplayName(BnfRule rule, boolean force)static @NotNull java.lang.StringgetRulePsiClassName(@NotNull BnfRule rule, @Nullable ParserGeneratorUtil.NameFormat format)static java.util.Collection<com.intellij.psi.impl.source.tree.LeafPsiElement>getSortedExternalRules(java.util.Set<com.intellij.psi.PsiElement> accessors)static java.util.Collection<BnfRule>getSortedPublicRules(java.util.Set<com.intellij.psi.PsiElement> accessors)static java.util.Collection<BnfExpression>getSortedTokens(java.util.Set<com.intellij.psi.PsiElement> accessors)static @NotNull java.lang.StringgetThrowsString(java.util.List<java.lang.String> exceptionList, NameShortener shortener)static java.lang.StringgetTokenType(BnfFile file, java.lang.String token, @NotNull Case cas)static BnfExpressiongetTrivialNodeChild(com.intellij.psi.PsiElement element)static booleanisRegexpToken(@NotNull java.lang.String tokenText)static booleanisRollbackRequired(BnfExpression o, BnfFile file)static booleanisTokenSequence(@NotNull BnfRule rule, @Nullable BnfExpression node)static booleanisTrivialNode(com.intellij.psi.PsiElement element)static booleanmatchesAny(java.lang.String regexp, java.lang.String... text)static @Nullable java.lang.Stringquote(@Nullable java.lang.String text)static <T extends com.intellij.psi.PsiElement>
gnu.trove.TObjectHashingStrategy<T>textStrategy()static @NotNull java.lang.StringtoIdentifier(@NotNull java.lang.String text, @Nullable ParserGeneratorUtil.NameFormat format, @NotNull Case cas)static java.util.List<BnfRule>topoSort(@NotNull java.util.Collection<BnfRule> rules, @NotNull RuleGraphHelper ruleGraph)static @NotNull java.lang.StringunwrapTypeArgumentForParamList(java.lang.String type)
-
-
-
Method Detail
-
enumFromString
@NotNull public static <T extends java.lang.Enum<T>> T enumFromString(@Nullable @Nullable java.lang.String value, @NotNull T def)
-
getGenerateOption
public static <T> T getGenerateOption(@NotNull @NotNull com.intellij.psi.PsiElement node, @NotNull @NotNull KnownAttribute<T> attribute, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.String> genOptions, java.lang.String... genOptionKeys)
-
getRootAttribute
public static <T> T getRootAttribute(@NotNull @NotNull com.intellij.psi.PsiElement node, @NotNull @NotNull KnownAttribute<T> attribute)
-
getRootAttribute
public static <T> T getRootAttribute(@NotNull @NotNull com.intellij.psi.PsiElement node, @NotNull @NotNull KnownAttribute<T> attribute, @Nullable @Nullable java.lang.String match)
-
getAttribute
public static <T> T getAttribute(@NotNull @NotNull BnfRule rule, @NotNull @NotNull KnownAttribute<T> attribute)
-
findAttribute
@Nullable public static <T> @Nullable BnfAttr findAttribute(@NotNull @NotNull BnfRule rule, @NotNull @NotNull KnownAttribute<T> attribute)
-
getAttribute
public static <T> T getAttribute(@NotNull @NotNull BnfRule rule, @NotNull @NotNull KnownAttribute<T> attribute, @Nullable @Nullable java.lang.String match)
-
getAttributeValue
public static java.lang.Object getAttributeValue(BnfExpression value)
-
getLiteralValue
@Nullable public static @Nullable java.lang.String getLiteralValue(BnfStringLiteralExpression child)
-
getLiteralValue
@Nullable public static <T> T getLiteralValue(BnfLiteralExpression child)
-
isTrivialNode
public static boolean isTrivialNode(com.intellij.psi.PsiElement element)
-
getNonTrivialNode
public static BnfExpression getNonTrivialNode(BnfExpression initialNode)
-
getTrivialNodeChild
public static BnfExpression getTrivialNodeChild(com.intellij.psi.PsiElement element)
-
getEffectiveType
public static com.intellij.psi.tree.IElementType getEffectiveType(com.intellij.psi.PsiElement tree)
-
getChildExpressions
public static java.util.List<BnfExpression> getChildExpressions(@Nullable @Nullable BnfExpression node)
-
getFuncName
public static java.lang.String getFuncName(@NotNull @NotNull BnfRule r)
-
getNextName
public static java.lang.String getNextName(@NotNull @NotNull java.lang.String funcName, int i)
-
getGetterName
@NotNull public static @NotNull java.lang.String getGetterName(@NotNull @NotNull java.lang.String text)
-
isRollbackRequired
public static boolean isRollbackRequired(BnfExpression o, BnfFile file)
-
toIdentifier
@TestOnly @NotNull public static @NotNull java.lang.String toIdentifier(@NotNull @NotNull java.lang.String text, @Nullable @Nullable ParserGeneratorUtil.NameFormat format, @NotNull @NotNull Case cas)
-
getPsiClassFormat
@NotNull public static @NotNull ParserGeneratorUtil.NameFormat getPsiClassFormat(BnfFile file)
-
getPsiImplClassFormat
@NotNull public static @NotNull ParserGeneratorUtil.NameFormat getPsiImplClassFormat(BnfFile file)
-
getRulePsiClassName
@NotNull public static @NotNull java.lang.String getRulePsiClassName(@NotNull @NotNull BnfRule rule, @Nullable @Nullable ParserGeneratorUtil.NameFormat format)
-
getQualifiedRuleClassName
public static com.intellij.openapi.util.Couple<java.lang.String> getQualifiedRuleClassName(BnfRule rule)
-
findRuleImplMethods
@NotNull public static @NotNull java.util.List<com.intellij.psi.NavigatablePsiElement> findRuleImplMethods(@NotNull @NotNull JavaHelper helper, @Nullable @Nullable java.lang.String psiImplUtilClass, @Nullable @Nullable java.lang.String methodName, @Nullable @Nullable BnfRule rule)
-
getRuleClasses
@NotNull public static @NotNull java.util.Set<java.lang.String> getRuleClasses(@NotNull @NotNull BnfRule rule)
-
getRuleDisplayName
@Nullable public static @Nullable java.lang.String getRuleDisplayName(BnfRule rule, boolean force)
-
getElementType
public static java.lang.String getElementType(BnfRule rule, @NotNull @NotNull Case cas)
-
getTokenType
public static java.lang.String getTokenType(BnfFile file, java.lang.String token, @NotNull @NotNull Case cas)
-
getSortedPublicRules
public static java.util.Collection<BnfRule> getSortedPublicRules(java.util.Set<com.intellij.psi.PsiElement> accessors)
-
getSortedTokens
public static java.util.Collection<BnfExpression> getSortedTokens(java.util.Set<com.intellij.psi.PsiElement> accessors)
-
getSortedExternalRules
public static java.util.Collection<com.intellij.psi.impl.source.tree.LeafPsiElement> getSortedExternalRules(java.util.Set<com.intellij.psi.PsiElement> accessors)
-
topoSort
public static java.util.List<BnfRule> topoSort(@NotNull @NotNull java.util.Collection<BnfRule> rules, @NotNull @NotNull RuleGraphHelper ruleGraph)
-
isRegexpToken
public static boolean isRegexpToken(@NotNull @NotNull java.lang.String tokenText)
-
getRegexpTokenRegexp
public static java.lang.String getRegexpTokenRegexp(@NotNull @NotNull java.lang.String tokenText)
-
isTokenSequence
public static boolean isTokenSequence(@NotNull @NotNull BnfRule rule, @Nullable @Nullable BnfExpression node)
-
appendTokenTypes
public static void appendTokenTypes(java.lang.StringBuilder sb, java.util.List<java.lang.String> tokenTypes)
-
collectTokenPattern2Name
public static java.util.Map<java.lang.String,java.lang.String> collectTokenPattern2Name(@NotNull @NotNull BnfFile file, boolean createTokenIfMissing, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.String> map, @Nullable @Nullable java.util.Set<java.lang.String> usedInGrammar)
-
quote
@Nullable public static @Nullable java.lang.String quote(@Nullable @Nullable java.lang.String text)
-
compilePattern
@Nullable public static @Nullable java.util.regex.Pattern compilePattern(java.lang.String text)
-
matchesAny
public static boolean matchesAny(java.lang.String regexp, java.lang.String... text)
-
getAllTokenPattern
@Nullable public static @Nullable java.util.regex.Pattern getAllTokenPattern(java.util.Map<java.lang.String,java.lang.String> tokens)
-
getParametersString
public static java.lang.String getParametersString(java.util.List<java.lang.String> paramsTypes, int offset, int mask, com.intellij.util.Function<java.lang.String,java.lang.String> substitutor, com.intellij.util.Function<java.lang.Integer,java.util.List<java.lang.String>> annoProvider, NameShortener shortener)
-
unwrapTypeArgumentForParamList
@NotNull public static @NotNull java.lang.String unwrapTypeArgumentForParamList(java.lang.String type)
-
getGenericClauseString
public static java.lang.String getGenericClauseString(java.util.List<JavaHelper.TypeParameterInfo> genericParameters, NameShortener shortener)
-
getThrowsString
@NotNull public static @NotNull java.lang.String getThrowsString(java.util.List<java.lang.String> exceptionList, NameShortener shortener)
-
textStrategy
public static <T extends com.intellij.psi.PsiElement> gnu.trove.TObjectHashingStrategy<T> textStrategy()
-
-