app.cash.sqldelight.dialects.sqlite_3_30.grammar.SqliteParser Maven / Gradle / Ivy
// This is a generated file. Not intended for manual editing.
package app.cash.sqldelight.dialects.sqlite_3_30.grammar;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import static app.cash.sqldelight.dialects.sqlite_3_30.grammar.psi.SqliteTypes.*;
import static app.cash.sqldelight.dialects.sqlite_3_30.grammar.SqliteParserUtil.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.lang.ASTNode;
import com.intellij.psi.tree.TokenSet;
import com.intellij.lang.PsiParser;
import com.intellij.lang.LightPsiParser;
import static com.alecstrong.sql.psi.core.SqlParser.*;
import static com.alecstrong.sql.psi.core.SqlParserUtil.collationNameExt;
import static com.alecstrong.sql.psi.core.psi.SqlTypes.COLLATE;
import static com.alecstrong.sql.psi.core.psi.SqlTypes.ASC;
import static com.alecstrong.sql.psi.core.psi.SqlTypes.DESC;
@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
public class SqliteParser implements PsiParser, LightPsiParser {
public ASTNode parse(IElementType root_, PsiBuilder builder_) {
parseLight(root_, builder_);
return builder_.getTreeBuilt();
}
public void parseLight(IElementType root_, PsiBuilder builder_) {
boolean result_;
builder_ = adapt_builder_(root_, builder_, this, null);
Marker marker_ = enter_section_(builder_, 0, _COLLAPSE_, null);
result_ = parse_root_(root_, builder_);
exit_section_(builder_, 0, marker_, root_, result_, true, TRUE_CONDITION);
}
protected boolean parse_root_(IElementType root_, PsiBuilder builder_) {
return parse_root_(root_, builder_, 0);
}
static boolean parse_root_(IElementType root_, PsiBuilder builder_, int level_) {
return root(builder_, level_ + 1);
}
/* ********************************************************** */
// <> [ COLLATE <>>> ] [ ASC | DESC ] [ 'NULLS' ( 'FIRST' | 'LAST' ) ]
public static boolean ordering_term_real(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ordering_term_real")) return false;
boolean result_;
Marker marker_ = enter_section_(builder_, level_, _COLLAPSE_, ORDERING_TERM, "");
result_ = expr(builder_, level_ + 1, -1);
result_ = result_ && ordering_term_real_1(builder_, level_ + 1);
result_ = result_ && ordering_term_real_2(builder_, level_ + 1);
result_ = result_ && ordering_term_real_3(builder_, level_ + 1);
exit_section_(builder_, level_, marker_, result_, false, null);
return result_;
}
// [ COLLATE <>>> ]
private static boolean ordering_term_real_1(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ordering_term_real_1")) return false;
ordering_term_real_1_0(builder_, level_ + 1);
return true;
}
// COLLATE <>>>
private static boolean ordering_term_real_1_0(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ordering_term_real_1_0")) return false;
boolean result_;
Marker marker_ = enter_section_(builder_);
result_ = consumeToken(builder_, COLLATE);
result_ = result_ && collationNameExt(builder_, level_ + 1, ordering_term_real_1_0_1_0_parser_);
exit_section_(builder_, marker_, null, result_);
return result_;
}
// [ ASC | DESC ]
private static boolean ordering_term_real_2(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ordering_term_real_2")) return false;
ordering_term_real_2_0(builder_, level_ + 1);
return true;
}
// ASC | DESC
private static boolean ordering_term_real_2_0(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ordering_term_real_2_0")) return false;
boolean result_;
result_ = consumeToken(builder_, ASC);
if (!result_) result_ = consumeToken(builder_, DESC);
return result_;
}
// [ 'NULLS' ( 'FIRST' | 'LAST' ) ]
private static boolean ordering_term_real_3(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ordering_term_real_3")) return false;
ordering_term_real_3_0(builder_, level_ + 1);
return true;
}
// 'NULLS' ( 'FIRST' | 'LAST' )
private static boolean ordering_term_real_3_0(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ordering_term_real_3_0")) return false;
boolean result_;
Marker marker_ = enter_section_(builder_);
result_ = consumeToken(builder_, "NULLS");
result_ = result_ && ordering_term_real_3_0_1(builder_, level_ + 1);
exit_section_(builder_, marker_, null, result_);
return result_;
}
// 'FIRST' | 'LAST'
private static boolean ordering_term_real_3_0_1(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ordering_term_real_3_0_1")) return false;
boolean result_;
result_ = consumeToken(builder_, "FIRST");
if (!result_) result_ = consumeToken(builder_, "LAST");
return result_;
}
/* ********************************************************** */
// <>
public static boolean overrides_real(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "overrides_real")) return false;
boolean result_;
Marker marker_ = enter_section_(builder_, level_, _COLLAPSE_, OVERRIDES, "");
result_ = orderingTermExt(builder_, level_ + 1, SqliteParser::ordering_term_real);
exit_section_(builder_, level_, marker_, result_, false, null);
return result_;
}
/* ********************************************************** */
// <>
static boolean root(PsiBuilder builder_, int level_) {
return overridesExt(builder_, level_ + 1, SqliteParser::overrides_real);
}
static final Parser ordering_term_real_1_0_1_0_parser_ = (builder_, level_) -> collation_name_real(builder_, level_ + 1);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy