public ConstantContext constant() { ConstantContext _localctx = new ConstantContext(Context, State); EnterRule(_localctx, 16, RULE_constant); int _la; try { EnterOuterAlt(_localctx, 1); { State = 108; _la = TokenStream.La(1); if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << STRING) | (1L << NUMBER) | (1L << BOOLEAN))) != 0))) { ErrorHandler.RecoverInline(this); } Consume(); } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return(_localctx); }
public ConstantContext constant() { ConstantContext _localctx = new ConstantContext(Context, State); EnterRule(_localctx, 14, RULE_constant); int _la; try { EnterOuterAlt(_localctx, 1); { State = 71; _la = TokenStream.LA(1); if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << PI) | (1L << EULER) | (1L << I))) != 0))) { ErrorHandler.RecoverInline(this); } else { ErrorHandler.ReportMatch(this); Consume(); } } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return(_localctx); }
public static QsiLiteralExpressionNode VisitConstant(ConstantContext context) { switch (context) { case StringLiteralConstantContext literalContext: { return(VisitLiteral(literalContext.stringLiteral())); } case NegativeDecimalLiteralConstantContext literalContext: { var literal = VisitLiteral(literalContext.decimalLiteral()); literal.Value = -(decimal)literal.Value; return(literal); } case PositiveDecimalLiteralConstantContext literalContext: { return(VisitLiteral(literalContext.decimalLiteral())); } case BooleanLiteralConstantContext literalContext: { return(VisitLiteral(literalContext.booleanLiteral())); } case RealLiteralConstantContext literalContext: { var node = new QsiLiteralExpressionNode { Value = decimal.Parse(literalContext.GetText()), Type = QsiDataType.Decimal }; PrimarSqlTree.PutContextSpan(node, literalContext); return(node); } case BitStringConstantContext _: { throw TreeHelper.NotSupportedFeature("Bit string"); } case NullConstantContext _: { return(new QsiLiteralExpressionNode { Value = null, Type = QsiDataType.Null }); } default: throw TreeHelper.NotSupportedTree(context); } }
public override Expression VisitConstant([NotNull] ConstantContext context) { if (!IsPredefined(context.index())) { throw new UnsupportedSyntaxException("User-defined constants", context.index().Start); } var predefinedTypeIndex = int.Parse(context.index().NUMBER().ToString()); var constantExpression = PredefinedObjects.GetConstantExpressionOfType(predefinedTypeIndex); Constants.Add(constantExpression); return(null); }
public ConstantContext constant() { ConstantContext _localctx = new ConstantContext(Context, State); EnterRule(_localctx, 14, RULE_constant); try { State = 69; switch (TokenStream.La(1)) { case BOOLEAN: _localctx = new BooleanConstantContext(_localctx); EnterOuterAlt(_localctx, 1); { State = 66; ((BooleanConstantContext)_localctx).Value = Match(BOOLEAN); } break; case NUMBER: _localctx = new NumberConstantContext(_localctx); EnterOuterAlt(_localctx, 2); { State = 67; ((NumberConstantContext)_localctx).Value = Match(NUMBER); } break; case STRING: _localctx = new StringConstantContext(_localctx); EnterOuterAlt(_localctx, 3); { State = 68; ((StringConstantContext)_localctx).Value = Match(STRING); } break; default: throw new NoViableAltException(this); } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return(_localctx); }
public void AddSchedule(string Time) { if (!String.IsNullOrEmpty(Time) && !String.IsNullOrEmpty(ConstantContext.GetConstant("Рассылки: настройки почтового ящика"))) { string[] time = Time.Split(':'); string[] _params = ConstantContext.GetConstant("Рассылки: настройки почтового ящика").Split(';'); foreach (string p in _params) { if (String.IsNullOrEmpty(p)) { return; } } RecurringJob.AddOrUpdate("Рассылка новостей", () => Mailing.SendNews(_params), time[1] + " " + time[0] + " * * *", TimeZoneInfo.FindSystemTimeZoneById("Belarus Standard Time")); } }
public static QsiExpressionNode VisitConstant(ConstantContext context) { string text = context.GetText(); QsiExpressionNode node; switch (context) { case LiteralStringContext literalString: { node = TreeHelper.CreateLiteral(literalString.s.raw); break; } case LiteralIntegerContext _: { node = TreeHelper.CreateLiteral(int.Parse(text)); break; } case LiteralFloatContext _: { node = TreeHelper.CreateLiteral(double.Parse(text)); break; } case LiteralBooleanContext _: { node = TreeHelper.CreateLiteral(bool.Parse(text)); break; } case LiteralHexnumberContext _: { node = TreeHelper.CreateLiteral(text, QsiDataType.Hexadecimal); break; } case LiteralPositiveNanContext _: { node = TreeHelper.CreateLiteral(double.NaN); break; } case LiteralNegativeNanContext _: { node = TreeHelper.CreateLiteral(-double.NaN); break; } case LiteralPositiveInfinityContext _: { node = TreeHelper.CreateLiteral(double.PositiveInfinity); break; } case LiteralNegativeInfinityContext _: { node = TreeHelper.CreateLiteral(double.NegativeInfinity); break; } default: { node = TreeHelper.CreateLiteral(text, QsiDataType.Raw); break; } } CqlTree.PutContextSpan(node, context); return(node); }
public StringConstantContext(ConstantContext context) { CopyFrom(context); }
public BooleanConstantContext(ConstantContext context) { CopyFrom(context); }
public NumberConstantContext(ConstantContext context) { CopyFrom(context); }
public virtual void CopyFrom(ConstantContext context) { base.CopyFrom(context); }
public PrimaryExpressionContext primaryExpression() { PrimaryExpressionContext _localctx = new PrimaryExpressionContext(Context, State); EnterRule(_localctx, 12, RULE_primaryExpression); try { int _alt; State = 112; switch (TokenStream.La(1)) { case Identifier: _localctx = new IdentifierContext(_localctx); EnterOuterAlt(_localctx, 1); { State = 101; Match(Identifier); } break; case Constant: _localctx = new ConstantContext(_localctx); EnterOuterAlt(_localctx, 2); { State = 102; Match(Constant); } break; case StringLiteral: _localctx = new StringLiteralContext(_localctx); EnterOuterAlt(_localctx, 3); { State = 104; ErrorHandler.Sync(this); _alt = 1; do { switch (_alt) { case 1: { { State = 103; Match(StringLiteral); } } break; default: throw new NoViableAltException(this); } State = 106; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream,6,Context); } while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber ); } break; case LeftParen: _localctx = new ParenthesizedContext(_localctx); EnterOuterAlt(_localctx, 4); { State = 108; Match(LeftParen); State = 109; expression(); State = 110; Match(RightParen); } break; default: throw new NoViableAltException(this); } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return _localctx; }
public ConstantContext constant() { ConstantContext _localctx = new ConstantContext(_ctx, State); EnterRule(_localctx, 246, RULE_constant); int _la; try { EnterOuterAlt(_localctx, 1); { State = 1334; _la = _input.La(1); if ( !(((((_la - 126)) & ~0x3f) == 0 && ((1L << (_la - 126)) & ((1L << (CHARACTER_LITERAL - 126)) | (1L << (HEX_LITERAL - 126)) | (1L << (DECIMAL_LITERAL - 126)) | (1L << (OCTAL_LITERAL - 126)) | (1L << (FLOATING_POINT_LITERAL - 126)))) != 0)) ) { _errHandler.RecoverInline(this); } Consume(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.ReportError(this, re); _errHandler.Recover(this, re); } finally { ExitRule(); } return _localctx; }