Skip to content

Commit 11cffa3

Browse files
committed
Decrease max nesting level in debug
1 parent c8c7465 commit 11cffa3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/SwiftParser/Parser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public struct Parser {
119119
/// explicitly specify one. Debug builds of the parser consume a lot more stack
120120
/// space and thus have a lower default maximum nesting level.
121121
#if DEBUG
122-
static let defaultMaximumNestingLevel = 25
122+
static let defaultMaximumNestingLevel = 20
123123
#else
124124
static let defaultMaximumNestingLevel = 256
125125
#endif

Tests/SwiftParserTest/ParserTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public class ParserTests: XCTestCase {
2323
let fileContents = try Data(contentsOf: fileURL)
2424
let parsed = fileContents.withUnsafeBytes({ buffer in
2525
// Release builds are fine with the default maximum nesting level of 256.
26-
// Debug builds overflow with any stack size bigger than 25-ish.
27-
Parser.parse(source: buffer.bindMemory(to: UInt8.self), maximumNestingLevel: 25)
26+
// Debug builds overflow with any stack size bigger than 20-ish.
27+
Parser.parse(source: buffer.bindMemory(to: UInt8.self), maximumNestingLevel: 20)
2828
})
2929
assertDataEqualWithDiff(
3030
Data(parsed.syntaxTextBytes),

0 commit comments

Comments
 (0)