emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master ea21fd6 22/56: field char-offset -> column


From: Rocky Bernstein
Subject: [elpa] master ea21fd6 22/56: field char-offset -> column
Date: Sat, 27 May 2017 05:02:32 -0400 (EDT)

branch: master
commit ea21fd6e2222a844af959ec852cfbd6953565b17
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    field char-offset -> column
---
 realgud/common/buffer/command.el  | 16 +++++++++----
 realgud/common/file.el            |  2 +-
 realgud/common/regexp.el          |  5 ++--
 realgud/common/track.el           | 10 ++++----
 realgud/debugger/gdb/init.el      |  2 +-
 realgud/debugger/gub/init.el      |  2 +-
 realgud/debugger/nodejs/init.el   |  2 +-
 realgud/debugger/trepanjs/init.el |  4 ++--
 realgud/lang/js.el                |  2 +-
 realgud/lang/python.el            |  3 ++-
 test/test-loc-regexp-nodejs.el    |  4 ++--
 test/test-regexp-gub.el           |  6 +++--
 test/test-regexp-python.el        |  4 ++--
 test/test-regexp-rdebug.el        |  4 ++++
 test/test-regexp-trepan.el        | 49 +++++++++++++++++++++++++--------------
 15 files changed, 72 insertions(+), 43 deletions(-)

diff --git a/realgud/common/buffer/command.el b/realgud/common/buffer/command.el
index 18b874f..c66dc9b 100644
--- a/realgud/common/buffer/command.el
+++ b/realgud/common/buffer/command.el
@@ -93,12 +93,17 @@
 
   ;; FIXME: REMOVE THIS and use regexp-hash
   loc-regexp   ;; Location regular expression string
-  file-group
-  line-group
+  file-group   ;; file path
+  line-group   ;; line number
+  ;; FIXME: remove alt- things
+  ;; They are here because sometimes we can't get a single regexp
+  ;; pattern to have all regexp file paths or line numbers appear at the
+  ;; same pattern group (e.g. in the first position)
   alt-file-group
   alt-line-group
-  char-offset-group
-  text-group
+  column-group  ;; Column within a line
+  char-offset-group ;; char offset from begging of file
+  text-group  ;; Matching text
   ignore-file-re
 
   loc-hist     ;; ring of locations seen in the course of execution
@@ -332,7 +337,8 @@ values set in the debugger's init.el."
             :line-group (realgud-sget 'loc-pat 'line-group)
             :alt-file-group (realgud-sget 'loc-pat 'alt-file-group)
             :alt-line-group (realgud-sget 'loc-pat 'alt-line-group)
-            :char-offset-group (realgud-sget 'loc-pat 'char-offset-group)
+            :column-group (realgud-sget 'loc-pat 'column-group)
+            :char-offset-group (realgud-sget 'loc-pat 'column-group)
             :text-group (realgud-sget 'loc-pat 'text-group)
             :ignore-file-re (realgud-sget 'loc-pat 'ignore-file-re)
             :loc-hist (make-realgud-loc-hist)
diff --git a/realgud/common/file.el b/realgud/common/file.el
index ae396c2..7b265ac 100644
--- a/realgud/common/file.el
+++ b/realgud/common/file.el
@@ -123,7 +123,7 @@ problem as best as we can determine."
                                (goto-char (point-min))
                                ;; FIXME allow for byte offset
                                (forward-line (1- line-number))
