# A B …

Description:

Represent multi-row, multi-column cellset code as text.

Syntax:

#<TAB>A<TAB>B<TAB>…

  row number [<space>]<TAB>code

  …

  Note: <TAB> represents the actual TAB character; <space> represents an actual space; the bracket indicates optional.

Note:

The function represents multi-row, multi-column cellset code as text, with support for row numbers, column headers, escaping of special characters within cells, and line continuation for multi-line code.

Type:

Type

Description

Column header

A standalone # marks the code’s column headers, and columns are separated by tabs.

Row number

When column headers are present, each subsequent code line begins with a row number (1, 2, …), followed by a TAB and then the code content. Add a space between the row number and the TAB to mark the escaping.

Without column headers

When column headers are absent, each line begins directly with the code content. This type will be gradually phased out.

Column separation

Within each cellset row, code in adjacent cells is separated by tabs. Empty cells are represented by preserving the corresponding tab positions.

Escape marker

A space after the row number indicates that the code in a cell on that row may be escaped. It is parsed according to the escaping rules, and line continuation is not used for such rows.

No space after the row number indicates that the code on that row is not escaped. If the row contains only one cell of code, line continuation may be present.

Escape condition

Escaping is performed in the following two cases: when a row contains multiple code cells and any cell contains a carriage return or TAB; or when a row contains only one code cell and that cell’s code begins with a TAB. In all other cases, no escaping is performed.

Line continuation

For unescaped code, subsequent text lines without row numbers are treated as continuation lines. Before each continuation line, TAB characters are automatically added according to the column in which the code is located, so as to keep alignment.

Example:

Note: The following \n and \t are used only to demonstrate the escaping of line breaks and TABs; the exact notation depends on the actual implementation. <TAB> represents an actual TAB character, and <空格> represents an actual space character.

Ø  Ordinary single-cell code

Text script:

#<TAB>A<TAB>B

1<TAB>=10

No space after the row number, so the code isn’t escaped. Here’s the corresponding cellset code:

 

A

B

1

=10

 

Ø  Multiple cells in one row contain code, and those cells contain line breaks

Text script:

#<TAB>A<TAB>B

1<space><TAB>The first line\nThe second line<TAB>=20

A space after the row number means the row is parsed according to the escaping rules. The line break in cell A1 is saved in escaped form, and corresponds to the following cellset code:

 

A

B

1

The first line

The second line

=20

Ø  The single-cell code beginning with TAB

Text script:

#<TAB>A<TAB>B

1<space><TAB>\t code content

When a row contains only one cell of code and that code starts with the TAB, it is escaped. This corresponds to the following cellset code:

 

A

B

1

  code content

 

Ø  Single-cell, multi-line code

Text script:

#<TAB>A<TAB>B

1<TAB>The first line

<TAB><TAB> The second line

<TAB><TAB> The third line

  The next two lines have no row numbers, so they are treated as continuation lines of cell B1. This corresponds to the following cellset code: 

 

A

B

1

 

The first line

The second line

The third line