Skip to content

Commit

Permalink
Add Regex support in gdb pretty printing
Browse files Browse the repository at this point in the history
  • Loading branch information
mawww committed Feb 6, 2017
1 parent dc2c5ea commit e929b15
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gdb/kakoune.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ def to_string(self):
else:
return self.val["color"]

class Regex:
"""Print a Regex"""

def __init__(self, val):
self.val = val

def to_string(self):
return "regex%s" % (self.val["m_str"])


def build_pretty_printer():
pp = gdb.printing.RegexpCollectionPrettyPrinter("kakoune")
Expand All @@ -215,4 +224,5 @@ def build_pretty_printer():
pp.add_printer('ColumnCount', '^Kakoune::ColumnCount$', ColumnCount)
pp.add_printer('ByteCount', '^Kakoune::ByteCount$', ByteCount)
pp.add_printer('Color', '^Kakoune::Color$', Color)
pp.add_printer('Regex', '^Kakoune::Regex$', Regex)
return pp

0 comments on commit e929b15

Please sign in to comment.