Пример #1
0
 public void Resolve(VBAParser.OnErrorStmtContext context)
 {
     if (context.expression() == null)
     {
         return;
     }
     ResolveLabel(context.expression(), context.expression().GetText());
 }
        private static bool IsBranchingOnErrorGoToLabel(VBAParser.OnErrorStmtContext errorStmtCtxt)
        {
            var label = errorStmtCtxt.expression()?.GetText();

            if (string.IsNullOrEmpty(label))
            {
                return(false);
            }
            //The VBE will complain about labels other than:
            //1. Numerics less than int.MaxValue (VBA: 'Long' max value).  '0' returns false because it cause a branch
            //2. Or, Any alphanumeric string beginning with a letter (VBE or the Debugger will choke on special characters, spaces, etc).
            return(!(int.TryParse(label, out var numberLabel) && numberLabel <= 0));
        }
 public override void EnterOnErrorStmt(VBAParser.OnErrorStmtContext context)
 {
     CheckContext(context, context.expression());
     base.EnterOnErrorStmt(context);
 }