/// <summary>
        /// Debug function which will print current variable scopes and info.
        /// </summary>
        // debug functions
        public virtual void debug_print_vars()
        {
            int level = 0;

            for (IEnumerator i = _scopes.GetEnumerator(); i.MoveNext();)
            {
                IDictionary scope = (IDictionary)i.Current;

                Console.WriteLine("Scope level " + level);
                //			scope.entrySet().iterator();
                for (IEnumerator j = scope.GetEnumerator(); j.MoveNext();)
                {
                    QName varname = (QName)j.Current;

                    AnyType val = (AnyType)scope[varname];

                    string string_val = "null";

                    if (val != null)
                    {
                        string_val = val.StringValue;
                    }

                    Console.WriteLine("Varname: " + varname.@string() + " expanded=" + varname.expanded() + " Value: " + string_val);
                }

                level++;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Validate a schema element test.
        /// </summary>
        /// <param name="e">
        ///            is the expression. </param>
        /// <returns> null. </returns>
        public virtual object visit(SchemaElemTest e)
        {
            QName elem = e.name();

            if (!expandItemQName(elem))
            {
                reportBadPrefix(elem.prefix());
            }

            if (_sc.TypeModel.lookupElementDeclaration(elem.@namespace(), elem.local()) == null)
            {
                reportError(new StaticElemNameError("Element not declared: " + elem.@string()));
            }
            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Validate a schema attribute test.
        /// </summary>
        /// <param name="e">
        ///            is the expression. </param>
        /// <returns> null. </returns>
        public virtual object visit(SchemaAttrTest e)
        {
            QName name = e.arg();

            if (!expandItemQName(name))
            {
                reportBadPrefix(name.prefix());
            }

            if (_sc.TypeModel.lookupAttributeDeclaration(name.@namespace(), name.local()) == null)
            {
                reportError(new StaticAttrNameError("Attribute not decleared: " + name.@string()));
            }

            return(null);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Validate a function call.
        /// </summary>
        /// <param name="e">
        ///            is the expression. </param>
        /// <returns> null. </returns>
        public virtual object visit(FunctionCall e)
        {
            QName name = e.name();

            if (!expandFunctionQName(name))
            {
                reportBadPrefix(name.prefix());
            }

            [email protected] qName = name.asQName();
            Function f = _sc.resolveFunction(qName, e.arity());

            if (f == null)
            {
                reportError(new StaticFunctNameError("Function does not exist: " + name.@string() + " arity: " + e.arity()));
            }
            e.set_function(f);
            _resolvedFunctions.Add(qName);

            visitExprs(e.GetEnumerator());
            return(null);
        }