• Convenience function for creating a CompositeGeneratorNode being configured with the provided tracing information in form of {astNode, property?, index: undefined} and appending content in form of a template.

    This function returns a tag function that takes the desired template and does the processing by delegating to expandToNode and traceToNode and finally returning the resulting generator node.

    Type Parameters

    Parameters

    • astNode: T

      the AstNode corresponding to the appended content

    • Optionalproperty: Properties<T>

      the value property name (string) corresponding to the appended content, if e.g. the content corresponds to some string or number property of astNode, is optional

    Returns ((staticParts: TemplateStringsArray, ...substitutions: unknown[]) => CompositeGeneratorNode)

    a tag function behaving as described above, which in turn returns a CompositeGeneratorNode.

    expandTracedToNode(entity)`
    Hello ${ traceToNode(entity, 'name')(entity.name) }
    `.appendNewLine()
  • Convenience function for creating a CompositeGeneratorNode being configured with the provided tracing information in form of {astNode, property, index} and appending content in form of a template.

    This function returns a tag function that takes the desired template and does the processing by delegating to expandToNode and traceToNode and finally returning the resulting generator node.

    Type Parameters

    Parameters

    • astNode: T

      the AstNode corresponding to the appended content

    • property: Properties<T>

      the value property name (string) corresponding to the appended content, if e.g. the content corresponds to some string or number property of astNode

    • Optionalindex: number

      the index of the value within a list property corresponding to the appended content, if the property contains a list of elements, is ignored otherwise

    Returns ((staticParts: TemplateStringsArray, ...substitutions: unknown[]) => CompositeGeneratorNode)

    a tag function behaving as described above, which in turn returns a CompositeGeneratorNode.

    expandTracedToNode(entity, 'definitions', 0)`
    Hello ${ traceToNode(entity, 'name')(entity.name) }
    `.appendNewLine()
  • Convenience function for creating a CompositeGeneratorNode being configured with the provided tracing information in form of concrete coordinates and appending content in form of a template. Complete coordinates are provided by the AstNodes' corresponding AstNode.$cstNodes.

    This function returns a tag function that takes the desired template and does the processing by delegating to expandToNode and traceToNode and finally returning the resulting generator node.

    Parameters

    • sourceRegion: undefined | SourceRegion

      a text region within some file in form of concrete coordinates, if undefined no tracing will happen

    Returns ((staticParts: TemplateStringsArray, ...substitutions: unknown[]) => CompositeGeneratorNode)

    a tag function behaving as described above, which in turn returns a CompositeGeneratorNode.

    expandTracedToNode(entity.$cstNode)`
    Hello ${ traceToNode(entity, 'name')(entity.name) }
    `.appendNewLine()
  • Convenience function for creating a CompositeGeneratorNode being configured with the provided tracing information in form of a list of concrete coordinates and appending content in form of a template. Complete coordinates are provided by the AstNodes' corresponding AstNode.$cstNodes.

    This function returns a tag function that takes the desired template and does the processing by delegating to expandToNode and traceToNode and finally returning the resulting generator node.

    The list of regions in sourceRegions will later be reduced to the smallest encompassing region of all the contained source regions.

    Parameters

    • sourceRegions: SourceRegion[]

      a list of text regions within some file in form of concrete coordinates, if empty no tracing will happen

    Returns ((staticParts: TemplateStringsArray, ...substitutions: unknown[]) => CompositeGeneratorNode)

    a tag function behaving as described above, which in turn returns a CompositeGeneratorNode.

    expandTracedToNode([
    findNodeForKeyword(entity.$cstNode, '{')!,
    findNodeForKeyword(entity.$cstNode, '}')!
    ])`
    Hello ${ traceToNode(entity, 'name')(entity.name) }
    `.appendNewLine()