-                               (forward-char (1- column-number))
+                               (move-to-column (1- column-number))
                                (make-realgud-loc
                                      :num           bp-num
                                      :cmd-marker    cmd-marker
diff --git a/realgud/common/regexp.el b/realgud/common/regexp.el
index 55895dc..1c6ff5b 100644
--- a/realgud/common/regexp.el
+++ b/realgud/common/regexp.el
@@ -41,12 +41,11 @@ output by a debugger inside a process shell"
                        ;; file position as in Perl locations.
   (regexp)             ;; a stack position, or thread number.
   (file-group)         ;; Filename position in struct
-  (line-group)         ;; Line number position in struct
+  (line-group)         ;; Line number position in struct. First line is 1
   (alt-file-group)     ;; Used when regexp is too complicated and use \|
                        ;; e.g. perldb file loc regexps
   (alt-line-group)     ;; ditto
-                       ;; FIXME: separate character offset from beginning
-                       ;; from column number
+  (column-group)       ;; Column position in struct. First position is 1
   (char-offset-group)  ;; Character offset position in struct
   (instruction-address-group)
   (ignore-file-re)     ;; Some debuggers create pseudo files in eval strings
diff --git a/realgud/common/track.el b/realgud/common/track.el
index c2c8f7b..ed96e88 100644
--- a/realgud/common/track.el
+++ b/realgud/common/track.el
@@ -398,10 +398,12 @@ Otherwise return nil."
           (line-group (or opt-line-group
                           (realgud-sget 'cmdbuf-info 'line-group)))
           (column-group (or opt-col-group
-                            (realgud-sget 'cmdbuf-info 'char-offset-group)))
+                            (realgud-sget 'cmdbuf-info 'column-group)))
           (alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
           (alt-line-group (realgud-sget 'cmdbuf-info 'alt-line-group))
-          (text-group (realgud-sget 'cmdbuf-info 'text-group))
+          ;; FIXME: should pass as parameter
+          (text-group)
+          ;; (text-group (realgud-sget 'cmdbuf-info 'text-group))
           (ignore-file-re (or opt-ignore-file-re
                               (realgud-sget 'cmdbuf-info 'ignore-file-re)))
           (callback-loc-fn (realgud-sget 'cmdbuf-info 'callback-loc-fn))
@@ -472,7 +474,7 @@ Otherwise return nil. CMD-MARK is set in the realgud-loc 
object created.
                    (loc-regexp     (realgud-loc-pat-regexp loc-pat))
                    (file-group     (realgud-loc-pat-file-group loc-pat))
                    (line-group     (realgud-loc-pat-line-group loc-pat))
-                   (col-group      (realgud-loc-pat-char-offset-group loc-pat))
+                   (col-group      (realgud-loc-pat-column-group loc-pat))
                    (text-group     (realgud-loc-pat-text-group loc-pat))
                    (ignore-file-re (realgud-loc-pat-ignore-file-re loc-pat))
                    (callback-loc-fn (realgud-sget 'cmdbuf-info 
'callback-loc-fn))
@@ -723,7 +725,7 @@ find a location. non-nil if we can find a location.
                                (realgud-loc-pat-regexp loc-pat)
                                (realgud-loc-pat-file-group loc-pat)
                                (realgud-loc-pat-line-group loc-pat)
-                               (realgud-loc-pat-char-offset-group loc-pat)
+                               (realgud-loc-pat-column-group loc-pat)
                                nil
                                (realgud-loc-pat-ignore-file-re loc-pat)
                                ))
diff --git a/realgud/debugger/gdb/init.el b/realgud/debugger/gdb/init.el
index 92bb5d6..4fa1c81 100644
--- a/realgud/debugger/gdb/init.el
+++ b/realgud/debugger/gdb/init.el
@@ -45,7 +45,7 @@ realgud-loc-pat struct")
                       realgud:gdb-frame-file-regexp 
realgud:regexp-captured-num)
        :file-group 1
        :line-group 2
-       :char-offset-group 3))
+       :column-group 3))
 
 ;; Regular expression that describes a gdb prompt
 ;; For example:
diff --git a/realgud/debugger/gub/init.el b/realgud/debugger/gub/init.el
index f244267..5b7bf93 100644
--- a/realgud/debugger/gub/init.el
+++ b/realgud/debugger/gub/init.el
@@ -81,7 +81,7 @@ realgud-loc-pat struct")
        :num 1
        :file-group 2
        :line-group 3
-       :char-offset-group 4))
+       :column-group 4))
 
 ;; Regular expression that describes a debugger "delete" (breakpoint) response.
 ;; For example:
diff --git a/realgud/debugger/nodejs/init.el b/realgud/debugger/nodejs/init.el
index 70634af..a009e47 100644
--- a/realgud/debugger/nodejs/init.el
+++ b/realgud/debugger/nodejs/init.el
@@ -109,7 +109,7 @@ realgud-loc-pat struct")
        :num 1
        :file-group 2
        :line-group 3
-       :char-offset-group 4))
+       :column-group 4))
 
 (defconst realgud:nodejs-debugger-name "nodejs" "Name of debugger")
 
diff --git a/realgud/debugger/trepanjs/init.el 
b/realgud/debugger/trepanjs/init.el
index 9f37b6f..70053b5 100644
--- a/realgud/debugger/trepanjs/init.el
+++ b/realgud/debugger/trepanjs/init.el
@@ -48,7 +48,7 @@ realgud-loc-pat struct")
                realgud:regexp-captured-num)
        :file-group 1
        :line-group 2
-       :char-offset-group 3
+       :column-group 3
        ))
 
 ;; realgud-loc-pat that describes a trepanjs command prompt
