branch: elpa/julia-mode commit d96a08c47aca625439e0d09f4e5dc2bf85edc4b6 Author: Wilfred Hughes <m...@wilfred.me.uk> Commit: Yichao Yu <yyc1...@gmail.com>
Refactoring julia-char-regex as an rx form. This regexp has been simplified from the original. The equivalent rx form of the original is: (defconst julia-char-regex (rx (submatch (or (any "-" ";" "\\" "^" "!" "|" "?" "*" "\\" "<" "%" "," "=" ">" "+" "/" "&" "$" "\\" "~" "\\" ":") (syntax open-parenthesis) (syntax whitespace) bol)) (submatch "'" (submatch (or (submatch (*\? (not (any "'"))) (not (any "\\" "\\"))) (submatch "\\\\"))) "'"))) However, the inner groups are unnecessary and there are repeated "\\" occurrences. --- julia-mode.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/julia-mode.el b/julia-mode.el index a5b6d94..efbc9df 100644 --- a/julia-mode.el +++ b/julia-mode.el @@ -110,7 +110,14 @@ This function provides equivalent functionality, but makes no efforts to optimis "\"[^\"]*?\\(\\(\\\\\\\\\\)*\\\\\"[^\"]*?\\)*\"") (defconst julia-char-regex - "\\(\\s(\\|\\s-\\|-\\|[,%=<>\\+*/?&|$!\\^~\\\\;:]\\|^\\)\\('\\(\\([^']*?[^\\\\]\\)\\|\\(\\\\\\\\\\)\\)'\\)") + (rx (submatch (or (any "-" ";" "\\" "^" "!" "|" "?" "*" "<" "%" "," "=" ">" "+" "/" "&" "$" "~" ":") + (syntax open-parenthesis) + (syntax whitespace) + bol)) + (submatch "'" + (or (*? (not (any "'"))) (not (any "\\")) + "\\\\") + "'"))) (defconst julia-unquote-regex "\\(\\s(\\|\\s-\\|-\\|[,%=<>\\+*/?&|!\\^~\\\\;:]\\|^\\)\\($[a-zA-Z0-9_]+\\)")