AddParserMessage() 공개 메소드

public AddParserMessage ( ParserErrorLevel level, SourceLocation location, string message ) : void
level ParserErrorLevel
location SourceLocation
message string
리턴 void
예제 #1
0
 public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
 {
     base.Init(context, treeNode);
     if (treeNode.Token.ValueString.Length > MaxLen)
     {
         context.AddParserMessage(ParserErrorLevel.Error, this.Span, "The maximum length is {0} character{1}.", MaxLen, MaxLen != 1 ? "s" : string.Empty);
     }
 }
예제 #2
0
        public void Init(ParsingContext context, ParseTreeNode parseNode, IGraphDS myGraphDS)
        {
            base.InitNode(context, parseNode, myGraphDS);
            _pluginManager.Discover();

            _componentName = parseNode.ChildNodes[1].Token.ValueString;

            if (base.CheckForComponent<IBenchmark>(_componentName, context, parseNode.ChildNodes[1].Token.Location))
            {
                if (parseNode.ChildNodes[2].ChildNodes.Count > 0)
                {
                    try
                    {
                        _iterations = Convert.ToInt64(parseNode.ChildNodes[2].ChildNodes[2].Token.ValueString);
                    }
                    catch(Exception)
                    {
                        context.AddParserMessage(ParserErrorLevel.Error, parseNode.ChildNodes[2].ChildNodes[2].Token.Location, "This is not a valid iteration count");
                        return;
                    }
                }

                Dictionary<String, String> options;
                if (parseNode.ChildNodes[3].ChildNodes.Count > 0)
                {
                    options = ((OptionsNode)(parseNode.ChildNodes[3].AstNode)).Options;
                }
                else
                {
                    options = new Dictionary<String, String>();
                }

                _benchmark = _pluginManager.GetAndInitializePlugin<IBenchmark>(
                    _componentName,
                    base.PreparePluginOptions(options, _graphDS));
            }
        }