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
endruns, including anincludeof a file that does not exist and a command James would reject. - A part still open at
endis closed with a warning, not an error. A script that opens ablockand then saysendgetswarning [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
endwas 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.