Allow dynamic theming and improve ruby parser

This commit is contained in:
2026-01-18 13:00:41 +00:00
parent 1fda5bf246
commit d0e811904c
18 changed files with 1029 additions and 496 deletions

View File

@@ -22,13 +22,29 @@ cjk_samples = [
]
# Ruby regex with unicode
$unicode_regex = /[一-龯ぁ-んァ-ヶー々〆〤]/
$unicode_regex = /[一-龯ぁ-ん#{0x3000}
\-ヶー
s wow
々〆〤]/
UNICORE = %r{
{#{}}
}
UNINITCORE = %{
{{#{}}}
}
# Unicode identifiers (valid in Ruby)
= 0x5_4eddaee
π = 3.14_159e+2, ?\u0234, ?\,, ?\x0A, ?s
= -> { "こんにちは" }
= -> { "こんに \n ちは" }
# Method using unicode variable names
def math_test
@@ -53,7 +69,7 @@ multi = <<BASH
local n="$1"
if ((n <= 1)); then
echo 1
else
else\ns
local prev
prev=$(factorial $((n - 1)))
echo $((n * prev))
@@ -82,9 +98,11 @@ mixed = [
two_docs = <<DOC1 , <<DOC2
stuff for doc2
DOC1
stuff for doc 2 with #{interpolation} and more
stuff for doc 2 with \#{interpolation} and more
DOC2
p = 0 <<22
mixed.each { |m| puts m }
# Unicode in comments — highlight me!
@@ -100,6 +118,7 @@ end
escaped = "Line1\nLine2\tTabbed 😀"
puts escaped
p = 0 <<2
# Frozen string literal test
# frozen_string_literal: true
const_str = "定数文字列🔒".freeze
@@ -199,6 +218,8 @@ def greet_person(name)
end
end
h = a / a
# Calling methods
greet_person("Alice")
greet_person("Bob")