Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Acornima" Version="1.2.0" />
<PackageVersion Include="Acornima.Extras" Version="1.2.0" />
<PackageVersion Include="Acornima" Version="1.3.0" />
<PackageVersion Include="Acornima.Extras" Version="1.3.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="BenchmarkDotNet.TestAdapter" Version="0.13.12" />
<PackageVersion Include="FluentAssertions" Version="[7.2.1]" />
Expand Down Expand Up @@ -35,4 +35,4 @@
<ItemGroup>
<GlobalPackageReference Include="PolySharp" Version="1.15.0" />
</ItemGroup>
</Project>
</Project>
11 changes: 9 additions & 2 deletions Jint.Tests.Test262/Test262Harness.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"Parallel": true,
"ExcludedFeatures": [
"import-defer",
"regexp-modifiers",
"regexp-unicode-property-escapes",
"regexp-v-flag",
"source-phase-imports",
Expand Down Expand Up @@ -52,6 +51,14 @@
"built-ins/RegExp/nullable-quantifier.js",
"built-ins/RegExp/lookahead-quantifier-match-groups.js",

// .NET regex engine: scoped regexp modifiers don't fully match ECMAScript boundary and multiline semantics
"built-ins/RegExp/regexp-modifiers/add-ignoreCase-affects-slash-lower-b.js",
"built-ins/RegExp/regexp-modifiers/add-ignoreCase-affects-slash-lower-w.js",
"built-ins/RegExp/regexp-modifiers/add-ignoreCase-affects-slash-upper-b.js",
"built-ins/RegExp/regexp-modifiers/add-ignoreCase-affects-slash-upper-w.js",
"built-ins/RegExp/regexp-modifiers/add-multiline.js",
"built-ins/RegExp/regexp-modifiers/remove-multiline-does-not-affect-dotAll-flag.js",

// .NET regex engine: complex quantifier capture group tracking differs
"built-ins/RegExp/S15.10.2.5_A1_T4.js",
"built-ins/RegExp/prototype/exec/S15.10.6.2_A1_T6.js",
Expand Down Expand Up @@ -288,4 +295,4 @@
// Per B.1.2, non-unicode RegExp should accept some malformed named group syntax
"annexB/built-ins/RegExp/named-groups/non-unicode-malformed.js"
]
}
}
17 changes: 17 additions & 0 deletions Jint.Tests/Runtime/RegExpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,23 @@ public void ShouldAllowProblematicGroupNames()
Assert.Equal("a-b-c", result);
}

[Fact]
public void ShouldSupportRegExpModifiersInLiteralsAndConstructor()
{
var engine = new Engine();

var prepared = Engine.PrepareScript("""
const literal = /(?m-i:^a$)/i;
`${literal.test('A\n')},${literal.test('a\n')}`;
""");

engine.Evaluate(prepared).AsString().Should().Be("false,true");
engine.Evaluate("""
const regex = new RegExp("(?m-i:^a$)", "i");
`${regex.test('A\n')},${regex.test('a\n')}`;
""").AsString().Should().Be("false,true");
}

[Fact]
public void Issue506()
{
Expand Down
1 change: 1 addition & 0 deletions Jint/Engine.Defaults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public partial class Engine
EcmaVersion = EcmaVersion.ES2023,
ExperimentalESFeatures = ExperimentalESFeatures.ImportAttributes
| ExperimentalESFeatures.RegExpDuplicateNamedCapturingGroups
| ExperimentalESFeatures.RegExpModifiers
| ExperimentalESFeatures.ExplicitResourceManagement
| ExperimentalESFeatures.Decorators,
Tolerant = false,
Expand Down