Main Page Modules Class Hierarchy Compound List File List Compound Members

# nedparser.h

    00001 //==========================================================================
    00002 //   NEDPARSER.H -
    00003 //            part of OMNeT++
    00004 //
    00005 //==========================================================================
    00006
    00007 /*--------------------------------------------------------------*
    00008   Copyright (C) 2002-2003 Andras Varga
    00009
    00010   This file is distributed WITHOUT ANY WARRANTY. See the file
    00011   `license' for details on this and other legal matters.
    00012 *--------------------------------------------------------------*/
    00013
    00014 #ifndef __NEDPARSER_H
    00015 #define __NEDPARSER_H
    00016
    00017 #include <stdio.h>
    00018
    00019 #include "nedgrammar.h"
    00020 #include "nedelement.h"
    00021
    00022 class NEDFileBuffer;
    00023 class NEDParser;
    00024 extern NEDParser *np;
    00025
    00026 /* to EXPR_TYPE: */
    00027 #define TYPE_NUMERIC   'N'
    00028 #define TYPE_CONST_NUM 'C'
    00029 #define TYPE_STRING    'S'
    00030 #define TYPE_BOOL      'B'
    00031 #define TYPE_ANYTYPE   'A'
    00032
    00033
    00042 class NEDParser
    00043 {
    00044   public:
    00045     NEDElement *tree;          // tree to build
    00046     NEDFileBuffer *nedsource;  // NED File object
    00047
    00048   protected:
    00049     const char *filename;  // file being parsed
    00050     int num_errors;        // number of errors so far
    00051
    00052   public:
    00056     NEDParser();
    00057
    00061     ~NEDParser();
    00062
    00067     bool parseFile(const char *fname,bool parseexpr);
    00068
    00073     bool parseText(const char *nedtext,bool parseexpr);
    00074
    00079     NEDElement *getTree();
    00080
    00081     // INTERNAL: error and debug handling, called from grammar file
    00082     void error(const char *msg, int line);
    00083     void dbg(YYLTYPE lc, const char *what);
    00084 };
    00085
    00086 #endif
    00087