当前位置: 首页>>代码示例>>Java>>正文


Java JSTokenTypes.NUMERIC_LITERAL属性代码示例

本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.NUMERIC_LITERAL属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.NUMERIC_LITERAL属性的具体用法?Java JSTokenTypes.NUMERIC_LITERAL怎么用?Java JSTokenTypes.NUMERIC_LITERAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.lang.javascript.JSTokenTypes的用法示例。


在下文中一共展示了JSTokenTypes.NUMERIC_LITERAL属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitJSLiteralExpression

@Override
@RequiredReadAction
public void visitJSLiteralExpression(JSSimpleLiteralExpression node)
{
	super.visitJSLiteralExpression(node);
	if(node.getLiteralElementType() == JSTokenTypes.NUMERIC_LITERAL)
	{
		String text = node.getText();
		if(StringUtil.startsWithIgnoreCase(text, "0o"))
		{
			reportFeatureUsage(node, JavaScriptFeature.OCTAL_LITERAL);
		}
		else if(StringUtil.startsWithIgnoreCase(text, "0b"))
		{
			reportFeatureUsage(node, JavaScriptFeature.BINARY_LITERAL);
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:18,代码来源:JavaScriptHighlightVisitor.java

示例2: parseValue

@RequiredReadAction
@Override
@SuppressWarnings("unchecked")
public T parseValue(@NotNull Class type, @NotNull Type genericType, @NotNull PsiElement value) throws JomBadValueExpressionException
{
	if(value instanceof JSLiteralExpression)
	{
		IElementType elementType = PsiUtilCore.getElementType(value.getFirstChild());
		if(elementType == JSTokenTypes.NUMERIC_LITERAL)
		{
			try
			{
				return (T) myParseMethodValue.getValue().invoke(null, value.getText());
			}
			catch(Exception e)
			{
				throw new JomBadValueExpressionException(e);
			}
		}
	}

	throw new JomBadValueExpressionException();
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:23,代码来源:JomNullableNumberValue.java

示例3: getTypeFromConstant

private static void getTypeFromConstant(final JSExpression rawqualifier, TypeProcessor typeProcessor, EvaluateContext context)
{
	final ASTNode childNode = rawqualifier.getNode().getFirstChildNode();
	IElementType constantType = childNode.getElementType();

	String type = JavaScriptTokenSets.STRING_LITERALS.contains(constantType) ? STRING_TYPE_NAME :
			constantType == JSTokenTypes.NUMERIC_LITERAL ? NUMBER_TYPE_NAME : constantType == JSTokenTypes.REGEXP_LITERAL ? REG_EXP_TYPE_NAME : constantType
					== JSTokenTypes.XML_START_TAG_START ? XML_TYPE_NAME : constantType == JSTokenTypes.XML_START_TAG_LIST ? XML_LIST_TYPE_NAME : constantType ==
					JSTokenTypes.TRUE_KEYWORD || constantType == JSTokenTypes.FALSE_KEYWORD ? BOOLEAN_TYPE_NAME : null;

	if(type == NUMBER_TYPE_NAME && typeProcessor.ecma())
	{
		final String text = childNode.getText();
		if(text.indexOf('.') == -1)
		{
			type = INT_TYPE;
		}
	}

	if(type != null)
	{
		addType(type, typeProcessor, context, rawqualifier);
	}
	else
	{
		typeProcessor.setUnknownElement(rawqualifier);
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:28,代码来源:BaseJSSymbolProcessor.java

示例4: getType

@RequiredReadAction
@NotNull
@Override
public JavaScriptType getType()
{
	IElementType literalElementType = getLiteralElementType();
	if(literalElementType == JSTokenTypes.TRUE_KEYWORD || literalElementType == JSTokenTypes.FALSE_KEYWORD)
	{
		return JavaScriptPrimitiveType.BOOL;
	}
	else if(literalElementType == JSTokenTypes.REGEXP_LITERAL)
	{
		return JavaScriptPrimitiveType.REGEXP;
	}
	else if(literalElementType == JSTokenTypes.NUMERIC_LITERAL)
	{
		return JavaScriptPrimitiveType.NUMBER;
	}
	else if(literalElementType == JSTokenTypes.NULL_KEYWORD)
	{
		return JavaScriptPrimitiveType.NULL;
	}
	else if(JavaScriptTokenSets.STRING_LITERALS.contains(literalElementType))
	{
		return JavaScriptPrimitiveType.STRING;
	}
	return super.getType();
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:28,代码来源:JSLiteralExpressionImpl.java

示例5: isNotPropertyStart

public boolean isNotPropertyStart(PsiBuilder builder, IElementType elementType)
{
	return !isIdentifierToken(builder, elementType) && !JavaScriptTokenSets.STRING_LITERALS.contains(elementType) && elementType != JSTokenTypes.NUMERIC_LITERAL;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:4,代码来源:ExpressionParsing.java

示例6: isNotPropertyStart

public static boolean isNotPropertyStart(final IElementType elementType)
{
	return !JSTokenTypes.IDENTIFIER_TOKENS_SET.contains(elementType) && !JavaScriptTokenSets.STRING_LITERALS.contains(elementType) && elementType != JSTokenTypes.NUMERIC_LITERAL;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:4,代码来源:JsonJavaScriptParser.java

示例7: parseValue

private boolean parseValue(PsiBuilder builder)
{
	final IElementType firstToken = builder.getTokenType();
	if(firstToken == JSTokenTypes.NUMERIC_LITERAL ||
			firstToken == JSTokenTypes.STRING_LITERAL ||
			firstToken == JSTokenTypes.SINGLE_QUOTE_STRING_LITERAL ||
			firstToken == JSTokenTypes.NULL_KEYWORD ||
			firstToken == JSTokenTypes.FALSE_KEYWORD ||
			firstToken == JSTokenTypes.TRUE_KEYWORD)
	{
		String errorMessage = ExpressionParsing.validateLiteral(builder);
		Parsing.buildTokenElement(JSElementTypes.LITERAL_EXPRESSION, builder);
		if(errorMessage != null)
		{
			builder.error(errorMessage);
		}
		return true;
	}
	if(firstToken == JSTokenTypes.LBRACKET)
	{
		parseArrayLiteralExpression(builder);
		return true;
	}
	else if(firstToken == JSTokenTypes.MINUS)
	{
		PsiBuilder.Marker marker = builder.mark();
		builder.advanceLexer();
		if(builder.getTokenType() == JSTokenTypes.NUMERIC_LITERAL)
		{
			builder.advanceLexer();
			marker.done(JSElementTypes.PREFIX_EXPRESSION);
		}
		else
		{
			marker.error("Unexpected token");
		}
		return true;
	}
	else if(firstToken == JSTokenTypes.LBRACE)
	{
		parseObjectLiteralExpression(builder);
		return true;
	}
	else
	{
		return false;
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:48,代码来源:JsonJavaScriptParser.java


注:本文中的com.intellij.lang.javascript.JSTokenTypes.NUMERIC_LITERAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。