[gtksourceview: 1/4] php.lang: Add support for Unicode identifiers
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview: 1/4] php.lang: Add support for Unicode identifiers
- Date: Mon, 28 Oct 2019 18:42:40 +0000 (UTC)
commit 282c20c62d0417246ce416f01ed4cc4ce4dab84d
Author: Jeffery To <jeffery to gmail com>
Date: Tue Oct 29 00:03:19 2019 +0800
php.lang: Add support for Unicode identifiers
Fixes #10.
data/language-specs/php.lang | 10 ++++++----
tests/syntax-highlighting/file.php | 8 ++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/data/language-specs/php.lang b/data/language-specs/php.lang
index 17d7b796..0066707e 100644
--- a/data/language-specs/php.lang
+++ b/data/language-specs/php.lang
@@ -58,6 +58,8 @@
<definitions>
+ <define-regex id="identifier">[a-zA-Z_\x{80}-\x{10ffff}][a-zA-Z0-9_\x{80}-\x{10ffff}]*</define-regex>
+
<context id="bash-line-comment" style-ref="comment" end-at-line-end="true" extend-parent="false"
class="comment" class-disabled="no-spell-check">
<start>#</start>
<include>
@@ -89,7 +91,7 @@
</context>
<context id="variable" style-ref="variable">
- <match>[$]+[a-zA-Z_][a-zA-Z0-9_]*</match>
+ <match>[$]+\%{identifier}</match>
</context>
<context id="array-operators" style-ref="variable">
@@ -147,7 +149,7 @@
</context>
<context id="here-doc-string" style-ref="here-doc" extend-parent="true">
- <start>(<<<)\s?([a-zA-Z_][a-zA-Z0-9_]*)</start>
+ <start>(<<<)\s?(\%{identifier})</start>
<end>^(\%{2@start});?$</end>
<include>
<context sub-pattern="0" where="start" style-ref="here-doc-bound"/>
@@ -159,7 +161,7 @@
</context>
<context id="now-doc-string" style-ref="here-doc" extend-parent="true">
- <start>(<<<)\s?'([a-zA-Z_][a-zA-Z0-9_]*)'</start>
+ <start>(<<<)\s?'(\%{identifier})'</start>
<end>^(\%{2@start});?$</end>
<include>
<context sub-pattern="0" where="start" style-ref="here-doc-bound"/>
@@ -172,7 +174,7 @@
</context>
<context id="identifier" style-ref="identifier">
- <match>[a-zA-Z_][a-zA-Z0-9_]*</match>
+ <match>\%{identifier}</match>
</context>
<context id="keywords" style-ref="keyword">
diff --git a/tests/syntax-highlighting/file.php b/tests/syntax-highlighting/file.php
new file mode 100644
index 00000000..69d2c730
--- /dev/null
+++ b/tests/syntax-highlighting/file.php
@@ -0,0 +1,8 @@
+<?php
+$i = 1;
+$數 = 1;
+$i數 = 1;
+
+$str <<<extrémité
+text
+extrémité
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]