[gedit] external tools: extend link parser to handle grep output
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] external tools: extend link parser to handle grep output
- Date: Mon, 29 Apr 2013 14:48:10 +0000 (UTC)
commit 24539a6f9738ebbdfc537f15369f8c040dc8b075
Author: Adam Dingle <adam yorba org>
Date: Mon Apr 29 10:36:51 2013 -0400
external tools: extend link parser to handle grep output
https://bugzilla.gnome.org/show_bug.cgi?id=697136
plugins/externaltools/tools/linkparsing.py | 5 +++--
plugins/externaltools/tools/linkparsing_test.py | 8 ++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/plugins/externaltools/tools/linkparsing.py b/plugins/externaltools/tools/linkparsing.py
index bad3894..77f9c67 100644
--- a/plugins/externaltools/tools/linkparsing.py
+++ b/plugins/externaltools/tools/linkparsing.py
@@ -158,6 +158,7 @@ class RegexpLinkParser(AbstractLinkParser):
return links
# gcc 'test.c:13: warning: ...'
+# grep 'test.c:5:int main(...'
# javac 'Test.java:13: ...'
# ruby 'test.rb:5: ...'
# scalac 'Test.scala:5: ...'
@@ -165,13 +166,13 @@ class RegexpLinkParser(AbstractLinkParser):
REGEXP_STANDARD = r"""
^
(?P<lnk>
- (?P<pth> [^\:\n]* )
+ (?P<pth> [^ \:\n]* )
\:
(?P<ln> \d+)
\:?
(?P<col> \d+)?
)
-\:\s"""
+\:"""
# python ' File "test.py", line 13'
REGEXP_PYTHON = r"""
diff --git a/plugins/externaltools/tools/linkparsing_test.py b/plugins/externaltools/tools/linkparsing_test.py
index 544b282..187a2f8 100644
--- a/plugins/externaltools/tools/linkparsing_test.py
+++ b/plugins/externaltools/tools/linkparsing_test.py
@@ -72,6 +72,14 @@ test.c:14:13: error: expected ';' before 'return'
def test_parse_gcc_none_as_argument(self):
self.assertRaises(ValueError, self.p.parse, None)
+ def test_parse_grep_one_line(self):
+ line = "libnautilus-private/nautilus-canvas-container.h:45:#define
NAUTILUS_CANVAS_ICON_DATA(pointer)"
+ links = self.p.parse(line)
+ self.assert_link_count(links, 1)
+ lnk = links[0]
+ self.assert_link(lnk, "libnautilus-private/nautilus-canvas-container.h", 45)
+ self.assert_link_text(line, lnk, "libnautilus-private/nautilus-canvas-container.h:45")
+
def test_parse_python_simple_test_with_real_output(self):
output = """
Traceback (most recent call last):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]