Example #1
0
        public string ReadNext(Context context)
        {
            token = new StringBuilder();

            for (int nextSymbol = context.Reader.Peek();
                 nextSymbol != -1;
                 nextSymbol = context.Reader.Peek())
            {
                if (nextSymbol == at)
                {
                    ProcessAt(context);
                    continue;
                }

                if (IsIdentifierOrKeywordSymbol(nextSymbol))
                {
                    token.Append(Convert.ToChar(context.Reader.Read()));
                    continue;
                }

                if (token.Length > 0)
                {
                    return(token.ToString());
                }

                context.Collect(context.Reader.Read());
            }
            return(null);
        }
Example #2
0
        private int FindGenericArgsCount(Context context)
        {
            int genericArgumentCount = 0;

            while (context.Reader.Peek() != '{' &&
                   context.Reader.Peek() != -1)
            {
                int currentSymbol = context.Reader.Read();
                switch (currentSymbol)
                {
                case '<':
                    genericArgumentCount = 1;
                    break;

                case '>':
                    return(genericArgumentCount);

                case ',':
                    genericArgumentCount++;
                    break;

                default:
                    context.Collect(currentSymbol);
                    break;
                }
            }
            return(genericArgumentCount);
        }
Example #3
0
 private void ProcessAt(Context context)
 {
     context.Reader.Read();
     if (IsIdentifierOrKeywordSymbol(context.Reader.Peek()))
     {
         token.Append(at);
     }
     else
     {
         context.Collect(at);
     }
 }