fix(parser): correctly extract type from VAR_CONSTANT with initialization

The parser was incorrectly finding the ':' inside attribute blocks like
{EXTERNALACCESSIBLE := 'false'} instead of the ':' after them.

Added 'break' after finding the first ':' outside braces to ensure
we get the correct type separator.

Fixes issue where variables like:
  STARTING_BASEPOS : Int := 30;
were showing data_type as '= 30' instead of 'Int'.
This commit is contained in:
2026-02-19 10:57:17 +01:00
parent 80d315df81
commit cba10851d2
+1
View File
@@ -96,6 +96,7 @@ function M.extract_variables(content)
brace_depth = brace_depth - 1
elseif c == ":" and brace_depth == 0 then
type_start = i
break -- Only take the first : outside braces
end
end
local var_data_type = "unknown"