SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Source Location API

Source location information is represented by facts for the following predicates:

  • A sl_packageT(#id, SubPos, SubLen) fact provides source location information for the package declaration in a compilation unit.
  • A slT(#id, Pos, Len) fact provides source location information for any other AST element (no packagT) that has an own ID. Somethimes, the slT(#id, Pos, Len) information is too coarse-grained. To access relvant parts of an element, in particular its identifier and type, we use two additional PEF types:
    • A sl_identifierT(#id, IdentifierStart, IdentifierLength) fact provides source location information for the identifier part of an element with own ID (and an own slT(#id, Pos, Len) fact). For instance, a field declaration (private MyType myfield;) contains a reference to the identifier “myfield”. An associated sl_identifierT stores the source location of “myfield”, whereas a separate slT fact stores the source location for the entire field declaration.
    • A sl_typeT (#id, #type, 'start', 'length' ) fact provides source location information for the type reference part of an element with own ID (and an own slT(#id, Pos, Len) fact). For instance, a field declaration (private MyType myfield;) contains a reference to the type “MyType”. An associated sl_typeT stores the source location of “MyType”, whereas a separate slT fact stores the source location for the entire field declaration.

Implementors of StarTransformer plugins supporting new languages are required to adhere to this specification (that is, to create suitable facts) in order for their plugin to be able to take advantage of the source location related features of StarTransformer.

research/jtransformer/api/meta/sourcelocations/sourcelocationapi.txt · Last modified: 2019/02/05 13:46 by Günter Kniesel

SEWiki, © 2025