Package com.intellij.lang

Examples of com.intellij.lang.ParserDefinition


    return new HbFileViewProvider(getManager(), virtualFile, false, myBaseLanguage, myTemplateLanguage);
  }

  @Override
  protected PsiFile createFile(@NotNull Language lang) {
    ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
    if (parserDefinition == null) {
      return null;
    }

    if (lang == getTemplateDataLanguage()) {
      PsiFileImpl file = (PsiFileImpl)parserDefinition.createFile(this);
      file.setContentElementType(TEMPLATE_DATA_ELEMENT_TYPE);
      return file;
    }
    else if (lang == HbLanguage.INSTANCE) {
      return parserDefinition.createFile(this);
    }
    else {
      return null;
    }
  }
View Full Code Here


        /*DBLanguageFile originalFile = (DBLanguageFile) file.getViewProvider().getAllFiles().get(0).getOriginalFile();
        if (originalFile != null)  file = originalFile;*/

        String text = chameleon.getText();
        ParserDefinition parserDefinition = languageDialect.getParserDefinition();
        Lexer lexer = parserDefinition.createLexer(project);

        DBLanguageParser parser = (DBLanguageParser) parserDefinition.createParser(project);

        PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, lexer, languageDialect, text);
        ASTNode node = parser.parse(this, builder, file.getParseRootId());
        return node.getFirstChildNode();
    }
View Full Code Here

    return new HbFileViewProvider(getManager(), virtualFile, false, myBaseLanguage, myTemplateLanguage);
  }

  @Override
  protected PsiFile createFile(@NotNull Language lang) {
    ParserDefinition parserDefinition = getDefinition(lang);
    if (parserDefinition == null) {
      return null;
    }

    if (lang.is(getTemplateDataLanguage())) {
      PsiFileImpl file = (PsiFileImpl)parserDefinition.createFile(this);
      file.setContentElementType(getTemplateDataElementType(getBaseLanguage()));
      return file;
    }
    else if (lang.isKindOf(getBaseLanguage())) {
      return parserDefinition.createFile(this);
    }
    else {
      return null;
    }
  }
View Full Code Here

      return null;
    }
  }

  private ParserDefinition getDefinition(Language lang) {
    ParserDefinition parserDefinition;
    if (lang.isKindOf(getBaseLanguage())) {
      parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(lang.is(getBaseLanguage()) ? lang : getBaseLanguage());
    } else {
      parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
    }
View Full Code Here

    initLanguage(language);
  }

  private void initLanguage(final Language language) {
    myLanguage = language;
    final ParserDefinition parserDefinition = language.getParserDefinition();
    if (parserDefinition == null) {
      throw new RuntimeException("PsiFileBase: language.getParserDefinition() returned null.");
    }
    myParserDefinition = parserDefinition;
    final IFileElementType nodeType = parserDefinition.getFileNodeType();
    init(nodeType, nodeType);
  }
View Full Code Here

  private PsiFile mySourceFile;

  public MetadataPsiFileBase(FileViewProvider provider, @NotNull Language language) {
    super(provider);
    myLanguage = language;
    final ParserDefinition parserDefinition = language.getParserDefinition();
    if (parserDefinition == null) {
      throw new RuntimeException("PsiFileBase: language.getParserDefinition() returned null.");
    }
    myParserDefinition = parserDefinition;
    final IFileElementType nodeType = parserDefinition.getFileNodeType();
    init(nodeType, nodeType);
  }
View Full Code Here

TOP

Related Classes of com.intellij.lang.ParserDefinition

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.