Adds src/main/grammar/Jai.bnf, the generated parser/PSI in src/main/gen, a
JaiParserDefinition, and the Tier 3 corpus parse gate (406/714 files clean).
Two things were not obvious:
- Grammar-Kit mints its own token instances from the .bnf 'tokens' block, which
are different objects from the ones JaiLexer emits, so every rule silently
failed to match. Fixed with tokenTypeFactory -> JaiTokenTypes.byName.
- A backslash inside an identifier is a continuation in the compiler's lexer
(Jai_Lexer/module.jai:444): 'left\_margin' is one identifier. JaiLexer now
does the same; the Tier 0 round-trip still holds because the token span
covers the backslash and the skipped spaces.
Constructs that BNF alone cannot express live in JaiParserUtil: directive-name
tests (#ident is one token), '==' before '{' for the switch form, procedure
header vs parenthesised expression, and the declaration lookahead.
43 lines
1.1 KiB
Java
43 lines
1.1 KiB
Java
// This is a generated file. Not intended for manual editing.
|
|
package dev.hgh.jai.psi.impl;
|
|
|
|
import java.util.List;
|
|
import org.jetbrains.annotations.*;
|
|
import com.intellij.lang.ASTNode;
|
|
import com.intellij.psi.PsiElement;
|
|
import com.intellij.psi.PsiElementVisitor;
|
|
import com.intellij.psi.util.PsiTreeUtil;
|
|
import static dev.hgh.jai.psi.JaiTypes.*;
|
|
import com.intellij.extapi.psi.ASTWrapperPsiElement;
|
|
import dev.hgh.jai.psi.*;
|
|
|
|
public class JaiCaseClauseImpl extends ASTWrapperPsiElement implements JaiCaseClause {
|
|
|
|
public JaiCaseClauseImpl(@NotNull ASTNode node) {
|
|
super(node);
|
|
}
|
|
|
|
public void accept(@NotNull JaiVisitor visitor) {
|
|
visitor.visitCaseClause(this);
|
|
}
|
|
|
|
@Override
|
|
public void accept(@NotNull PsiElementVisitor visitor) {
|
|
if (visitor instanceof JaiVisitor) accept((JaiVisitor)visitor);
|
|
else super.accept(visitor);
|
|
}
|
|
|
|
@Override
|
|
@Nullable
|
|
public JaiExpr getExpr() {
|
|
return findChildByClass(JaiExpr.class);
|
|
}
|
|
|
|
@Override
|
|
@NotNull
|
|
public List<JaiStatement> getStatementList() {
|
|
return PsiTreeUtil.getChildrenOfTypeAsList(this, JaiStatement.class);
|
|
}
|
|
|
|
}
|