commsfwtools/commstools/utracedecoder/test/messageparser_test_main.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2008-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 <ostream>
       
    17 #include "definitiontokenizer.h"
       
    18 #include "definitionparser.h"
       
    19 
       
    20 int testTokenizer(int argc, char* argv[]);
       
    21 
       
    22 int main(int argc, char* argv[])
       
    23     {
       
    24   //  return testTokenizer(argc, argv);
       
    25 
       
    26     if (argc < 2)
       
    27         {
       
    28         return -1;
       
    29         }
       
    30 
       
    31     Parser::CDefinitionParser parser;
       
    32     parser.ParseDefinitionFile(argv[1]);
       
    33     parser.DumpIdentifiers();
       
    34     return 0;
       
    35     }
       
    36 
       
    37 
       
    38 int testTokenizer(int argc, char* argv[])
       
    39     {
       
    40     Tokens::CDefinitionTokenizer tokenizer;
       
    41     if (argc < 2)
       
    42         {
       
    43         return -1;
       
    44         }
       
    45     tokenizer.LoadDefinitionFile(argv[1]);
       
    46 
       
    47     Tokens::TResult result;
       
    48     result = tokenizer.GetNextToken();
       
    49     while (result != Tokens::EEndOfFile)
       
    50         {
       
    51         std::cout << "result=" << result << " : " << tokenizer.Token() << " : ";
       
    52         std::cout << Tokens::TokenTypeToString(tokenizer.TokenType());
       
    53         if (result != Tokens::ETokenFound)
       
    54             {
       
    55             std::cout << " - line " << tokenizer.Line();
       
    56             }
       
    57         std::cout << std::endl;
       
    58         result = tokenizer.GetNextToken();
       
    59         }
       
    60 
       
    61     return 0;
       
    62     }
       
    63