[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt f30a05624d 051/323: Add support for parsing .
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt f30a05624d 051/323: Add support for parsing .file directives |
Date: |
Thu, 9 Mar 2023 10:58:12 -0500 (EST) |
branch: externals/beardbolt
commit f30a05624dda7cd704e0cce4867b88e39151437a
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Add support for parsing .file directives
---
rmsbolt.el | 55 ++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 38 insertions(+), 17 deletions(-)
diff --git a/rmsbolt.el b/rmsbolt.el
index 2e5ed91bd5..48bebfba01 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -183,6 +183,12 @@ Outputs assembly file if ASM."
(opt " ")))
(0+ space)
(group (0+ any))))
+(defvar rmsbolt-source-file (rx bol (0+ space) ".file" (1+ space)
+ (group (1+ digit)) (1+ space) ?\"
+ (group (1+ (not (any ?\")))) ?\"
+ (opt (1+ space) ?\"
+ (group (1+ (not (any ?\")))) ?\")
+ (0+ any)))
(defvar rmsbolt-source-tag (rx bol (0+ space) ".loc" (1+ space)
(group (1+ digit)) (1+ space)
(group (1+ digit))
@@ -247,7 +253,7 @@ Outputs assembly file if ASM."
(cl-defun rmsbolt--ocaml-compile-cmd (&key src-buffer)
"Process a compile command for gcc/clang.
-Needed as ocaml cannot output asm to a non-hardcoded file"
+ Needed as ocaml cannot output asm to a
non-hardcoded file"
(let* ((diss (buffer-local-value 'rmsbolt-disassemble src-buffer))
(output-filename (rmsbolt-output-filename src-buffer))
(predicted-asm-filename (concat (file-name-sans-extension
(buffer-file-name)) ".s"))
@@ -276,7 +282,7 @@ Needed as ocaml cannot output asm to a non-hardcoded file"
(cl-defun rmsbolt--lisp-compile-cmd (&key src-buffer)
"Process a compile command for common lisp.
-Assumes function name to dissasemble is 'main'."
+ Assumes function name to dissasemble is
'main'."
(let* ((cmd (buffer-local-value 'rmsbolt-command src-buffer))
(interpreter (cl-first (split-string cmd nil t)))
(disass-eval "\"(disassemble 'main)\"")
@@ -289,17 +295,17 @@ Assumes function name to dissasemble is 'main'."
"--eval" disass-eval "--non-interactive"
;; Remove leading comments
"|" "sed" "'s/^;\s//'" ">"
- (rmsbolt-output-filename src-buffer))
- " "))
- ("clisp"
- (mapconcat 'identity
- (list cmd "-q" "-x"
- (concat
- "\"(load \\\"" (buffer-file-name) "\\\") "
disass-eval-unquoted "\"")
- ">" (rmsbolt-output-filename src-buffer))
- " "))
- (_
- (error "This Common Lisp interpreter is not supported")))))
+ (rmsbolt-output-filename src-buffer))
+ " "))
+("clisp"
+ (mapconcat 'identity
+ (list cmd "-q" "-x"
+ (concat
+ "\"(load \\\"" (buffer-file-name) "\\\") "
disass-eval-unquoted "\"")
+ ">" (rmsbolt-output-filename src-buffer))
+ " "))
+(_
+ (error "This Common Lisp interpreter is not supported")))))
(cl-defun rmsbolt--rust-compile-cmd (&key src-buffer)
"Process a compile command for rustc."
(let* ((cmd (buffer-local-value 'rmsbolt-command src-buffer))
@@ -543,7 +549,11 @@ Assumes function name to dissasemble is 'main'."
(let ((used-labels (rmsbolt--find-used-labels src-buffer asm-lines))
(result nil)
(prev-label nil)
- (source-linum nil))
+ (source-linum nil)
+ (source-file nil)
+ (skip-file-match
+ ;; Skip file match if we don't have a current filename
+ (not (buffer-file-name src-buffer))))
(dolist (line asm-lines)
(let* ((raw-match (or (string-match rmsbolt-label-def line)
(string-match rmsbolt-assignment-def line)))
@@ -551,11 +561,21 @@ Assumes function name to dissasemble is 'main'."
(match-string 1 line)))
(used-label (cl-find match used-labels :test #'equal)))
(cl-tagbody
+ ;; Process file name hints
+ (when (string-match rmsbolt-source-file line)
+ (if (match-string 3 line)
+ ;; Clang style match
+ (setq source-file (expand-file-name
+ (match-string 3 line)
+ (match-string 2 line)))
+ (setq source-file (match-string 2 line))))
;; Process any line number hints
(when (string-match rmsbolt-source-tag line)
- (setq source-linum
- (string-to-number
- (match-string 2 line))))
+ (if (or skip-file-match
+ (file-equal-p (buffer-file-name src-buffer) source-file))
+ (setq source-linum (string-to-number
+ (match-string 2 line)))
+ (setq source-linum nil)))
(when (string-match rmsbolt-source-stab line)
(pcase (string-to-number (match-string 1 line))
;; http://www.math.utah.edu/docs/info/stabs_11.html
@@ -781,6 +801,7 @@ Assumes function name to dissasemble is 'main'."
(rmsbolt-defstarter "c++" 'c++-mode)
(rmsbolt-defstarter "ocaml" 'tuareg-mode)
(rmsbolt-defstarter "cl" 'lisp-mode)
+(rmsbolt-defstarter "rust" 'rust-mode)
;;;; Font lock matcher
(defun rmsbolt--goto-line (line)
- [elpa] externals/beardbolt c05a0be490 297/323: Add useful beardbolt-preserve-library-functions, (continued)
- [elpa] externals/beardbolt c05a0be490 297/323: Add useful beardbolt-preserve-library-functions, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 26c0b918e4 301/323: Tweak README.md again, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e1e69080b7 303/323: Rename "output buffer" -> "asm buffer", ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt dbafc4a88c 304/323: Minor cleanup, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 68469cfb57 306/323: More misc minor rework to simplify code, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 02a0bfbcdb 313/323: Add `beardbolt-ccj-extra-flags` option, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 6a71a16619 319/323: Simplify rainbow-clearing logic, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e403331350 322/323: * beardbolt.el (bb--synch-relation-overlays): Fix bug., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4a6f289c94 002/323: Add very basic compilation of c files, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ac893146e3 019/323: Force dissasembly if we don't support asm, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f30a05624d 051/323: Add support for parsing .file directives,
ELPA Syncer <=
- [elpa] externals/beardbolt 865d5a8c1a 111/323: Clean up CI config, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 7f61815c17 121/323: Try to fix bytecode issues, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e517cd4dbc 142/323: Remove unneeded disass-hidden-funcs overrides, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f89875215b 128/323: Fix byte-compilation warnings, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt cb0b781e82 143/323: Add rudimentary support for hack/hhvm, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4f86bae37e 144/323: Add rmsbolt-asm-format for toggling between asm formats., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 20fa6a76e0 150/323: Clear out unset or nil variables after setting them via defaults, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt fc712fe954 147/323: Fix typo in readme, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 56f8fd2037 148/323: Add additional salespitch, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0c19afca2d 157/323: Simplify d support, ELPA Syncer, 2023/03/09