;ELC ;;; Compiled by [email protected] on Sat Jun 12 01:40:48 2010 ;;; from file /home/boggles/.emacs.d/gas-mode.el ;;; in Emacs version 22.2.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`gas-mode.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (custom-declare-group 'gas nil "Mode for editing gas syntax assembler code." :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) :group 'languages) #@50 The comment start character assumed by gas mode. (custom-declare-variable 'gas-comment-char '59 '(#$ . 747) :type 'character :group 'gas) #@20 The opcode column. (custom-declare-variable 'gas-opcode-column '14 '(#$ . 891) :type 'integer :group 'gas) #@40 The column for the arguments (if any). (custom-declare-variable 'gas-argument-column '20 '(#$ . 1004) :type 'integer :group 'gas) #@50 The column where end of line asm comments go to. (custom-declare-variable 'gas-comment-column '36 '(#$ . 1140) :type 'integer :group 'gas) #@203 Always jump to comment column when a variable `gas-comment-char' is typed. It t, starts/expands a comment if appropriate. When unset (nil), use `gas-comment-dwim' (usually bound to M-;) to get there. (custom-declare-variable 'gas-comment-char-starts-comment 'nil '(#$ . 1286) :type 'boolean :group 'gas) #@99 If nil, 'indent' indents all fileds on the current line. Else only the current field is affected. (custom-declare-variable 'gas-indent-current-field-only 'nil '(#$ . 1598) :type 'boolean :group 'gas) (byte-code "\301\211\207" [gas-preserve-trailing-whitespace nil] 2) #@381 Enable symbol recognition and highlighing. When t and if point is on a symbol, some limited parsing data is collected and all occurences of this symbol in the buffer get highlighted according to the results (defined, global, etc.). As long as a symbol is highlighted, `forward-sexp' and `backward-sexp' move to the next/previous occurence of the same symbol in the same buffer. (custom-declare-variable 'gas-enable-symbol-highlight 't '(#$ . 1874) :type 'boolean :group 'gas) #@442 When true, C passthrough comments are recognized. This kind of comment is introduced by the starting sequence "/*C" and is meant to be processed later by an external program (see the introducing comment in gas-mode.el for an example) into C source code. Within these passthrough-comments, the combination /# ... #/ is available for nested comments which will be later changed into real C comments (/* ... */) by the same external program. (custom-declare-variable 'gas-use-C-passthrough 't '(#$ . 2359) :type 'boolean :group 'gas) #@338 Regexp used to recognize the beginning of a defun. The default value describes a line which is either empty, a full-line left-justified comment or a directive, followed by a line starting with a label. Note that the character ";" in the regexp will be replaced by the actual comment character described by variable `gas-comment-char'. (custom-declare-variable 'gas-defun-regexp '"\n\\([;#].*\\|.*[*]/[ ]*\\|\\|[ ]*\\|[ ]+\\..*\\)\n\\([^ \n;]+:\\)" '(#$ . 2899) :type 'regexp :group 'gas) #@45 The subexp in `gas-defun-regexp to jump to. (custom-declare-variable 'gas-defun-regexp-subexp '2 '(#$ . 3399) :type 'integer :group 'gas) #@38 Indent to use with C style comments. (custom-declare-variable 'gas-C-indent '3 '(#$ . 3543) :group 'gas :type 'integer) #@61 Where to indent a C comment end ("*/") if it starts a line. (custom-declare-variable 'gas-C-comment-end-column '0 '(#$ . 3669) :group 'gas :type 'integer) #@134 After this many seconds symbols get highlighted. Number of seconds of idle time (a float) to wait before a symbol gets highlighted. (custom-declare-variable 'gas-symbol-highlight-delay '0.5 '(#$ . 3831) :group 'gas :type 'float) (byte-code "\301\302\303\304\305\306%\210\307\310\311\312\305\302%\210\307\313\314\315\305\302%\210\307\316\317\320\305\302%\210\307\321\322\323\305\302%\210\307\324\325\326\305\302%\210\307\327\330\331\305\302%\210\307\332\333\334\305\302%\210\307\335\336\337\305\302%\210\340B\341\340!\204W \342\340\310\"\210\343B\341\343!\204f \342\343\313\"\210\344B\341\344!\204u \342\344\316\"\210\345B\341\345!\204\204 \342\345\321\"\210\346B\341\346!\204\223 \342\346\324\"\210\347B\341\347!\204\242 \342\347\327\"\210\350B\341\350!\204\261 \342\350\332\"\210\351B\341\351!\204\300 \342\351\335\"\210\303\207" [current-load-list custom-declare-group gas-faces nil "Faces used by gas-mode." :group gas custom-declare-face gas-builtin ((((class color) (background light)) (:foreground "maroon")) (t (:foreground "yellow"))) "Face to use for Gas buitins." gas-symbol-ok ((((class color) (background light)) (:background "#e0ffe0")) (((class color) (background dark)) (:background "#001f00")) (t (:foreground "yellow" :background "blue"))) "Face to use for symbols where exactly 1 definition was found." gas-symbol-error ((((class color) (background light)) (:background "#ffffe8" :foreground "red" :weight bold)) (((class color) (background dark)) (:background "#181800" :foreground "red" :weight bold)) (t (:foreground "yellow" :background "red"))) "Face to use when highlighting symbols with more than 1 definition." gas-symbol-global ((((class color) (background light)) (:background "#d0f8ff")) (((class color) (background dark)) (:background "#00383f")) (t (:foreground "yellow" :background "blue"))) "Face to use when highlighting global symbols." gas-symbol-undef ((((class color) (background light)) (:background "#ffffe8" :foreground "maroon")) (((class color) (background dark)) (:background "#181800")) (t (:foreground "yellow" :background "red"))) "Face to use for symbols defined as global when no definition\nwas found." gas-symbol-global-undef ((((class color) (background light)) (:background "#d0f8ff" :foreground "red")) (((class color) (background dark)) (:background "#002840" :foreground "red")) (t (:foreground "yellow" :background "red"))) "Face to use for symbols when no definition is found." gas-passthrough-code ((((class color) (background light)) (:foreground "magenta4")) (((class color) (background dark)) (:foreground "magenta2")) (t (:foreground "magenta1" :background "cyan"))) "Marks passthrough code." gas-passthrough-comment ((((class color) (background light)) (:foreground "turquoise4")) (((class color) (background dark)) (:foreground "turquoise2")) (t (:foreground "turquoise1"))) "Marks passthrough comments." gas-builtin-face default-boundp set-default gas-symbol-ok-face gas-symbol-error-face gas-symbol-global-face gas-symbol-undef-face gas-symbol-global-undef-face gas-passthrough-code-face gas-passthrough-comment-face] 6) #@226 Maximum number of parsed lines in cache. I don't expect much impact from this on performance (the line cache is emptied on any buffer change anyway). Play around with this value if you suspect memory may be your problem. (defconst gas-max-lines-in-cache 500 (#$ . 6943)) #@113 Maximum number of symbols in highlight cache. Reduce this if memory footprint grows too high (very unlikely). (defconst gas-max-labels-in-cache 300 (#$ . 7225)) #@52 Regexp defining a valid symbol as a subexpression. (defconst gas-re-sym "\\([_$A-Za-z][_0-9$A-Za-z]*\\)" (#$ . 7394)) #@72 The valid characters for a symbol as used in `skip-chars-*' functions. (defconst gas-skip-sym "_0-9$A-Za-z" (#$ . 7518)) #@60 Regexp defining the character set not allowed in a symbol. (defconst gas-re-nosym "[^_0-9$A-Za-z]" (#$ . 7645)) #@38 Syntax table used while in gas mode. (defvar gas-mode-syntax-table (byte-code "\301 \302\303\304#\210\302\305\306#\210\302\307\310#\210\302\311\312#\210)\207" [st make-syntax-table modify-syntax-entry 10 "> b" 46 "_" 47 ". 124b" 42 ". 23"] 4) (#$ . 7763)) #@38 Abbrev table used while in Gas mode. (defvar gas-mode-abbrev-table nil (#$ . 8031)) (define-abbrev-table 'gas-mode-abbrev-table nil) #@22 Keymap for Gas mode. (defvar gas-mode-map (byte-code "\301 \302\303\304#\210\302\305\306#\210\302\307\310#\210\302\311\312#\210\302\313\314#\210\302\315\316#\210\302\317\320#\210\302\321\320#\210)\207" [map make-sparse-keymap define-key ":" gas-colon "\273" gas-comment ";" gas-comment-char "#" gas-hash [S-iso-lefttab] gas-indent-backward ";" comment-region "\n" newline-and-indent " "] 4) (#$ . 8170)) #@53 Regex matching all operators which define a symbol. (defconst gas-equ "\\.\\(?:eq\\(?:uiv\\|[uv]\\)\\|set\\)" (#$ . 8591)) #@152 Fields and their indents. The cdr (the indent) may either be a number, a symbol bound to a number, or a symbol bound to a function yielding the value. (defconst gas-indents '((C-comment-end . gas-C-comment-end-column) (C-comment-start . 0) (C-comment . gas-get-C-relative-indent) (cpp-macro-def . 0) (cpp-argument . 0) (label . 0) (opcode . gas-opcode-column) (argument . gas-argument-column) (asm-comment . gas-get-asm-comment-column)) (#$ . 8721)) #@252 Mapping from the field type we're on to the field types to check next. car - type of field we're on (IOW, the one just handled) cdr - ordered list of (first (most special) check first): car - token to match cdr - next field type iff match. (defconst gas-parse-sequences '((starting-asm-line (cpp-macro-def . cpp-macro-def) (label . label) (empty-label . label) (asm-comment . asm-comment) (opcode . opcode)) (label (opcode . opcode) (asm-comment . asm-comment) (garbage . garbage)) (opcode (asm-comment . asm-comment) (argument . argument) (eol-ws . eol-ws) (garbage . garbage)) (argument (asm-comment . asm-comment) (eol-ws . eol-ws) (garbage . garbage)) (asm-comment (eol-ws . eol-ws)) (cpp-argument (eol-ws . eol-ws) (garbage . garbage)) (cpp-macro-def (cpp-argument . cpp-argument) (garbage . garbage)) (cpp-argument (eol-ws) (garbage . garbage)) (C-comment-start (C-comment . C-comment)) (starting-within-C-comment (C-comment-end . C-comment-end) (C-comment . C-comment)) (C-comment (C-comment-end . C-comment-end) (eol-ws . eol-ws) (garbage . garbage)) (garbage (eol-ws . eol-ws)) (eol-ws . fini)) (#$ . 9178)) #@656 An alist of parse patterns. Each entry holds 4 elements (SYMBOL REGEXP SUBEXPS TERMINATE-RE): SYMBOL - designator (a symbol) under which it will be referenced. REGEXP - the regexp to match against, SUBEXPS - a list (BEG-COL TEXT-COL END-COL END-OF-FIELD) of at which subexpression of REGEXP to find beg-col, text-col, end-col (see `gas-parse-line-really') and the end of the field, TERMINATE-RE - a regexp, the start of which (if it matches and if outside a ".." string) unconditionally terminates the field. Every occurence of the character ";" in both regexps is replaced by variable `gas-comment-char' before use. (defconst gas-patterns '((cpp-macro-def "[ ]*\\(\\(#[^ \n]*\\)\\)" (0 1 1 1) "/[*]") (cpp-argument "[ ]*\\(\\([ ]*\\([^ \n]\\)+\\)+\\)" (0 1 1 1) "/[*]") (label "[ ]*\\([^ : \n]+:\\)" (0 1 1 1) "/[*]\\|;") (opcode "[ ]*\\([^ \n]+\\)" (0 1 1 1) "/[*]\\|;") (argument "[ ]*\\(\\([ ]*\\([^ \n]\\)+\\)+\\)" (0 1 1 1) "/[*]\\|;") (garbage "[ ]*\\(\\([ ]*\\([^ \n]\\)+\\)+\\)" (0 1 1 1) "/[*]\\|;") (asm-comment "[ ]*\\(\\(;+\\)\\([ ]*[^ \n]+\\)*\\)" (0 1 1 1) nil) (C-inline-comment "[ ]*\\(/[*].*?[*]/\\)" (0 1 1 1) nil) (C-comment-start "[ ]*\\(/[*]C?\\)" (0 1 1 1) nil) (empty-label " [ ]*" (0 0 0 nil) "/[*]\\|;") (C-comment-end "[ ]*\\([*]/\\)" (0 1 1 1) nil) (C-comment "[ ]*\\(\\([ ]*[^ ]+\\)*\\)" (0 1 1 1) "[*]/") (eol-ws "[ ]+\\( ?\\)" (0 1 1 1) nil)) (#$ . 10313)) #@37 The elements of a gas syntax field. (defconst gas-elmt-types '(type subtype beg-col text-col end-col text modified) (#$ . 11770)) (byte-code "\301B\302\303!\207" [current-load-list gas-builtin-keywords (lambda (#1=#:defconst-tmp-var) (defconst gas-builtin-keywords #1#)) "^\\(\\(\\sw\\|\\s_\\)+:?\\)?[ ]+\\(\\.\\(?:A\\(?:BORT\\|bort\\|l\\(?:ign\\|tmacro\\)\\|sci[iz]\\)\\|B\\(?:align\\|yte\\)\\|Comm\\|D\\(?:ata\\|e\\(?:f\\|precated\\|sc\\)\\|im\\|ouble\\)\\|E\\(?:ject\\|lse\\(?:if\\)?\\|nd\\(?:ef\\|func\\|if\\)?\\|q\\(?:uiv\\|[uv]\\)\\|rr\\(?:or\\)?\\|x\\(?:itm\\|tern\\)\\)\\|F\\(?:ail\\|il[el]\\|loat\\|unc\\)\\|Global\\|Hidden\\|I\\(?:dent\\|f\\|n\\(?:c\\(?:bin\\|lude\\)\\|t\\(?:ernal\\)?\\)\\|rpc?\\)\\|L\\(?:comm\\|flags\\|i\\(?:n\\(?:\\(?:konc\\)?e\\)\\|st\\)\\|n\\|ong\\)\\|M\\(?:RI\\|acro\\)\\|No\\(?:altmacro\\|list\\)\\|O\\(?:cta\\|rg\\)\\|P\\(?:2align\\|opSection\\|r\\(?:evious\\|int\\|otected\\)\\|size\\|u\\(?:rgem\\|shSection\\)\\)\\|Quad\\|Rept\\|S\\(?:bttl\\|cl\\|e\\(?:ction\\|t\\)\\|hort\\|i\\(?:\\(?:ngl\\|z\\)e\\)\\|kip\\|leb128\\|pace\\|t\\(?:ab\\|r\\(?:ing\\|uct\\)\\)\\|ubSection\\|ymver\\)\\|T\\(?:ag\\|ext\\|\\(?:itl\\|yp\\)e\\)\\|Uleb128\\|V\\(?:Table\\(?:Entry\\|Inherit\\)\\|al\\|ersion\\)\\|W\\(?:arning\\|eak\\(?:ref\\)?\\|ord\\)\\|hword\\|if\\(?:def\\|eqs?\\|g[et]\\|l[et]\\|n\\(?:def\\|es\\|otdef\\|[bce]\\)\\|[bc]\\)\\)\\)[ \n]"] 2) #@50 Additional expressions to highlight in gas mode. (defvar gas-font-lock-keywords (byte-code "\302\303\304\305\306\307\310\311\312\313E\314\257 \"\207" [gas-builtin-keywords cpp-font-lock-keywords append (gas-return-passthrough-code-hi 0 gas-passthrough-code-face t) (gas-return-passthrough-comment-hi 0 gas-passthrough-comment-face t) (gas-return-gas-hi-ok 0 gas-symbol-ok-face t) (gas-return-gas-hi-global 0 gas-symbol-global-face t) (gas-return-gas-hi-error 0 gas-symbol-error-face t) (gas-return-gas-hi-undef 0 gas-symbol-undef-face t) (gas-return-gas-hi-global-undef 0 gas-symbol-global-undef-face t) 3 gas-builtin-face ("^\\(\\(\\sw\\|\\s_\\)+\\)\\>:?" 1 font-lock-function-name-face)] 11) (#$ . 13151)) (put 'gas-mode 'font-lock-defaults '(gas-font-lock-keywords)) #@2536 Major mode for editing assembler code. Commands: (Some of these commands may exhibit slightly different behaviour if point is on a C syntax line.) \[indent-for-tab-command] indent the field(s) point is on. If it already is in its position, move on to the next field on the line. \[gas-indent-backward] Move to the previous field. \[gas-comment] When no region is active, starts a comment sequence: - If a comment is present and point is not at its start, jump there. - Else start a comment. If there already is one, increase its comment level. What that is and what it does, is best explained when you try it out: Move to en empty line, then type \[gas-comment] and then repeatedly \[gas-comment] or \[gas-comment-char]. Calls \[gas-comment-dwim] (see below) if the region is active. \[forward-sexp] If you're on a highlighted symbol, jump to its next occurence. Else do `forward-sexp' like in text mode. \[backward-sexp] If you're on a highlighted symbol, jump to its previous occurence. Else do `backward-sexp' like in text mode. \[gas-comment-dwim] If the region starts at the leading white space before a comment, all full-line comments in region will be removed. If the region starts on a comment, comments will be removed, but comments with leading white space will be left untouched. Else insert triple variable `gas-comment-char's before all lines in region. \[fill-paragraph] beautifies the paragraph around point, i.e. it adjusts all assembly syntax fields to their standard positions. \[indent-region] beautifies the region, i.e., adjusts all fields in region. The following characters have a special meaning in special cases: \[gas-colon] if it terminates a label: outdent the label and move to opcode column. Else, just insert \[gas-colon] as usual. \[gas-comment-char] The value which introduces an asm style comment. If typed in in a row after \[gas-comment], behaves as an alias to \[gas-comment]. else just insert \[gas-comment-char]. Can be customized to always act as alias (`gas-comment-char-starts-comment'). Alternatively, you may use a File Variable to make it buffer local (which allows you to use different syntaxes in the same session). Note: Setting it to a value other than ?; has not yet been tested. \[gas-hash] If it starts a preprocessor directive: Outdent it to first column. Customization: Entry on this mode runs `gas-mode-hook'. The customization group is called 'gas'. Special commands: \{gas-mode-map} (defalias 'gas-mode #[nil "\306 \210\307\310\n\311\f!\312 !1\313\314!\210\315\f\313\316!\210\317\313\320!\210\321\313\322!\210\323\313\324!\210\325\313\326!\210\f\313\327!\210\330\313\331!\210\332\313\333!\210\334\335\336 2\244!\210\337\340\f!\304\"\210\341\3423!!\210\343\f\344\"\210\345\3464\2115\203\213 5@4\3134!\346L\2105A\2115\204v *\347\350\351\"\210\352\353\354\"\210\355 \210\356\357!\210\360 \207" [mode-name major-mode gas-mode-abbrev-table local-abbrev-table gas-comment-char gas-comment-string kill-all-local-variables "gas" gas-mode string regexp-quote make-local-variable indent-line-function gas-indent indent-region-function gas-indent-region forward-sexp-function gas-forward-sexp fill-paragraph-function gas-fill-paragraph font-lock-defaults (gas-font-lock-keywords) gas-local-comment-char beginning-of-defun-function gas-beginning-of-defun end-of-defun-function gas-end-of-defun font-lock-keywords-case-fold-search t use-local-map make-sparse-keymap local-set-key vector set-syntax-table make-syntax-table modify-syntax-entry "< b" (gas-line-cache gas-globals-cache gas-locals-cache gas-hi-valid gas-hi-sym-list gas-hi-global gas-hi-undef gas-hi-error gas-hi-ok gas-changed gas-highlights gas-hi gas-pass-code-hi gas-pass-comment-hi gas-symbol-timer gas-highlights-error gas-symbol-highlight-beg gas-symbol-highlight-end gas-doing-comment after-change-functions) nil add-to-list after-change-functions gas-after-change add-hook pre-command-hook gas-symbol-pre-command gas-start-symbol-timer run-mode-hooks gas-mode-hook gas-symbol-highlight gas-comment-re gas-mode-map gas-mode-syntax-table var --dolist-tail--] 4 (#$ . 13931) nil]) #@57 You won't need this unless you're debugging `gas-mode'. (defalias 'gas-dbg #[nil "\302\303\304\305!\210\304\306!\210\307\310!\210\304\306!\210\311\312!\210\304\312!\210\304\313\314!!\210\311\315!\210\316\302!\210\304\315!\207" [debug-on-error debug-items t (indent) switch-to-buffer-other-frame "*Messages*" "*scratch*" info "Elisp" find-file-other-frame "x.S" get-buffer-create "*gas-dbg*" "gas-mode.el" column-number-mode] 3 (#$ . 18156) nil]) #@421 Helper function, outputs debug messages into a buffer of their own. If DEBUG-ITEMS (a symbol or a list) has a non-empty intersection with CONDITION (a symbol or a list)', apply `format' to ARGS and insert the result at the end of the buffer `gas-dbg' (which is created if non-existing). Currently defined symbols are: 'wip (work in progress), 'hi (highlighting), 'parser, 'cursor, 'sym (symbol highlighting), 'cursor. (defalias 'dmsg #[(condition &rest args) "\304\300!\205= \205= <\204 C<\204 C \305=\204&