Exemplo n.º 1
0
        /// <summary>
        /// Parser for TextChars
        /// </summary>
        /// <returns>Parsed TextChars as String</returns>
        public String ParseTextChars()
        {
            StringBuilder stringBuilder = new StringBuilder();

            while (EmbeddingTokenStream.HasNext() && EmbeddingTokenStream.Peek(1).GetType() == TokenType.TEXT)
            {   //Parse all text tokens until different type found
                CurrentToken = EmbeddingTokenStream.NextToken();
                stringBuilder.Append(CurrentToken.GetValue().ToString());
            }

            return(stringBuilder.ToString());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Get NextToken and verify if it exists
 /// </summary>
 /// <param name="name">Name of expected token</param>
 /// <param name="syntax">Syntax of expected token</param>
 /// <returns>True if new token found, otherwise false</returns>
 protected bool NextToken(String name, String syntax)
 {
     if (TokenStream.HasNext())
     {
         CurrentToken = TokenStream.NextToken();
         return(true);
     }
     else
     {
         //Unexpected token
         throw new UnexpectedToken("Unexpected token found:", CurrentToken.GetValue().ToString(), CurrentToken.GetLine());
     }
 }