com.jetbrains.commandInterface.commandLine.CommandLineParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of python-community Show documentation
Show all versions of python-community Show documentation
A packaging of the IntelliJ Community Edition python-community library.
This is release number 1 of trunk branch 142.
The newest version!
// This is a generated file. Not intended for manual editing.
package com.jetbrains.commandInterface.commandLine;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import static com.jetbrains.commandInterface.commandLine.CommandLineElementTypes.*;
import static com.jetbrains.commandInterface.commandLine.CommandLineParserUtil.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.lang.ASTNode;
import com.intellij.psi.tree.TokenSet;
import com.intellij.lang.PsiParser;
@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
public class CommandLineParser implements PsiParser {
public ASTNode parse(IElementType t, PsiBuilder b) {
parseLight(t, b);
return b.getTreeBuilt();
}
public void parseLight(IElementType t, PsiBuilder b) {
boolean r;
b = adapt_builder_(t, b, this, null);
Marker m = enter_section_(b, 0, _COLLAPSE_, null);
if (t == ARGUMENT) {
r = argument(b, 0);
}
else if (t == COMMAND) {
r = command(b, 0);
}
else if (t == OPTION) {
r = option(b, 0);
}
else {
r = parse_root_(t, b, 0);
}
exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
}
protected boolean parse_root_(IElementType t, PsiBuilder b, int l) {
return root(b, l + 1);
}
/* ********************************************************** */
// LITERAL_STARTS_FROM_LETTER | LITERAL_STARTS_FROM_DIGIT
public static boolean argument(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "argument")) return false;
if (!nextTokenIs(b, "", LITERAL_STARTS_FROM_DIGIT, LITERAL_STARTS_FROM_LETTER)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, "");
r = consumeToken(b, LITERAL_STARTS_FROM_LETTER);
if (!r) r = consumeToken(b, LITERAL_STARTS_FROM_DIGIT);
exit_section_(b, l, m, ARGUMENT, r, false, null);
return r;
}
/* ********************************************************** */
// LITERAL_STARTS_FROM_LETTER
public static boolean command(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "command")) return false;
if (!nextTokenIs(b, LITERAL_STARTS_FROM_LETTER)) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, LITERAL_STARTS_FROM_LETTER);
exit_section_(b, m, COMMAND, r);
return r;
}
/* ********************************************************** */
// LONG_OPTION_NAME_TOKEN
static boolean long_option_name(PsiBuilder b, int l) {
return consumeToken(b, LONG_OPTION_NAME_TOKEN);
}
/* ********************************************************** */
// short_option_name <> ? | long_option_name <> ?
public static boolean option(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "option")) return false;
if (!nextTokenIs(b, "
© 2015 - 2025 Weber Informatics LLC | Privacy Policy