public void Extension(string extender, string @base) { _logs.FindByName(@base) .Add(_provenance, "Extending with {0}".ToFormat(extender)); _logs.FindByName(extender) .Add(_provenance, "Extends {0}".ToFormat(@base)); _inner.Extension(extender, @base); }
/// <summary> /// Register an extension relationship between two assets /// </summary> /// <param name="base"></param> /// <returns></returns> public AssetsExpression Extends(string @base) { _registration.Extension(_assetName, @base); return(_parent); }
public void ReadLine(string text) { if (text.Trim().IsEmpty()) { return; } if (text.Trim().StartsWith("#")) { return; } var tokens = new Queue <string>(StringTokenizer.Tokenize(text.Replace(',', ' '))); if (tokens.Count == 1) { if (_readerAction == null) { throw new InvalidSyntaxException("Not enough tokens in the command line"); } _readerAction(tokens.First()); return; } _lastName = null; _readerAction = null; if (tokens.Count() < 3) { throw new InvalidSyntaxException("Not enough tokens in the command line"); } var key = tokens.Dequeue(); var verb = tokens.Dequeue(); if (key == "ordered") { handleOrderedSet(tokens, verb); return; } // TODO -- time for something more sophisticated here if (key == "apply") { readPolicy(tokens, verb); return; } if (key == "combine") { readCombination(tokens, verb); return; } switch (verb) { case "is": if (tokens.Count > 1) { throw new InvalidSyntaxException("Only one name can appear on the right side of the 'is' verb"); } _registration.Alias(tokens.Dequeue(), key); break; case "requires": tokens.Each(name => _registration.Dependency(key, name)); break; case "extends": if (tokens.Count > 1) { throw new InvalidSyntaxException("Only one name can appear on the right side of the 'extends' verb"); } _registration.Extension(key, tokens.Single()); break; case "includes": tokens.Each(name => _registration.AddToSet(key, name)); break; case "preceeds": tokens.Each(name => _registration.Preceeding(key, name)); break; default: string message = "'{0}' is an invalid verb".ToFormat(verb); throw new InvalidSyntaxException(message); } }