home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / intro / backslash < prev    next >
Encoding:
Text File  |  1992-12-17  |  3.6 KB  |  89 lines

  1.      BACKSLASH SUBSTITUTION
  2.           Backslashes may be used to  insert  non-printing  characters
  3.           into  command  fields  and also to insert special characters
  4.           like braces and brackets  into  fields  without  them  being
  5.           interpreted  specially  as  described  above.  The backslash
  6.           sequences understood  by  the  Tcl  interpreter  are  listed
  7.           below.   In each case, the backslash sequence is replaced by
  8.           the given character:
  9.  
  10.           \b                  Backspace (0x8).
  11.  
  12.           \f                  Form feed (0xc).
  13.  
  14.           \n                  Newline (0xa).
  15.  
  16.           \r                  Carriage-return (0xd).
  17.  
  18.           \t                  Tab (0x9).
  19.  
  20.           \v                  Vertical tab (0xb).
  21.  
  22.           \{                  Left brace (``{'').
  23.  
  24.           \}                  Right brace (``}'').
  25.  
  26.           \[                  Open bracket (``['').
  27.  
  28.           \]                  Close bracket (``]'').
  29.  
  30.           \$                  Dollar sign (``$'').
  31.  
  32.           \<space>            Space   (``   ''):   doesn't   terminate
  33.                               argument.
  34.  
  35.           \;                  Semi-colon: doesn't terminate command.
  36.  
  37.           \"                  Double-quote.
  38.  
  39.           \<newline>          Nothing:  this joins two lines  together
  40.                               into  a  single  line.   This  backslash
  41.                               feature is unique in  that  it  will  be
  42.                               applied  even  when  the sequence occurs
  43.                               within braces.
  44.  
  45.           \\                  Backslash (``\'').
  46.  
  47.           \ddd                The digits ddd (one, two,  or  three  of
  48.                               them)   give  the  octal  value  of  the
  49.                               character.  Null characters may  not  be
  50.                               embedded  in  command  fields; if ddd is
  51.                               zero  then  the  backslash  sequence  is
  52.                               ignored   (i.e.  it  maps  to  an  empty
  53.                               string).
  54.  
  55.           For example, in the command
  56.  
  57.                set a \{x\[\ yz\141
  58.  
  59.           the second argument to set will be ``{x[ yza''.
  60.  
  61.           If a backslash is followed by something other  than  one  of
  62.           the   options   described   above,  then  the  backslash  is
  63.           transmitted  to  the  argument  field  without  any  special
  64.           processing,  and the Tcl scanner continues normal processing
  65.           with the next character.  For example, in the command
  66.  
  67.                set \*a \\\{foo
  68.           The first argument  to  set  will  be  \*a  and  the  second
  69.           argument will be \{foo.
  70.  
  71.           If  an  argument  is  enclosed  in  braces,  then  backslash
  72.           sequences inside the argument are parsed but no substitution
  73.           occurs  (except  for  backslash-newline):    the   backslash
  74.           sequence  is  passed  through to the argument as is, without
  75.           making any special interpretation of the characters  in  the
  76.           backslash  sequence.   In particular, backslashed braces are
  77.           not counted  in  locating  the  matching  right  brace  that
  78.           terminates the argument.  For example, in the command
  79.  
  80.                set a {\{abc}
  81.  
  82.           the second argument to set will be \{abc.
  83.  
  84.           This backslash  mechanism  is  not  sufficient  to  generate
  85.           absolutely  any  argument structure; it only covers the most
  86.           common cases.  To produce particularly complicated arguments
  87.           it  is probably easiest to use the format command along with
  88.           command substitution.
  89.