/// <summary> /// Create and initialize a new small integer literal node. /// </summary> /// <param name="parent">Parent node that defines this literal node.</param> /// <param name="token">Token defining the value of the literal node.</param> /// <param name="negativeSignToken">Optional negative sign token indicating a negative numeric value.</param> public SmallIntegerLiteralNode(ILiteralNodeParent parent, SmallIntegerToken token, NegativeSignToken negativeSignToken) : base(parent, token, negativeSignToken) { }
/// <summary> /// Create and initialize a new scaled decimal literal node. /// </summary> /// <param name="parent">Parent node that defines this literal node.</param> /// <param name="token">Token defining the value of the literal node.</param> /// <param name="negativeSignToken">Optional negative sign token indicating a negative numeric value.</param> protected internal ScaledDecimalLiteralNode(ILiteralNodeParent parent, ScaledDecimalToken token, NegativeSignToken negativeSignToken) : base(parent, token, negativeSignToken) { }
/// <summary> /// Create and initialize a new numeric literal node. /// </summary> /// <param name="parent">Parent node that defines this literal node.</param> /// <param name="token">Token defining the value of the literal node.</param> /// <param name="negativeSignToken">Optional negative sign token indicating a negative numeric value.</param> protected NumericLiteralNode(ILiteralNodeParent parent, TToken token, NegativeSignToken negativeSignToken) : base(parent, token) { this.NegativeSignToken = negativeSignToken; // OK with null. }
/// <summary> /// Create and initialize a new float literal node. /// </summary> /// <param name="parent">Parent node that defines this literal node.</param> /// <param name="token">Token defining the value of the literal node.</param> /// <param name="negativeSignToken">Optional negative sign token indicating a negative numeric value.</param> protected internal FloatDLiteralNode(ILiteralNodeParent parent, FloatDToken token, NegativeSignToken negativeSignToken) : base(parent, token, negativeSignToken) { }
/// <summary> /// Create and initialize a new float literal node. /// </summary> /// <param name="parent">Parent node that defines this literal node.</param> /// <param name="token">Token defining the value of the literal node.</param> /// <param name="negativeSignToken">Optional negative sign token indicating a negative numeric value.</param> protected FloatLiteralNode(ILiteralNodeParent parent, TToken token, NegativeSignToken negativeSignToken) : base(parent, token, negativeSignToken) { }
/// <summary> /// Create and initialize a new large integer literal node. /// </summary> /// <param name="parent">Parent node that defines this literal node.</param> /// <param name="token">Token defining the value of the literal node.</param> /// <param name="negativeSignToken">Optional negative sign token indicating a negative numeric value.</param> protected internal LargeIntegerLiteralNode(ILiteralNodeParent parent, LargeIntegerToken token, NegativeSignToken negativeSignToken) : base(parent, token, negativeSignToken) { }
protected virtual LiteralNode ParseNegativeNumericLiteralNode(ILiteralNodeParent parent, NegativeSignToken negativeSign) { // PARSE: <number> ::= integer | float | scaledDecimal Token token = this.GetNextTokenxx(Preference.NegativeSign); if (token is SmallIntegerToken) { return(new SmallIntegerLiteralNode(parent, (SmallIntegerToken)token, negativeSign)); } if (token is LargeIntegerToken) { return(new LargeIntegerLiteralNode(parent, (LargeIntegerToken)token, negativeSign)); } if (token is FloatEToken) { return(new FloatELiteralNode(parent, (FloatEToken)token, negativeSign)); } if (token is FloatDToken) { return(new FloatDLiteralNode(parent, (FloatDToken)token, negativeSign)); } if (token is ScaledDecimalToken) { return(new ScaledDecimalLiteralNode(parent, (ScaledDecimalToken)token, negativeSign)); } // We don't know what that is.... the negative sign token thrown away and lost :-/ this.ReportParserError(parent, SemanticErrors.UnrecognizedLiteral, token); this.ResidueToken = token; return(null); }
protected ByteArrayLiteralNode ParseByteArrayLiteral(ILiteralNodeParent parent, SpecialCharacterToken arrayToken, SpecialCharacterToken leftBracket) { // PARSE: <array literal> ::= '#[' <number literal>* ']' List <SmallIntegerLiteralNode> elements = new List <SmallIntegerLiteralNode>(); ByteArrayLiteralNode result = new ByteArrayLiteralNode(parent, arrayToken, leftBracket); // Process tokens inside the array ... while (true) { // ... get next token in the array ... Token token = this.GetNextTokenxx(Preference.NegativeSign); // Is this closing parenthesis? if (VseCompatibleParser.IsClosingByteArrayBracket(token)) { // Closing parenthesis ... done with the array, return litral array node. result.SetContents(elements, (SpecialCharacterToken)token); this.ResidueToken = null; return(result); } if (token is EofToken) { // Unfinished source code ... return result.SetContents(elements, null); this.ReportParserError(parent, "Missing literal byte array closing bracket.", token); this.ResidueToken = token; return(result); } // PARSE: <numeric liteal> if (token is SmallIntegerToken) { elements.Add(new SmallIntegerLiteralNode(result, (SmallIntegerToken)token, null)); } else if (token is NegativeSignToken) { NegativeSignToken negativeSign = (NegativeSignToken)token; token = this.GetNextTokenxx(Preference.NegativeSign); if (token is SmallIntegerToken) { elements.Add(new SmallIntegerLiteralNode(result, (SmallIntegerToken)token, negativeSign)); } else { this.ReportParserError(parent, "Unrecognized literal.", token); this.ResidueToken = token; result.SetContents(elements, null); return(result); } } else { this.ReportParserError(parent, "Unrecognized literal.", token); this.ResidueToken = token; result.SetContents(elements, null); return(result); } } }