Inheritance: XRI3SyntaxComponent, XRIPath
Esempio n. 1
0
 private void reset()
 {
     this.scheme = null;
     this.authority = null;
     this.path = null;
     this.query = null;
     this.fragment = null;
 }
Esempio n. 2
0
 private void reset()
 {
     this.xri = null;
     this.path = null;
     this.query = null;
     this.fragment = null;
 }
Esempio n. 3
0
        private void read()
        {
            this.reset();

            object obj = this.rule;	// xri

            // read xri_scheme or xri_noscheme from xri

            IList<Rule> list_xri = ((Parser.Parser.xri)obj).rules;
            if (list_xri.Count < 1)
                return;
            obj = list_xri[0];	// xri_scheme or xri_noscheme

            // xri_scheme or xri_noscheme ?

            if (obj is Parser.Parser.xri_scheme)
            {

                // read "xri:" from xri_scheme

                IList<Rule> list_xri_scheme = ((Parser.Parser.xri_scheme)obj).rules;
                if (list_xri_scheme.Count < 1)
                    return;
                obj = list_xri_scheme[0];	// "xri:"
                this.scheme = ((Parser.Parser.StringValue)obj).spelling;

                // read xri_noscheme from xri_scheme

                if (list_xri_scheme.Count < 2)
                    return;
                obj = list_xri_scheme[1];	// xri_noscheme
            }
            else if (obj is Parser.Parser.xri_noscheme)
            {

            }
            else
            {
                throw new InvalidCastException(obj.GetType().Name);
            }

            // read xri_hier_part from xri_noscheme

            IList<Rule> list_xri_noscheme = ((Parser.Parser.xri_noscheme)obj).rules;
            if (list_xri_noscheme.Count < 1)
                return;
            obj = list_xri_noscheme[0];	// xri_hier_part

            // read xri_authority from xri_hier_part

            IList<Rule> list_xri_hier_part = ((Parser.Parser.xri_hier_part)obj).rules;
            if (list_xri_hier_part.Count < 1)
                return;
            obj = list_xri_hier_part[0];	// xri_authority
            this.authority = new XRI3Authority((Parser.Parser.xri_authority)obj);
            if (this.authority.getParserObject().spelling.Length < 1)
                this.authority = null;

            // read xri_path_abempty from xri_hier_part

            if (list_xri_hier_part.Count < 2)
                return;
            obj = list_xri_hier_part[1];	// xri_path_abempty
            this.path = new XRI3Path((Parser.Parser.xri_path_abempty)obj);
            if (this.path.getParserObject().spelling.Length < 1)
                this.path = null;

            // read iquery or ifragment from xri_noscheme

            if (list_xri_noscheme.Count < 3)
                return;
            obj = list_xri_noscheme[2];	// iquery or ifragment

            // iquery or ifragment ?

            if (obj is Parser.Parser.iquery)
            {
                this.query = new XRI3Query((Parser.Parser.iquery)obj);
                if (this.query.getParserObject().spelling.Length < 1)
                    this.query = null;

                // read ifragment from xri_noscheme

                if (list_xri_noscheme.Count < 5)
                    return;
                obj = list_xri_noscheme[4];	// ifragment
                this.fragment = new XRI3Fragment((Parser.Parser.ifragment)obj);
                if (this.fragment.getParserObject().spelling.Length < 1)
                    this.fragment = null;
            }
            else if (obj is Parser.Parser.ifragment)
            {
                this.fragment = new XRI3Fragment((Parser.Parser.ifragment)obj);
                if (this.fragment.getParserObject().spelling.Length < 1)
                    this.fragment = null;
            }
            else
            {
                throw new InvalidCastException(obj.GetType().Name);
            }
        }
Esempio n. 4
0
        private void read()
        {
            this.reset();

            object obj = this.rule;	// xri_reference

            // read xri or relative_xri_ref from xri_reference

            IList<Rule> list_xri_reference = ((Parser.Parser.xri_reference)obj).rules;
            if (list_xri_reference.Count < 1)
                return;
            obj = list_xri_reference[0];	// xri or relative_xri_ref

            // xri or relative_xri_ref ?

            if (obj is Parser.Parser.xri)
            {
                this.xri = new XRI3((Parser.Parser.xri)obj);
            }
            else if (obj is Parser.Parser.relative_xri_ref)
            {

                // read relative_xri_part from relative_xri_ref

                IList<Rule> list_relative_xri_ref = ((Parser.Parser.relative_xri_ref)obj).rules;
                if (list_relative_xri_ref.Count < 1)
                    return;
                obj = list_relative_xri_ref[0];	// relative_xri_part

                // read xri_path_abs or xri_path_noscheme or ipath_empty from relative_xri_part

                IList<Rule> list_relative_xri_part = ((Parser.Parser.relative_xri_part)obj).rules;
                if (list_relative_xri_part.Count < 1)
                    return;
                obj = list_relative_xri_part[0];	// xri_path_abs or xri_path_noscheme or ipath_empty

                // read xri_path_abs or xri_path_noscheme or ipath_emptry ?

                if (obj is Parser.Parser.xri_path_abs)
                {
                    this.path = new XRI3Path((Parser.Parser.xri_path_abs)obj);
                }
                else if (obj is Parser.Parser.xri_path_noscheme)
                {
                    this.path = new XRI3Path((Parser.Parser.xri_path_noscheme)obj);
                }
                else if (obj is Parser.Parser.ipath_empty)
                {
                    this.path = new XRI3Path((Parser.Parser.ipath_empty)obj);
                }
                else
                {
                    throw new InvalidCastException(obj.GetType().Name);
                }

                // read iquery from relative_xri_ref

                if (list_relative_xri_ref.Count < 3)
                    return;
                obj = list_relative_xri_ref[2];	// iquery
                this.query = new XRI3Query((Parser.Parser.iquery)obj);

                // read ifragment from relative_xri_ref

                if (list_relative_xri_ref.Count < 5)
                    return;
                obj = list_relative_xri_ref[4];	// ifragment
                this.fragment = new XRI3Fragment((Parser.Parser.ifragment)obj);
            }
            else
            {
                throw new InvalidCastException(obj.GetType().Name);
            }
        }