示例#1
0
		/////////////////////////////////////////////////////////////////////////////

		public MacroOptions( IMacroProcessor mp, MacroFlags macroFlags, NmpStringList options )
		{
			// ******
			Initialize( mp );
			
			//Pushback = mp.GrandCentral>.PushbackResult;

			if( FlagIsSet( (int) macroFlags, (int) MacroFlags.NoPushback ) ) {
				Pushback = false;
			}
			
			if( FlagIsSet( (int) macroFlags, (int) MacroFlags.Pushback ) ) {
				Pushback = true;
			}
			
			if( FlagIsSet( (int) macroFlags, (int) MacroFlags.NoFwdExpand ) ) {
				FwdExpand = false;
			}

			if( FlagIsSet( (int) macroFlags, (int) MacroFlags.FwdExpand ) ) {
				FwdExpand = true;
			}

			// ******
			if( null != options && options.Count > 0 ) {
				//
				// flags that @[] instructions were added
				//
				CallerInstructions = true;

				// ******
				foreach( string option in options ) {
					switch( option.ToLower() ) {
						case "format":
							Format = true;
							break;

						case "data":
							Data = true;
							break;

						case "expand":
							FwdExpand = true;
							break;

						case "noexp":
							FwdExpand = false;
							break;

						case "pushback":
							Pushback = true;
							break;

						case "nopb":
							Pushback = false;
							break;

						case "quote":
							Quote = true;
							break;

						case "noquote":
							Quote = false;
							break;

						case "trim":
							Trim = true;
							break;

						case "nlstrip":
							NLStrip = true;
							break;

						case "normalize":
						case "wscompress":
							CompressAllWhiteSpace = true;
							break;

						case "ilcompressws":
							ILCompressWhiteSpace = true;
							break;

						case "tbwrap":
							TextBlockWrap = true;
							break;

						case "divert":
							Divert = true;
							break;

						case "eval":
							Eval = true;
							break;

						case "noexpression":
							NoExpression = true;
							break;

						case "nosubst":
							NoSubst = true;
							break;

						case "razorobject":
							RazorObject = true;
							break;

						case "razor":
							Razor = true;
							break;

						case "empty":
							Empty = true;
							break;

						default:
							AdditionalOptions.Add( option );
							break;
					}
				}
			}
		}
示例#2
0
文件: ETB.cs 项目: jmclain/Nmp
		/////////////////////////////////////////////////////////////////////////////

		protected void ParseMacroOptions( IInput input, NmpStringList instructions )
		{
			//MacroInstructions = argScanner( input, RecognizedCharType.CloseBracketChar );
			NmpStringList list = scanner.ArgScanner( input, RecognizedCharType.CloseBracketChar );
			instructions.Add( list );
		}
示例#3
0
		/////////////////////////////////////////////////////////////////////////////

		public RazorRunner( IMacroProcessor mp )
		{
			// ******
			this.mp = mp;
			this.assemblyPaths = ThreadContext.RazorAssemblyPaths;

			// ******
			string codeBase = LibInfo.CodeBase;
			if( ! assemblyPaths.Contains(codeBase) ) {
				assemblyPaths.Add( codeBase );
			}

			codeBase = string.Format( "{0}\\Nmp.dll", Path.GetDirectoryName(codeBase) );
			if( ! assemblyPaths.Contains(codeBase) ) {
				assemblyPaths.Add( codeBase );
			}
		}
