private NameValue eatAttr(TextProcessor textProcessor) { textProcessor.EatSpace(); if (textProcessor.End()) return null; // string attrValue = null; // string attrName = textProcessor.EatName(); textProcessor.EatSpace(); // if (textProcessor.EatChar('=')) { textProcessor.EatSpace(); char valueStartChar = textProcessor.Current(); if ((valueStartChar == '\"') || (valueStartChar == '\'')) { attrValue = textProcessor.EatQuoted(valueStartChar); } else { attrValue = textProcessor.EatNonSpace(); } } // return new NameValue() { Name = attrName, Value = attrValue }; }
private bool eatAttr(TextProcessor textProcessor) { // attr1="xxx yyy" attr2 = "yyy" // textProcessor.EatSpace(); if (textProcessor.End()) return false; // string attrValue = null; // string attrName = textProcessor.EatName(); if (string.IsNullOrEmpty(attrName)) return false; textProcessor.EatSpace(); // if (textProcessor.EatChar('=')) { textProcessor.EatSpace(); char valueStartChar = textProcessor.Current(); if ((valueStartChar == '\"') || (valueStartChar == '\'')) { attrValue = textProcessor.EatQuoted(valueStartChar); } else { attrValue = textProcessor.EatNonSpace(); } } // this.Attributes[attrName] = attrValue; // return true; }
private Parm eatParm(TextProcessor textProcessor) { // <@parm name = "xxx" type="xxx" description="xxxxxx" /> // textProcessor.EatSpace(); if (textProcessor.End()) return null; // if (!textProcessor.EatString("<@parm ", StringComparison.OrdinalIgnoreCase)) return null; textProcessor.EatSpace(); // Parm result = new Parm(); // while (!textProcessor.EatString("/>")) { NameValue attr = this.eatAttr(textProcessor); if (attr == null) break; // if (string.Equals(attr.Name, "name", StringComparison.OrdinalIgnoreCase)) result.Name = attr.Value; if (string.Equals(attr.Name, "type", StringComparison.OrdinalIgnoreCase)) result.Type = attr.Value; if (string.Equals(attr.Name, "description", StringComparison.OrdinalIgnoreCase)) result.Description = attr.Value; if (string.Equals(attr.Name, "default", StringComparison.OrdinalIgnoreCase)) result.Default = attr.Value; if (string.Equals(attr.Name, "optional", StringComparison.OrdinalIgnoreCase)) result.Optional = !string.Equals(attr.Value, "false", StringComparison.OrdinalIgnoreCase); // textProcessor.EatSpace(); } // return result; }