Beispiel #1
0
        void ParseMod(string s)
        {
            int  p = 6; // Length of "modopt" or "modreq"
            char c;

            while (char.IsWhiteSpace(c = s[p]))
            {
                p++;
            }

            if (c != '(')
            {
                throw new EcmaILParserException("'('", s.Substring(0, 6), s);
            }

            while (char.IsWhiteSpace(c = s[p]))
            {
                p++;
            }

            content += s.Substring(0, p);

            EcmaTypeRef typeRef = new EcmaTypeRef();

            if (!typeRef.Parse(s.Substring(p)))
            {
                throw new EcmaILParserException("TypeRef", s.Substring(0, p), s);
            }

            content += typeRef.Content;
            p       += typeRef.NextTokenPosition;

            while (char.IsWhiteSpace(c = s[p]))
            {
                p++;
            }

            if (c != ')')
            {
                throw new EcmaILParserException("'('", s.Substring(0, p), s);
            }

            content += c;
        }
Beispiel #2
0
        bool ParseClassOrValueType(string s)
        {
            int p = 0;

            if (s.StartsWith("class "))
            {
                content = "class ";
                p       = content.Length;
            }
            else if (s.StartsWith("valuetype "))
            {
                content = "valuetype ";
                p       = content.Length;
            }
            if (p == 0)
            {
                return(false);
            }
            while (char.IsWhiteSpace(s[p]))
            {
                p++;
            }

            EcmaTypeRef typeRef = new EcmaTypeRef();

            if (!typeRef.Parse(s.Substring(p)))
            {
                throw new EcmaILParserException("TypeRef", content, s.Substring(p));
            }

            content += typeRef.Content;
            p       += typeRef.NextTokenPosition;

            nextTokenPosition += p;

            return(true);
        }