예제 #1
0
 public ANTLRMessage([NotNull] ErrorType errorType, [Nullable] Exception e, IToken offendingToken, params object[] args)
 {
     this.errorType = errorType;
     this.e = e;
     this.args = args;
     this.offendingToken = offendingToken;
 }
예제 #2
0
 public GrammarSemanticsMessage(ErrorType etype,
                                string fileName,
                                IToken offendingToken,
                                params object[] args)
     : base(etype, offendingToken, args)
 {
     this.fileName = fileName;
     if (offendingToken != null)
     {
         line = offendingToken.Line;
         charPosition = offendingToken.CharPositionInLine;
     }
 }
예제 #3
0
 public GrammarSyntaxMessage(ErrorType etype,
                             string fileName,
                             IToken offendingToken,
                             RecognitionException antlrException,
                             params object[] args)
     : base(etype, antlrException, offendingToken, args)
 {
     this.fileName = fileName;
     this.offendingToken = offendingToken;
     if (offendingToken != null)
     {
         line = offendingToken.Line;
         charPosition = offendingToken.CharPositionInLine;
     }
 }
예제 #4
0
 public ToolMessage(ErrorType errorType, Exception e, params object[] args)
     : base(errorType, e, new CommonToken(TokenTypes.Invalid), args)
 {
 }
예제 #5
0
 public ToolMessage(ErrorType errorType)
     : base(errorType)
 {
 }
예제 #6
0
 public virtual void Panic(ErrorType errorType, params object[] args)
 {
     ToolMessage msg = new ToolMessage(errorType, args);
     Template msgST = GetMessageTemplate(msg);
     string outputMsg = msgST.Render();
     if (FormatWantsSingleLineMessage())
     {
         outputMsg = outputMsg.Replace('\n', ' ');
     }
     Panic(outputMsg);
 }
예제 #7
0
        // S U P P O R T  C O D E

        public virtual void Emit(ErrorType etype, ANTLRMessage msg)
        {
            var severity = etype.severity;
            if (severity == ErrorSeverity.WARNING_ONE_OFF || severity == ErrorSeverity.WARNING)
            {
                if (severity == ErrorSeverity.WARNING || !errorTypes.Contains(etype))
                {
                    warnings++;
                    tool.Warning(msg);
                }
            }
            else if (severity == ErrorSeverity.ERROR_ONE_OFF || severity == ErrorSeverity.ERROR)
            {
                if (severity == ErrorSeverity.ERROR || !errorTypes.Contains(etype))
                {
                    errors++;
                    tool.Error(msg);
                }
            }

            errorTypes.Add(etype);
        }
예제 #8
0
        public virtual void GrammarError(ErrorType etype,
                                 string fileName,
                                 Antlr.Runtime.IToken token,
                                 params object[] args)
        {
            ANTLRMessage msg = new GrammarSemanticsMessage(etype, fileName, token, args);
            Emit(etype, msg);

        }
예제 #9
0
 public virtual void ToolError(ErrorType errorType, Exception e, params object[] args)
 {
     ToolMessage msg = new ToolMessage(errorType, e, args);
     Emit(errorType, msg);
 }
예제 #10
0
 /**
  * Raise a predefined message with some number of parameters for the StringTemplate but for which there
  * is no location information possible.
  * @param errorType The Message Descriptor
  * @param args The arguments to pass to the StringTemplate
  */
 public virtual void ToolError(ErrorType errorType, params object[] args)
 {
     ToolError(errorType, null, args);
 }
예제 #11
0
 public virtual void SyntaxError(ErrorType etype,
                                string fileName,
                                Antlr.Runtime.IToken token,
                                Antlr.Runtime.RecognitionException antlrException,
                                params object[] args)
 {
     ANTLRMessage msg = new GrammarSyntaxMessage(etype, fileName, token, antlrException, args);
     Emit(etype, msg);
 }
예제 #12
0
 public override void GrammarError(ErrorType etype, Antlr.Runtime.IToken token, params object[] args)
 {
     tool.errMgr.GrammarError(etype, SourceName, token, args);
 }