Function: haskell-string-literal-decode1

haskell-string-literal-decode1 is a natively compiled function defined in haskell-string.el.

Signature

(haskell-string-literal-decode1 L)

Documentation

Decode a single string literal escape sequence.

L must contain exactly one escape sequence. This is an internal function used by haskell-string-literal-decode.

Source Code

;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-string.el
(defun haskell-string-literal-decode1 (l)
  "Decode a single string literal escape sequence.
L must contain exactly one escape sequence.
This is an internal function used by `haskell-string-literal-decode'."
  (let ((case-fold-search nil))
    (cond
     ((gethash l haskell-string-literal-decode1-table))
     ((string-match "\\`[\\][0-9]+\\'" l)         (char-to-string (string-to-number (substring l 1) 10)))
     ((string-match "\\`[\\]x[[:xdigit:]]+\\'" l) (char-to-string (string-to-number (substring l 2) 16)))
     ((string-match "\\`[\\]o[0-7]+\\'" l)        (char-to-string (string-to-number (substring l 2) 8)))
     ((string-match "\\`[\\]\\^[@-_]\\'" l)       (char-to-string (- (aref l 2) ?@))) ;; "cntrl" escapes
     ((string-match "\\`[\\][\t\n\v\f\r ]+[\\]\\'" l) "") ;; whitespace gap
     (t (error "Invalid escape sequence")))))