Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be 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
m (node)
(Internal Lua Model)
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

Revision as of 12:52, 9 January 2012

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

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.

bloc
.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)


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