[ Syntax Settings | Reference Manual | Alphabetic Index ]

get_chtab(+Char, -Class)

Succeeds if the lexical class of character Char is Class.
Char
Integer in the range 0 to 255.
Class
Atom giving class name or variable.

Description

Retrieves or checks the lexical class of a given character.

Class is unified with the current lexical character class of Char.

Char must be an integer character code, which would typically be written in character-quote syntax, eg 0'a instead of 98.

The following table lists the existing character classes and the default set of characters in that class:

 Class          Default member characters
---------------------------------------------------------
 upper_case     all upper case letters
 underline      _
 lower_case     all lower case letters
 digit          digits
 blank_space    space, tab and nonprintable characters
 end_of_line    newline (NL)
 atom_quote     '
 string_quote   "
 list_quote	`
 chars_quote
 radix
 ascii
 solo           ! ;
 special        ( [ { ) ] } , |
 line_comment   %
 escape         \
 first_comment  /
 second_comment *
 symbol         # + - . : < = > ? @ ^ ~ & $
 terminator

The table corresponds to the default eclipse_language settings. Using other language dialects typically changes some of the assignments on a module-local basis (e.g. for the iso dialect, the meaning of single and double quotes is reversed).

Note: the default class of the back-quote character ` was changed from symbol to list_quote in ECLiPSe 7.0.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions

(4) instantiation fault
Char in not instantiated.
(5) type error
Char is not an ASCII code.
(6) out of range
Char is not in the range 0 to 255.

Examples

Success:
   [eclipse]: get_chtab(0'a,X).

   X = lower_case
   yes.
   [eclipse]: get_chtab(60,X).

   X = symbol
   yes.
   [eclipse]:

Fail:
   get_chtab(98,symbol).
   get_chtab(98,blah).

Error
   get_chtab(X,lower_case).     (Error 4).
   get_chtab("a",X).            (Error 5).
   get_chtab(-1,X).             (Error 6).



See Also

set_chtab / 2, read_token / 2, read_token / 3