本文整理汇总了Java中com.intellij.lang.javascript.JSTokenTypes.LPAR属性的典型用法代码示例。如果您正苦于以下问题:Java JSTokenTypes.LPAR属性的具体用法?Java JSTokenTypes.LPAR怎么用?Java JSTokenTypes.LPAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.lang.javascript.JSTokenTypes
的用法示例。
在下文中一共展示了JSTokenTypes.LPAR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseLetExpressionStart
PsiBuilder.Marker parseLetExpressionStart(final PsiBuilder builder)
{
StatementParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.LET_KEYWORD);
final PsiBuilder.Marker marker = builder.mark();
builder.advanceLexer();
if(builder.getTokenType() == JSTokenTypes.LPAR)
{
builder.advanceLexer();
if(getExpressionParsing().parseAssignmentExpression(builder))
{
while(builder.getTokenType() == JSTokenTypes.COMMA)
{
builder.advanceLexer();
if(!getExpressionParsing().parseAssignmentExpression(builder))
{
break;
}
}
}
Parsing.checkMatches(builder, JSTokenTypes.RPAR, JavaScriptBundle.message("javascript.parser.message.expected.rparen"));
}
return marker;
}
示例2: visitParameterList
@Override
public void visitParameterList(final ASTNode node)
{
if(type1 == JSTokenTypes.LPAR && type2 == JSTokenTypes.RPAR)
{
setSingleSpace(false);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_METHOD_PARENTHESES);
}
else if(type1 == JSTokenTypes.COMMA)
{
setSingleSpace(mySettings.SPACE_AFTER_COMMA);
}
else if(type2 == JSTokenTypes.COMMA)
{
setSingleSpace(mySettings.SPACE_BEFORE_COMMA);
}
}
示例3: visitIfStatement
@Override
public void visitIfStatement(final ASTNode node)
{
if(type1 == JSTokenTypes.IF_KEYWORD && type2 == JSTokenTypes.LPAR)
{
setSingleSpace(mySettings.SPACE_BEFORE_IF_PARENTHESES);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_IF_PARENTHESES);
}
else if(type1 == JSTokenTypes.RPAR && type2 == JSElementTypes.BLOCK_STATEMENT)
{
TextRange dependentRange = new TextRange(myParent.getStartOffset(), myChild1.getTextRange().getEndOffset());
setBraceSpace(mySettings.SPACE_BEFORE_IF_LBRACE, mySettings.BRACE_STYLE, dependentRange);
}
else if(type2 == JSTokenTypes.ELSE_KEYWORD)
{
setLineBreakSpace(mySettings.ELSE_ON_NEW_LINE);
}
else if(type1 == JSTokenTypes.ELSE_KEYWORD && type2 == JSElementTypes.BLOCK_STATEMENT)
{
setBraceSpace(mySettings.SPACE_BEFORE_ELSE_LBRACE, mySettings.BRACE_STYLE, null);
}
}
示例4: visitForStatement
@Override
public void visitForStatement(final ASTNode node)
{
if(type1 == JSTokenTypes.SEMICOLON)
{
setSingleSpace(true);
}
else if(type2 == JSTokenTypes.SEMICOLON)
{
setSingleSpace(mySettings.SPACE_BEFORE_SEMICOLON);
}
if(type1 == JSTokenTypes.FOR_KEYWORD && type2 == JSTokenTypes.LPAR)
{
setSingleSpace(mySettings.SPACE_BEFORE_FOR_PARENTHESES);
}
else if(type1 == JSTokenTypes.RPAR && type2 == JSElementTypes.BLOCK_STATEMENT)
{
TextRange dependentRange = new TextRange(myParent.getStartOffset(), myChild1.getTextRange().getEndOffset());
setBraceSpace(mySettings.SPACE_BEFORE_FOR_LBRACE, mySettings.BRACE_STYLE, dependentRange);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_FOR_PARENTHESES);
}
}
示例5: visitDoWhileStatement
@Override
public void visitDoWhileStatement(final ASTNode node)
{
if(type2 == JSTokenTypes.WHILE_KEYWORD)
{
if(mySettings.WHILE_ON_NEW_LINE)
{
myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
}
else
{
myResult = Spacing.createSpacing(1, 1, 0, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
}
}
else if(type2 == JSTokenTypes.LPAR)
{
setSingleSpace(mySettings.SPACE_BEFORE_WHILE_PARENTHESES);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_WHILE_PARENTHESES);
}
}
示例6: visitForInStatement
@Override
public void visitForInStatement(final ASTNode node)
{
if(type1 == JSTokenTypes.VAR_KEYWORD || type2 == JSTokenTypes.VAR_KEYWORD)
{
setSingleSpace(true);
}
else if(type1 == JSTokenTypes.FOR_KEYWORD && type2 == JSTokenTypes.LPAR)
{
setSingleSpace(mySettings.SPACE_BEFORE_FOR_PARENTHESES);
}
else if(type1 == JSTokenTypes.RPAR && type2 == JSElementTypes.BLOCK_STATEMENT)
{
TextRange dependentRange = new TextRange(myParent.getStartOffset(), myChild1.getTextRange().getEndOffset());
setBraceSpace(mySettings.SPACE_BEFORE_FOR_LBRACE, mySettings.BRACE_STYLE, dependentRange);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_FOR_PARENTHESES);
}
}
示例7: visitWhileStatement
@Override
public void visitWhileStatement(final ASTNode node)
{
if(type1 == JSTokenTypes.WHILE_KEYWORD && type2 == JSTokenTypes.LPAR)
{
setSingleSpace(mySettings.SPACE_BEFORE_WHILE_PARENTHESES);
}
else if(type1 == JSTokenTypes.RPAR && type2 == JSElementTypes.BLOCK_STATEMENT)
{
TextRange dependentRange = new TextRange(myParent.getStartOffset(), myChild1.getTextRange().getEndOffset());
setBraceSpace(mySettings.SPACE_BEFORE_WHILE_LBRACE, mySettings.BRACE_STYLE, dependentRange);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_WHILE_PARENTHESES);
}
}
示例8: visitWithStatement
@Override
public void visitWithStatement(final ASTNode node)
{
if(type1 == JSTokenTypes.WITH_KEYWORD && type2 == JSTokenTypes.LPAR)
{
setSingleSpace(mySettings.SPACE_BEFORE_WHILE_PARENTHESES);
}
else if(type1 == JSTokenTypes.RPAR && type2 == JSElementTypes.BLOCK_STATEMENT)
{
TextRange dependentRange = new TextRange(myParent.getStartOffset(), myChild1.getTextRange().getEndOffset());
setBraceSpace(mySettings.SPACE_BEFORE_WHILE_LBRACE, mySettings.BRACE_STYLE, dependentRange);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_WHILE_PARENTHESES);
}
}
示例9: visitSwitchStatement
@Override
public void visitSwitchStatement(final ASTNode node)
{
if(type1 == JSTokenTypes.SWITCH_KEYWORD && type2 == JSTokenTypes.LPAR)
{
setSingleSpace(mySettings.SPACE_BEFORE_SWITCH_PARENTHESES);
}
else if(type1 == JSTokenTypes.RPAR)
{
TextRange dependentRange = new TextRange(myParent.getStartOffset(), myChild1.getTextRange().getEndOffset());
setBraceSpace(mySettings.SPACE_BEFORE_SWITCH_LBRACE, mySettings.BRACE_STYLE, dependentRange);
}
else if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_SWITCH_PARENTHESES);
}
}
示例10: visitArgumentList
@Override
public void visitArgumentList(final ASTNode node)
{
if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(false);
}
else if(type1 == JSTokenTypes.COMMA)
{
setSingleSpace(mySettings.SPACE_AFTER_COMMA);
}
else if(type2 == JSTokenTypes.COMMA)
{
setSingleSpace(mySettings.SPACE_BEFORE_COMMA);
}
}
示例11: parseNamespaceNoMarker
private boolean parseNamespaceNoMarker(final PsiBuilder builder, final @NotNull PsiBuilder.Marker useNSStatement)
{
EcmaScript4StatementParsing.LOGGER.assertTrue(builder.getTokenType() == JSTokenTypes.NAMESPACE_KEYWORD);
builder.advanceLexer();
if(builder.getTokenType() == JSTokenTypes.LPAR)
{
useNSStatement.rollbackTo();
return false;
}
if(!getExpressionParsing().parseQualifiedTypeName(builder))
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.typename"));
}
if(builder.getTokenType() == JSTokenTypes.EQ)
{
builder.advanceLexer();
checkMatches(builder, JSTokenTypes.STRING_LITERAL, JavaScriptBundle.message("javascript.parser.message.expected.string.literal"));
}
checkForSemicolon(builder);
useNSStatement.done(JSElementTypes.NAMESPACE_DECLARATION);
return true;
}
示例12: EmberJSParser
public EmberJSParser(PsiBuilder builder) {
super(JavaScriptSupportLoader.JAVASCRIPT_1_5, builder);
myExpressionParser = new EmberJSExpressionParser();
myStatementParser = new StatementParser<EmberJSParser>(this) {
@Override
protected void doParseStatement(boolean canHaveClasses) {
final IElementType firstToken = builder.getTokenType();
if (firstToken == JSTokenTypes.LBRACE) {
parseExpressionStatement();
checkForSemicolon();
return;
}
if (isIdentifierToken(firstToken)) {
final IElementType nextToken = builder.lookAhead(1);
if (nextToken == JSTokenTypes.IN_KEYWORD) {
parseInStatement();
return;
}
}
if (builder.getTokenType() == JSTokenTypes.LPAR) {
if (parseInStatement()) {
return;
}
}
super.doParseStatement(canHaveClasses);
}
private boolean parseInStatement() {
PsiBuilder.Marker statement = builder.mark();
if (!getExpressionParser().parseInExpression()) {
statement.drop();
return false;
}
statement.done(JSElementTypes.EXPRESSION_STATEMENT);
return true;
}
};
}
示例13: visitCatchBlock
@Override
public void visitCatchBlock(final ASTNode node)
{
if(type1 == JSTokenTypes.LPAR || type2 == JSTokenTypes.RPAR)
{
setSingleSpace(mySettings.SPACE_WITHIN_CATCH_PARENTHESES);
}
if(type2 == JSElementTypes.BLOCK_STATEMENT)
{
TextRange dependentRange = new TextRange(myParent.getStartOffset(), myChild2.getTextRange().getStartOffset());
setBraceSpace(mySettings.SPACE_BEFORE_CATCH_LBRACE, mySettings.BRACE_STYLE, dependentRange);
}
}
示例14: 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();
}
}
示例15: parseFunctionNoMarker
public void parseFunctionNoMarker(final PsiBuilder builder, final boolean expressionContext, final @NotNull PsiBuilder.Marker functionMarker)
{
if(builder.getTokenType() == JSTokenTypes.FUNCTION_KEYWORD)
{ // function keyword may be ommited in context of get/set property definition
builder.advanceLexer();
}
// Function name
final IElementType tokenType = builder.getTokenType();
if(!expressionContext && (tokenType == JSTokenTypes.GET_KEYWORD || tokenType == JSTokenTypes.SET_KEYWORD))
{
builder.advanceLexer();
}
if(isIdentifierName(builder, builder.getTokenType()))
{
getExpressionParsing().parseQualifiedTypeName(builder, false);
}
else
{
if(!expressionContext && builder.getTokenType() != JSTokenTypes.LPAR /*get/set as name*/)
{
builder.error(JavaScriptBundle.message("javascript.parser.message.expected.function.name"));
}
}
parseParameterList(builder);
getExpressionParsing().tryParseType(builder);
if(builder.getTokenType() == JSTokenTypes.SEMICOLON)
{
builder.advanceLexer();
}
else
{
getStatementParsing().parseFunctionBody(builder);
}
functionMarker.done(expressionContext ? JSElementTypes.FUNCTION_EXPRESSION : JSElementTypes.FUNCTION_DECLARATION);
}