Reader Syntax Entry: String Literal

← Prev | ↑ Chapter | Next → | Index | Symbols

Reader Syntax Entry: String Literal

Name

String Literal

Class

Reader Syntax

Concrete Syntax

string ::= "\"" string-char* "\""

Constituents

  • opening double quote
  • zero or more string characters
  • closing double quote

Description

A string literal denotes a string object.

Acceptance Rules

  • a string is delimited by double quotes
  • backslash introduces escape/control sequences
  • a line break written literally between the double quotes is part of the string (tested, see Tested Behaviour): the literal may span several lines of the source, and any indentation on the following lines is part of its value

Strict/Lax Policy

  • strict: accept only documented or tested escapes
  • lax: accept additional escapes only when they do not conflict with documented behavior and compatibility requires them

Examples

  • "abc"
  • "A string with spaces"

Compatibility

  • string interpretation changed materially with Autodesk Unicode/LISPSYS changes beginning in 2021
  • BricsCAD also documents Unicode-aware file text handling

Notes

The complete escape repertoire remains under-specified in the current source corpus.

Tested Behaviour

Probe probes/sources/probe-multiline-string.lsp (fixtures probes/sources/fixtures/mls-*.lsp, byte-exact), run 2026-10-27 on AutoCAD 2022 (Windows), BricsCAD V25 (Windows) and BricsCAD V26 (macOS). Code lists are the characters of the string "ab<break>cd".

line break in the literal AutoCAD 2022 BricsCAD V25 / V26
LOAD, LF (LF file) 10 10
LOAD, CR LF (CR LF file) 10 10
LOAD, LF LF + 3 spaces 10 10 32 32 32 10 10 32 32 32
LOAD, lone CR 13 10
LOAD, CR CR (CR LF file) 13 13 10 10
READ, LF 10 10
READ, CR LF 10 10
READ, lone CR 13 13

In every case the form following the string in the file was read as well: the reader resynchronises after a multi-line literal.

  • A line break inside a string literal is accepted by both products, and CR LF is read as a single LF (code 10): common behaviour.
  • READ keeps a lone CR (code 13): common behaviour.
  • LOAD of a source file holding a lone CR inside a string literal: AutoCAD keeps it, BricsCAD reads it as LF. No vendor document covers it, and this specification adopts neither: an unresolved divergence (chapter 25, case 3). Portable code writes \r or \n instead.
  • Not tested: a line break typed inside a string at the CAD command line.

clautolisp

clautolisp implementation deviation – not part of the normative specification above.

clautolisp reads a line break inside a string literal as both products do, keeps a lone CR under READ in every dialect, silently, and handles a lone CR met by LOAD per dialect (case 3: every dialect but lax warns [lone-cr-in-string], with the file and line):

dialect LOAD of a lone CR in a string warning
autocad kept (13) yes
bricscad read as LF (10) yes
clautolisp kept (13) yes
strict kept (13) yes
lax kept (13) no

clautolisp and strict keep the CR because that is what READ does in every engine and it loses nothing.

Availability

  • AutoCAD 2026: documented (per Autodesk reference page).
  • BricsCAD V26: presumed compatible (no contradicting page found).
  • Status: AutoCAD documented; BricsCAD presumed-both pending Phase 4 verification.