Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

cmt_syntax.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------
00002 // Copyright Christian Arnault LAL-Orsay CNRS
00003 // arnault@lal.in2p3.fr
00004 // See the complete license in cmt_license.txt "http://www.cecill.info". 
00005 //-----------------------------------------------------------
00006 
00007 #ifndef __cmt_syntax_h__
00008 #define __cmt_syntax_h__
00009 
00010 #include "cmt_map.h"
00011 #include "cmt_string.h"
00012 #include "cmt_system.h"
00013 #include "cmt_use.h"
00014 #include "cmt_project.h"
00015 
00016 class Kwd
00017 {
00018 public:
00019   virtual void action (const CmtSystem::cmt_string_vector& words,
00020                        Use* use,
00021                        const cmt_string& file_name,
00022                        int line_number) = 0;
00023 
00024   virtual void action (const CmtSystem::cmt_string_vector& words,
00025                        Project* project,
00026                        const cmt_string& file_name,
00027                        int line_number);
00028 };
00029 
00030 class SyntaxParser
00031 {
00032 public:
00033   static SyntaxParser& instance ();
00034 
00035   static void parse_requirements (const cmt_string& file_name, Use* use);
00036 
00037   static void parse_project_file_text (const cmt_string& text,
00038                                        const cmt_string& file_name,
00039                                        Project* project);
00040 
00041   static void parse_requirements_text (const cmt_string& text,
00042                                        const cmt_string& file_name,
00043                                        Use* use);
00044 
00045   static void parse_requirements_line (const cmt_string& line,
00046                                        Use* use,
00047                                        const cmt_string& file_name = "",
00048                                        int line_number = 0);
00049 
00050 private:
00051 
00052   typedef enum
00053     {
00054       project_context,
00055       package_context
00056     } ContextType;
00057 
00058   void do_parse_requirements (const cmt_string& file_name, Use* use);
00059 
00060   void do_parse_text (const cmt_string& text,
00061                       const cmt_string& file_name,
00062                       ContextType context,
00063                       Use* use,
00064                       Project* project);
00065 
00066   void do_parse_line (const cmt_string& line,
00067                       const cmt_string& file_name,
00068                       int line_number,
00069                       ContextType context,
00070                       Use* use,
00071                       Project* project);
00072 
00073   void do_parse_words (const CmtSystem::cmt_string_vector& words,
00074                        const cmt_string& file_name,
00075                        int line_number,
00076                        Use* use);
00077 
00078   void do_parse_words (const CmtSystem::cmt_string_vector& words,
00079                        const cmt_string& file_name,
00080                        int line_number,
00081                        Project* project);
00082 
00083   SyntaxParser ();
00084   cmt_map <cmt_string, Kwd> m_keywords;
00085   cmt_map <cmt_string, Kwd> m_project_keywords;
00086   cmt_string m_filtered_text;
00087 };
00088 
00089 
00090 #endif

Generated on Mon May 2 10:25:06 2005 for CMT by doxygen 1.3.5