Commit 9d918ba5 authored by claes's avatar claes

Try to install antlr 2.7.3 (failed)

parent d0384dce
......@@ -1210,12 +1210,17 @@ int wb_vrepwbl::load_files( const char *file_spec)
file[file_cnt]->parser = new wb_wblparser(*file[file_cnt]->lexer);
file[file_cnt]->parser->setFilename( found_file);
// Antlr 2.7.3 seems to want an ASTFactory here...
// wb_wblfactory *factory = new wb_wblfactory();
// file[file_cnt]->parser->setASTNodeFactory( factory);
file[file_cnt]->parser->setASTNodeFactory( wb_wblnode::factory);
try {
// Parse the input expression
file[file_cnt]->parser->unit();
file[file_cnt]->rootAST = file[file_cnt]->parser->getAST();
AST *a = file[file_cnt]->parser->getAST();
file[file_cnt]->rootAST = (wb_wblnode *) a;
if ( !file[file_cnt]->rootAST) {
error("File empty", found_file, 0);
file_cnt--;
......
......@@ -3,6 +3,7 @@
#include <iostream.h>
#include "antlr/CommonAST.hpp"
#include "antlr/ASTFactory.hpp"
#include "pwr.h"
#include "wb_name.h"
#include "wb_wblfile.h"
......@@ -262,6 +263,28 @@ public:
wbl_object *o;
};
#if 0
// Factory is needed in Antrl 2.7.3, not used in 2.7.1
class wb_wblfactory : public ASTFactory {
public:
typedef RefAST (*factory_type)();
wb_wblfactory() : nodeFactory(&wb_wblnode::factory) {}
ref_wblnode create( ref_wblnode tr) {
if ( !tr)
return (ref_wblnode) nullAST;
ref_wblnode t = (ref_wblnode)(nodeFactory)();
t->initialize(tr);
return t;
}
ref_wblnode dup( ref_wblnode t) {
return create(t);
}
private:
factory_type nodeFactory;
};
#endif
#endif
......
#ifndef INC_wb_wblparserTokenTypes_hpp_
#define INC_wb_wblparserTokenTypes_hpp_
/* $ANTLR 2.7.1: "wb_wblparser.g" -> "wb_wblparserTokenTypes.hpp"$ */
struct wb_wblparserTokenTypes {
/* $ANTLR 2.7.3 (20040413-1): "wb_wblparser.g" -> "wb_wblparserTokenTypes.hpp"$ */
#ifndef CUSTOM_API
# define CUSTOM_API
#endif
#ifdef __cplusplus
struct CUSTOM_API wb_wblparserTokenTypes {
#endif
enum {
EOF_ = 1,
OBJECT = 4,
......@@ -38,5 +45,7 @@ struct wb_wblparserTokenTypes {
SWEC = 34,
NULL_TREE_LOOKAHEAD = 3
};
#ifdef __cplusplus
};
#endif
#endif /*INC_wb_wblparserTokenTypes_hpp_*/
// $ANTLR 2.7.1: wb_wblparser.g -> wb_wblparserTokenTypes.txt$
// $ANTLR 2.7.3 (20040413-1): wb_wblparser.g -> wb_wblparserTokenTypes.txt$
wb_wblparser // output token vocab name
OBJECT=4
ENDOBJECT=5
......
#ifndef INC_wb_wblvocabTokenTypes_hpp_
#define INC_wb_wblvocabTokenTypes_hpp_
/* $ANTLR 2.7.1: "wb_wbllexer.g" -> "wb_wblvocabTokenTypes.hpp"$ */
struct wb_wblvocabTokenTypes {
/* $ANTLR 2.7.3 (20040413-1): "wb_wbllexer.g" -> "wb_wblvocabTokenTypes.hpp"$ */
#ifndef CUSTOM_API
# define CUSTOM_API
#endif
#ifdef __cplusplus
struct CUSTOM_API wb_wblvocabTokenTypes {
#endif
enum {
EOF_ = 1,
OBJECT = 4,
......@@ -38,5 +45,7 @@ struct wb_wblvocabTokenTypes {
SWEC = 34,
NULL_TREE_LOOKAHEAD = 3
};
#ifdef __cplusplus
};
#endif
#endif /*INC_wb_wblvocabTokenTypes_hpp_*/
// $ANTLR 2.7.1: wb_wbllexer.g -> wb_wblvocabTokenTypes.txt$
// $ANTLR 2.7.3 (20040413-1): wb_wbllexer.g -> wb_wblvocabTokenTypes.txt$
wb_wblvocab // output token vocab name
OBJECT=4
ENDOBJECT=5
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment