diff options
Diffstat (limited to 'lisp/cedet/semantic')
| -rw-r--r-- | lisp/cedet/semantic/symref/grep.el | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 42dc40cce04..df71508da7c 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el | |||
| @@ -189,26 +189,25 @@ This shell should support pipe redirect syntax." | |||
| 189 | ;; Return the answer | 189 | ;; Return the answer |
| 190 | ans)) | 190 | ans)) |
| 191 | 191 | ||
| 192 | (defconst semantic-symref-grep--line-re | ||
| 193 | "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):") | ||
| 194 | |||
| 195 | (cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-grep)) | 192 | (cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-grep)) |
| 196 | "Parse one line of grep output, and return it as a match list. | 193 | "Parse one line of grep output, and return it as a match list. |
| 197 | Moves cursor to end of the match." | 194 | Moves cursor to end of the match." |
| 198 | (cond ((eq (oref tool :resulttype) 'file) | 195 | (pcase-let |
| 199 | ;; Search for files | 196 | ((`(,grep-re ,file-group ,line-group . ,_) (car (grep-regexp-alist)))) |
| 200 | (when (re-search-forward "^\\([^\n]+\\)$" nil t) | 197 | (cond ((eq (oref tool :resulttype) 'file) |
| 201 | (match-string 1))) | 198 | ;; Search for files |
| 202 | ((eq (oref tool :resulttype) 'line-and-text) | 199 | (when (re-search-forward "^\\([^\n]+\\)$" nil t) |
| 203 | (when (re-search-forward semantic-symref-grep--line-re nil t) | 200 | (match-string 1))) |
| 204 | (list (string-to-number (match-string 2)) | 201 | ((eq (oref tool :resulttype) 'line-and-text) |
| 205 | (match-string 1) | 202 | (when (re-search-forward grep-re nil t) |
| 206 | (buffer-substring-no-properties (point) (line-end-position))))) | 203 | (list (string-to-number (match-string line-group)) |
| 207 | (t | 204 | (match-string file-group) |
| 208 | (when (re-search-forward semantic-symref-grep--line-re nil t) | 205 | (buffer-substring-no-properties (point) (line-end-position))))) |
| 209 | (cons (string-to-number (match-string 2)) | 206 | (t |
| 210 | (match-string 1)) | 207 | (when (re-search-forward grep-re nil t) |
| 211 | )))) | 208 | (cons (string-to-number (match-string line-group)) |
| 209 | (match-string file-group)) | ||
| 210 | ))))) | ||
| 212 | 211 | ||
| 213 | (provide 'semantic/symref/grep) | 212 | (provide 'semantic/symref/grep) |
| 214 | 213 | ||