private void ShowCalltip() { FunctionCall fc = FunctionCall.Parse(m_source, m_autoCompleteData, CurrentPos); if (fc != null) { m_calltipFuncion = fc; CallTip.Show(fc.CalltipString, fc.HighLightStart, fc.HighLightEnd); } else { CallTip.Hide(); } }
// Public Methods (2) public static FunctionCall Parse(IntelluaSource source, AutoCompleteData data, int pos) { VariableManager variables = data.Variables; const string luaOperators = "+-*/^%<>=~"; int paramIndex = 0; Byte[] str = source.RawText; bool running = true; while (pos > 0) { char c = Convert.ToChar(str[pos]); if (c == 0 || char.IsWhiteSpace(Convert.ToChar(str[pos])) || !Parser.isCode(source, pos)) { pos--; continue; } if (c == ',') { paramIndex++; pos--; break; } if (c == '(') { running = false; break; } break; } MemberChain chain = MemberChain.ParseBackward(source, pos); while (chain.Elements.Count != 0 && running) { pos = chain.StartPos; while (pos > 0 && pos < str.Length) { if (char.IsWhiteSpace(Convert.ToChar(str[pos])) || !Parser.isCode(source, pos)) { pos--; continue; } if (str[pos] == ',') { paramIndex++; pos--; break; } if (luaOperators.Contains(Convert.ToChar(str[pos]))) { pos--; break; } if (str[pos] == '(') { running = false; break; } return(null); } if (pos <= 0) { return(null); } chain = MemberChain.ParseBackward(source, pos); if (chain.StartPos == -1) { break; } } while (pos > 0 && pos < str.Length) { if (char.IsWhiteSpace(Convert.ToChar(str[pos])) || !Parser.isCode(source, pos)) { pos--; continue; } if (str[pos] == '(') { chain = MemberChain.ParseBackward(source, pos - 1); chain.getType(data, true); if (chain.LastFunction == null) { return(null); } FunctionCall fc = new FunctionCall(); fc.m_func = chain.LastFunction; fc.ParamIndex = paramIndex; fc.update(); return(fc); } break; } return(null); }
// Public Methods (2) public static FunctionCall Parse(IntelluaSource source, AutoCompleteData data, int pos) { VariableManager variables = data.Variables; const string luaOperators = "+-*/^%<>=~"; int paramIndex = 0; Byte[] str = source.RawText; bool running = true; while (pos > 0) { char c = Convert.ToChar(str[pos]); if (c == 0 || char.IsWhiteSpace(Convert.ToChar(str[pos])) || !Parser.isCode(source, pos)) { pos--; continue; } if (c == ',') { paramIndex++; pos--; break; } if (c == '(') { running = false; break; } break; } MemberChain chain = MemberChain.ParseBackward(source, pos); while (chain.Elements.Count != 0 && running) { pos = chain.StartPos; while (pos > 0 && pos < str.Length) { if (char.IsWhiteSpace(Convert.ToChar(str[pos])) || !Parser.isCode(source, pos)) { pos--; continue; } if (str[pos] == ',') { paramIndex++; pos--; break; } if (luaOperators.Contains(Convert.ToChar(str[pos]))) { pos--; break; } if (str[pos] == '(') { running = false; break; } return null; } if (pos <= 0) return null; chain = MemberChain.ParseBackward(source, pos); if (chain.StartPos == -1) break; } while (pos > 0 && pos < str.Length) { if (char.IsWhiteSpace(Convert.ToChar(str[pos])) || !Parser.isCode(source, pos)) { pos--; continue; } if (str[pos] == '(') { chain = MemberChain.ParseBackward(source, pos - 1); chain.getType(data, true); if (chain.LastFunction == null) return null; FunctionCall fc = new FunctionCall(); fc.m_func = chain.LastFunction; fc.ParamIndex = paramIndex; fc.update(); return fc; } break; } return null; }