예제 #1
0
 public virtual void Visit(RecordExpression expression)
 {
     VisitSubNodes(expression);
 }
예제 #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;
        }