示例#1
0
 internal Preprocessor(string text, CsTokenClass tokenClass, CodeLocation location, bool generated)
     : base(text, CsTokenType.PreprocessorDirective, tokenClass, location, generated)
 {
     this.preprocessorType = string.Empty;
     int num = 0;
     while (true)
     {
         if (text[num] == '#')
         {
             break;
         }
         num++;
     }
     string str = string.Empty;
     int num2 = num;
     while ((num2 + 1) < text.Length)
     {
         if (!char.IsLetter(text[num2 + 1]))
         {
             break;
         }
         num2++;
     }
     if (num2 > num)
     {
         str = text.Substring(num + 1, num2 - num);
     }
     this.preprocessorType = str;
 }
        /// <summary>
        /// Initializes a new instance of the TypeToken class.
        /// </summary>
        /// <param name="childTokens">
        /// The list of child tokens that form the token.
        /// </param>
        /// <param name="location">
        /// The location of the token in the code.
        /// </param>
        /// <param name="parent">
        /// The parent of the token.
        /// </param>
        /// <param name="tokenClass">
        /// The token class.
        /// </param>
        /// <param name="generated">
        /// True if the token is inside of a block of generated code.
        /// </param>
        internal TypeToken(MasterList<CsToken> childTokens, CodeLocation location, Reference<ICodePart> parent, CsTokenClass tokenClass, bool generated)
            : base(CsTokenType.Other, tokenClass, location, parent, generated)
        {
            Param.AssertNotNull(childTokens, "childTokens");
            Param.AssertNotNull(location, "location");
            Param.AssertNotNull(parent, "parent");
            Param.AssertNotNull(tokenClass, "tokenClass");
            Param.Ignore(generated);

            this.childTokens = childTokens;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the CsToken class.
        /// </summary>
        /// <param name="tokenType">
        /// The token type.
        /// </param>
        /// <param name="tokenClass">
        /// The token class.
        /// </param>
        /// <param name="location">
        /// The location of the token within the code document.
        /// </param>
        /// <param name="parent">
        /// References the parent code part.
        /// </param>
        /// <param name="generated">
        /// True if the token is inside of a block of generated code.
        /// </param>
        internal CsToken(CsTokenType tokenType, CsTokenClass tokenClass, CodeLocation location, Reference <ICodePart> parent, bool generated)
        {
            Param.Ignore(tokenType);
            Param.Ignore(tokenClass);
            Param.AssertNotNull(location, "location");
            Param.AssertNotNull(parent, "parent");
            Param.Ignore(generated);

            this.tokenType  = tokenType;
            this.tokenClass = tokenClass;
            this.location   = location;
            this.parent     = parent;
            this.generated  = generated;
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the Preprocessor class.
        /// </summary>
        /// <param name="text">
        /// The line text.
        /// </param>
        /// <param name="tokenClass">
        /// The class of the token.
        /// </param>
        /// <param name="location">
        /// The location of the preprocessor in the code.
        /// </param>
        /// <param name="parent">
        /// The parent code part.
        /// </param>
        /// <param name="generated">
        /// Indicates whether the preprocessor lies within a block of generated code.
        /// </param>
        internal Preprocessor(string text, CsTokenClass tokenClass, CodeLocation location, Reference <ICodePart> parent, bool generated)
            : base(text, CsTokenType.PreprocessorDirective, tokenClass, location, parent, generated)
        {
            Param.AssertNotNull(text, "text");
            Param.AssertNotNull(tokenClass, "tokenClass");
            Param.AssertNotNull(location, "location");
            Param.AssertNotNull(parent, "parent");
            Param.Ignore(generated);

            // Extract the type of the preprocessor statement.
            int startIndex = 0;

            while (true)
            {
                if (text[startIndex] == '#')
                {
                    break;
                }

                ++startIndex;
            }

            // Extract the name.
            string name  = string.Empty;
            int    index = startIndex;

            while (index + 1 < text.Length)
            {
                if (!char.IsLetter(text[index + 1]))
                {
                    break;
                }

                ++index;
            }

            if (index > startIndex)
            {
                name = text.Substring(startIndex + 1, index - startIndex);
            }

            this.preprocessorType = name;
        }
        /// <summary>
        /// Initializes a new instance of the Preprocessor class.
        /// </summary>
        /// <param name="text">
        /// The line text.
        /// </param>
        /// <param name="tokenClass">
        /// The class of the token.
        /// </param>
        /// <param name="location">
        /// The location of the preprocessor in the code.
        /// </param>
        /// <param name="parent">
        /// The parent code part.
        /// </param>
        /// <param name="generated">
        /// Indicates whether the preprocessor lies within a block of generated code.
        /// </param>
        internal Preprocessor(string text, CsTokenClass tokenClass, CodeLocation location, Reference<ICodePart> parent, bool generated)
            : base(text, CsTokenType.PreprocessorDirective, tokenClass, location, parent, generated)
        {
            Param.AssertNotNull(text, "text");
            Param.AssertNotNull(tokenClass, "tokenClass");
            Param.AssertNotNull(location, "location");
            Param.AssertNotNull(parent, "parent");
            Param.Ignore(generated);

            // Extract the type of the preprocessor statement.
            int startIndex = 0;
            while (true)
            {
                if (text[startIndex] == '#')
                {
                    break;
                }

                ++startIndex;
            }

            // Extract the name.
            string name = string.Empty;
            int index = startIndex;
            while (index + 1 < text.Length)
            {
                if (!char.IsLetter(text[index + 1]))
                {
                    break;
                }

                ++index;
            }

            if (index > startIndex)
            {
                name = text.Substring(startIndex + 1, index - startIndex);
            }

            this.preprocessorType = name;
        }
        /// <summary>
        /// Initializes a new instance of the CsToken class.
        /// </summary>
        /// <param name="text">
        /// The token string.
        /// </param>
        /// <param name="tokenType">
        /// The token type.
        /// </param>
        /// <param name="tokenClass">
        /// The token class.
        /// </param>
        /// <param name="location">
        /// The location of the token within the code document.
        /// </param>
        /// <param name="parent">
        /// References the parent code part.
        /// </param>
        /// <param name="generated">
        /// True if the token is inside of a block of generated code.
        /// </param>
        internal CsToken(string text, CsTokenType tokenType, CsTokenClass tokenClass, CodeLocation location, Reference<ICodePart> parent, bool generated)
        {
            Param.AssertNotNull(text, "text");
            Param.Ignore(tokenType);
            Param.Ignore(tokenClass);
            Param.Ignore(location);
            Param.AssertNotNull(parent, "parent");
            Param.Ignore(generated);

            this.text = text;
            this.tokenType = tokenType;
            this.tokenClass = tokenClass;
            this.location = location;
            this.parent = parent;
            this.generated = generated;
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the TypeToken class.
        /// </summary>
        /// <param name="childTokens">
        /// The list of child tokens that form the token.
        /// </param>
        /// <param name="location">
        /// The location of the token in the code.
        /// </param>
        /// <param name="parent">
        /// The parent of the token.
        /// </param>
        /// <param name="tokenClass">
        /// The token class.
        /// </param>
        /// <param name="generated">
        /// True if the token is inside of a block of generated code.
        /// </param>
        internal TypeToken(MasterList <CsToken> childTokens, CodeLocation location, Reference <ICodePart> parent, CsTokenClass tokenClass, bool generated)
            : base(CsTokenType.Other, tokenClass, location, parent, generated)
        {
            Param.AssertNotNull(childTokens, "childTokens");
            Param.AssertNotNull(location, "location");
            Param.AssertNotNull(parent, "parent");
            Param.AssertNotNull(tokenClass, "tokenClass");
            Param.Ignore(generated);

            this.childTokens = childTokens;
        }
示例#8
0
 internal TypeToken(MasterList<CsToken> childTokens, CodeLocation location, CsTokenClass tokenClass, bool generated)
     : base(CsTokenType.Other, tokenClass, location, generated)
 {
     this.childTokens = childTokens;
 }