2 // The ecmaspec provider is for ECMA specifications
5 // John Luke (jluke@cfl.rr.com)
6 // Ben Maurer (bmaurer@users.sourceforge.net)
9 // mono assembler.exe --ecmaspec DIRECTORY --out name
17 using System.Xml.Linq;
18 using System.Collections.Generic;
20 using Lucene.Net.Index;
21 using Lucene.Net.Documents;
26 namespace Monodoc.Providers
28 public class EcmaProvider : Provider
30 HashSet<string> directories = new HashSet<string> ();
32 public EcmaProvider ()
36 public EcmaProvider (string baseDir)
38 AddDirectory (baseDir);
41 public void AddDirectory (string directory)
43 if (string.IsNullOrEmpty (directory))
44 throw new ArgumentNullException ("directory");
46 directories.Add (directory);
49 public override void PopulateTree (Tree tree)
51 var storage = tree.HelpSource.Storage;
52 var nsSummaries = new Dictionary<string, XElement> ();
55 foreach (var asm in directories) {
56 var indexFilePath = Path.Combine (asm, "index.xml");
57 if (!File.Exists (indexFilePath)) {
58 Console.Error.WriteLine ("Warning: couldn't process directory `{0}' as it has no index.xml file", asm);
62 EcmaDoc.PopulateTreeFromIndexFile (indexFilePath, EcmaHelpSource.EcmaPrefix, tree, storage, nsSummaries, _ => resID++.ToString ());
65 foreach (var summary in nsSummaries)
66 storage.Store ("xml.summary." + summary.Key, summary.Value.ToString ());
68 var masterSummary = new XElement ("elements",
70 .SelectMany (d => Directory.EnumerateFiles (d, "ns-*.xml"))
71 .Select (ExtractNamespaceSummary));
72 storage.Store ("mastersummary.xml", masterSummary.ToString ());
75 XElement ExtractNamespaceSummary (string nsFile)
77 using (var reader = XmlReader.Create (nsFile)) {
78 reader.ReadToFollowing ("Namespace");
79 var name = reader.GetAttribute ("Name");
80 var summary = reader.ReadToFollowing ("summary") ? XElement.Load (reader.ReadSubtree ()) : new XElement ("summary");
81 var remarks = reader.ReadToFollowing ("remarks") ? XElement.Load (reader.ReadSubtree ()) : new XElement ("remarks");
83 return new XElement ("namespace",
84 new XAttribute ("ns", name ?? string.Empty),
90 public override void CloseTree (HelpSource hs, Tree tree)
93 AddExtensionMethods (hs);
96 void AddEcmaXml (HelpSource hs)
98 var xmls = directories
99 .SelectMany (Directory.EnumerateDirectories) // Assemblies
100 .SelectMany (Directory.EnumerateDirectories) // Namespaces
101 .SelectMany (Directory.EnumerateFiles)
102 .Where (f => f.EndsWith (".xml")); // Type XML files
105 foreach (var xml in xmls)
106 using (var file = File.OpenRead (xml))
107 hs.Storage.Store ((resID++).ToString (), file);
110 void AddImages (HelpSource hs)
112 var imgs = directories
113 .SelectMany (Directory.EnumerateDirectories)
114 .Select (d => Path.Combine (d, "_images"))
115 .Where (Directory.Exists)
116 .SelectMany (Directory.EnumerateFiles);
118 foreach (var img in imgs)
119 using (var file = File.OpenRead (img))
120 hs.Storage.Store (Path.GetFileName (img), file);
123 void AddExtensionMethods (HelpSource hs)
125 var extensionMethods = directories
126 .SelectMany (Directory.EnumerateDirectories)
127 .Select (d => Path.Combine (d, "index.xml"))
130 using (var file = File.OpenRead (f)) {
131 var reader = XmlReader.Create (file);
132 reader.ReadToFollowing ("ExtensionMethods");
133 return reader.ReadInnerXml ();
136 .DefaultIfEmpty (string.Empty);
138 hs.Storage.Store ("ExtensionMethods.xml",
139 "<ExtensionMethods>" + extensionMethods.Aggregate (string.Concat) + "</ExtensionMethods>");
142 IEnumerable<string> GetEcmaXmls ()
145 .SelectMany (Directory.EnumerateDirectories) // Assemblies
146 .SelectMany (Directory.EnumerateDirectories) // Namespaces
147 .SelectMany (Directory.EnumerateFiles)
148 .Where (f => f.EndsWith (".xml")); // Type XML files
152 public class EcmaHelpSource : HelpSource
154 internal const string EcmaPrefix = "ecma:";
155 LRUCache<string, Node> cache = new LRUCache<string, Node> (4);
157 public EcmaHelpSource (string base_file, bool create) : base (base_file, create)
161 protected EcmaHelpSource () : base ()
165 protected override string UriPrefix {
171 public override bool CanHandleUrl (string url)
173 if (url.Length > 2 && url[1] == ':') {
186 return base.CanHandleUrl (url);
189 // Clean the extra paramers in the id
190 public override Stream GetHelpStream (string id)
192 var idParts = id.Split ('?');
193 var name = idParts[0];
195 name = "mastersummary.xml";
196 return base.GetHelpStream (name);
199 public override Stream GetCachedHelpStream (string id)
201 var idParts = id.Split ('?');
202 return base.GetCachedHelpStream (idParts[0]);
205 public override DocumentType GetDocumentTypeForId (string id)
207 return DocumentType.EcmaXml;
210 public override string GetPublicUrl (Node node)
212 string url = string.Empty;
213 var type = EcmaDoc.GetNodeType (node);
214 //Console.WriteLine ("GetPublicUrl {0} : {1} [{2}]", node.Element, node.Caption, type.ToString ());
216 case EcmaNodeType.Namespace:
217 return node.Element; // A namespace node has already a well formated internal url
218 case EcmaNodeType.Type:
219 return MakeTypeNodeUrl (node);
220 case EcmaNodeType.Meta:
221 return MakeTypeNodeUrl (GetNodeTypeParent (node)) + GenerateMetaSuffix (node);
222 case EcmaNodeType.Member:
223 var typeChar = EcmaDoc.GetNodeMemberTypeChar (node);
224 var parentNode = GetNodeTypeParent (node);
225 var typeNode = MakeTypeNodeUrl (parentNode).Substring (2);
226 return typeChar + ":" + typeNode + MakeMemberNodeUrl (typeChar, node);
232 string MakeTypeNodeUrl (Node node)
234 // A Type node has a Element property of the form: 'ecma:{number}#{typename}/'
235 var hashIndex = node.Element.IndexOf ('#');
236 var typeName = node.Element.Substring (hashIndex + 1, node.Element.Length - hashIndex - 2);
237 return "T:" + node.Parent.Caption + '.' + typeName.Replace ('.', '+');
240 string MakeMemberNodeUrl (char typeChar, Node node)
242 // We clean inner type ctor name which may contain the outer type name
243 var caption = node.Caption;
245 // Sanitize constructor caption of inner types
246 if (typeChar == 'C') {
248 for (int i = 0; i < caption.Length && caption[i] != '('; i++)
249 lastDot = caption[i] == '.' ? i : lastDot;
250 return lastDot == -1 ? '.' + caption : caption.Substring (lastDot);
253 /* We handle type conversion operator by checking if the name contains " to "
254 * (as in 'foo to bar') and we generate a corresponding conversion signature
256 if (typeChar == 'O' && caption.IndexOf (" to ") != -1) {
257 var parts = caption.Split (' ');
258 return "." + node.Parent.Caption + "(" + parts[0] + ", " + parts[2] + ")";
261 /* The goal here is to treat method which are explicit interface definition
262 * such as 'void IDisposable.Dispose ()' for which the caption is a dot
263 * expression thus colliding with the ecma parser.
264 * If the first non-alpha character in the caption is a dot then we have an
265 * explicit member implementation (we assume the interface has namespace)
267 var firstNonAlpha = caption.FirstOrDefault (c => !char.IsLetterOrDigit (c));
268 if (firstNonAlpha == '.')
269 return "$" + caption;
271 return "." + caption;
274 Node GetNodeTypeParent (Node node)
276 // Type nodes are always at level 2 so we just need to get there
277 while (node != null && node.Parent != null && !node.Parent.Parent.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase))
282 string GenerateMetaSuffix (Node node)
284 string suffix = string.Empty;
285 // A meta node has always a type element to begin with
286 while (EcmaDoc.GetNodeType (node) != EcmaNodeType.Type) {
287 suffix = '/' + node.Element + suffix;
293 public override string GetInternalIdForUrl (string url, out Node node, out Dictionary<string, string> context)
295 var id = string.Empty;
299 if (!url.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase)) {
300 node = MatchNode (url);
303 id = node.GetInternalUrl ();
307 id = GetInternalIdForInternalUrl (id, out hash);
308 context = EcmaDoc.GetContextForEcmaNode (hash, SourceID.ToString (), node);
313 public string GetInternalIdForInternalUrl (string internalUrl, out string hash)
315 var id = internalUrl;
316 if (id.StartsWith (UriPrefix, StringComparison.OrdinalIgnoreCase))
317 id = id.Substring (UriPrefix.Length);
318 else if (id.StartsWith ("N:", StringComparison.OrdinalIgnoreCase))
319 id = "xml.summary." + id.Substring ("N:".Length);
321 var hashIndex = id.IndexOf ('#');
323 if (hashIndex != -1) {
324 hash = id.Substring (hashIndex + 1);
325 id = id.Substring (0, hashIndex);
331 public override Node MatchNode (string url)
334 if ((node = cache.Get (url)) == null) {
335 node = EcmaDoc.MatchNodeWithEcmaUrl (url, Tree);
337 cache.Put (url, node);
342 public override void PopulateIndex (IndexMaker index_maker)
344 foreach (Node ns_node in Tree.RootNode.ChildNodes){
345 foreach (Node type_node in ns_node.ChildNodes){
346 string typename = type_node.Caption.Substring (0, type_node.Caption.IndexOf (' '));
347 string full = ns_node.Caption + "." + typename;
349 string doc_tag = GetKindFromCaption (type_node.Caption);
350 string url = type_node.PublicUrl;
353 // Add MonoMac/MonoTouch [Export] attributes, those live only in classes
355 XDocument type_doc = null;
356 ILookup<string, XElement> prematchedMembers = null;
357 bool hasExports = doc_tag == "Class" && (ns_node.Caption.StartsWith ("MonoTouch") || ns_node.Caption.StartsWith ("MonoMac"));
361 var id = GetInternalIdForInternalUrl (type_node.GetInternalUrl (), out hash);
362 type_doc = XDocument.Load (GetHelpStream (id));
363 prematchedMembers = type_doc.Root.Element ("Members").Elements ("Member").ToLookup (n => (string)n.Attribute ("MemberName"), n => n);
364 } catch (Exception e) {
365 Console.WriteLine ("Problem processing {0} for MonoTouch/MonoMac exports\n\n{0}", e);
370 if (doc_tag == "Class" || doc_tag == "Structure" || doc_tag == "Interface"){
371 index_maker.Add (type_node.Caption, typename, url);
372 index_maker.Add (full + " " + doc_tag, full, url);
374 foreach (Node c in type_node.ChildNodes){
377 index_maker.Add (" constructors", typename+"0", url + "/C");
380 index_maker.Add (" fields", typename+"1", url + "/F");
383 index_maker.Add (" events", typename+"2", url + "/E");
386 index_maker.Add (" properties", typename+"3", url + "/P");
389 index_maker.Add (" methods", typename+"4", url + "/M");
392 index_maker.Add (" operators", typename+"5", url + "/O");
398 // Now repeat, but use a different sort key, to make sure we come after
399 // the summary data above, start the counter at 6
401 string keybase = typename + "6.";
403 foreach (Node c in type_node.ChildNodes){
404 var type = c.Caption[0];
406 foreach (Node nc in c.ChildNodes) {
407 string res = nc.Caption;
408 string nurl = nc.PublicUrl;
411 if (hasExports && (type == 'C' || type == 'M' || type == 'P')) {
413 var member = GetMemberFromCaption (type_doc, type == 'C' ? ".ctor" : res, false, prematchedMembers);
414 var exports = member.Descendants ("AttributeName").Where (a => a.Value.Contains ("Foundation.Export"));
415 foreach (var exportNode in exports) {
416 var parts = exportNode.Value.Split ('"');
417 if (parts.Length != 3) {
418 Console.WriteLine ("Export attribute not found or not usable in {0}", exportNode);
420 var export = parts[1];
421 index_maker.Add (export + " selector", export, nurl);
424 } catch (Exception e) {
425 Console.WriteLine ("Problem processing {0}/{1} for MonoTouch/MonoMac exports\n\n{2}", nurl, res, e);
433 index_maker.Add (String.Format ("{0}.{1} field", typename, res),
434 keybase + res, nurl);
435 index_maker.Add (String.Format ("{0} field", res), res, nurl);
438 index_maker.Add (String.Format ("{0}.{1} event", typename, res),
439 keybase + res, nurl);
440 index_maker.Add (String.Format ("{0} event", res), res, nurl);
443 index_maker.Add (String.Format ("{0}.{1} property", typename, res),
444 keybase + res, nurl);
445 index_maker.Add (String.Format ("{0} property", res), res, nurl);
448 index_maker.Add (String.Format ("{0}.{1} method", typename, res),
449 keybase + res, nurl);
450 index_maker.Add (String.Format ("{0} method", res), res, nurl);
453 index_maker.Add (String.Format ("{0}.{1} operator", typename, res),
454 keybase + res, nurl);
459 } else if (doc_tag == "Enumeration"){
461 // Enumerations: add the enumeration values
463 index_maker.Add (type_node.Caption, typename, url);
464 index_maker.Add (full + " " + doc_tag, full, url);
466 // Now, pull the values.
468 var id = GetInternalIdForInternalUrl (type_node.GetInternalUrl (), out hash);
469 var xdoc = XDocument.Load (GetHelpStream (id));
473 var members = xdoc.Root.Element ("Members").Elements ("Members");
477 foreach (var member_node in members){
478 string enum_value = member_node.Attribute ("MemberName").Value;
479 string caption = enum_value + " value";
480 index_maker.Add (caption, caption, url);
482 } else if (doc_tag == "Delegate"){
483 index_maker.Add (type_node.Caption, typename, url);
484 index_maker.Add (full + " " + doc_tag, full, url);
491 public override void PopulateSearchableIndex (IndexWriter writer)
493 StringBuilder text = new StringBuilder ();
494 SearchableDocument searchDoc = new SearchableDocument ();
496 foreach (Node ns_node in Tree.RootNode.ChildNodes) {
497 foreach (Node type_node in ns_node.ChildNodes) {
498 string typename = type_node.Caption.Substring (0, type_node.Caption.IndexOf (' '));
499 string full = ns_node.Caption + "." + typename;
500 string url = type_node.PublicUrl;
501 string doc_tag = GetKindFromCaption (type_node.Caption);
503 var id = GetInternalIdForInternalUrl (type_node.GetInternalUrl (), out hash);
504 var xdoc = XDocument.Load (GetHelpStream (id));
507 if (string.IsNullOrEmpty (doc_tag))
510 // For classes, structures or interfaces add a doc for the overview and
511 // add a doc for every constructor, method, event, ...
512 // doc_tag == "Class" || doc_tag == "Structure" || doc_tag == "Interface"
513 if (doc_tag[0] == 'C' || doc_tag[0] == 'S' || doc_tag[0] == 'I') {
514 // Adds a doc for every overview of every type
515 SearchableDocument doc = searchDoc.Reset ();
516 doc.Title = type_node.Caption;
517 doc.HotText = typename;
519 doc.FullTitle = full;
521 var node_sel = xdoc.Root.Element ("Docs");
523 GetTextFromNode (node_sel, text);
524 doc.Text = text.ToString ();
527 GetExamples (node_sel, text);
528 doc.Examples = text.ToString ();
530 writer.AddDocument (doc.LuceneDoc);
531 var exportParsable = doc_tag[0] == 'C' && (ns_node.Caption.StartsWith ("MonoTouch") || ns_node.Caption.StartsWith ("MonoMac"));
533 //Add docs for contructors, methods, etc.
534 foreach (Node c in type_node.ChildNodes) { // c = Constructors || Fields || Events || Properties || Methods || Operators
535 if (c.Element == "*")
537 const float innerTypeBoost = 0.2f;
539 IEnumerable<Node> ncnodes = c.ChildNodes;
540 // The rationale is that we need to properly handle method overloads
541 // so for those method node which have children, flatten them
542 if (c.Caption == "Methods") {
544 .Where (n => n.ChildNodes == null || n.ChildNodes.Count == 0)
545 .Concat (ncnodes.Where (n => n.ChildNodes.Count > 0).SelectMany (n => n.ChildNodes));
546 } else if (c.Caption == "Operators") {
548 .Where (n => !n.Caption.EndsWith ("Conversion"))
549 .Concat (ncnodes.Where (n => n.Caption.EndsWith ("Conversion")).SelectMany (n => n.ChildNodes));
552 var prematchedMembers = xdoc.Root.Element ("Members").Elements ("Member").ToLookup (n => (string)n.Attribute ("MemberName"), n => n);
554 foreach (Node nc in ncnodes) {
555 XElement docsNode = null;
557 docsNode = GetDocsFromCaption (xdoc, c.Caption[0] == 'C' ? ".ctor" : nc.Caption, c.Caption[0] == 'O', prematchedMembers);
559 if (docsNode == null) {
560 Console.Error.WriteLine ("Problem: {0}", nc.PublicUrl);
564 SearchableDocument doc_nod = searchDoc.Reset ();
565 doc_nod.Title = LargeName (nc) + " " + EcmaDoc.EtcKindToCaption (c.Caption[0]);
566 doc_nod.FullTitle = ns_node.Caption + '.' + typename + "::" + nc.Caption;
567 doc_nod.HotText = string.Empty;
569 /* Disable constructors hottext indexing as it's often "polluting" search queries
570 because it has the same hottext than standard types */
571 if (c.Caption != "Constructors") {
572 //dont add the parameters to the hottext
573 int ppos = nc.Caption.IndexOf ('(');
574 doc_nod.HotText = ppos != -1 ? nc.Caption.Substring (0, ppos) : nc.Caption;
577 var urlnc = nc.PublicUrl;
581 GetTextFromNode (docsNode, text);
582 doc_nod.Text = text.ToString ();
585 GetExamples (docsNode, text);
586 doc_nod.Examples = text.ToString ();
588 Document lucene_doc = doc_nod.LuceneDoc;
589 lucene_doc.Boost = innerTypeBoost;
590 writer.AddDocument (lucene_doc);
592 // Objective-C binding specific parsing of [Export] attributes
593 if (exportParsable) {
595 var exports = docsNode.Parent.Elements ("Attributes").Elements ("Attribute").Elements ("AttributeName")
596 .Select (a => (string)a).Where (txt => txt.Contains ("Foundation.Export"));
598 foreach (var exportNode in exports) {
599 var parts = exportNode.Split ('"');
600 if (parts.Length != 3) {
601 Console.WriteLine ("Export attribute not found or not usable in {0}", exportNode);
605 var export = parts[1];
606 var export_node = searchDoc.Reset ();
607 export_node.Title = export + " Export";
608 export_node.FullTitle = ns_node.Caption + '.' + typename + "::" + export;
609 export_node.Url = urlnc;
610 export_node.HotText = export;
611 export_node.Text = string.Empty;
612 export_node.Examples = string.Empty;
613 lucene_doc = export_node.LuceneDoc;
614 lucene_doc.Boost = innerTypeBoost;
615 writer.AddDocument (lucene_doc);
617 } catch (Exception e){
618 Console.WriteLine ("Problem processing {0} for MonoTouch/MonoMac exports\n\n{0}", e);
623 // doc_tag == "Enumeration"
624 } else if (doc_tag[0] == 'E'){
625 var members = xdoc.Root.Element ("Members").Elements ("Member");
630 foreach (var member_node in members) {
631 string enum_value = (string)member_node.Attribute ("MemberName");
632 text.Append (enum_value);
634 GetTextFromNode (member_node.Element ("Docs"), text);
638 SearchableDocument doc = searchDoc.Reset ();
641 GetExamples (xdoc.Root.Element ("Docs"), text);
642 doc.Examples = text.ToString ();
644 doc.Title = type_node.Caption;
645 doc.HotText = (string)xdoc.Root.Attribute ("Name");
646 doc.FullTitle = full;
648 doc.Text = text.ToString();
649 writer.AddDocument (doc.LuceneDoc);
650 // doc_tag == "Delegate"
651 } else if (doc_tag[0] == 'D'){
652 SearchableDocument doc = searchDoc.Reset ();
653 doc.Title = type_node.Caption;
654 doc.HotText = (string)xdoc.Root.Attribute ("Name");
655 doc.FullTitle = full;
658 var node_sel = xdoc.Root.Element ("Docs");
661 GetTextFromNode (node_sel, text);
662 doc.Text = text.ToString();
665 GetExamples (node_sel, text);
666 doc.Examples = text.ToString();
668 writer.AddDocument (doc.LuceneDoc);
674 string GetKindFromCaption (string s)
676 int p = s.LastIndexOf (' ');
678 return s.Substring (p + 1);
682 // Extract the interesting text from the docs node
683 void GetTextFromNode (XElement n, StringBuilder sb)
685 // Include the text content of the docs
686 sb.AppendLine (n.Value);
687 foreach (var tag in n.Descendants ())
688 //include the url to which points the see tag and the name of the parameter
689 if ((tag.Name.LocalName.Equals ("see", StringComparison.Ordinal) || tag.Name.LocalName.Equals ("paramref", StringComparison.Ordinal))
690 && tag.HasAttributes)
691 sb.AppendLine ((string)tag.Attributes ().First ());
694 // Extract the code nodes from the docs
695 void GetExamples (XElement n, StringBuilder sb)
697 foreach (var code in n.Descendants ("code"))
698 sb.Append ((string)code);
701 // Extract a large name for the Node
702 static string LargeName (Node matched_node)
704 string[] parts = matched_node.GetInternalUrl ().Split('/', '#');
705 if (parts.Length == 3 && parts[2] != String.Empty) //List of Members, properties, events, ...
706 return parts[1] + ": " + matched_node.Caption;
707 else if(parts.Length >= 4) //Showing a concrete Member, property, ...
708 return parts[1] + "." + matched_node.Caption;
710 return matched_node.Caption;
713 XElement GetMemberFromCaption (XDocument xdoc, string caption, bool isOperator, ILookup<string, XElement> prematchedMembers)
717 var doc = xdoc.Root.Element ("Members").Elements ("Member");
720 // The first case are explicit and implicit conversion operators which are grouped specifically
721 if (caption.IndexOf (" to ") != -1) {
722 var convArgs = caption.Split (new[] { " to " }, StringSplitOptions.None);
724 .First (n => (AttrEq (n, "MemberName", "op_Explicit") || AttrEq (n, "MemberName", "op_Implicit"))
725 && ((string)n.Element ("ReturnValue").Element ("ReturnType")).Equals (convArgs[1], StringComparison.Ordinal)
726 && AttrEq (n.Element ("Parameters").Element ("Parameter"), "Type", convArgs[0]));
728 return doc.First (m => AttrEq (m, "MemberName", "op_" + caption));
732 TryParseCaption (caption, out name, out args);
734 if (!string.IsNullOrEmpty (name)) { // Filter member by name
735 var prematched = prematchedMembers[name];
736 doc = prematched.Any () ? prematched : doc.Where (m => AttrEq (m, "MemberName", name));
738 if (args != null && args.Count > 0) // Filter member by its argument list
739 doc = doc.Where (m => m.Element ("Parameters").Elements ("Parameter").Attributes ("Type").Select (a => (string)a).SequenceEqual (args));
744 XElement GetDocsFromCaption (XDocument xdoc, string caption, bool isOperator, ILookup<string, XElement> prematchedMembers)
746 return GetMemberFromCaption (xdoc, caption, isOperator, prematchedMembers).Element ("Docs");
749 // A simple stack-based parser to detect single type definition separated by commas
750 IEnumerable<string> ExtractArguments (string rawArgList)
752 var sb = new System.Text.StringBuilder ();
753 int genericDepth = 0;
756 for (int i = 0; i < rawArgList.Length; i++) {
757 char c = rawArgList[i];
760 if (genericDepth == 0 && arrayDepth == 0) {
761 yield return sb.ToString ();
782 yield return sb.ToString ();
785 void TryParseCaption (string caption, out string name, out IList<string> argList)
789 int parenIdx = caption.IndexOf ('(');
790 // In case of simple name, there is no need for processing
791 if (parenIdx == -1) {
795 name = caption.Substring (0, parenIdx);
796 // Now we gather the argument list if there is any
797 var rawArgList = caption.Substring (parenIdx + 1, caption.Length - parenIdx - 2); // Only take what's inside the parens
798 if (string.IsNullOrEmpty (rawArgList))
801 argList = ExtractArguments (rawArgList).Select (arg => arg.Trim ()).ToList ();
804 bool AttrEq (XElement element, string attributeName, string expectedValue)
806 return ((string)element.Attribute (attributeName)).Equals (expectedValue, StringComparison.Ordinal);