示例#4
0
		/////////////////////////////////////////////////////////////////////////////

		public static NmpStringList CoreAssemblies( IList<string> moreAssemblies )
		{
			// ******
			var assemblies = new NmpStringList( unique : true );
			
			assemblies.Add( "System.dll" );
			assemblies.Add( "System.Core.dll" );
			assemblies.Add( "Microsoft.CSharp.dll" );

	/*

		things to watch out for:

			o		the compile (and razor) code is currently in Csx.exe but it will be
					moved to NmpBase when it is all smoothed out and running

						so, at some point DefaultRazorTemplateBase will NOT be in the
						same assembly as this code


	*/

//			assemblies.Add( Assembly.GetExecutingAssembly().CodeBase.Substring( 8 ) );
//
//			//
//			// this get NmpBase.dll
//			//
//			assemblies.Add( typeof(NmpStringList).Assembly.CodeBase.Substring( 8 ) );

			if( null != moreAssemblies ) {
				assemblies.AddRange( moreAssemblies );
			}

			// ******
			assemblies.Sort();
			return assemblies;
		}
示例#5
0
文件: Deflist.cs 项目: jmclain/Nmp
		/////////////////////////////////////////////////////////////////////////////
		//
		// (#Deflist `macroName' )
		//
		/////////////////////////////////////////////////////////////////////////////

		public override object Evaluate( IMacro macro, IMacroArguments macroArgs )
		{
			// ******
			var args = GetMacroArgsAsTuples( macroArgs.Expression ) as NmpTuple<string, bool>;
			string macroName = args.Item1;
			bool trimLines = args.Item2;

			// ******
			if( string.IsNullOrEmpty(macroName) ) {
				ThreadContext.MacroError( "attempt to define or pushdef a macro without a name" );
			}

			// ******
			//
			// parse text into NmpArray instance
			//
			var list = new NmpStringList( macroArgs.BlockText, trimLines );

			// ******
			//
			// create the new macro
			//
			IMacro newMacro = mp.AddObjectMacro( macroName, list );
			
			// ******
			return string.Empty;
		}
示例#6
0
		public string [] Extract( string regExStr, int maxItems )
		{
			// ******
			NmpStringList list = new NmpStringList();

			try {
				Regex rx = new Regex( regExStr );
				MatchCollection mc = rx.Matches( theString );
				
				//
				// find all the matches for a regular expression and return the match or
				// if there is at least one subexpression return the subexpression
				//

				foreach( Match match in mc ) {
					if( match.Groups.Count > 1 ) {
						//
						// if there are subexpressions then we return the first one (outer most)
						//
						list.Add( match.Groups[1].Value );
					}
					else {
						list.Add( match.Value );
					}
					
					//
					// note: we are NOT inhibiting Matches from generating as many matches as it
					// can, only limiting the number we return
					//

					if( 0 == --maxItems ) {
						break;
					}
				}
			}
			catch ( ArgumentException ex ) {
				ThreadContext.MacroError( "while executing Extract(): {0}", ex.Message );
			}
			
			// ******
			return list.ToArray();
		}
示例#7
0
文件: Core-Other.cs 项目: jmclain/Nmp
		public object getMacroNames()
		{
			// ******
			var array = new NmpArray();

			// ******
			var list = mp.GetMacros( false );

			var names = new NmpStringList();
			foreach( IMacro macro in list ) {
				names.Add( macro.Name );
			}

			array.Add( "unsorted", names );
			names.Sort();
			array.Add( "sorted", names );
			
			
			list.Sort( ( a, b ) => string.Compare( a.Name, b.Name ) );


			// ******

//		Builtin,
//		Object,
//		Text,

			names = new NmpStringList();
			foreach( IMacro macro in list ) {
				if( MacroType.Builtin == macro.MacroType ) {
					names.Add( macro.Name );
				}
			}

			array.Add( "builtin", names );

			names = new NmpStringList();
			foreach( IMacro macro in list ) {
				if( MacroType.Object == macro.MacroType ) {
					names.Add( macro.Name );
				}
			}

			array.Add( "object", names );

			names = new NmpStringList();
			foreach( IMacro macro in list ) {
				if( MacroType.Text == macro.MacroType ) {
					names.Add( macro.Name );
				}
			}

			array.Add( "text", names );

			// ******
			return array;
		}