@@ -123,7 +123,7 @@ realgud-loc-pat struct")
        :num 1
        :file-group 2
        :line-group 3
-       :char-offset-group 4
+       :column-group 4
        ))
 
 (defconst realgud:trepanjs-debugger-name "trepanjs" "Name of debugger")
diff --git a/realgud/lang/js.el b/realgud/lang/js.el
index 8d19847..8cc8f16 100644
--- a/realgud/lang/js.el
+++ b/realgud/lang/js.el
@@ -35,7 +35,7 @@
                   realgud:regexp-captured-num realgud:regexp-captured-num)
    :file-group 2
    :line-group 3
-   :char-offset-group 4)
+   :column-group 4)
   "A realgud-loc-pat struct that describes a V8 backtrace location")
 
 (provide-me "realgud-lang-")
diff --git a/realgud/lang/python.el b/realgud/lang/python.el
index 6e7b731..8706e10 100644
--- a/realgud/lang/python.el
+++ b/realgud/lang/python.el
@@ -179,7 +179,8 @@ traceback) line."  )
    :regexp "^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\): [EFW]\\([0-9]+\\) "
    :file-group 1
    :line-group 2
-   :char-offset-group 3
+   :column-group 3
+   :text-group nil
    )
   "A realgud-loc-pat struct that describes a flake8 warning or error line"
   )
