source: CMT/v1r14p20031120/src/cmt_syntax.h @ 1

Last change on this file since 1 was 1, checked in by arnault, 19 years ago

Import all tags

File size: 1.9 KB
Line 
1#ifndef __cmt_syntax_h__
2#define __cmt_syntax_h__
3
4#include "cmt_map.h"
5#include "cmt_string.h"
6#include "cmt_system.h"
7#include "cmt_use.h"
8
9class Kwd
10{
11public:
12  virtual void action (const CmtSystem::cmt_string_vector& words,
13                       Use* use,
14                       const cmt_string& file_name,
15                       int line_number) = 0;
16};
17
18class SyntaxParser
19{
20public:
21  static SyntaxParser& instance ();
22
23  static void parse (const CmtSystem::cmt_string_vector& words,
24                     Use* use,
25                     const cmt_string& file_name,
26                     int line_number);
27
28  static void parse_requirements_line (const cmt_string& line,
29                                       Use* use,
30                                       const cmt_string& file_name = "",
31                                       int line_number = 0);
32
33  static void parse_requirements_text (const cmt_string& text,
34                                       const cmt_string& file_name,
35                                       Use* use);
36
37  static void parse_requirements (const cmt_string& file_name, Use* use);
38
39private:
40
41  void do_parse (const CmtSystem::cmt_string_vector& words,
42                 Use* use,
43                 const cmt_string& file_name,
44                 int line_number);
45
46  void do_parse_requirements_line (const cmt_string& line,
47                                   Use* use,
48                                   const cmt_string& file_name,
49                                   int line_number);
50
51  void do_parse_requirements_text (const cmt_string& text,
52                                   const cmt_string& file_name,
53                                   Use* use);
54
55  void do_parse_requirements (const cmt_string& file_name, Use* use);
56
57  SyntaxParser ();
58  cmt_map <cmt_string, Kwd> m_keywords;
59  cmt_string m_filtered_text;
60};
61
62
63class CommandParser
64{
65public:
66  typedef cmt_map <ActionType, cmt_string> HelpMap;
67  typedef cmt_vector<cmt_string> HelpTexts;
68
69  static HelpMap& get_help ();
70  static HelpTexts& get_help_texts ();
71  static const cmt_string& get_help_text (ActionType key);
72  static void show_all ();
73  static void show (ActionType action);
74
75private:
76  static CommandParser& instance ();
77
78  CommandParser ();
79
80  HelpMap m_help;
81  HelpTexts m_help_texts;
82};
83
84
85
86#endif
Note: See TracBrowser for help on using the repository browser.