Skip to content

Commit a0e95f8

Browse files
committed
Update parser file to handle Double, f64, and types with multiple underscores.
1 parent f300e82 commit a0e95f8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/parser.mts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,14 @@ export default class Parser {
729729
rustType.swiftRawSignature = 'Int64';
730730
rustType.kind = RustKind.Primitive;
731731
}
732+
} else if (relevantTypeLine.startsWith('double')) {
733+
rustType = new RustPrimitive();
734+
typelessLineRemainder = relevantTypeLine.substring('double'.length).trim();
735+
if (rustType instanceof RustPrimitive) {
736+
rustType.cSignature = 'double';
737+
rustType.swiftRawSignature = 'Double';
738+
rustType.kind = RustKind.Primitive;
739+
}
732740
} else if (relevantTypeLine.startsWith('bool')) {
733741
rustType = new RustPrimitive();
734742
typelessLineRemainder = relevantTypeLine.substring('bool'.length).trim();
@@ -1000,7 +1008,7 @@ export default class Parser {
10001008
*
10011009
*/
10021010

1003-
const METHOD_TYPE_ASSOCIATION_PREFIX_REGEX = /^([A-Z][a-zA-Z0-9]*)(_([A-Z_][a-zA-Z0-9]*))*(_(i5|i8|i16|i32|i64|i128|u5|u8|u16|u32|u64|u128|usize|bool)[a-zA-Z0-9]+)?/;
1011+
const METHOD_TYPE_ASSOCIATION_PREFIX_REGEX = /^([A-Z][a-zA-Z0-9]*)(_([A-Z_][a-zA-Z0-9]*))*(_(f64|i5|i8|i16|i32|i64|i128|u5|u8|u16|u32|u64|u128|usize|bool)[a-zA-Z0-9]+)*/;
10041012
const prefixMatches = METHOD_TYPE_ASSOCIATION_PREFIX_REGEX.exec(name);
10051013
if (!prefixMatches) {
10061014
// debug('object-unassociated method name: %s', name);

0 commit comments

Comments
 (0)