Пример #1
0
        // Compat with mbuild client type interface

        public TargetList FilterScope(IGraphState graph, string here, OperationScope scope)
        {
            if (inner == null)
            {
                return(TargetList.Null);
            }

            short hereid = graph.GetProviderId(here);

            if (hereid < 0)
            {
                throw ExHelp.App("Nonexistant provider basis `{0}'", here);
            }

            switch (scope)
            {
            case OperationScope.Everywhere:
                return(this);

            case OperationScope.HereAndBelow:
                return(FilterInside(graph, hereid));

            case OperationScope.HereOnly:
                return(FilterExact(hereid));

            default:
                throw ExHelp.App("Unknown OperationScope {0} (here = {1})", scope, here);
            }
        }
Пример #2
0
        public bool UseNamespace(string ns, string declloc, IWarningLogger log)
        {
            if (bm == null)
            {
                // No bundle manager yet. Save the info; once our manager is
                // set, we can do all the loading and structure template instantiation.
                nsqueue[ns] = declloc;
                return(false);
            }

            // Standard initialization.

            UseRawNamespace("MBuildDynamic." + ns);

            // Now we load the associated structure template and instantiate
            // anything that needs instantiation.

            // XXX this was later before; why???
            if (declloc == null)
            {
                throw ExHelp.App("! {0}, {1}", ns, declloc);
            }

            StructureTemplate st = bm.UseNamespaceTemplate(ns, declloc, log);

            if (st == null)
            {
                return(true);
            }

            known_structs[st.GetType()] = st;
            return(false);
        }
Пример #3
0
            public ProvData(WrenchProvider pb)
            {
                this.pb = pb;

                int ntarg = pb.NumTargets;

                dep_chunk_len  = 0;
                name_chunk_len = 0;

                dep_offsets  = new int[ntarg];
                name_offsets = new int[ntarg];

                targids = new Dictionary <int, WrenchTarget> ();
                int nseen = 0;

                foreach (WrenchTarget tb in pb.DefinedTargets)
                {
                    targids[tb.ShortId] = tb;
                    nseen++;
                }

                if (nseen != ntarg)
                {
                    throw ExHelp.App("Report NumTargets ({0}) for provider {1} not number " +
                                     "actually seen ({2})", ntarg, pb.Basis, nseen);
                }
            }
