Skip to content

Commit 3b4d6e7

Browse files
h3n4lclaude
andauthored
feat(mongodb): accept string arguments in Int32/NumberInt helpers (#64)
Int32("123") and NumberInt("456") are valid in mongosh but the grammar only accepted NUMBER tokens. Align with Long/NumberLong which already supports both forms. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 42a9a5d commit 3b4d6e7

2 files changed

Lines changed: 810 additions & 773 deletions

File tree

mongodb/MongoShellParser.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,9 +819,9 @@ longHelper
819819
: (LONG | NUMBER_LONG) LPAREN (NUMBER | stringLiteral) RPAREN
820820
;
821821

822-
// Int32(n), NumberInt(n)
822+
// Int32(n), Int32("n"), NumberInt(n), NumberInt("n")
823823
int32Helper
824-
: (INT32 | NUMBER_INT) LPAREN NUMBER RPAREN
824+
: (INT32 | NUMBER_INT) LPAREN (NUMBER | stringLiteral) RPAREN
825825
;
826826

827827
// Double(n)

0 commit comments

Comments
 (0)