end

The end command ends the script: James reads nothing after it.

Syntax

end

end takes no arguments.

What it does

James stops reading the script at end, as if the file ended there. An open part is closed first, as if by endpart, with a warning. Everything defined before end still takes effect, and a write before end still writes its file.

When James applies it

When it is read. It is legal in any phase: Control, Part or Merge.

Rules James adds

  • Nothing after end runs, including an include of a file that does not exist and a command James would reject.
  • A part still open at end is closed with a warning, not an error. A script that opens a block and then says end gets warning [E0416]: part 1 was still open at end; closed as if by endpart, and James exits 0.

Diagnostics

  • E0416: a warning: a part was still open when end was reached, and James closed it.

Example

The script tests/corpus/116-end-terminates-session/input.tg, which make test runs:

para x 1;
end
block 1 2;1 2;1 2;0 1;0 1;0 1;
endpart

James reads para x 1; and stops at end. The IR holds no part, although a block follows: the prep dump ends with end, and the block and endpart after it never reach the parser.

See also

  • endpart: the command that closes a part on purpose.
  • Parts: the phases of a script.

James 0.3.1.

This site uses Just the Docs, a documentation theme for Jekyll.