示例#8
0
文件: Arguments.cs 项目: jmclain/Nmp
		/////////////////////////////////////////////////////////////////////////////

		public static object [] Create( NmpStringList argList )
		{
			// ******
			if( 0 == argList.Count ) {
				return new object [0];
			}

			// ******
			var args = new NmpObjectList();
			
			foreach( string arg in argList ) {
				string s = arg.Trim();
				
				// ******
				if( string.IsNullOrEmpty(s) ) {
					args.Add( string.Empty );
				}
				else if( 1 == s.Length ) {
					args.Add( s );
				}
				else if( '(' == s [ 0 ] && '(' != s [ 1 ] ) {
					args.Add( CastArg( s ) );
				}
				else if( '[' == s [ 0 ] && '[' != s [ 1 ] ) {
					args.Add( CollectionArg(s) );
				}
				else { 
					//
					// as a string
					//
					args.Add( s );
				}
			}

			// ******
			return args.ToArray();
		}
示例#9
0
文件: MIR.cs 项目: jmclain/Nmp
		/////////////////////////////////////////////////////////////////////////////

		public MIR( IMacro macro, bool isAltTokenFormat, NmpStringList specialArgs, IInput inputSource, string context, int pos, int line, int column )
		{
			// ******
			CalledFromMacro = string.IsNullOrEmpty( inputSource.SourceName );
			CalledFromFile = ! CalledFromMacro;

			// ******
			State = MacroProcessingState.None;
			MacroArgs = null;
			SpecialArgs = specialArgs;

			// ******
			Macro = macro;
			Source = inputSource.Current;
			PushbackCalled = inputSource.PushbackCalled;

			// ******
			Context = context;
			SourceStartIndex = pos;
			SourceEndIndex = 0;
			_line = line;
			_column = column;
			AltToken = isAltTokenFormat;

		}
示例#10
0
//		/////////////////////////////////////////////////////////////////////////////
//
//		public static string ProcessText(	string textIn, 
//																			StringBuilder textOut, 
//																			List<string> targets, Action<string, string, StringBuilder> handler
//																		)
//		{
//			// ******
//			var reader = new StringIndexer( textIn );
//
//			while( true ) {
//				foreach( string target in targets ) {
//					if( reader.StartsWith(target) ) {
//						reader.Skip( target.Length );
//						string remainder = GetText( reader ).Trim();
//						if( null != handler ) {
//							handler( target, remainder, textOut );
//						}
//					}
//					else {
//						if( null != textOut ) {
//							textOut.Append( GetText(reader) );
//						}
//					}
//				}
//
//			}
//		}
//
//
//		/////////////////////////////////////////////////////////////////////////////
//
//		public static bool CheckCallerOptions(	StringIndexer reader,
//																						StringBuilder textOut, 
//																						List<string> targets, 
//																						Action<string, string, StringBuilder> handler
//																					)
//		{
//			foreach( string target in targets ) {
//				if( reader.StartsWith(target) ) {
//					reader.Skip( target.Length );
//					string remainder = GetText( reader ).Trim();
//					if( null != handler ) {
//						handler( target, remainder, textOut );
//					}
//				}
//				else {
//					if( null != textOut ) {
//						textOut.Append( GetText(reader) );
//					}
//				}
//			}
//		}
//
//
//		/////////////////////////////////////////////////////////////////////////////
//
//		public string _GetOptions(	string textIn,
//																StringBuilder textOut, 
//																List<string> targets,
//																Action<string, string, StringBuilder> handler
//															)
//		{
//
//			// ******
//			var sb = new StringBuilder();
//			var reader = new StringIndexer( textIn );
//
//			bool checkTopOfFileOptions = true;
//
//			while( true ) {
//				if( checkTopOfFileOptions ) {
//					if( reader.StartsWith( START_SINGLE_LINE_COMMENT ) ) {
//						ReadToEOL( reader );
//					}
//
//					else if( reader.StartsWith(RAZOR_ASMINC) ) {
//						reader.Skip( RAZOR_ASMINC.Length );
//						GetAssemblyName( reader );
//					}
//
//					else if( reader.StartsWith(RAZOR_ASMINC2) ) {
//						reader.Skip( RAZOR_ASMINC2.Length );
//						GetAssemblyName( reader );
//					}
//
//					else if( reader.StartsWith(KEEP_TEMPS) ) {
//						ReadToEOL( reader );
//						KeepTempFiles = true;
//					}
//
//					else if( reader.StartsWith(RAZOR_DEBUG) ) {
//						ReadToEOL( reader );
//						Debug = true;
//					}
//
//					else if( reader.StartsWith(CODE_NAMESPACE) ) {
//						reader.Skip( CODE_NAMESPACE.Length );
//						Namespace = GetText( reader ).Trim();
//					}
//
//					else if( reader.StartsWith(CODE_CLASSNAME) ) {
//						reader.Skip( CODE_CLASSNAME.Length );
//						ClassName = GetText( reader ).Trim();
//					}
//
//					else if( reader.StartsWith(INJECT) ) {
//						ReadToEOL( reader );
//						Inject = true;
//					}
//					
//					else if( reader.StartsWith(PREPROCESS) ) {
//						ReadToEOL( reader );
//						PreProcess = true;
//					}
//					
//					else if( reader.StartsWith(POSTPROCESS) ) {
//						ReadToEOL( reader );
//						PostProcess = true;
//					}
//
//					else if( reader.StartsWith(COMMENTS_FULL_REMOVE) ) {
//						ReadToEOL( reader );
//						CommentsFullRemove = true;
//					}
//					
//					else {
//						checkTopOfFileOptions = false;
//						if( ! CheckCallerOptions(reader, sb, targets, handler) ) {
//							sb.Append( GetText(reader) );
//							sb.Append( SC.NEWLINE );
//						}
//					}
//				}
//
// ***** INCOMPLETE - NEVER FINISHED - MORE THINK THROUGH
//
//				else {
//				}
//			}
//		}
//

		/////////////////////////////////////////////////////////////////////////////

		public RazorOptions()
		{
			KeepTempFiles = false;
			RefAssemblies = new NmpStringList();

			//AllowNullData = true;
			//AllowNullEnumData = true;

			Namespace = string.Empty;
			ClassName = "_" + Guid.NewGuid().ToString().Replace( "-", "_" );


		}
