コード例 #1
0
        public bool Parse(string input)
        {
            int            p          = 0;
            EcmaDottedName dottedName = new EcmaDottedName();

            if (!dottedName.Parse(input))
            {
                return(false);
            }

            p = dottedName.NextTokenPosition;

            while (input[p] == '/')
            {
                p++;
                if (!dottedName.Parse(input.Substring(p)))
                {
                    throw new EcmaILParserException("DottedName", input.Substring(0, p), input);
                }
                p += dottedName.NextTokenPosition;
            }
            content           = input.Substring(0, p);
            nextTokenPosition = p;

            return(true);
        }
コード例 #2
0
        public bool Parse(string input)
        {
            if (input.StartsWith(".cctor"))
            {
                this.content           = ".cctor";
                this.nextTokenPosition = 6;
                return(true);
            }
            if (input.StartsWith(".ctor"))
            {
                this.content           = ".ctor";
                this.nextTokenPosition = 5;
                return(true);
            }
            EcmaDottedName dottedName = new EcmaDottedName();

            if (!dottedName.Parse(input))
            {
                return(false);
            }

            this.content           = dottedName.Content;
            this.nextTokenPosition = dottedName.NextTokenPosition;

            return(true);
        }
コード例 #3
0
        bool ParseGenericArgs(string s)
        {
            int p = 0;

            while (s[p] == '!')
            {
                p++;
            }
            if (p == 0)
            {
                return(false);
            }
            while (char.IsWhiteSpace(s[p]))
            {
                p++;
            }
            if (char.IsDigit(s[p]))
            {
                while (char.IsDigit(s[p]))
                {
                    p++;
                }
            }
            else
            {
                // This seems to be a Microsoft extension to the standard
                // !Name instead of !int32
                EcmaDottedName dn = new EcmaDottedName();  // Actually it's a simple name, but we don't have a special class for it
                if (!dn.Parse(s.Substring(p)))
                {
                    throw new EcmaILParserException("Name", s.Substring(p), s);
                }
                p += dn.NextTokenPosition;
            }
            content            = s.Substring(0, p);
            nextTokenPosition += p;
            return(true);
        }