コード例 #1
0
        public void TestGenerateModel1()
        {
            string    model01 = string.Empty;
            string    model02 = "par int : size;\n";
            string    model03 = "par int : size;\npar array [ par 1 .. size , par 1 .. size ] of par int : d;\n";
            ZincModel zm      = new ZincModel();

            Assert.AreEqual(model01, zm.WriteString());
            ZincIdent size = new ZincIdent("size");

            zm.AddItem(new ZincVarDeclItem(new ZincTypeInstExprAndIdent(new ZincTypeInstBaseExpression(new ZincScalarType(ZincScalar.Int)), size)));
            Assert.AreEqual(model02, zm.WriteString());
            ZincTypeInstBaseExpression range = new ZincTypeInstBaseExpression(new ZincTypeInstRangeExpression(new ZincIntLiteral(1), size));
            ZincIdent d = new ZincIdent("d");

            zm.AddItem(new ZincVarDeclItem(new ZincTypeInstExprAndIdent(new ZincTypeInstBaseExpression(new ZincTypeInstArrayExpression(new ZincTypeInstBaseExpression(new ZincScalarType(ZincScalar.Int)), range, range)), d)));
            Assert.AreEqual(model03, zm.WriteString());
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZincIdTieBoxBase"/> class with given initial
 /// <see cref="IZincIdent"/> and <see cref="IZincTypeInstExpression"/> instances.
 /// </summary>
 /// <param name='ident'>
 /// The initial <see cref="IZincIdent"/> instance to store.
 /// </param>
 /// <param name='tie'>
 /// The initial <see cref="IZincTypeInstExpression"/> instance to store.
 /// </param>
 protected ZincIdTieBoxBase(ZincIdent ident, IZincTypeInstExpression tie) : base(ident)
 {
     this.TypeInstExpression = tie;
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZincIdTieBoxBase"/> class with a given initial
 /// <see cref="IZincIdent"/> instance.
 /// </summary>
 /// <param name='ident'>
 /// The initial <see cref="IZincIdent"/> instance to store.
 /// </param>
 protected ZincIdTieBoxBase(ZincIdent ident) : base(ident)
 {
 }
コード例 #4
0
		/// <summary>
		/// Initializes a new instance of the <see cref="ZincAsExIdTieTiasBoxBase"/> class
		/// with a given initial <see cref="IZincAnnotations"/>, <see cref="IZincExp"/>, <see cref="IZincIdent"/>,
		/// <see cref="IZincTypeInstExpression"/> and <see cref="IZincTypeInstExprAndIdent"/> instances.
		/// </summary>
		/// <param name='anns'>
		/// The given initial <see cref="IZincAnnotations"/> instance.
		/// </param>
		/// <param name='expr'>
		/// The given initial <see cref="IZincExp"/> instance.
		/// </param>
		/// <param name='id'>
		/// The given initial <see cref="IZincIdent"/> instance.
		/// </param>
		/// <param name='tie'>
		/// The given initial <see cref="IZincTypeInstExpression"/> instance.
		/// </param>
		/// <param name='tias'>
		/// The given initial <see cref="IZincTypeInstExprAndIdent"/> instances.
		/// </param>
		protected ZincAsExIdTieTiasBoxBase (ZincAnnotations anns, IZincExp expr, ZincIdent id, IZincTypeInstExpression tie, params ZincTypeInstExprAndIdent[] tias) : base(anns,expr,id,tias) {
			this.typeInstExpression = tie;
		}
コード例 #5
0
 public ZincPredicateItem(ZincIdent ident, IEnumerable <ZincTypeInstExprAndIdent> parameters, ZincAnnotations annotations, IZincExp body = null) : base(annotations, body, ident, parameters)
 {
     ident.Usage = ZincIdentUsage.Function;
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZincAssignItem"/> class with a given identifier and expression.
 /// </summary>
 /// <param name="ident">The identifier of the variable to which the assignment is made.</param>
 /// <param name="expression">The expression that describes how the value to assign must be calculated.</param>
 public ZincAssignItem(ZincIdent ident, IZincExp expression) : base(ident, expression)
 {
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZincAnnotationItem"/> class with a given <see cref="IZincIdent"/>.
 /// that redirects to the semantic of the annotation.
 /// </summary>
 /// <param name="ident">An indentifier that links to the semantics of the identifier..</param>
 public ZincAnnotationItem(ZincIdent ident) : base(ident)
 {
 }
コード例 #8
0
 public ZincFunctionItem(IZincTypeInstExpression typeInst, ZincIdent ident, IList <ZincTypeInstExprAndIdent> parameters, ZincAnnotations annotations, IZincExp body = null) : base(annotations, body, ident, typeInst, parameters)
 {
     ident.Usage = ZincIdentUsage.Function;
 }