From patchwork Tue Mar 12 13:14:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergius Nyah X-Patchwork-Id: 13589976 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04D1C58112 for ; Tue, 12 Mar 2024 13:14:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249298; cv=none; b=iUTd32RrTKbTtpc3svuWEus2ee+YkjXKe6D9LPnZWm4JQcZNqfXIjPsKvvDUmwyks45vCLzU9DL2wLa2u3ucVMoDdRlvxAq/CZJ6+XUwZlGC/e6GRrcrB1OZViwyS4Z3tsky5QxzrBlr1Dqsiz/gQ/4q0pUbcLMgMZWIIqUin4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249298; c=relaxed/simple; bh=ZK9PuJZQXmxCrOY2MHL3UrU+Ohue6dc0TQ2bcUH+fHs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZmwedVRmYqm6O4r1nWJMeQcX58At8VxbL61/ipTvFq/fSa6WPIQcDCCbE1WOL4BI76/TkoBMv+9IRa+2aO6duM0LOBeIikp4i+OihGCTTAR5l+hXX4HvLF9TjzlQDbp/3RMkmb8I5FQhWPvBKitFbeNWK3f3upw8TO8Webjug1I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Bz1wEQU4; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bz1wEQU4" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-41332865abfso5415855e9.2 for ; Tue, 12 Mar 2024 06:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710249295; x=1710854095; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=we7uoVi5lX0UHmExlkxCOTUXfU3jH5EUwDTrm8GhzOs=; b=Bz1wEQU4Fg4eZ+3pS0XAMC3rC51lqRRA6oOEwY07u0i/54P7zA39YA9zH8Si34M41g iZyrxFmf94Pkd2Ubenm0MIc17Jr9J0M2JnXhSkBBfqR+XFLI9Fcqxbz0VSgjBDZUBg5v 0qtEib0MlqeoVQ52D9rHy0lnZoDJSxJH2uUMZZZQzPtb2haQRgoJTozprsBBJAO1DZqT sQIXEeWKDwKWcffupR8p6mWygvZbu4JaUiFsIoZcJrnG3G1QDGyzzRUDijMwpYMIUogD XW+x4bK3PezL4f3tjjQZEJIxhfo4aeiqR9cmhGz3Nxu8KP4Q9iw0UZuzqYwBxeG+Gq1C bI4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710249295; x=1710854095; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=we7uoVi5lX0UHmExlkxCOTUXfU3jH5EUwDTrm8GhzOs=; b=hrwTMuPr154SaxoTBBv+rMzjWfKpfEsbokwhKPdA86B27vO1DzRIohCfIXbmEvC8jO pbgXya5kdi11p7hTCxVMzOYJxLJPnbhBf/O75tQcgKIkLhXVh3mVnF3LhcQe1eHRPA3o fdfClx2XcsaV8/Wp9hbj2ulh2kpdOXC4u845JfL02zqEsjJOb6vnlRxquWDHOixBjYQQ YTHcrwAv6Yq7+dbQTq+CthHRMJL3HsEOIesxxvqPjZn0+8RmzCB/5Gu6CTd1lW5kc3Qe MGUGZnCNS3pUoHGOfg3g4XfTjd0hoNnG6uKnWHux8kSntomXjNTVHAnSCmE0wYe0UlX4 4DzQ== X-Gm-Message-State: AOJu0YyB5nz10BbhoTky5jCR+QM8jB5VGNx3uH12nyiy6kMazYUW4rzs dEDtPqfIuVcf5+20j0NGf9cvsu/P4881Ei7X5mkfjPU6J0ZTcrxadI5N0kVlmeg= X-Google-Smtp-Source: AGHT+IF4zt0toN1s2YF4GZXknB9zVBXSJMqszxqz+XvsQh7p/bl4qb3S6tSAKFByhNVOVqXC7/51yA== X-Received: by 2002:a05:600c:4f09:b0:412:f979:587b with SMTP id l9-20020a05600c4f0900b00412f979587bmr1398717wmq.17.1710249294931; Tue, 12 Mar 2024 06:14:54 -0700 (PDT) Received: from host-sergy.. ([154.72.153.211]) by smtp.gmail.com with ESMTPSA id l2-20020a05600c4f0200b00412a31d2e2asm12586737wmq.32.2024.03.12.06.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 06:14:54 -0700 (PDT) From: Sergius Nyah To: git@vger.kernel.org Cc: gitster@pobox.com, christian.couder@gmail.com, pk@pks.im, Sergius Nyah Subject: [GSOC][PATCH v2 1/3]t4018-diff-funcname: use test_grep instead of test_i18ngrep Date: Tue, 12 Mar 2024 14:14:46 +0100 Message-ID: <20240312131448.638472-1-sergiusnyah@gmail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Signed-off-by: Sergius Nyah --- t/t4018-diff-funcname.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.43.2 diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index d35cce18a0..e6d2f1c215 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -119,8 +119,6 @@ do " done -test_done - test_expect_success 'identify builtin patterns in JavaScript' ' # setup echo "function myFunction() { return true; }" > test.js && @@ -136,9 +134,11 @@ test_expect_success 'identify builtin patterns in JavaScript' ' git diff >output && # check results - test_i18ngrep "function myFunction() { return true; }" output && - test_i18ngrep "function myFunction() { return false; }" output && - test_i18ngrep "var myVar = function() { return false; }" output && - test_i18ngrep "var myVar = function() { return true; }" output + test_grep "function myFunction() { return true; }" output && + test_grep "function myFunction() { return false; }" output && + test_grep "var myVar = function() { return false; }" output && + test_grep "var myVar = function() { return true; }" output ' -test_done \ No newline at end of file + +test_done + From patchwork Tue Mar 12 13:14:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergius Nyah X-Patchwork-Id: 13589977 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CF3A58112 for ; Tue, 12 Mar 2024 13:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249301; cv=none; b=kfFG6KB9SJeaFhl5Rh7O+0eP206nJASp66vJnV4HOzDWBKiEYkm7fJbDSdxpJPDATyZizJPNdPfKybhN6m9Ls+hngY1PdL5PQLmUww85mh8JL7KO3YtcFvFtFmHq+ROGl6NQsg4Ahdx/IzBN+IyI7HMlRRlO7SIUMsO8zO6fEP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249301; c=relaxed/simple; bh=PTR8QQcEOxGDj4nsDc7lE2oLBBfFQOcKysLn9mLiBzY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c5N/U8MwJdYf8C9Yn+htZj0Kgdu0LoSWWtBMOxyRieSyHlFwg5sz1+jef9CINKjORTRKJU37iy3HR2yQOaE4ugC7D9fyRzi50hTfvSQN4LdhQxJEZRif0Urmrh56J0c8dagZoxpWWMgYQD3FQKocwVPTsi3HoYzBJd5KRPdTIv8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CY4IXk8M; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CY4IXk8M" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4132e548343so10009655e9.1 for ; Tue, 12 Mar 2024 06:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710249298; x=1710854098; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PTR8QQcEOxGDj4nsDc7lE2oLBBfFQOcKysLn9mLiBzY=; b=CY4IXk8M2JSWX+3uvbYs5SXKmNxY1w2D2REg+z5/RmXp1YvXNYgWjSXHDoNB+72H1F N0xFY1kuPQisd5gGhPKPvkLil/eZO8f1xXuYDaJhpd+avFflXZIMOAWH6STF1QwkTt1e 5LqwZpCllRhj+e1roxOd7/PfjhfwAY45yeqYD/FXgueFX3g9maqkVsxbxrLMvDKVeTj9 91I0WZBZEYd/crY4z60aLU904kjy1HARBghbxqjCOzUSguCluaTQMa2wI+14hGiBX3+P bW/WZbkxgBK2RI8j3bGoVHkrmJ+dkTsDMiVzcHel9t30TCgCVoKaoF5WlIZsuAZdS0LD 7k2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710249298; x=1710854098; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PTR8QQcEOxGDj4nsDc7lE2oLBBfFQOcKysLn9mLiBzY=; b=Te+hQFByEFSpkTIM5ib5G3VndqOh+DfEOzVUOlfjhbrFz9N+akiV0+kkPUtAIyPLnm Slh7Z4IW30VF95fynon2TDq9EkHV6qcpPBZdM5UkSG0Y/x6e9GD7XSBoK/99BeK6pFI1 4GzeBIQDw9Gb6JG/U4OZPSIcmuysV6tofvIav81hv+z4KGyYmhwi2NULqMcsOqKLP7mU 6EQTvM8jdATGqTYuOHJ5/3YENNakKvMZfbTuLHDoMCo2euhLScHRqrjJMKTtEu88UtZj tCFeg+3ue6M/9DiDApNmp9k0sCGsJwz6X4E32yoF7v9clbgpSkaICVyAGBYuCyOgc3nJ CBjg== X-Gm-Message-State: AOJu0YzB+WOw5c10zqPbI8GPJGu7Q8WcQpXZ5olipWRRaM+1Ntw3MsB5 5dzftp2C9YQHp2P8i4VxbRA53E1I00prEGmk+lL87KenjO2xKdnPAbZig86AW6k= X-Google-Smtp-Source: AGHT+IFXJyoJKc2oomunk6DtFpLWCHSYE7V5zfTZse9OvC6YEZaG5FTdgrK4mOqtNYx9QxlyXvzHWQ== X-Received: by 2002:a05:600c:3ac8:b0:412:ed9b:621c with SMTP id d8-20020a05600c3ac800b00412ed9b621cmr118836wms.24.1710249298468; Tue, 12 Mar 2024 06:14:58 -0700 (PDT) Received: from host-sergy.. ([154.72.153.211]) by smtp.gmail.com with ESMTPSA id l2-20020a05600c4f0200b00412a31d2e2asm12586737wmq.32.2024.03.12.06.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 06:14:58 -0700 (PDT) From: Sergius Nyah To: git@vger.kernel.org Cc: gitster@pobox.com, christian.couder@gmail.com, pk@pks.im, Sergius Nyah Subject: [GSOC][PATCH v2 2/3]t4034-diff-words: add javascript language driver Date: Tue, 12 Mar 2024 14:14:47 +0100 Message-ID: <20240312131448.638472-2-sergiusnyah@gmail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240312131448.638472-1-sergiusnyah@gmail.com> References: <20240312131448.638472-1-sergiusnyah@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- t/t4034-diff-words.sh | 1 + 1 file changed, 1 insertion(+) --- 2.43.2 diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh index 74586f3813..cf2374af2c 100755 --- a/t/t4034-diff-words.sh +++ b/t/t4034-diff-words.sh @@ -328,6 +328,7 @@ test_language_driver dts test_language_driver fortran test_language_driver html test_language_driver java +test_language_driver javascript test_language_driver kotlin test_language_driver matlab test_language_driver objc From patchwork Tue Mar 12 13:14:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergius Nyah X-Patchwork-Id: 13589978 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C94958112 for ; Tue, 12 Mar 2024 13:15:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249305; cv=none; b=DhVhh9Y3+Y0dwSGevxlpPw0kPb2ABn+rvNsbuldUHWy7x7C1zCci4wJDMdPNj9Ua/rYuN1DGhDDbTR8JKt2rzAJNdcibVPx39hDly3Jznrdc0UUSoorQlCZMeBjadgteHvVtmyYW5b5fL7Id8xFcjuYZCic4MZKiARnP2K5tLEg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249305; c=relaxed/simple; bh=w8LPhrdhOHREuZ8PAt3X/OIKjeeOhrw/XlZV8QgoVkQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bjNRWYjrCNgiQLRUo4+Tp61RfhRmNev3r06l3FkEn5/NLJfQ6Dqr263m3ebKaeVkZ/gFW8GEDGhfl4sfXt1WHk7l8tZjfl7qEspwRk56B6gCM8syjZlxHNCrSg908c7OaBooWWyK6Ea/kbcKSsnmymD4/s8LMQtC48ai9Mmt7H0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=maKbKVj9; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="maKbKVj9" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-33e94c12f33so2321929f8f.3 for ; Tue, 12 Mar 2024 06:15:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710249302; x=1710854102; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YTCLg17ZGhvDzGeQoCBYxGyYTWyBwI0CNDaIgma/jfQ=; b=maKbKVj9hh0FRKV6/Ro2LzGt66QUmjl/9gE+OB7aY6IMJHiKlIIZgoREx4qmYhnS0N kKp4Ab/gWa/zMG/BMegp6GWzAF8CXTk3gqhLZ+BEvPUnoe8XsgCQQuzm4kDcHxkhB4h7 iGoNFgYuh5FWcm95HFg6wcx8szwxQqW4a0XrEAXgXi8opFWKvYy0djbxhXcOkuwF0nl0 DuqnE12vqhfB3qu/6XfZlvfswltONow0li4x4qB8TMg8KSHtHFh2F2ErRlentAdVeg9a WRwrRybKehmTtgxMs+/3qB8g+4ntalRdRDs3E/BJ4rgI3xGoX9WCYQ+nfjYWjkrgQKZv EP1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710249302; x=1710854102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YTCLg17ZGhvDzGeQoCBYxGyYTWyBwI0CNDaIgma/jfQ=; b=qf+vkOim9X59rQfvhfXStjM1f/2+AOQFDaW6hmZbeLT16agS4qcF6qkLANDvsTC8aI DORBtdP81PY4IJl/OvE+iXVOtyF3f8qM4rA4nZR3jlAgVtdluIjww04J50tGVRss3rw4 8Yl/b3Mdaafg4M9qRvLOsLlGZBL2fHIdMwbxIy+HdfYtqKNEQyBhRMKuSyqQfhiNoqFD CV6RNnJtg4aZu7zQm/hoa3J0KIUBuOhS/p3iJ4M63iNlzSZt0giebeBN2H+5HwRGxASk AxercwuwHFkvq8GPoHPeDO9JdFP3DD2jWNgstU/hyA33743qKMM5WB9qe3YMCtWCp5Wr AkKQ== X-Gm-Message-State: AOJu0YzcLFUxFLr+Oc7mWMRuRXZjoFePZjX3k2tGBWb6qx8DfIRT+YBa WT1N2ZA04vyqvvXAMeMa4WRFei4M53t+7egnYJpX62gsbLKfrq+mHwb/Q1G2LnY= X-Google-Smtp-Source: AGHT+IGFvHInMPXoSQOOiVxEo/EXIsQXbtdyqsxnShLBsuUL8gnEhm04qBUHyEOOW+LfB+R/9Ot+Uw== X-Received: by 2002:a05:600c:3583:b0:413:1bbc:b25f with SMTP id p3-20020a05600c358300b004131bbcb25fmr113447wmq.25.1710249301675; Tue, 12 Mar 2024 06:15:01 -0700 (PDT) Received: from host-sergy.. ([154.72.153.211]) by smtp.gmail.com with ESMTPSA id l2-20020a05600c4f0200b00412a31d2e2asm12586737wmq.32.2024.03.12.06.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 06:15:01 -0700 (PDT) From: Sergius Nyah To: git@vger.kernel.org Cc: gitster@pobox.com, christian.couder@gmail.com, pk@pks.im, Sergius Nyah Subject: [GSOC][PATCH v2 3/3]userdiff: remove trailing whitespaces, fix multiline comments Date: Tue, 12 Mar 2024 14:14:48 +0100 Message-ID: <20240312131448.638472-3-sergiusnyah@gmail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240312131448.638472-1-sergiusnyah@gmail.com> References: <20240312131448.638472-1-sergiusnyah@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This patch removes trailing whitespaces and fixes multiline comments in the `userdiff.c` file to match Gits coding standards as seen in [1]. Signed-off-by: Sergius Nyah --- userdiff.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- 2.43.2 [1]: https://github.com/git/git/blob/master/Documentation/CodingGuidelines diff --git a/userdiff.c b/userdiff.c index bbe2bcb9a3..15342c8662 100644 --- a/userdiff.c +++ b/userdiff.c @@ -184,17 +184,18 @@ PATTERNS("java", "|[-+*/<>%&^|=!]=" "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"), PATTERNS("javascript", - /* Looks for lines that start with optional whitespace, followed - * by 'function'* and any characters (for function declarations), - * or valid JavaScript identifiers, equals sign '=', 'function' keyword - * and any characters (for function expressions). - * Also considers functions defined inside blocks with '{...}'. - */ - "^[ \t]*(function[ \t]*.*|[a-zA-Z_$][0-9a-zA-Z_$]*[ \t]*=[ \t]*function[ \t]*.*|(\\{[ \t]*)?)\n", - /* This pattern matches JavaScript identifiers */ - "[a-zA-Z_$][0-9a-zA-Z_$]*" - "|[-+0-9.eE]+|0[xX][0-9a-fA-F]+" - "|[-+*/<>%&^|=!:]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\|"), + /* + * Look for lines that start with optional whitespace, followed + * by 'function' and any characters (for function declarations), + * or valid JavaScript identifiers, equals sign '=', 'function' keyword + * and any characters (for function expressions). + * Also consider functions defined inside blocks with '{...}'. + */ + "^[ \t]*(function[ \t]*.*|[a-zA-Z_$][0-9a-zA-Z_$]*[ \t]*=[ \t]*function[ \t]*.*|(\\{[ \t]*)?)\n", + /* Match JavaScript identifiers with this pattern */ + "[a-zA-Z_$][0-9a-zA-Z_$]*" + "|[-+0-9.eE]+|0[xX][0-9a-fA-F]+" + "|[-+*/<>%&^|=!:]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\|"), PATTERNS("kotlin", "^[ \t]*(([a-z]+[ \t]+)*(fun|class|interface)[ \t]+.*)$", /* -- */