示例#11
0
文件: Arguments.cs 项目: jmclain/Nmp
		/////////////////////////////////////////////////////////////////////////////

		public static object CastArg( NmpStringList list, string s )
		{

//TODO: buggy, does not handle errors in list length

			// ******
			if( 0 == list.Count ) {
				//
				// "()" 
				//
				return string.Empty;
			}
			else if( 1 == list.Count ) {
				//
				// the opening parenthesis was NOT ballanced by a closer !
				//
			}
			else {
				//
				// if Count is greater than 2
				//
				Trace.Assert( 2 == list.Count, string.Format("Helpers.CastArg: error parsing cast expression \"{0}\"", s) );
			}

			// ******
			string castType = list[ 0 ];
			string castValue = list[ 1 ];

			object value = CastExpression( castType.Substring(1, castType.Length - 2), castValue );
			if( null == value ) {
				value = s;
			}
			
			// ******
			return value;
		}
示例#12
0
		/////////////////////////////////////////////////////////////////////////////

		public TextMacroRunner( IMacroProcessor mp, IMacro macro, IMacroArguments args, object [] objArgsIn )
		{
			// ******
			this.mp = mp;
			this.macro = macro;
			this.options = args.Options;
			this.objectArgs = objArgsIn;
			this.arguments = new NmpStringList( objArgsIn, false );

			// ******
			expressionNodeTypeName = args.Expression.NodeTypeName;

			// ******
			///flags = new BitArray( (int)MDIndexes.COUNT_DIRECTIVES, false );

			// ******
			argsMacro = mp.AddObjectMacro( mp.GenerateArgListName( macro.Name ), this.arguments );
			specials = mp.AddObjectMacro( mp.GenerateLocalName( macro.Name + "_specials" ), args.SpecialArgs );
			localArrayMacro = mp.AddObjectMacro( mp.GenerateLocalName( macro.Name ), localArray = new NmpArray() );
			objArgsMacro = mp.AddObjectMacro( mp.GenerateArgListName( macro.Name + "Objects" ), objArgsIn );
		}
