Example #1
0
 public virtual void Visit(RecordExpression expression)
 {
     VisitSubNodes(expression);
 }
Example #2
0
        /// <summary>
        /// Parse an RecordExpression
        /// </summary>
        /// <returns>Parsed Record Expression</returns>
        public RecordExpression ParseRecordExpression()
        {
            RecordExpression recordExpression = new RecordExpression();

            //Skip { token
            NextToken("{", "{key:value, key:value}", '{');

            while (TokenStream.HasNext())
            {   //Scan for key value pairs
                if(TokenStream.Peek(1).GetValue().ToString() == "}")
                {
                    break; //} marks end of stream
                }

                recordExpression.AddKeyValuePair(ParseKeyValuePair());

                if (TokenStream.HasNext() && TokenStream.Peek(1).GetValue().ToString() == ",")
                {
                    //Skip , token
                    NextToken(",", "{key:value, key:value}", ',');
                }
            }

            //Skip } token
            NextToken("}", "{key:value, key:value}", '}');

            return recordExpression;
        }