commsfwtools/commstools/utracedecoder/src/messagedefparser/initialstate.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "messagedefparser\initialstate.h"
       
    17 #include "messagedefparser\constprocessor.h"
       
    18 #include "messagedefparser\contextprocessor.h"
       
    19 #include "messagedefparser\enumprocessor.h"
       
    20 #include "messagedefparser\includeprocessor.h"
       
    21 #include "messagedefparser\messageprocessor.h"
       
    22 #include "messagedefparser\signatureprocessor.h"
       
    23 #include "messagedefparser\structprocessor.h"
       
    24 #include "messagedefparser\aliasprocessor.h"
       
    25 
       
    26 
       
    27 namespace Parser
       
    28 {
       
    29 void CInitialState::ProcessState()
       
    30     {
       
    31     CStateBase* newState = NULL;
       
    32     switch (CurrentTokenType())
       
    33         {
       
    34         case Tokens::EInclude:
       
    35             newState = new CIncludeProcessor(ParserSM());
       
    36             break;
       
    37 
       
    38         case Tokens::EConst:
       
    39             newState = new CConstProcessor(ParserSM());
       
    40             break;
       
    41 
       
    42         case Tokens::EEnum:
       
    43             newState = new CEnumProcessor(ParserSM());
       
    44             break;
       
    45 
       
    46         case Tokens::EStruct:
       
    47             newState = new CStructProcessor(ParserSM());
       
    48             break;
       
    49 
       
    50         case Tokens::ESignature:
       
    51             newState = new CSignatureProcessor(ParserSM());
       
    52             break;
       
    53 
       
    54         case Tokens::EContext:
       
    55             newState = new CContextProcessor(ParserSM());
       
    56             break;
       
    57 
       
    58         case Tokens::EMessage:
       
    59             newState = new CMessageProcessor(ParserSM());
       
    60             break;
       
    61         
       
    62         case Tokens::EAlias:
       
    63             newState = new CAliasProcessor(ParserSM());
       
    64             break;
       
    65         
       
    66         default:
       
    67             ParserSM().SetError(Parser::EUnexpectedToken);
       
    68             break;
       
    69         }
       
    70 
       
    71     if (newState != NULL)
       
    72         {
       
    73         StateMachine().SetState(newState);
       
    74         }
       
    75     }
       
    76 
       
    77 } // namespace Parser
       
    78