CxContract

Description

abstract class Tinman.Core.Cx.Contract.CxContract

Derived from

CxNode abstract

Extended by

CxContractCompare sealed
CxContractInterval sealed
CxContractSimple sealed

Abstract base for classes that represent a value contract in form of a pre- or post-condition of a type member, specified in both user-readable and machine-readable form, embedded in the documentation:

/// <param name="a">[...] </param>

/// <returns>[...] </returns>

/// <value>[...] </value>

The syntax of a Code-X value contract is defined by the following Grammar:

root                  := contract ;

!contract             := '[' (contract-simple | contract-compare | contract-interval)
                         ']' ;

contract-compare      := contract-compare-op contract-expr ;
contract-interval     := contract-expr '..' contract-expr ;
contract-simple       := 'not-empty' | 'not-null' | 'pow2+1' | 'pow2' ;

contract-compare-op   := '>=' | '>' | '&lt;=' | '&lt;' ;
contract-expr         := contract-expr-primary !> '-' contract-expr-primary ;

contract-expr-primary := contract-expr-literal | contract-expr-name ;

contract-expr-literal := '-'? dec-digit+ ;
contract-expr-name    := 'global::'? (id .. '.') ;

The following external rules are used:

To obtain a CxContract from source code, use the FromSource method.

Public / Constructors

From​Source


public static method FromSource → (1)

source in : string

[not-null]
The value contract text.

returns → CxContract

The parsed Code-X value contract.

Parses the given Code-X value contract.

ValidatingException

If the syntax of source in is invalid.