protected void parseTopLevel() {
    while (!myBuilder.eof() && LA_DECL.contains(currentToken())) {
      parseDecl(myBuilder);
    }

    if (LA_GRAMMAR_CONTENT.contains(currentToken())) {
      final PsiBuilder.Marker marker = myBuilder.mark();
      parseGrammarContents();
      marker.done(RncElementTypes.GRAMMAR_PATTERN);
    } else if (currentToken() == KEYWORD_GRAMMAR) {
      parsePattern();
    } else {
      final PsiBuilder.Marker marker = myBuilder.mark();
      while (!myBuilder.eof()) {
        if (!parsePattern()) {
          break;
        }
      }
      marker.done(RncElementTypes.GRAMMAR_PATTERN);
    }
  }
protected void parseTopLevel()