When ANA reads input from a file, then it can read ahead as much as it
wants to until it can figure out the meaning of something on the line.
Therefore, ANA ignores line breaks (where you start a new line) unless
the line break changes the value or meaning to ANA of something on the
command line. Also, newlines are important to the IGNORE and
RESUME commands (Ignoring Input). Newlines are not allowed
in the middle of a name, such as those of variables (Variables),
functions (Function Definition, subroutines (Subroutine Definition, and argument keywords (Argument Specification); in
the middle of a literal text string (between quotes (' or
"); Strings) or a number (Scalars); or in the middle
of a reserved keyword such as IF or REPEAT (Reserved Keywords). In all other places in ANA files, newlines are allowed.
So, in an ANA file, it is OK to have T,SIN ( 5.3 on one line and
) on the next line to form a complete command.
When ANA reads input from the keyboard, then it assumes for the most
part that the user intended to finish one or more complete statements
when the user pressed the RET key. Only in certain cases where a
statement always includes more statements does ANA conclude that the
user wants to give more input on following lines. These cases are:
after the start of a SUBR, FUNC, BLOCK,
BEGIN, {, IF, CASE, NCASE,
FOR, REPEAT, DO, or WHILE statement and the
corresponding end of the statement (Statements). For these
purposes, the start of the statement consists of the keyword listed
before, plus the name of the subroutine, function, or blockroutine (for
SUBR, FUNC, or BLOCK, or the condition (for
IF). The "corresponding end" of the statement consists of the
very end of the statement, or of the keywords UNTIL or
WHILE (for REPEAT and DO).
At the keyboard, the IF statement presents special problems,
because it may or may not contain an ELSE clause. If you specify
an IF statement at the keyboard without an ELSE on the
same line as the end of the THEN clause, then ANA assumes the
statement has no ELSE clause.
You can explicitly indicate that a newline should be ignored by typing a
continuation character (a minus sign, -) as the very last
character on the line. If a minus sign is found as the last character
on a command line (including inside a comment), then the minus sign is
removed, and the contents of the next line are appended to the previous
one before the whole thing is sent to the parser. Such continuation
characters are not required in files, but are useful when copying and
pasting lines from a file to the command line.
Below are some examples of ANA statements that generate errors when entered from the keyboard. It is assumed that the RET key is pressed at the end of each line.
T,SIN(2.34 ) T,'alphabetical stuff' FUNC MYFUN(x) RETURN,x+2 ENDFUNC IF x LT 3 THEN T,'OK' ELSE T,'Not OK'
In the first example, it is an error not to specify a closing
parenthesis on the same line as the opening one. In the second example,
a closing quote was expected on the same line as the opening quote. In
the third example, a function name should follow FUNC on the same
line. In the last example, the ELSE should be on the same line
as the end of the THEN clause: now ANA will execute the IF
statement without the ELSE clause and then complain about the
unexpected ELSE at the start of the next line. Except for the
string example, which modifies the value of the string, all of these
examples would not cause problems if they were read from a file.