Skip to content

Commit

Permalink
C, C++, parse <width> <complex/imaginary>
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobandersen committed Aug 20, 2021
1 parent a4371ea commit 4b62b6c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions sphinx/domains/c.py
Expand Up @@ -106,6 +106,7 @@
# Floating-point
# --------------
|(float|double|long\s+double)(\s+(_Complex|complex|_Imaginary|imaginary))?
|(_Complex|complex|_Imaginary|imaginary)\s+(float|double|long\s+double)
|_Decimal(32|64|128)
# extensions
|__float80|_Float64x|__float128|_Float128|__ibm128
Expand Down
19 changes: 9 additions & 10 deletions sphinx/domains/cpp.py
Expand Up @@ -349,6 +349,7 @@
# Floating-point
# --------------
|(float|double|long\s+double)(\s+(_Complex|_Imaginary))?
|(_Complex|_Imaginary)\s+(float|double|long\s+double)
# extensions
|__float80|_Float64x|__float128|_Float128
# Integer types that could be prefixes of the previous ones
Expand Down Expand Up @@ -482,16 +483,14 @@
'float': 'f',
'double': 'd',
'long double': 'e',
'__float80': 'e',
'_Float64x': 'e',
'__float128': 'g',
'_Float128': 'g',
'float _Complex': 'Cf',
'double _Complex': 'Cd',
'long double _Complex': 'Ce',
'float _Imaginary': 'f',
'double _Imaginary': 'd',
'long double _Imaginary': 'e',
'__float80': 'e', '_Float64x': 'e',
'__float128': 'g', '_Float128': 'g',
'float _Complex': 'Cf', '_Complex float': 'Cf',
'double _Complex': 'Cd', '_Complex double': 'Cd',
'long double _Complex': 'Ce', '_Complex long double': 'Ce',
'float _Imaginary': 'f', '_Imaginary float': 'f',
'double _Imaginary': 'd', '_Imaginary double': 'd',
'long double _Imaginary': 'e', '_Imaginary long double': 'e',
'auto': 'Da',
'decltype(auto)': 'Dc',
'std::nullptr_t': 'Dn'
Expand Down
3 changes: 2 additions & 1 deletion tests/test_domain_c.py
Expand Up @@ -306,7 +306,8 @@ def signed(t):
for f in ('float', 'double', 'long double'):
yield f
yield from (f + " _Complex", f + " complex")
yield from (f + " _Imaginary", f + " imaginary")
yield from ("_Complex " + f, "complex " + f)
yield from ("_Imaginary " + f, "imaginary " + f)
# extensions
# https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html#Floating-Types
yield from ('__float80', '_Float64x',
Expand Down

0 comments on commit 4b62b6c

Please sign in to comment.