Exemple #1
0
        private OfcToken CreateToken(OfcTokenType type, [CanBeNull] string data)
        {
#if CDUMP
            Console.WriteLine($"tkn: {type}; x: {_tokenLine}; y: {_tokenColumn}");
#endif
            return(new OfcToken(type, data, _tokenPosition, _tokenLine, _tokenColumn, _currentPosition - _tokenPosition));
        }
Exemple #2
0
        /// <summary>
        ///     Sets up the token with the specified type and payload as well es token positioning and sizing information.
        /// </summary>
        /// <param name="type">Type of the token.</param>
        /// <param name="payload">Payload of the token.</param>
        /// <param name="column">Column at which the token starts.</param>
        /// <param name="length">Length of the token in characters.</param>
        /// <param name="line">Line at which the token starts.</param>
        public OfcToken(OfcTokenType type, [CanBeNull] string payload, uint position, uint column, uint length, uint line)
        {
            Type    = type;
            Payload = payload;

            Position = position;
            Column   = column;
            Length   = length;
            Line     = line;
        }
Exemple #3
0
 private bool Expect(OfcTokenType type)
 {
     Ensure(1);
     return(_buffer[_position].Type == type);
 }
Exemple #4
0
 private OfcToken CreateToken(OfcTokenType type) => CreateToken(type, null);
Exemple #5
0
 /// <summary>
 ///     Sets up the token with the specified type and payload.
 /// </summary>
 /// <param name="type">Type of the token.</param>
 /// <param name="payload">Payload of the token.</param>
 public OfcToken(OfcTokenType type, [CanBeNull] string payload, uint position) : this(type, payload, position, 0, 0, 0)
 {
 }
Exemple #6
0
 /// <summary>
 ///     Sets up the token with the specified type the payload is asserted to be <c>null</c>.
 /// </summary>
 /// <param name="type">Type of the token.</param>
 public OfcToken(OfcTokenType type) : this(type, null, 0)
 {
 }