1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2008 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or (at
8 // your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 
19 #ifndef LIBAEGIS_SEM_H
20 #define LIBAEGIS_SEM_H
21 
22 #include <common/nstring.h>
23 
24 class meta_context; // forward
25 class input; // forward
26 
27 /**
28   * The sem_integer function is called by the parser when an integer
29   * value is seen.
30   *
31   * @param n
32   *     The value of the number.
33   */
34 void sem_integer(long n);
35 
36 /**
37   * The sem_real function is called by the parser when a floating point
38   * value is seen.
39   *
40   * @param n
41   *     The value of the number.
42   */
43 void sem_real(double n);
44 
45 /**
46   * The sem_string function is called by the parser when a string value
47   * is seen.
48   *
49   * @param text
50   *     The value of the string constant.
51   */
52 void sem_string(const nstring &text);
53 
54 /**
55   * The sem_enum function is called when the parser sees a name in an
56   * enumeration tag place.
57   *
58   * @param name
59   *     The name of the enumerand.
60   */
61 void sem_enum(const nstring &name);
62 
63 /**
64   * The sem_list function is called when the parser sees the start of a
65   * list value.  The pop method will be called after the value has been
66   * parsed.
67   */
68 void sem_list(void);
69 
70 /**
71   * The sem_list_end function is called by the parser when it sees the
72   * end of a list element.
73   */
74 void sem_list_end(void);
75 
76 /**
77   * The sem_field function is called when the parser sees the start of
78   * a name=value field.  The field_end method will be called after the
79   * value has been parsed.
80   *
81   * @param name
82   *     The nam eof the field.
83   */
84 void sem_field(const nstring &name);
85 
86 /**
87   * The sem_field_end function is called by the parser when it sees the
88   * end of a name=value field.
89   */
90 void sem_field_end(void);
91 
92 /**
93   * The sem_parse function is used to parse the given input, a redirect
94   * the parser actions through the given context.
95   *
96   * @param ctx
97   *     The context for the parser's actions.
98   * @param ifp
99   *     The input stream to be parsed.
100   */
101 void sem_parse(meta_context &ctx, input &ifp);
102 
103 /**
104   * The sem_parse_file function is used to parse the given file, and
105   * redirect the parser actions through the given context.
106   *
107   * @param ctx
108   *     The context for the parser's actions.
109   * @param filename
110   *     The name of the file to be parsed.
111   */
112 void sem_parse_file(meta_context &ctx, const nstring &filename);
113 
114 /**
115   * The sem_parse_env function is used to parse the given environment
116   * variable, and redirect the parser actions through the given context.
117   *
118   * @param ctx
119   *     The context for the parser's actions.
120   * @param name
121   *     The name of the environment variable to be parsed.
122   */
123 void sem_parse_env(meta_context &ctx, const nstring &name);
124 
125 #endif // LIBAEGIS_SEM_H
126