scanner

package
v0.0.0-...-0cd33ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package scanner allows to extract information from the DTD and create corresponding DTD structs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DTDScanner

type DTDScanner struct {
	Data         *bufio.Scanner
	WithComments bool
	Filepath     string
	CurrentLine  int // first line of a block
	CurrentChar  int
	CharCount    int
	LineCount    int  // line processed by the scanner
	CRLF         bool // 0 linux / 1 dos

	Log *zap.SugaredLogger
	// contains filtered or unexported fields
}

DTDScanner represents a DTD scanner

func NewScanner

func NewScanner(path string, s string, log *zap.SugaredLogger) *DTDScanner

NewScanner returns a new DTD Scanner

func (*DTDScanner) NextBlock

func (sc *DTDScanner) NextBlock() bool

Next Move to the next Block

func (*DTDScanner) ParseAttlist

func (sc *DTDScanner) ParseAttlist(s *sentence) *DTD.Attlist

ParseAttlist Use the information in the sentence to return a pointer to a DTD.Attlist

[52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' [53] AttDef ::= S Name S AttType S DefaultDecl

func (*DTDScanner) ParseComment

func (sc *DTDScanner) ParseComment(s *sentence) *DTD.Comment

ParseComment Use the information in the sentence to return a pointer to a DTD.Comment

func (*DTDScanner) ParseElement

func (sc *DTDScanner) ParseElement(s *sentence) *DTD.Element

ParseEntity Use the information in the sentence to return a pointer to a DTD.Element @ref https://www.w3.org/TR/xml11/#elemdecls

Element Declaration [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>' [VC: Unique Element Type Declaration] [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children

func (*DTDScanner) ParseEntity

func (sc *DTDScanner) ParseEntity(s *sentence) *DTD.Entity

ParseEntity Use the information in the sentence to return a pointer to a DTD.Entity @ref https://www.w3.org/TR/xml11/#sec-entity-decl

Entity Declaration [70] EntityDecl ::= GEDecl | PEDecl [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>' [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>' [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) [74] PEDef ::= EntityValue | ExternalID

func (*DTDScanner) ParseNotation

func (sc *DTDScanner) ParseNotation(s *sentence) *DTD.Notation

ParseNotation Use the information in the sentence to return a pointer to a DTD.Notation @ref https://www.w3.org/TR/xml11/#Notations

Element Declaration

[82] NotationDec ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>' [VC: Unique Notation Name] [83] PublicID ::= 'PUBLIC' S PubidLiteral

func (*DTDScanner) Previous

func (sc *DTDScanner) Previous() bool

Next Move to the next character

func (*DTDScanner) Scan

func (sc *DTDScanner) Scan() (DTD.IDTDBlock, []*word, error)

Scan the string to find the next block

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL