3 #ifndef _SFIDL_PARSER_H_
4 #define _SFIDL_PARSER_H_
12 template<
typename Key,
typename Value>
18 const Value&
get(
const Key& k)
const {
47 char *x = g_strescape (
c_str(), 0);
49 result = i18n_prefix +
"(\"" +
String (x) +
"\")";
51 result =
"\"" +
String(x) +
"\"";
66 char *x = g_strdup_format (
"%s:%d", (filename ==
"-") ?
"stdin" : filename.
c_str(), line);
85 enum { tString = 1, tFloat = 2, tInt = 3, tIdent = 4 } type;
110 enum Type { IStream, JStream, OStream } type;
178 enum TypeDeclaration {
184 tdChoiceProto = tdChoice | tdProto,
185 tdRecordProto = tdRecord | tdProto,
186 tdSequenceProto = tdSequence | tdProto,
187 tdClassProto = tdClass | tdProto,
223 bool insert (
Symbol *symbol);
260 bool enterNamespace (
const String& name);
261 void leaveNamespace ();
262 bool usingNamespace (
const String& name);
266 static void scannerMsgHandler (GScanner *scanner, gchar *message, gboolean is_error);
268 template<
class... Args>
void print_error (
const char *format,
const Args &...args)
270 if (scanner->parse_errors < scanner->max_parse_errors)
271 g_scanner_error (scanner,
"%s", string_format (format, args...).c_str());
273 template<
class... Args>
void print_warning (
const char *format,
const Args &...args)
275 g_scanner_warn (scanner,
"%s", string_format (format, args...).c_str());
280 void preprocess (
const String& filename,
bool includeImpl =
false);
281 void preprocessContents (
const String& filename);
282 bool haveIncluded (
const String& filename)
const;
283 bool insideInclude ()
const;
287 void addConstantTodo (
const Constant& cdef);
288 void addChoiceTodo (
const Choice& cdef);
289 void addRecordTodo (
const Record& rdef);
290 void addSequenceTodo (
const Sequence& sdef);
291 void addClassTodo (
const Class& cdef);
292 void addProcedureTodo (
const Method& pdef);
294 void addPrototype (
const String& type, TypeDeclaration typeDecl);
295 void addType (
const String& type, TypeDeclaration typeDecl);
297 GTokenType parseTypeName (
String& s);
298 GTokenType parseStringOrConst (
String &s);
299 GTokenType parseConstant (
bool isident =
false);
300 GTokenType parseNamespace ();
301 GTokenType parseChoice ();
302 GTokenType parseChoiceValue (
ChoiceValue& comp,
int& value,
int& sequentialValue);
303 GTokenType parseRecord ();
304 GTokenType parseRecordField (
Param& comp,
const IString& group);
305 GTokenType parseStream (
Stream& stream, Stream::Type);
306 GTokenType parseSequence ();
307 GTokenType parseParamHints (
Param &def);
308 GTokenType parseClass ();
309 GTokenType parseMethod (
Method& def);
314 bool parse (
const String& fileName);
316 String fileName()
const {
return scanner->input_name; }
332 bool isChoice (
const String& type)
const;
333 bool isSequence (
const String& type)
const;
334 bool isRecord (
const String& type)
const;
335 bool isClass (
const String& type)
const;
336 Type typeOf (
const String& type)
const;
337 bool fromInclude (
const String& type)
const;
Definition: sfidl-parser.hh:92
Definition: sfidl-parser.hh:82
Definition: sfidl-parser.hh:226
Definition: sfidl-parser.hh:57
Definition: sfidl-parser.hh:129
Definition: sfidl-options.hh:16
Definition: sfidl-parser.hh:166
Definition: sfidl-parser.hh:150
The Sfidl namespace contains implementation and API of the Sfi IDL compiler.
Definition: sfidl-cbase.hh:14
Definition: sfidl-parser.hh:231
Definition: sfidl-parser.hh:73
Definition: sfidl-parser.hh:13
Definition: sfidl-parser.hh:157
Definition: sfidl-parser.hh:33
Definition: sfidl-parser.hh:142
Definition: sfidl-parser.hh:109
Definition: sfidl-parser.hh:118
Definition: sfidl-parser.hh:211