Tiny update for the Emacs
aficionados<http://asset.soup.io/asset/2001/5652_6161_500.jpeg>among
us: The snippet below highlights the v8 code output nicely, at least
if you don't hate the default colors... ;-)

;;
--------------------------------------------------------------------------------
(defvar v8-code-syntax-table
  (let ((table (make-syntax-table)))
    (modify-syntax-entry ?;  ". 12" table)
    (modify-syntax-entry ?\n "> " table)
    table))

(defconst v8-code-font-lock-keywords
  `(("^--- .* ---$" . font-lock-warning-face)
    ("^0x[[:xdigit:]]+ +[[:digit:]]+ +[[:xdigit:]]+" .
font-lock-preprocessor-face)
    (,(concat "^" (regexp-opt '("Deoptimization Input Data (deopt points"
                                "Instructions (size"
                                "RelocInfo (size"
                                "Safepoints (size"
                                "argc"
                                "compare_operation"
                                "compare_state"
                                "extra_ic_state"
                                "ic_state"
                                "kind"
                                "name"
                                "stack_slots"
                                "type") t) " = .*$") . font-lock-type-face))
  "Highlighting expressions for v8 code mode")

(define-derived-mode v8-code-mode fundamental-mode "v8 code"
  "Major mode for editing v8 machine code."
  (set-syntax-table v8-code-syntax-table)
  (set (make-local-variable 'font-lock-defaults)
'(v8-code-font-lock-keywords)))

(provide 'v8-code-mode)

; Mode selection based on filename extension
; (add-to-list 'auto-mode-alist '("\\.code\\'" .v8-code-mode))

; Mode selection based on the first line of the file
(add-to-list 'magic-mode-alist '("--- Raw source ---" . v8-code-mode) )

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to