private void ParseDirectives(RootCommandNode parent) { while (More()) { var token = CurrentToken; if (token.Type != TokenType.Directive) { return; } var withoutBrackets = token.Value.Substring(1, token.Value.Length - 2); var keyAndValue = withoutBrackets.Split(new[] { ':' }, 2); var key = keyAndValue[0]; var value = keyAndValue.Length == 2 ? keyAndValue[1] : null; var directiveNode = new DirectiveNode(token, parent, key, value); parent.AddChildNode(directiveNode); Advance(); } }
protected override void VisitDirectiveNode(DirectiveNode directiveNode) { _directives.Add(directiveNode.Name, directiveNode.Value); }