aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-02-18 17:01:18 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2011-02-18 17:01:18 -0500
commit5079722f9c6834017d8c4db86080a027fec7d50b (patch)
tree4245b45a14f27fb5c8c6828cfeaffb88b4ad99c2 /modules/textadept
parentee776fecd97fbfbca7446aa526df8065299a582d (diff)
downloadtextadept-5079722f9c6834017d8c4db86080a027fec7d50b.tar.gz
textadept-5079722f9c6834017d8c4db86080a027fec7d50b.zip
Fixed bug with assignment type-inference; modules/textadept/adeptsense.lua
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/adeptsense.lua26
1 files changed, 14 insertions, 12 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
index 865bb376..90093b54 100644
--- a/modules/textadept/adeptsense.lua
+++ b/modules/textadept/adeptsense.lua
@@ -63,16 +63,18 @@ function get_class(sense, symbol)
s, e, class = line:find(patt:gsub('%%_', symbol))
if class then break end
end
- s, e, assignment = line:find(assignment_patt)
- if assignment then
- for patt, type in pairs(type_assignments) do
- local captures = { assignment:match(patt) }
- if #captures > 0 then
- class = type:gsub('%%(%d+)', function(n)
- return captures[tonumber(n)]
- end)
+ if not class then
+ s, e, assignment = line:find(assignment_patt)
+ if assignment then
+ for patt, type in pairs(type_assignments) do
+ local captures = { assignment:match(patt) }
+ if #captures > 0 then
+ class = type:gsub('%%(%d+)', function(n)
+ return captures[tonumber(n)]
+ end)
+ end
+ if class then break end
end
- if class then break end
end
end
end
@@ -483,12 +485,12 @@ api_files = {},
-- @field symbol_chars A Lua pattern of characters allowed in a symbol,
-- including member operators. Default is '[%w_%.]'.
-- @field type_declarations A list of Lua patterns used for determining the
--- class type of a symbol. The first capture returned must be the class name.
+-- class type of a symbol. The first capture returned must be the class name.
-- Use '%_' to match the symbol. Defaults to '(%u[%w_%.]+)%s+%_'.
-- @field type_assignments A map of Lua patterns to class types for variable
-- assignments. This is typically used for dynamically typed languages. For
--- example, `sense.type_assignments['^"'] = 'string'` would recognize string
--- assignments in Lua so the `foo` in `foo = "bar"` would be recognized as
+-- example, `sense.type_assignments['^"'] = 'string'` would recognize string
+-- assignments in Lua so the `foo` in `foo = "bar"` would be recognized as
-- type `string`. The class type value can contain pattern captures.
-- @class table
-- @name syntax