Skip to content

Commit

Permalink
Support for hex literals.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimY4 committed Jan 11, 2025
1 parent 38fefee commit 967372d
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 27 deletions.
14 changes: 7 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ lazy val core = (project in file("core"))
name := "core",
moduleName := "coregex-core",
description := "A handy utility for generating strings that match given regular expression criteria.",
headerEndYear := Some(2024),
headerEndYear := Some(2025),
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "1.0.3" % Test,
"org.scalameta" %% "munit-scalacheck" % "1.0.0" % Test
Expand All @@ -81,7 +81,7 @@ lazy val functionaljavaQuickcheck = (project in file("functionaljava-quickcheck"
name := "functionaljava-quickcheck",
moduleName := "coregex-functionaljava-quickcheck",
description := "Functionaljava quickcheck bindings for coregex library.",
headerEndYear := Some(2024),
headerEndYear := Some(2025),
libraryDependencies ++= Seq(
"org.functionaljava" % "functionaljava-quickcheck" % "5.0" % Provided,
"junit" % "junit" % "4.13.2" % Test,
Expand All @@ -98,7 +98,7 @@ lazy val jqwik = (project in file("jqwik"))
name := "jqwik",
moduleName := "coregex-jqwik",
description := "JQwik bindings for coregex library.",
headerEndYear := Some(2024),
headerEndYear := Some(2025),
libraryDependencies ++= Seq(
"net.jqwik" % "jqwik-api" % "1.9.2" % Provided,
"net.jqwik" % "jqwik-engine" % "1.9.2" % Test,
Expand All @@ -117,7 +117,7 @@ lazy val junitQuickcheck = (project in file("junit-quickcheck"))
name := "junit-quickcheck",
moduleName := "coregex-junit-quickcheck",
description := "JUnit Quickcheck bindings for coregex library.",
headerEndYear := Some(2024),
headerEndYear := Some(2025),
libraryDependencies ++= Seq(
"com.pholser" % "junit-quickcheck-core" % "1.0" % Provided,
"com.pholser" % "junit-quickcheck-generators" % "1.0" % Test,
Expand All @@ -136,7 +136,7 @@ lazy val kotest = (project in file("kotest"))
name := "kotest",
moduleName := "coregex-kotest",
description := "Kotest bindings for coregex library.",
headerEndYear := Some(2024),
headerEndYear := Some(2025),
libraryDependencies ++= Seq(
"io.kotest" % "kotest-property-jvm" % "5.9.1" % Provided,
"com.github.sbt.junit" % "jupiter-interface" % JupiterKeys.jupiterVersion.value % Test
Expand All @@ -152,7 +152,7 @@ lazy val scalacheck = (project in file("scalacheck"))
name := "scalacheck",
moduleName := "coregex-scalacheck",
description := "ScalaCheck bindings for coregex library.",
headerEndYear := Some(2024),
headerEndYear := Some(2025),
libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % "1.18.1" % Provided
),
Expand All @@ -167,7 +167,7 @@ lazy val vavrTest = (project in file("vavr-test"))
name := "vavr-test",
moduleName := "coregex-vavr-test",
description := "VAVR Test bindings for coregex library.",
headerEndYear := Some(2024),
headerEndYear := Some(2025),
libraryDependencies ++= Seq(
"io.vavr" % "vavr-test" % "0.10.5" % Provided,
"com.github.sbt.junit" % "jupiter-interface" % JupiterKeys.jupiterVersion.value % Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ String span(IntPredicate charPredicate) {
private char token() {
char[] chars;
char ch;
int cursor = this.cursor;
int start, cursor = this.cursor;
loop:
do {
ch = cursor < regex.length() ? regex.charAt(cursor) : EOF;
Expand Down Expand Up @@ -688,8 +688,17 @@ private char token() {
break;
case '\\':
switch (cursor + 1 < regex.length() ? regex.charAt(cursor + 1) : EOF) {
case '0':
start = cursor += 2;
while ('0' <= (ch = regex.charAt(cursor)) && ch <= '7') {
cursor++;
}
chars = Character.toChars(Integer.parseInt(regex.substring(start, cursor), 8));
System.arraycopy(chars, 0, tokens, tokensCursor, chars.length);
ch = chars[0];
break loop;
case 'N':
int start = cursor += 3;
start = cursor += 3;
while ('}' != regex.charAt(cursor)) {
cursor++;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1041,9 +1041,9 @@ class CoregexParserSuite extends ScalaCheckSuite with CoregexArbitraries {
.intersect(set()(_.set('a', 'e', 'i', 'o', 'u')).set())
.intersect(set()(_.set('e', 'i')).set())
)
) -> Pattern.compile("[a-z&&[^aeiou]]+[]][a-z&&aeiou&&ei]"),
) -> Pattern.compile("[a-z&&[^aeiou]]+[]][a-z&&aeiou&&ei]"),
("": Coregex.Literal) -> Pattern.compile("\\N{WHITE SMILING FACE}"),
empty() -> Pattern.compile("^(?:||)$")
empty() -> Pattern.compile("^(?:||)$")
)
rng <- List(new RandomRNG())
} {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 Alex Simkin
* Copyright 2021-2025 Alex Simkin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 967372d

Please sign in to comment.