PARSE

Contents


parse allows you to analyze an expression contained in a character string syntactically.

 

Syntax

   parse(string [, tok_exp])

 

Parameters

Element

Description

Restrictions

string

Character string that contains the expression to be analyzed

None

tok_exp

Reserved

None

 

Examples

   # In a screen, control process of a field in which you
   # enter a group of selection criteria that affects the
   # fields of a file.
    If parse(zc, 0)                    
       [V]CRITERE([S]indice) = '1=1'   :# '1=1':  true logical expression
    Else [V]CRITERE([S]indice) = zc
    Endif
   #
   # In the process that creates the entry of the previous screen, opening
   # of the file with the selection criteria entered.
    Global Char CRITERE(50) (3)
    Local Shortint I
    File EMPLOYE [EMP]
    &    Where evalue(sigma(I = 0, dim([V]CRITERE)-1, [V]CRITERE(I)-
    &    "and"-" ")-"1")               :#'1'=true logical expression
   # Syntactical verification of the CHA character string. 
   # In the 1st Parse, date$ is recognized as a keyword; the syntax
   # is therefore valid. In the 2nd Parse, it is recognized as an
   # identifier and the expression is invalid due to the dollar signs ($).
    CHA = "date$"
    Infbox parse(CHA, 0)     :# The result is equal to zero (0).
    CHA = "date$$$$$$"
    Infbox parse(CHA, 0)     :# The result is not equal to zero (0).

 

Description and Comments

parse allows you to perform the syntactical analysis of any expression contained in a character string.

parse returns zero (0) when the expression analyzed is syntactically correct - or, otherwise, a non-null value that corresponds to the error number recognized by Adonix.

The default value of the tok_exp parameter is zero.

The result is of the Integer type.

 

Associated Errors

Error

Description

ERMODE (10)

The string parameter is not of the Char type. The tok_exp parameter is not numeric.

 

Associated Keywords

evalue


CONTENTS


Copyright © Sage 1999 - 2007