rubygem-rouge/rubygem-rouge-pr1912-espace-hash-in-regex-ruby32.patch
Mamoru TASAKA 97550b18cc Execute spec test provided by the upstream
Backport upstream patch for ruby32 regex issue with hash character
2023-02-12 16:42:17 +09:00

25 lines
940 B
Diff

From 97deb402cf670d6f0708ab583f1b7d769d477c0b Mon Sep 17 00:00:00 2001
From: Tan Le <tan.le@hey.com>
Date: Fri, 13 Jan 2023 17:31:18 +1100
Subject: [PATCH 3/3] Escape character that causes parsing issue
This ensures we escape `#` character to avoid parsing issue in Ruby 3.2.
This change is backward compatible with earlier versions.
---
lib/rouge/lexers/ghc_cmm.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/rouge/lexers/ghc_cmm.rb b/lib/rouge/lexers/ghc_cmm.rb
index 481bf20f9..1bbfb6be0 100644
--- a/lib/rouge/lexers/ghc_cmm.rb
+++ b/lib/rouge/lexers/ghc_cmm.rb
@@ -22,7 +22,7 @@ class GHCCmm < RegexLexer
ws = %r(\s|//.*?\n|/[*](?:[^*]|(?:[*][^/]))*[*]+/)mx
# Make sure that this is not a preprocessor macro, e.g. `#if` or `#define`.
- id = %r((?!#[a-zA-Z])[\w#\$%_']+)
+ id = %r((?!\#[a-zA-Z])[\w#\$%_']+)
complex_id = %r(
(?:[\w#$%_']|\(\)|\(,\)|\[\]|[0-9])*