diff --git a/test/test-loc-regexp-nodejs.el b/test/test-loc-regexp-nodejs.el
index f9b647d..b93094f 100644
--- a/test/test-loc-regexp-nodejs.el
+++ b/test/test-loc-regexp-nodejs.el
@@ -20,7 +20,7 @@
 (declare-function assert-equal 'test-simple)
 (declare-function note 'test-simple)
 (declare-function end-tests 'test-simple)
-(declare-function realgud-loc-pat-char-offset-group  'realgud:nodejs-init)
+(declare-function realgud-loc-pat-column-group  'realgud:nodejs-init)
 
 (test-simple-start)
 
@@ -68,7 +68,7 @@
 (setq num-group (realgud-loc-pat-num realgud-pat-bt))
 (setq file-group (realgud-loc-pat-file-group realgud-pat-bt))
 (setq line-group (realgud-loc-pat-line-group realgud-pat-bt))
-(setq col-group (realgud-loc-pat-char-offset-group realgud-pat-bt))
+(setq col-group (realgud-loc-pat-column-group realgud-pat-bt))
 (assert-equal 0 (string-match bt-re test-s1))
 (assert-equal "0" (substring test-s1
                             (match-beginning num-group)
diff --git a/test/test-regexp-gub.el b/test/test-regexp-gub.el
index 0240a05..faf87ac 100644
--- a/test/test-regexp-gub.el
+++ b/test/test-regexp-gub.el
@@ -12,11 +12,13 @@
 
 (eval-when-compile
   (defvar dbg-name)
-  (defvar realgud:gub-pat-hash)
   (defvar panic-tb)
-  (defvar test-tb)
+  (defvar prompt-match)
   (defvar prompt-pat)
+  (defvar realgud:gub-pat-hash)
+  (defvar tb-loc-match)
   (defvar test-dbgr)
+  (defvar test-tb)
   (defvar test-text)
 )
 
diff --git a/test/test-regexp-python.el b/test/test-regexp-python.el
index 35301c2..2471d2b 100644
--- a/test/test-regexp-python.el
+++ b/test/test-regexp-python.el
@@ -35,7 +35,7 @@
                            test-text))
 
 (assert-equal "17"
-             (match-string (realgud-loc-pat-char-offset-group 
realgud-flake8-msg-loc-pat)
+             (match-string (realgud-loc-pat-column-group 
realgud-flake8-msg-loc-pat)
                            test-text))
 
 (setq test-text
@@ -54,7 +54,7 @@
                            test-text))
 
 (assert-equal "1"
-             (match-string (realgud-loc-pat-char-offset-group 
realgud-flake8-msg-loc-pat)
+             (match-string (realgud-loc-pat-column-group 
realgud-flake8-msg-loc-pat)
                            test-text))
 
 ;; FIXME add pytest testing
diff --git a/test/test-regexp-rdebug.el b/test/test-regexp-rdebug.el
index c57dc23..8eb535b 100644
--- a/test/test-regexp-rdebug.el
+++ b/test/test-regexp-rdebug.el
@@ -10,6 +10,10 @@
 (test-simple-start)
 
 (eval-when-compile
+  (defvar helper-bps)
+  (defvar helper-bt)
+  (defvar prompt-pat)
+  (defvar rails-bt)
   (defvar realgud-rdebug-pat-hash)
 )
 
diff --git a/test/test-regexp-trepan.el b/test/test-regexp-trepan.el
index bff0331..5be508a 100644
--- a/test/test-regexp-trepan.el
+++ b/test/test-regexp-trepan.el
@@ -7,6 +7,20 @@
 
 (test-simple-start)
 
+(eval-when-compile
+  (defvar bps-pat)
+  (defvar dbg-bt-pat)
+  (defvar ctrl-pat)
+  (defvar file-group)
+  (defvar line-group)
+  (defvar prompt-pat)
+  (defvar lang-bt-pat)
+  (defvar tb-loc-match)
+  (defvar test-dbgr)
+  (defvar test-s1)
+  (defvar test-text)
+)
+
 (set (make-local-variable 'bps-pat)
      (gethash "brkpt-set"          realgud:trepan-pat-hash))
 (set (make-local-variable 'dbg-bt-pat)
@@ -21,26 +35,26 @@
 ;; FIXME: we get a void variable somewhere in here when running
 ;;        even though we define it in lexical-let. Dunno why.
 ;;        setq however will workaround this.
-(set (make-local-variable 'text)
+(set (make-local-variable 'test-text)
  "     from /usr/local/bin/irb:12:in `<main>'")
 
 (note "traceback location matching")
 
-(setq text "   from /usr/local/bin/irb:12:in `<main>'")
+(setq test-text "      from /usr/local/bin/irb:12:in `<main>'")
 
-(assert-t (numberp (loc-match text lang-bt-pat))
+(assert-t (numberp (loc-match test-text lang-bt-pat))
          "basic traceback location")
 (assert-equal "/usr/local/bin/irb"
-             (match-string (realgud-loc-pat-file-group lang-bt-pat) text)
+             (match-string (realgud-loc-pat-file-group lang-bt-pat) test-text)
              "extract traceback file name")
 
 (assert-equal "12"
              (match-string (realgud-loc-pat-line-group
-                            lang-bt-pat) text)
+                            lang-bt-pat) test-text)
              "extract traceback line number")
 
 (note "debugger-backtrace")
-(set (make-local-variable 's1)
+(set (make-local-variable 'test-s1)
      "--> #0 METHOD Object#require(path) in file <internal:lib/require> at 
line 28
     #1 TOP Object#<top /tmp/linecache.rb> in file /tmp/linecache.rb
 ")
@@ -54,26 +68,26 @@
 (set (make-local-variable 'line-group)
      (realgud-loc-pat-line-group dbg-bt-pat))
 
-(assert-equal 0 (string-match frame-re s1))
-(assert-equal "0" (substring s1
+(assert-equal 0 (string-match frame-re test-s1))
+(assert-equal "0" (substring test-s1
                             (match-beginning num-group)
                             (match-end num-group)))
 (assert-equal "<internal:lib/require>"
-             (substring s1
+             (substring test-s1
                         (match-beginning file-group)
                         (match-end file-group)))
 (assert-equal "28"
-             (substring s1
+             (substring test-s1
                         (match-beginning line-group)
                         (match-end line-group)))
 (setq pos (match-end 0))
 
-(assert-equal 77 (string-match frame-re s1 pos))
-(assert-equal "1" (substring s1
+(assert-equal 77 (string-match frame-re test-s1 pos))
+(assert-equal "1" (substring test-s1
                             (match-beginning num-group)
                             (match-end num-group)))
 (assert-equal "/tmp/linecache.rb"
-             (substring s1
+             (substring test-s1
                         (match-beginning file-group)
                         (match-end file-group)))
 
@@ -102,23 +116,24 @@
                 ctrl-pat)
              )
 
-(setq text "Breakpoint 1 set at VM offset 2 of instruction sequence \"<top 
/usr/local/bin/irb>\",
+(setq test-text
+      "Breakpoint 1 set at VM offset 2 of instruction sequence \"<top 
/usr/local/bin/irb>\",
        line 9 in file /usr/local/bin/irb.
 ")
 
 
-(assert-t (numberp (loc-match text bps-pat))
+(assert-t (numberp (loc-match test-text bps-pat))
          "basic breakpoint location")
 
 
 (assert-equal "/usr/local/bin/irb"
              (match-string (realgud-loc-pat-file-group
-                            bps-pat) text)
+                            bps-pat) test-text)
              "extract breakpoint file name")
 
 (assert-equal "9"
              (match-string (realgud-loc-pat-line-group
-                            bps-pat) text)
+                            bps-pat) test-text)
              "extract breakpoint line number")
 
 (end-tests)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]