E01093: a backtick String is never closed - it runs to the end of the file

Category: E01xxx Parsing and excluded constructs · Reported in phase: PARSING · Classification: UNCLOSED_BACKTICK_STRING · All error codes

What went wrong

A backtick String was opened and never closed: `${count} items" A double quote cannot end a backtick String, so the String runs on to the end of the file - and the parser gives up at the LAST line, far from the mistake. This error points at the backtick that opened it.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 43 (How do I escape characters in EK9 string interpolation?)
  • ek9 -q 909 (How does $ work inside backtick strings in EK9?)

How to fix it

Close a String with the delimiter that opened it:

  • `${count} items" --> `${count} items`
  • "${count} items` --> `${count} items` (interpolation needs backticks)

A backtick meant as text inside a backtick String is written \`

Common causes

  • Mixing the two delimiters: EK9 has "plain" and `interpolated` Strings
  • Adding ${...} to a double-quoted String and changing only one quote
  • A backtick meant as text inside a backtick String, not escaped as \`

See also

Examples

Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.

Fails with E01093: a backtick String is never closed - it runs to the end of the file

#!ek9
defines module error.e01093.bad

  defines function

    describe()
      -> count as Integer
      <- rtn as String: `${count} items"

Fixed: Close a backtick String with a backtick

#!ek9
defines module error.e01093.good

  defines function

    describe()
      -> count as Integer
      <- rtn as String: `${count} items`