crashanalysercmd/PerfToolsSharedLibraries/Engine/SymBuildParsingLib/Parser/BuildFile/Workers/SymWorkerBuildFileMain.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 using System;
       
    19 using SymBuildParsingLib.Tree;
       
    20 using SymBuildParsingLib.Token;
       
    21 using SymBuildParsingLib.Parser.Framework;
       
    22 using SymBuildParsingLib.Parser.Framework.Workers;
       
    23 
       
    24 namespace SymBuildParsingLib.Parser.BuildFile.Workers
       
    25 {
       
    26 	public class SymWorkerBuildFileMain : SymParserWorker
       
    27 	{
       
    28 		#region Constructors & destructor
       
    29 		public SymWorkerBuildFileMain( SymParserWorkerContext aContext )
       
    30 			: base( aContext )
       
    31 		{
       
    32 		}
       
    33 		#endregion
       
    34 
       
    35 		#region From SymParserWorker
       
    36 		public override SymParserWorker.TTokenConsumptionType OfferToken( SymToken aToken )
       
    37 		{
       
    38 			// Offer the token to the base class first. If it doesn't want it, we'll
       
    39 			// check it.
       
    40 			TTokenConsumptionType ret = base.OfferToken( aToken );
       
    41 			if	( ret == TTokenConsumptionType.ETokenNotConsumed )
       
    42 			{
       
    43 				if	( aToken.Class != SymToken.TClass.EClassComment )
       
    44 				{
       
    45 					// Try to find a new child worker to handle this kind
       
    46 					// of data.
       
    47 					SymParserWorker worker = CreateWorkerByTokenType( aToken );
       
    48 					if	( worker != null )
       
    49 					{
       
    50 						System.Diagnostics.Debug.WriteLine( "SymWorkerBuildFileMain.OfferToken() - FOUND HANDLER FOR: " + aToken.Value );
       
    51 
       
    52 						AddChild( worker );
       
    53 						ret = TTokenConsumptionType.ETokenConsumed;
       
    54 					}
       
    55 				}
       
    56 			}
       
    57 			//
       
    58 			return ret;
       
    59 		}
       
    60 		#endregion
       
    61 
       
    62 		#region Internal methods
       
    63 		private SymParserWorker CreateWorkerByTokenType( SymToken aToken )
       
    64 		{
       
    65 			// Find a worker to handle the token type
       
    66 			SymParserWorkerContext context = new SymParserWorkerContext( WorkerContext.Document.Context, this, aToken );
       
    67 			//
       
    68 			SymParserWorker worker = null;
       
    69 			switch( aToken.Value.ToLower() )
       
    70 			{
       
    71 				// Simple preprocessor operations
       
    72 				case "prj_platforms":
       
    73 					break;
       
    74 				case "prj_exports":
       
    75 					break;
       
    76 				case "prj_testexports":
       
    77 					break;
       
    78 				case "prj_mmpfiles":
       
    79 					break;
       
    80 				case "prj_testmmpfiles":
       
    81 					break;
       
    82 
       
    83 				// Skip unhandled preprocessor directives
       
    84 				default:
       
    85 					break;
       
    86 			}
       
    87 			//
       
    88 			return worker;
       
    89 		}
       
    90 		#endregion
       
    91 
       
    92 		#region Data members
       
    93 		#endregion
       
    94 	}
       
    95 }