%indent, %pushindent and %popindent statements (SDL script)
This topic applies to TDK SDL script extensions. For more information, see
Overview of SDL script extensions for TDK (SDL script).
SDL Script Extensions for TDK:
$ The following generates:
$ class <classname> {
$ int A;
$ };
%indent 0
"class " %c:Name " {\n"
%indent 1
"int A;\n"
%indent 0
"};\n"
$ Exactly as above with push and pop indent
%indent 0
"class " %c:Name " {\n"
%pushindent 1
"int A;\n"
%popindent
"};\n"
$ %indent sets an absolute indent, %pushindent a relative indent:
%indent 0
"class " %c:Name " {\n" $ this line is not indented
%pushindent 1
"private:\n" $ This line gets indented 1 unit
%pushindent 1
"int A;\n" $ This line gets indented 2 units
%popindent $ This restore the indent stack to zero
%popindent
"};\n"
%ind is a synonym of %indent, %pushind of %pushindent, %popind of %popindent.
%indent <n> does not push anything onto the indent stack (pushindent does).
%pushindent <n> actually saves the current indent level onto the indent stack, then sums N to the current indent level. N can be negative.
%popindent restores the current indent level by popping the indent stack.
The global variable sysIndentLevel reflects the current indent level.
sysIndentLevel = N is equivalent to %indent N