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 src/main/java/org/perlonjava/core/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ public final class Configuration {
* Automatically populated by Gradle/Maven during build.
* DO NOT EDIT MANUALLY - this value is replaced at build time.
*/
public static final String gitCommitId = "3611e23bd";
public static final String gitCommitId = "4623fa856";

/**
* Git commit date of the build (ISO format: YYYY-MM-DD).
* Automatically populated by Gradle/Maven during build.
* DO NOT EDIT MANUALLY - this value is replaced at build time.
*/
public static final String gitCommitDate = "2026-04-23";
public static final String gitCommitDate = "2026-04-24";

/**
* Build timestamp in Perl 5 "Compiled at" format (e.g., "Apr 7 2026 11:20:00").
* Automatically populated by Gradle during build.
* Parsed by App::perlbrew and other tools via: perl -V | grep "Compiled at"
* DO NOT EDIT MANUALLY - this value is replaced at build time.
*/
public static final String buildTimestamp = "Apr 24 2026 12:28:51";
public static final String buildTimestamp = "Apr 24 2026 13:01:40";

// Prevent instantiation
private Configuration() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ public class StringDoubleQuoted extends StringSegmentParser {
*/
private final Stack<CaseModifier> caseModifiers = new Stack<>();

/**
* Flag indicating whether we're inside a \Q...\E quotemeta region.
*
* <p>When true, all special characters (including $ and @) are treated as literals,
* and escape sequences are not processed (except \E to end the region).
*/
private boolean inQuotemeta = false;

/**
* Private constructor for StringDoubleQuoted parser.
*
Expand Down Expand Up @@ -357,37 +349,20 @@ private Node createJoinNode(List<Node> nodes) {
/**
* Parses escape sequences based on context.
*
* <p>This method delegates to different escape handling based on the
* parseEscapes flag and quotemeta mode:
* <p>Delegates to different escape handling based on the parseEscapes flag:
* <ul>
* <li>inQuotemeta=true: Only \E is special, everything else is literal</li>
* <li>parseEscapes=true: Process escapes like \n to actual newline</li>
* <li>parseEscapes=false: Preserve escapes for regex engine</li>
* </ul>
*
* <p>Note: \Q...\E quotemeta regions are handled via the case-modifier stack
* (pushing a "Q" modifier in the \Q handler and applying it in \E), so no
* special in-string state is needed. Inside \Q, escape sequences and variable
* interpolation continue to work normally; the accumulated content is wrapped
* in quotemeta() at the point where \E is encountered.
*/
@Override
protected void parseEscapeSequence() {
if (inQuotemeta) {
// In quotemeta mode, everything is literal except \E
var token = tokens.get(parser.tokenIndex);
if (token.text.startsWith("E")) {
// End quotemeta mode
TokenUtils.consumeChar(parser);
flushCurrentSegment();
if (!caseModifiers.isEmpty() && caseModifiers.peek().type.equals("Q")) {
applyCaseModifier(caseModifiers.pop());
}
inQuotemeta = false;
} else if (token.text.startsWith("Q")) {
// In quotemeta mode, \Q is idempotent and should be ignored.
TokenUtils.consumeChar(parser);
} else {
// Everything else is literal, including the backslash
currentSegment.append("\\");
}
return;
}

if (parseEscapes) {
parseDoubleQuotedEscapes();
} else {
Expand Down Expand Up @@ -423,7 +398,6 @@ private void parseDoubleQuotedEscapesRegex() {
// Quotemeta modifier
case "Q" -> {
flushCurrentSegment();
inQuotemeta = true;
caseModifiers.push(new CaseModifier("Q", false));
}

Expand Down Expand Up @@ -525,7 +499,6 @@ private void parseDoubleQuotedEscapes() {
// Quotemeta modifier
case "Q" -> {
flushCurrentSegment();
inQuotemeta = true;
caseModifiers.push(new CaseModifier("Q", false));
}

Expand Down
Loading