Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface FileParser<TN>

Central interface for integration of trees and path expressions into the Atomist Project API. Implemented by objects that can parse a file into an AST using a single grammar

Type parameters

  • TN: TreeNode = TreeNode

Hierarchy

  • FileParser

Implemented by

Index

Properties

rootName

rootName: string

Name of the top level production: name of the root TreeNode

Methods

Optional couldBeMatchesInThisFile

  • couldBeMatchesInThisFile(pex: PathExpression, f: File): Promise<boolean>
  • If this method is supplied, it can help with optimization. If we can look at the path expression and determine a match is impossible in this file, we may be able to skip an expensive parsing operation.

    Parameters

    • pex: PathExpression
    • f: File

    Returns Promise<boolean>

toAst

  • toAst(f: File): Promise<TN>

Optional validate

  • validate(pex: PathExpression): void
  • Can this path expression possibly be valid using this parser? For example, if the implementation is backed by the grammar for a programming language, the set of symbols is known in advance, as is the legality of their combination. If it is invalid, throw an Error. This is useful to differentiate between nonsensical path expressions and path expressions that didn't match anything. If this function is not implemented, no path expressions will be rejected

    Parameters

    • pex: PathExpression

    Returns void

Generated using TypeDoc