示例#13
0
			/////////////////////////////////////////////////////////////////////////////

			public string Make( string rspPath )
			{
				// ******
				try {
					if( string.IsNullOrEmpty(rspPath) ) {
						ThreadContext.MacroError( "the response file path argument to #makersp is empty" );
					}

					// ******
					if( ! Path.IsPathRooted(rspPath) ) {
						rspPath = Path.Combine( mp.GrandCentral.GetDirectoryStack().Peek(), rspPath );
					}

					string responseFileDirectory = Path.GetDirectoryName( rspPath );

					if( ! File.Exists(rspPath) ) {
						ThreadContext.MacroError( "#makersp could not locate the response file \"{0}\"", rspPath );
					}

					// ******
					string dllPath = null;
					var filesToCheck = new NmpStringList();

					// ******
					string [] linesOfText = File.ReadAllLines( rspPath );

					foreach( string _text in linesOfText ) {
						var text = _text.Trim().ToLower();

						// ******
						if( string.IsNullOrEmpty(text) ) {
							continue;
						}

						// ******
						if( text.StartsWith("/out:") ) {
							dllPath = text.Substring( 5 ).Trim();
							continue;
						}

						// ******
						char chFirst = text[0];

						if( '/' == chFirst || '#' == chFirst ) {
							continue;
						}

						// ******
						filesToCheck.Add( text );
					}

					// ******
					if( null == dllPath ) {
						ThreadContext.MacroError( "#makersp was unable to locate the \"/out:\" argument in the response file" );
					}

					if( string.IsNullOrEmpty(dllPath) ) {
						ThreadContext.MacroError( "#makersp: the \"/out:\" argument in the response file is empty" );
					}

					if( ! Path.IsPathRooted(dllPath) ) {
						dllPath = Path.Combine( responseFileDirectory, dllPath );
					}

					// ******
					if( 0 == linesOfText.Count() ) {
						ThreadContext.MacroError( "#makersp was unable to locate any source file paths in the response file" );
					}

					// ******
					if( ! UptoDate(dllPath, rspPath, responseFileDirectory, filesToCheck) ) {
						Update( rspPath, dllPath );
					}

					// ******
					return dllPath;
				}
				catch ( Exception ex ) {
					if( ex is ExitException ) {
						throw ex;
					}
					//
					// never returns
					//
					ThreadContext.MacroError( "exception in macro #makersp: {0}", ex.Message );
					//
					// make the compiler happy
					//
					throw ex;
				}
			}
示例#14
0
		/////////////////////////////////////////////////////////////////////////////

		public string Forloop_TextChunk( int start, int end, int increment, string macroText, object [] extraArgs )
		{
			// ******
			//
			//	`index', `lastIndex', `increment' [, extra0, extra1, ...]
			//
			var argNames = new NmpStringList( "index", "lastIndex", "increment" );
			//
			// extra0 ... extraN
			//
			for( int i = 0; i < extraArgs.Length; i++ ) {
				argNames.Add( string.Format( "extra{0}", i ) );
			}

			// ******
			IMacro target = mp.AddTextMacro( mp.GenerateMacroName("$.forloop"), macroText, argNames );
			string result = ProcessForLoop( target, start, end, increment, extraArgs );
			mp.DeleteMacro( target );

			// ******
			return result;
		}
