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

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

[elpa] master e85da34 43/56: Add lang/java.el and ...


From: Rocky Bernstein
Subject: [elpa] master e85da34 43/56: Add lang/java.el and ...
Date: Sat, 27 May 2017 05:02:36 -0400 (EDT)

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

    Add lang/java.el and ...
    
    in that parse a maven error line
---
 realgud/debugger/jdb/init.el       |  8 ++++--
 realgud/debugger/jdb/track-mode.el |  8 ++++--
 realgud/lang/java.el               | 47 +++++++++++++++++++++++++++++++++++
 test/test-regexp-java.el           | 50 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 109 insertions(+), 4 deletions(-)

diff --git a/realgud/debugger/jdb/init.el b/realgud/debugger/jdb/init.el
index 8d557c9..b29602a 100644
--- a/realgud/debugger/jdb/init.el
+++ b/realgud/debugger/jdb/init.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2014-2016 Free Software Foundation, Inc
+;; Copyright (C) 2014-2017 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -15,7 +15,7 @@
                         "../../common/init")
                       "realgud-")
 
-;; (require-relative-list '("../../lang/java") "realgud-lang-")
+(require-relative-list '("../../lang/java") "realgud-lang-")
 
 (defvar realgud-pat-hash)
 (declare-function make-realgud-loc-pat (realgud-loc))
@@ -126,6 +126,10 @@ backtrace listing.")
    :file-group 1
    :line-group 2))
 
+;;  Regular expression that describes location in a maven error
+(setf (gethash "maven-error" realgud:jdb-pat-hash)
+      realgud-maven-error-loc-pat)
+
 (setf (gethash "font-lock-keywords" realgud:jdb-pat-hash)
       '(
        ;; The frame number and first type name, if present.
diff --git a/realgud/debugger/jdb/track-mode.el 
b/realgud/debugger/jdb/track-mode.el
index e35a134..567cc74 100644
--- a/realgud/debugger/jdb/track-mode.el
+++ b/realgud/debugger/jdb/track-mode.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015-2016 Free Software Foundation, Inc
+;; Copyright (C) 2015-2017 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -18,18 +18,22 @@
                         )
                       "realgud-")
 (require-relative-list '("core" "init") "realgud:jdb-")
-(require-relative-list '("../../lang/ruby") "realgud-lang-")
+(require-relative-list '("../../lang/java") "realgud-lang-")
 
 (declare-function realgud-track-mode 'realgud-track-mode)
 (declare-function realgud-track-mode-hook 'realgud-track-mode)
 (declare-function realgud-track-mode-setup 'realgud-track-mode)
 (declare-function realgud:track-set-debugger 'realgud-track-mode)
 (declare-function realgud-goto-line-for-pt 'realgud-track-mode)
+(declare-function realgud-java-populate-command-keys 'realgud-lang-java)
 
 (realgud-track-mode-vars "realgud:jdb")
 ;;(defvaralias 'jdb-short-key-mode-map 'realgud:jdb-short-key-mode-map)
 ;;(defvaralias 'jdb-track-mode         'realgud:track-mode)
 
+(realgud-java-populate-command-keys realgud:jdb-track-mode-map)
+
+
 (define-key realgud-track-mode-map
   (kbd "C-c !!") 'realgud:goto-lang-backtrace-line)
 (define-key realgud-track-mode-map
diff --git a/realgud/lang/java.el b/realgud/lang/java.el
new file mode 100644
index 0000000..0d81d8e
--- /dev/null
+++ b/realgud/lang/java.el
@@ -0,0 +1,47 @@
+;; Copyright (C) 2017 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Common Java constants and regular expressions.
+(require 'load-relative)
+(require-relative-list '("../common/regexp" "../common/loc" "../common/track")
+                      "realgud-")
+
+(declare-function realgud-goto-line-for-pt 'realgud-track)
+
+(defun realgud-java-populate-command-keys (&optional map)
+  "Bind the debugger function key layout used by many debuggers.
+
+\\{realgud-example-map-standard}"
+  (define-key map (kbd "C-c !m") 'realgud:goto-maven-errmsg-line)
+  )
+
+
+(defconst realgud-maven-error-loc-pat
+  (make-realgud-loc-pat
+   :regexp "^\\[ERROR\\] \\(.*\\):\\[\\([0-9][0-9]*\\),\\([0-9][0-9]*\\)\\]"
+   :file-group 1
+   :line-group 2
+   :char-offset-group 3)
+  "A realgud-loc-pat struct that describes a maven error or warning line"
+  )
+
+(defun realgud:goto-maven-errmsg-line (pt)
+  "Display the location mentioned by the maven error at PT."
+  (interactive "d")
+  (realgud-goto-line-for-pt pt "maven-error"))
+
+(provide-me "realgud-lang-")
diff --git a/test/test-regexp-java.el b/test/test-regexp-java.el
new file mode 100644
index 0000000..6fd71d0
--- /dev/null
+++ b/test/test-regexp-java.el
@@ -0,0 +1,50 @@
+;; Press C-x C-e at the end of the next line to run this file test 
non-interactively
+;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory 
(locate-library "test-simple.elc")) buffer-file-name)
+
+(require 'test-simple)
+(load-file "../realgud/lang/java.el")
+(load-file "./regexp-helper.el")
+
+(declare-function __FILE__              'load-relative)
+(declare-function prompt-match          'regexp-helper)
+
+(test-simple-start)
+
+(eval-when-compile
+  (defvar loc-pat)   (defvar realgud:flake8-msg-loc-pat)
+  (defvar test-text)
+  )
+
+;; 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.
+(note "maven testing")
+
+(setq test-text
+      "[ERROR] /Users/rocky/pymaven/LexumoIndexer.java:[203,26] error: ';' 
expected")
+
+(assert-t (numberp (loc-match test-text realgud-maven-error-loc-pat))
+         "maven error")
+
+;; (string-match "^\\[ERROR\\] 
\\(.*\\):\\[\\([0-9][0-9]*\\),\\([0-9][0-9]*\\)\\]" test-text)
+;; (match-string 1 test-text)
+;; (match-string 2 test-text)
+;; (match-string 3 test-text)
+
+(assert-equal "/Users/rocky/pymaven/LexumoIndexer.java"
+             (match-string (realgud-loc-pat-file-group 
realgud-maven-error-loc-pat)
+                           test-text))
+
+(assert-equal "203"
+             (match-string (realgud-loc-pat-line-group 
realgud-maven-error-loc-pat)
+                           test-text))
+
+(assert-equal "26"
+             (match-string (realgud-loc-pat-char-offset-group 
realgud-maven-error-loc-pat)
+                           test-text))
+
+;; FIXME add pytest testing
+;; (note "pytest testing")
+
+
+(end-tests)



reply via email to

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