本文整理汇总了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);
}
}
}
示例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();
}
示例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);
}
}
示例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();
}
示例5: isNotPropertyStart
public boolean isNotPropertyStart(PsiBuilder builder, IElementType elementType)
{
return !isIdentifierToken(builder, elementType) && !JavaScriptTokenSets.STRING_LITERALS.contains(elementType) && elementType != JSTokenTypes.NUMERIC_LITERAL;
}
示例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;
}
示例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;
}
}