Skip to content

Commit 2b22bb9

Browse files
committed
Add support for more "short" variants
1 parent 516333d commit 2b22bb9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/fiddle/cparser.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,20 @@ def parse_ctype(ty, tymap=nil)
175175
/\A(?:signed\s+)?int\s+long(?:\s+\w+)?\z/,
176176
/\Along(?:\s+int)?\s+signed(?:\s+\w+)?\z/
177177
return TYPE_LONG
178+
when /\Aunsigned\s+short(?:\s+int\s+)?(?:\s+\w+)?\z/,
179+
/\Aunsigned\s+int\s+short(?:\s+\w+)?\z/,
180+
/\Ashort(?:\s+int)?\s+unsigned(?:\s+\w+)?\z/,
181+
/\Aint\s+unsigned\s+short(?:\s+\w+)?\z/,
182+
/\A(?:int\s+)?short\s+unsigned(?:\s+\w+)?\z/
183+
return TYPE_USHORT
184+
when /\A(?:signed\s+)?short(?:\s+int\s+)?(?:\s+\w+)?\z/,
185+
/\A(?:signed\s+)?int\s+short(?:\s+\w+)?\z/,
186+
/\Aint\s+(?:signed\s+)?short(?:\s+\w+)?\z/
187+
return TYPE_SHORT
178188
when /\A(?:signed\s+)?int(?:\s+\w+)?\z/
179189
return TYPE_INT
180190
when /\A(?:unsigned\s+int|uint)(?:\s+\w+)?\z/
181191
return TYPE_UINT
182-
when /\A(?:signed\s+)?short(?:\s+int\s+)?(?:\s+\w+)?\z/
183-
return TYPE_SHORT
184-
when /\Aunsigned\s+short(?:\s+int\s+)?(?:\s+\w+)?\z/
185-
return TYPE_USHORT
186192
when /\A(?:signed\s+)?char(?:\s+\w+)?\z/
187193
return TYPE_CHAR
188194
when /\Aunsigned\s+char(?:\s+\w+)?\z/

0 commit comments

Comments
 (0)