IndexOf() public method

public IndexOf ( char text ) : int
text char
return int
コード例 #1
0
ファイル: AutoComplete.cs プロジェクト: sonneveld/agscj
 private static bool IncrementIndexToSkipAnyComments(FastString script, ref int index)
 {
     if (index < script.Length - 1)
     {
         if ((script[index] == '/') && (script[index + 1] == '/'))
         {
             while ((script[index] != '\r') && (index < script.Length - 1))
             {
                 index++;
             }
         }
         if ((script[index] == '/') && (script[index + 1] == '*'))
         {
             index = script.IndexOf("*/", index + 2);
             if (index < 0)
             {
                 index = script.Length - 1;
                 return true;
             }
         }
     }
     return false;
 }
コード例 #2
0
ファイル: AutoComplete.cs プロジェクト: sonneveld/agscj
 private static void GoToNextLine(ref FastString script)
 {
     int indexOfNextLine = script.IndexOf("\r\n");
     if (indexOfNextLine < 0)
     {
         script = string.Empty;
     }
     else
     {
         script = script.Substring(indexOfNextLine + 2);
     }
 }
コード例 #3
0
ファイル: AutoComplete.cs プロジェクト: sonneveld/agscj
        private static bool AddFunctionDeclaration(List<ScriptFunction> functions, ref FastString script, string thisWord, AutoCompleteParserState state, bool isExtenderMethod)
        {
            bool succeeded = false;

            if ((state.LastWord.Length > 0) && (state.WordBeforeLast.Length > 0))
            {
                if (!DoesCurrentLineHaveToken(script, AUTO_COMPLETE_IGNORE))
                {
                    string functionName = state.LastWord;
                    string type = state.WordBeforeLast;
                    bool isPointer = false, isNoInherit = false;
                    bool isStatic = false, isStaticOnly = false;
                    bool isProtected = false;
                    if (type == "::")
                    {
                        functionName = state.WordBeforeWordBeforeLast + "::" + functionName;
                        type = (state.PreviousWords.Length > 3) ? state.PreviousWords[3] : "unknown";
                    }
                    if (type == "*")
                    {
                        isPointer = true;
                        type = state.WordBeforeWordBeforeLast;
                    }
                    if (state.DynamicArrayDefinition)
                    {
                        // get the type name and the []
                        type = state.WordBeforeWordBeforeLast + state.WordBeforeLast;
                    }
                    if (state.IsWordInPreviousList("static"))
                    {
                        isStatic = true;
                    }
                    if (state.IsWordInPreviousList("protected"))
                    {
                        isProtected = true;
                    }
                    if (DoesCurrentLineHaveToken(script, AUTO_COMPLETE_STATIC_ONLY))
                    {
                        isStaticOnly = true;
                    }
                    if (DoesCurrentLineHaveToken(script, AUTO_COMPLETE_NO_INHERIT))
                    {
                        isNoInherit = true;
                    }

                    int parameterListEndIndex = script.IndexOf(')');
                    if (parameterListEndIndex >= 0)
                    {
                        string parameterList = script.Substring(0, parameterListEndIndex);
                        script = script.Substring(parameterListEndIndex + 1);
                        ScriptFunction newFunc = new ScriptFunction(functionName, type, parameterList, state.InsideIfDefBlock, state.InsideIfNDefBlock, isPointer, isStatic, isStaticOnly, isNoInherit, isProtected, isExtenderMethod, state.CurrentScriptCharacterIndex - 1);
                        if (!string.IsNullOrEmpty(state.PreviousComment))
                        {
                            newFunc.Description = state.PreviousComment;
                            state.PreviousComment = null;
                        }
                        functions.Add(newFunc);
                        succeeded = true;
                    }
                    state.DynamicArrayDefinition = false;
                }
            }

            return succeeded;
        }
コード例 #4
0
ファイル: AutoComplete.cs プロジェクト: sonneveld/agscj
 private static bool DoesCurrentLineHaveToken(FastString script, string tokenToCheckFor)
 {
     int indexOfNextLine = script.IndexOf("\r\n");
     if (indexOfNextLine > 0)
     {
         if (script.Substring(0, indexOfNextLine).IndexOf(tokenToCheckFor) > 0)
         {
             return true;
         }
     }
     return false;
 }
コード例 #5
0
ファイル: AutoComplete.cs プロジェクト: CisBetter/ags
 private static bool IncrementIndexToSkipAnyComments(FastString script, ref int index)
 {
     while (index < script.Length - 1 && (script[index] == '/'))
     {
         if ((script[index + 1] == '/'))
         {
             index = script.IndexOf('\r', index + 2);
             if (index < 0)
             {
                 index = script.Length;
             }
         }
         else
         {
             if ((script[index + 1] == '*'))
             {
                 index = script.IndexOf("*/", index + 2);
                 if (index < 0)
                 {
                     index = script.Length;
                 }
             }
             else
             {
                 break;
             }
         }
     }
     return index == script.Length;
 }