From 71a5d4bc0e4025b3fbdeed76052b39fcef284e8c Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 26 Dec 2010 03:07:31 -0600 Subject: diff: funcname and word patterns for perl The default function name discovery already works quite well for Perl code... with the exception of here-documents (or rather their ending). sub foo { print < Signed-off-by: Junio C Hamano --- userdiff.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'userdiff.c') diff --git a/userdiff.c b/userdiff.c index 2d5453697..fc2afe33a 100644 --- a/userdiff.c +++ b/userdiff.c @@ -61,6 +61,21 @@ PATTERNS("pascal", "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+" "|<>|<=|>=|:=|\\.\\." "|[^[:space:]]|[\x80-\xff]+"), +PATTERNS("perl", + "^[ \t]*package .*;\n" + "^[ \t]*sub .* \\{", + /* -- */ + "[[:alpha:]_'][[:alnum:]_']*" + "|0[xb]?[0-9a-fA-F_]*" + /* taking care not to interpret 3..5 as (3.)(.5) */ + "|[0-9a-fA-F_]+(\\.[0-9a-fA-F_]+)?([eE][-+]?[0-9_]+)?" + "|=>|-[rwxoRWXOezsfdlpSugkbctTBMAC>]|~~|::" + "|&&=|\\|\\|=|//=|\\*\\*=" + "|&&|\\|\\||//|\\+\\+|--|\\*\\*|\\.\\.\\.?" + "|[-+*/%.^&<>=!|]=" + "|=~|!~" + "|<<|<>|<=>|>>" + "|[^[:space:]]"), PATTERNS("php", "^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n" "^[\t ]*(class.*)$", -- cgit v1.2.1