using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
+using Mono.XBuild.Utilities;
namespace Microsoft.Build.BuildEngine {
this.expressionCollection = new ExpressionCollection ();
}
+ public static T ParseAs<T> (string expression, ParseOptions options, Project project)
+ {
+ Expression expr = new Expression ();
+ expr.Parse (expression, options);
+ return (T)expr.ConvertTo (project, typeof (T));
+ }
+
+ public static T ParseAs<T> (string expression, ParseOptions options, Project project, ExpressionOptions exprOptions)
+ {
+ Expression expr = new Expression ();
+ expr.Parse (expression, options);
+ return (T)expr.ConvertTo (project, typeof (T), exprOptions);
+ }
+
// Split: Split on ';'
// Eg. Property values don't need to be split
//
bool allowItems = (options & ParseOptions.AllowItems) == ParseOptions.AllowItems;
bool allowMd = (options & ParseOptions.AllowMetadata) == ParseOptions.AllowMetadata;
- expression = expression.Replace ('/', Path.DirectorySeparatorChar);
expression = expression.Replace ('\\', Path.DirectorySeparatorChar);
string [] parts;
for (int i = 0; i < lists.Count; i++) {
foreach (object o in lists [i]) {
if (o is string)
- expressionCollection.Add (Utilities.Unescape ((string) o));
+ expressionCollection.Add (MSBuildUtils.Unescape ((string) o));
else if (!allowItems && o is ItemReference)
expressionCollection.Add (((ItemReference) o).OriginalString);
else if (!allowMd && o is MetadataReference) {