;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307\310\311\312\313\314& \210\315\316\317\320\321DD\322\323\324\311\304&\210\315\325\317\320\326DD\327\323\324\311\304&\210\315\330\317\320\331DD\332\323\324\311\304&\210\315\333\317\320\334DD\335\323\324\311\304&\210\315\336\317\320\337DD\340\323\324\311\304&\210\315\341\317\320\342DD\343\323\344\311\304&\210\345\341!\207" [require cl-lib haskell-lexeme custom-declare-group haskell-indentation nil "Haskell indentation." :link (custom-manual "(haskell-mode)Indentation") :group haskell :prefix "haskell-indentation-" custom-declare-variable haskell-indentation-layout-offset funcall function #[0 "\300\207" [2] 1] "Extra indentation to add before expressions in a Haskell layout list." :type integer haskell-indentation-starter-offset #[0 "\300\207" [2] 1] "Extra indentation after an opening keyword (e.g. \"let\")." haskell-indentation-left-offset #[0 "\300\207" [2] 1] "Extra indentation after an indentation to the left (e.g. after \"do\")." haskell-indentation-where-pre-offset #[0 "\300\207" [2] 1] "Extra indentation before the keyword \"where\"." haskell-indentation-where-post-offset #[0 "\300\207" [2] 1] "Extra indentation after the keyword \"where\"." haskell-indentation-electric-flag #[0 "\300\207" [nil] 1] "Non-nil means insertion of some characters may auto reindent the line.\nIf the variable `electric-indent-mode' is non-nil then this variable is\noverridden." symbol make-variable-buffer-local] 10) #@40 Keymap for `haskell-indentation-mode'. (defvar haskell-indentation-mode-map (byte-code "\300 \301\302\303#\210\301\304\305#\210\301\306\307#\210\301\310\307#\210\301\311\307#\210\301\312\307#\210\301\313\307#\210\207" [make-sparse-keymap define-key " " haskell-indentation-newline-and-indent [backtab] haskell-indentation-indent-backwards "," haskell-indentation-common-electric-command ";" ")" "}" "]"] 5) (#$ . 1572)) #@117 Non-nil if Haskell-Indentation mode is enabled. Use the command `haskell-indentation-mode' to change this variable. (defvar haskell-indentation-mode nil (#$ . 2006)) (make-variable-buffer-local 'haskell-indentation-mode) #@737 Haskell indentation mode that deals with the layout rule. It rebinds RET, DEL and BACKSPACE, so that indentations can be set and deleted as if they were real tabs. This is a minor mode. If called interactively, toggle the `Haskell-Indentation mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `haskell-indentation-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. (fn &optional ARG) (defalias 'haskell-indentation-mode #[256 "\305 \306=\203 ?\202\247\203\307W\203\310\202\311\312\301!\2031\313\300 \"\2031\300 B\314\303!\210\314\304!\210\203\\\312\302!\203P\n\203P\315\316!\203P\316 \210\317\303!\210\320\317\304!\210\321\322\323\203f\324\202g\325\"\210\326\327!\203\211\305 \203{\211\305 \232\203\211\330\331\203\205\332\202\206\333\334#\210\210\335 \210\207" [haskell-indentation-mode local-minor-modes haskell-indent-mode indent-line-function indent-region-function current-message toggle 1 nil t boundp delq kill-local-variable fboundp turn-off-haskell-indent make-local-variable haskell-indentation-indent-line haskell-indentation-indent-region run-hooks haskell-indentation-mode-hook haskell-indentation-mode-on-hook haskell-indentation-mode-off-hook called-interactively-p any message "Haskell-Indentation mode %sabled%s" "en" "dis" " in current buffer" force-mode-line-update] 6 (#$ . 2234) (byte-code "\203\n\301!\202 \302C\207" [current-prefix-arg prefix-numeric-value toggle] 2)]) (defvar haskell-indentation-mode-hook nil) (byte-code "\301\302N\204\f\303\301\302\304#\210\303\301\305\306#\210\303\301\307\310C#\210\311\312\310\310\211%\207" [haskell-indentation-mode-map haskell-indentation-mode-hook variable-documentation put "Hook run after entering or leaving `haskell-indentation-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode haskell-indentation-mode] 6) #@45 Turn on the haskell-indentation minor mode. (defalias 'turn-on-haskell-indentation #[0 "\300\301!\207" [haskell-indentation-mode t] 2 (#$ . 4547) nil]) (make-obsolete 'turn-on-haskell-indentation 'haskell-indentation-mode "2015-05-25") #@77 Return t if this is a literate Haskell buffer in bird style, NIL otherwise. (defalias 'haskell-indentation-bird-p #[0 "\301=\207" [haskell-literate bird] 2 (#$ . 4789)]) #@97 Reindent current line to COL, move the point there if MOVE is non-NIL. (fn COL &optional MOVE) (defalias 'haskell-indentation-reindent-to #[513 "\300 \212\301!\210\211X\203\302\303Z\304\"!\210\202\305Z!\210)\205'\301!\207" [haskell-indentation-current-indentation move-to-column insert-before-markers make-string 32 delete-char] 7 (#$ . 4966)]) #@271 Indent all lines starting in the region sideways by ARG columns. Called from a program, takes three arguments, START, END and ARG. You can remove all indentation from a region by giving a large negative ARG. Handles bird style literate Haskell too. (fn START END ARG) (defalias 'haskell-indentation-indent-rigidly #[771 "\212b\210\300 b\210n\204\301y\210`W\2039\302 \303f\304=\203\"\305u\210\306\307!\210l\2042\310\301\\]!\210\305y\266\202\211\303\211\223\262)\207" [point-marker 0 haskell-indentation-current-indentation nil 62 1 skip-syntax-forward "-" haskell-indentation-reindent-to] 9 (#$ . 5332) "*r\np"]) #@68 Column position of first non-whitespace character in current line. (defalias 'haskell-indentation-current-indentation #[0 "\212\300 \210\301 \203\f\302u\210\303\304!\210i)\207" [beginning-of-line haskell-indentation-bird-p nil skip-syntax-forward "-"] 2 (#$ . 5966)]) #@63 Non-NIL if we are in bird literate mode, but outside of code. (defalias 'haskell-indentation-bird-outside-code-p #[0 "\300 \205i\301W\206\212\302 \210\303f)\304=?\207" [haskell-indentation-bird-p 2 beginning-of-line nil 62] 2 (#$ . 6241)]) #@28 Insert newline and indent. (defalias 'haskell-indentation-newline-and-indent #[0 "\300 \203 \301 \210\302 \207\303 \301 \210\302 \210\304 \206\305\306 \203!\307c\210\310\311S\312#\313\"\207" [haskell-indentation-bird-outside-code-p delete-horizontal-space newline haskell-indentation-current-indentation haskell-indentation-find-indentations (0) haskell-indentation-bird-p "> " haskell-indentation-reindent-to haskell-indentation-next-indentation nofail move] 7 (#$ . 6491) "*"]) #@244 Find the leftmost indentation which is greater than COL. Indentations are taken from INDENTATIONS, which should be a list. Return the last indentation if there are no bigger ones and NOFAIL is non-NIL. (fn COL INDENTATIONS &optional NOFAIL) (defalias 'haskell-indentation-next-indentation #[770 "\204\300\301!\210\302\303\304\"\"\206\211\205\305!@\207" [error "haskell-indentation-next-indentation called with empty list" cl-find-if make-closure #[257 "\211\300V\207" [V0] 3 "\n\n(fn I)"] last] 7 (#$ . 6984)]) #@218 Find the rightmost indentation less than COL from INDENTATIONS. When no indentations are less than COL, return the rightmost indentation if NOFAIL is non-nil, or nil otherwise. (fn COL INDENTATIONS &optional NOFAIL) (defalias 'haskell-indentation-previous-indentation #[770 "\204\300\301!\210\302!\303\304\305\"\"\206\205\211@\207" [error "haskell-indentation-previous-indentation called with empty list" reverse cl-find-if make-closure #[257 "\211\300W\207" [V0] 3 "\n\n(fn I)"]] 8 (#$ . 7514)]) #@2  (defvar haskell-indentation-dyn-last-direction nil (#$ . 8029)) #@2  (defvar haskell-indentation-dyn-last-indentations nil (#$ . 8099)) #@309 Indent current line, cycle though indentation positions. Do nothing inside multiline comments and multiline strings. Start enumerating the indentation points to the right. The user can continue by repeatedly pressing TAB. When there is no more indentation points to the right, we switch going to the left. (defalias 'haskell-indentation-indent-line #[0 "\302 ?\205<\303i\304 \212\305!\210\306 \206\307)>W\203,\211\203,\305!\210\2025\310\311\312#\"\210\313\211\266\205\207" [haskell-indentation-dyn-last-direction haskell-indentation-dyn-last-indentations haskell-indentation-indent-line-repeat nil haskell-indentation-current-indentation move-to-column haskell-indentation-find-indentations (0) haskell-indentation-reindent-to haskell-indentation-next-indentation nofail right] 10 (#$ . 8174) "*"]) #@37 Cycle though indentation positions. (defalias 'haskell-indentation-indent-line-repeat #[0 "\304>\203 \305=\203\306\307\310 \311 \312#\210)\306\207\313=\203U \314>\203U \203U\315 \316=\203<\317\320 \321#!\210\202S\322 \"\203N\317\322 \321#!\210\202S\316\323 \210\306\207\324\207" [last-command haskell-indentation-dyn-last-direction mark-even-if-inactive haskell-indentation-dyn-last-indentations (indent-for-tab-command haskell-indentation-indent-backwards) region t haskell-indentation-indent-rigidly region-beginning region-end 1 indent-for-tab-command (left right) haskell-indentation-current-indentation left haskell-indentation-reindent-to haskell-indentation-previous-indentation nofail haskell-indentation-next-indentation haskell-indentation-indent-line-repeat nil] 6 (#$ . 9001)]) #@420 This function does nothing. It is better to do nothing to indent region in Haskell than to break the semantics of indentation. This function is used for `indent-region-function' because the default is to call `indent-line-function' on every line from START to END and that also produces catastrophic results. Someday we will have indent region that preserves semantics and fixes up only indentation. (fn START END) (defalias 'haskell-indentation-indent-region #[514 "\300\207" [nil] 3 (#$ . 9817)]) #@60 Indent the current line to the previous indentation point. (defalias 'haskell-indentation-indent-backwards #[0 "\303>\203 \304=\203\305\306\307 \310 \311#)\207\312 \203*\304\306\307 \310 \311#\210\313\314!\207\315i\316 \212\317!\210\320 \206:\321)W\322\"\211\204M\323\324 @\"\207\323\"\207" [last-command haskell-indentation-dyn-last-direction mark-even-if-inactive (indent-for-tab-command haskell-indentation-indent-backwards) region t haskell-indentation-indent-rigidly region-beginning region-end -1 use-region-p message "Press TAB or S-TAB again to indent the region more" nil haskell-indentation-current-indentation move-to-column haskell-indentation-find-indentations (0) haskell-indentation-previous-indentation haskell-indentation-reindent-to haskell-indentation-first-indentation] 8 (#$ . 10326) "*"]) #@395 Call `self-insert-command' to insert the character typed ARG times and indent when all of the following are true: 1) The character is the first non-whitespace character on the line. 2) There is only one possible indentation position. 3) The variable `electric-indent-mode' or `haskell-indentation-electric-flag' is non-nil. 4) The point is not in a comment, string, or quasiquote. (fn ARG) (defalias 'haskell-indentation-common-electric-command #[257 "i\302\303!\210\204 \2058\304 U\2058\305V\2058\306\307 8?\2058\212\310!\210\311 \211\262G)\312U\2058\313@!\207" [haskell-indentation-electric-flag electric-indent-mode nil self-insert-command haskell-indentation-current-indentation 0 8 syntax-ppss move-to-column haskell-indentation-find-indentations 1 haskell-indentation-reindent-to] 5 (#$ . 11163) "*p"]) #@2  (defalias 'haskell-indentation-goto-least-indentation #[0 "\300 \210\301 \203T\3022\261\303f\304=\204\303y\210\305u\210\306\302\303\"\210\307\310 8\211\203,\211b\210\300 \210\210\305\311 Y\203B\312\313!\204B\305u\210\306\302\303\"\210o\203N\305u\210\306\302\303\"\210\314y\210\202\f\3022\245o?\205\244`\315\316 [!\210`\232\203q\314y\266\202u\300 \266\310 \3078A@\203\210b\266\202X\211\203\223\211b\266\202X\311 \317U\203\237\306\302\303\"\210\266\202X0\210\300 \210o\205\261\315\316 !\207" [beginning-of-line haskell-indentation-bird-p return nil 62 2 throw 8 syntax-ppss haskell-indentation-current-indentation looking-at ">\\s-*$" -1 forward-comment buffer-size 0] 6 (#$ . 11995)]) #@2  (defalias 'haskell-indentation-parse-to-indentations #[0 "\212\306\307!\210`\310\211\211\311\211\211\211\211\211\312 \210`X\2030\313 \202<\314 \3152:\316 0\210\n.\f\207" [haskell-indentation-layout-offset implicit-layout-active possible-indentations following-token previous-token current-token skip-syntax-forward "-" 0 nil haskell-indentation-goto-least-indentation haskell-indentation-first-indentation haskell-indentation-peek-token parse-end haskell-indentation-toplevel case-fold-search left-indent starter-indent current-indent layout-indent indentation-point] 11 (#$ . 12715)]) #@37 Return column of first indentation. (defalias 'haskell-indentation-first-indentation #[0 "\300 \203 \301\202\n\302C\207" [haskell-indentation-bird-p 2 0] 1 (#$ . 13332)]) #@79 Return list of indentation positions corresponding to actual cursor position. (defalias 'haskell-indentation-find-indentations #[0 "\300 \3018\203.\212\302y\205\3038`W)\203 \212\302y\210\304 )C\207\305\306 \212\3038b\210i)C\"\207\3078\203V\212\310\311!\205Ll\205L\312y\313V?\205L\307\300 8?)\203S\314 \207\306 \207\314 \207" [syntax-ppss 3 -1 8 current-indentation append haskell-indentation-first-indentation 4 skip-syntax-forward "-" 1 0 haskell-indentation-parse-to-indentations] 5 (#$ . 13511)]) #@70 Translation from UnicodeSyntax tokens to their ASCII representation. (defconst haskell-indentation-unicode-tokens '(("→" . "->") ("∷" . "::") ("←" . "<-") ("⇒" . "=>") ("∀" . "forall") ("⤙" . "-<") ("⤚" . ">-") ("⤛" . "-<<") ("⤜" . ">>-") ("★" . "*")) (#$ . 14030)) #@53 Alist of toplevel keywords with associated parsers. (defconst haskell-indentation-toplevel-list '(("module" . haskell-indentation-module) ("signature" . haskell-indentation-module) ("data" . haskell-indentation-data) ("type" . haskell-indentation-data) ("newtype" . haskell-indentation-data) ("import" . haskell-indentation-import) ("foreign" . haskell-indentation-foreign) ("where" . haskell-indentation-toplevel-where) ("class" . haskell-indentation-class-declaration) ("instance" . haskell-indentation-class-declaration) ("deriving" . haskell-indentation-deriving)) (#$ . 14322)) #@63 Alist of tokens in type declarations with associated parsers. (defconst haskell-indentation-type-list (byte-code "\300\301\302\301\303\304\305#\"B\306\301\307\304\310\311$B\312\301\307\304\313\311$B\314\301\307\304\315\311$BF\207" ["::" apply-partially haskell-indentation-with-starter haskell-indentation-separated haskell-indentation-type ("->" "=>") "(" haskell-indentation-list ")" "," "[" "]" "{" "}"] 9) (#$ . 14911)) #@59 Alist of keywords in expressions with associated parsers. (defconst haskell-indentation-expression-list (byte-code "\300\301\302\303\304\305\306\307\"B\310\305\311\312\"B\313\305\311\312\"B\314\305\311\312\"B\315\305\306\316\"B\317\305\311\320\"B\321\305\306\322\"B\323\305\311\324\325\326$B\327\330\305\331\332\"B\333\305\331\332\"B\334\305\335\332\336\337$B\340\305\335\332\341\342\343%B\344\305\335\332\345\342$B\257\207" [("data" . haskell-indentation-data) ("type" . haskell-indentation-data) ("newtype" . haskell-indentation-data) ("if" . haskell-indentation-if) "let" apply-partially haskell-indentation-phrase (haskell-indentation-declaration-layout "in" haskell-indentation-expression) "do" haskell-indentation-with-starter haskell-indentation-expression-layout "mdo" "rec" "case" (haskell-indentation-expression "of" haskell-indentation-case-layout) "\\" haskell-indentation-lambda-maybe-lambdacase "proc" (haskell-indentation-expression "->" haskell-indentation-expression) "where" haskell-indentation-declaration-layout nil t ("::" . haskell-indentation-scoped-type) "=" haskell-indentation-statement-right haskell-indentation-expression "<-" "(" haskell-indentation-list ")" (list "," "->") "[" "]" "," "|" "{" "}"] 23) (#$ . 15341)) #@57 Parse layout list with expressions, such as after "do". (defalias 'haskell-indentation-expression-layout #[0 "\300\301!\207" [haskell-indentation-layout haskell-indentation-expression] 2 (#$ . 16595)]) #@61 Parse layout list with declarations, such as after "where". (defalias 'haskell-indentation-declaration-layout #[0 "\300\301!\207" [haskell-indentation-layout haskell-indentation-declaration] 2 (#$ . 16803)]) #@42 Parse layout list with case expressions. (defalias 'haskell-indentation-case-layout #[0 "\300\301!\207" [haskell-indentation-layout haskell-indentation-case] 2 (#$ . 17017)]) #@280 Parse lambda or lambda-case expression. After a lambda (backslash) there are two possible cases: - the new lambdacase expression, that can be recognized by the next token being "case"; - or simply an anonymous function definition in the form of "expression -> expression". (defalias 'haskell-indentation-lambda-maybe-lambdacase #[0 "\301\230\203\n\302\303!\207\304\305!\207" [current-token "case" haskell-indentation-with-starter haskell-indentation-case-layout haskell-indentation-phrase-rest (haskell-indentation-expression "->" haskell-indentation-expression)] 2 (#$ . 17199)]) #@30 Parse functional dependency. (defalias 'haskell-indentation-fundep #[0 "\300\301\302\303\304#!\207" [haskell-indentation-with-starter apply-partially haskell-indentation-separated haskell-indentation-fundep1 ","] 5 (#$ . 17794)]) #@53 Parse an item in functional dependency declaration. (defalias 'haskell-indentation-fundep1 #[0 "i \303\235\203\304 \210\202 \305=\205\n\306\235\205\307!)\207" [current-indent current-token following-token (value "->") haskell-indentation-read-next-token end-tokens (value "->") haskell-indentation-add-indentation] 2 (#$ . 18030)]) #@28 Parse toplevel statements. (defalias 'haskell-indentation-toplevel #[0 "\300\301!\207" [haskell-indentation-layout #[0 "\302 \"\211\203\f\211A \207\303 \207" [current-token haskell-indentation-toplevel-list assoc haskell-indentation-declaration] 3]] 2 (#$ . 18378)]) #@25 Parse type declaration. (defalias 'haskell-indentation-type #[0 "i\3062O \307\267\2025\310 \210\202\n\311\235\203-\n\312\232\203%\313 !\210\202)\313!\210\313\f!\210\314\306\315\"\210\202\316 \"\211\204F\314\306\315\"\266\202\211A \266\2020)\207" [current-indent current-token following-token starter-indent left-indent haskell-indentation-type-list return #s(hash-table size 5 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (value 12 operator 12 "->" 12 "=>" 12 end-tokens 18)) haskell-indentation-read-next-token (value operator no-following-token "(" "[" "{" "::") "=>" haskell-indentation-add-indentation throw nil assoc] 4 (#$ . 18653)]) #@34 Parse a single type declaration. (defalias 'haskell-indentation-type-1 #[0 "i\30427 \305\267\202\"\306 \2026\n\307\235\203\310!\210\311\304\312\"\2026\313 \"\211\2041\311\304\312\"\2024\211A \2620)\207" [current-indent current-token following-token haskell-indentation-type-list return #s(hash-table size 5 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (value 12 operator 12 "->" 12 "=>" 12 end-tokens 17)) haskell-indentation-read-next-token (value operator no-following-token "->" "=>" "(" "[" "{" "::") haskell-indentation-add-indentation throw nil assoc] 4 (#$ . 19340)]) #@94 Parse scoped type declaration. For example let x :: Int = 12 do x :: Int <- return 12 (defalias 'haskell-indentation-scoped-type #[0 "\301\302\303\304\305#!\210\306\235\205\307\310!\207" [current-token haskell-indentation-with-starter apply-partially haskell-indentation-separated haskell-indentation-type ("->" "=>") ("<-" "=") haskell-indentation-statement-right haskell-indentation-expression] 5 (#$ . 19955)]) #@33 Parse data or type declaration. (defalias 'haskell-indentation-data #[0 "\303 \210\304\230\203\f\303 \210\305 \210\306=\203$ \307\235\205g\310\n!\210\311\312\313\"\207\314\230\203Hi\315\316!\210\317\267\202F \320\230\205G\321!\210\322 \207\315\323!\207\313\207\324\230\205g\315\325\313\"\210\326\267\202f \320\230\205g\322 \207\315\323!\207\313\207" [current-token following-token current-indent haskell-indentation-read-next-token "instance" haskell-indentation-type end-tokens ("=" "where") haskell-indentation-add-indentation throw parse-end nil "=" haskell-indentation-with-starter #[0 "\300\301\302\"\207" [haskell-indentation-separated haskell-indentation-expression "|"] 3] #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (end-tokens 53 "deriving" 66)) "deriving" haskell-indentation-push-indentation haskell-indentation-add-left-indent haskell-indentation-type-1 "where" haskell-indentation-expression-layout #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (end-tokens 89 "deriving" 98))] 3 (#$ . 20385)]) #@27 Parse import declaration. (defalias 'haskell-indentation-import #[0 "\300\301!\207" [haskell-indentation-with-starter haskell-indentation-expression] 2 (#$ . 21501)]) #@35 Parse foreign import declaration. (defalias 'haskell-indentation-foreign #[0 "\300\301\302\303\"!\207" [haskell-indentation-with-starter apply-partially haskell-indentation-expression (value operator "import")] 4 (#$ . 21674)]) #@26 Parse class declaration. (defalias 'haskell-indentation-class-declaration #[0 "\300\301!\207" [haskell-indentation-with-starter #[0 "\301 \210\302\230\203\f\303 \210\304\230\205\305\306\307\"\207" [current-token haskell-indentation-type "|" haskell-indentation-fundep "where" haskell-indentation-with-starter haskell-indentation-declaration-layout nil] 3]] 2 (#$ . 21908)]) #@31 Parse standalone declaration. (defalias 'haskell-indentation-deriving #[0 "\300\301!\207" [haskell-indentation-with-starter #[0 "\301\230\203 \302 \210\303=\203\304 \210\305\306\307\"\210\310 \210\311\230\205\"\312 \207" [current-token "instance" haskell-indentation-read-next-token end-tokens haskell-indentation-add-left-indent throw parse-end nil haskell-indentation-type "|" haskell-indentation-fundep] 3]] 2 (#$ . 22293)]) #@27 Parse module declaration. (defalias 'haskell-indentation-module #[0 "\300\301!\207" [haskell-indentation-with-starter #[0 "\305 \210\306=\203\f\305 \210\307\230\203\310\311\312\313#\210\314\230\203!\305 \207\315=\205E \316\235\203>\317\n \\!\210\317\f \\!\210\320\321\322\"\210\323 \210\320\321\322\"\207" [current-token following-token starter-indent haskell-indentation-starter-offset left-indent haskell-indentation-read-next-token layout-item "(" haskell-indentation-list haskell-indentation-module-export ")" "," "where" end-tokens (value no-following-token "(") haskell-indentation-add-indentation throw parse-end nil haskell-indentation-add-layout-indent] 4]] 2 (#$ . 22734)]) #@70 Parse 'where' that we may hit as a standalone in module declaration. (defalias 'haskell-indentation-toplevel-where #[0 "\301 \210\302=\205\303 \210\304\305\306\"\207" [current-token haskell-indentation-read-next-token end-tokens haskell-indentation-add-layout-indent throw parse-end nil] 3 (#$ . 23434)]) #@20 Parse export list. (defalias 'haskell-indentation-module-export #[0 "\302\230\203i\303 \210\304\267\202\305 !\202\303 \202\306)\207\307 \207" [current-token current-indent "module" haskell-indentation-read-next-token #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (end-tokens 17 value 23)) haskell-indentation-add-indentation nil haskell-indentation-type] 2 (#$ . 23748)]) #@175 Parse a list, pair or other expression containing multiple items parsed by PARSER, separated by SEP or STMT-SEP, and ending with END. (fn PARSER END SEP &optional STMT-SEP) (defalias 'haskell-indentation-list #[1027 "\300\301\302\303\304\305\306\nDFEE\"\207" [haskell-indentation-with-starter lambda nil let ((implicit-layout-active nil)) haskell-indentation-separated function] 13 (#$ . 24177)]) #@136 Parse an expression starting with a keyword or parenthesis. Skip the keyword or parenthesis. (fn PARSER &optional END WHERE-EXPR\=\?) (defalias 'haskell-indentation-with-starter #[769 "ii\306 U\203 i\202 \307 \210\n\310=\2039 \232\203&\311!\210\2024\2031\312 !\210\2024\313 \210\314\315\316\"\210i\211^\203I\f \\\202J  \210\n\310=\203i \232\203^\311\f!\210\205q\314\315\316\"\202q\n\232\205q\307 -\207" [current-indent left-indent current-token following-token starter-indent haskell-indentation-starter-offset haskell-indentation-current-indentation haskell-indentation-read-next-token end-tokens haskell-indentation-add-indentation haskell-indentation-add-where-post-indent haskell-indentation-add-left-indent throw parse-end nil] 7 (#$ . 24588)]) #@2  (defalias 'haskell-indentation-case-alternative #[0 "i\303\304\305\306#\210 \307=\203\310\n!\207 \311\230\205\312\304!\207" [left-indent current-token current-indent haskell-indentation-separated haskell-indentation-expression "," nil end-tokens haskell-indentation-add-indentation "->" haskell-indentation-statement-right] 4 (#$ . 25374)]) #@2  (defalias 'haskell-indentation-case #[0 "\302 \210\303=\203 \304 !\207\305\230\203\306\307\310\311\305\312$\312\"\207\313\230\205&\314\302!\207" [current-token current-indent haskell-indentation-expression end-tokens haskell-indentation-add-indentation "|" haskell-indentation-with-starter apply-partially haskell-indentation-separated haskell-indentation-case-alternative nil "->" haskell-indentation-statement-right] 6 (#$ . 25726)]) #@175 Process right side of a statement. Set `current-indent' to the current column and calls the given parser. If parsing ends here, set indentation to left-indent. (fn PARSER) (defalias 'haskell-indentation-statement-right #[257 "\302 \210\303=\203\304 \210\305 !\210\306\307\310\"\210\211 \210\311\232\205\"\312\313\310\"\207" [current-token current-indent haskell-indentation-read-next-token end-tokens haskell-indentation-add-left-indent haskell-indentation-add-indentation throw parse-end nil "where" haskell-indentation-with-starter haskell-indentation-expression-layout] 4 (#$ . 26177)]) #@26 Parse "guard" statement. (defalias 'haskell-indentation-guard #[0 "i\301\302\303\304#\207" [left-indent haskell-indentation-separated haskell-indentation-expression "," nil] 4 (#$ . 26780)]) #@37 Parse function or type declaration. (defalias 'haskell-indentation-declaration #[0 "\303\304\305\306#\210\307\230\203\310\311\303\312\307\306$\306\"\210\313=\205* \314\235\205*\315\n!\210\316\317\306\"\207" [current-token following-token current-indent haskell-indentation-separated haskell-indentation-expression "," nil "|" haskell-indentation-with-starter apply-partially haskell-indentation-guard end-tokens ("|" "=" "::" ",") haskell-indentation-add-indentation throw parse-end] 6 (#$ . 26978)]) #@77 Parse layout list, where each layout item is parsed by parser. (fn PARSER) (defalias 'haskell-indentation-layout #[257 "\301\230\203\f\302\303\304#\207\305!\207" [current-token "{" haskell-indentation-list "}" ";" haskell-indentation-implicit-layout-list] 5 (#$ . 27491)]) #@67 Return non-NIL value if TOKEN is an expression token. (fn TOKEN) (defalias 'haskell-indentation-expression-token-p #[257 "\211\300\235\207" [("if" "let" "do" "case" "\\" "(" "{" "[" "::" value operator no-following-token)] 3 (#$ . 27775)]) #@92 Parse an expression until an unknown token is encountered. (fn &optional ACCEPTED-TOKENS) (defalias 'haskell-indentation-expression #[256 "\3052bi\211\204 \306\262 >\203\307 \210\202 \310=\203A\n\311\230\203+\312 \210\2029\313\n!\2039\314!\210\314 !\210\315\305\316\"\210\202 \317 \f\"\211\204N\315\305\316\"\210\211A \210\211@\320\235\204^\315\305\316\"\210\210\202 \207" [current-indent current-token following-token left-indent haskell-indentation-expression-list return (value operator) haskell-indentation-read-next-token end-tokens "where" haskell-indentation-add-where-pre-indent haskell-indentation-expression-token-p haskell-indentation-add-indentation throw nil assoc ("(" "[" "{" "case")] 5 (#$ . 28022)]) #@226 Evaluate PARSER separated by SEPARATOR and STMT-SEPARATOR. If STMT-SEPARATOR is not NIL, it will be used to set a new starter-indent. For example: [ i | i <- [1..10] , (fn PARSER SEPARATOR &optional STMT-SEPARATOR) (defalias 'haskell-indentation-separated #[770 "\3042v<\204 C\262\211<\204\211C\262 \210\235\203%\305 \210\202\235\2033i\305 \210\202\306=\203n\n\235\204E\n\235\203X\307 !\210 W\203S\307 !\210\310\311\312\"\210\n\313=\203f\307 !\210\307 !\210\310\304\312\"\210\202\310\304\312\"\210\202\207" [current-token starter-indent following-token left-indent return haskell-indentation-at-separator end-tokens haskell-indentation-add-indentation throw parse-end nil no-following-token] 6 (#$ . 28765)]) #@173 At a separator. If at a new line, set starter-indent at the separator and current-indent after the separator, for example: l = [ 1 , 2 , -- start now here. (defalias 'haskell-indentation-at-separator #[0 "i\305 U\205i\306 \210\307=\203\310 !\210\310\n!\210\311\312\313\"\207\211\205+i\211\211\f\\\211\207" [current-token current-indent left-indent starter-indent haskell-indentation-starter-offset haskell-indentation-current-indentation haskell-indentation-read-next-token end-tokens haskell-indentation-add-indentation throw return nil] 4 (#$ . 29524)]) #@150 An implicit layout list, elements are parsed with PARSER. This sets the `layout-indent' variable to the column where the layout starts. (fn PARSER) (defalias 'haskell-indentation-implicit-layout-list #[257 "iii\306\3072a\n\211 \210)\f\310\267\202X\311 \210\202\f \312\235\2041\313=\2041\314 !\204M \315\230\204M\316=\203P \317\320\"\235\203P \321\230\204P\322 \210\323\307\324\"\210\202\f\323\307\324\"\210\202\f0\210,\f\325=\205n\306\311 )\207" [layout-indent current-indent left-indent implicit-layout-active current-token following-token t return #s(hash-table size 3 test equal rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (layout-item 24 ";" 24 end-tokens 30)) haskell-indentation-read-next-token ("{" operator) operator haskell-indentation-expression-token-p ";" 0 mapcar car "where" haskell-indentation-add-layout-indent throw nil layout-end previous-token haskell-indentation-toplevel-list] 5 (#$ . 30112)]) #@2  (defalias 'haskell-indentation-if #[0 "\300\301\302\"\207" [haskell-indentation-with-starter #[0 "\301\230\203 \302\303\304\"\207\305\306!\207" [current-token "|" haskell-indentation-with-starter #[0 "\300\301\302\303#\207" [haskell-indentation-separated haskell-indentation-case-alternative "|" nil] 4] nil haskell-indentation-phrase-rest (haskell-indentation-expression "then" haskell-indentation-expression "else" haskell-indentation-expression)] 3] nil] 3 (#$ . 31069)]) #@15 (fn PHRASE) (defalias 'haskell-indentation-phrase #[257 "\300\301\302\"\303\"\207" [haskell-indentation-with-starter apply-partially haskell-indentation-phrase-rest nil] 5 (#$ . 31553)]) #@16 (fn PHRASE1) (defalias 'haskell-indentation-phrase-rest #[257 "\211\205\225\211\306\262i \211@ \210+ \307=\203`\211A\203\221\fA@\232\203=\310 !\210\f\311\235\2044\310!\210\312\313\306\"\266\202\211A@\314\230\203W U\203\\\315 \210\312\313\306\"\266\202\312\313\306\"\210\210\202\211A\203\221\211A@ \232\203\221\316 \210 \307=\203\211\310 \\!\210\310\\!\210\312\313\306\"\210\211AA\266\202\202\210\202\207" [left-indent layout-indent current-indent current-token following-token starter-indent nil end-tokens haskell-indentation-add-indentation ("," ";") throw parse-end "in" haskell-indentation-add-layout-indent haskell-indentation-read-next-token haskell-indentation-starter-offset] 5 (#$ . 31749)]) #@15 (fn INDENT) (defalias 'haskell-indentation-add-indentation #[257 "\302X\203  \\\202!\207" [layout-indent haskell-indentation-layout-offset haskell-indentation-push-indentation] 4 (#$ . 32493)]) #@2  (defalias 'haskell-indentation-add-layout-indent #[0 "\301!\207" [layout-indent haskell-indentation-push-indentation] 2 (#$ . 32701)]) #@2  (defalias 'haskell-indentation-add-where-pre-indent #[0 "\303 \\!\210\nU\205\303 !\207" [layout-indent haskell-indentation-where-pre-offset haskell-indentation-layout-offset haskell-indentation-push-indentation] 3 (#$ . 32843)]) #@15 (fn INDENT) (defalias 'haskell-indentation-add-where-post-indent #[257 "\301\\!\207" [haskell-indentation-where-post-offset haskell-indentation-push-indentation] 4 (#$ . 33083)]) #@2  (defalias 'haskell-indentation-add-left-indent #[0 "\302 \\!\207" [left-indent haskell-indentation-left-offset haskell-indentation-add-indentation] 3 (#$ . 33271)]) #@156 Add INDENT to list of possible indentations. Add INDENT to `possible-indentations' if it is not there yet. Keep the list in ascending order. (fn INDENT) (defalias 'haskell-indentation-push-indentation #[257 "\211\235?\205\301B\302\"\211\207" [possible-indentations sort <] 4 (#$ . 33445)]) #@705 Go to the next token and set current-token to the next token. The following symbols are used as pseudo tokens: 'layout-item: A new item in a layout list. The next token will be the first token from the item. 'layout-end: the end of a layout list. Next token will be the first token after the layout list. 'end-tokens: back at point where we started, following-token will be set to the next token. Pseudo tokens are used only when implicit-layout-active is t. That is the case only after keywords "do", "where", "let" and "of". If we are at a new line, parse-line is increased, and current-indent and left-indent are set to the indentation of the line. (defalias 'haskell-indentation-read-next-token #[0 "\203\f \306=\203\f\306\207\2033 \307=\2033\niV\203\307\207\niU\203(\310\211\207\niW\205\233\311 \211\207\203B \310=\203B\311 \211\207\203P\niV\203P\307\211\207\311 \312 \210`\fY\203qm\204k`\fU\203k\311 \202l\313\306\211\207i\314 U\203{i \203\211\niV\203\211\307\211\207\203\227\niU\203\227\310\211\207\311 \211\207" [implicit-layout-active current-token layout-indent previous-token indentation-point following-token end-tokens layout-end layout-item haskell-indentation-peek-token haskell-indentation-skip-token no-following-token haskell-indentation-current-indentation current-indent] 2 (#$ . 33750)]) #@33 Return token starting at point. (defalias 'haskell-indentation-peek-token #[0 "\301\302!\203\n\303\304!\207\301\305!\203\303\306!\207\301\307!\203\303\304!\207\301\310!\2031\303\304!\311\"A\2060\211\207\301\312!\2039\313\207\314\207" [haskell-indentation-unicode-tokens looking-at "\\(if\\|then\\|else\\|let\\|in\\|mdo\\|rec\\|do\\|proc\\|case\\|of\\|where\\|module\\|signature\\|deriving\\|import\\|data\\|type\\|newtype\\|class\\|instance\\)\\([^[:alnum:]'_]\\|$\\)" match-string-no-properties 1 "[][(){}[,;]" 0 "\\(\\\\\\|->\\|<-\\|::\\|=\\||\\|=>\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)" "\\(→\\|←\\|∷\\|⇒\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)" assoc "[-:!#$%&*+./<=>?@\\\\^|~`]" operator value] 4 (#$ . 35155)]) #@25 Skip to the next token. (defalias 'haskell-indentation-skip-token #[0 "\300 \203\f\301\225b\210\202\302\303!\210\304\305w\210\306\307 !\210\310 \2054n\2054\305f\311=\2054\305u\210\306\307 !\210\202\207" [haskell-lexeme-looking-at-token 0 skip-syntax-forward "^-" "\n" nil forward-comment buffer-size haskell-indentation-bird-p 62] 2 (#$ . 35896)]) (provide 'haskell-indentation)