Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "LDT/Developer Area/Lua Internal Model"

< LDT
(internal view)
(Internal Lua Model)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
=Internal Lua Model=
 
=Internal Lua Model=
This model come as an extension of the lua external api model.</br>
+
This model come as an extension of the lua external api model.  
This model is an internal view of a lua file.</br>
+
This model is an internal view of a lua file.  
 
This model is used by IDE to do :
 
This model is used by IDE to do :
 
*auto-completion
 
*auto-completion
Line 7: Line 7:
 
*highlight occurences
 
*highlight occurences
 
*show documentation
 
*show documentation
 +
 +
The code relative to this model is based on lua and metalua, it is accessible [http://git.eclipse.org/c/ldt/org.eclipse.ldt.git/tree/libraries/modelsbuilder/models here].
  
 
==== internal content====
 
==== internal content====
Line 19: Line 21:
 
It also hold a list of variable declarations.
 
It also hold a list of variable declarations.
  
  bloc
+
  block
 
  .list (Item,scope) localvars  
 
  .list (Item,scope) localvars  
 
  .list (node) content
 
  .list (node) content
Line 32: Line 34:
 
  node:expr
 
  node:expr
  
  expr:identifier|index|call|invoke  
+
  expr:identifier|index|call|invoke|block
  
 
  identifier
 
  identifier
Line 39: Line 41:
  
 
  index
 
  index
 +
.(offsetmin, offsetmax) sourcerange
 
  .expr left  
 
  .expr left  
 
  .string right
 
  .string right
  
 
  call
 
  call
 +
.(offsetmin, offsetmax) sourcerange
 
  .expr function
 
  .expr function
  
 
  Invoke
 
  Invoke
 +
.(offsetmin, offsetmax) sourcerange
 
  . expr record
 
  . expr record
 
  . string functioname
 
  . string functioname
Line 63: Line 68:
 
  .string description
 
  .string description
 
  .typeref type
 
  .typeref type
  <span style="color:#B22222">.list(Identifier)</span>
+
  <span style="color:#B22222">.list(Identifier) occurrences</span>
 
+
  
 
== TypeRef ==
 
== TypeRef ==

Latest revision as of 04:01, 17 July 2014

Internal Lua Model

This model come as an extension of the lua external api model. This model is an internal view of a lua file. This model is used by IDE to do :

  • auto-completion
  • go to definition
  • highlight occurences
  • show documentation

The code relative to this model is based on lua and metalua, it is accessible here.

internal content

This is the internal view of a lua file

internalcontent
.list(item) unknownglobalvars
.block content

block

A block is a container of "node". It also hold a list of variable declarations.

block
.list (Item,scope) localvars 
.list (node) content
.(offsetmin, offsetmax) sourcerange

a scope is the offsetmin and the offsetmax which define the visibility range

node

A node is ast element which have a representation in the source code. Now, we only need Identifier, Index, Call and Invoke element.

node:expr
expr:identifier|index|call|invoke|block 
identifier
.(offsetmin, offsetmax) sourcerange
.item definition
index
.(offsetmin, offsetmax) sourcerange
.expr left 
.string right
call
.(offsetmin, offsetmax) sourcerange
.expr function
Invoke
.(offsetmin, offsetmax) sourcerange
. expr record
. string functioname
 

The definition of an identifier is an item which could be :

  • a local declaration of a block of this file
  • a global var declared in the external api
  • an unresolvedglobalvar stored at the root of the internal view.

External API Model Extension

Item

To implements highlight occurences, item needs be modified

item
.string name
.string description
.typeref type
.list(Identifier) occurrences

TypeRef

We also need more typeref.

ModuleTypeRef

When a variable is initialized with require "my.module", the type ref is a moduletyperef which will be resolved later.

moduletyperef 
.string modulename
.int returnposition

ExprTypeRef

When a variable is initialized with a complex expression like mymodule.newObject(), the type ref is a exprtyperef which will be resolved later.

exprtyperef 
.expr expression
.int returnposition

Back to the top