Armin Ronacher avatar Armin Ronacher committed 4e078b5

Added support for noexcept specifiers

Comments (0)

Files changed (2)

sphinx/domains/cpp.py

 class FuncDefExpr(NamedDefExpr):
 
     def __init__(self, name, visibility, static, explicit, constexpr, rv,
-                 signature, const, pure_virtual):
+                 signature, const, noexcept, pure_virtual):
         NamedDefExpr.__init__(self, name, visibility, static)
         self.rv = rv
         self.signature = signature
         self.explicit = explicit
         self.constexpr = constexpr
         self.const = const
+        self.noexcept = noexcept
         self.pure_virtual = pure_virtual
 
     def get_id(self):
             map(unicode, self.signature))))
         if self.const:
             buf.append(u'const')
+        if self.noexcept:
+            buf.append(u'noexcept')
         if self.pure_virtual:
             buf.append(u'= 0')
         return u' '.join(buf)
             args.append(ArgumentDefExpr(argtype, argname, default))
         self.skip_ws()
         const = self.skip_word_and_ws('const')
+        noexcept = self.skip_word_and_ws('noexcept')
         if self.skip_string('='):
             self.skip_ws()
             if not (self.skip_string('0') or \
             pure_virtual = True
         else:
             pure_virtual = False
-        return args, const, pure_virtual
+        return args, const, noexcept, pure_virtual
 
     def _parse_visibility_static(self):
         visibility = 'public'

tests/test_cpp_domain.py

     x = 'constexpr int get_value()'
     assert unicode(parse('function', x)) == x
 
+    x = 'int get_value() const noexcept'
+    assert unicode(parse('function', x)) == x
+
 
 def test_operators():
     x = parse('function', 'void operator new [  ] ()')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.