Inheritance: XRI3SyntaxComponent, XRIXRef
Exemplo n.º 1
0
 private void reset()
 {
     this.gcs = null;
     this.lcs = null;
     this.literal = null;
     this.xref = null;
 }
Exemplo n.º 2
0
        private void read()
        {
            this.reset();

            object obj = this.rule;	// subseg or global_subseg or local_subseg or rel_subseg or rel_subseg_nc

            // subseg?

            if (obj is Parser.Parser.subseg)
            {
                // read global_subseg or local_subseg from subseg

                IList<Rule> list_subseg = ((Parser.Parser.subseg)obj).rules;
                if (list_subseg.Count < 1)
                    return;
                obj = list_subseg[0];	// global_subseg or local_subseg
            }

            // global_subseg?

            if (obj is Parser.Parser.global_subseg)
            {
                // read gcs_char from global_subseg;

                IList<Rule> list_global_subseg = ((Parser.Parser.global_subseg)obj).rules;
                if (list_global_subseg.Count < 1)
                    return;
                obj = list_global_subseg[0];	// gcs_char
                this.gcs = ((Parser.Parser.gcs_char)obj).spelling[0];

                // read rel_subseg or local_subseg from global_subseg

                if (list_global_subseg.Count < 2)
                    return;
                obj = list_global_subseg[1];	// rel_subseg or local_subseg
            }

            // local_subseg?

            if (obj is Parser.Parser.local_subseg)
            {
                // read lcs_char from local_subseg;

                IList<Rule> list_local_subseg = ((Parser.Parser.local_subseg)obj).rules;
                if (list_local_subseg.Count < 1)
                    return;
                obj = list_local_subseg[0];	// lcs_char
                this.lcs = ((Parser.Parser.lcs_char)obj).spelling[0];

                // read rel_subseg from local_subseg

                if (list_local_subseg.Count < 2)
                    return;
                obj = list_local_subseg[1];	// rel_subseg
            }

            // rel_subseg or rel_subseg_nc?

            if (obj is Parser.Parser.rel_subseg)
            {
                // read literal or xref from rel_subseg

                IList<Rule> list_rel_subseg = ((Parser.Parser.rel_subseg)obj).rules;
                if (list_rel_subseg.Count < 1)
                    return;
                obj = list_rel_subseg[0];	// literal or xref
            }
            else if (obj is Parser.Parser.rel_subseg_nc)
            {
                // read literal_nc or xref from rel_subseg_nc

                IList<Rule> list_rel_subseg_nc = ((Parser.Parser.rel_subseg_nc)obj).rules;
                if (list_rel_subseg_nc.Count < 1)
                    return;
                obj = list_rel_subseg_nc[0];	// literal_nc or xref
            }
            else
            {
                return;
            }

            // literal or literal_nc or xref?

            if (obj is Parser.Parser.literal)
            {
                this.literal = new XRI3Literal((Parser.Parser.literal)obj);
            }
            else if (obj is Parser.Parser.literal_nc)
            {
                this.literal = new XRI3Literal((Parser.Parser.literal_nc)obj);
            }
            else if (obj is Parser.Parser.xref)
            {
                this.xref = new XRI3XRef((Parser.Parser.xref)obj);
            }
            else
            {
                return;
            }
        }