Skip to contentSkip to conversation

Add Pascal/Delphi (.pas file) funcname pattern.

PATCH New Avery Pennarun 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add Pascal/Delphi (.pas file) funcname pattern.

Finds classes, records, functions, procedures, and sections. Most lines need to start at the first column, or else there's no way to differentiate a procedure's definition from its declaration.

---
 diff.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Changes since v1:

- Tried using '\n' to separate the two parts of the regex, but it doesn't work. Seems the lines are combined with AND instead of OR. Also can't reduce the number of parens since only the part in parens is returned as the result string.

- Rename 'pas' type to 'pascal'

- Remove unnecessary 'type' match.

diff.c +6 -0
index cbf2547..2f88e6d 100644
@@ -1380,6 +1380,12 @@ static struct builtin_funcname_pattern {
 			"^[ 	]*\\(\\([ 	]*"
 			"[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
 			"[ 	]*([^;]*\\)$" },
+	{ "pascal", "^\\(\\(procedure\\|function\\|constructor\\|"
+			"destructor\\|interface\\|implementation\\|"
+			"initialization\\|finalization\\)[ \t]*.*\\)$"
+			"\\|"
+			"^\\(.*=[ \t]*\\(class\\|record\\).*\\)$" 
+			},
 	{ "tex", "^\\(\\\\\\(sub\\)*section{.*\\)$" },
 };
 
Signature · 1 line
1.5.6