28
using System.Collections.Generic;
29
30
namespace Mono.Debugging.Client
32
33
public class FunctionBreakpoint : Breakpoint
34
public FunctionBreakpoint (string functionName, string language) : base (null, 1/*, 1*/)
35
public FunctionBreakpoint (string functionName, string language) : base (null, 1, 1)
36
37
FunctionName = functionName;
37
38
Language = language;
41
static bool SkipArrayRank (string text, ref int index, int endIndex)
45
while (index < endIndex) {
46
if ((c = text[index++]) == ']')
49
if (c != ',' && !char.IsWhiteSpace (c) && !char.IsDigit (c))
56
static bool SkipGenericArgs (string text, ref int index, int endIndex)
60
while (index < endIndex) {
61
if ((c = text[index++]) == '>')
65
if (!SkipGenericArgs (text, ref index, endIndex))
68
while (index < endIndex && !char.IsWhiteSpace (text[index]))
71
// the only chars allowed after a '>' are: '>', '[', and ','
72
if (">[,".IndexOf (text[index]) == -1)
74
} else if (c == '[') {
75
if (!SkipArrayRank (text, ref index, endIndex))
78
while (index < endIndex && !char.IsWhiteSpace (text[index]))
81
// the only chars allowed after a ']' are: '>', '[', and ','
82
if (">[,".IndexOf (text[index]) == -1)
84
} else if (c != '.' && c != '+' && c != ',' && !char.IsWhiteSpace (c) && !char.IsLetterOrDigit (c)) {
92
public static bool TryParseParameters (string text, int startIndex, int endIndex, out string[] paramTypes)
94
List<string> parsedParamTypes = new List<string> ();
95
int index = startIndex;
101
while (index < endIndex) {
102
while (char.IsWhiteSpace (text[index]))
106
while (index < endIndex) {
107
if ((c = text[index]) == ',')
113
if (!SkipGenericArgs (text, ref index, endIndex))
115
} else if (c == '[') {
116
if (!SkipArrayRank (text, ref index, endIndex))
121
parsedParamTypes.Add (text.Substring (start, index - start).TrimEnd ());
123
if (index < endIndex)
127
paramTypes = parsedParamTypes.ToArray ();
40
132
internal FunctionBreakpoint (XmlElement elem) : base (elem)
42
134
FunctionName = elem.GetAttribute ("function");
44
string s = elem.GetAttribute ("language");
45
if (string.IsNullOrEmpty (s))
136
string text = elem.GetAttribute ("language");
137
if (string.IsNullOrEmpty (text))
50
s = elem.GetAttribute ("params");
51
if (!string.IsNullOrEmpty (s))
52
ParamTypes = s.Split (new char [] { ',' });
142
if (elem.HasAttribute ("params")) {
145
text = elem.GetAttribute ("params").Trim ();
146
if (text.Length > 0 && TryParseParameters (text, 0, text.Length, out paramTypes))
147
ParamTypes = paramTypes;
149
ParamTypes = new string[0];
55
155
internal override XmlElement ToXml (XmlDocument doc)