Class UnclosedBacktickString

java.lang.Object
org.ek9lang.compiler.repair.UnclosedBacktickString

public final class UnclosedBacktickString extends Object
THE E01093 repair - a backtick String closed with a double quote, `${count} items" - for every editing tool. Use this; do not re-derive the rule.

A backtick String does not end at a ", so it runs to the end of the file and never compiles: the compiler reports E01093 at the backtick that opened it. When the rest of that line holds exactly one " and no second backtick, that quote is the only close the writer can have meant - the opening delimiter says which kind of String it is (and with ${ in it, the double-quoted reading is E07901 anyway) - so it becomes a backtick. Anything less certain is skipped and the refusal stands.

Measured: qwen3-coder T10 sent it in 33 of 118 runs of the harness record (37 would-fail), about a round each, and once beside Type?: value - where the ?: repair was then thrown away because nothing could repair the String.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    The rewritten text and one note per rewrite; notes empty means nothing moved.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static String
    closedAt(String source, int column)
    source with the one " after the backtick at column made a backtick, or null when there is no backtick there, no single " after it, or a second backtick.
    static String
    The same repair for ONE statement entry, before the compile: the line whose backtick String is still open at its end, closed with a " - taken only when the entry does not parse as written and parses once closed, because a backtick String may legitimately span lines.
    (package private) static TextRule.Rewrite
    The text rule for a WHOLE source, whatever the parser said: the first line, at or before the failure, whose backtick String is still open at its end and holds exactly one " after the backtick - closed there.
    static boolean
    True when text holds an ODD number of unescaped backticks - a String left open - the cheap gate before a probe compile (most files hold backticks; a closed file holds them in pairs).
    static String
    noteFor(int line, String source, String closed)
    The note for a line closed as closed.
    repair(String text, List<Map<String,Object>> diagnostics)
    Close every String an E01093 diagnostic opens: the code must be E01093, its column the backtick, and the rest of that line must hold exactly one " and no backtick.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • mayApply

      public static boolean mayApply(String text)
      True when text holds an ODD number of unescaped backticks - a String left open - the cheap gate before a probe compile (most files hold backticks; a closed file holds them in pairs).
    • repair

      public static UnclosedBacktickString.Result repair(String text, List<Map<String,Object>> diagnostics)
      Close every String an E01093 diagnostic opens: the code must be E01093, its column the backtick, and the rest of that line must hold exactly one " and no backtick. Rewrites within one line, so the receipts can follow (SourceRepairs).
    • closedInEntry

      public static String closedInEntry(String entry)
      The same repair for ONE statement entry, before the compile: the line whose backtick String is still open at its end, closed with a " - taken only when the entry does not parse as written and parses once closed, because a backtick String may legitimately span lines. Null when there is nothing to take.
    • closedOnALine

      static TextRule.Rewrite closedOnALine(List<String> lines, SyntaxProbe.SyntaxError failure)
      The text rule for a WHOLE source, whatever the parser said: the first line, at or before the failure, whose backtick String is still open at its end and holds exactly one " after the backtick - closed there. Without E01093 the parser reports the String's END (the next backtick in the file, often far below) as a token error; the engine keeps the rewrite only when the parse then gets further, which is what makes a backtick String that legitimately spans lines safe here.
    • noteFor

      public static String noteFor(int line, String source, String closed)
      The note for a line closed as closed.
    • closedAt

      static String closedAt(String source, int column)
      source with the one " after the backtick at column made a backtick, or null when there is no backtick there, no single " after it, or a second backtick.