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.
Difference between revisions of "LDT/Developer Area/Lua Internal Model"
(→internal view) |
m (→node) |
||
Line 32: | Line 32: | ||
node:expr | node:expr | ||
− | expr:identifier|index|call|invoke | + | expr:identifier|index|call|invoke|block |
identifier | identifier | ||
Line 39: | Line 39: | ||
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 |
Revision as of 13:20, 29 December 2011
Contents
Internal Lua Model
This model come as an extension of the lua external api model.</br> This model is an internal view of a lua file.</br> 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