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

User Tools

Site Tools

sl_identifierT(#id, IdentifierStart, IdentifierLength)

Represents the Source Location of the identifier of the element with id #id. The source location of the entire element with id #id is represented by an slT(#id, Pos, Len) fact slT(#id, ElementStart, ElementLength). Since the identifier is part of the textual representation of the element, it is always true that ElementStart < IdentifierStart and ElementLength > IdentifierLength.

An sl_identifierT fact is created for each named element:


#id: id
the id of the element whose identifier source location is represented

IdentifierStart: integer
IdentifierStart is the character position of the first character of the identifier within the file.

IdentifierStart: integer
IdentifierLength is the number of characters of the identifier.

Sample Java Source

0123456789 123456789 12  // <-- just for easier counting of the character positions 
package myPackage;

import java.util.List;

public class MyClass {
    List list;

Its PEF Representation

% Program elements:

packageT(#Package, 'myPackage').
compilationUnitT(#CompilationUnit, #Package, #File, [#Import], [#Class]).
importT(#Import, #CompilationUnit, #Imported).
classT(#Class, #CompilationUnit, 'MyClass', [#Field]).
fieldT(#Field, #Class, #ListType, 'list', null).

% Source locations of the elements in the file: 

slT(#Package, 0, 18).
slT(#Import, 19, 22).
slT(#Class,  42, 40).
slT(#Field,  69, 10).

% Source locations of the identifiers of named elements:

sl_identifierT(#Package, 8, 9).   % <-- 'myPackage' starts at position 8 and is 9 characters long
sl_identifierT(#Class,  56, 7).   % <-- 'MyClass'  starts at position 56 and is 7 characters long
sl_identifierT(#Field,  74, 5).   % <-- 'list'     starts at position 56 and is 5 characters long

Note that

  • the compilationUnitT has no slT since the compilation unit is the entire file.
  • the import has no sl_identifierT since it is not a named element.
except for anonymous classes
research/jtransformer/api/meta/sourcelocations/sl_identifiert.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024