示例#15
0
		/////////////////////////////////////////////////////////////////////////////

		public MacroArguments(	IMacro macro,
														IInput input, 
														MacroExpression macroExp, 
														
														NmpStringList specialArgs = null,
														string blockText = ""
													)
		{
			// ******
			if( null == input ) {
				throw new ArgumentNullException( "input" );
			}
			Input = input;

			// ******
			Expression = macroExp;

			// ******
			Options = new MacroOptions( macro.MacroProcessor, macro.Flags, macroExp.MacroInstructions );
			
			// ******
			SpecialArgs = null == specialArgs ? new NmpStringList() : specialArgs;
			BlockText = blockText;
		}
示例#16
0
		/////////////////////////////////////////////////////////////////////////////

		public string Foreach_TextChunk( object objToEnumerate, string macroText, object [] extraArgs )
		{
			// ******
			//
			//	list: `value', `index', `lastIndex', `count', `type'
			//
			var argNames = new NmpStringList( "value", "index", "lastIndex", "count", "type" );

			//
			// extra0 ... extraN
			//
			for( int i = 0; i < extraArgs.Length; i++ ) {
				argNames.Add( string.Format( "extra{0}", i ) );
			}

			// ******
			IMacro target = mp.AddTextMacro( mp.GenerateMacroName("$.foreach"), macroText, argNames );
			string result = ForeachTextMacro( target, objToEnumerate, extraArgs );
			mp.DeleteMacro( target );

			// ******
			return result;
		}
示例#17
0
		///////////////////////////////////////////////////////////////////////////////
		//
		//protected bool DeterminFlagState( bool currentState, bool set, bool clear )
		//{
		//	//
		//	// if set and clear are the same then they conflict and we return
		//	// current value otherwise 'set' which if true will if it is true
		//	// and false otherwise - clear will be true (take my word for it) and
		//	// false will be the correct value
		//	//
		//	return set == clear ? currentState : set;
		//}
		//

		/////////////////////////////////////////////////////////////////////////////

		protected void Initialize( IMacroProcessor mp )
		{
			// ******
			gc = mp.GrandCentral;

			// ******
			CallerInstructions = false;

			Pushback = gc.PushbackResult;
			FwdExpand = gc.ExpandAndScan;

			Quote = false;
			Trim = false;
			NLStrip = false;
			CompressAllWhiteSpace = false;
			ILCompressWhiteSpace = false;
			TextBlockWrap = false;
			Divert = false;
			Eval = false;

			Data = false;
			Format = false;

			NoSubst = false;

			Razor = false;
			RazorObject = false;

			Empty = false;

			TabsToSpaces = false;

			//
			// other options
			//
			NoExpression = false;		// for defining macro

			AdditionalOptions = new NmpStringList();
		}
示例#18
0
		/////////////////////////////////////////////////////////////////////////////

		public IMacro AddTextMacro( string macroName, string macroText, NmpStringList argNames )
		{
			using( new NMP.NmpMakeCurrent(nmp) ) {
				string text = nmp.GrandCentral.FixText( macroText );
				return nmp.MacroProcessor.AddTextMacro( macroName, text, argNames );
			}
		}
