public override string VisitPlugin_attribute([NotNull] LogstashconfigParser.Plugin_attributeContext context)
        {
            //参数名字
            var paraname = context.IDENTIFIER().GetText();
            //参数结果
            var paravalue = context.plugin_attribute_value().GetText();

            ParaItem item = new ParaItem()
            {
                Name = paraname
            };

            item.IsArray = paravalue.Contains("[") && paravalue.Contains("]");
            item.IsHash  = paravalue.Contains("=>");
            if (item.IsArray)
            {
                item.Values = new List <string>(paravalue.Replace("[", "").Replace("]", "").Replace("\"", "").Split(','));
            }
            else if (item.IsHash)
            {
                //TODO
                //Hashtable
            }
            else
            {
                item.Values = new List <string>()
                {
                    paravalue
                };
            }
            //获取类型

            var plug = Config.Plugins[curplugtype].LastOrDefault();

            if (plug.Params == null)
            {
                plug.Params = new Dictionary <string, ParaItem>();
            }
            if (!plug.Params.ContainsKey(paraname))
            {
                plug.Params.Add(paraname, item);
            }

            return(base.VisitPlugin_attribute(context));
        }
	/// <summary>
	/// Visit a parse tree produced by <see cref="LogstashconfigParser.plugin_attribute"/>.
	/// <para>
	/// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
	/// on <paramref name="context"/>.
	/// </para>
	/// </summary>
	/// <param name="context">The parse tree.</param>
	/// <return>The visitor result.</return>
	public virtual Result VisitPlugin_attribute([NotNull] LogstashconfigParser.Plugin_attributeContext context) { return VisitChildren(context); }
Exemple #3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="LogstashconfigParser.plugin_attribute"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitPlugin_attribute([NotNull] LogstashconfigParser.Plugin_attributeContext context)
 {
 }