Class SourceFile
Package: grammarkdown
Constructors
constructor(filename, text, elements)
Constructs a new instance of the SourceFile
class
Declaration
constructor(filename: string, text: string, elements: ReadonlyArray<SourceElement>);
Parameters
Properties
edgeCount
Declaration
protected get edgeCount(): number;
Property Value
number
elements
Declaration
readonly elements: ReadonlyArray<SourceElement>;
Property Value
ReadonlyArray<SourceElement>
filename
Declaration
readonly filename: string;
Property Value
string
firstChild
Declaration
get firstChild(): Node | undefined;
Property Value
Node | undefined
imports
Declaration
get imports(): readonly string[] | undefined;
Property Value
readonly string[] | undefined
lastChild
Declaration
get lastChild(): Node | undefined;
Property Value
Node | undefined
lineMap
Declaration
readonly lineMap: LineMap;
Property Value
text
Declaration
readonly text: string;
Property Value
string
Methods
accept(visitor)
Declaration
protected accept(visitor: NodeVisitor): SourceFile;
Parameters
- visitor
- NodeVisitor
Returns
children()
Declaration
children(): IterableIterator<Node>;
Returns
IterableIterator<Node>
edgeName(offset)
Declaration
protected edgeName(offset: number): string | undefined;
Parameters
- offset
- number
Returns
string | undefined
edgeValue(offset)
Declaration
protected edgeValue(offset: number): Node | ReadonlyArray<Node> | undefined;
Parameters
- offset
- number
Returns
forEachChild(cbNode)
Declaration
forEachChild<T>(cbNode: (node: Node) => T | undefined): T | undefined;
Type Parameters
- T
Parameters
- cbNode
- (node: Node) => T | undefined
Returns
T | undefined
update(elements)
Declaration
update(elements: ReadonlyArray<SourceElement>): SourceFile;
Parameters
- elements
- ReadonlyArray<SourceElement>