示例#19
0
		/////////////////////////////////////////////////////////////////////////////

		public static NmpStringList Split( StringIndexer input, char openChar, char closeChar, bool splitCastMode = false )
		{
			// ******
			NmpStringList subStrings = new NmpStringList();

			// ******
			StringBuilder sb = new StringBuilder();
			char ch;

			while( true ) {
				ch = input.NextChar();

				// ******
				if( ESCAPE_CHAR == ch ) {
					ch = input.NextChar();

					if( END_OF_STRING == ch ) {
						continue;
					}
					else if( escapeChars.IndexOf(ch) >= 0 || openChar == ch || closeChar == ch ) {
						sb.Append( ch );
						continue;
					}

					//
					// not a valid escape char so add escape into output and fall thru to handle
					// ch
					//
					sb.Append( ESCAPE_CHAR );
				}

				// ******
				if( END_OF_STRING == ch || SPLIT_CHAR == ch || closeChar == ch ) {
					subStrings.Add( sb.ToString().Trim() );
					sb.Length = 0;

					if( END_OF_STRING == ch || closeChar == ch ) {
						break;
					}
				}
				else if( OPEN_BRACKET == ch || OPEN_PAREN == ch || openChar == ch ) {
					char closer;

					switch( ch ) {
						case OPEN_BRACKET:
							closer = CLOSE_BRACKET;
							break;

						case OPEN_PAREN:
							closer = CLOSE_PAREN;
							break;

						default:
							closer = closeChar;
							break;
					}
					
					// ******
					NmpStringList s = Split( input, ch, closer );

					sb.Append( ch );
					sb.Append( s.Join(';') );
					sb.Append( closer );

					// ******
					if( OPEN_PAREN == ch && splitCastMode ) {
						//
						// once we've seen a complete parenthesized chunk of text we:
						//
						//		add it to the list
						//		then add the remainder of the text to the next entry
						//		and return
						//
						subStrings.Add( sb.ToString() );
						subStrings.Add( input.Remainder.Trim() );
						return subStrings;
					}
				}
				else {
					sb.Append( ch );
				}
			}

			// ******
			//
			// did not find terminating character
			//
			if( END_OF_STRING != closeChar && END_OF_STRING == ch ) {
				throw ExceptionHelpers.CreateException( "Helpers.SplitString: unbalanced string, could not locate closing character '{0}'", closeChar );
			}

			// ******
			return subStrings;
		}
示例#20
0
文件: Helpers.cs 项目: jmclain/Nmp
		/////////////////////////////////////////////////////////////////////////////

		public static ICollection GetNamespaces( Assembly assembly )
		{
			// ******
			NmpStringList list = new NmpStringList( unique: true );

			foreach( Type t in assembly.GetTypes() ) {
				string ns = t.Namespace;

				if( IsNetValidIdentifier(ns, allowDots : true) ) {
					list.Add( ns );
				}
			}

			// ******
			return list;
		}
示例#21
0
		/////////////////////////////////////////////////////////////////////////////

		// converts a list of text arguments into individual ArgumentExpresion's and
		// return them as an ArgumentList which later need to be interpreted by ArgumentsEvaluator

		public ArgumentList ProcessArgumentList( Expression parent, NmpStringList strArgs )
		{
			// ******
			ArgumentList objArgs = new ArgumentList();

			// ******
			for( int iArg = 0; iArg < strArgs.Count; iArg++ ) {
				string strArg = strArgs[ iArg ];

				// ******
				if( string.IsNullOrEmpty(strArg) ) {
					//
					// empty string arg
					//
					objArgs.Add( new ArgumentExpression(parent, string.Empty) );
				}
				else {
					char firstChar = strArg[ 0 ];

					//
					// if we don't understand the cast maybe we should just let
					// it go ...
					//
					
					if( SC.OPEN_PAREN == firstChar && ! IgnoreCastLikeThis(strArg) ) {
						//
						// (cast) something
						//
						ArgumentExpression ae = EvaluateCastExpression( parent, strArg );
						if( null != ae ) {
							objArgs.Add( ae );
						}
						else {
							objArgs.Add( new ArgumentExpression( parent, strArg ) );
						}
					}
					else if( SC.ATCHAR == firstChar && strArg.Length > 1 && '@' != strArg[1] ) {
						//
						// @macro ...
						//
						// string must be more than just "@", "@@" escapes it
						//
						objArgs.Add( EvaluateAtExpression( parent, strArg.Substring(1) ) );
					}
					else {
						//
						// a string
						//
						objArgs.Add( new ArgumentExpression(parent, strArg) );
					}
				}
			}

			// ******
			return objArgs;
		}
示例#22
0
		/////////////////////////////////////////////////////////////////////////////

		public static NmpStringList DefCompilerOptions( TargetType tt )
		{
			var options = new NmpStringList();

			// ******
			//options.Add( "/platform:" + PlatformName(pt) );
			options.Add( "/target:" + TargetTypeExtension(tt) );

			// ******
			return options;
		}