本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.IDENTIFIER属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.IDENTIFIER属性的具体用法?Java JSTokenTypes.IDENTIFIER怎么用?Java JSTokenTypes.IDENTIFIER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.lang.javascript.JSTokenTypes
的用法示例。
在下文中一共展示了JSTokenTypes.IDENTIFIER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSuppressedFor
@Override
public boolean isSuppressedFor(@NotNull PsiElement element) {
Project project = element.getProject();
DojoSettings settings = ServiceManager.getService(project, DojoSettings.class);
if(!settings.isNeedsMoreDojoEnabled())
{
return super.isSuppressedFor(element);
}
if(element instanceof LeafPsiElement)
{
LeafPsiElement leafPsiElement = (LeafPsiElement) element;
if(leafPsiElement.getElementType() == JSTokenTypes.IDENTIFIER &&
leafPsiElement.getParent() != null &&
leafPsiElement.getParent().getFirstChild() instanceof JSThisExpression)
{
return AttachPointResolver.getGotoDeclarationTargets(element, 0, null).length > 0 || super.isSuppressedFor(element);
}
}
return super.isSuppressedFor(element);
}
示例2: parseBreakStatement
protected void parseBreakStatement(final PsiBuilder builder)
{
StatementParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.BREAK_KEYWORD);
final PsiBuilder.Marker statement = builder.mark();
boolean hasSemanticLineBeforeNextToken = hasSemanticLineBeforeNextToken(builder);
builder.advanceLexer();
if(!hasSemanticLineBeforeNextToken && builder.getTokenType() == JSTokenTypes.IDENTIFIER)
{
builder.advanceLexer();
}
if(builder.getTokenType() == JSTokenTypes.SEMICOLON)
{
builder.advanceLexer();
}
statement.done(JSElementTypes.BREAK_STATEMENT);
}
示例3: parseContinueStatement
protected void parseContinueStatement(final PsiBuilder builder)
{
StatementParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.CONTINUE_KEYWORD);
final PsiBuilder.Marker statement = builder.mark();
boolean hasSemanticLineBeforeNextToken = hasSemanticLineBeforeNextToken(builder);
builder.advanceLexer();
if(!hasSemanticLineBeforeNextToken && builder.getTokenType() == JSTokenTypes.IDENTIFIER)
{
builder.advanceLexer();
}
if(builder.getTokenType() == JSTokenTypes.SEMICOLON)
{
builder.advanceLexer();
}
statement.done(JSElementTypes.CONTINUE_STATEMENT);
}
示例4: expectContextKeyword
@Nullable
public IElementType expectContextKeyword(@NotNull PsiBuilder builder, @NotNull TokenSet tokenSet)
{
if(builder.getTokenType() == JSTokenTypes.IDENTIFIER)
{
IElementType contextKeywordElementType = ContextKeywordCache.getContextKeywordElementType(builder.getTokenText());
if(contextKeywordElementType == null)
{
return null;
}
if(tokenSet.contains(contextKeywordElementType))
{
return contextKeywordElementType;
}
}
return null;
}
示例5: getTokenType
@Nullable
@Override
public IElementType getTokenType()
{
checkStrictMode();
IElementType tokenType = super.getTokenType();
ThreeState threeState = myStrictKeywords.get(tokenType);
if(threeState != null)
{
if(threeState == myStrictState)
{
return tokenType;
}
else
{
int currentOffset = getCurrentOffset();
if(ArrayUtil.indexOf(myDisableNonStrictRemap, currentOffset) != -1)
{
return tokenType;
}
return JSTokenTypes.IDENTIFIER;
}
}
return tokenType;
}
示例6: visitElement
@Override
@RequiredReadAction
public void visitElement(PsiElement element)
{
super.visitElement(element);
PsiElement parent = element.getParent();
IElementType elementType = PsiUtilCore.getElementType(element);
if((JavaScriptTokenSets.STRING_LITERALS.contains(elementType) || elementType == JSTokenTypes.IDENTIFIER) && parent instanceof JSProperty && ((JSProperty) parent).getNameIdentifier() ==
element)
{
highlightPropertyName((JSProperty) parent, element);
}
else if(elementType == JSTokenTypes.IDENTIFIER)
{
addElementHighlight(parent, element);
}
else if(JSTokenTypes.CONTEXT_KEYWORDS.contains(elementType))
{
myHighlightInfoHolder.add(HighlightInfo.newHighlightInfo(HighlightInfoType.INFORMATION).textAttributes(JavaScriptSyntaxHighlightKeys.JS_KEYWORD).range(element).create());
}
}
示例7: expectStaticKeywordExpected
private boolean expectStaticKeywordExpected(PsiBuilder builder)
{
IElementType tokenType = builder.getTokenType();
if(tokenType == JSTokenTypes.STATIC_KEYWORD)
{
builder.advanceLexer();
return true;
}
else if(expectContextKeyword(builder, TokenSet.create(JSTokenTypes.STATIC_KEYWORD)) != null)
{
if(builder.lookAhead(1) == JSTokenTypes.IDENTIFIER)
{
advanceContextKeyword(builder, TokenSet.create(JSTokenTypes.STATIC_KEYWORD));
return true;
}
}
return false;
}
示例8: parseDefaultNsStatement
private void parseDefaultNsStatement(final PsiBuilder builder)
{
EcmaScript4StatementParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.DEFAULT_KEYWORD);
final PsiBuilder.Marker marker = builder.mark();
builder.advanceLexer();
if(builder.getTokenType() == JSTokenTypes.IDENTIFIER && "xml".equals(builder.getTokenText()))
{
builder.advanceLexer();
if(checkMatches(builder, JSTokenTypes.NAMESPACE_KEYWORD, JavaScriptBundle.message("javascript.parser.message.expected.namespace")))
{
if(checkMatches(builder, JSTokenTypes.EQ, JavaScriptBundle.message("javascript.parser.message.expected.equal")))
{
getExpressionParsing().parseExpression(builder);
}
}
}
else
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.xml"));
}
marker.done(JSElementTypes.ASSIGNMENT_EXPRESSION);
}
示例9: parsePackage
private void parsePackage(final PsiBuilder builder)
{
final PsiBuilder.Marker packageMarker = builder.mark();
builder.advanceLexer();
if(builder.getTokenType() == JSTokenTypes.IDENTIFIER)
{
getExpressionParsing().parseQualifiedTypeName(builder);
}
if(builder.getTokenType() != JSTokenTypes.LBRACE)
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.name.or.lbrace"));
}
else
{
parseBlockOrFunctionBody(builder, BlockType.PACKAGE_OR_CLASS_BODY);
}
packageMarker.done(JSElementTypes.PACKAGE_STATEMENT);
}
示例10: getLineMarkerInfo
@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element)
{
if(element.getNode().getElementType() == JSTokenTypes.IDENTIFIER && element.getParent() instanceof JSReferenceExpression && element.getParent().getParent() instanceof JSFunction)
{
UnityFunctionManager functionManager = UnityFunctionManager.getInstance();
Map<String, UnityFunctionManager.FunctionInfo> map = functionManager.getFunctionsByType().get(Unity3dTypes.UnityEngine.MonoBehaviour);
if(map == null)
{
return null;
}
UnityFunctionManager.FunctionInfo functionInfo = map.get(element.getText());
if(functionInfo == null)
{
return null;
}
Unity3dModuleExtension extension = ModuleUtilCore.getExtension(element, Unity3dModuleExtension.class);
if(extension == null)
{
return null;
}
JSFunction jsFunction = (JSFunction) element.getParent().getParent();
if(jsFunction.getParent() instanceof JSFile)
{
if(!isEqualParameters(functionInfo.getParameters(), jsFunction))
{
return null;
}
return new LineMarkerInfo<>(element, element.getTextRange(), Unity3dIcons.EventMethod, Pass.LINE_MARKERS, new ConstantFunction<>(functionInfo.getDescription()), null,
GutterIconRenderer.Alignment.LEFT);
}
}
return null;
}
示例11: parsePrimaryExpression
@Override
public boolean parsePrimaryExpression() {
final IElementType firstToken = builder.getTokenType();
if (firstToken == JSTokenTypes.STRING_LITERAL) {
return parseStringLiteral(firstToken);
}
if (firstToken == JSTokenTypes.IDENTIFIER && builder.lookAhead(1) == JSTokenTypes.AS_KEYWORD) {
return parseAsExpression();
}
return super.parsePrimaryExpression();
}
示例12: parseMainJsFile
public void parseMainJsFile(TreeElement node) {
TreeElement firstChild = node.getFirstChildNode();
if (firstChild != null) {
parseMainJsFile(firstChild);
}
TreeElement nextNode = node.getTreeNext();
if (nextNode != null) {
parseMainJsFile(nextNode);
}
if (node.getElementType() == JSTokenTypes.IDENTIFIER) {
if (node.getText().equals("requirejs") || node.getText().equals("require")) {
TreeElement treeParent = node.getTreeParent();
if (null != treeParent) {
ASTNode firstTreeChild = treeParent.findChildByType(JSElementTypes.OBJECT_LITERAL_EXPRESSION);
TreeElement nextTreeElement = treeParent.getTreeNext();
if (null != firstTreeChild) {
parseRequirejsConfig((TreeElement) firstTreeChild
.getFirstChildNode()
);
} else if (null != nextTreeElement && nextTreeElement.getElementType() == JSTokenTypes.DOT) {
nextTreeElement = nextTreeElement.getTreeNext();
if (null != nextTreeElement && nextTreeElement.getText().equals("config")) {
treeParent = nextTreeElement.getTreeParent();
findAndParseConfig(treeParent);
}
} else {
findAndParseConfig(treeParent);
}
}
}
}
}
示例13: parseParameter
public void parseParameter(@NotNull PsiBuilder builder, @Nullable PsiBuilder.Marker parameterMarker)
{
if(parameterMarker == null)
{
parameterMarker = builder.mark();
}
if(builder.getTokenType() == JSTokenTypes.DOT_DOT_DOT)
{
builder.advanceLexer();
}
if(builder.getTokenType() == JSTokenTypes.IDENTIFIER)
{
builder.advanceLexer();
getExpressionParsing().tryParseType(builder);
if(builder.getTokenType() == JSTokenTypes.EQ)
{
builder.advanceLexer();
getExpressionParsing().parseSimpleExpression(builder);
}
parameterMarker.done(JSElementTypes.FORMAL_PARAMETER);
}
else
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.formal.parameter.name"));
parameterMarker.drop();
}
}
示例14: parseLambdaExpression
private boolean parseLambdaExpression(PsiBuilder builder)
{
PsiBuilder.Marker mark = builder.mark();
IElementType tokenType = builder.getTokenType();
if(tokenType == JSTokenTypes.IDENTIFIER)
{
PsiBuilder.Marker parameterList = builder.mark();
getFunctionParsing().parseParameter(builder, null);
parameterList.done(JSElementTypes.PARAMETER_LIST);
}
else
{
getFunctionParsing().parseParameterList(builder);
}
if(builder.getTokenType() == JSTokenTypes.DARROW)
{
builder.advanceLexer();
}
if(builder.getTokenType() == JSTokenTypes.LBRACE)
{
getStatementParsing().parseBlock(builder);
}
else
{
parseExpression(builder);
}
mark.done(JSElementTypes.LAMBDA_EXPRESSION);
return true;
}
示例15: canParseLambdaExpression
private boolean canParseLambdaExpression(PsiBuilder builder)
{
PsiBuilder.Marker marker = builder.mark();
try
{
IElementType tokenType = builder.getTokenType();
if(tokenType == JSTokenTypes.IDENTIFIER)
{
builder.advanceLexer();
if(builder.getTokenType() == JSTokenTypes.DARROW)
{
return true;
}
}
else if(tokenType == JSTokenTypes.LPAR)
{
getFunctionParsing().parseParameterList(builder);
if(builder.getTokenType() == JSTokenTypes.DARROW)
{
return true;
}
}
return false;
}
finally
{
marker.rollbackTo();
}
}