Whitespace

Whitespace

Whitespace consists of all spaces, tabs, and newlines. It is used to separate tokens and to make a program more readable. As long as the tokens are distinguishable, adding or subtracting whitespace has no effect on the meaning of a program. For example, the following lines of code both have the same meaning:

 set x,2
 set   x,   2

Generally, whitespace is ignored outside of string constants and constant numeric expressions. However, unlike in C, NBC statements may not span multiple lines. Aside from pre-processor macros invocations, each statement in an NBC program must begin and end on the same line.

 add x, x, 2 // okay
 add x,      // error
     x, 2    // error
 
 set x, (2*2)+43-12 // okay
 set x, 2 * 2 // error (constant expression contains whitespace)

The exception to this rule is if you end a line with the '\' character which makes the NBC parser continue the current statement on the next line just like with preprocessor macros.

 add x, \
     x, 2 // okay

Generated by  doxygen 1.6.2