Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TypescriptParser

Magic.happens('here'); This class is the parser of the whole extension. It uses the typescript compiler to parse a file or given source code into the token stream and therefore into the AST of the source. Afterwards an array of resources is generated and returned.

export
class

TypescriptParser

Hierarchy

  • TypescriptParser

Index

Methods

Private parse

  • parse(resource: Resource, root: Node): void
  • Recursive function that runs through the AST of a source and parses the nodes. Creates the class / function / etc declarations and instanciates a new module / namespace resource if needed.

    memberof

    TsResourceParser

    Parameters

    Returns void

parseFile

  • parseFile(filePath: string, rootPath: string): Promise<File>
  • Parses a single file into a parsed file.

    memberof

    TsResourceParser

    Parameters

    • filePath: string
    • rootPath: string

    Returns Promise<File>

parseFiles

  • parseFiles(filePathes: string[], rootPath: string): Promise<File[]>
  • Parses multiple files into parsed files.

    memberof

    TsResourceParser

    Parameters

    • filePathes: string[]
    • rootPath: string

    Returns Promise<File[]>

parseSource

  • parseSource(source: string, scriptKind?: ScriptKind): Promise<File>
  • Parses the given source into an anonymous File resource. Mainly used to parse source code of a document.

    memberof

    TsResourceParser

    Parameters

    • source: string
    • Default value scriptKind: ScriptKind = ScriptKind.TS

    Returns Promise<File>

Private parseTypescript

  • parseTypescript(source: SourceFile, rootPath: string): File
  • Parses the typescript source into the file instance. Calls .parse afterwards to get the declarations and other information about the source.

    memberof

    TsResourceParser

    Parameters

    • source: SourceFile
    • rootPath: string

    Returns File

Generated using TypeDoc