Author: Stan Eisenstat
Subject: Re: [Cs323] VARCHR
Date: Saturday, 26 Sep 2020, 17:10:43
> Message Posted By: Unknown
>
> Are the characters in VARCHR defined in parsely.h the only characters that
> may appear in variable names? ...
Yes.
=====
> ... And if so, could you explain these outputs?
>
> (1)$ a#b
> CMD (Depth = 0): SIMPLE, argv[0] = a#b
>
> (2)$ a*b
> CMD (Depth = 0): SIMPLE, argv[0] = a*b
>
> (3)$ a\\b
> CMD (Depth = 0): SIMPLE, argv[0] = a\b
>
> (4)$ a#b\
> CMD (Depth = 0): SIMPLE, argv[0] = a#b\
An argument is not a variable name.
=====
> Do "#" only start comments when there is a space before it? ...
No. As stated in the specification
[Comments] If a # would begin a TEXT token, it and the remainder of the
line (including any trailing \'s) are ignored; otherwise it is just another
character.
A text token need not be preceded by a space.
=====
> ... When do we
> treat \ as a character as opposed to the start of an escape character?
As stated in the specification,
[Escape Characters] The escape character \ removes any special meaning that
is associated with the non-null, non-newline character immediately following.
--Stan-
PREV
INDEX
NEXT