Package org.intellij.grammar.psi

Examples of org.intellij.grammar.psi.BnfFile


  public void testSOEInPrivateMeta() { doTest("private r ::= A <<r>> external A::=", "A+"); }
  public void testSOEInPrivate() { doTest("private r ::= A r external A::=", "A+"); }

  private void doTest(String text, String... expected) {
    BnfFile f = (BnfFile)myFixture.configureByText("a.bnf", text);
    List<BnfRule> rules = f.getRules();
    assertFalse(rules.isEmpty());
    RuleGraphHelper helper = new RuleGraphHelper(f);
    Map<PsiElement,RuleGraphHelper.Cardinality> map = helper.getFor(rules.get(0));
    Collection<BnfRule> sortedPublicRules = ParserGeneratorUtil.getSortedPublicRules(map.keySet());
    Collection<BnfExpression> sortedTokens = ParserGeneratorUtil.getSortedTokens(map.keySet());
View Full Code Here


    return true;
  }

  public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
    if (file instanceof BnfFile) {
      BnfFile bnfFile = (BnfFile)file;
      ExpressionHelper expressionHelper = ExpressionHelper.getCached(bnfFile);
      BnfFirstNextAnalyzer analyzer = new BnfFirstNextAnalyzer();
      ArrayList<ProblemDescriptor> list = new ArrayList<ProblemDescriptor>();
      for (BnfRule rule : bnfFile.getRules()) {
        String ruleName = rule.getName();
        boolean exprParsing = ExpressionGeneratorHelper.getInfoForExpressionParsing(expressionHelper, rule) != null;

        if (!exprParsing && analyzer.asStrings(analyzer.calcFirst(rule)).contains(ruleName)) {
          list.add(manager.createProblemDescriptor(rule.getId(), "'" + ruleName + "' employs left-recursion unsupported by generator",
View Full Code Here

    return problemsHolder.getResultsArray();
  }
 
  private static void checkFile(final PsiFile file, final ProblemsHolder problemsHolder) {
    if (!(file instanceof BnfFile)) return;
    final BnfFile bnfFile = (BnfFile)file;

    final Set<BnfRule> rules = new THashSet<BnfRule>();
    GrammarUtil.processChildrenDummyAware(file, new Processor<PsiElement>() {
      @Override
      public boolean process(PsiElement psiElement) {
        String name = psiElement instanceof BnfRule ? ((BnfRule)psiElement).getName() : null;
        BnfRule rule = name == null? null : bnfFile.getRule(name);
        if (name != null && rule != psiElement) {
          rules.add(rule);
          rules.add((BnfRule)psiElement);
        }
        return true;
View Full Code Here

TOP

Related Classes of org.intellij.grammar.psi.BnfFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.