git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Avery Pennarun <apenwarr@gmail.com>
Date
Aug 1, 2008, 21:00 UTC
Message-ID
<1217624415-14736-1-git-send-email-apenwarr@gmail.com>

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.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
---
 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 --git a/diff.c b/diff.c
index cbf2547..2f88e6d 100644
--- a/diff.c
+++ b/diff.c
@@ -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{.*\\)$" },
 };
 
-- 
1.5.6
Message 1 of 1 in “Add Pascal/Delphi (.pas file) funcname pattern.”
  1. Add Pascal/Delphi (.pas file) funcname pattern.Avery Pennarun, Aug 1, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.