JeJe wrote: ↑Tue Apr 04, 2023 1:52 pm... - but try and get the sub or function node below and there's a freeze for me ... meaning you have to search the module text and examine it to discover the parameters of the sub or function - which will fail if the module is longer than maximum string length.
(Did not yet study your most recent post.)
Just entered the thread again and first time actually read what's quoted above. Sorry.
Yes there is only the text, imo. No XML file containing nodes on the single-routine level. You surely know better than I do how nested modules are handled where allowed.
Concerning a hand-made function like
createSubAndFunctionInfoForBasicModule(pModuleFilePath As String) I wouldn't see the 2^16 limit as the most relevant problem. We can read lines after all, we can import the .xba into a helper text-model (paragraph in LibO no longer limted by 16-bit for a long time now) and we may hope for routine-
headers not exceeding the limit, or read byte-oriented.
The problem is the tokenizing/preparsing based on a syntax surely not being regular, but relying on start-to-end tokenizing. We may need to explicitly program lots of steps the Basic IDE and "compiler" have included in a professional and efficient way already, but don't offer as a service to the user. Did you ever try code of the kind? I tried together with the students (17 of age) of a course in 1995/1996 - and there we were it ourselves who defined the syntax of the declarations (excluding comments and left-right-non-distinguishing parenthesing characters like quotes e.g.).
Assuming at least the headers are "regular", and xba files are single-paragraph (with \n linebreaks only) as they should be, a good finder I can offer is the RegEx
Code: Select all
(^|\n)\s*(public\s+)?(function|sub)\s+[a-z_][a-z_0-9]*\s*\([^\(\)]*\)(\s*as\s+[a-z]+)?
(Just found there are exceptions concerning paragraph breaks in ScriptForge code.)
Do you know if ScriptForge offers something usable here? Is the respective task supported by Python? Since my early superficial studies in programming (1964/65) I missed the respective self-support. All the later IDE interfaces had support for syntax highlighting at least (and much more depending), but often didn't offer related tools as modules/units/services whatever. (freepascal seems to have.)
Concerning the level of the discussion: Please regard that I didn't anything in the field on a professional (except teaching) level since 1968. Only a few years ago I started my part-time support for LibO/AOO and due to age I will not again go through fundamental studies now. Not enough time left.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München