[ ECLiPSe Prolog Environment built-in.|Group Index| Full Index]

set_chtab(+Char, +Class)

Sets the lexical class of character Char to class Class, this provides an interface to ECLiPSe 's lexical analyser.

+Char
Integer in range 0 to 255.
+Class
Atom indicating the character class.

Description

Changes the lexical class of a given character. This is especially useful for implementing compatibility packages. The possible character classes which a character may have been given are shown below.

Note It is not recommended to change the class of the special characters, since in some cases it might make it impossible to correctly parse Prolog terms.

The following table lists the character classes and the default corresponding characters:

 Class          Default member characters
---------------------------------------------------------
 upper-case     all upper case letters
 underline      -
 lower-case     all lower case letters
 digit          digits
 blank-space    space and nonprintable ASCII characters
 end-ofline     carriage return and line feed
 atom-quote     '
 string-quote   "
 list-quote
 radix
 ascii
 solo           ( ) ] }
 special        ! , ; [ { |
 line-comment   %
 escape         \
 first-comment  /
 second-comment *
 symbol         # + - . : < = > ? @ ^ ` ~ & $
 unused         ASCII codes 8, 17, 21, 24
 null           null character

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) Instantiation fault
Char and/or Class are not instantiated. Error 5 --- Char is not an integer in the range 0 to 255.
(6) Range error
Class is not a valid lexical class.

Examples


Success:
   % The following example illustrates the use
   % of set_chtab/2 to redefine the class of the
   % dollar symbol.
   %
   [eclipse]: X = $a.
                 ^ (here?)
   syntax error: postfix/infix operator expected
   [eclipse]: set_chtab(0'$, lower_case).

   yes.
   [eclipse]: X = $a.

   X = $a
   yes.
   [eclipse]:

Error:
   set_chtab("a",symbol).       (Error 5)
   set_chtab(97,fred).          (Error 6)



See Also

get_chtab / 2, read_token / 2, read_token / 3