Пример #4
0
        public bool Finish(BundleManager bm, IWarningLogger log)
        {
            if (DeclarationLoc == null)
            {
                throw ExHelp.App("WP Finish, basis {0}", Basis);
            }

            if (namecontext.SetManager(bm, log))
            {
                return(true);
            }

            if (DoneRequesting(namecontext, log))
            {
                return(true);
            }

            foreach (WrenchTarget wt in DefinedTargets)
            {
                if (wt.DoFixup(namecontext, log))
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #5
0
        void ReadProviders(BinaryReader br)
        {
            int n = br.ReadInt32();

            if (n < 0 || n > 0x7FFE)
            {
                throw ExHelp.App("Graph has too many ({0}) providers (pos {1})",
                                 n, br.BaseStream.Position);
            }

            nprov     = (short)n;
            providers = new PData[n];

            for (int i = 0; i < nprov; i++)
            {
                int ntarg = br.ReadInt32();

                if (ntarg < 0 || ntarg > 0xFFFF)
                {
                    throw ExHelp.App("Provider {0} has too many targets ({1}) (pos {2})}",
                                     i, ntarg, br.BaseStream.Position);
                }

                providers[i].ntarg          = (short)ntarg;
                providers[i].basis          = br.ReadString();
                providers[i].declloc        = br.ReadString();
                providers[i].dep_chunk_len  = br.ReadInt32();
                providers[i].dep_offsets    = BinaryHelper.ReadRawInts(br, ntarg);
                providers[i].name_chunk_len = br.ReadInt32();
                providers[i].name_offsets   = BinaryHelper.ReadRawInts(br, ntarg);
                providers[i].rule_indices   = BinaryHelper.ReadRawInts(br, ntarg);
            }
        }
Пример #6
0
        public IEnumerable <TargetTagInfo> GetTargetsWithTag(int tag)
        {
            int start, bound;

            GetOffsetRange(tag, tag_offsets, tag_data.Length, out start, out bound);

            if (((bound - start) & 0x1) != 0)
            {
                throw ExHelp.App("Target tag data segment length {0} is odd!", bound - start);
            }

            for (int idx = start; idx < bound; idx += 2)
            {
                TargetTagInfo tti;
                int           valcode = tag_data[idx + 1];

                if ((valcode & 0x7FFF0000) == 0x7FFF0000)
                {
                    tti = new TargetTagInfo(tag, tag_data[idx], ResultFromCode(valcode));
                }
                else
                {
                    tti = new TargetTagInfo(tag, tag_data[idx], valcode);
                }

                yield return(tti);
            }
        }
Пример #7
0
        void WriteTargetTables()
        {
            // Initialize provider offset tables

            int nprov = gb.NumProviders;

            provdata = new ProvData[nprov];
            int numseen = 0;

            foreach (WrenchProvider pb in gb.Providers)
            {
                provdata[pb.Id] = new ProvData(pb);
                numseen++;
            }

            if (numseen != nprov)
            {
                throw ExHelp.App("Reported NumProviders ({0}) does not agree with seen ({1})?",
                                 nprov, numseen);
            }

            // First dep chunks

            long pos      = bw.BaseStream.Position;
            int  totallen = 0;

            bw.Write(-1);  // placeholder

            for (int i = 0; i < nprov; i++)
            {
                totallen = provdata[i].WriteDeps(this, totallen);
            }

            long retpos = bw.BaseStream.Position;

            // there is a bw.Seek that maybe we should use, but it only
            // takes int arguments
            bw.BaseStream.Position = pos;
            bw.Write(totallen);
            bw.BaseStream.Position = retpos;

            BinaryHelper.WriteDelimiter(bw);

            // Now name chunks

            pos      = bw.BaseStream.Position;
            totallen = 0;
            bw.Write(-1);  // placeholder

            for (int i = 0; i < nprov; i++)
            {
                totallen = provdata[i].WriteNames(this, totallen);
            }

            retpos = bw.BaseStream.Position;
            bw.BaseStream.Position = pos;
            bw.Write(totallen);
            bw.BaseStream.Position = retpos;
        }
Пример #8
0
        public void AddTargetParam(string name, string dflt)
        {
            if (sparams.ContainsKey (name))
            throw ExHelp.App ("Redefinition of structure parameter `{0}'", name);

            sparams[name] = StructureParameterKind.Target;
            defaults[name] = dflt;
        }
Пример #9
0
        public void AddStructureParam(UserType type, string name, string dflt)
        {
            if (sparams.ContainsKey (name))
            throw ExHelp.App ("Redefinition of structure parameter `{0}'", name);

            sparams[name] = StructureParameterKind.Structure;
            structtypes[name] = type;
            defaults[name] = dflt;
        }
Пример #10
0
        public BGProviderBuilder(string name, NamespaceBuilder ns) : base(ns)
        {
            if (Structure[name] != StructureParameterKind.Basis)
            {
                throw ExHelp.App("No such basis parameter {0} for provider", name);
            }

            basisparam = name;
        }
Пример #11
0
        public TypeExpressedItem GetUserTypeItem(string tname)
        {
            if (!user_types.ContainsKey(tname))
            {
                throw ExHelp.App("Trying to get undefined user type {0}", tname);
            }

            return(user_types[tname]);
        }
Пример #12
0
        // Should only be called if the provider at the given
        // basis is known to exist -- will throw an exception
        // if it doesn't.

        public ProviderBuilder GetProvider(string basis)
        {
            if (!providers.ContainsKey(basis))
            {
                throw ExHelp.App("The provider at basis `{0}' should be defined " +
                                 "by now, but hasn't been.", basis);
            }

            return(providers[basis]);
        }
Пример #13
0
        public void AddLiteralTarget(string name, Result res)
        {
            // FIXME: generalize this to not-necessarily-literal targets too.
            if (lits.ContainsKey(name))
            {
                throw ExHelp.App("Redefining literal target {0}?", name);
            }

            lits[name] = res;
        }
Пример #14
0
        public UserType ResolveBoundRuleType(TypeResolveContext trc, bool errors)
        {
            if (!resolved)
            {
                if (errors)
                {
                    throw new InvalidOperationException();
                }
                return(null);
            }

            UserType ret;

            if (IsUser)
            {
                // User type. Use our lookup tables

                RuleTemplateBuilder rtb = trc.Driver.GetUserTypeItem((string)t) as RuleTemplateBuilder;

                if (errors && rtb == null)
                {
                    throw ExHelp.App("Expected a rule template but got {0} for {1}",
                                     trc.Driver.GetUserTypeItem((string)t), this);
                }

                ret = new UserType(rtb.Rule.FullName);
            }
            else
            {
                // System type. Use reflection.

                Type type = (Type)t;

                object[] attrs = type.GetCustomAttributes(typeof(RuleBindingAttribute), false);

                if (errors && attrs.Length == 0)
                {
                    throw ExHelp.App("Expected type {0} to have a RuleBindingAttribute " +
                                     "but it didn't. This type is not allowed to be a rule baseclass.", type);
                }

                ret = new UserType(((RuleBindingAttribute)attrs[0]).RuleType);
            }

            if (ret.Resolve(trc, errors))
            {
                if (errors)
                {
                    throw ExHelp.App("Failed to resolve bound rule type {0}", ret);
                }
                return(null);
            }

            return(ret);
        }
Пример #15
0
        public UserType ResolveSelfType(TypeResolveContext trc, bool errors)
        {
            UserType ut = new UserType(FullName);

            if (ut.Resolve(trc, errors) && errors)
            {
                throw ExHelp.App("Failed to resolve SelfType of {0}?", this);
            }

            return(ut);
        }
Пример #16
0
        internal void AddTarget(TargetBuilder tb)
        {
            int id = ((WrenchTarget)tb).Id;

            if (targs_by_id.ContainsKey(id))
            {
                throw ExHelp.App("Somehow got a dup target id? ({0:x})", id);
            }

            targs_by_id[id] = tb;
        }
Пример #17
0
        public void DefineUserType(string tname, TypeExpressedItem tei)
        {
            //Console.WriteLine ("Registering user type: {0}", tname);

            if (user_types.ContainsKey(tname))
            {
                throw ExHelp.App("Trying to redefine type {0}", tname);
            }

            user_types[tname] = tei;
            definitions_made  = true;
        }
Пример #18
0
        public static void ExpectDelimiter(BinaryReader br)
        {
            Debug("expect delimiter #{0}", ndelim_rd++);

            int val = br.ReadInt32();

            if (val == DelimiterVal)
            {
                return;
            }

            throw ExHelp.App("Expected a delimiter at position {0} but got (int) {1}",
                             br.BaseStream.Position, val);
        }
Пример #19
0
        // Return an expression that yields an appropriate StructureTemplate
        // instance of type bstruct from our current context. stmpl is an expression
        // that returns an instance of the structure that we are bound to.
        // Typical usage:
        //
        //    UserType bstruct = BaseClass.ResolveUsedStructureType (trc, errors);
        //    ...
        //    ctor.BaseConstructorArgs.Add (ContextualStructRef (bstruct, stmpl));
        //
        // If bstruct is null, CDH.Null is returned -- so in the above case, we
        // will pass null to the base constructor, which is appropriate since it
        // needs no structure.

        public CodeExpression ContextualStructRef(UserType bstruct, CodeExpression stmpl)
        {
            if (bstruct == null)
            {
                return(CDH.Null);
            }

            if (bstruct.Equals(NS.ParamsType))
            {
                // Sweet! We are referring to ourselves.
                return(stmpl);
            }

            // We need some nontrivial different structure
            // type. Search our structure for a member that points to
            // a structure of that type.

            string foundparam = null;

            foreach (string param in Params.Parameters)
            {
                if (Params[param] != StructureParameterKind.Structure)
                {
                    continue;
                }

                if (!bstruct.Equals(Params.StructParamType(param)))
                {
                    continue;
                }

                // FIXME: better model that handles this.
                if (foundparam != null)
                {
                    throw ExHelp.App("Ambiguous structure chain: structure {0} contains two parameters " +
                                     "of type {1}: {2} and {3}", Params, bstruct, foundparam, param);
                }

                foundparam = param;
            }

            if (foundparam == null)
            {
                throw ExHelp.App("Missing structure chain: structure {0} needs a parameter of type {1} " +
                                 "to allow chaining of type {2} to its base class {3}", Params,
                                 bstruct, this, BaseClass);
            }

            return(new CodeFieldReferenceExpression(stmpl, foundparam));
        }
Пример #20
0
        void ApplyTemplate(string name)
        {
            if (CheckTargetName(name))
            {
                return;
            }
            if (cur_apply_name == null)
            {
                throw ExHelp.App("Trying to apply template without having set template name??");
            }

            TargetBuilder tb = wp.DefineTarget(name, log);

            tb.TemplateName = cur_apply_name;
        }
Пример #21
0
        int RegisterResult(Result r)
        {
            int idx = result_table.IndexOf(r);

            if (idx < 0)
            {
                result_table.Add(r);
                idx = result_table.Count - 1;

                if (idx > 0xFFFF)
                {
                    throw ExHelp.App("Too many constant results in graph!");
                }
            }

            return(0x7FFF0000 | idx);
        }
Пример #22
0
        void WriteTags()
        {
            bw.Write(gb.NumTags);

            int nwritten = 0;

            foreach (string name in gb.GetTags())
            {
                int id = gb.GetTagId(name);

                bw.Write(name);
                bw.Write(id);
                nwritten++;
            }

            if (nwritten != gb.NumTags)
            {
                throw ExHelp.App("Report NumTags ({0}) is not actual ({1})?",
                                 gb.NumTags, nwritten);
            }
        }
Пример #23
0
        public bool Prepare()
        {
            definitions_made = true;
            int n = 0;

            while (definitions_made)
            {
                definitions_made = false;

                foreach (Parser p in parsers.Values)
                {
                    p.Resolve(false);
                }

                if (n++ > 100)
                {
                    throw ExHelp.App("Infinite loop of user type declarations???");
                }

                // definitions_made gets set if any resolve
                // function defines a new usertype, which might
                // play a role in type resolution.
            }

            bool ret = false;

            // Now all the user types have been defined, so
            // if any type resolution fails, it is an error.

            foreach (Parser p in parsers.Values)
            {
                ret |= p.Resolve(true);
            }

            return(ret);
        }
Пример #24
0
    public static void Stats(BinaryReader br)
    {
        byte[] dat;
        int    val;

        dat = br.ReadBytes(4);

        if (dat[0] != (byte)'M' || dat[1] != (byte)'B' ||
            dat[2] != (byte)'G' || dat[3] != (byte)BinaryLoadedGraph.BinaryFormatIdent)
        {
            throw ExHelp.App("Unexpected header values: {0},{1},{2},{3}",
                             dat[0], dat[1], dat[2], dat[3]);
        }

        Console.WriteLine(" * Header OK");

        val = BinaryHelper.ReadRawInt(br);

        if (val != 0x01B2C3D4)
        {
            throw ExHelp.App("Endianness marker not valid: got {0:x}", val);
        }

        Console.WriteLine(" * Endianness OK");

        long        pstart = br.BaseStream.Position;
        ProjectInfo pi     = (ProjectInfo)BinaryHelper.ReadObject(br);
        long        pend   = br.BaseStream.Position;

        Console.WriteLine(" * Project info: name {0}, version {1}, compat code {2}, bfname {3}",
                          pi.Name, pi.Version, pi.CompatCode, pi.BuildfileName);
        Console.WriteLine(" * Project info entry consumes {0} bytes", pend - pstart);

        BinaryHelper.ExpectDelimiter(br);

        pstart = br.BaseStream.Position;
        DependentItemInfo[] dii = (DependentItemInfo[])BinaryHelper.ReadObject(br);
        Console.WriteLine(" * Depends on {0} files", dii.Length);
        dii = (DependentItemInfo[])BinaryHelper.ReadObject(br);
        Console.WriteLine(" * Depends on {0} bundles", dii.Length);
        pend = br.BaseStream.Position;
        Console.WriteLine(" * Dependency info consumes {0} bytes", pend - pstart);

        BinaryHelper.ExpectDelimiter(br);

        pstart = br.BaseStream.Position;
        int ntags = br.ReadInt32();

        Console.WriteLine(" * {0} tags", ntags);

        for (int i = 0; i < ntags; i++)
        {
            string s     = br.ReadString();
            int    tagid = br.ReadInt32();
            Console.WriteLine("    {0} : {1}", s, tagid);
        }

        pend = br.BaseStream.Position;
        Console.WriteLine(" * Tag listing consumes {0} bytes", pend - pstart);

        BinaryHelper.ExpectDelimiter(br);

        int n = br.ReadInt32();

        Console.WriteLine(" * Dependency data table is {0} ints ({1} bytes)", n, n * 4);
        dat = br.ReadBytes(n * 4);

        BinaryHelper.ExpectDelimiter(br);

        n = br.ReadInt32();
        Console.WriteLine(" * Name data table is {0} bytes", n);
        dat = br.ReadBytes(n);

        BinaryHelper.ExpectDelimiter(br);

        pstart = br.BaseStream.Position;
        n      = br.ReadInt32();
        Console.WriteLine(" * There are {0} providers", n);

        for (int i = 0; i < n; i++)
        {
            int    ntarg   = br.ReadInt32();
            string basis   = br.ReadString();
            string declloc = br.ReadString();
            int    deplen  = br.ReadInt32();
            dat = br.ReadBytes(ntarg * 4);
            int namelen = br.ReadInt32();
            dat = br.ReadBytes(ntarg * 4);
            dat = br.ReadBytes(ntarg * 4);

            Console.WriteLine("   {0}: {1} targs, {2} bytes of dep, {3} bytes of name, decl {4}",
                              basis, ntarg, deplen * 4, namelen * 4, declloc);
        }

        pend = br.BaseStream.Position;
        Console.WriteLine(" * Provider listing consumes {0} bytes", pend - pstart);

        BinaryHelper.ExpectDelimiter(br);

        pstart = br.BaseStream.Position;
        n      = br.ReadInt32();
        Console.WriteLine(" * There are {0} ints ({1} bytes) in the tag data table",
                          n, n * 4);
        dat = br.ReadBytes(n * 4);
        int[] ofs = BinaryHelper.ReadRawInts(br, ntags);

        Console.Write(" * Tag chunk lengths:");

        for (int i = 0; i < ntags - 1; i++)
        {
            Console.Write(" {0}", ofs[i + 1] - ofs[i]);
        }

        Console.WriteLine(" {0}", n - ofs[ntags - 1]);

        pend = br.BaseStream.Position;
        Console.WriteLine(" * Tag data consumes {0} bytes", pend - pstart);

        BinaryHelper.ExpectDelimiter(br);

        pstart = br.BaseStream.Position;
        Type[] typetab = (Type[])BinaryHelper.ReadObject(br);
        pend = br.BaseStream.Position;
        Console.WriteLine(" * Type table has {0} entries, consumes {1} bytes",
                          typetab.Length, pend - pstart);

        BinaryHelper.ExpectDelimiter(br);

        pstart = br.BaseStream.Position;
        Result[] rtab = (Result[])BinaryHelper.ReadObject(br);
        pend = br.BaseStream.Position;
        Console.WriteLine(" * Result table has {0} entries, consumes {1} bytes",
                          rtab.Length, pend - pstart);

        for (int i = 0; i < rtab.Length; i++)
        {
            Console.WriteLine("    {0}: {1}", i, rtab[i]);
        }

        try {
            br.ReadByte();
        } catch (Exception) {
            Console.WriteLine(" * Found EOF as expected");
            return;
        }

        throw ExHelp.App("Did not find EOF at position {0} as expected",
                         br.BaseStream.Position);
    }
Пример #25
0
        public UserType ResolveUsedStructureType(TypeResolveContext trc, bool errors)
        {
            if (!resolved)
            {
                if (errors)
                {
                    throw new InvalidOperationException();
                }
                return(null);
            }

            UserType ret;

            if (IsUser)
            {
                // User type. Use our lookup tables

                StructureBoundItem sbi = trc.Driver.GetUserTypeItem((string)t) as StructureBoundItem;

                if (sbi == null)
                {
                    if (errors)
                    {
                        throw ExHelp.App("Expected structure bound item but got {0} for {1}",
                                         trc.Driver.GetUserTypeItem((string)t), this);
                    }
                    return(null);
                }

                if (!sbi.UsesStructure)
                {
                    return(null);
                }

                ret = sbi.NS.ParamsType;
            }
            else
            {
                // System type. Use reflection.

                Type type = (Type)t;

                object[] attrs = type.GetCustomAttributes(typeof(StructureBindingAttribute), false);

                if (attrs.Length == 0)
                {
                    throw ExHelp.App("Expected type {0} to have a StructureBindingAttribute " +
                                     "but it didn't", type);
                }

                StructureBindingAttribute attr = (StructureBindingAttribute)attrs[0];

                if (!attr.UsesStructure)
                {
                    return(null);
                }

                ret = new UserType(attr.StructureType);
            }

            if (ret.Resolve(trc, errors))
            {
                if (errors)
                {
                    throw ExHelp.App("Failed to resolve bound structure type {0}", ret);
                }
                return(null);
            }

            return(ret);
        }
Пример #26
0
        public override bool Resolve(TypeResolveContext trc, bool errors)
        {
            bool ret = base.Resolve(trc, errors);

            ret |= MatchType.ResolveExtension("RTemplate", trc, errors);

            // RegexMatcher will handle distinguishing between when
            // we return a Rule type and a TargetTemplate type, but we need
            // to check if we require a binding.

            bool?foo = MatchType.ResolvesAsRule(trc, errors);

            if (foo == null)
            {
                // MatchType unresolved, can't say.
                return(true);
            }

            if ((bool)foo)
            {
                // We point to a Rule, and ResolveUsedStructureType will
                // complain if we call it on MatchType.

                if (UsesStructure)
                {
                    throw ExHelp.App("Odd, MatcherBuilder {0} is using its structure" +
                                     "even though it points to a plain rule {1}", this,
                                     MatchType);
                }

                return(false);
            }

            // We have a template, so see if it uses a structure

            UserType stype = MatchType.ResolveUsedStructureType(trc, errors);

            if (errors)
            {
                if (stype == null && UsesStructure)
                {
                    // XXX is this actually an error? Shouldn't happen, I think.
                    Console.Error.WriteLine("Matcher {0} is bound to structure {1} but its " +
                                            "associated template {2} is unbound", this,
                                            Params, MatchType);
                    return(true);
                }
                else if (stype != null && !UsesStructure)
                {
                    UseStructure();
                }
                else if (stype != null && !NS.ParamsType.Equals(stype))
                {
                    // FIXME: see if Structure has a member of type stype.
                    Console.Error.WriteLine("Matcher {0} is bound to the structure {1}  but its " +
                                            "associated template {2} is bound to {3}", this,
                                            Params, MatchType, stype);
                    return(true);
                }
            }

            return(ret);
        }
Пример #27
0
        // Helper: converts a structure-bound target reference to a CodeExpression.
        // A "structure-bound target reference" is one of the following:
        //
        //    * plain: [target basename] (valid only if 'basis' is nonnull)
        //    * relative to a basis param: [param]/[target basename]
        //    * relative to a structure param: [param].[structure's basis param]/[target basename]
        //
        // (We could add: [structure param].[structure param]....[basis param]/[target basename])
        //
        // 'strukt' is an expression which, in the context of the whatever will evaluate
        // our return value, yields the StructureTemplate object whose parameters
        // will be used to evaluate bases.
        //
        // 'basis' is an optional expression which yields a string representing
        // the "current" basis, if that is meaningful. If not, pass null.

        public CodeExpression MakeTargetNameExpr(string name, CodeExpression strukt,
                                                 CodeExpression basis)
        {
            int idx = name.IndexOf('/');

            CodeBinaryOperatorExpression e = new CodeBinaryOperatorExpression();

            e.Operator = CodeBinaryOperatorType.Add;

            if (idx < 0)
            {
                if (basis == null)
                {
                    throw new Exception("Can't have bare target name in object without an " +
                                        "associated basis.");
                }

                e.Left  = basis;
                e.Right = new CodePrimitiveExpression(name);
            }
            else
            {
                string param    = name.Substring(0, idx);
                string basename = name.Substring(idx + 1);

                if (basename.IndexOf('/') != -1)
                {
                    throw new Exception("Target references must be relative to a " +
                                        "parameter; can have at most one / in the text");
                }

                int jdx = param.IndexOf('.');

                e.Right = new CodePrimitiveExpression(basename);

                if (jdx < 0)
                {
                    if (!nsparams.HasParam(param))
                    {
                        throw ExHelp.App("Relative target name references unknown " +
                                         "structure parameter {0}.", param);
                    }

                    if (nsparams[param] == StructureParameterKind.Structure)
                    {
                        throw ExHelp.App("Target prefix parmeter {0} should be a `basis' but is a " +
                                         "`structure'. Did you forget to add a member access to the structure?", param);
                    }

                    if (nsparams[param] != StructureParameterKind.Basis)
                    {
                        throw ExHelp.App("Target prefix argument {0} must be of type `basis'.", param);
                    }

                    e.Left = new CodeFieldReferenceExpression(strukt, param);
                }
                else
                {
                    // Member of a Structure parameter

                    string member = param.Substring(jdx + 1);
                    param = param.Substring(0, jdx);

                    if (!nsparams.HasParam(param))
                    {
                        throw ExHelp.App("Relative target name references unknown " +
                                         "structure parameter {0}", param);
                    }

                    if (nsparams[param] != StructureParameterKind.Structure)
                    {
                        throw ExHelp.App("Member access parameter must be of type `structure'.");
                    }

                    CodeExpression outer =
                        new CodeFieldReferenceExpression(strukt, param);
                    e.Left = new CodeFieldReferenceExpression(outer, member);
                }
            }

            return(e);
        }