+5
.changeset/curvy-geese-hope.md
+5
.changeset/curvy-geese-hope.md
+12
-5
src/parser.ts
+12
-5
src/parser.ts
···
65
65
idx--;
66
66
}
67
67
68
-
const nameRe = /[_\w][_\d\w]*/y;
68
+
const nameRe = /[_A-Za-z]\w*/y;
69
69
function name(): ast.NameNode | undefined {
70
70
let match: string | undefined;
71
71
if ((match = advance(nameRe))) {
···
76
76
}
77
77
}
78
78
79
-
const constRe = /null|true|false/y;
80
-
const variableRe = /\$[_\w][_\d\w]*/y;
79
+
// NOTE(Safari10 Quirk): This needs to be wrapped in a non-capturing group
80
+
const constRe = /(?:null|true|false)/y;
81
+
82
+
const variableRe = /\$[_A-Za-z]\w*/y;
81
83
const intRe = /-?\d+/y;
82
-
const floatPartRe = /(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
84
+
85
+
// NOTE(Safari10 Quirk): This cannot be further simplified
86
+
const floatPartRe = /(?:\.\d+)?[eE][+-]?\d+|\.\d+/y;
87
+
83
88
const complexStringRe = /\\/g;
84
89
const blockStringRe = /"""(?:[\s\S]+(?="""))?"""/y;
85
90
const stringRe = /"(?:[^"\r\n]+)?"/y;
···
413
418
}
414
419
}
415
420
416
-
const operationDefinitionRe = /query|mutation|subscription/y;
421
+
// NOTE(Safari10 Quirk): This *might* need to be wrapped in a group, but worked without it too
422
+
const operationDefinitionRe = /(?:query|mutation|subscription)/y;
423
+
417
424
function operationDefinition(): ast.OperationDefinitionNode | undefined {
418
425
let _operation: string | undefined;
419
426
let _name: ast.NameNode | undefined;