Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Examples

Parser.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |  
00003 |                      __   __    ____ _____ ____                      |  
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |  
00005 |                       \ V / _` \___ \ | |   __) |                    |  
00006 |                        | | (_| |___) || |  / __/                     |  
00007 |                        |_|\__,_|____/ |_| |_____|                    |  
00008 |                                                                      |  
00009 |                               core system                            | 
00010 |                                                        (C) SuSE GmbH |  
00011 \----------------------------------------------------------------------/ 
00012 
00013    File:       Parser.h
00014 
00015    Author:     Mathias Kettner <kettner@suse.de>
00016    Maintainer: Klaus Kaempf <kkaempf@suse.de>
00017 
00018 /-*/
00019 /*
00020  * YCP interface to the bison generated parser
00021  */
00022 
00023 #ifndef Parser_h
00024 #define Parser_h
00025 
00026 #include <stdio.h>
00027 #include <string>
00028 
00029 #include "ycp/Scanner.h"
00030 #include "ycp/YCode.h"
00031 
00032 class Scanner;
00033 class blockstack_t;
00034 class scannerstack_t;
00035 class YBlock;
00036 
00063 class Parser
00064 {
00068     Scanner *m_scanner;
00069 
00074     bool m_buffered;
00075 
00080     bool m_depends;
00081 
00085     bool m_at_eof;
00086 
00087 public:
00092     YCodePtr m_result;
00093 
00097     int m_lineno;
00098 
00103     int m_loop_count;
00104 
00109     int m_parser_errors;
00110 
00114     blockstack_t *m_block_stack;
00115 
00119     scannerstack_t *m_scanner_stack;
00120     
00124     YBlockPtr m_current_block;
00125     
00129     int m_blockstack_depth;
00130     
00134     void init ();
00135 
00136 public:
00141     Parser();
00142 
00149     Parser(FILE *file, const char *filename=0);
00150 
00154     Parser(const char *buf);
00155 
00162     Parser(int fd, const char *filename=0);
00163 
00167     ~Parser();
00168 
00181     YCodePtr parse(SymbolTable *gTable = 0, SymbolTable *lTable = 0);
00182 
00186     Scanner *scanner ();
00187 
00192     void setScanner (Scanner *);
00193 
00199     bool atEOF ();
00200 
00207     void setInput(FILE *file, const char *filename=0);
00208 
00212     void setInput(const char *buf);
00213 
00220     void setInput(int fd, const char *filename = 0);
00221 
00226     void setBuffered();
00227 
00231     void setDepends();
00232 
00236     bool depends() const;
00237 };
00238 
00239 #endif // Parser_h

Generated on Tue Mar 22 11:35:48 2005 for yast2-core by  doxygen 1.4.1