Java Code Examples for com.intellij.lang.PsiBuilder.remapCurrentToken()

The following are Jave code examples for showing how to use remapCurrentToken() of the com.intellij.lang.PsiBuilder class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: reasonml-idea-plugin   File: RmlParser.java   Source Code and License Vote up 6 votes
private void parseGtAutoClose(PsiBuilder builder, ParserState parserState) {
    if (parserState.currentScope.tokenType == m_types.TAG_PROPERTY) {
        parserState.currentScope.end();
        parserState.scopes.pop();
        parserState.currentScope = parserState.scopes.empty() ? parserState.fileScope : parserState.scopes.peek();
    }

    if (parserState.currentScope.resolution == startTag || parserState.currentScope.resolution == closeTag) {
        builder.remapCurrentToken(m_types.TAG_GT);
        builder.advanceLexer();
        parserState.dontMove = true;

        parserState.currentScope.end();
        parserState.scopes.pop();

        parserState.currentScope = parserState.scopes.empty() ? parserState.fileScope : parserState.scopes.peek();
    }
}
 
Example 2
Project: reasonml-idea-plugin   File: RmlParser.java   Source Code and License Vote up 6 votes
private void parseLt(PsiBuilder builder, ParserState parserState) {
    // Can be a symbol or a JSX tag
    IElementType nextTokenType = builder.rawLookup(1);
    if (nextTokenType == m_types.LIDENT || nextTokenType == m_types.UIDENT) {
        // Surely a tag
        builder.remapCurrentToken(m_types.TAG_LT);
        parserState.currentScope = markScope(builder, parserState.scopes, startTag, m_types.TAG_START, groupExpression, m_types.TAG_LT);
        parserState.currentScope.complete = true;

        builder.advanceLexer();
        parserState.dontMove = true;
        builder.remapCurrentToken(m_types.TAG_NAME);
    } else if (nextTokenType == m_types.SLASH) {
        builder.remapCurrentToken(m_types.TAG_LT);
        parserState.currentScope = markScope(builder, parserState.scopes, closeTag, m_types.TAG_CLOSE, any, m_types.TAG_LT);
        parserState.currentScope.complete = true;
    }
}
 
Example 3
Project: reasonml-idea-plugin   File: OclParser.java   Source Code and License Vote up 6 votes
private void parseLIdent(PsiBuilder builder, ParserState parserState) {
    if (parserState.isCurrentResolution(type)) {
        builder.remapCurrentToken(m_types.TYPE_CONSTR_NAME);
        parserState.currentScope.resolution = typeNamed;
        parserState.currentScope.complete = true;
    } else if (parserState.isCurrentResolution(external)) {
        builder.remapCurrentToken(m_types.VALUE_NAME);
        parserState.currentScope.resolution = externalNamed;
        parserState.currentScope.complete = true;
    } else if (parserState.isCurrentResolution(let)) {
        builder.remapCurrentToken(m_types.VALUE_NAME);
        parserState.dontMove = wrapWith(m_types.VAR_NAME, builder);
        parserState.currentScope.resolution = letNamed;
        parserState.currentScope.complete = true;
    } else if (parserState.isCurrentResolution(val)) {
        builder.remapCurrentToken(m_types.VALUE_NAME);
        parserState.currentScope.resolution = valNamed;
        parserState.currentScope.complete = true;
    } else {
        if (parserState.notCurrentResolution(annotationName)) {
            builder.remapCurrentToken(m_types.VALUE_NAME);
            parserState.dontMove = wrapWith(m_types.VAR_NAME, builder);
        }
    }
}
 
Example 4
Project: reasonml-idea-plugin   File: OclParser.java   Source Code and License Vote up 6 votes
private void parseUIdent(PsiBuilder builder, ParserState parserState) {
    if (parserState.isCurrentResolution(open)) {
        // It is a module name/path
        parserState.currentScope.complete = true;
        builder.remapCurrentToken(m_types.VALUE_NAME);
        parserState.currentScope = markComplete(builder, parserState.scopes, openModulePath, m_types.MODULE_PATH);
        parserState.dontMove = wrapWith(m_types.MODULE_NAME, builder);
    } else if (parserState.isCurrentResolution(include)) {
        // It is a module name/path
        parserState.currentScope.complete = true;
        builder.remapCurrentToken(m_types.MODULE_NAME);
        parserState.currentScope = markComplete(builder, parserState.scopes, openModulePath, m_types.MODULE_PATH);
    } else if (parserState.isCurrentResolution(exception)) {
        parserState.currentScope.complete = true;
        builder.remapCurrentToken(m_types.VALUE_NAME);
        parserState.dontMove = wrapWith(m_types.EXCEPTION_NAME, builder);
        parserState.currentScope.resolution = exceptionNamed;
    } else if (parserState.isCurrentResolution(module)) {
        // Module definition
        builder.remapCurrentToken(m_types.VALUE_NAME);
        parserState.dontMove = wrapWith(m_types.MODULE_NAME, builder);
        parserState.currentScope.resolution = moduleNamed;
    }
}
 
Example 5
Project: reasonml-idea-plugin   File: RmlParser.java   Source Code and License Vote up 5 votes
private void parseLIdent(PsiBuilder builder, ParserState parserState) {
    if (parserState.currentScope.resolution == type) {
        builder.remapCurrentToken(m_types.VALUE_NAME);
        parserState.dontMove = wrapWith(m_types.TYPE_CONSTR_NAME, builder);
        parserState.currentScope.resolution = typeNamed;
        parserState.currentScope.complete = true;
    } else if (parserState.currentScope.resolution == external) {
        builder.remapCurrentToken(m_types.VALUE_NAME);
        parserState.currentScope.resolution = externalNamed;
        parserState.currentScope.complete = true;
    } else if (parserState.currentScope.resolution == let) {
        builder.remapCurrentToken(m_types.VALUE_NAME);
        parserState.dontMove = wrapWith(m_types.VAR_NAME, builder);
        parserState.currentScope.resolution = letNamed;
        parserState.currentScope.complete = true;
    } else if (parserState.currentScope.resolution == startTag) {
        // This is a property
        parserState.end();
        builder.remapCurrentToken(m_types.PROPERTY_NAME);
        parserState.currentScope = markScope(builder, parserState.scopes, tagProperty, m_types.TAG_PROPERTY, groupExpression, m_types.LIDENT);
        parserState.currentScope.complete = true;
    } else {
        if (parserState.notCurrentResolution(annotationName)) {
            builder.remapCurrentToken(m_types.VALUE_NAME);
            parserState.dontMove = wrapWith(m_types.VAR_NAME, builder);
        }
    }
}