[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/raku-mode 730155c851 103/253: Apply prefix syntax property
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/raku-mode 730155c851 103/253: Apply prefix syntax property to sigils and twigils |
Date: |
Sat, 29 Jan 2022 08:28:46 -0500 (EST) |
branch: elpa/raku-mode
commit 730155c85112a728ca9cdb481ff4749bf65b5a22
Author: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Commit: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
Apply prefix syntax property to sigils and twigils
---
perl6-font-lock.el | 256 +++++++++++++++++++++++++++--------------------------
1 file changed, 132 insertions(+), 124 deletions(-)
diff --git a/perl6-font-lock.el b/perl6-font-lock.el
index 51a22384dc..86fe5d9679 100644
--- a/perl6-font-lock.el
+++ b/perl6-font-lock.el
@@ -114,123 +114,132 @@
(let ((body (cdr form)))
(rx-to-string `(and symbol-start ,@body symbol-end) 'no-group)))
- (defconst perl6-rx-constituents
- `((symbol perl6-rx-symbol 0 nil)
- (routine
- . ,(rx (or "macro" "sub" "submethod" "method" "multi" "proto" "only"
- "category")))
- (module
- . ,(rx (or "module" "class" "role" "package" "enum" "grammar" "slang"
- "subset")))
- (rule . ,(rx (or "regex" "rule" "token")))
- (include . ,(rx (or "use" "require")))
- (conditional . ,(rx (or "if" "else" "elsif" "unless")))
- (scope . ,(rx (or "let" "my" "our" "state" "temp" "has" "constant")))
- (loop . ,(rx (or "for" "loop" "repeat" "while" "until" "gather"
"given")))
- (flow-control
- . ,(rx (or "take" "do" "when" "next" "last" "redo" "return" "contend"
- "maybe" "defer" "start" "default" "exit" "make" "continue"
- "break" "goto" "leave" "async" "lift")))
- (phaser
- . ,(rx (or "BEGIN" "CHECK" "INIT" "START" "FIRST" "ENTER" "LEAVE" "KEEP"
- "UNDO" "NEXT" "LAST" "PRE" "POST" "END" "CATCH" "CONTROL"
- "TEMP")))
- (exception . ,(rx (or "die" "fail" "try" "warn")))
- (pragma . ,(rx (or "oo" "fatal")))
- (type-constraint
- . ,(rx (or "does" "as" "but" "trusts" "of" "returns" "handles" "where"
- "augment" "supersede")))
- (type-property
- . ,(rx (or "signature" "context" "also" "shape" "prec" "irs" "ofs" "ors"
- "export" "deep" "binary" "unary" "reparsed" "rw" "parsed"
- "cached" "readonly" "defequiv" "will" "ref" "copy" "inline"
- "tighter" "looser" "equiv" "assoc" "required")))
- (operator-word
- . ,(rx (or "div" "xx" "x" "mod" "also" "leg" "cmp" "before" "after" "eq"
- "ne" "le" "lt" "not" "gt" "eqv" "ff" "fff" "and" "andthen"
- "or" "xor" "orelse" "extra" "lcm" "gcd")))
- (operator-char . ,(rx (any "-:+/*~?|=^!%&,<>».;\\∈∉∋∌∩∪≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖∅")))
- (set-operator
- . ,(rx (opt "R")
- "\("
- (or (char "-^.+|&")
- (and (char "<>") (opt (char "=+")))
- "cont"
- "elem")
- "\)"))
- (rsxz-operator
- . ,(rx
- symbol-start
- (any "RSXZ")
- (or (or (and (or "div" "mod" "gcd" "lcm" "xx" "x" "does" "but" "cmp"
- "leg" "eq" "ne" "gt" "ge" "lt" "le" "before"
"after"
- "eqv" "min" "max" "not" "so" "andthen" "and" "or"
- "orelse")
- symbol-end)
- (any ".,")
- (1+ (regex "[^:\[.,[:space:][:alnum:]]")))
- symbol-end)))
- (reduce-operator
- . ,(rx (0+ (any "RSXZ\["))
- (opt (any "RSXZ&"))
- (1+ "\[")
- (opt "\(")
- (or (and (regex "[^[:digit:]@%$]")
- (0+ (regex "[^\[\{\('\"[:space:]]")))
- (and (any "@%$")
- (regex "[^.?^=_[:alpha:]]\[\{\('\"[:space:]]")
- (0+ (regex "[^\[\{\('\"[:space:]]"))))
- (opt "\)")
- (1+ "\]")))
- (low-type
- . ,(rx (or "int" "int1" "int2" "int4" "int8" "int16" "int32" "int64"
- "rat" "rat1" "rat2" "rat4" "rat8" "rat16" "rat32" "rat64"
- "buf" "buf1" "buf2" "buf4" "buf8" "buf16" "buf32" "buf64"
- "uint" "uint1" "uint2" "uint4" "uint8" "uint16" "uint32"
- "uint64" "utf8" "utf16" "utf32" "bit" "bool" "bag" "set"
- "mix" "num" "complex")))
- (high-type
- . ,(rx (or "Object" "Any" "Junction" "Whatever" "Capture" "Match"
- "Signature" "Proxy" "Matcher" "Package" "Module" "Class"
- "Grammar" "Scalar" "Array" "Hash" "KeyHash" "KeySet" "KeyBag"
- "Pair" "List" "Seq" "Range" "Set" "Bag" "Mapping" "Void"
- "Undef" "Failure" "Exception" "Code" "Block" "Routine" "Sub"
- "Macro" "Method" "Submethod" "Regex" "Str" "Blob" "Char"
- "Byte" "Parcel" "Codepoint" "Grapheme" "StrPos" "StrLen"
- "Version" "Num" "Complex" "Bit" "True" "False" "Order" "Same"
- "Less" "More" "Increasing" "Decreasing" "Ordered" "Callable"
- "AnyChar" "Positional" "Associative" "Ordering"
"KeyExtractor"
- "Comparator" "OrderingPair" "IO" "KitchenSink" "Role" "Int"
- "Rat" "Buf" "UInt" "Abstraction" "Numeric" "Real" "Nil"
"Mu")))
- (identifier . ,(rx (regex "[_[:alpha:]]")
- (0+ (regex "[_[:alnum:]]"))
- (0+ (any "-'")
- (regex "[_[:alpha:]]") (0+ (regex
"[_[:alnum:]]")))))
- (version . ,(rx "v" (1+ digit) (0+ "." (or "*" (1+ digit))) (opt "+")))
- (number
- . ,(rx
- (group-n 1
- (opt (1+ digit) (opt "_" (1+ digit)))
- (opt ".")
- (1+ digit))
- (opt (group-n 2 (any "Ee"))
- (group-n 3 (opt "-") (1+ digit) (opt "_" (1+ digit))))
- (opt (group-n 4 "i"))))
- (base-number
- . ,(rx symbol-start
- (group-n 1 "0")
- (or (and
- (group-n 2 "o")
- (group-n 3 (any "0-7") (0+ (any "0-7_"))))
- (and
- (group-n 2 "b")
- (group-n 3 (any "0-1") (0+ (any "0-1_"))))
- (and
- (group-n 2 "x")
- (group-n 3 (regex "[[:xdigit:]]") (0+ (regex
"[[:xdigit:]_]"))))
- (and
- (group-n 2 "d")
- (group-n 3 (regex "[[:digit:]]") (0+ (regex
"[[:digit:]_]")))))))))
+ (let ((rx-identifier (rx (regex "[_[:alpha:]]")
+ (0+ (regex "[_[:alnum:]]"))
+ (0+ (any "-'")
+ (regex "[_[:alpha:]]") (0+ (regex
"[_[:alnum:]]"))))))
+ (defconst perl6-rx-constituents
+ `((symbol perl6-rx-symbol 0 nil)
+ (identifier . ,rx-identifier)
+ (variable
+ . ,(rx-to-string
+ `(and (group (1+ (char "@$%&")))
+ (group (opt (char ".^*?=!~:")))
+ (group (opt (or (and "::" (0+ (regex ,rx-identifier) "::"))
+ (1+ (regex ,rx-identifier) "::"))))
+ (group (or (or digit (char "/!¢"))
+ (and (regex ,rx-identifier) symbol-end))))))
+ (routine
+ . ,(rx (or "macro" "sub" "submethod" "method" "multi" "proto" "only"
+ "category")))
+ (module
+ . ,(rx (or "module" "class" "role" "package" "enum" "grammar" "slang"
+ "subset")))
+ (rule . ,(rx (or "regex" "rule" "token")))
+ (include . ,(rx (or "use" "require")))
+ (conditional . ,(rx (or "if" "else" "elsif" "unless")))
+ (scope . ,(rx (or "let" "my" "our" "state" "temp" "has" "constant")))
+ (loop . ,(rx (or "for" "loop" "repeat" "while" "until" "gather"
"given")))
+ (flow-control
+ . ,(rx (or "take" "do" "when" "next" "last" "redo" "return" "contend"
+ "maybe" "defer" "start" "default" "exit" "make" "continue"
+ "break" "goto" "leave" "async" "lift")))
+ (phaser
+ . ,(rx (or "BEGIN" "CHECK" "INIT" "START" "FIRST" "ENTER" "LEAVE"
"KEEP"
+ "UNDO" "NEXT" "LAST" "PRE" "POST" "END" "CATCH" "CONTROL"
+ "TEMP")))
+ (exception . ,(rx (or "die" "fail" "try" "warn")))
+ (pragma . ,(rx (or "oo" "fatal")))
+ (type-constraint
+ . ,(rx (or "does" "as" "but" "trusts" "of" "returns" "handles" "where"
+ "augment" "supersede")))
+ (type-property
+ . ,(rx (or "signature" "context" "also" "shape" "prec" "irs" "ofs"
"ors"
+ "export" "deep" "binary" "unary" "reparsed" "rw" "parsed"
+ "cached" "readonly" "defequiv" "will" "ref" "copy" "inline"
+ "tighter" "looser" "equiv" "assoc" "required")))
+ (operator-word
+ . ,(rx (or "div" "xx" "x" "mod" "also" "leg" "cmp" "before" "after"
"eq"
+ "ne" "le" "lt" "not" "gt" "eqv" "ff" "fff" "and" "andthen"
+ "or" "xor" "orelse" "extra" "lcm" "gcd")))
+ (operator-char . ,(rx (any
"-:+/*~?|=^!%&,<>».;\\∈∉∋∌∩∪≼≽⊂⊃⊄⊅⊆⊇⊈⊉⊍⊎⊖∅")))
+ (set-operator
+ . ,(rx (opt "R")
+ "\("
+ (or (char "-^.+|&")
+ (and (char "<>") (opt (char "=+")))
+ "cont"
+ "elem")
+ "\)"))
+ (rsxz-operator
+ . ,(rx
+ symbol-start
+ (any "RSXZ")
+ (or (or (and (or "div" "mod" "gcd" "lcm" "xx" "x" "does" "but"
"cmp"
+ "leg" "eq" "ne" "gt" "ge" "lt" "le" "before"
"after"
+ "eqv" "min" "max" "not" "so" "andthen" "and" "or"
+ "orelse")
+ symbol-end)
+ (any ".,")
+ (1+ (regex "[^:\[.,[:space:][:alnum:]]")))
+ symbol-end)))
+ (reduce-operator
+ . ,(rx (0+ (any "RSXZ\["))
+ (opt (any "RSXZ&"))
+ (1+ "\[")
+ (opt "\(")
+ (or (and (regex "[^[:digit:]@%$]")
+ (0+ (regex "[^\[\{\('\"[:space:]]")))
+ (and (any "@%$")
+ (regex "[^.?^=_[:alpha:]]\[\{\('\"[:space:]]")
+ (0+ (regex "[^\[\{\('\"[:space:]]"))))
+ (opt "\)")
+ (1+ "\]")))
+ (low-type
+ . ,(rx (or "int" "int1" "int2" "int4" "int8" "int16" "int32" "int64"
+ "rat" "rat1" "rat2" "rat4" "rat8" "rat16" "rat32" "rat64"
+ "buf" "buf1" "buf2" "buf4" "buf8" "buf16" "buf32" "buf64"
+ "uint" "uint1" "uint2" "uint4" "uint8" "uint16" "uint32"
+ "uint64" "utf8" "utf16" "utf32" "bit" "bool" "bag" "set"
+ "mix" "num" "complex")))
+ (high-type
+ . ,(rx (or "Object" "Any" "Junction" "Whatever" "Capture" "Match"
+ "Signature" "Proxy" "Matcher" "Package" "Module" "Class"
+ "Grammar" "Scalar" "Array" "Hash" "KeyHash" "KeySet"
"KeyBag"
+ "Pair" "List" "Seq" "Range" "Set" "Bag" "Mapping" "Void"
+ "Undef" "Failure" "Exception" "Code" "Block" "Routine"
"Sub"
+ "Macro" "Method" "Submethod" "Regex" "Str" "Blob" "Char"
+ "Byte" "Parcel" "Codepoint" "Grapheme" "StrPos" "StrLen"
+ "Version" "Num" "Complex" "Bit" "True" "False" "Order"
"Same"
+ "Less" "More" "Increasing" "Decreasing" "Ordered"
"Callable"
+ "AnyChar" "Positional" "Associative" "Ordering"
"KeyExtractor"
+ "Comparator" "OrderingPair" "IO" "KitchenSink" "Role" "Int"
+ "Rat" "Buf" "UInt" "Abstraction" "Numeric" "Real" "Nil"
"Mu")))
+ (version . ,(rx "v" (1+ digit) (0+ "." (or "*" (1+ digit))) (opt "+")))
+ (number
+ . ,(rx
+ (group-n 1
+ (opt (1+ digit) (opt "_" (1+ digit)))
+ (opt ".")
+ (1+ digit))
+ (opt (group-n 2 (any "Ee"))
+ (group-n 3 (opt "-") (1+ digit) (opt "_" (1+ digit))))
+ (opt (group-n 4 "i"))))
+ (base-number
+ . ,(rx symbol-start
+ (group-n 1 "0")
+ (or (and
+ (group-n 2 "o")
+ (group-n 3 (any "0-7") (0+ (any "0-7_"))))
+ (and
+ (group-n 2 "b")
+ (group-n 3 (any "0-1") (0+ (any "0-1_"))))
+ (and
+ (group-n 2 "x")
+ (group-n 3 (regex "[[:xdigit:]]") (0+ (regex
"[[:xdigit:]_]"))))
+ (and
+ (group-n 2 "d")
+ (group-n 3 (regex "[[:digit:]]") (0+ (regex
"[[:digit:]_]"))))))))))
(defmacro perl6-rx (&rest sexps)
"Specialized `rx' variant for perl6-mode."
@@ -415,7 +424,11 @@ Takes arguments START and END which delimit the region to
propertize."
((rx (any "‘「“"))
(0 (ignore (progn (backward-char)
(with-syntax-table perl6-string-delimiter-syntax-table
- (perl6-syntax-propertize-delimiters "|")))))))
+ (perl6-syntax-propertize-delimiters "|"))))))
+ ((perl6-rx variable)
+ (1 ". p")
+ (2 ". p")
+ (3 (ignore (goto-char (match-beginning 3))))))
start end)))
(defun perl6-font-lock-syntactic-face (state)
@@ -498,12 +511,7 @@ LIMIT can be used to bound the search."
(and (0+ space)
(or (any ",\)\}") (symbol "where")))))
1 'perl6-sigil)
- (,(perl6-rx (group (1+ (char "@$%&")))
- (group (opt (char ".^*?=!~:")))
- (group (opt (or (and "::" (0+ (and identifier "::")))
- (1+ identifier "::"))))
- (group (or (or digit (char "/!¢"))
- (and identifier symbol-end))))
+ (,(perl6-rx variable)
(1 'perl6-sigil)
(2 'perl6-twigil)
(3 'perl6-var-package)
- [nongnu] elpa/raku-mode 04f458529e 206/253: Rename perl6 -> raku in test files, (continued)
- [nongnu] elpa/raku-mode 04f458529e 206/253: Rename perl6 -> raku in test files, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode ed816f0ce3 214/253: Add a new item, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 0968a528bb 216/253: Fix wrong slashes., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 21af6e8398 224/253: Add comment-style highlighting to POD., ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 9fa9e3968e 091/253: pcase is more straightforward than let+cond here, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode aa5078f9cc 112/253: Mention test suite in README.md, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 299099e246 102/253: Simplify variable fontification, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 8ecc3daa40 113/253: Expand comment, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 6d4ef1743a 118/253: More robust comment highlighting, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 07b36e8506 114/253: Amend comment about magic-mode-alist a bit, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 730155c851 103/253: Apply prefix syntax property to sigils and twigils,
ELPA Syncer <=
- [nongnu] elpa/raku-mode 2b5f69ade1 094/253: Fix highlighting of some non-alphanumberic RSXZ metaops, like C«R<», ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode cf09f024a3 099/253: Support some unicode quote delimiters, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 87fdf3d563 085/253: Highlight numbered match variables ($1, $2, ...), ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 2a9e959a24 092/253: Improve highlighting of bracketed strings/comments, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode aa57012ec3 138/253: Minor change to magic pattern, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 4aa7fde34b 134/253: Separate syntax flags, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 3d4a45d644 128/253: No identifiers in comments after recent changes, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 883a60e8ef 127/253: Clean up label pattern, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode c8e8ebe289 150/253: fix the range of choices more completely, ELPA Syncer, 2022/01/29
- [nongnu] elpa/raku-mode 8319cebe75 147/253: remove imenu item, ELPA Syncer, 2022/01/29