Пример #1
0
        public IntegerLiteralLexeme(string value, IntegerStyle style, int lineNumber, int index) : base(lineNumber, index)
        {
            switch (style)
            {
            case IntegerStyle.Base10:
                Debug.Assert(NumberLiteralParser.TryParseDecimal(value, out _));
                Value = NumberLiteralParser.ParseDecimal(value);
                break;

            case IntegerStyle.Base16:
                Debug.Assert(NumberLiteralParser.TryParseHexadecimal(value, out _));
                Value = NumberLiteralParser.ParseHexadecimal(value);
                break;

            case IntegerStyle.Base2:
                Debug.Assert(NumberLiteralParser.TryParseBinary(value, out _));
                Value = NumberLiteralParser.ParseBinary(value);
                break;
            }
        }
Пример #2
0
 public RationalLiteralLexeme(string value, int lineNumber, int index) : base(lineNumber, index)
 {
     Debug.Assert(NumberLiteralParser.TryParseRational(value, out _));
     Value = NumberLiteralParser.ParseRational(value);
 }