AddParserMessage() public méthode

public AddParserMessage ( ParserErrorLevel level, SourceLocation location, string message ) : void
level ParserErrorLevel
location SourceLocation
message string
Résultat void
Exemple #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);
     }
 }
Exemple #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));
            }
        }