SDA SE Wiki

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

User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
research:jtransformer:api:meta:sourcelocations:sl_identifiert [2016/04/17 23:44]
127.0.0.1 external edit
research:jtransformer:api:meta:sourcelocations:sl_identifiert [2018/05/09 01:59] (current)
Line 1: Line 1:
 +
 +=== 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]] 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:
 +  * declarations ([[..:​..:​java:​pefs:​4.2:​classT|classT]] ((except for anonymous classes)), [[..:​..:​java:​pefs:​4.2:​methodt|methodT]],​ [[..:​..:​java:​pefs:​4.2:​fieldt|fieldT]],​ [[..:​..:​java:​pefs:​4.2:​paramt|paramT]],​ [[..:​..:​java:​pefs:​4.2:​localt|localT]]) ​
 +  * expressions ([[..:​..:​java:​pefs:​4.2:​callt|callT]] -- including super/this constructor calls, [[..:​..:​java:​pefs:​4.2:​fieldAccessT|fieldAccessT]], ​ [[..:​..:​java:​pefs:​4.2:​selectt|selectT]]).
 +  * labeled statements ([[..:​..:​java:​pefs:​4.2:​labelt|labelT]]).
 +
 +=== Arguments ===
 +==  ==
 +**#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 ===
 +
 +
 + ​== ​ ==
 +<Code lang-java>​
 +0123456789 123456789 12  // <-- just for easier counting of the character positions ​
 +package myPackage;
 +
 +import java.util.List;​
 +
 +public class MyClass {
 +    List list;
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +==  ==
 +<Code lang-prolog>​
 +% 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
 +</​Code>​
 +
 +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.
  
research/jtransformer/api/meta/sourcelocations/sl_identifiert.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019