Java 类com.intellij.lang.dtd.DTDLanguage 实例源码

项目:intellij-ce-playground    文件:XmlNSDescriptorImpl.java   
@Override
public void validate(@NotNull XmlDocument document, @NotNull ValidationHost host) {
  if (document.getLanguage() == DTDLanguage.INSTANCE) {
    final List<XmlElementDecl> decls = new ArrayList<XmlElementDecl>(3);

    XmlUtil.processXmlElements(document, new PsiElementProcessor() {
      @Override
      public boolean execute(@NotNull final PsiElement element) {
        if (element instanceof XmlElementDecl) decls.add((XmlElementDecl)element);
        return true;
      }
    }, false);
    XmlUtil.doDuplicationCheckForElements(
      decls.toArray(new XmlElementDecl[decls.size()]),
      new HashMap<String, XmlElementDecl>(decls.size()),
      XML_ELEMENT_DECL_PROVIDER,
      host
    );
    return;
  }
  ExternalDocumentValidator.doValidation(document,host);
}
项目:intellij-ce-playground    文件:DtdParsing.java   
public DtdParsing(CharSequence chars,
                  final IElementType type,
                  final XmlEntityDecl.EntityContextType contextType,
                  PsiFile contextFile
) {
  this(
    type,
    contextType,
    PsiBuilderFactory.getInstance().createBuilder(
      LanguageParserDefinitions.INSTANCE.forLanguage(DTDLanguage.INSTANCE),
      new DtdLexer(false) {
        final int myInitialState = getLexerInitialState(type, contextType);
        @Override
        public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
          super.start(buffer, startOffset, endOffset, myInitialState);
        }
      }, chars
    )
  );
  if (contextFile != null) myBuilder.putUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY, contextFile);
}
项目:tools-idea    文件:XmlNSDescriptorImpl.java   
public void validate(@NotNull XmlDocument document, @NotNull ValidationHost host) {
  if (document.getLanguage() == DTDLanguage.INSTANCE) {
    final List<XmlElementDecl> decls = new ArrayList<XmlElementDecl>(3);

    XmlUtil.processXmlElements(document, new PsiElementProcessor() {
      public boolean execute(@NotNull final PsiElement element) {
        if (element instanceof XmlElementDecl) decls.add((XmlElementDecl)element);
        return true;
      }
    }, false);
    XmlUtil.doDuplicationCheckForElements(
      decls.toArray(new XmlElementDecl[decls.size()]),
      new HashMap<String, XmlElementDecl>(decls.size()),
      XML_ELEMENT_DECL_PROVIDER,
      host
    );
    return;
  }
  ExternalDocumentValidator.doValidation(document,host);
}
项目:tools-idea    文件:DtdParsing.java   
public DtdParsing(CharSequence chars,
                  final IElementType type,
                  final XmlEntityDecl.EntityContextType contextType,
                  PsiFile contextFile
) {
  this(
    type,
    contextType,
    PsiBuilderFactory.getInstance().createBuilder(
      LanguageParserDefinitions.INSTANCE.forLanguage(DTDLanguage.INSTANCE),
      new DtdLexer(false) {
        final int myInitialState = getLexerInitialState(type, contextType);
        @Override
        public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
          super.start(buffer, startOffset, endOffset, myInitialState);
        }
      }, chars
    )
  );
  if (contextFile != null) myBuilder.putUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY, contextFile);
}
项目:consulo-xml    文件:XmlNSDescriptorImpl.java   
@Override
public void validate(@NotNull XmlDocument document, @NotNull ValidationHost host)
{
    if(document.getLanguage() == DTDLanguage.INSTANCE)
    {
        final List<XmlElementDecl> decls = new ArrayList<>(3);

        XmlUtil.processXmlElements(document, new PsiElementProcessor()
        {
            @Override
            public boolean execute(@NotNull final PsiElement element)
            {
                if(element instanceof XmlElementDecl)
                {
                    decls.add((XmlElementDecl) element);
                }
                return true;
            }
        }, false);
        XmlUtil.doDuplicationCheckForElements(decls.toArray(new XmlElementDecl[decls.size()]), new HashMap<>(decls.size()), XML_ELEMENT_DECL_PROVIDER, host);
        return;
    }
    ExternalDocumentValidator.doValidation(document, host);
}
项目:consulo-xml    文件:DtdParsing.java   
public DtdParsing(CharSequence chars,
                  final IElementType type,
                  final XmlEntityDecl.EntityContextType contextType,
                  PsiFile contextFile
) {
  this(
    type,
    contextType,
    PsiBuilderFactory.getInstance().createBuilder(
      LanguageParserDefinitions.INSTANCE.forLanguage(DTDLanguage.INSTANCE),
      new DtdLexer(false) {
        final int myInitialState = getLexerInitialState(type, contextType);
        @Override
        public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
          super.start(buffer, startOffset, endOffset, myInitialState);
        }
      }, LanguageVersionUtil.findDefaultVersion(DTDLanguage.INSTANCE), chars
    )
  );
  if (contextFile != null) myBuilder.putUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY, contextFile);
}
项目:intellij-ce-playground    文件:XmlHighlightVisitor.java   
@Override public void visitXmlDocument(final XmlDocument document) {
  if (document.getLanguage() == DTDLanguage.INSTANCE) {
    final PsiMetaData psiMetaData = document.getMetaData();
    if (psiMetaData instanceof Validator) {
      //noinspection unchecked
      ((Validator<XmlDocument>)psiMetaData).validate(document, this);
    }
  }
}
项目:intellij-ce-playground    文件:XmlCoreEnvironment.java   
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
  appEnvironment.registerFileType(HtmlFileType.INSTANCE, "html;htm;sht;shtm;shtml");
  appEnvironment.registerFileType(XHtmlFileType.INSTANCE, "xhtml");
  appEnvironment.registerFileType(DTDFileType.INSTANCE, "dtd;ent;mod;elt");

  appEnvironment.registerFileType(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;jhm;ant;xul;xslt;rng;fxml");

  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XMLLanguage.INSTANCE, new XmlSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(DTDLanguage.INSTANCE, new DtdSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(HTMLLanguage.INSTANCE, new HtmlSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XHTMLLanguage.INSTANCE, new XhtmlSyntaxHighlighterFactory());

  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XMLLanguage.INSTANCE, new XMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, DTDLanguage.INSTANCE, new DTDParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, HTMLLanguage.INSTANCE, new HTMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XHTMLLanguage.INSTANCE, new XHTMLParserDefinition());

  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlTodoIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlTodoIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XHtmlFileType.INSTANCE, new XHtmlTodoIndexer());

  appEnvironment.addExtension(MetaDataContributor.EP_NAME, new XmlApplicationComponent());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlNamespaceIndex());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new SchemaTypeInheritanceIndex());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlTagNamesIndex());
  appEnvironment.addExtension(StandardResourceProvider.EP_NAME, new InternalResourceProvider());

  appEnvironment.registerApplicationComponent(PathMacros.class, new PathMacrosImpl());
  appEnvironment.registerApplicationService(ExternalResourceManager.class, new ExternalResourceManagerExImpl());
  appEnvironment.registerApplicationService(XmlFoldingSettings.class, new XmlFoldingSettings());
  Language[] myLanguages = new Language[]{XMLLanguage.INSTANCE, HTMLLanguage.INSTANCE, XHTMLLanguage.INSTANCE, DTDLanguage.INSTANCE};
  for (Language myLanguage : myLanguages) {
    appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, myLanguage, new XmlFoldingBuilder());
    appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, myLanguage, new XmlFindUsagesProvider());
    appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, myLanguage, new XmlASTFactory());
  }
}
项目:intellij-ce-playground    文件:XmlStructureViewTreeModel.java   
@Override
@NotNull
public StructureViewTreeElement getRoot() {
  XmlFile myFile = getPsiFile();
  if (myFile.getLanguage() == DTDLanguage.INSTANCE) return new DtdFileTreeElement(myFile);
  return new XmlFileTreeElement(myFile);
}
项目:intellij-ce-playground    文件:XmlParsingTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  addExplicitExtension(LanguageParserDefinitions.INSTANCE, XMLLanguage.INSTANCE, new XMLParserDefinition());
  addExplicitExtension(LanguageParserDefinitions.INSTANCE, DTDLanguage.INSTANCE, new DTDParserDefinition());
  addExplicitExtension(LanguageASTFactory.INSTANCE, XMLLanguage.INSTANCE, new XmlASTFactory());
  addExplicitExtension(LanguageASTFactory.INSTANCE, DTDLanguage.INSTANCE, new XmlASTFactory());
  registerExtensionPoint(StartTagEndTokenProvider.EP_NAME, StartTagEndTokenProvider.class);
}
项目:tools-idea    文件:XmlCoreEnvironment.java   
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
  appEnvironment.registerFileType(HtmlFileType.INSTANCE, "html;htm;sht;shtm;shtml");
  appEnvironment.registerFileType(XHtmlFileType.INSTANCE, "xhtml");
  appEnvironment.registerFileType(DTDFileType.INSTANCE, "dtd;ent;mod;elt");

  appEnvironment.registerFileType(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;jhm;ant;xul;xslt;rng;fxml");

  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XMLLanguage.INSTANCE, new XMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, DTDLanguage.INSTANCE, new DTDParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, HTMLLanguage.INSTANCE, new HTMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XHTMLLanguage.INSTANCE, new XHTMLParserDefinition());

  XmlASTFactory astFactory = new XmlASTFactory();
  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, XMLLanguage.INSTANCE, astFactory);
  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, HTMLLanguage.INSTANCE, astFactory);
  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, XHTMLLanguage.INSTANCE, astFactory);
  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, DTDLanguage.INSTANCE, astFactory);

  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlIdIndexer());

  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), StartTagEndTokenProvider.EP_NAME, StartTagEndTokenProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlSuppressionProvider.EP_NAME, XmlSuppressionProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlFileNSInfoProvider.EP_NAME, XmlFileNSInfoProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlSchemaProvider.EP_NAME, XmlSchemaProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ImplicitNamespaceDescriptorProvider.EP_NAME, ImplicitNamespaceDescriptorProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlElementDescriptorProvider.EP_NAME, XmlElementDescriptorProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), Html5SchemaProvider.EP_NAME, Html5SchemaProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlAttributeDescriptorsProvider.EP_NAME, XmlAttributeDescriptorsProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), XmlExtension.EP_NAME, XmlExtension.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), HtmlEmbeddedTokenTypesProvider.EXTENSION_POINT_NAME, HtmlEmbeddedTokenTypesProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), StandardResourceProvider.EP_NAME, StandardResourceProvider.class);
  CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), StandardResourceEP.EP_NAME, StandardResourceEP.class);

  appEnvironment.addExtension(MetaDataContributor.EP_NAME, new XmlApplicationComponent());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlNamespaceIndex());
  appEnvironment.addExtension(StandardResourceProvider.EP_NAME, new InternalResourceProvider());

  appEnvironment.registerApplicationService(ExternalResourceManager.class, createExternalResourceManager());
}
项目:tools-idea    文件:XmlParsingTest.java   
@Override
protected void setUp() throws Exception {
  super.setUp();
  addExplicitExtension(LanguageParserDefinitions.INSTANCE, XMLLanguage.INSTANCE, new XMLParserDefinition());
  addExplicitExtension(LanguageParserDefinitions.INSTANCE, DTDLanguage.INSTANCE, new DTDParserDefinition());
  addExplicitExtension(LanguageASTFactory.INSTANCE, XMLLanguage.INSTANCE, new XmlASTFactory());
  addExplicitExtension(LanguageASTFactory.INSTANCE, DTDLanguage.INSTANCE, new XmlASTFactory());
  registerExtensionPoint(StartTagEndTokenProvider.EP_NAME, StartTagEndTokenProvider.class);
}
项目:tools-idea    文件:XmlHighlightVisitor.java   
@Override public void visitXmlDocument(final XmlDocument document) {
  if (document.getLanguage() == DTDLanguage.INSTANCE) {
    final PsiMetaData psiMetaData = document.getMetaData();
    if (psiMetaData instanceof Validator) {
      //noinspection unchecked
      ((Validator<XmlDocument>)psiMetaData).validate(document, this);
    }
  }
}
项目:consulo-xml    文件:XmlHighlightVisitor.java   
@Override
public void visitXmlDocument(final XmlDocument document)
{
    if(document.getLanguage() == DTDLanguage.INSTANCE)
    {
        final PsiMetaData psiMetaData = document.getMetaData();
        if(psiMetaData instanceof Validator)
        {
            //noinspection unchecked
            ((Validator<XmlDocument>) psiMetaData).validate(document, this);
        }
    }
}
项目:consulo-xml    文件:XmlStructureViewTreeModel.java   
@Override
@NotNull
public StructureViewTreeElement getRoot()
{
    XmlFile myFile = getPsiFile();
    if(myFile.getLanguage() == DTDLanguage.INSTANCE)
    {
        return new DtdFileTreeElement(myFile);
    }
    return new XmlFileTreeElement(myFile);
}
项目:intellij-ce-playground    文件:DtdParsing.java   
public ASTNode parse() {
  final PsiBuilder.Marker root = myBuilder.mark();

  if (myRootType == XML_MARKUP_DECL) {
    parseTopLevelMarkupDecl();
    root.done(myRootType);
    return myBuilder.getTreeBuilt();
  }

  PsiBuilder.Marker document = null;
  if (myRootType == DTD_FILE) {
    document = myBuilder.mark();
    parseProlog();
  } 

  switch (myContextType) {
    case GENERIC_XML:
      parseGenericXml();
      break;
    case ELEMENT_CONTENT_SPEC:
      doParseContentSpec(true);
      break;
    case ATTLIST_SPEC:
      parseAttlistContent();
      break;
    case ATTR_VALUE:
      parseAttrValue();
    case ATTRIBUTE_SPEC:
      parseAttributeContentSpec();
      break;
    case ENTITY_DECL_CONTENT:
      parseEntityDeclContent();
      break;
    case ENUMERATED_TYPE:
      parseEnumeratedTypeContent();
      break;
  }

  while(!myBuilder.eof()) myBuilder.advanceLexer();
  if (document != null) document.done(XML_DOCUMENT);
  root.done(myRootType);
  ASTNode astNode = myBuilder.getTreeBuilt();

  if (myRootType != DTD_FILE) {
    PsiFile file = myBuilder.getUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY);
    if (file != null) {
      final DummyHolder result = DummyHolderFactory.createHolder(file.getManager(), DTDLanguage.INSTANCE, file);
      final FileElement holder = result.getTreeElement();
      holder.rawAddChildren((TreeElement)astNode);
    }
  }

  return astNode;
}
项目:intellij-ce-playground    文件:DTDFileType.java   
public DTDFileType() {
  super(DTDLanguage.INSTANCE);
}
项目:intellij-ce-playground    文件:XmlParsingTest.java   
private void doTestDtd(@NonNls String text) throws Exception {
  myLanguage = DTDLanguage.INSTANCE;
  doTest(text, "test.dtd");
}
项目:intellij-ce-playground    文件:IDTDElementType.java   
public IDTDElementType(@NonNls String debugName) {
  super(debugName, DTDLanguage.INSTANCE);
}
项目:tools-idea    文件:DtdParsing.java   
public ASTNode parse() {
  final PsiBuilder.Marker root = myBuilder.mark();

  if (myRootType == XML_MARKUP_DECL) {
    parseTopLevelMarkupDecl();
    root.done(myRootType);
    return myBuilder.getTreeBuilt();
  }

  PsiBuilder.Marker document = null;
  if (myRootType == DTD_FILE) {
    document = myBuilder.mark();
    parseProlog();
  } 

  switch (myContextType) {
    case GENERIC_XML:
      parseGenericXml();
      break;
    case ELEMENT_CONTENT_SPEC:
      doParseContentSpec(true);
      break;
    case ATTLIST_SPEC:
      parseAttlistContent();
      break;
    case ATTR_VALUE:
      parseAttrValue();
    case ATTRIBUTE_SPEC:
      parseAttributeContentSpec();
      break;
    case ENTITY_DECL_CONTENT:
      parseEntityDeclContent();
      break;
    case ENUMERATED_TYPE:
      parseEnumeratedTypeContent();
      break;
  }

  while(!myBuilder.eof()) myBuilder.advanceLexer();
  if (document != null) document.done(XML_DOCUMENT);
  root.done(myRootType);
  ASTNode astNode = myBuilder.getTreeBuilt();

  if (myRootType != DTD_FILE) {
    PsiFile file = myBuilder.getUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY);
    if (file != null) {
      final DummyHolder result = DummyHolderFactory.createHolder(file.getManager(), DTDLanguage.INSTANCE, file);
      final FileElement holder = result.getTreeElement();
      holder.rawAddChildren((TreeElement)astNode);
    }
  }

  return astNode;
}
项目:tools-idea    文件:DTDFileType.java   
public DTDFileType() {
  super(DTDLanguage.INSTANCE);
}
项目:tools-idea    文件:XmlParsingTest.java   
private void doTestDtd(@NonNls String text) throws Exception {
  myLanguage = DTDLanguage.INSTANCE;
  doTest(text, "test.dtd");
}
项目:tools-idea    文件:XmlStructureViewTreeModel.java   
@Override
@NotNull
public StructureViewTreeElement getRoot() {
  if (myFile.getLanguage() == DTDLanguage.INSTANCE) return new DtdFileTreeElement(myFile);
  return new XmlFileTreeElement(myFile);
}
项目:tools-idea    文件:IDTDElementType.java   
public IDTDElementType(@NonNls String debugName) {
  super(debugName, DTDLanguage.INSTANCE);
}
项目:consulo-xml    文件:DtdParsing.java   
public ASTNode parse() {
  final PsiBuilder.Marker root = myBuilder.mark();

  if (myRootType == XML_MARKUP_DECL) {
    parseTopLevelMarkupDecl();
    root.done(myRootType);
    return myBuilder.getTreeBuilt();
  }

  PsiBuilder.Marker document = null;
  if (myRootType == DTD_FILE) {
    document = myBuilder.mark();
    parseProlog();
  } 

  switch (myContextType) {
    case GENERIC_XML:
      parseGenericXml();
      break;
    case ELEMENT_CONTENT_SPEC:
      parseElementContentSpec();
      break;
    case ATTLIST_SPEC:
      parseAttlistContent();
      break;
    case ATTR_VALUE:
      parseAttrValue();
    case ATTRIBUTE_SPEC:
      parseAttributeContentSpec();
      break;
    case ENTITY_DECL_CONTENT:
      parseEntityDeclContent();
      break;
    case ENUMERATED_TYPE:
      parseEnumeratedTypeContent();
      break;
  }

  while(!myBuilder.eof()) myBuilder.advanceLexer();
  if (document != null) document.done(XML_DOCUMENT);
  root.done(myRootType);
  ASTNode astNode = myBuilder.getTreeBuilt();

  if (myRootType != DTD_FILE) {
    PsiFile file = myBuilder.getUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY);
    if (file != null) {
      final DummyHolder result = DummyHolderFactory.createHolder(file.getManager(), DTDLanguage.INSTANCE, file);
      final FileElement holder = result.getTreeElement();
      holder.rawAddChildren((TreeElement)astNode);
    }
  }

  return astNode;
}
项目:consulo-xml    文件:DTDFileType.java   
public DTDFileType() {
  super(DTDLanguage.INSTANCE);
}
项目:consulo-xml    文件:IDTDElementType.java   
public IDTDElementType(@NonNls String debugName)
{
    super(debugName, DTDLanguage.INSTANCE);
}