コード例 #1
0
		private NPathSelectQuery ParseSelectQuery()
		{
			NPathSelectQuery query = new NPathSelectQuery();
			queries.Push(query);

			tokenizer.GetCurrentToken("select", "Select");

			NPathSelectClause selectClause = new NPathSelectClause();
			ParseSelectClause(selectClause);
			query.Select = selectClause;

			tokenizer.GetCurrentToken("from", "From");
			NPathFromClause fromClause = new NPathFromClause();
			ParseFromClause(fromClause);
			query.From = fromClause;

			if (tokenizer.GetCurrentToken().IsType("where"))
			{
				NPathWhereClause whereClause = new NPathWhereClause();
                query.Where = whereClause;
				ParseWhereClause(whereClause);
				
			}

			if (tokenizer.GetCurrentToken().IsType("order by")) // do not localize
			{
				NPathOrderByClause orderByClause = new NPathOrderByClause();
				ParseOrderByClause(orderByClause);
				query.OrderBy = orderByClause;
			}

			return query;
		}
コード例 #2
0
 private void ParseFromClause(NPathFromClause fromClause)
 {
     do
     {
         tokenizer.MoveNext();
         Token classToken = tokenizer.GetCurrentToken("identifier", "Class name"); // do not localize
         NPathClassName className = new NPathClassName();
         className.Name = classToken.Text;
         fromClause.Classes.Add(className);
         tokenizer.MoveNext();
     } while (tokenizer.GetCurrentToken().IsType("comma"));
 }