2016-01-14 19:38:06 -08:00

105 lines
3.1 KiB
Java

// This is a generated file. Not intended for manual editing.
package com.simpleplugin.parser;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import static com.simpleplugin.psi.SimpleTypes.*;
import static com.intellij.lang.parser.GeneratedParserUtilBase.*;
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;
@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
public class SimpleParser implements PsiParser, LightPsiParser {
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 == PROPERTY) {
r = property(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 simpleFile(b, l + 1);
}
/* ********************************************************** */
// property|COMMENT|CRLF
static boolean item_(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "item_")) return false;
boolean r;
Marker m = enter_section_(b);
r = property(b, l + 1);
if (!r) r = consumeToken(b, COMMENT);
if (!r) r = consumeToken(b, CRLF);
exit_section_(b, m, null, r);
return r;
}
/* ********************************************************** */
// (KEY? SEPARATOR VALUE?) | KEY
public static boolean property(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "property")) return false;
if (!nextTokenIs(b, "<property>", KEY, SEPARATOR)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, "<property>");
r = property_0(b, l + 1);
if (!r) r = consumeToken(b, KEY);
exit_section_(b, l, m, PROPERTY, r, false, null);
return r;
}
// KEY? SEPARATOR VALUE?
private static boolean property_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "property_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = property_0_0(b, l + 1);
r = r && consumeToken(b, SEPARATOR);
r = r && property_0_2(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
// KEY?
private static boolean property_0_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "property_0_0")) return false;
consumeToken(b, KEY);
return true;
}
// VALUE?
private static boolean property_0_2(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "property_0_2")) return false;
consumeToken(b, VALUE);
return true;
}
/* ********************************************************** */
// item_*
static boolean simpleFile(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "simpleFile")) return false;
int c = current_position_(b);
while (true) {
if (!item_(b, l + 1)) break;
if (!empty_element_parsed_guard_(b, "simpleFile", c)) break;
c = current_position_(b);
}
return true;
}
}