;ELC ;;; compiled by jwz@thalidomide on Sat Nov 13 17:57:40 1993 ;;; from file /th/jwz/emacs19/lisp/modes/pascal.el ;;; emacs version 19.9 Lucid. ;;; bytecomp version 2.20; 20-oct-93. ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "This file was compiled for Emacs 19.")) (defconst pascal-mode-version "1.3" "\ Version of this pascal mode.") (defvar pascal-mode-abbrev-table nil "\ Abbrev table in use in Pascal-mode buffers.") (define-abbrev-table 'pascal-mode-abbrev-table nil) (defvar pascal-mode-map nil "\ Keymap used in Pascal mode.") (byte-code " \n\"##############)!#ć" [pascal-mode-map make-sparse-keymap map set-keymap-name nil define-key ";" electric-pascal-semi "." electric-pascal-dot ":" electric-pascal-colon "=" electric-pascal-equal " " electric-pascal-terminate-line " " electric-pascal-tab "" backward-delete-char-untabify "" pascal-backward-to-beginning-of-function "" pascal-forward-to-end-of-function "" pascal-mark-function "" pascal-insert-block "" pascal-comment-area "" pascal-uncomment-area "" pascal-star-comment boundp pascal-keywords ("and" "array" "begin" "case" "const" "div" "do" "downto" "else" "end" "file" "for" "function" "goto" "if" "in" "label" "mod" "nil" "not" "of" "or" "packed" "procedure" "program" "record" "repeat" "set" "then" "to" "type" "until" "var" "while" "with" "get" "put" "input" "output" "read" "readln" "reset" "rewrite" "write" "writeln")] 4) (defvar pascal-mode-syntax-table nil "\ Syntax table in use in Pascal-mode buffers.") (byte-code " ################" [pascal-mode-syntax-table make-syntax-table modify-syntax-entry 92 "\\" 40 ". 1" 41 ". 4" 42 ". 23" 123 "<" 125 ">" 43 "." 45 61 37 60 62 38 124 95 "w" 39 "\""] 4) (defconst pascal-indent-level 3 "\ *Indentation of Pascal statements with respect to containing block.") (defconst pascal-continued-expr 1 "\ *Indentation of line that is a continued expression.") (defconst pascal-label-offset -1 "\ *Offset of Pascal label lines, case statements and record lines. This is relative to usual indentation.") (defconst pascal-case-offset 2 "\ *Indentation after case statements.") (defconst pascal-vardecl-indent 15 "\ *Indentation (from the beginning of line to `:' of the declaration.") (defconst pascal-typedecl-indent 10 "\ *Indentation (from the beginning of line to `=' of the declaration.") (defconst pascal-auto-newline nil "\ *Non-nil means automatically newline after semicolons and `end'.") (defconst pascal-tab-always-indent t "\ *Non-nil means TAB in Pascal mode should always reindent the current line. It does so regardless of where in the line point is when the TAB command is used.") (defconst pascal-auto-endcomments t "\ *Non-nil means make a comment { ... } after the end for a case or function. The name of the function or case is put between the braces.") (fset 'pascal-mode #[nil " \n!\n!! !!!" [kill-all-local-variables use-local-map pascal-mode-map pascal-mode major-mode "Pascal" mode-name pascal-mode-abbrev-table local-abbrev-table set-syntax-table pascal-mode-syntax-table make-local-variable indent-line-function pascal-indent-line pascal-indent-within-comment comment-indent-function parse-sexp-ignore-comments t case-fold-search run-hooks pascal-mode-hook] 2 "\ Major mode for editing Pascal code. Tab indents for Pascal code. Delete converts tabs to spaces as it moves back. \\{pascal-mode-map} Variables controlling indentation style: pascal-tab-always-indent (default t) Non-nil means TAB in Pascal mode should always reindent the current line, regardless of where in the line point is when the TAB command is used. pascal-auto-newline (default nil) Non-nil means automatically newline after semicolons and the punctation mark after an end. pascal-auto-endcomments (default t) Non-nil means automatically set name of function or `case' in braces after after the `end' if this end ends a function or a case block. pascal-indent-level (default 3) Indentation of Pascal statements within surrounding block. pascal-continued-expr (default 1) Indentation of a line that is a continued expression. pascal-typedecl-indent (default 10) Indentation to the `=' in type declarations. (Or constant declarations.) pascal-vardecl-indent (default 20) Indentation to the `:' in var declarations. pascal-label-offset (default -1) Extra indentation for line that is a label, case statement or part of a record block. pascal-case-offset (default 2) Extra indent to the `:' in case statements. The only auto indention this mode doesn't fully support is if there is a case within a type declaration. However, this is seldom used. When typing text, you should not worry about to get right indentions, they will be set when you hit return. The mode will also automatically delete the whitespaces between `*' and `)' when ending a starcomment. Turning on Pascal mode calls the value of the variable pascal-mode-hook with no args, if that value is non-nil." nil]) (fset 'electric-pascal-terminate-line #[nil "yw! )   yw!u ! #) ) c )" [0 " " nil looking-at "until\\b\\|end\\(\\b\\|;\\|\\.\\)\\|begin\\b\\|repeat\\b\\|else\\b" pascal-indent-line newline pascal-auto-endcomments pascal-set-auto-comments setstar -1 "\\*[ ]*)" 1 pascal-delete-whitespaces "(\\*\\|\\*[^)]" search-forward "*)" pascal-get-end-of-line t "*" pascal-indent-command] 4 "\ Terminate line and indent next line." nil]) (fset 'electric-pascal-semi #[nil "cy ) " [last-command-char 0 pascal-indent-line pascal-auto-newline electric-pascal-terminate-line] 1 "\ Insert ; character and correct this line's indention." nil]) (fset 'electric-pascal-dot #[nil "cy ) " [last-command-char 0 pascal-indent-line pascal-auto-newline electric-pascal-terminate-line] 1 "\ Insert a period and correct this line's indention." nil]) (fset 'electric-pascal-colon #[nil "c ?!!)y ) )" [last-command-char pascal-within-string backward-char 2 looking-at "[0-9]" 0 pascal-indent-line nil pascal-tab-always-indent pascal-indent-command] 2 "\ Insert : and do all indentions except line indent on this line." nil]) (fset 'electric-pascal-equal #[nil "c!A@= )" [last-command-char pascal-calculate-indent t decl nil pascal-tab-always-indent pascal-indent-command] 2 "\ Insert = and do indention if within type declaration." nil]) (fset 'electric-pascal-tab #[nil " ? y ) " [pascal-within-string pascal-tab-always-indent 0 pascal-indent-line pascal-indent-command] 1 "\ Function called when tab is pressed." nil]) (fset 'pascal-insert-block #[nil " c cy )" [pascal-indent-line "begin" electric-pascal-terminate-line "end;" 0] 1 "\ Insert begin ... end; block in the code with right indents." nil]) (fset 'pascal-star-comment #[nil " c c)" [pascal-indent-line "(*" electric-pascal-terminate-line pascal-delete-whitespaces ")"] 1 "\ Insert star comment in the code." nil]) (fset 'pascal-mark-function #[nil "`! `! " [push-mark pascal-forward-to-end-of-function pascal-backward-to-beginning-of-function zmacs-activate-region] 2 "\ Mark the current pascal function (or procedure). Put the mark at the end of the function, and point at the beginning." nil]) (fset 'pascal-comment-area #[(start end) "bwl)xn)yyc` byc b#ˉ#p)#ˉ#p*" [end " " nil 1 0 " ---/\\---EXCLUDED---/\\---}" newline start "{---\\/---EXCLUDED---\\/--- " re-search-backward "\\*)" t replace-match "!(*" "}" "!{"] 4 "\ Put the current region in a comment. The comments that are in this area are be changed so that `*)' becomes `!(*' and `}' becomes `!{'. These will however be turned back to normal when the area is uncommented by pressing \\[pascal-uncomment-area]. The commented area starts with: `{---\\/---EXCLUDED---\\/---' , and ends with: ` ---/\\---EXCLUDED---/\\---}'. If these texts are changed, uncomment-area will not be able to recognize them." "r"]) (fset 'pascal-uncomment-area #[nil "``#`#`) ``X!by`  `T|) #ʼn#q) #ʼn#q) by`  `T|)+" [end start search-backward "{---\\/---EXCLUDED---\\/--" nil t search-forward "---/\\---EXCLUDED---/\\---}" message "Not standing within commented area." 0 pos re-search-backward "!{" replace-match "}" "!(\\*" "*)"] 4 "\ Uncomment a commented area. Change all deformed comments in this area back to normal. This function does nothing if the pointer is not in a commented area. See also `pascal-comment-area'." nil]) (fset 'pascal-backward-to-beginning-of-function #[nil "#!) lj \n yo!!! T ! S  \n]\nU) o! U?!! T a! \n T  S I!D S =+" [re-search-backward "\\T7*" [looking-at "function\\b\\|procedure\\b" pascal-backward-to-beginning-of-function end-of-buffer 0 1 func-depth nest-depth forward-sexp 2 backward-sexp "begin\\b\\|case\\b\\|record\\b" "end\\(\\b\\|;\\|\\.\\)" nil] 3 "\ Moves the point to the end of the function." nil]) (fset 'pascal-downcase-keywords #[nil "!" [pascal-change-keywords downcase-word] 2 "\ Makes all Pascal keywords in the buffer lowercase." nil]) (fset 'pascal-upcase-keywords #[nil "!" [pascal-change-keywords upcase-word] 2 "\ Makes all Pascal keywords in the buffer uppercase." nil]) (fset 'pascal-capitalize-keywords #[nil "!" [pascal-change-keywords capitalize-word] 2 "\ Makes all Pascal keywords in the buffer uppercase." nil]) (fset 'pascal-change-keywords #[(change-word) " ##!n)" [beginning-of-buffer re-search-forward mapconcat downcase pascal-keywords "\\>\\|\\<" nil t change-word -1] 5 "\ Change the keywords according to argument."]) (fset 'pascal-delete-whitespaces #[nil "x`w\n`|)" [" " nil pos] 2 "\ Deletes the whitespaces around the current point." nil]) (byte-code "MM" [pascal-get-beg-of-line #[nil "y`)" [0] 1] pascal-get-end-of-line #[nil "`)" [nil] 1]] 2) (fset 'pascal-within-string #[nil " #) $)?" [search-backward "\"" pascal-get-beg-of-line t 2] 5 "\ Return t if within string; nil otherwise."]) (fset 'pascal-check-if-within-comment #[nil "``#`)#`) W b!iTi)*" [comend comstart re-search-backward "(\\*\\|{" nil t 0 "\\*)\\|}" looking-at "(\\*"] 4 "\ If within a comment, return the correct indent. Return nil otherwise."]) (fset 'pascal-set-auto-comments #[nil "yw! #)? A@= c!o!!Sh!cT\\o)U ww`w`)\") c !c)))" [-1 " " nil looking-at "end\\(>\\|;\\)" search-backward "}" pascal-get-beg-of-line t pascal-calculate-indent case pascal-delete-whitespaces " { case }" 1 nest "function\\b\\|\\procedure\\b" backward-sexp "begin\\b\\|case\\b" "end\\(\\b\\|;\\|\\.\\)" 0 last-command pascal-backward-to-beginning-of-function "^ " copy-region-as-kill "a-zA-Z0-9_" " { " yank rotate-yank-pointer " }"] 4 "\ Put { case } or { FUNNAME } on this line if appropriate after `end'."]) (fset 'pascal-indent-command #[nil " ! A@= A@=y #! iT]ju iTjywlw iT]j A@= #!#!#) A@= )wl)*" [pascal-indent-line pascal-calculate-indent t 0 pos indent case record search-forward ":" pascal-get-end-of-line backward-char 1 pascal-delete-whitespaces pascal-find-leading-case-colon " " nil "0-9a-zA-Z\"'_;" decl pascal-get-beg-of-line posii re-search-backward "\\<\\(var\\|type\\|const\\|label\\)\\>" looking-at "var\\b" pascal-declindent-middle-of-line pascal-vardecl-indent "type\\b\\|const\\b" "=" pascal-typedecl-indent function pascal-indent-parameter-list] 4 "\ Indent current line as Pascal code and/or indent within line."]) (fset 'pascal-indent-line #[nil "Dy )  !xn)y ! A@ A@=! A@=! @j A@= @\\j A@= A@= @\\\\j!w @\\j A@= @\\j," [0 nil point beg comindent indent pascal-calculate-indent pascal-check-if-within-comment pascal-indent-within-comment " " pascal-delete-whitespaces looking-at "end\\b\\|until\\b" if "begin\\b\\|\\repeat\\b\\|else\\b" whilewith "begin\\b\\|\\repeat\\b" contexp pascal-continued-expr case record pascal-indent-level pascal-label-offset "[0-9]*:" "0-9:" function pascal-indent-parameter-list] 4 "\ Indent current line as Pascal code."]) (fset 'pascal-calculate-indent #[(&optional arg) "y`)`D ? \n   UCoC!`  #) !!SH! 2T,! !ĉ!ĉ# #`)#`))U W`VV Y WV#u*''xnwl #y!! wg!њ))' D\n! D\n!# )D\ny \n@j!Ċ `}!~!)y # )j #) D\n D\n! D\n!iD\n!iD\n! #) D\niD\n! #`) #`);< " beginning-of-buffer search-forward "(" ")" " " pascal-get-end-of-line "\\(do\\|then\\|of\\|begin\\|repeat\\|else\\)\\>" "^; " char-to-string pascal-lstart-col contexp "begin\\b" begin "else\\b" "if\\b" if pascal-delete-whitespaces pascal-get-beg-of-line re-search-forward "then\\b" "repeat\\b" repeat "case\\b" case "record\\b" record "while\\b\\|with\\b\\|for\\b" "do\\b" whilewith "procedure\\b\\|function\\b" epos spos function "var\\b\\|label\\b\\|const\\b\\|type\\b" decl "^[ ]*$"] 10 "\ Search backward in code to find the right indent level. Return a list containing: 1. Indent level 2. The indent keyword (begin, case etc.), or nil if backtracking failed. If arg is non-nil, we do not search for continued expressions."]) (fset 'pascal-lstart-col #[nil "ywwi)" [0 ":0-9" nil " "] 2 "\ Return the column of the beginning of the first command on the line."]) (fset 'pascal-indent-parameter-list #[nil " y #yww @j!u A@jwl)? #! 8jgҚu 8\\j*" [pascal-get-highest-indents-in-parameterlist 0 pos indents search-forward "(" pascal-get-end-of-line t " " nil pascal-delete-whitespaces looking-at "var\\b" 3 ":" backward-char 1 2 58] 4 "\ Indent this line as part of a parameter list in a function."]) (fset 'pascal-get-highest-indents-in-parameterlist #[nil "#!i‰ \nmy #) #x i] yO\n\\ TE\n TE-" [re-search-backward "\\<\\(function\\|procedure\\)\\>" nil t search-forward "(" 0 done vardecl arglength start re-search-forward "\\" pascal-get-end-of-line ":" ": " 1 4] 4]) (fset 'pascal-declindent-middle-of-line #[(declkey endpos defaultindent) " #iS b #) !xx iT]j !u iTj)" [0 decindent search-forward declkey endpos t defaultindent nil search-backward " " pascal-delete-whitespaces looking-at 1] 4 "\ Indent declaration line."]) (fset 'pascal-indent-within-comment #[(&optional indent) "xn)y jyw!)y! i\\j)" [" " nil 0 pascal-delete-whitespaces indent pascal-check-if-within-comment looking-at "\\*\\|(\\*" search-forward "*" 2] 2 "\ Indent comments and/or indent text within comment."]) (fset 'pascal-find-leading-case-colon #[nil "yw`)!yw `= #iSi \\*" [0 " " nil pos re-search-backward "\\<\\(case\\|record\\)\\>" 1 search-forward ":" pascal-get-end-of-line t pascal-case-offset] 4 "\ Return hpos of first colon after the case-of or record line. If there's no such line, use the place where it ought to be."]) (provide 'pascal)