1 #ifndef DEVICE_TOOLS_AIDL_AIDL_LANGUAGE_H
2 #define DEVICE_TOOLS_AIDL_AIDL_LANGUAGE_H
13 typedef struct extra_text_type {
15 which_extra_text which;
18 struct extra_text_type* next;
21 typedef struct buffer_type {
25 extra_text_type* extra;
28 typedef struct type_type {
30 buffer_type array_token;
34 typedef struct arg_type {
35 buffer_type comma_token; // empty in the first one in the list
36 buffer_type direction;
39 struct arg_type *next;
46 typedef struct interface_item_type {
48 struct interface_item_type* next;
49 } interface_item_type;
51 typedef struct method_type {
52 interface_item_type interface_item;
55 buffer_type oneway_token;
57 buffer_type open_paren_token;
59 buffer_type close_paren_token;
60 // XXX missing comments/copy text here
61 buffer_type semicolon_token;
62 buffer_type* comments_token; // points into this structure, DO NOT DELETE
70 typedef struct document_item_type {
72 struct document_item_type* next;
75 typedef struct parcelable_type {
76 document_item_type document_item;
77 buffer_type parcelable_token;
80 buffer_type semicolon_token;
83 typedef struct interface_type {
84 document_item_type document_item;
85 buffer_type interface_token;
87 buffer_type oneway_token;
90 buffer_type open_brace_token;
91 interface_item_type* interface_items;
92 buffer_type close_brace_token;
93 buffer_type* comments_token; // points into this structure, DO NOT DELETE
96 typedef union lexer_type {
101 interface_item_type* interface_item;
102 interface_type* interface_obj;
103 parcelable_type* parcelable;
104 document_item_type* document_item;
108 #define YYSTYPE lexer_type
114 int parse_aidl(char const *);
116 // strips off the leading whitespace, the "import" text
117 // also returns whether it's a local or system import
118 // we rely on the input matching the import regex from below
119 char* parse_import_statement(const char* text);
127 int convert_direction(const char* direction);
129 // callbacks from within the parser
130 // these functions all take ownership of the strings
131 typedef struct ParserCallbacks {
132 void (*document)(document_item_type* items);
133 void (*import)(buffer_type* statement);
136 extern ParserCallbacks* g_callbacks;
138 // true if there was an error parsing, false otherwise
141 // the name of the file we're currently parsing
142 extern char const* g_currentFilename;
144 // the package name for our current file
145 extern char const* g_currentPackage;
148 STATEMENT_INSIDE_INTERFACE
151 void init_buffer_type(buffer_type* buf, int lineno);
159 #endif // DEVICE_TOOLS_AIDL_AIDL_LANGUAGE_H