UNPKG

@grammar/xml

Version:

XML 1.1 grammar.

104 lines 3.34 kB
import $ from './spellu-engine'; declare namespace grammar$xml { } declare namespace grammar$xml { const enum Syntax { TagName = "xml.TagName", AttributeName = "xml.AttributeName", StringLiteral = "xml.StringLiteral", Text = "xml.Text", XmlDocument = "xml.Document", XmlDeclaration = "xml.XmlDeclaration", DoctypeDeclaration = "xml.DoctypeDeclaration", ElementDeclaration = "xml.ElementDeclaration", TagSection = "xml.TagSection", TextSection = "xml.TextSection", CDataSection = "xml.CDataSection", CommentSection = "xml.CommentSection", Attribute = "xml.Attribute" } const enum Syntax { XmlDeclarationOpenToken = "token.xml.XmlDeclaration.L", XmlDeclarationCloseToken = "token.xml.XmlDeclaration.R", MarkupDeclarationOpenToken = "token.xml.MarkupDeclaration.L", MarkupDeclarationCloseToken = "token.xml.MarkupDeclaration.R", MarkupDeclarationKeywordToken = "token.xml.MarkupDeclaration.keyword", DoubleHyphenToken = "token.xml.doublehyphen", TagOpenToken = "token.xml.<", TagCloseToken = "token.xml.>", SlashToken = "token.xml./", EqualToken = "token.xml.=" } interface Node extends $.Node { } interface Token extends $.Token { } interface Document extends Node { syntax: Syntax.XmlDocument; xmlDeclaration: XmlDeclaration; doctype: DoctypeDeclaration | null; nodeList: Node[]; } interface XmlDeclaration extends Node { syntax: Syntax.XmlDeclaration; attributeList: Attribute[]; } interface DoctypeDeclaration extends Node { syntax: Syntax.DoctypeDeclaration; string: Token; } interface Element extends Node { syntax: Syntax.ElementDeclaration; tagName: Token; attributeList: Attribute[]; nodeList: Node[]; } interface Tag extends Node { syntax: Syntax.TagSection; isOpen: boolean; isClose: boolean; tagName: Token; attributeList: Attribute[]; } interface Text extends Node { syntax: Syntax.TextSection; text: Token; } interface CData extends Node { syntax: Syntax.CDataSection; text: Token; } interface Comment extends Node { syntax: Syntax.CommentSection; text: Token; } interface Attribute extends Node { name: Token; value: Token; } } /** * XML 1.1 */ declare namespace grammar$xml { function createRecipe(): $.Recipe; } declare namespace grammar$xml.processors { const cst: $.Processor; } declare namespace grammar$xml.processors { const ast: $.Processor; } declare namespace grammar$xml { enum ProcessorSuite { CST = "cst", AST = "ast" } function selectProcessorSuite(suite: ProcessorSuite): $.Processor[]; function scan<V>(source: string | $.SourceDescriptor, suite?: ProcessorSuite, rule?: string, options?: Partial<$.ScanOptions>): V; function tokens(source: string | $.SourceDescriptor, options?: Partial<$.ScanOptions>): Token[]; } declare namespace grammar$xml { function assemble(source: Document): Document; } export default grammar$xml; //# sourceMappingURL=grammar-xml.d.ts.map