.. highlightlang:: us .. index:: exptok .. _exptok: exptok ====== .. us.tag exptok NOTREADYENGLISH ProgMisc Changed5511 :ref:`exptok` splits a simple arithmetic expression into tokens. .. function:: ssToks = exptok(ssExpression) .. us.return **Return Value** *ssToks* is a string of tokens. In case of an error *ssToks* is a number containing the position of the error in *ssExpression*.The tokens are separated by the character ``\2``. A token consists of a type and the token string. The type and the token string are separated by the character ``\1``. The following token types exist: .. list-table:: :header-rows: 1 * - Type Value - Meaning * - F$n - Value is a function call. n is the number of parameters. * - V - Variable name. * - O - Operator ``+ - \ * / ^``. * - S - String * - N - Number * - C - Parenthesis ``(`` or ``)`` or Comma ``,``. .. us.params **Parameters** .. uparam:: ssExpression *ssExpression* is an arithmetic expression. The following elements are allowed in the expression: Operators: ``+,-,*,/,^`` Parenthesis: ``(`` und ``)`` Function names, variable names, string contants enclosed in ``"``-characters, also Strings and numbers of the form 1, 1.2, 1.2e3, -1.2e-3 Functions can have an empty parameter list as in ``print()`` or a list of parameters separated by a comma (``,``). .. us.example **Example** .. highlight:: none :: toks = exptok("3 * sin(2.3) + abc / 1"); * toks N3O*F$1sinC(N2.3C)O+VabcO/N1 * toks = strtok(toks, "\1\2"); * toks' N 3 O * F$1 sin C ( N 2.3 C ) O + V abc O / N 1 .. highlight:: us .. seealso:: :ref:`overview-programming` :sub:`id-285600`