;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (require 'cl-lib) #@435 Remove whitespace around STRING. A Whitespace character is defined in the Haskell Report as follows whitechar -> newline | vertab | space | tab | uniWhite newline -> return linefeed | return | linefeed | formfeed uniWhite -> any Unicode character defined as whitespace Note: The implementation currently only supports ASCII white-space characters, i.e. the implemention doesn't consider uniWhite. (fn STRING) (defalias 'haskell-string-trim #[257 "\300\301\"\203\302\303\304\211$\202\211\300\305\"\203\302\303\304\211$\207\207" [string-match "[ \n \f ]+\\'" replace-match "" t "\\`[ \n \f ]+"] 7 (#$ . 106)]) #@73 Return t if STRING contains only whitespace (or is empty). (fn STRING) (defalias 'haskell-string-only-spaces-p #[257 "\300!\301\230\207" [haskell-string-trim ""] 3 (#$ . 757)]) #@68 Return (up to) N character length prefix of STRING. (fn STRING N) (defalias 'haskell-string-take #[514 "\300G^O\207" [0] 6 (#$ . 942)]) #@77 Array of encodings for 7-bit ASCII character points indexed by ASCII value. (defconst haskell-string-literal-encode-ascii-array ["\\NUL" "\\SOH" "\\STX" "\\ETX" "\\EOT" "\\ENQ" "\\ACK" "\\a" "\\b" "\\t" "\\n" "\\v" "\\f" "\\r" "\\SO" "\\SI" "\\DLE" "\\DC1" "\\DC2" "\\DC3" "\\DC4" "\\NAK" "\\SYN" "\\ETB" "\\CAN" "\\EM" "\\SUB" "\\ESC" "\\FS" "\\GS" "\\RS" "\\US" " " "!" "\\\"" "#" "$" "%" "&" "'" "(" ")" "*" "+" "," "-" "." "/" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" ":" ";" "<" "=" ">" "?" "@" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "[" "\\\\" "]" "^" "_" "`" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "{" "|" "}" "~" "\\DEL"] (#$ . 1088)) #@336 Encode STR according Haskell escape rules using 7-bit ASCII representation. The serialization has been implemented to closely match the behaviour of GHC's Show instance for Strings. If NO-QUOTES is non-nil, omit wrapping result in quotes. This is the dual operation to `haskell-string-literal-decode'. (fn STR &optional NO-QUOTES) (defalias 'haskell-string-literal-encode #[513 "\300C\301\302\"\203\303\304#\207\305\303\304#\305Q\207" [-1 make-closure #[257 "\300\242\300\240\210\302Y\203\303\304\"\207\211\305U\203\306U\204/\211\302Y\2035\307Y\2035\310X\2035\311 HP\207 H\207" [V0 haskell-string-literal-encode-ascii-array 128 format "\\%d" 14 72 48 57 "\\&"] 5 "\n\n(fn C)"] mapconcat "" "\""] 9 (#$ . 1867)]) #@184 Regexp for matching escape codes in string literals. See Haskell Report Sect 2.6, URL `http://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-200002.6', for more details. (defconst haskell-string-literal-escapes-regexp (byte-code "\300\301\302\303\304\305\"\303\306\307\"\303\310\311\312!\"#!\313Q\207" ["[\\]\\(?:" regexp-opt append mapcar #[257 "\300\301\"\207" [format "%c"] 4 "\n\n(fn C)"] "abfnrtv\\\"'&" #[257 "\300\301\"\207" [format "^%c"] 4 "\n\n(fn C)"] "ABCDEFGHIJKLMNOPQRSTUVWXYZ@[\\]^_" #[257 "\300\301\"\207" [format "%s"] 4 "\n\n(fn S)"] split-string "NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR\n SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC\n FS GS RS US SP DEL" "\\|[ \n \f ]+[\\]\\|[0-9]+\\|o[0-7]+\\|x[0-9a-f]+\\)?"] 9) (#$ . 2615)) #@119 Hash table containing irregular escape sequences and their decoded strings. Used by `haskell-string-literal-decode1'. (defconst haskell-string-literal-decode1-table (byte-code "\300\301\302\"\303\304\305\"\306\"\210\207" [make-hash-table :test equal mapc make-closure #[257 "\301\302@PA\300#\207" [V0 puthash "\\"] 5 "\n\n(fn C)"] (("NUL" . "") ("SOH" . "") ("STX" . "") ("ETX" . "") ("EOT" . "") ("ENQ" . "") ("ACK" . "") ("BEL" . "") ("BS" . "") ("HT" . " ") ("LF" . "\n") ("VT" . " ") ("FF" . "\f") ("CR" . " ") ("SO" . "") ("SI" . "") ("DLE" . "") ("DC1" . "") ("DC2" . "") ("DC3" . "") ("DC4" . "") ("NAK" . "") ("SYN" . "") ("ETB" . "") ("CAN" . "") ("EM" . "") ("SUB" . "") ("ESC" . "") ("FS" . "") ("GS" . "") ("RS" . "") ("US" . "") ("SP" . " ") ("DEL" . "") ("a" . "") ("b" . "") ("f" . "\f") ("n" . "\n") ("r" . " ") ("t" . " ") ("v" . " ") ("\\" . "\\") ("\"" . "\"") ("'" . "'") ("&" . ""))] 5) (#$ . 3495)) #@171 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'. (fn L) (defalias 'haskell-string-literal-decode1 #[257 "\302\303 \"\206a\304\305\"\203\306\307\310\302O\311\"!\202a\304\312\"\203/\306\307\313\302O\314\"!\202a\304\315\"\203B\306\307\313\302O\316\"!\202a\304\317\"\203S\306\313H\320Z!\202a\304\321\"\203^\322\202a\323\324!)\207" [case-fold-search haskell-string-literal-decode1-table nil gethash string-match "\\`[\\][0-9]+\\'" char-to-string string-to-number 1 10 "\\`[\\]x[[:xdigit:]]+\\'" 2 16 "\\`[\\]o[0-7]+\\'" 8 "\\`[\\]\\^[@-_]\\'" 64 "\\`[\\][ \n \f ]+[\\]\\'" "" error "Invalid escape sequence"] 6 (#$ . 4456)]) #@185 Decode a Haskell string-literal. If NO-QUOTES is nil, ESTR must be surrounded by quotes. This is the dual operation to `haskell-string-literal-encode'. (fn ESTR &optional NO-QUOTES) (defalias 'haskell-string-literal-decode #[513 "\211\204\303\304\305\306#)\266\203\203\307\310O\207\211\203!\202;\311\304\305\306#)\266\203\2038\307\310O\202;\312\313!\304\314\n\315\305\211%)\207" [inhibit-changing-match-data case-fold-search haskell-string-literal-escapes-regexp "\\`\"[^\\\"[:cntrl:]]*\"\\'" nil t string-match 1 -1 "\\`\".*\"\\'" error "String literal must be delimited by quotes" replace-regexp-in-string haskell-string-literal-decode1] 9 (#$ . 5221)]) #@170 Return STRING truncated to (at most) N characters. If truncation occurred, last character in string is replaced by `…'. See also `haskell-string-take'. (fn STRING N) (defalias 'haskell-string-ellipsize #[514 "GX\203 \207\211\300W\203\301\207\302SO\303P\207" [1 "" 0 "…"] 5 (#$ . 5909)]) #@58 Chomp leading and tailing whitespace from STR. (fn STR) (defalias 'haskell-string-chomp #[257 "\300\301\"\203\302\303\304\211$\262\202\207" [string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'" replace-match "" t] 6 (#$ . 6215)]) #@103 Split STR to lines and return a list of strings with preceding and succeding space removed. (fn STR) (defalias 'haskell-string-split-to-lines #[257 "\211;\205\f\300\301\302\303\"\"\207" [cl-mapcar haskell-string-chomp split-string "\n"] 6 (#$ . 6456)]) #@69 If PREFIX is prefix of STR, the string is trimmed. (fn PREFIX STR) (defalias 'haskell-string-trim-prefix #[514 ";\205\211;\205\300\"\205\211G\301O\207" [string-prefix-p nil] 5 (#$ . 6718)]) #@69 If SUFFIX is suffix of STR, the string is trimmed. (fn SUFFIX STR) (defalias 'haskell-string-trim-suffix #[514 ";\205\211;\205\300\"\205\211\301\302G_O\207" [string-suffix-p 0 -1] 6 (#$ . 6925)]) #@114 Drop qualifier from given identifier IDENT. If the identifier is not qualified return it unchanged. (fn IDENT) (defalias 'haskell-string-drop-qualifier #[257 "\300\301\"\203\302\303\"\206\211\207" [string-match "^\\([^.]*\\.\\)*\\(?1:[^.]+\\)$" match-string 1] 4 (#$ . 7139)]) #@122 Echo STR in mini-buffer. Given string is shrinken to single line, multiple lines just disturbs the programmer. (fn STR) (defalias 'haskell-mode-message-line #[257 "\300 ?\205\301\302\303\304 \"\"\207" [active-minibuffer-window message "%s" haskell-mode-one-line frame-width] 6 (#$ . 7431)]) #@100 Try to fit STR as much as possible on one line according to given WIDTH. (fn STR &optional WIDTH) (defalias 'haskell-mode-one-line #[513 "\211\204G\262\300\301\302#\300\303\302\304!#\305\306\211\307%\207" [replace-regexp-in-string "\n" " " " +" haskell-string-trim truncate-string-to-width nil "…"] 10 (#$ . 7733)]) (provide 'haskell-string)