#include "avltree.h"
#include "parsedata.h"
-extern char *lelNames[];
+extern char *Parser_lelNames[];
struct LangEl;
# semi is sent as a token in the code block rather than as a generic
# symbol.
token TK_Semi;
-
- interface;
}%%
+ %%{ write instance_data; }%%
+
+ void init();
+ int parseLangEl( int type, const Token *token );
+
Parser( char *fileName, char *sectionName, InputLoc §ionLoc )
: sectionName(sectionName)
{
NameRefList nameRefList;
};
+%%{ write token_defs; }%%
+
#endif
}%%
+%%{
+ write types;
+ write data;
+}%%
+
+
+void Parser::init()
+{
+ %%{ write init; }%%
+}
+
+int Parser::parseLangEl( int type, const Token *token )
+{
+ %%{ write exec; }%%
+ return errCount == 0 ? 0 : -1;
+}
+
void Parser::tryMachineDef( InputLoc &loc, char *name,
JoinOrLm *joinOrLm, bool isInstance )
{
cerr << token.loc.fileName << ":" << token.loc.line << ":" << token.loc.col << ": ";
cerr << "at token ";
if ( tokId < 128 )
- cerr << "\"" << lelNames[tokId] << "\"";
+ cerr << "\"" << Parser_lelNames[tokId] << "\"";
else
- cerr << lelNames[tokId];
+ cerr << Parser_lelNames[tokId];
if ( token.data != 0 )
cerr << " with data \"" << token.data << "\"";
cerr << ": ";
token.data = tokstart;
token.length = toklen;
token.loc = loc;
- int res = parseLangEl( tokId, token );
+ int res = parseLangEl( tokId, &token );
if ( res < 0 ) {
parser_error(tokId, token) << "parse error" << endl;
exit(1);
TAG_set_tokend, TAG_get_tokend, TAG_init_tokstart,
TAG_set_tokstart, TAG_write, TAG_curstate, TAG_access, TAG_break,
TAG_option;
-
- interface;
}%%
+ %%{ write instance_data; }%%
+
+ void init();
+ int parseLangEl( int type, const Token *token );
+
Parser( char *fileName )
: fileName(fileName), sourceFileName(0) { }
CodeGenMap codeGenMap;
};
+%%{ write token_defs; }%%
+
#endif /* _XMLPARSE_H */
}%%
+%%{
+ write types;
+ write data;
+}%%
+
+void Parser::init()
+{
+ %%{ write init; }%%
+}
+
+int Parser::parseLangEl( int type, const Token *token )
+{
+ %%{ write exec; }%%
+ return errCount == 0 ? 0 : -1;
+}
+
+
unsigned long readLength( char *td )
{
return strtoul( td, 0, 10 );
int Parser::token( int tokenId, Token &tok )
{
- int res = parseLangEl( tokenId, tok );
+ int res = parseLangEl( tokenId, &tok );
if ( res < 0 ) {
parser_error( tokenId, tok ) << "parse error" << endl;
exit(1);