From 3e3d9eda9d1dd8c67c1c27c6a9bdc68bdecfcc30 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 17 Dec 2020 20:50:19 +0900 Subject: Renaming of files in preparation for code style tools. Signed-off-by: Michele Calgaro --- Makefile.am | 1 - buildtools/lib/parsers/autotools/Makefile.am | 2 +- buildtools/lib/parsers/qmake/location.h | 145 ++++++ buildtools/lib/parsers/qmake/location.hh | 145 ------ buildtools/lib/parsers/qmake/position.h | 142 +++++ buildtools/lib/parsers/qmake/position.hh | 142 ----- buildtools/lib/parsers/qmake/qmake.yy | 2 +- buildtools/lib/parsers/qmake/qmake_lex.h | 2 +- buildtools/lib/parsers/qmake/qmake_yacc.cpp | 6 +- buildtools/lib/parsers/qmake/qmake_yacc.h | 418 +++++++++++++++ buildtools/lib/parsers/qmake/qmake_yacc.hpp | 418 --------------- buildtools/lib/parsers/qmake/qmakedriver.cpp | 2 +- buildtools/lib/parsers/qmake/stack.h | 129 +++++ buildtools/lib/parsers/qmake/stack.hh | 129 ----- languages/ada/AdaAST.h | 77 +++ languages/ada/AdaAST.hpp | 77 --- languages/ada/AdaLexer.cpp | 16 +- languages/ada/AdaLexer.h | 86 +++ languages/ada/AdaLexer.hpp | 86 --- languages/ada/AdaParser.cpp | 8 +- languages/ada/AdaParser.h | 389 ++++++++++++++ languages/ada/AdaParser.hpp | 389 -------------- languages/ada/AdaStoreWalker.cpp | 14 +- languages/ada/AdaStoreWalker.h | 350 +++++++++++++ languages/ada/AdaStoreWalker.hpp | 350 ------------- languages/ada/AdaStoreWalkerTokenTypes.h | 307 +++++++++++ languages/ada/AdaStoreWalkerTokenTypes.hpp | 307 ----------- languages/ada/AdaTokenTypes.h | 306 +++++++++++ languages/ada/AdaTokenTypes.hpp | 306 ----------- languages/ada/AdaTreeParserSuper.cpp | 14 +- languages/ada/AdaTreeParserSuper.h | 241 +++++++++ languages/ada/AdaTreeParserSuper.hpp | 241 --------- languages/ada/AdaTreeParserSuperTokenTypes.h | 307 +++++++++++ languages/ada/AdaTreeParserSuperTokenTypes.hpp | 307 ----------- languages/ada/Makefile.am | 6 +- languages/ada/README.dox | 6 +- languages/ada/ada.g | 4 +- languages/ada/ada.store.g | 4 +- languages/ada/ada_utils.cpp | 4 +- languages/ada/ada_utils.h | 15 + languages/ada/ada_utils.hpp | 15 - languages/ada/adasupport.cpp | 8 +- languages/ada/adasupport.h | 13 + languages/ada/adasupport.hpp | 13 - languages/ada/adasupportpart.cpp | 8 +- languages/ada/backgroundparser.cpp | 6 +- .../cpp/app_templates/gnome2mmapp/Makefile.am | 10 +- .../cpp/app_templates/gnome2mmapp/gnome2mm.cc | 22 - .../cpp/app_templates/gnome2mmapp/gnome2mm.cpp | 22 + .../gnome2mmapp/gnome2mmapp.kdevtemplate | 20 +- .../cpp/app_templates/gnome2mmapp/main_window.cc | 16 - .../cpp/app_templates/gnome2mmapp/main_window.cpp | 14 + .../cpp/app_templates/gnome2mmapp/main_window.h | 17 + .../cpp/app_templates/gnome2mmapp/main_window.hh | 19 - .../app_templates/gnome2mmapp/main_window_glade.cc | 30 -- .../gnome2mmapp/main_window_glade.cpp | 30 ++ .../app_templates/gnome2mmapp/main_window_glade.h | 49 ++ .../app_templates/gnome2mmapp/main_window_glade.hh | 49 -- .../cpp/app_templates/gnome2mmapp/src-Makefile.am | 10 +- .../cpp/app_templates/gtk2mmapp/CMakeLists.txt | 8 +- languages/cpp/app_templates/gtk2mmapp/Makefile.am | 10 +- languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc | 15 - languages/cpp/app_templates/gtk2mmapp/gtk2mm.cpp | 15 + .../app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate | 20 +- .../cpp/app_templates/gtk2mmapp/main_window.cc | 12 - .../cpp/app_templates/gtk2mmapp/main_window.cpp | 10 + .../cpp/app_templates/gtk2mmapp/main_window.h | 17 + .../cpp/app_templates/gtk2mmapp/main_window.hh | 19 - .../app_templates/gtk2mmapp/main_window_glade.cc | 40 -- .../app_templates/gtk2mmapp/main_window_glade.cpp | 40 ++ .../app_templates/gtk2mmapp/main_window_glade.h | 48 ++ .../app_templates/gtk2mmapp/main_window_glade.hh | 48 -- .../cpp/app_templates/gtk2mmapp/src-Makefile.am | 10 +- languages/java/JavaAST.h | 77 +++ languages/java/JavaAST.hpp | 77 --- languages/java/JavaLexer.cpp | 16 +- languages/java/JavaLexer.h | 132 +++++ languages/java/JavaLexer.hpp | 132 ----- languages/java/JavaRecognizer.cpp | 8 +- languages/java/JavaRecognizer.h | 423 +++++++++++++++ languages/java/JavaRecognizer.hpp | 423 --------------- languages/java/JavaStoreWalker.cpp | 14 +- languages/java/JavaStoreWalker.h | 164 ++++++ languages/java/JavaStoreWalker.hpp | 164 ------ languages/java/JavaStoreWalkerTokenTypes.h | 169 ++++++ languages/java/JavaStoreWalkerTokenTypes.hpp | 169 ------ languages/java/JavaTokenTypes.h | 168 ++++++ languages/java/JavaTokenTypes.hpp | 168 ------ languages/java/Makefile.am | 4 +- languages/java/backgroundparser.h | 2 +- languages/java/driver.cpp | 6 +- languages/java/driver.h | 2 +- languages/java/java.g | 2 +- languages/java/java.store.g | 2 +- languages/java/javasupportpart.cpp | 4 +- languages/java/kdevdriver.cpp | 2 +- languages/pascal/Makefile.am | 4 +- languages/pascal/PascalAST.h | 51 ++ languages/pascal/PascalAST.hpp | 51 -- languages/pascal/PascalLexer.cpp | 16 +- languages/pascal/PascalLexer.h | 121 +++++ languages/pascal/PascalLexer.hpp | 121 ----- languages/pascal/PascalParser.cpp | 8 +- languages/pascal/PascalParser.h | 422 +++++++++++++++ languages/pascal/PascalParser.hpp | 422 --------------- languages/pascal/PascalStoreWalker.cpp | 14 +- languages/pascal/PascalStoreWalker.h | 172 ++++++ languages/pascal/PascalStoreWalker.hpp | 172 ------ languages/pascal/PascalStoreWalkerTokenTypes.h | 206 ++++++++ languages/pascal/PascalStoreWalkerTokenTypes.hpp | 206 -------- languages/pascal/PascalTokenTypes.h | 209 ++++++++ languages/pascal/PascalTokenTypes.hpp | 209 -------- languages/pascal/backgroundparser.cpp | 8 +- languages/pascal/pascal.g | 2 +- languages/pascal/pascal.tree.g | 2 +- languages/pascal/pascalsupport_part.cpp | 8 +- lib/antlr/README | 2 +- lib/antlr/TODO | 2 +- lib/antlr/antlr/ANTLRException.h | 59 +++ lib/antlr/antlr/ANTLRException.hpp | 59 --- lib/antlr/antlr/ANTLRUtil.h | 53 ++ lib/antlr/antlr/ANTLRUtil.hpp | 53 -- lib/antlr/antlr/AST.h | 166 ++++++ lib/antlr/antlr/AST.hpp | 166 ------ lib/antlr/antlr/ASTArray.h | 45 ++ lib/antlr/antlr/ASTArray.hpp | 45 -- lib/antlr/antlr/ASTFactory.h | 165 ++++++ lib/antlr/antlr/ASTFactory.hpp | 165 ------ lib/antlr/antlr/ASTNULLType.h | 64 +++ lib/antlr/antlr/ASTNULLType.hpp | 64 --- lib/antlr/antlr/ASTPair.h | 57 ++ lib/antlr/antlr/ASTPair.hpp | 57 -- lib/antlr/antlr/ASTRefCount.h | 98 ++++ lib/antlr/antlr/ASTRefCount.hpp | 98 ---- lib/antlr/antlr/BaseAST.h | 193 +++++++ lib/antlr/antlr/BaseAST.hpp | 193 ------- lib/antlr/antlr/BitSet.h | 60 +++ lib/antlr/antlr/BitSet.hpp | 60 --- lib/antlr/antlr/CharBuffer.h | 56 ++ lib/antlr/antlr/CharBuffer.hpp | 56 -- lib/antlr/antlr/CharInputBuffer.h | 77 +++ lib/antlr/antlr/CharInputBuffer.hpp | 77 --- lib/antlr/antlr/CharScanner.h | 576 +++++++++++++++++++++ lib/antlr/antlr/CharScanner.hpp | 576 --------------------- lib/antlr/antlr/CharStreamException.h | 29 ++ lib/antlr/antlr/CharStreamException.hpp | 29 -- lib/antlr/antlr/CharStreamIOException.h | 31 ++ lib/antlr/antlr/CharStreamIOException.hpp | 31 -- lib/antlr/antlr/CircularQueue.h | 100 ++++ lib/antlr/antlr/CircularQueue.hpp | 100 ---- lib/antlr/antlr/CommonAST.h | 110 ++++ lib/antlr/antlr/CommonAST.hpp | 110 ---- lib/antlr/antlr/CommonASTWithHiddenTokens.h | 60 +++ lib/antlr/antlr/CommonASTWithHiddenTokens.hpp | 60 --- lib/antlr/antlr/CommonHiddenStreamToken.h | 41 ++ lib/antlr/antlr/CommonHiddenStreamToken.hpp | 41 -- lib/antlr/antlr/CommonToken.h | 83 +++ lib/antlr/antlr/CommonToken.hpp | 83 --- lib/antlr/antlr/IOException.h | 45 ++ lib/antlr/antlr/IOException.hpp | 45 -- lib/antlr/antlr/InputBuffer.h | 146 ++++++ lib/antlr/antlr/InputBuffer.hpp | 146 ------ lib/antlr/antlr/LLkParser.h | 67 +++ lib/antlr/antlr/LLkParser.hpp | 67 --- lib/antlr/antlr/LexerSharedInputState.h | 156 ++++++ lib/antlr/antlr/LexerSharedInputState.hpp | 156 ------ lib/antlr/antlr/Makefile.am | 2 +- lib/antlr/antlr/MismatchedCharException.h | 102 ++++ lib/antlr/antlr/MismatchedCharException.hpp | 102 ---- lib/antlr/antlr/MismatchedTokenException.h | 144 ++++++ lib/antlr/antlr/MismatchedTokenException.hpp | 144 ------ lib/antlr/antlr/NoViableAltException.h | 40 ++ lib/antlr/antlr/NoViableAltException.hpp | 40 -- lib/antlr/antlr/NoViableAltForCharException.h | 41 ++ lib/antlr/antlr/NoViableAltForCharException.hpp | 41 -- lib/antlr/antlr/Parser.h | 319 ++++++++++++ lib/antlr/antlr/Parser.hpp | 319 ------------ lib/antlr/antlr/ParserSharedInputState.h | 92 ++++ lib/antlr/antlr/ParserSharedInputState.hpp | 92 ---- lib/antlr/antlr/RecognitionException.h | 66 +++ lib/antlr/antlr/RecognitionException.hpp | 66 --- lib/antlr/antlr/RefCount.h | 80 +++ lib/antlr/antlr/RefCount.hpp | 80 --- lib/antlr/antlr/SemanticException.h | 40 ++ lib/antlr/antlr/SemanticException.hpp | 40 -- lib/antlr/antlr/String.h | 27 + lib/antlr/antlr/String.hpp | 27 - lib/antlr/antlr/Token.h | 108 ++++ lib/antlr/antlr/Token.hpp | 108 ---- lib/antlr/antlr/TokenBuffer.h | 121 +++++ lib/antlr/antlr/TokenBuffer.hpp | 121 ----- lib/antlr/antlr/TokenRefCount.h | 98 ++++ lib/antlr/antlr/TokenRefCount.hpp | 98 ---- lib/antlr/antlr/TokenStream.h | 34 ++ lib/antlr/antlr/TokenStream.hpp | 34 -- lib/antlr/antlr/TokenStreamBasicFilter.h | 46 ++ lib/antlr/antlr/TokenStreamBasicFilter.hpp | 46 -- lib/antlr/antlr/TokenStreamException.h | 41 ++ lib/antlr/antlr/TokenStreamException.hpp | 41 -- lib/antlr/antlr/TokenStreamHiddenTokenFilter.h | 95 ++++ lib/antlr/antlr/TokenStreamHiddenTokenFilter.hpp | 95 ---- lib/antlr/antlr/TokenStreamIOException.h | 40 ++ lib/antlr/antlr/TokenStreamIOException.hpp | 40 -- lib/antlr/antlr/TokenStreamRecognitionException.h | 57 ++ .../antlr/TokenStreamRecognitionException.hpp | 57 -- lib/antlr/antlr/TokenStreamRetryException.h | 28 + lib/antlr/antlr/TokenStreamRetryException.hpp | 28 - lib/antlr/antlr/TokenStreamRewriteEngine.h | 439 ++++++++++++++++ lib/antlr/antlr/TokenStreamRewriteEngine.hpp | 439 ---------------- lib/antlr/antlr/TokenStreamSelector.h | 87 ++++ lib/antlr/antlr/TokenStreamSelector.hpp | 87 ---- lib/antlr/antlr/TokenWithIndex.h | 84 +++ lib/antlr/antlr/TokenWithIndex.hpp | 84 --- lib/antlr/antlr/TreeParser.h | 155 ++++++ lib/antlr/antlr/TreeParser.hpp | 155 ------ lib/antlr/antlr/TreeParserSharedInputState.h | 45 ++ lib/antlr/antlr/TreeParserSharedInputState.hpp | 45 -- lib/antlr/antlr/config.h | 290 +++++++++++ lib/antlr/antlr/config.hpp | 290 ----------- lib/antlr/src/ANTLRUtil.cpp | 4 +- lib/antlr/src/ASTFactory.cpp | 10 +- lib/antlr/src/ASTNULLType.cpp | 6 +- lib/antlr/src/ASTRefCount.cpp | 4 +- lib/antlr/src/BaseAST.cpp | 6 +- lib/antlr/src/BitSet.cpp | 2 +- lib/antlr/src/CharBuffer.cpp | 2 +- lib/antlr/src/CharScanner.cpp | 4 +- lib/antlr/src/CommonAST.cpp | 6 +- lib/antlr/src/CommonASTWithHiddenTokens.cpp | 12 +- lib/antlr/src/CommonHiddenStreamToken.cpp | 2 +- lib/antlr/src/CommonToken.cpp | 4 +- lib/antlr/src/InputBuffer.cpp | 4 +- lib/antlr/src/LLkParser.cpp | 2 +- lib/antlr/src/MismatchedCharException.cpp | 6 +- lib/antlr/src/MismatchedTokenException.cpp | 4 +- lib/antlr/src/NoViableAltException.cpp | 4 +- lib/antlr/src/NoViableAltForCharException.cpp | 4 +- lib/antlr/src/Parser.cpp | 2 +- lib/antlr/src/RecognitionException.cpp | 4 +- lib/antlr/src/String.cpp | 2 +- lib/antlr/src/Token.cpp | 4 +- lib/antlr/src/TokenBuffer.cpp | 2 +- lib/antlr/src/TokenRefCount.cpp | 4 +- lib/antlr/src/TokenStreamBasicFilter.cpp | 2 +- lib/antlr/src/TokenStreamHiddenTokenFilter.cpp | 4 +- lib/antlr/src/TokenStreamRewriteEngine.cpp | 10 +- lib/antlr/src/TokenStreamSelector.cpp | 4 +- lib/antlr/src/TreeParser.cpp | 4 +- parts/tipofday/Makefile.am | 6 +- 249 files changed, 10989 insertions(+), 10998 deletions(-) create mode 100644 buildtools/lib/parsers/qmake/location.h delete mode 100644 buildtools/lib/parsers/qmake/location.hh create mode 100644 buildtools/lib/parsers/qmake/position.h delete mode 100644 buildtools/lib/parsers/qmake/position.hh create mode 100644 buildtools/lib/parsers/qmake/qmake_yacc.h delete mode 100644 buildtools/lib/parsers/qmake/qmake_yacc.hpp create mode 100644 buildtools/lib/parsers/qmake/stack.h delete mode 100644 buildtools/lib/parsers/qmake/stack.hh create mode 100644 languages/ada/AdaAST.h delete mode 100644 languages/ada/AdaAST.hpp create mode 100644 languages/ada/AdaLexer.h delete mode 100644 languages/ada/AdaLexer.hpp create mode 100644 languages/ada/AdaParser.h delete mode 100644 languages/ada/AdaParser.hpp create mode 100644 languages/ada/AdaStoreWalker.h delete mode 100644 languages/ada/AdaStoreWalker.hpp create mode 100644 languages/ada/AdaStoreWalkerTokenTypes.h delete mode 100644 languages/ada/AdaStoreWalkerTokenTypes.hpp create mode 100644 languages/ada/AdaTokenTypes.h delete mode 100644 languages/ada/AdaTokenTypes.hpp create mode 100644 languages/ada/AdaTreeParserSuper.h delete mode 100644 languages/ada/AdaTreeParserSuper.hpp create mode 100644 languages/ada/AdaTreeParserSuperTokenTypes.h delete mode 100644 languages/ada/AdaTreeParserSuperTokenTypes.hpp create mode 100644 languages/ada/ada_utils.h delete mode 100644 languages/ada/ada_utils.hpp create mode 100644 languages/ada/adasupport.h delete mode 100644 languages/ada/adasupport.hpp delete mode 100644 languages/cpp/app_templates/gnome2mmapp/gnome2mm.cc create mode 100644 languages/cpp/app_templates/gnome2mmapp/gnome2mm.cpp delete mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window.cc create mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window.cpp create mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window.h delete mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window.hh delete mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window_glade.cc create mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window_glade.cpp create mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window_glade.h delete mode 100644 languages/cpp/app_templates/gnome2mmapp/main_window_glade.hh delete mode 100644 languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc create mode 100644 languages/cpp/app_templates/gtk2mmapp/gtk2mm.cpp delete mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window.cc create mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window.cpp create mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window.h delete mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window.hh delete mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window_glade.cc create mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window_glade.cpp create mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window_glade.h delete mode 100644 languages/cpp/app_templates/gtk2mmapp/main_window_glade.hh create mode 100644 languages/java/JavaAST.h delete mode 100644 languages/java/JavaAST.hpp create mode 100644 languages/java/JavaLexer.h delete mode 100644 languages/java/JavaLexer.hpp create mode 100644 languages/java/JavaRecognizer.h delete mode 100644 languages/java/JavaRecognizer.hpp create mode 100644 languages/java/JavaStoreWalker.h delete mode 100644 languages/java/JavaStoreWalker.hpp create mode 100644 languages/java/JavaStoreWalkerTokenTypes.h delete mode 100644 languages/java/JavaStoreWalkerTokenTypes.hpp create mode 100644 languages/java/JavaTokenTypes.h delete mode 100644 languages/java/JavaTokenTypes.hpp create mode 100644 languages/pascal/PascalAST.h delete mode 100644 languages/pascal/PascalAST.hpp create mode 100644 languages/pascal/PascalLexer.h delete mode 100644 languages/pascal/PascalLexer.hpp create mode 100644 languages/pascal/PascalParser.h delete mode 100644 languages/pascal/PascalParser.hpp create mode 100644 languages/pascal/PascalStoreWalker.h delete mode 100644 languages/pascal/PascalStoreWalker.hpp create mode 100644 languages/pascal/PascalStoreWalkerTokenTypes.h delete mode 100644 languages/pascal/PascalStoreWalkerTokenTypes.hpp create mode 100644 languages/pascal/PascalTokenTypes.h delete mode 100644 languages/pascal/PascalTokenTypes.hpp create mode 100644 lib/antlr/antlr/ANTLRException.h delete mode 100644 lib/antlr/antlr/ANTLRException.hpp create mode 100644 lib/antlr/antlr/ANTLRUtil.h delete mode 100644 lib/antlr/antlr/ANTLRUtil.hpp create mode 100644 lib/antlr/antlr/AST.h delete mode 100644 lib/antlr/antlr/AST.hpp create mode 100644 lib/antlr/antlr/ASTArray.h delete mode 100644 lib/antlr/antlr/ASTArray.hpp create mode 100644 lib/antlr/antlr/ASTFactory.h delete mode 100644 lib/antlr/antlr/ASTFactory.hpp create mode 100644 lib/antlr/antlr/ASTNULLType.h delete mode 100644 lib/antlr/antlr/ASTNULLType.hpp create mode 100644 lib/antlr/antlr/ASTPair.h delete mode 100644 lib/antlr/antlr/ASTPair.hpp create mode 100644 lib/antlr/antlr/ASTRefCount.h delete mode 100644 lib/antlr/antlr/ASTRefCount.hpp create mode 100644 lib/antlr/antlr/BaseAST.h delete mode 100644 lib/antlr/antlr/BaseAST.hpp create mode 100644 lib/antlr/antlr/BitSet.h delete mode 100644 lib/antlr/antlr/BitSet.hpp create mode 100644 lib/antlr/antlr/CharBuffer.h delete mode 100644 lib/antlr/antlr/CharBuffer.hpp create mode 100644 lib/antlr/antlr/CharInputBuffer.h delete mode 100644 lib/antlr/antlr/CharInputBuffer.hpp create mode 100644 lib/antlr/antlr/CharScanner.h delete mode 100644 lib/antlr/antlr/CharScanner.hpp create mode 100644 lib/antlr/antlr/CharStreamException.h delete mode 100644 lib/antlr/antlr/CharStreamException.hpp create mode 100644 lib/antlr/antlr/CharStreamIOException.h delete mode 100644 lib/antlr/antlr/CharStreamIOException.hpp create mode 100644 lib/antlr/antlr/CircularQueue.h delete mode 100644 lib/antlr/antlr/CircularQueue.hpp create mode 100644 lib/antlr/antlr/CommonAST.h delete mode 100644 lib/antlr/antlr/CommonAST.hpp create mode 100644 lib/antlr/antlr/CommonASTWithHiddenTokens.h delete mode 100644 lib/antlr/antlr/CommonASTWithHiddenTokens.hpp create mode 100644 lib/antlr/antlr/CommonHiddenStreamToken.h delete mode 100644 lib/antlr/antlr/CommonHiddenStreamToken.hpp create mode 100644 lib/antlr/antlr/CommonToken.h delete mode 100644 lib/antlr/antlr/CommonToken.hpp create mode 100644 lib/antlr/antlr/IOException.h delete mode 100644 lib/antlr/antlr/IOException.hpp create mode 100644 lib/antlr/antlr/InputBuffer.h delete mode 100644 lib/antlr/antlr/InputBuffer.hpp create mode 100644 lib/antlr/antlr/LLkParser.h delete mode 100644 lib/antlr/antlr/LLkParser.hpp create mode 100644 lib/antlr/antlr/LexerSharedInputState.h delete mode 100644 lib/antlr/antlr/LexerSharedInputState.hpp create mode 100644 lib/antlr/antlr/MismatchedCharException.h delete mode 100644 lib/antlr/antlr/MismatchedCharException.hpp create mode 100644 lib/antlr/antlr/MismatchedTokenException.h delete mode 100644 lib/antlr/antlr/MismatchedTokenException.hpp create mode 100644 lib/antlr/antlr/NoViableAltException.h delete mode 100644 lib/antlr/antlr/NoViableAltException.hpp create mode 100644 lib/antlr/antlr/NoViableAltForCharException.h delete mode 100644 lib/antlr/antlr/NoViableAltForCharException.hpp create mode 100644 lib/antlr/antlr/Parser.h delete mode 100644 lib/antlr/antlr/Parser.hpp create mode 100644 lib/antlr/antlr/ParserSharedInputState.h delete mode 100644 lib/antlr/antlr/ParserSharedInputState.hpp create mode 100644 lib/antlr/antlr/RecognitionException.h delete mode 100644 lib/antlr/antlr/RecognitionException.hpp create mode 100644 lib/antlr/antlr/RefCount.h delete mode 100644 lib/antlr/antlr/RefCount.hpp create mode 100644 lib/antlr/antlr/SemanticException.h delete mode 100644 lib/antlr/antlr/SemanticException.hpp create mode 100644 lib/antlr/antlr/String.h delete mode 100644 lib/antlr/antlr/String.hpp create mode 100644 lib/antlr/antlr/Token.h delete mode 100644 lib/antlr/antlr/Token.hpp create mode 100644 lib/antlr/antlr/TokenBuffer.h delete mode 100644 lib/antlr/antlr/TokenBuffer.hpp create mode 100644 lib/antlr/antlr/TokenRefCount.h delete mode 100644 lib/antlr/antlr/TokenRefCount.hpp create mode 100644 lib/antlr/antlr/TokenStream.h delete mode 100644 lib/antlr/antlr/TokenStream.hpp create mode 100644 lib/antlr/antlr/TokenStreamBasicFilter.h delete mode 100644 lib/antlr/antlr/TokenStreamBasicFilter.hpp create mode 100644 lib/antlr/antlr/TokenStreamException.h delete mode 100644 lib/antlr/antlr/TokenStreamException.hpp create mode 100644 lib/antlr/antlr/TokenStreamHiddenTokenFilter.h delete mode 100644 lib/antlr/antlr/TokenStreamHiddenTokenFilter.hpp create mode 100644 lib/antlr/antlr/TokenStreamIOException.h delete mode 100644 lib/antlr/antlr/TokenStreamIOException.hpp create mode 100644 lib/antlr/antlr/TokenStreamRecognitionException.h delete mode 100644 lib/antlr/antlr/TokenStreamRecognitionException.hpp create mode 100644 lib/antlr/antlr/TokenStreamRetryException.h delete mode 100644 lib/antlr/antlr/TokenStreamRetryException.hpp create mode 100644 lib/antlr/antlr/TokenStreamRewriteEngine.h delete mode 100644 lib/antlr/antlr/TokenStreamRewriteEngine.hpp create mode 100644 lib/antlr/antlr/TokenStreamSelector.h delete mode 100644 lib/antlr/antlr/TokenStreamSelector.hpp create mode 100644 lib/antlr/antlr/TokenWithIndex.h delete mode 100644 lib/antlr/antlr/TokenWithIndex.hpp create mode 100644 lib/antlr/antlr/TreeParser.h delete mode 100644 lib/antlr/antlr/TreeParser.hpp create mode 100644 lib/antlr/antlr/TreeParserSharedInputState.h delete mode 100644 lib/antlr/antlr/TreeParserSharedInputState.hpp create mode 100644 lib/antlr/antlr/config.h delete mode 100644 lib/antlr/antlr/config.hpp diff --git a/Makefile.am b/Makefile.am index 10a75db6..791e596c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,7 +36,6 @@ messages: done dirs=`cat dirs` ;\ find $$dirs -maxdepth 1 -name "*.cpp" -print > files ;\ - find $$dirs -maxdepth 1 -name "*.cc" -print >> files ;\ find $$dirs -maxdepth 1 -name "*.h" -print >> files ;\ $(EXTRACTRC) `find $$dirs -maxdepth 1 -name "*.rc"` > rc.cpp ;\ $(EXTRACTRC) `find $$dirs -maxdepth 1 -name "*.ui"` >> rc.cpp ;\ diff --git a/buildtools/lib/parsers/autotools/Makefile.am b/buildtools/lib/parsers/autotools/Makefile.am index 340d0e38..950d6571 100644 --- a/buildtools/lib/parsers/autotools/Makefile.am +++ b/buildtools/lib/parsers/autotools/Makefile.am @@ -13,7 +13,7 @@ libkdevautotoolsparser_la_SOURCES = autotoolsast.cpp autotoolsdriver.cpp autotoo parser: cd $(srcdir) ; \ bison -d autotools.yy -o autotools_yacc.cpp ; \ - mv -f autotools_yacc.hpp autotools_yacc.h ; \ + mv -f autotools_yacc.h autotools_yacc.h ; \ flex -oautotools_lex.cpp autotools.ll EXTRA_DIST = autotools.yy autotools.ll diff --git a/buildtools/lib/parsers/qmake/location.h b/buildtools/lib/parsers/qmake/location.h new file mode 100644 index 00000000..f97af783 --- /dev/null +++ b/buildtools/lib/parsers/qmake/location.h @@ -0,0 +1,145 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Locations for Bison parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file location.h + ** Define the TQMake::location class. + */ + +#ifndef BISON_LOCATION_H +# define BISON_LOCATION_H + +# include +# include +# include "position.h" + +namespace TQMake +{ + + /// Abstract a location. + class location + { + public: + + /// Construct a location. + location () + : begin (), end () + { + } + + + /// Initialization. + inline void initialize (std::string* fn) + { + begin.initialize (fn); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + inline void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + inline void columns (unsigned int count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + inline void lines (unsigned int count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two location objects to create a location. + inline const location operator+ (const location& begin, const location& end) + { + location res = begin; + res.end = end.end; + return res; + } + + /// Add two location objects. + inline const location operator+ (const location& begin, unsigned int width) + { + location res = begin; + res.columns (width); + return res; + } + + /// Add and assign a location. + inline location& operator+= (location& res, unsigned int width) + { + res.columns (width); + return res; + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + inline std::ostream& operator<< (std::ostream& ostr, const location& loc) + { + position last = loc.end - 1; + ostr << loc.begin; + if (last.filename + && (!loc.begin.filename + || *loc.begin.filename != *last.filename)) + ostr << '-' << last; + else if (loc.begin.line != last.line) + ostr << '-' << last.line << '.' << last.column; + else if (loc.begin.column != last.column) + ostr << '-' << last.column; + return ostr; + } + +} + +#endif // not BISON_LOCATION_H diff --git a/buildtools/lib/parsers/qmake/location.hh b/buildtools/lib/parsers/qmake/location.hh deleted file mode 100644 index d6247645..00000000 --- a/buildtools/lib/parsers/qmake/location.hh +++ /dev/null @@ -1,145 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Locations for Bison parsers in C++ - - Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/** - ** \file location.hh - ** Define the TQMake::location class. - */ - -#ifndef BISON_LOCATION_HH -# define BISON_LOCATION_HH - -# include -# include -# include "position.hh" - -namespace TQMake -{ - - /// Abstract a location. - class location - { - public: - - /// Construct a location. - location () - : begin (), end () - { - } - - - /// Initialization. - inline void initialize (std::string* fn) - { - begin.initialize (fn); - end = begin; - } - - /** \name Line and Column related manipulators - ** \{ */ - public: - /// Reset initial location to final location. - inline void step () - { - begin = end; - } - - /// Extend the current location to the COUNT next columns. - inline void columns (unsigned int count = 1) - { - end += count; - } - - /// Extend the current location to the COUNT next lines. - inline void lines (unsigned int count = 1) - { - end.lines (count); - } - /** \} */ - - - public: - /// Beginning of the located region. - position begin; - /// End of the located region. - position end; - }; - - /// Join two location objects to create a location. - inline const location operator+ (const location& begin, const location& end) - { - location res = begin; - res.end = end.end; - return res; - } - - /// Add two location objects. - inline const location operator+ (const location& begin, unsigned int width) - { - location res = begin; - res.columns (width); - return res; - } - - /// Add and assign a location. - inline location& operator+= (location& res, unsigned int width) - { - res.columns (width); - return res; - } - - /** \brief Intercept output stream redirection. - ** \param ostr the destination output stream - ** \param loc a reference to the location to redirect - ** - ** Avoid duplicate information. - */ - inline std::ostream& operator<< (std::ostream& ostr, const location& loc) - { - position last = loc.end - 1; - ostr << loc.begin; - if (last.filename - && (!loc.begin.filename - || *loc.begin.filename != *last.filename)) - ostr << '-' << last; - else if (loc.begin.line != last.line) - ostr << '-' << last.line << '.' << last.column; - else if (loc.begin.column != last.column) - ostr << '-' << last.column; - return ostr; - } - -} - -#endif // not BISON_LOCATION_HH diff --git a/buildtools/lib/parsers/qmake/position.h b/buildtools/lib/parsers/qmake/position.h new file mode 100644 index 00000000..9f5951f0 --- /dev/null +++ b/buildtools/lib/parsers/qmake/position.h @@ -0,0 +1,142 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Positions for Bison parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/** + ** \file position.h + ** Define the TQMake::position class. + */ + +#ifndef BISON_POSITION_H +# define BISON_POSITION_H + +# include +# include + +namespace TQMake +{ + /// Abstract a position. + class position + { + public: + + /// Construct a position. + position () + : filename (0), line (1), column (0) + { + } + + + /// Initialization. + inline void initialize (std::string* fn) + { + filename = fn; + line = 1; + column = 0; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// (line related) Advance to the COUNT next lines. + inline void lines (int count = 1) + { + column = 0; + line += count; + } + + /// (column related) Advance to the COUNT next columns. + inline void columns (int count = 1) + { + int leftmost = 0; + int current = column; + if (leftmost <= current + count) + column += count; + else + column = 0; + } + /** \} */ + + public: + /// File name to which this position refers. + std::string* filename; + /// Current line number. + unsigned int line; + /// Current column number. + unsigned int column; + }; + + /// Add and assign a position. + inline const position& + operator+= (position& res, const int width) + { + res.columns (width); + return res; + } + + /// Add two position objects. + inline const position + operator+ (const position& begin, const int width) + { + position res = begin; + return res += width; + } + + /// Add and assign a position. + inline const position& + operator-= (position& res, const int width) + { + return res += -width; + } + + /// Add two position objects. + inline const position + operator- (const position& begin, const int width) + { + return begin + -width; + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + inline std::ostream& + operator<< (std::ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + +} +#endif // not BISON_POSITION_H diff --git a/buildtools/lib/parsers/qmake/position.hh b/buildtools/lib/parsers/qmake/position.hh deleted file mode 100644 index 6e95eb95..00000000 --- a/buildtools/lib/parsers/qmake/position.hh +++ /dev/null @@ -1,142 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Positions for Bison parsers in C++ - - Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/** - ** \file position.hh - ** Define the TQMake::position class. - */ - -#ifndef BISON_POSITION_HH -# define BISON_POSITION_HH - -# include -# include - -namespace TQMake -{ - /// Abstract a position. - class position - { - public: - - /// Construct a position. - position () - : filename (0), line (1), column (0) - { - } - - - /// Initialization. - inline void initialize (std::string* fn) - { - filename = fn; - line = 1; - column = 0; - } - - /** \name Line and Column related manipulators - ** \{ */ - public: - /// (line related) Advance to the COUNT next lines. - inline void lines (int count = 1) - { - column = 0; - line += count; - } - - /// (column related) Advance to the COUNT next columns. - inline void columns (int count = 1) - { - int leftmost = 0; - int current = column; - if (leftmost <= current + count) - column += count; - else - column = 0; - } - /** \} */ - - public: - /// File name to which this position refers. - std::string* filename; - /// Current line number. - unsigned int line; - /// Current column number. - unsigned int column; - }; - - /// Add and assign a position. - inline const position& - operator+= (position& res, const int width) - { - res.columns (width); - return res; - } - - /// Add two position objects. - inline const position - operator+ (const position& begin, const int width) - { - position res = begin; - return res += width; - } - - /// Add and assign a position. - inline const position& - operator-= (position& res, const int width) - { - return res += -width; - } - - /// Add two position objects. - inline const position - operator- (const position& begin, const int width) - { - return begin + -width; - } - - /** \brief Intercept output stream redirection. - ** \param ostr the destination output stream - ** \param pos a reference to the position to redirect - */ - inline std::ostream& - operator<< (std::ostream& ostr, const position& pos) - { - if (pos.filename) - ostr << *pos.filename << ':'; - return ostr << pos.line << '.' << pos.column; - } - -} -#endif // not BISON_POSITION_HH diff --git a/buildtools/lib/parsers/qmake/qmake.yy b/buildtools/lib/parsers/qmake/qmake.yy index 3cc0b79d..2c3e866d 100644 --- a/buildtools/lib/parsers/qmake/qmake.yy +++ b/buildtools/lib/parsers/qmake/qmake.yy @@ -109,7 +109,7 @@ Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp. */ %} -%skeleton "lalr1.cc" +%skeleton "lalr1.cpp" %define "parser_class_name" "Parser" %name-prefix="QMake" %parse-param { QMake::Lexer* lexer } diff --git a/buildtools/lib/parsers/qmake/qmake_lex.h b/buildtools/lib/parsers/qmake/qmake_lex.h index 25aa402d..4bed35dd 100644 --- a/buildtools/lib/parsers/qmake/qmake_lex.h +++ b/buildtools/lib/parsers/qmake/qmake_lex.h @@ -20,7 +20,7 @@ #ifndef TQMAKE_LEX_H #define TQMAKE_LEX_H -#include "qmake_yacc.hpp" +#include "qmake_yacc.h" #include #ifndef DONT_INCLUDE_FLEXLEXER diff --git a/buildtools/lib/parsers/qmake/qmake_yacc.cpp b/buildtools/lib/parsers/qmake/qmake_yacc.cpp index f9dea804..25ae0e85 100644 --- a/buildtools/lib/parsers/qmake/qmake_yacc.cpp +++ b/buildtools/lib/parsers/qmake/qmake_yacc.cpp @@ -35,12 +35,12 @@ // Take the name prefix into account. #define yylex TQMakelex -#include "qmake_yacc.hpp" +#include "qmake_yacc.h" /* User implementation prologue. */ -/* Line 317 of lalr1.cc. */ +/* Line 317 of lalr1.cpp. */ #line 45 "tqmake_yacc.cpp" #ifndef YY_ @@ -751,7 +751,7 @@ namespace TQMake break; - /* Line 675 of lalr1.cc. */ + /* Line 675 of lalr1.cpp. */ #line 756 "tqmake_yacc.cpp" default: break; } diff --git a/buildtools/lib/parsers/qmake/qmake_yacc.h b/buildtools/lib/parsers/qmake/qmake_yacc.h new file mode 100644 index 00000000..4c4e3042 --- /dev/null +++ b/buildtools/lib/parsers/qmake/qmake_yacc.h @@ -0,0 +1,418 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton interface for Bison LALR(1) parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C++ LALR(1) parser skeleton written by Akim Demaille. */ + +#ifndef PARSER_HEADER_H +# define PARSER_HEADER_H + +#include +#include +#include "stack.h" + +namespace TQMake +{ + class position; + class location; +} + +/* First part of user declarations. */ +#line 1 "qmake.yy" + +/*************************************************************************** + * Copyright (C) 2005 by Alexander Dymo * + * adymo@kdevelop.org * + * Copyright (C) 2006 by Andreas Pakulat * + * apaku@gmx.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License as * + * published by the Free Software Foundation; either version 2 of the * + * License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +/** +@file qmake.yy +TQMake Parser + +Simple LALR parser which builds the syntax tree (see @ref TQMake::AST). + +@todo Recognize comments after statements like: +SOURCES = foo #regognize me + +@fixme Parser fails on files that do not end with a newline +@fixme 1 shift/reduce conflict in "line_body" rule +*/ + +#include +#include "qmakeast.h" +#include + +#define YYSTYPE_IS_DECLARED + +namespace TQMake +{ + class Lexer; + +/** +The yylval type. +*/ +struct Result { + Result(): node(0) {} + + /**Type of semantic value for simple grammar rules.*/ + TQString value; + /**Type of semantic value for grammar rules which are parts of AST.*/ + AST *node; + /**Type of semantic value for "multiline_values" grammar rule. + Each line of multiline value is stored as a string in the list. + + For example we have in .pro file: + @code + SOURCE = foo1.cpp \ + foo2.cpp \ + foo3.cpp foo4.cpp + @endcode + The string list will be populated with three strings: +
+    foo1.cpp
+    foo2.cpp
+    foo3.cpp foo4.cpp
+    
+ */ + TQStringList values; + TQString indent; +}; + +#define YYSTYPE Result +typedef Result YYSTYPE; +} + +extern int TQMakelex( TQMake::Result* yylval, TQMake::Lexer* lexer ); + +/** +The stack to store ProjectAST pointers when a new child +ProjectAST is created and filled with statements. + +Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts +adding statements. Each statement is added as a child StatementAST to the ProjectAST +currently on the top in the stack. + +When a scope or function scope statement is parsed, the child ProjectAST is created +and pushed onto the stack. Therefore all statements which belong to the scope +or function scope are added as childs to their direct parent (scope or function scope). +*/ +//TQValueStack projects; + +/** +The current depth of AST node is stored here. +AST depth is important to know because automatic indentation can +be easily implemented (the parser itself looses all information +about indentation). +*/ +// int depth = 0; + +/* +To debug this parser, put the line below into the next bison file section. +Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp. +%debug +*/ + + +/* Line 35 of lalr1.cpp. */ +#line 165 "qmake_yacc.h" + +#include "location.h" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 1 +#endif + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ +do { \ + if (N) \ + { \ + (Current).begin = (Rhs)[1].begin; \ + (Current).end = (Rhs)[N].end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = (Rhs)[0].end; \ + } \ +} while (false) +#endif + +namespace TQMake +{ + + /// A Bison parser. + class Parser + { + public: + /// Symbol semantic values. +#ifndef YYSTYPE + typedef int semantic_type; +#else + typedef YYSTYPE semantic_type; +#endif + /// Symbol locations. + typedef location location_type; + /// Tokens. + struct token + { + /* Tokens. */ + enum yytokentype { + ID_SIMPLE = 258, + EQ = 259, + PLUSEQ = 260, + MINUSEQ = 261, + STAREQ = 262, + TILDEEQ = 263, + LBRACE = 264, + RBRACE = 265, + COLON = 266, + NEWLINE = 267, + COMMENT = 268, + CONT = 269, + COMMENT_CONT = 270, + RCURLY = 271, + LCURLY = 272, + ID_ARGS = 273, + QUOTED_VARIABLE_VALUE = 274, + VARIABLE_VALUE = 275, + LIST_WS = 276, + ENDOFFILE = 277 + }; + + }; + /// Token type. + typedef token::yytokentype token_type; + + /// Build a parser object. + Parser (TQMake::Lexer* lexer_yyarg, TQValueStack& projects_yyarg, int depth_yyarg); + virtual ~Parser (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + + /// The current debugging stream. + std::ostream& debug_stream () const; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); + + private: + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + + /// Generate an error message. + /// \param state the state where the error occurred. + /// \param tok the look-ahead token. + virtual std::string yysyntax_error_ (int yystate); + +#if YYDEBUG + /// \brief Report a symbol value on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); + /// \brief Report a symbol on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); +#endif /* ! YYDEBUG */ + + + /// State numbers. + typedef int state_type; + /// State stack type. + typedef stack state_stack_type; + /// Semantic value stack type. + typedef stack semantic_stack_type; + /// location stack type. + typedef stack location_stack_type; + + /// The state stack. + state_stack_type yystate_stack_; + /// The semantic value stack. + semantic_stack_type yysemantic_stack_; + /// The location stack. + location_stack_type yylocation_stack_; + + /// Internal symbol numbers. + typedef unsigned char token_number_type; + /* Tables. */ + /// For a state, the index in \a yytable_ of its portion. + static const signed char yypact_[]; + static const signed char yypact_ninf_; + + /// For a state, default rule to reduce. + /// Unless\a yytable_ specifies something else to do. + /// Zero means the default is an error. + static const unsigned char yydefact_[]; + + static const signed char yypgoto_[]; + static const signed char yydefgoto_[]; + + /// What to do in a state. + /// \a yytable_[yypact_[s]]: what to do in state \a s. + /// - if positive, shift that token. + /// - if negative, reduce the rule which number is the opposite. + /// - if zero, do what YYDEFACT says. + static const signed char yytable_[]; + static const signed char yytable_ninf_; + + static const unsigned char yycheck_[]; + + /// For a state, its accessing symbol. + static const unsigned char yystos_[]; + + /// For a rule, its LHS. + static const unsigned char yyr1_[]; + /// For a rule, its RHS length. + static const unsigned char yyr2_[]; + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#endif + +#if YYERROR_VERBOSE + /// Convert the symbol name \a n to a form suitable for a diagnostic. + virtual std::string yytnamerr_ (const char *n); +#endif + +#if YYDEBUG + /// A type to store symbol numbers and -1. + typedef signed char rhs_number_type; + /// A `-1'-separated list of the rules' RHS. + static const rhs_number_type yyrhs_[]; + /// For each rule, the index of the first RHS symbol in \a yyrhs_. + static const unsigned char yyprhs_[]; + /// For each rule, its source line number. + static const unsigned short int yyrline_[]; + /// For each scanner token number, its symbol number. + static const unsigned short int yytoken_number_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); +#endif + + /// Convert a scanner token number \a t to a symbol number. + token_number_type yytranslate_ (int t); + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// \param yytype The symbol type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + inline void yydestruct_ (const char* yymsg, + int yytype, + semantic_type* yyvaluep, + location_type* yylocationp); + + /// Pop \a n symbols the three stacks. + inline void yypop_ (unsigned int n = 1); + + /* Constants. */ + static const int yyeof_; + /* LAST_ -- Last index in TABLE_. */ + static const int yylast_; + static const int yynnts_; + static const int yyempty_; + static const int yyfinal_; + static const int yyterror_; + static const int yyerrcode_; + static const int yyntokens_; + static const unsigned int yyuser_token_number_max_; + static const token_number_type yyundef_token_; + + /* Debugging. */ + int yydebug_; + std::ostream* yycdebug_; + + + /* User arguments. */ + TQMake::Lexer* lexer; + TQValueStack& projects; + int depth; + }; +} + + +#endif /* ! defined PARSER_HEADER_H */ diff --git a/buildtools/lib/parsers/qmake/qmake_yacc.hpp b/buildtools/lib/parsers/qmake/qmake_yacc.hpp deleted file mode 100644 index fd130e65..00000000 --- a/buildtools/lib/parsers/qmake/qmake_yacc.hpp +++ /dev/null @@ -1,418 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton interface for Bison LALR(1) parsers in C++ - - Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C++ LALR(1) parser skeleton written by Akim Demaille. */ - -#ifndef PARSER_HEADER_H -# define PARSER_HEADER_H - -#include -#include -#include "stack.hh" - -namespace TQMake -{ - class position; - class location; -} - -/* First part of user declarations. */ -#line 1 "qmake.yy" - -/*************************************************************************** - * Copyright (C) 2005 by Alexander Dymo * - * adymo@kdevelop.org * - * Copyright (C) 2006 by Andreas Pakulat * - * apaku@gmx.de * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU Library General Public License as * - * published by the Free Software Foundation; either version 2 of the * - * License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -/** -@file qmake.yy -TQMake Parser - -Simple LALR parser which builds the syntax tree (see @ref TQMake::AST). - -@todo Recognize comments after statements like: -SOURCES = foo #regognize me - -@fixme Parser fails on files that do not end with a newline -@fixme 1 shift/reduce conflict in "line_body" rule -*/ - -#include -#include "qmakeast.h" -#include - -#define YYSTYPE_IS_DECLARED - -namespace TQMake -{ - class Lexer; - -/** -The yylval type. -*/ -struct Result { - Result(): node(0) {} - - /**Type of semantic value for simple grammar rules.*/ - TQString value; - /**Type of semantic value for grammar rules which are parts of AST.*/ - AST *node; - /**Type of semantic value for "multiline_values" grammar rule. - Each line of multiline value is stored as a string in the list. - - For example we have in .pro file: - @code - SOURCE = foo1.cpp \ - foo2.cpp \ - foo3.cpp foo4.cpp - @endcode - The string list will be populated with three strings: -
-    foo1.cpp
-    foo2.cpp
-    foo3.cpp foo4.cpp
-    
- */ - TQStringList values; - TQString indent; -}; - -#define YYSTYPE Result -typedef Result YYSTYPE; -} - -extern int TQMakelex( TQMake::Result* yylval, TQMake::Lexer* lexer ); - -/** -The stack to store ProjectAST pointers when a new child -ProjectAST is created and filled with statements. - -Parser creates root ProjectAST for a .pro file, pushes it onto the stack and starts -adding statements. Each statement is added as a child StatementAST to the ProjectAST -currently on the top in the stack. - -When a scope or function scope statement is parsed, the child ProjectAST is created -and pushed onto the stack. Therefore all statements which belong to the scope -or function scope are added as childs to their direct parent (scope or function scope). -*/ -//TQValueStack projects; - -/** -The current depth of AST node is stored here. -AST depth is important to know because automatic indentation can -be easily implemented (the parser itself looses all information -about indentation). -*/ -// int depth = 0; - -/* -To debug this parser, put the line below into the next bison file section. -Don't forget to uncomment "yydebug = 1" line in qmakedriver.cpp. -%debug -*/ - - -/* Line 35 of lalr1.cc. */ -#line 165 "qmake_yacc.hpp" - -#include "location.hh" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 1 -#endif - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ -do { \ - if (N) \ - { \ - (Current).begin = (Rhs)[1].begin; \ - (Current).end = (Rhs)[N].end; \ - } \ - else \ - { \ - (Current).begin = (Current).end = (Rhs)[0].end; \ - } \ -} while (false) -#endif - -namespace TQMake -{ - - /// A Bison parser. - class Parser - { - public: - /// Symbol semantic values. -#ifndef YYSTYPE - typedef int semantic_type; -#else - typedef YYSTYPE semantic_type; -#endif - /// Symbol locations. - typedef location location_type; - /// Tokens. - struct token - { - /* Tokens. */ - enum yytokentype { - ID_SIMPLE = 258, - EQ = 259, - PLUSEQ = 260, - MINUSEQ = 261, - STAREQ = 262, - TILDEEQ = 263, - LBRACE = 264, - RBRACE = 265, - COLON = 266, - NEWLINE = 267, - COMMENT = 268, - CONT = 269, - COMMENT_CONT = 270, - RCURLY = 271, - LCURLY = 272, - ID_ARGS = 273, - QUOTED_VARIABLE_VALUE = 274, - VARIABLE_VALUE = 275, - LIST_WS = 276, - ENDOFFILE = 277 - }; - - }; - /// Token type. - typedef token::yytokentype token_type; - - /// Build a parser object. - Parser (TQMake::Lexer* lexer_yyarg, TQValueStack& projects_yyarg, int depth_yyarg); - virtual ~Parser (); - - /// Parse. - /// \returns 0 iff parsing succeeded. - virtual int parse (); - - /// The current debugging stream. - std::ostream& debug_stream () const; - /// Set the current debugging stream. - void set_debug_stream (std::ostream &); - - /// Type for debugging levels. - typedef int debug_level_type; - /// The current debugging level. - debug_level_type debug_level () const; - /// Set the current debugging level. - void set_debug_level (debug_level_type l); - - private: - /// Report a syntax error. - /// \param loc where the syntax error is found. - /// \param msg a description of the syntax error. - virtual void error (const location_type& loc, const std::string& msg); - - /// Generate an error message. - /// \param state the state where the error occurred. - /// \param tok the look-ahead token. - virtual std::string yysyntax_error_ (int yystate); - -#if YYDEBUG - /// \brief Report a symbol value on the debug stream. - /// \param yytype The token type. - /// \param yyvaluep Its semantic value. - /// \param yylocationp Its location. - virtual void yy_symbol_value_print_ (int yytype, - const semantic_type* yyvaluep, - const location_type* yylocationp); - /// \brief Report a symbol on the debug stream. - /// \param yytype The token type. - /// \param yyvaluep Its semantic value. - /// \param yylocationp Its location. - virtual void yy_symbol_print_ (int yytype, - const semantic_type* yyvaluep, - const location_type* yylocationp); -#endif /* ! YYDEBUG */ - - - /// State numbers. - typedef int state_type; - /// State stack type. - typedef stack state_stack_type; - /// Semantic value stack type. - typedef stack semantic_stack_type; - /// location stack type. - typedef stack location_stack_type; - - /// The state stack. - state_stack_type yystate_stack_; - /// The semantic value stack. - semantic_stack_type yysemantic_stack_; - /// The location stack. - location_stack_type yylocation_stack_; - - /// Internal symbol numbers. - typedef unsigned char token_number_type; - /* Tables. */ - /// For a state, the index in \a yytable_ of its portion. - static const signed char yypact_[]; - static const signed char yypact_ninf_; - - /// For a state, default rule to reduce. - /// Unless\a yytable_ specifies something else to do. - /// Zero means the default is an error. - static const unsigned char yydefact_[]; - - static const signed char yypgoto_[]; - static const signed char yydefgoto_[]; - - /// What to do in a state. - /// \a yytable_[yypact_[s]]: what to do in state \a s. - /// - if positive, shift that token. - /// - if negative, reduce the rule which number is the opposite. - /// - if zero, do what YYDEFACT says. - static const signed char yytable_[]; - static const signed char yytable_ninf_; - - static const unsigned char yycheck_[]; - - /// For a state, its accessing symbol. - static const unsigned char yystos_[]; - - /// For a rule, its LHS. - static const unsigned char yyr1_[]; - /// For a rule, its RHS length. - static const unsigned char yyr2_[]; - -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE - /// For a symbol, its name in clear. - static const char* const yytname_[]; -#endif - -#if YYERROR_VERBOSE - /// Convert the symbol name \a n to a form suitable for a diagnostic. - virtual std::string yytnamerr_ (const char *n); -#endif - -#if YYDEBUG - /// A type to store symbol numbers and -1. - typedef signed char rhs_number_type; - /// A `-1'-separated list of the rules' RHS. - static const rhs_number_type yyrhs_[]; - /// For each rule, the index of the first RHS symbol in \a yyrhs_. - static const unsigned char yyprhs_[]; - /// For each rule, its source line number. - static const unsigned short int yyrline_[]; - /// For each scanner token number, its symbol number. - static const unsigned short int yytoken_number_[]; - /// Report on the debug stream that the rule \a r is going to be reduced. - virtual void yy_reduce_print_ (int r); - /// Print the state stack on the debug stream. - virtual void yystack_print_ (); -#endif - - /// Convert a scanner token number \a t to a symbol number. - token_number_type yytranslate_ (int t); - - /// \brief Reclaim the memory associated to a symbol. - /// \param yymsg Why this token is reclaimed. - /// \param yytype The symbol type. - /// \param yyvaluep Its semantic value. - /// \param yylocationp Its location. - inline void yydestruct_ (const char* yymsg, - int yytype, - semantic_type* yyvaluep, - location_type* yylocationp); - - /// Pop \a n symbols the three stacks. - inline void yypop_ (unsigned int n = 1); - - /* Constants. */ - static const int yyeof_; - /* LAST_ -- Last index in TABLE_. */ - static const int yylast_; - static const int yynnts_; - static const int yyempty_; - static const int yyfinal_; - static const int yyterror_; - static const int yyerrcode_; - static const int yyntokens_; - static const unsigned int yyuser_token_number_max_; - static const token_number_type yyundef_token_; - - /* Debugging. */ - int yydebug_; - std::ostream* yycdebug_; - - - /* User arguments. */ - TQMake::Lexer* lexer; - TQValueStack& projects; - int depth; - }; -} - - -#endif /* ! defined PARSER_HEADER_H */ diff --git a/buildtools/lib/parsers/qmake/qmakedriver.cpp b/buildtools/lib/parsers/qmake/qmakedriver.cpp index 40fd9bd9..8b9b722a 100644 --- a/buildtools/lib/parsers/qmake/qmakedriver.cpp +++ b/buildtools/lib/parsers/qmake/qmakedriver.cpp @@ -28,7 +28,7 @@ #include #include "qmake_lex.h" -#include "qmake_yacc.hpp" +#include "qmake_yacc.h" namespace TQMake { diff --git a/buildtools/lib/parsers/qmake/stack.h b/buildtools/lib/parsers/qmake/stack.h new file mode 100644 index 00000000..1c18d4d0 --- /dev/null +++ b/buildtools/lib/parsers/qmake/stack.h @@ -0,0 +1,129 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Stack handling for Bison parsers in C++ + + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef BISON_STACK_H +# define BISON_STACK_H + +#include + +namespace TQMake +{ + template > + class stack + { + public: + + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; + + stack () : seq_ () + { + } + + stack (unsigned int n) : seq_ (n) + { + } + + inline + T& + operator [] (unsigned int i) + { + return seq_[i]; + } + + inline + const T& + operator [] (unsigned int i) const + { + return seq_[i]; + } + + inline + void + push (const T& t) + { + seq_.push_front (t); + } + + inline + void + pop (unsigned int n = 1) + { + for (; n; --n) + seq_.pop_front (); + } + + inline + unsigned int + height () const + { + return seq_.size (); + } + + inline const_iterator begin () const { return seq_.rbegin (); } + inline const_iterator end () const { return seq_.rend (); } + + private: + + S seq_; + }; + + /// Present a slice of the top of a stack. + template > + class slice + { + public: + + slice (const S& stack, + unsigned int range) : stack_ (stack), + range_ (range) + { + } + + inline + const T& + operator [] (unsigned int i) const + { + return stack_[range_ - i]; + } + + private: + + const S& stack_; + unsigned int range_; + }; +} + +#endif // not BISON_STACK_H diff --git a/buildtools/lib/parsers/qmake/stack.hh b/buildtools/lib/parsers/qmake/stack.hh deleted file mode 100644 index dfc6c67e..00000000 --- a/buildtools/lib/parsers/qmake/stack.hh +++ /dev/null @@ -1,129 +0,0 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Stack handling for Bison parsers in C++ - - Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef BISON_STACK_HH -# define BISON_STACK_HH - -#include - -namespace TQMake -{ - template > - class stack - { - public: - - // Hide our reversed order. - typedef typename S::reverse_iterator iterator; - typedef typename S::const_reverse_iterator const_iterator; - - stack () : seq_ () - { - } - - stack (unsigned int n) : seq_ (n) - { - } - - inline - T& - operator [] (unsigned int i) - { - return seq_[i]; - } - - inline - const T& - operator [] (unsigned int i) const - { - return seq_[i]; - } - - inline - void - push (const T& t) - { - seq_.push_front (t); - } - - inline - void - pop (unsigned int n = 1) - { - for (; n; --n) - seq_.pop_front (); - } - - inline - unsigned int - height () const - { - return seq_.size (); - } - - inline const_iterator begin () const { return seq_.rbegin (); } - inline const_iterator end () const { return seq_.rend (); } - - private: - - S seq_; - }; - - /// Present a slice of the top of a stack. - template > - class slice - { - public: - - slice (const S& stack, - unsigned int range) : stack_ (stack), - range_ (range) - { - } - - inline - const T& - operator [] (unsigned int i) const - { - return stack_[range_ - i]; - } - - private: - - const S& stack_; - unsigned int range_; - }; -} - -#endif // not BISON_STACK_HH diff --git a/languages/ada/AdaAST.h b/languages/ada/AdaAST.h new file mode 100644 index 00000000..35b734b4 --- /dev/null +++ b/languages/ada/AdaAST.h @@ -0,0 +1,77 @@ +#ifndef ADAAST_HPP +#define ADAAST_HPP + +#include + +class AdaAST; +typedef antlr::ASTRefCount RefAdaAST; + +class AdaAST : public antlr::CommonAST { +public: + AdaAST() : m_line (0), m_column (0) {} + + ~AdaAST() {} + + int getLine () const { return m_line; } + void setLine (int line) { m_line = line; } + + int getColumn () const { return m_column; } + void setColumn (int column) { m_column = column; } + + void initialize (antlr::RefToken t) { + antlr::CommonAST::initialize (t); + m_line = t->getLine () - 1; + m_column = t->getColumn () - 1; + } + + void initialize (int t, const std::string& txt) { + setType (t); + setText (txt); + m_line = 0; + m_column = 0; + } + + RefAdaAST duplicate (void) const { + AdaAST *ast = new AdaAST (*this); + return RefAdaAST (ast); + } + + void set (int t, const std::string& txt) { + setType (t); + setText (txt); + } + + void addChild (RefAdaAST c) { + antlr::RefAST n( c.get() ); + antlr::BaseAST::addChild (n); + } + + RefAdaAST down () const { + return RefAdaAST (antlr::BaseAST::getFirstChild ()); + } + + RefAdaAST right () const { + return RefAdaAST (antlr::BaseAST::getNextSibling ()); + } + + /* bool equals(RefAdaAST t) const { + return ((antlr::BaseAST*)this)->equals (t); + } */ + + static antlr::RefAST factory (void) { + RefAdaAST n( new AdaAST ); + return n.get(); + } + + static const RefAdaAST nullAdaAST; + +private: + int m_line; + int m_column; +}; + +#define Set(n, t) (n)->set(t, #t) +// for Java compatibility: +#define boolean bool + +#endif diff --git a/languages/ada/AdaAST.hpp b/languages/ada/AdaAST.hpp deleted file mode 100644 index 1bb2bd07..00000000 --- a/languages/ada/AdaAST.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef ADAAST_HPP -#define ADAAST_HPP - -#include - -class AdaAST; -typedef antlr::ASTRefCount RefAdaAST; - -class AdaAST : public antlr::CommonAST { -public: - AdaAST() : m_line (0), m_column (0) {} - - ~AdaAST() {} - - int getLine () const { return m_line; } - void setLine (int line) { m_line = line; } - - int getColumn () const { return m_column; } - void setColumn (int column) { m_column = column; } - - void initialize (antlr::RefToken t) { - antlr::CommonAST::initialize (t); - m_line = t->getLine () - 1; - m_column = t->getColumn () - 1; - } - - void initialize (int t, const std::string& txt) { - setType (t); - setText (txt); - m_line = 0; - m_column = 0; - } - - RefAdaAST duplicate (void) const { - AdaAST *ast = new AdaAST (*this); - return RefAdaAST (ast); - } - - void set (int t, const std::string& txt) { - setType (t); - setText (txt); - } - - void addChild (RefAdaAST c) { - antlr::RefAST n( c.get() ); - antlr::BaseAST::addChild (n); - } - - RefAdaAST down () const { - return RefAdaAST (antlr::BaseAST::getFirstChild ()); - } - - RefAdaAST right () const { - return RefAdaAST (antlr::BaseAST::getNextSibling ()); - } - - /* bool equals(RefAdaAST t) const { - return ((antlr::BaseAST*)this)->equals (t); - } */ - - static antlr::RefAST factory (void) { - RefAdaAST n( new AdaAST ); - return n.get(); - } - - static const RefAdaAST nullAdaAST; - -private: - int m_line; - int m_column; -}; - -#define Set(n, t) (n)->set(t, #t) -// for Java compatibility: -#define boolean bool - -#endif diff --git a/languages/ada/AdaLexer.cpp b/languages/ada/AdaLexer.cpp index 2ac19416..07e0cdd0 100644 --- a/languages/ada/AdaLexer.cpp +++ b/languages/ada/AdaLexer.cpp @@ -1,12 +1,12 @@ /* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaLexer.cpp"$ */ -#include "AdaLexer.hpp" -#include -#include -#include -#include -#include -#include -#include +#include "AdaLexer.h" +#include +#include +#include +#include +#include +#include +#include #line 1531 "ada.g" diff --git a/languages/ada/AdaLexer.h b/languages/ada/AdaLexer.h new file mode 100644 index 00000000..f004b971 --- /dev/null +++ b/languages/ada/AdaLexer.h @@ -0,0 +1,86 @@ +#ifndef INC_AdaLexer_h_ +#define INC_AdaLexer_h_ + +#line 29 "ada.g" + +#include // antlr wants this +#include "AdaAST.h" +#include "preambles.h" + +#line 11 "AdaLexer.h" +#include +/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaLexer.h"$ */ +#include +#include +#include +#include "AdaTokenTypes.h" +#include +class CUSTOM_API AdaLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public AdaTokenTypes +{ +#line 1879 "ada.g" + + ANTLR_LEXER_PREAMBLE + private: + bool lastTokenWasTicCompatible; +#line 22 "AdaLexer.h" +private: + void initLiterals(); +public: + bool getCaseSensitiveLiterals() const + { + return false; + } +public: + AdaLexer(ANTLR_USE_NAMESPACE(std)istream& in); + AdaLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); + AdaLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); + ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); + public: void mCOMMENT_INTRO(bool _createToken); + public: void mDOT_DOT(bool _createToken); + public: void mLT_LT(bool _createToken); + public: void mOX(bool _createToken); + public: void mGT_GT(bool _createToken); + public: void mASSIGN(bool _createToken); + public: void mRIGHT_SHAFT(bool _createToken); + public: void mNE(bool _createToken); + public: void mLE(bool _createToken); + public: void mGE(bool _createToken); + public: void mEXPON(bool _createToken); + public: void mPIPE(bool _createToken); + public: void mCONCAT(bool _createToken); + public: void mDOT(bool _createToken); + public: void mEQ(bool _createToken); + public: void mLT_(bool _createToken); + public: void mGT(bool _createToken); + public: void mPLUS(bool _createToken); + public: void mMINUS(bool _createToken); + public: void mSTAR(bool _createToken); + public: void mDIV(bool _createToken); + public: void mLPAREN(bool _createToken); + public: void mRPAREN(bool _createToken); + public: void mCOLON(bool _createToken); + public: void mCOMMA(bool _createToken); + public: void mSEMI(bool _createToken); + public: void mIDENTIFIER(bool _createToken); + public: void mTIC_OR_CHARACTER_LITERAL(bool _createToken); + public: void mCHAR_STRING(bool _createToken); + public: void mNUMERIC_LIT(bool _createToken); + protected: void mDIGIT(bool _createToken); + protected: void mBASED_INTEGER(bool _createToken); + protected: void mEXPONENT(bool _createToken); + protected: void mEXTENDED_DIGIT(bool _createToken); + public: void mWS_(bool _createToken); + public: void mCOMMENT(bool _createToken); +private: + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; +}; + +#endif /*INC_AdaLexer_h_*/ diff --git a/languages/ada/AdaLexer.hpp b/languages/ada/AdaLexer.hpp deleted file mode 100644 index 795c7bba..00000000 --- a/languages/ada/AdaLexer.hpp +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef INC_AdaLexer_hpp_ -#define INC_AdaLexer_hpp_ - -#line 29 "ada.g" - -#include // antlr wants this -#include "AdaAST.hpp" -#include "preambles.h" - -#line 11 "AdaLexer.hpp" -#include -/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaLexer.hpp"$ */ -#include -#include -#include -#include "AdaTokenTypes.hpp" -#include -class CUSTOM_API AdaLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public AdaTokenTypes -{ -#line 1879 "ada.g" - - ANTLR_LEXER_PREAMBLE - private: - bool lastTokenWasTicCompatible; -#line 22 "AdaLexer.hpp" -private: - void initLiterals(); -public: - bool getCaseSensitiveLiterals() const - { - return false; - } -public: - AdaLexer(ANTLR_USE_NAMESPACE(std)istream& in); - AdaLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); - AdaLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); - ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); - public: void mCOMMENT_INTRO(bool _createToken); - public: void mDOT_DOT(bool _createToken); - public: void mLT_LT(bool _createToken); - public: void mOX(bool _createToken); - public: void mGT_GT(bool _createToken); - public: void mASSIGN(bool _createToken); - public: void mRIGHT_SHAFT(bool _createToken); - public: void mNE(bool _createToken); - public: void mLE(bool _createToken); - public: void mGE(bool _createToken); - public: void mEXPON(bool _createToken); - public: void mPIPE(bool _createToken); - public: void mCONCAT(bool _createToken); - public: void mDOT(bool _createToken); - public: void mEQ(bool _createToken); - public: void mLT_(bool _createToken); - public: void mGT(bool _createToken); - public: void mPLUS(bool _createToken); - public: void mMINUS(bool _createToken); - public: void mSTAR(bool _createToken); - public: void mDIV(bool _createToken); - public: void mLPAREN(bool _createToken); - public: void mRPAREN(bool _createToken); - public: void mCOLON(bool _createToken); - public: void mCOMMA(bool _createToken); - public: void mSEMI(bool _createToken); - public: void mIDENTIFIER(bool _createToken); - public: void mTIC_OR_CHARACTER_LITERAL(bool _createToken); - public: void mCHAR_STRING(bool _createToken); - public: void mNUMERIC_LIT(bool _createToken); - protected: void mDIGIT(bool _createToken); - protected: void mBASED_INTEGER(bool _createToken); - protected: void mEXPONENT(bool _createToken); - protected: void mEXTENDED_DIGIT(bool _createToken); - public: void mWS_(bool _createToken); - public: void mCOMMENT(bool _createToken); -private: - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; -}; - -#endif /*INC_AdaLexer_hpp_*/ diff --git a/languages/ada/AdaParser.cpp b/languages/ada/AdaParser.cpp index e783595e..fed95180 100644 --- a/languages/ada/AdaParser.cpp +++ b/languages/ada/AdaParser.cpp @@ -1,8 +1,8 @@ /* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaParser.cpp"$ */ -#include "AdaParser.hpp" -#include -#include -#include +#include "AdaParser.h" +#include +#include +#include #line 1 "ada.g" #line 8 "AdaParser.cpp" AdaParser::AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k) diff --git a/languages/ada/AdaParser.h b/languages/ada/AdaParser.h new file mode 100644 index 00000000..9ceb8811 --- /dev/null +++ b/languages/ada/AdaParser.h @@ -0,0 +1,389 @@ +#ifndef INC_AdaParser_h_ +#define INC_AdaParser_h_ + +#line 29 "ada.g" + +#include // antlr wants this +#include "AdaAST.h" +#include "preambles.h" + +#line 11 "AdaParser.h" +#include +/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaParser.h"$ */ +#include +#include +#include "AdaTokenTypes.h" +#include + +class CUSTOM_API AdaParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public AdaTokenTypes +{ +#line 53 "ada.g" + + ANTLR_PARSER_PREAMBLE + +public: + // Ada support stuff + void push_def_id (const RefAdaAST& defid); + const RefAdaAST& pop_def_id (); + bool end_id_matches_def_id (const RefAdaAST& endid); + bool definable_operator (const char *string); // operator_symbol sans "/=" + bool is_operator_symbol (const char *string); +#line 22 "AdaParser.h" +public: + void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); +protected: + AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); +public: + AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); +protected: + AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); +public: + AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); + AdaParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); + int getNumTokens() const + { + return AdaParser::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return AdaParser::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return AdaParser::tokenNames; + } + public: void compilation_unit(); + public: void context_items_opt(); + public: void library_item(); + public: void subunit(); + public: void pragma(); + public: void pragma_args_opt(); + public: void pragma_arg(); + public: void expression(); + public: void with_clause(); + public: void use_clause(); + public: void c_name_list(); + public: void compound_name(); + public: void subtype_mark(); + public: void attribute_id(); + public: void private_opt(); + public: void lib_pkg_spec_or_body(); + public: void subprog_decl_or_rename_or_inst_or_body( + boolean lib_level + ); + public: void generic_decl( + boolean lib_level + ); + public: void def_id( + boolean lib_level + ); + public: void pkg_body_part(); + public: void spec_decl_part( + RefAdaAST pkg + ); + public: void subprog_decl( + boolean lib_level + ); + public: void generic_subp_inst(); + public: void formal_part_opt(); + public: void renames(); + public: void is_separate_or_abstract_or_decl( + RefAdaAST t + ); + public: void def_designator( + boolean lib_level + ); + public: void function_tail(); + public: void generic_inst(); + public: void value_s(); + public: void parenth_values(); + public: void value(); + public: void ranged_expr_s(); + public: void ranged_expr(); + public: void simple_expression(); + public: void range(); + public: void range_constraint(); + public: void range_dots(); + public: void range_attrib_ref(); + public: void prefix(); + public: void parameter_specification(); + public: void def_ids_colon(); + public: void mode_opt(); + public: void init_opt(); + public: void defining_identifier_list(); + public: void name(); + public: RefAdaAST definable_operator_symbol(); + public: RefAdaAST is_operator(); + public: void parenthesized_primary(); + public: void extension_opt(); + public: void separate_or_abstract( + RefAdaAST t + ); + public: RefAdaAST designator(); + public: void func_formal_part_opt(); + public: void func_param(); + public: void in_access_opt(); + public: void pkg_spec_part(); + public: void basic_declarative_items_opt(); + public: void private_declarative_items_opt(); + public: void end_id_opt(); + public: void basic_decl_item(); + public: void basic_declarative_items(); + public: void task_type_or_single_decl( + RefAdaAST tsk + ); + public: void prot_type_or_single_decl( + RefAdaAST pro + ); + public: void decl_common(); + public: void discrim_part_opt(); + public: void task_definition_opt(); + public: void task_items_opt(); + public: void private_task_items_opt(); + public: void discrim_part_text(); + public: void discriminant_specifications(); + public: void known_discrim_part(); + public: void empty_discrim_opt(); + public: void discrim_part(); + public: void discriminant_specification(); + public: void access_opt(); + public: void entrydecls_repspecs_opt(); + public: void entry_declaration(); + public: void rep_spec(); + public: void discrete_subtype_def_opt(); + public: void discrete_subtype_definition(); + public: void subtype_ind(); + public: void rep_spec_part( + RefAdaAST t + ); + public: void align_opt(); + public: void comp_loc_s(); + public: void protected_definition(); + public: void prot_private_opt(); + public: void prot_op_decl(); + public: void comp_decl(); + public: void prot_op_decl_s(); + public: void prot_member_decl_s(); + public: void component_subtype_def(); + public: void type_def( + RefAdaAST t + ); + public: void derived_or_private_or_record( + RefAdaAST t, boolean has_discrim + ); + public: void local_enum_name(); + public: void enumeration_aggregate(); + public: void aliased_constant_opt(); + public: void array_type_definition( + RefAdaAST t + ); + public: void enum_id_s(); + public: void range_constraint_opt(); + public: void access_type_definition( + RefAdaAST t + ); + public: void enumeration_literal_specification(); + public: void index_or_discrete_range_s(); + public: void index_or_discrete_range(); + public: void aliased_opt(); + public: void constraint_opt(); + public: void digits_constraint(); + public: void delta_constraint(); + public: void index_constraint(); + public: void discriminant_constraint(); + public: void discrete_range(); + public: void discriminant_association(); + public: void selector_names_opt(); + public: void association_head(); + public: void selector_name(); + public: void protected_opt(); + public: void constant_all_opt(); + public: void abstract_opt(); + public: void record_definition( + boolean has_discrim + ); + public: void abstract_tagged_limited_opt(); + public: void component_list( + boolean has_discrim + ); + public: void component_items(); + public: void variant_part(); + public: void empty_component_items(); + public: void discriminant_direct_name(); + public: void variant_s(); + public: void variant(); + public: void choice_s(); + public: void choice(); + public: void discrete_with_range(); + public: void mark_with_constraint(); + public: void generic_formal_part_opt(); + public: void generic_formal_parameter(); + public: void discriminable_type_definition( + RefAdaAST t + ); + public: void subprogram_default_opt(); + public: void formal_package_actual_part_opt(); + public: void body_part(); + public: void declarative_part(); + public: void block_body(); + public: void declarative_item(); + public: void body_is(); + public: void separate(); + public: void prot_op_bodies_opt(); + public: void block_body_opt(); + public: void handled_stmt_s(); + public: void entry_body(); + public: void subprog_decl_or_body(); + public: void statements(); + public: void except_handler_part_opt(); + public: void handled_stmts_opt(); + public: void statement(); + public: void def_label_opt(); + public: void null_stmt(); + public: void exit_stmt(); + public: void return_stmt(); + public: void goto_stmt(); + public: void delay_stmt(); + public: void abort_stmt(); + public: void raise_stmt(); + public: void requeue_stmt(); + public: void accept_stmt(); + public: void select_stmt(); + public: void if_stmt(); + public: void case_stmt(); + public: void loop_stmt(); + public: void block(); + public: void statement_identifier(); + public: void id_opt(); + public: void call_or_assignment(); + public: void cond_clause(); + public: void elsifs_opt(); + public: void else_opt(); + public: void condition(); + public: void alternative_s(); + public: void case_statement_alternative(); + public: void iteration_scheme_opt(); + public: void reverse_opt(); + public: void id_opt_aux(); + public: void declare_opt(); + public: void label_name(); + public: void entry_body_formal_part(); + public: void entry_barrier(); + public: void entry_index_spec_opt(); + public: void entry_call_stmt(); + public: void entry_index_opt(); + public: void until_opt(); + public: void triggering_alternative(); + public: void abortable_part(); + public: void selective_accept(); + public: void entry_call_alternative(); + public: void delay_alternative(); + public: void stmts_opt(); + public: void guard_opt(); + public: void select_alternative(); + public: void or_select_opt(); + public: void accept_alternative(); + public: void exception_handler(); + public: void identifier_colon_opt(); + public: void except_choice_s(); + public: void exception_choice(); + public: void operator_call(); + public: void operator_call_tail( + RefAdaAST opstr + ); + public: void relation(); + public: void range_or_mark(); + public: void signed_term(); + public: void term(); + public: void factor(); + public: void primary(); + public: void name_or_qualified(); + public: void allocator(); + public: void subprogram_body(); + public: void package_body(); + public: void task_body(); + public: void protected_body(); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefAdaAST returnAST; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 290; +#else + enum { + NUM_TOKENS = 290 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; + static const unsigned long _tokenSet_5_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; + static const unsigned long _tokenSet_6_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; + static const unsigned long _tokenSet_7_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; + static const unsigned long _tokenSet_8_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; + static const unsigned long _tokenSet_9_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; + static const unsigned long _tokenSet_10_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10; + static const unsigned long _tokenSet_11_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11; + static const unsigned long _tokenSet_12_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12; + static const unsigned long _tokenSet_13_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13; + static const unsigned long _tokenSet_14_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14; + static const unsigned long _tokenSet_15_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_15; + static const unsigned long _tokenSet_16_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_16; + static const unsigned long _tokenSet_17_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_17; + static const unsigned long _tokenSet_18_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_18; + static const unsigned long _tokenSet_19_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_19; + static const unsigned long _tokenSet_20_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_20; + static const unsigned long _tokenSet_21_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_21; + static const unsigned long _tokenSet_22_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_22; + static const unsigned long _tokenSet_23_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_23; + static const unsigned long _tokenSet_24_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_24; + static const unsigned long _tokenSet_25_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_25; + static const unsigned long _tokenSet_26_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_26; + static const unsigned long _tokenSet_27_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_27; + static const unsigned long _tokenSet_28_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_28; + static const unsigned long _tokenSet_29_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_29; + static const unsigned long _tokenSet_30_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_30; +}; + +#endif /*INC_AdaParser_h_*/ diff --git a/languages/ada/AdaParser.hpp b/languages/ada/AdaParser.hpp deleted file mode 100644 index 0074c820..00000000 --- a/languages/ada/AdaParser.hpp +++ /dev/null @@ -1,389 +0,0 @@ -#ifndef INC_AdaParser_hpp_ -#define INC_AdaParser_hpp_ - -#line 29 "ada.g" - -#include // antlr wants this -#include "AdaAST.hpp" -#include "preambles.h" - -#line 11 "AdaParser.hpp" -#include -/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaParser.hpp"$ */ -#include -#include -#include "AdaTokenTypes.hpp" -#include - -class CUSTOM_API AdaParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public AdaTokenTypes -{ -#line 53 "ada.g" - - ANTLR_PARSER_PREAMBLE - -public: - // Ada support stuff - void push_def_id (const RefAdaAST& defid); - const RefAdaAST& pop_def_id (); - bool end_id_matches_def_id (const RefAdaAST& endid); - bool definable_operator (const char *string); // operator_symbol sans "/=" - bool is_operator_symbol (const char *string); -#line 22 "AdaParser.hpp" -public: - void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); -protected: - AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); -public: - AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); -protected: - AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); -public: - AdaParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); - AdaParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); - int getNumTokens() const - { - return AdaParser::NUM_TOKENS; - } - const char* getTokenName( int type ) const - { - if( type > getNumTokens() ) return 0; - return AdaParser::tokenNames[type]; - } - const char* const* getTokenNames() const - { - return AdaParser::tokenNames; - } - public: void compilation_unit(); - public: void context_items_opt(); - public: void library_item(); - public: void subunit(); - public: void pragma(); - public: void pragma_args_opt(); - public: void pragma_arg(); - public: void expression(); - public: void with_clause(); - public: void use_clause(); - public: void c_name_list(); - public: void compound_name(); - public: void subtype_mark(); - public: void attribute_id(); - public: void private_opt(); - public: void lib_pkg_spec_or_body(); - public: void subprog_decl_or_rename_or_inst_or_body( - boolean lib_level - ); - public: void generic_decl( - boolean lib_level - ); - public: void def_id( - boolean lib_level - ); - public: void pkg_body_part(); - public: void spec_decl_part( - RefAdaAST pkg - ); - public: void subprog_decl( - boolean lib_level - ); - public: void generic_subp_inst(); - public: void formal_part_opt(); - public: void renames(); - public: void is_separate_or_abstract_or_decl( - RefAdaAST t - ); - public: void def_designator( - boolean lib_level - ); - public: void function_tail(); - public: void generic_inst(); - public: void value_s(); - public: void parenth_values(); - public: void value(); - public: void ranged_expr_s(); - public: void ranged_expr(); - public: void simple_expression(); - public: void range(); - public: void range_constraint(); - public: void range_dots(); - public: void range_attrib_ref(); - public: void prefix(); - public: void parameter_specification(); - public: void def_ids_colon(); - public: void mode_opt(); - public: void init_opt(); - public: void defining_identifier_list(); - public: void name(); - public: RefAdaAST definable_operator_symbol(); - public: RefAdaAST is_operator(); - public: void parenthesized_primary(); - public: void extension_opt(); - public: void separate_or_abstract( - RefAdaAST t - ); - public: RefAdaAST designator(); - public: void func_formal_part_opt(); - public: void func_param(); - public: void in_access_opt(); - public: void pkg_spec_part(); - public: void basic_declarative_items_opt(); - public: void private_declarative_items_opt(); - public: void end_id_opt(); - public: void basic_decl_item(); - public: void basic_declarative_items(); - public: void task_type_or_single_decl( - RefAdaAST tsk - ); - public: void prot_type_or_single_decl( - RefAdaAST pro - ); - public: void decl_common(); - public: void discrim_part_opt(); - public: void task_definition_opt(); - public: void task_items_opt(); - public: void private_task_items_opt(); - public: void discrim_part_text(); - public: void discriminant_specifications(); - public: void known_discrim_part(); - public: void empty_discrim_opt(); - public: void discrim_part(); - public: void discriminant_specification(); - public: void access_opt(); - public: void entrydecls_repspecs_opt(); - public: void entry_declaration(); - public: void rep_spec(); - public: void discrete_subtype_def_opt(); - public: void discrete_subtype_definition(); - public: void subtype_ind(); - public: void rep_spec_part( - RefAdaAST t - ); - public: void align_opt(); - public: void comp_loc_s(); - public: void protected_definition(); - public: void prot_private_opt(); - public: void prot_op_decl(); - public: void comp_decl(); - public: void prot_op_decl_s(); - public: void prot_member_decl_s(); - public: void component_subtype_def(); - public: void type_def( - RefAdaAST t - ); - public: void derived_or_private_or_record( - RefAdaAST t, boolean has_discrim - ); - public: void local_enum_name(); - public: void enumeration_aggregate(); - public: void aliased_constant_opt(); - public: void array_type_definition( - RefAdaAST t - ); - public: void enum_id_s(); - public: void range_constraint_opt(); - public: void access_type_definition( - RefAdaAST t - ); - public: void enumeration_literal_specification(); - public: void index_or_discrete_range_s(); - public: void index_or_discrete_range(); - public: void aliased_opt(); - public: void constraint_opt(); - public: void digits_constraint(); - public: void delta_constraint(); - public: void index_constraint(); - public: void discriminant_constraint(); - public: void discrete_range(); - public: void discriminant_association(); - public: void selector_names_opt(); - public: void association_head(); - public: void selector_name(); - public: void protected_opt(); - public: void constant_all_opt(); - public: void abstract_opt(); - public: void record_definition( - boolean has_discrim - ); - public: void abstract_tagged_limited_opt(); - public: void component_list( - boolean has_discrim - ); - public: void component_items(); - public: void variant_part(); - public: void empty_component_items(); - public: void discriminant_direct_name(); - public: void variant_s(); - public: void variant(); - public: void choice_s(); - public: void choice(); - public: void discrete_with_range(); - public: void mark_with_constraint(); - public: void generic_formal_part_opt(); - public: void generic_formal_parameter(); - public: void discriminable_type_definition( - RefAdaAST t - ); - public: void subprogram_default_opt(); - public: void formal_package_actual_part_opt(); - public: void body_part(); - public: void declarative_part(); - public: void block_body(); - public: void declarative_item(); - public: void body_is(); - public: void separate(); - public: void prot_op_bodies_opt(); - public: void block_body_opt(); - public: void handled_stmt_s(); - public: void entry_body(); - public: void subprog_decl_or_body(); - public: void statements(); - public: void except_handler_part_opt(); - public: void handled_stmts_opt(); - public: void statement(); - public: void def_label_opt(); - public: void null_stmt(); - public: void exit_stmt(); - public: void return_stmt(); - public: void goto_stmt(); - public: void delay_stmt(); - public: void abort_stmt(); - public: void raise_stmt(); - public: void requeue_stmt(); - public: void accept_stmt(); - public: void select_stmt(); - public: void if_stmt(); - public: void case_stmt(); - public: void loop_stmt(); - public: void block(); - public: void statement_identifier(); - public: void id_opt(); - public: void call_or_assignment(); - public: void cond_clause(); - public: void elsifs_opt(); - public: void else_opt(); - public: void condition(); - public: void alternative_s(); - public: void case_statement_alternative(); - public: void iteration_scheme_opt(); - public: void reverse_opt(); - public: void id_opt_aux(); - public: void declare_opt(); - public: void label_name(); - public: void entry_body_formal_part(); - public: void entry_barrier(); - public: void entry_index_spec_opt(); - public: void entry_call_stmt(); - public: void entry_index_opt(); - public: void until_opt(); - public: void triggering_alternative(); - public: void abortable_part(); - public: void selective_accept(); - public: void entry_call_alternative(); - public: void delay_alternative(); - public: void stmts_opt(); - public: void guard_opt(); - public: void select_alternative(); - public: void or_select_opt(); - public: void accept_alternative(); - public: void exception_handler(); - public: void identifier_colon_opt(); - public: void except_choice_s(); - public: void exception_choice(); - public: void operator_call(); - public: void operator_call_tail( - RefAdaAST opstr - ); - public: void relation(); - public: void range_or_mark(); - public: void signed_term(); - public: void term(); - public: void factor(); - public: void primary(); - public: void name_or_qualified(); - public: void allocator(); - public: void subprogram_body(); - public: void package_body(); - public: void task_body(); - public: void protected_body(); -public: - ANTLR_USE_NAMESPACE(antlr)RefAST getAST() - { - return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); - } - -protected: - RefAdaAST returnAST; -private: - static const char* tokenNames[]; -#ifndef NO_STATIC_CONSTS - static const int NUM_TOKENS = 290; -#else - enum { - NUM_TOKENS = 290 - }; -#endif - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; - static const unsigned long _tokenSet_4_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; - static const unsigned long _tokenSet_5_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; - static const unsigned long _tokenSet_6_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; - static const unsigned long _tokenSet_7_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; - static const unsigned long _tokenSet_8_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; - static const unsigned long _tokenSet_9_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; - static const unsigned long _tokenSet_10_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10; - static const unsigned long _tokenSet_11_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11; - static const unsigned long _tokenSet_12_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12; - static const unsigned long _tokenSet_13_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13; - static const unsigned long _tokenSet_14_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14; - static const unsigned long _tokenSet_15_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_15; - static const unsigned long _tokenSet_16_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_16; - static const unsigned long _tokenSet_17_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_17; - static const unsigned long _tokenSet_18_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_18; - static const unsigned long _tokenSet_19_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_19; - static const unsigned long _tokenSet_20_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_20; - static const unsigned long _tokenSet_21_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_21; - static const unsigned long _tokenSet_22_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_22; - static const unsigned long _tokenSet_23_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_23; - static const unsigned long _tokenSet_24_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_24; - static const unsigned long _tokenSet_25_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_25; - static const unsigned long _tokenSet_26_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_26; - static const unsigned long _tokenSet_27_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_27; - static const unsigned long _tokenSet_28_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_28; - static const unsigned long _tokenSet_29_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_29; - static const unsigned long _tokenSet_30_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_30; -}; - -#endif /*INC_AdaParser_hpp_*/ diff --git a/languages/ada/AdaStoreWalker.cpp b/languages/ada/AdaStoreWalker.cpp index 167d671c..51cd0067 100644 --- a/languages/ada/AdaStoreWalker.cpp +++ b/languages/ada/AdaStoreWalker.cpp @@ -1,11 +1,11 @@ /* $ANTLR 2.7.7 (20070609): "expandedada.store.g" -> "AdaStoreWalker.cpp"$ */ -#include "AdaStoreWalker.hpp" -#include -#include -#include -#include -#include -#include +#include "AdaStoreWalker.h" +#include +#include +#include +#include +#include +#include #line 1 "expandedada.store.g" #line 11 "AdaStoreWalker.cpp" AdaStoreWalker::AdaStoreWalker() diff --git a/languages/ada/AdaStoreWalker.h b/languages/ada/AdaStoreWalker.h new file mode 100644 index 00000000..79b0ce76 --- /dev/null +++ b/languages/ada/AdaStoreWalker.h @@ -0,0 +1,350 @@ +#ifndef INC_AdaStoreWalker_h_ +#define INC_AdaStoreWalker_h_ + +#line 1 "expandedada.store.g" + +#include +#include +#include + +#include +#include "AdaAST.h" +#include "ada_utils.h" + +#line 15 "AdaStoreWalker.h" +#include +#include "AdaStoreWalkerTokenTypes.h" +/* $ANTLR 2.7.7 (20070609): "expandedada.store.g" -> "AdaStoreWalker.h"$ */ +#include + +#line 10 "expandedada.store.g" + +#include +#include + +#line 26 "AdaStoreWalker.h" +class CUSTOM_API AdaStoreWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public AdaStoreWalkerTokenTypes +{ +#line 25 "expandedada.store.g" + +private: + TQString m_fileName; + TQValueList m_scopeStack; + CodeModel* m_model; + TQValueList m_imports; + NamespaceDom m_currentContainer; + int m_currentAccess; + bool m_addToStore; /* auxiliary variable: for the moment, this is `true' + only when we are in specs, not bodies. */ + bool m_isSubprogram; // auxiliary to def_id() + FileDom m_file; + +public: + void setCodeModel (CodeModel* model) { m_model = model; } + CodeModel* codeModel () { return m_model; } + const CodeModel* codeModel () const { return m_model; } + + TQString fileName () const { return m_fileName; } + void setFileName (const TQString& fileName) { m_fileName = fileName; } + + void init () { + m_scopeStack.clear (); + m_imports.clear (); + m_currentContainer = m_model->globalNamespace (); + m_scopeStack.append (m_currentContainer); + m_currentAccess = CodeModelItem::Public; + m_addToStore = false; + m_isSubprogram = false; + if (m_model->hasFile(m_fileName)) + m_model->removeFile (m_model->fileByName(m_fileName)); + m_file = m_model->create(); + m_file->setName(m_fileName); + m_model->addFile(m_file); + } + + void wipeout () { m_model->wipeout (); } +// void out () { m_store->out (); } + void removeWithReferences (const TQString& fileName) { + m_model->removeFile (m_model->fileByName(fileName)); + } + NamespaceDom insertScopeContainer + (NamespaceDom scope, const TQStringList & scopes ) { + TQStringList::ConstIterator it = scopes.begin(); + TQString prefix( *it ); + NamespaceDom ns = scope->namespaceByName( prefix ); +// kdDebug() << "insertScopeContainer begin with prefix " << prefix << endl; + if (!ns.data()) { +// kdDebug() << "insertScopeContainer: ns is empty" << endl; + ns = m_model->create(); +// kdDebug() << "insertScopeContainer: ns created" << endl; + ns->setName( prefix ); +// kdDebug() << "insertScopeContainer: ns name set" << endl; + scope->addNamespace( ns ); +// kdDebug() << "insertScopeContainer: ns added to a scope" << endl; + + if (scope == m_model->globalNamespace()) + m_file->addNamespace( ns ); + } +// kdDebug() << "insertScopeContainer: while" << endl; + while ( ++it != scopes.end() ) { + TQString nameSegment( *it ); + prefix += "." + nameSegment; +// kdDebug() << "insertScopeContainer: while prefix = " << prefix << endl; + NamespaceDom inner = scope->namespaceByName( prefix ); + if (!inner.data() ) { +// kdDebug() << "insertScopeContainer: inner is empty " << endl; + inner = m_model->create(); +// kdDebug() << "insertScopeContainer: inner created " << endl; + inner->setName( nameSegment ); + ns->addNamespace( inner ); +// kdDebug() << "insertScopeContainer: inner added " << endl; + } + ns = inner; + } + return ns; + } + NamespaceDom defineScope( RefAdaAST namenode ) { + TQStringList scopes( qnamelist( namenode ) ); +// kdDebug() << "defineScope: " << scopes.join(" ") << endl; + NamespaceDom psc = insertScopeContainer( m_currentContainer, scopes ); +// kdDebug() << "defineScope psc created" << endl; + psc->setStartPosition(namenode->getLine(), namenode->getColumn()); +// kdDebug() << "defineScope start position set" << endl; + psc->setFileName(m_fileName); +// kdDebug() << "defineScope file name set" << endl; + // psc->setEndPosition (endLine, 0); +// kdDebug() << "defineScope return" << endl; + return psc; + } +#line 30 "AdaStoreWalker.h" +public: + AdaStoreWalker(); + static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); + int getNumTokens() const + { + return AdaStoreWalker::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return AdaStoreWalker::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return AdaStoreWalker::tokenNames; + } + public: void compilation_unit(RefAdaAST _t); + public: void context_items_opt(RefAdaAST _t); + public: void library_item(RefAdaAST _t); + public: void subunit(RefAdaAST _t); + public: void pragma(RefAdaAST _t); + public: void with_clause(RefAdaAST _t); + public: void compound_name(RefAdaAST _t); + public: void use_clause(RefAdaAST _t); + public: void subtype_mark(RefAdaAST _t); + public: void lib_subprog_decl_or_rename_or_inst_or_body(RefAdaAST _t); + public: void def_id(RefAdaAST _t); + public: void pkg_body_part(RefAdaAST _t); + public: void generic_inst(RefAdaAST _t); + public: void pkg_spec_part(RefAdaAST _t); + public: void renames(RefAdaAST _t); + public: void generic_decl(RefAdaAST _t); + public: void subprog_def_id(RefAdaAST _t); + public: void subprog_decl(RefAdaAST _t); + public: void formal_part_opt(RefAdaAST _t); + public: void def_designator(RefAdaAST _t); + public: void function_tail(RefAdaAST _t); + public: void definable_operator_symbol(RefAdaAST _t); + public: void spec_decl_part(RefAdaAST _t); + public: void basic_declarative_items_opt(RefAdaAST _t); + public: void private_declarative_items_opt(RefAdaAST _t); + public: void end_id_opt(RefAdaAST _t); + public: void basic_decl_item(RefAdaAST _t); + public: void generic_formal_part_opt(RefAdaAST _t); + public: void procedure_body(RefAdaAST _t); + public: void function_body(RefAdaAST _t); + public: void subprog_decl_or_rename_or_inst_or_body(RefAdaAST _t); + public: void subprog_decl_or_body(RefAdaAST _t); + public: void package_body(RefAdaAST _t); + public: void pragma_arg(RefAdaAST _t); + public: void expression(RefAdaAST _t); + public: void attribute_id(RefAdaAST _t); + public: void modifiers(RefAdaAST _t); + public: void id_opt(RefAdaAST _t); + public: void value_s(RefAdaAST _t); + public: void value(RefAdaAST _t); + public: void ranged_expr_s(RefAdaAST _t); + public: void ranged_expr(RefAdaAST _t); + public: void simple_expression(RefAdaAST _t); + public: void range(RefAdaAST _t); + public: void range_constraint(RefAdaAST _t); + public: void range_dots(RefAdaAST _t); + public: void range_attrib_ref(RefAdaAST _t); + public: void prefix(RefAdaAST _t); + public: void parameter_specification(RefAdaAST _t); + public: void defining_identifier_list(RefAdaAST _t); + public: void init_opt(RefAdaAST _t); + public: void name(RefAdaAST _t); + public: void parenthesized_primary(RefAdaAST _t); + public: void extension_opt(RefAdaAST _t); + public: void task_type_or_single_decl(RefAdaAST _t); + public: void prot_type_or_single_decl(RefAdaAST _t); + public: void decl_common(RefAdaAST _t); + public: void discrim_part_opt(RefAdaAST _t); + public: void task_definition_opt(RefAdaAST _t); + public: void task_items_opt(RefAdaAST _t); + public: void private_task_items_opt(RefAdaAST _t); + public: void discriminant_specifications(RefAdaAST _t); + public: void discriminant_specification(RefAdaAST _t); + public: void entrydecls_repspecs_opt(RefAdaAST _t); + public: void entry_declaration(RefAdaAST _t); + public: void rep_spec(RefAdaAST _t); + public: void discrete_subtype_def_opt(RefAdaAST _t); + public: void discrete_subtype_definition(RefAdaAST _t); + public: void subtype_ind(RefAdaAST _t); + public: void align_opt(RefAdaAST _t); + public: void comp_loc_s(RefAdaAST _t); + public: void local_enum_name(RefAdaAST _t); + public: void enumeration_aggregate(RefAdaAST _t); + public: void protected_definition(RefAdaAST _t); + public: void prot_private_opt(RefAdaAST _t); + public: void prot_member_decl_s(RefAdaAST _t); + public: void prot_op_decl_s(RefAdaAST _t); + public: void prot_op_decl(RefAdaAST _t); + public: void comp_decl(RefAdaAST _t); + public: void component_subtype_def(RefAdaAST _t); + public: void enum_id_s(RefAdaAST _t); + public: void range_constraint_opt(RefAdaAST _t); + public: void array_type_declaration(RefAdaAST _t); + public: void access_type_declaration(RefAdaAST _t); + public: void id_and_discrim(RefAdaAST _t); + public: void record_definition(RefAdaAST _t); + public: void array_type_definition(RefAdaAST _t); + public: void enumeration_literal_specification(RefAdaAST _t); + public: void index_or_discrete_range_s(RefAdaAST _t); + public: void index_or_discrete_range(RefAdaAST _t); + public: void constraint_opt(RefAdaAST _t); + public: void digits_constraint(RefAdaAST _t); + public: void delta_constraint(RefAdaAST _t); + public: void index_constraint(RefAdaAST _t); + public: void discriminant_constraint(RefAdaAST _t); + public: void discrete_range(RefAdaAST _t); + public: void discriminant_association(RefAdaAST _t); + public: void selector_names_opt(RefAdaAST _t); + public: void selector_name(RefAdaAST _t); + public: void component_list(RefAdaAST _t); + public: void component_items(RefAdaAST _t); + public: void variant_part(RefAdaAST _t); + public: void discriminant_direct_name(RefAdaAST _t); + public: void variant_s(RefAdaAST _t); + public: void variant(RefAdaAST _t); + public: void choice_s(RefAdaAST _t); + public: void choice(RefAdaAST _t); + public: void discrete_with_range(RefAdaAST _t); + public: void mark_with_constraint(RefAdaAST _t); + public: void generic_formal_parameter(RefAdaAST _t); + public: void formal_array_type_declaration(RefAdaAST _t); + public: void formal_access_type_declaration(RefAdaAST _t); + public: void id_part(RefAdaAST _t); + public: void subprogram_default_opt(RefAdaAST _t); + public: void formal_package_actual_part_opt(RefAdaAST _t); + public: void body_part(RefAdaAST _t); + public: void declarative_part(RefAdaAST _t); + public: void block_body(RefAdaAST _t); + public: void declarative_item(RefAdaAST _t); + public: void prot_op_bodies_opt(RefAdaAST _t); + public: void block_body_opt(RefAdaAST _t); + public: void handled_stmt_s(RefAdaAST _t); + public: void entry_body(RefAdaAST _t); + public: void statements(RefAdaAST _t); + public: void except_handler_part_opt(RefAdaAST _t); + public: void handled_stmts_opt(RefAdaAST _t); + public: void statement(RefAdaAST _t); + public: void def_label_opt(RefAdaAST _t); + public: void null_stmt(RefAdaAST _t); + public: void exit_stmt(RefAdaAST _t); + public: void return_stmt(RefAdaAST _t); + public: void goto_stmt(RefAdaAST _t); + public: void delay_stmt(RefAdaAST _t); + public: void abort_stmt(RefAdaAST _t); + public: void raise_stmt(RefAdaAST _t); + public: void requeue_stmt(RefAdaAST _t); + public: void accept_stmt(RefAdaAST _t); + public: void select_stmt(RefAdaAST _t); + public: void if_stmt(RefAdaAST _t); + public: void case_stmt(RefAdaAST _t); + public: void loop_stmt(RefAdaAST _t); + public: void block(RefAdaAST _t); + public: void call_or_assignment(RefAdaAST _t); + public: void cond_clause(RefAdaAST _t); + public: void elsifs_opt(RefAdaAST _t); + public: void else_opt(RefAdaAST _t); + public: void condition(RefAdaAST _t); + public: void alternative_s(RefAdaAST _t); + public: void case_statement_alternative(RefAdaAST _t); + public: void iteration_scheme_opt(RefAdaAST _t); + public: void declare_opt(RefAdaAST _t); + public: void label_name(RefAdaAST _t); + public: void entry_body_formal_part(RefAdaAST _t); + public: void entry_barrier(RefAdaAST _t); + public: void entry_index_spec_opt(RefAdaAST _t); + public: void entry_call_stmt(RefAdaAST _t); + public: void entry_index_opt(RefAdaAST _t); + public: void triggering_alternative(RefAdaAST _t); + public: void abortable_part(RefAdaAST _t); + public: void selective_accept(RefAdaAST _t); + public: void entry_call_alternative(RefAdaAST _t); + public: void delay_alternative(RefAdaAST _t); + public: void stmts_opt(RefAdaAST _t); + public: void guard_opt(RefAdaAST _t); + public: void select_alternative(RefAdaAST _t); + public: void or_select_opt(RefAdaAST _t); + public: void accept_alternative(RefAdaAST _t); + public: void exception_handler(RefAdaAST _t); + public: void identifier_colon_opt(RefAdaAST _t); + public: void except_choice_s(RefAdaAST _t); + public: void exception_choice(RefAdaAST _t); + public: void operator_call(RefAdaAST _t); + public: void relation(RefAdaAST _t); + public: void range_or_mark(RefAdaAST _t); + public: void signed_term(RefAdaAST _t); + public: void term(RefAdaAST _t); + public: void factor(RefAdaAST _t); + public: void primary(RefAdaAST _t); + public: void name_or_qualified(RefAdaAST _t); + public: void allocator(RefAdaAST _t); + public: void subprogram_body(RefAdaAST _t); + public: void task_body(RefAdaAST _t); + public: void protected_body(RefAdaAST _t); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefAdaAST returnAST; + RefAdaAST _retTree; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 291; +#else + enum { + NUM_TOKENS = 291 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; +}; + +#endif /*INC_AdaStoreWalker_h_*/ diff --git a/languages/ada/AdaStoreWalker.hpp b/languages/ada/AdaStoreWalker.hpp deleted file mode 100644 index c18f5dcd..00000000 --- a/languages/ada/AdaStoreWalker.hpp +++ /dev/null @@ -1,350 +0,0 @@ -#ifndef INC_AdaStoreWalker_hpp_ -#define INC_AdaStoreWalker_hpp_ - -#line 1 "expandedada.store.g" - -#include -#include -#include - -#include -#include "AdaAST.hpp" -#include "ada_utils.hpp" - -#line 15 "AdaStoreWalker.hpp" -#include -#include "AdaStoreWalkerTokenTypes.hpp" -/* $ANTLR 2.7.7 (20070609): "expandedada.store.g" -> "AdaStoreWalker.hpp"$ */ -#include - -#line 10 "expandedada.store.g" - -#include -#include - -#line 26 "AdaStoreWalker.hpp" -class CUSTOM_API AdaStoreWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public AdaStoreWalkerTokenTypes -{ -#line 25 "expandedada.store.g" - -private: - TQString m_fileName; - TQValueList m_scopeStack; - CodeModel* m_model; - TQValueList m_imports; - NamespaceDom m_currentContainer; - int m_currentAccess; - bool m_addToStore; /* auxiliary variable: for the moment, this is `true' - only when we are in specs, not bodies. */ - bool m_isSubprogram; // auxiliary to def_id() - FileDom m_file; - -public: - void setCodeModel (CodeModel* model) { m_model = model; } - CodeModel* codeModel () { return m_model; } - const CodeModel* codeModel () const { return m_model; } - - TQString fileName () const { return m_fileName; } - void setFileName (const TQString& fileName) { m_fileName = fileName; } - - void init () { - m_scopeStack.clear (); - m_imports.clear (); - m_currentContainer = m_model->globalNamespace (); - m_scopeStack.append (m_currentContainer); - m_currentAccess = CodeModelItem::Public; - m_addToStore = false; - m_isSubprogram = false; - if (m_model->hasFile(m_fileName)) - m_model->removeFile (m_model->fileByName(m_fileName)); - m_file = m_model->create(); - m_file->setName(m_fileName); - m_model->addFile(m_file); - } - - void wipeout () { m_model->wipeout (); } -// void out () { m_store->out (); } - void removeWithReferences (const TQString& fileName) { - m_model->removeFile (m_model->fileByName(fileName)); - } - NamespaceDom insertScopeContainer - (NamespaceDom scope, const TQStringList & scopes ) { - TQStringList::ConstIterator it = scopes.begin(); - TQString prefix( *it ); - NamespaceDom ns = scope->namespaceByName( prefix ); -// kdDebug() << "insertScopeContainer begin with prefix " << prefix << endl; - if (!ns.data()) { -// kdDebug() << "insertScopeContainer: ns is empty" << endl; - ns = m_model->create(); -// kdDebug() << "insertScopeContainer: ns created" << endl; - ns->setName( prefix ); -// kdDebug() << "insertScopeContainer: ns name set" << endl; - scope->addNamespace( ns ); -// kdDebug() << "insertScopeContainer: ns added to a scope" << endl; - - if (scope == m_model->globalNamespace()) - m_file->addNamespace( ns ); - } -// kdDebug() << "insertScopeContainer: while" << endl; - while ( ++it != scopes.end() ) { - TQString nameSegment( *it ); - prefix += "." + nameSegment; -// kdDebug() << "insertScopeContainer: while prefix = " << prefix << endl; - NamespaceDom inner = scope->namespaceByName( prefix ); - if (!inner.data() ) { -// kdDebug() << "insertScopeContainer: inner is empty " << endl; - inner = m_model->create(); -// kdDebug() << "insertScopeContainer: inner created " << endl; - inner->setName( nameSegment ); - ns->addNamespace( inner ); -// kdDebug() << "insertScopeContainer: inner added " << endl; - } - ns = inner; - } - return ns; - } - NamespaceDom defineScope( RefAdaAST namenode ) { - TQStringList scopes( qnamelist( namenode ) ); -// kdDebug() << "defineScope: " << scopes.join(" ") << endl; - NamespaceDom psc = insertScopeContainer( m_currentContainer, scopes ); -// kdDebug() << "defineScope psc created" << endl; - psc->setStartPosition(namenode->getLine(), namenode->getColumn()); -// kdDebug() << "defineScope start position set" << endl; - psc->setFileName(m_fileName); -// kdDebug() << "defineScope file name set" << endl; - // psc->setEndPosition (endLine, 0); -// kdDebug() << "defineScope return" << endl; - return psc; - } -#line 30 "AdaStoreWalker.hpp" -public: - AdaStoreWalker(); - static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); - int getNumTokens() const - { - return AdaStoreWalker::NUM_TOKENS; - } - const char* getTokenName( int type ) const - { - if( type > getNumTokens() ) return 0; - return AdaStoreWalker::tokenNames[type]; - } - const char* const* getTokenNames() const - { - return AdaStoreWalker::tokenNames; - } - public: void compilation_unit(RefAdaAST _t); - public: void context_items_opt(RefAdaAST _t); - public: void library_item(RefAdaAST _t); - public: void subunit(RefAdaAST _t); - public: void pragma(RefAdaAST _t); - public: void with_clause(RefAdaAST _t); - public: void compound_name(RefAdaAST _t); - public: void use_clause(RefAdaAST _t); - public: void subtype_mark(RefAdaAST _t); - public: void lib_subprog_decl_or_rename_or_inst_or_body(RefAdaAST _t); - public: void def_id(RefAdaAST _t); - public: void pkg_body_part(RefAdaAST _t); - public: void generic_inst(RefAdaAST _t); - public: void pkg_spec_part(RefAdaAST _t); - public: void renames(RefAdaAST _t); - public: void generic_decl(RefAdaAST _t); - public: void subprog_def_id(RefAdaAST _t); - public: void subprog_decl(RefAdaAST _t); - public: void formal_part_opt(RefAdaAST _t); - public: void def_designator(RefAdaAST _t); - public: void function_tail(RefAdaAST _t); - public: void definable_operator_symbol(RefAdaAST _t); - public: void spec_decl_part(RefAdaAST _t); - public: void basic_declarative_items_opt(RefAdaAST _t); - public: void private_declarative_items_opt(RefAdaAST _t); - public: void end_id_opt(RefAdaAST _t); - public: void basic_decl_item(RefAdaAST _t); - public: void generic_formal_part_opt(RefAdaAST _t); - public: void procedure_body(RefAdaAST _t); - public: void function_body(RefAdaAST _t); - public: void subprog_decl_or_rename_or_inst_or_body(RefAdaAST _t); - public: void subprog_decl_or_body(RefAdaAST _t); - public: void package_body(RefAdaAST _t); - public: void pragma_arg(RefAdaAST _t); - public: void expression(RefAdaAST _t); - public: void attribute_id(RefAdaAST _t); - public: void modifiers(RefAdaAST _t); - public: void id_opt(RefAdaAST _t); - public: void value_s(RefAdaAST _t); - public: void value(RefAdaAST _t); - public: void ranged_expr_s(RefAdaAST _t); - public: void ranged_expr(RefAdaAST _t); - public: void simple_expression(RefAdaAST _t); - public: void range(RefAdaAST _t); - public: void range_constraint(RefAdaAST _t); - public: void range_dots(RefAdaAST _t); - public: void range_attrib_ref(RefAdaAST _t); - public: void prefix(RefAdaAST _t); - public: void parameter_specification(RefAdaAST _t); - public: void defining_identifier_list(RefAdaAST _t); - public: void init_opt(RefAdaAST _t); - public: void name(RefAdaAST _t); - public: void parenthesized_primary(RefAdaAST _t); - public: void extension_opt(RefAdaAST _t); - public: void task_type_or_single_decl(RefAdaAST _t); - public: void prot_type_or_single_decl(RefAdaAST _t); - public: void decl_common(RefAdaAST _t); - public: void discrim_part_opt(RefAdaAST _t); - public: void task_definition_opt(RefAdaAST _t); - public: void task_items_opt(RefAdaAST _t); - public: void private_task_items_opt(RefAdaAST _t); - public: void discriminant_specifications(RefAdaAST _t); - public: void discriminant_specification(RefAdaAST _t); - public: void entrydecls_repspecs_opt(RefAdaAST _t); - public: void entry_declaration(RefAdaAST _t); - public: void rep_spec(RefAdaAST _t); - public: void discrete_subtype_def_opt(RefAdaAST _t); - public: void discrete_subtype_definition(RefAdaAST _t); - public: void subtype_ind(RefAdaAST _t); - public: void align_opt(RefAdaAST _t); - public: void comp_loc_s(RefAdaAST _t); - public: void local_enum_name(RefAdaAST _t); - public: void enumeration_aggregate(RefAdaAST _t); - public: void protected_definition(RefAdaAST _t); - public: void prot_private_opt(RefAdaAST _t); - public: void prot_member_decl_s(RefAdaAST _t); - public: void prot_op_decl_s(RefAdaAST _t); - public: void prot_op_decl(RefAdaAST _t); - public: void comp_decl(RefAdaAST _t); - public: void component_subtype_def(RefAdaAST _t); - public: void enum_id_s(RefAdaAST _t); - public: void range_constraint_opt(RefAdaAST _t); - public: void array_type_declaration(RefAdaAST _t); - public: void access_type_declaration(RefAdaAST _t); - public: void id_and_discrim(RefAdaAST _t); - public: void record_definition(RefAdaAST _t); - public: void array_type_definition(RefAdaAST _t); - public: void enumeration_literal_specification(RefAdaAST _t); - public: void index_or_discrete_range_s(RefAdaAST _t); - public: void index_or_discrete_range(RefAdaAST _t); - public: void constraint_opt(RefAdaAST _t); - public: void digits_constraint(RefAdaAST _t); - public: void delta_constraint(RefAdaAST _t); - public: void index_constraint(RefAdaAST _t); - public: void discriminant_constraint(RefAdaAST _t); - public: void discrete_range(RefAdaAST _t); - public: void discriminant_association(RefAdaAST _t); - public: void selector_names_opt(RefAdaAST _t); - public: void selector_name(RefAdaAST _t); - public: void component_list(RefAdaAST _t); - public: void component_items(RefAdaAST _t); - public: void variant_part(RefAdaAST _t); - public: void discriminant_direct_name(RefAdaAST _t); - public: void variant_s(RefAdaAST _t); - public: void variant(RefAdaAST _t); - public: void choice_s(RefAdaAST _t); - public: void choice(RefAdaAST _t); - public: void discrete_with_range(RefAdaAST _t); - public: void mark_with_constraint(RefAdaAST _t); - public: void generic_formal_parameter(RefAdaAST _t); - public: void formal_array_type_declaration(RefAdaAST _t); - public: void formal_access_type_declaration(RefAdaAST _t); - public: void id_part(RefAdaAST _t); - public: void subprogram_default_opt(RefAdaAST _t); - public: void formal_package_actual_part_opt(RefAdaAST _t); - public: void body_part(RefAdaAST _t); - public: void declarative_part(RefAdaAST _t); - public: void block_body(RefAdaAST _t); - public: void declarative_item(RefAdaAST _t); - public: void prot_op_bodies_opt(RefAdaAST _t); - public: void block_body_opt(RefAdaAST _t); - public: void handled_stmt_s(RefAdaAST _t); - public: void entry_body(RefAdaAST _t); - public: void statements(RefAdaAST _t); - public: void except_handler_part_opt(RefAdaAST _t); - public: void handled_stmts_opt(RefAdaAST _t); - public: void statement(RefAdaAST _t); - public: void def_label_opt(RefAdaAST _t); - public: void null_stmt(RefAdaAST _t); - public: void exit_stmt(RefAdaAST _t); - public: void return_stmt(RefAdaAST _t); - public: void goto_stmt(RefAdaAST _t); - public: void delay_stmt(RefAdaAST _t); - public: void abort_stmt(RefAdaAST _t); - public: void raise_stmt(RefAdaAST _t); - public: void requeue_stmt(RefAdaAST _t); - public: void accept_stmt(RefAdaAST _t); - public: void select_stmt(RefAdaAST _t); - public: void if_stmt(RefAdaAST _t); - public: void case_stmt(RefAdaAST _t); - public: void loop_stmt(RefAdaAST _t); - public: void block(RefAdaAST _t); - public: void call_or_assignment(RefAdaAST _t); - public: void cond_clause(RefAdaAST _t); - public: void elsifs_opt(RefAdaAST _t); - public: void else_opt(RefAdaAST _t); - public: void condition(RefAdaAST _t); - public: void alternative_s(RefAdaAST _t); - public: void case_statement_alternative(RefAdaAST _t); - public: void iteration_scheme_opt(RefAdaAST _t); - public: void declare_opt(RefAdaAST _t); - public: void label_name(RefAdaAST _t); - public: void entry_body_formal_part(RefAdaAST _t); - public: void entry_barrier(RefAdaAST _t); - public: void entry_index_spec_opt(RefAdaAST _t); - public: void entry_call_stmt(RefAdaAST _t); - public: void entry_index_opt(RefAdaAST _t); - public: void triggering_alternative(RefAdaAST _t); - public: void abortable_part(RefAdaAST _t); - public: void selective_accept(RefAdaAST _t); - public: void entry_call_alternative(RefAdaAST _t); - public: void delay_alternative(RefAdaAST _t); - public: void stmts_opt(RefAdaAST _t); - public: void guard_opt(RefAdaAST _t); - public: void select_alternative(RefAdaAST _t); - public: void or_select_opt(RefAdaAST _t); - public: void accept_alternative(RefAdaAST _t); - public: void exception_handler(RefAdaAST _t); - public: void identifier_colon_opt(RefAdaAST _t); - public: void except_choice_s(RefAdaAST _t); - public: void exception_choice(RefAdaAST _t); - public: void operator_call(RefAdaAST _t); - public: void relation(RefAdaAST _t); - public: void range_or_mark(RefAdaAST _t); - public: void signed_term(RefAdaAST _t); - public: void term(RefAdaAST _t); - public: void factor(RefAdaAST _t); - public: void primary(RefAdaAST _t); - public: void name_or_qualified(RefAdaAST _t); - public: void allocator(RefAdaAST _t); - public: void subprogram_body(RefAdaAST _t); - public: void task_body(RefAdaAST _t); - public: void protected_body(RefAdaAST _t); -public: - ANTLR_USE_NAMESPACE(antlr)RefAST getAST() - { - return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); - } - -protected: - RefAdaAST returnAST; - RefAdaAST _retTree; -private: - static const char* tokenNames[]; -#ifndef NO_STATIC_CONSTS - static const int NUM_TOKENS = 291; -#else - enum { - NUM_TOKENS = 291 - }; -#endif - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; - static const unsigned long _tokenSet_4_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; -}; - -#endif /*INC_AdaStoreWalker_hpp_*/ diff --git a/languages/ada/AdaStoreWalkerTokenTypes.h b/languages/ada/AdaStoreWalkerTokenTypes.h new file mode 100644 index 00000000..be52bae2 --- /dev/null +++ b/languages/ada/AdaStoreWalkerTokenTypes.h @@ -0,0 +1,307 @@ +#ifndef INC_AdaStoreWalkerTokenTypes_h_ +#define INC_AdaStoreWalkerTokenTypes_h_ + +/* $ANTLR 2.7.7 (20070609): "expandedada.store.g" -> "AdaStoreWalkerTokenTypes.h"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API AdaStoreWalkerTokenTypes { +#endif + enum { + EOF_ = 1, + PRAGMA = 4, + IDENTIFIER = 5, + SEMI = 6, + LPAREN = 7, + COMMA = 8, + RPAREN = 9, + RIGHT_SHAFT = 10, + WITH = 11, + DOT = 12, + USE = 13, + TYPE = 14, + TIC = 15, + RANGE = 16, + DIGITS = 17, + DELTA = 18, + ACCESS = 19, + PRIVATE = 20, + PACKAGE = 21, + BODY = 22, + IS = 23, + PROCEDURE = 24, + FUNCTION = 25, + NEW = 26, + OTHERS = 27, + PIPE = 28, + DOT_DOT = 29, + ALL = 30, + COLON = 31, + IN = 32, + OUT = 33, + RENAMES = 34, + CHARACTER_LITERAL = 35, + CHAR_STRING = 36, + NuLL = 37, + RECORD = 38, + SEPARATE = 39, + ABSTRACT = 40, + RETURN = 41, + TASK = 42, + PROTECTED = 43, + BOX = 44, + ASSIGN = 45, + ENTRY = 46, + FOR = 47, + END = 48, + AT = 49, + MOD = 50, + SUBTYPE = 51, + EXCEPTION = 52, + CONSTANT = 53, + ARRAY = 54, + OF = 55, + ALIASED = 56, + CASE = 57, + WHEN = 58, + TAGGED = 59, + LIMITED = 60, + GENERIC = 61, + BEGIN = 62, + LT_LT = 63, + GT_GT = 64, + IF = 65, + THEN = 66, + ELSIF = 67, + ELSE = 68, + LOOP = 69, + WHILE = 70, + REVERSE = 71, + DECLARE = 72, + EXIT = 73, + GOTO = 74, + ACCEPT = 75, + DO = 76, + DELAY = 77, + UNTIL = 78, + SELECT = 79, + ABORT = 80, + OR = 81, + TERMINATE = 82, + RAISE = 83, + REQUEUE = 84, + AND = 85, + XOR = 86, + NOT = 87, + EQ = 88, + NE = 89, + LT_ = 90, + LE = 91, + GT = 92, + GE = 93, + PLUS = 94, + MINUS = 95, + CONCAT = 96, + STAR = 97, + DIV = 98, + REM = 99, + ABS = 100, + EXPON = 101, + NUMERIC_LIT = 102, + ABORTABLE_PART = 103, + ABORT_STATEMENT = 104, + ACCEPT_ALTERNATIVE = 105, + ACCEPT_STATEMENT = 106, + ALLOCATOR = 107, + ASSIGNMENT_STATEMENT = 108, + ASYNCHRONOUS_SELECT = 109, + ATTRIBUTE_DEFINITION_CLAUSE = 110, + AT_CLAUSE = 111, + BLOCK_STATEMENT = 112, + CASE_STATEMENT = 113, + CASE_STATEMENT_ALTERNATIVE = 114, + CODE_STATEMENT = 115, + COMPONENT_DECLARATION = 116, + CONDITIONAL_ENTRY_CALL = 117, + CONTEXT_CLAUSE = 118, + DECLARATIVE_PART = 119, + DEFINING_IDENTIFIER_LIST = 120, + DELAY_ALTERNATIVE = 121, + DELAY_STATEMENT = 122, + DELTA_CONSTRAINT = 123, + DIGITS_CONSTRAINT = 124, + DISCRIMINANT_ASSOCIATION = 125, + DISCRIMINANT_CONSTRAINT = 126, + DISCRIMINANT_SPECIFICATION = 127, + ENTRY_BODY = 128, + ENTRY_CALL_ALTERNATIVE = 129, + ENTRY_CALL_STATEMENT = 130, + ENTRY_DECLARATION = 131, + ENTRY_INDEX_SPECIFICATION = 132, + ENUMERATION_REPESENTATION_CLAUSE = 133, + EXCEPTION_DECLARATION = 134, + EXCEPTION_HANDLER = 135, + EXCEPTION_RENAMING_DECLARATION = 136, + EXIT_STATEMENT = 137, + FORMAL_PACKAGE_DECLARATION = 138, + GENERIC_FORMAL_PART = 139, + GENERIC_PACKAGE_DECLARATION = 140, + GOTO_STATEMENT = 141, + HANDLED_SEQUENCE_OF_STATEMENTS = 142, + HANDLED_STMTS_OPT = 143, + IF_STATEMENT = 144, + INCOMPLETE_TYPE_DECLARATION = 145, + INDEXED_COMPONENT = 146, + INDEX_CONSTRAINT = 147, + LIBRARY_ITEM = 148, + LOOP_STATEMENT = 149, + NAME = 150, + NULL_STATEMENT = 151, + NUMBER_DECLARATION = 152, + OBJECT_DECLARATION = 153, + OBJECT_RENAMING_DECLARATION = 154, + OPERATOR_SYMBOL = 155, + PACKAGE_BODY = 156, + PACKAGE_BODY_STUB = 157, + PACKAGE_RENAMING_DECLARATION = 158, + PACKAGE_SPECIFICATION = 159, + PARAMETER_SPECIFICATION = 160, + PRIVATE_EXTENSION_DECLARATION = 161, + PRIVATE_TYPE_DECLARATION = 162, + PROTECTED_BODY = 163, + PROTECTED_BODY_STUB = 164, + PROTECTED_TYPE_DECLARATION = 165, + RAISE_STATEMENT = 166, + RANGE_ATTRIBUTE_REFERENCE = 167, + RECORD_REPRESENTATION_CLAUSE = 168, + REQUEUE_STATEMENT = 169, + RETURN_STATEMENT = 170, + SELECTIVE_ACCEPT = 171, + SEQUENCE_OF_STATEMENTS = 172, + SINGLE_PROTECTED_DECLARATION = 173, + SINGLE_TASK_DECLARATION = 174, + STATEMENT = 175, + SUBTYPE_DECLARATION = 176, + SUBTYPE_INDICATION = 177, + SUBTYPE_MARK = 178, + SUBUNIT = 179, + TASK_BODY = 180, + TASK_BODY_STUB = 181, + TASK_TYPE_DECLARATION = 182, + TERMINATE_ALTERNATIVE = 183, + TIMED_ENTRY_CALL = 184, + TRIGGERING_ALTERNATIVE = 185, + USE_CLAUSE = 186, + USE_TYPE_CLAUSE = 187, + VARIANT = 188, + VARIANT_PART = 189, + WITH_CLAUSE = 190, + ABSTRACT_FUNCTION_DECLARATION = 191, + ABSTRACT_PROCEDURE_DECLARATION = 192, + ACCESS_TO_FUNCTION_DECLARATION = 193, + ACCESS_TO_OBJECT_DECLARATION = 194, + ACCESS_TO_PROCEDURE_DECLARATION = 195, + ARRAY_OBJECT_DECLARATION = 196, + ARRAY_TYPE_DECLARATION = 197, + AND_THEN = 198, + BASIC_DECLARATIVE_ITEMS_OPT = 199, + BLOCK_BODY = 200, + BLOCK_BODY_OPT = 201, + CALL_STATEMENT = 202, + COMPONENT_CLAUSES_OPT = 203, + COMPONENT_ITEMS = 204, + COND_CLAUSE = 205, + DECIMAL_FIXED_POINT_DECLARATION = 206, + DECLARE_OPT = 207, + DERIVED_RECORD_EXTENSION = 208, + DISCRETE_SUBTYPE_DEF_OPT = 209, + DISCRIMINANT_SPECIFICATIONS = 210, + DISCRIM_PART_OPT = 211, + ELSE_OPT = 212, + ELSIFS_OPT = 213, + END_ID_OPT = 214, + ENTRY_INDEX_OPT = 215, + ENUMERATION_TYPE_DECLARATION = 216, + EXCEPT_HANDLER_PART_OPT = 217, + EXTENSION_OPT = 218, + FLOATING_POINT_DECLARATION = 219, + FORMAL_DECIMAL_FIXED_POINT_DECLARATION = 220, + FORMAL_DISCRETE_TYPE_DECLARATION = 221, + FORMAL_FLOATING_POINT_DECLARATION = 222, + FORMAL_FUNCTION_DECLARATION = 223, + FORMAL_MODULAR_TYPE_DECLARATION = 224, + FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION = 225, + FORMAL_ORDINARY_FIXED_POINT_DECLARATION = 226, + FORMAL_PART_OPT = 227, + FORMAL_PRIVATE_EXTENSION_DECLARATION = 228, + FORMAL_PRIVATE_TYPE_DECLARATION = 229, + FORMAL_PROCEDURE_DECLARATION = 230, + FORMAL_SIGNED_INTEGER_TYPE_DECLARATION = 231, + FUNCTION_BODY = 232, + FUNCTION_BODY_STUB = 233, + FUNCTION_DECLARATION = 234, + FUNCTION_RENAMING_DECLARATION = 235, + GENERIC_FUNCTION_DECLARATION = 236, + GENERIC_FUNCTION_INSTANTIATION = 237, + GENERIC_FUNCTION_RENAMING = 238, + GENERIC_PACKAGE_INSTANTIATION = 239, + GENERIC_PACKAGE_RENAMING = 240, + GENERIC_PROCEDURE_DECLARATION = 241, + GENERIC_PROCEDURE_INSTANTIATION = 242, + GENERIC_PROCEDURE_RENAMING = 243, + GUARD_OPT = 244, + IDENTIFIER_COLON_OPT = 245, + ID_OPT = 246, + INIT_OPT = 247, + ITERATION_SCHEME_OPT = 248, + LABEL_OPT = 249, + MARK_WITH_CONSTRAINT = 250, + MODIFIERS = 251, + MODULAR_TYPE_DECLARATION = 252, + MOD_CLAUSE_OPT = 253, + NOT_IN = 254, + ORDINARY_DERIVED_TYPE_DECLARATION = 255, + ORDINARY_FIXED_POINT_DECLARATION = 256, + OR_ELSE = 257, + OR_SELECT_OPT = 258, + PARENTHESIZED_PRIMARY = 259, + PRIVATE_DECLARATIVE_ITEMS_OPT = 260, + PRIVATE_TASK_ITEMS_OPT = 261, + PROCEDURE_BODY = 262, + PROCEDURE_BODY_STUB = 263, + PROCEDURE_DECLARATION = 264, + PROCEDURE_RENAMING_DECLARATION = 265, + PROT_MEMBER_DECLARATIONS = 266, + PROT_OP_BODIES_OPT = 267, + PROT_OP_DECLARATIONS = 268, + PROT_PRIVATE_OPT = 269, + RANGED_EXPRS = 270, + RANGE_CONSTRAINT = 271, + RECORD_TYPE_DECLARATION = 272, + SELECTOR_NAMES_OPT = 273, + SIGNED_INTEGER_TYPE_DECLARATION = 274, + TASK_ITEMS_OPT = 275, + UNARY_MINUS = 276, + UNARY_PLUS = 277, + VALUE = 278, + VALUES = 279, + VARIANTS = 280, + COMMENT_INTRO = 281, + OX = 282, + TIC_OR_CHARACTER_LITERAL = 283, + DIGIT = 284, + EXPONENT = 285, + EXTENDED_DIGIT = 286, + BASED_INTEGER = 287, + WS_ = 288, + COMMENT = 289, + CHARACTER_STRING = 290, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_AdaStoreWalkerTokenTypes_h_*/ diff --git a/languages/ada/AdaStoreWalkerTokenTypes.hpp b/languages/ada/AdaStoreWalkerTokenTypes.hpp deleted file mode 100644 index daaa4b21..00000000 --- a/languages/ada/AdaStoreWalkerTokenTypes.hpp +++ /dev/null @@ -1,307 +0,0 @@ -#ifndef INC_AdaStoreWalkerTokenTypes_hpp_ -#define INC_AdaStoreWalkerTokenTypes_hpp_ - -/* $ANTLR 2.7.7 (20070609): "expandedada.store.g" -> "AdaStoreWalkerTokenTypes.hpp"$ */ - -#ifndef CUSTOM_API -# define CUSTOM_API -#endif - -#ifdef __cplusplus -struct CUSTOM_API AdaStoreWalkerTokenTypes { -#endif - enum { - EOF_ = 1, - PRAGMA = 4, - IDENTIFIER = 5, - SEMI = 6, - LPAREN = 7, - COMMA = 8, - RPAREN = 9, - RIGHT_SHAFT = 10, - WITH = 11, - DOT = 12, - USE = 13, - TYPE = 14, - TIC = 15, - RANGE = 16, - DIGITS = 17, - DELTA = 18, - ACCESS = 19, - PRIVATE = 20, - PACKAGE = 21, - BODY = 22, - IS = 23, - PROCEDURE = 24, - FUNCTION = 25, - NEW = 26, - OTHERS = 27, - PIPE = 28, - DOT_DOT = 29, - ALL = 30, - COLON = 31, - IN = 32, - OUT = 33, - RENAMES = 34, - CHARACTER_LITERAL = 35, - CHAR_STRING = 36, - NuLL = 37, - RECORD = 38, - SEPARATE = 39, - ABSTRACT = 40, - RETURN = 41, - TASK = 42, - PROTECTED = 43, - BOX = 44, - ASSIGN = 45, - ENTRY = 46, - FOR = 47, - END = 48, - AT = 49, - MOD = 50, - SUBTYPE = 51, - EXCEPTION = 52, - CONSTANT = 53, - ARRAY = 54, - OF = 55, - ALIASED = 56, - CASE = 57, - WHEN = 58, - TAGGED = 59, - LIMITED = 60, - GENERIC = 61, - BEGIN = 62, - LT_LT = 63, - GT_GT = 64, - IF = 65, - THEN = 66, - ELSIF = 67, - ELSE = 68, - LOOP = 69, - WHILE = 70, - REVERSE = 71, - DECLARE = 72, - EXIT = 73, - GOTO = 74, - ACCEPT = 75, - DO = 76, - DELAY = 77, - UNTIL = 78, - SELECT = 79, - ABORT = 80, - OR = 81, - TERMINATE = 82, - RAISE = 83, - REQUEUE = 84, - AND = 85, - XOR = 86, - NOT = 87, - EQ = 88, - NE = 89, - LT_ = 90, - LE = 91, - GT = 92, - GE = 93, - PLUS = 94, - MINUS = 95, - CONCAT = 96, - STAR = 97, - DIV = 98, - REM = 99, - ABS = 100, - EXPON = 101, - NUMERIC_LIT = 102, - ABORTABLE_PART = 103, - ABORT_STATEMENT = 104, - ACCEPT_ALTERNATIVE = 105, - ACCEPT_STATEMENT = 106, - ALLOCATOR = 107, - ASSIGNMENT_STATEMENT = 108, - ASYNCHRONOUS_SELECT = 109, - ATTRIBUTE_DEFINITION_CLAUSE = 110, - AT_CLAUSE = 111, - BLOCK_STATEMENT = 112, - CASE_STATEMENT = 113, - CASE_STATEMENT_ALTERNATIVE = 114, - CODE_STATEMENT = 115, - COMPONENT_DECLARATION = 116, - CONDITIONAL_ENTRY_CALL = 117, - CONTEXT_CLAUSE = 118, - DECLARATIVE_PART = 119, - DEFINING_IDENTIFIER_LIST = 120, - DELAY_ALTERNATIVE = 121, - DELAY_STATEMENT = 122, - DELTA_CONSTRAINT = 123, - DIGITS_CONSTRAINT = 124, - DISCRIMINANT_ASSOCIATION = 125, - DISCRIMINANT_CONSTRAINT = 126, - DISCRIMINANT_SPECIFICATION = 127, - ENTRY_BODY = 128, - ENTRY_CALL_ALTERNATIVE = 129, - ENTRY_CALL_STATEMENT = 130, - ENTRY_DECLARATION = 131, - ENTRY_INDEX_SPECIFICATION = 132, - ENUMERATION_REPESENTATION_CLAUSE = 133, - EXCEPTION_DECLARATION = 134, - EXCEPTION_HANDLER = 135, - EXCEPTION_RENAMING_DECLARATION = 136, - EXIT_STATEMENT = 137, - FORMAL_PACKAGE_DECLARATION = 138, - GENERIC_FORMAL_PART = 139, - GENERIC_PACKAGE_DECLARATION = 140, - GOTO_STATEMENT = 141, - HANDLED_SEQUENCE_OF_STATEMENTS = 142, - HANDLED_STMTS_OPT = 143, - IF_STATEMENT = 144, - INCOMPLETE_TYPE_DECLARATION = 145, - INDEXED_COMPONENT = 146, - INDEX_CONSTRAINT = 147, - LIBRARY_ITEM = 148, - LOOP_STATEMENT = 149, - NAME = 150, - NULL_STATEMENT = 151, - NUMBER_DECLARATION = 152, - OBJECT_DECLARATION = 153, - OBJECT_RENAMING_DECLARATION = 154, - OPERATOR_SYMBOL = 155, - PACKAGE_BODY = 156, - PACKAGE_BODY_STUB = 157, - PACKAGE_RENAMING_DECLARATION = 158, - PACKAGE_SPECIFICATION = 159, - PARAMETER_SPECIFICATION = 160, - PRIVATE_EXTENSION_DECLARATION = 161, - PRIVATE_TYPE_DECLARATION = 162, - PROTECTED_BODY = 163, - PROTECTED_BODY_STUB = 164, - PROTECTED_TYPE_DECLARATION = 165, - RAISE_STATEMENT = 166, - RANGE_ATTRIBUTE_REFERENCE = 167, - RECORD_REPRESENTATION_CLAUSE = 168, - REQUEUE_STATEMENT = 169, - RETURN_STATEMENT = 170, - SELECTIVE_ACCEPT = 171, - SEQUENCE_OF_STATEMENTS = 172, - SINGLE_PROTECTED_DECLARATION = 173, - SINGLE_TASK_DECLARATION = 174, - STATEMENT = 175, - SUBTYPE_DECLARATION = 176, - SUBTYPE_INDICATION = 177, - SUBTYPE_MARK = 178, - SUBUNIT = 179, - TASK_BODY = 180, - TASK_BODY_STUB = 181, - TASK_TYPE_DECLARATION = 182, - TERMINATE_ALTERNATIVE = 183, - TIMED_ENTRY_CALL = 184, - TRIGGERING_ALTERNATIVE = 185, - USE_CLAUSE = 186, - USE_TYPE_CLAUSE = 187, - VARIANT = 188, - VARIANT_PART = 189, - WITH_CLAUSE = 190, - ABSTRACT_FUNCTION_DECLARATION = 191, - ABSTRACT_PROCEDURE_DECLARATION = 192, - ACCESS_TO_FUNCTION_DECLARATION = 193, - ACCESS_TO_OBJECT_DECLARATION = 194, - ACCESS_TO_PROCEDURE_DECLARATION = 195, - ARRAY_OBJECT_DECLARATION = 196, - ARRAY_TYPE_DECLARATION = 197, - AND_THEN = 198, - BASIC_DECLARATIVE_ITEMS_OPT = 199, - BLOCK_BODY = 200, - BLOCK_BODY_OPT = 201, - CALL_STATEMENT = 202, - COMPONENT_CLAUSES_OPT = 203, - COMPONENT_ITEMS = 204, - COND_CLAUSE = 205, - DECIMAL_FIXED_POINT_DECLARATION = 206, - DECLARE_OPT = 207, - DERIVED_RECORD_EXTENSION = 208, - DISCRETE_SUBTYPE_DEF_OPT = 209, - DISCRIMINANT_SPECIFICATIONS = 210, - DISCRIM_PART_OPT = 211, - ELSE_OPT = 212, - ELSIFS_OPT = 213, - END_ID_OPT = 214, - ENTRY_INDEX_OPT = 215, - ENUMERATION_TYPE_DECLARATION = 216, - EXCEPT_HANDLER_PART_OPT = 217, - EXTENSION_OPT = 218, - FLOATING_POINT_DECLARATION = 219, - FORMAL_DECIMAL_FIXED_POINT_DECLARATION = 220, - FORMAL_DISCRETE_TYPE_DECLARATION = 221, - FORMAL_FLOATING_POINT_DECLARATION = 222, - FORMAL_FUNCTION_DECLARATION = 223, - FORMAL_MODULAR_TYPE_DECLARATION = 224, - FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION = 225, - FORMAL_ORDINARY_FIXED_POINT_DECLARATION = 226, - FORMAL_PART_OPT = 227, - FORMAL_PRIVATE_EXTENSION_DECLARATION = 228, - FORMAL_PRIVATE_TYPE_DECLARATION = 229, - FORMAL_PROCEDURE_DECLARATION = 230, - FORMAL_SIGNED_INTEGER_TYPE_DECLARATION = 231, - FUNCTION_BODY = 232, - FUNCTION_BODY_STUB = 233, - FUNCTION_DECLARATION = 234, - FUNCTION_RENAMING_DECLARATION = 235, - GENERIC_FUNCTION_DECLARATION = 236, - GENERIC_FUNCTION_INSTANTIATION = 237, - GENERIC_FUNCTION_RENAMING = 238, - GENERIC_PACKAGE_INSTANTIATION = 239, - GENERIC_PACKAGE_RENAMING = 240, - GENERIC_PROCEDURE_DECLARATION = 241, - GENERIC_PROCEDURE_INSTANTIATION = 242, - GENERIC_PROCEDURE_RENAMING = 243, - GUARD_OPT = 244, - IDENTIFIER_COLON_OPT = 245, - ID_OPT = 246, - INIT_OPT = 247, - ITERATION_SCHEME_OPT = 248, - LABEL_OPT = 249, - MARK_WITH_CONSTRAINT = 250, - MODIFIERS = 251, - MODULAR_TYPE_DECLARATION = 252, - MOD_CLAUSE_OPT = 253, - NOT_IN = 254, - ORDINARY_DERIVED_TYPE_DECLARATION = 255, - ORDINARY_FIXED_POINT_DECLARATION = 256, - OR_ELSE = 257, - OR_SELECT_OPT = 258, - PARENTHESIZED_PRIMARY = 259, - PRIVATE_DECLARATIVE_ITEMS_OPT = 260, - PRIVATE_TASK_ITEMS_OPT = 261, - PROCEDURE_BODY = 262, - PROCEDURE_BODY_STUB = 263, - PROCEDURE_DECLARATION = 264, - PROCEDURE_RENAMING_DECLARATION = 265, - PROT_MEMBER_DECLARATIONS = 266, - PROT_OP_BODIES_OPT = 267, - PROT_OP_DECLARATIONS = 268, - PROT_PRIVATE_OPT = 269, - RANGED_EXPRS = 270, - RANGE_CONSTRAINT = 271, - RECORD_TYPE_DECLARATION = 272, - SELECTOR_NAMES_OPT = 273, - SIGNED_INTEGER_TYPE_DECLARATION = 274, - TASK_ITEMS_OPT = 275, - UNARY_MINUS = 276, - UNARY_PLUS = 277, - VALUE = 278, - VALUES = 279, - VARIANTS = 280, - COMMENT_INTRO = 281, - OX = 282, - TIC_OR_CHARACTER_LITERAL = 283, - DIGIT = 284, - EXPONENT = 285, - EXTENDED_DIGIT = 286, - BASED_INTEGER = 287, - WS_ = 288, - COMMENT = 289, - CHARACTER_STRING = 290, - NULL_TREE_LOOKAHEAD = 3 - }; -#ifdef __cplusplus -}; -#endif -#endif /*INC_AdaStoreWalkerTokenTypes_hpp_*/ diff --git a/languages/ada/AdaTokenTypes.h b/languages/ada/AdaTokenTypes.h new file mode 100644 index 00000000..becbd205 --- /dev/null +++ b/languages/ada/AdaTokenTypes.h @@ -0,0 +1,306 @@ +#ifndef INC_AdaTokenTypes_h_ +#define INC_AdaTokenTypes_h_ + +/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaTokenTypes.h"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API AdaTokenTypes { +#endif + enum { + EOF_ = 1, + PRAGMA = 4, + IDENTIFIER = 5, + SEMI = 6, + LPAREN = 7, + COMMA = 8, + RPAREN = 9, + RIGHT_SHAFT = 10, + WITH = 11, + DOT = 12, + USE = 13, + TYPE = 14, + TIC = 15, + RANGE = 16, + DIGITS = 17, + DELTA = 18, + ACCESS = 19, + PRIVATE = 20, + PACKAGE = 21, + BODY = 22, + IS = 23, + PROCEDURE = 24, + FUNCTION = 25, + NEW = 26, + OTHERS = 27, + PIPE = 28, + DOT_DOT = 29, + ALL = 30, + COLON = 31, + IN = 32, + OUT = 33, + RENAMES = 34, + CHARACTER_LITERAL = 35, + CHAR_STRING = 36, + NuLL = 37, + RECORD = 38, + SEPARATE = 39, + ABSTRACT = 40, + RETURN = 41, + TASK = 42, + PROTECTED = 43, + BOX = 44, + ASSIGN = 45, + ENTRY = 46, + FOR = 47, + END = 48, + AT = 49, + MOD = 50, + SUBTYPE = 51, + EXCEPTION = 52, + CONSTANT = 53, + ARRAY = 54, + OF = 55, + ALIASED = 56, + CASE = 57, + WHEN = 58, + TAGGED = 59, + LIMITED = 60, + GENERIC = 61, + BEGIN = 62, + LT_LT = 63, + GT_GT = 64, + IF = 65, + THEN = 66, + ELSIF = 67, + ELSE = 68, + LOOP = 69, + WHILE = 70, + REVERSE = 71, + DECLARE = 72, + EXIT = 73, + GOTO = 74, + ACCEPT = 75, + DO = 76, + DELAY = 77, + UNTIL = 78, + SELECT = 79, + ABORT = 80, + OR = 81, + TERMINATE = 82, + RAISE = 83, + REQUEUE = 84, + AND = 85, + XOR = 86, + NOT = 87, + EQ = 88, + NE = 89, + LT_ = 90, + LE = 91, + GT = 92, + GE = 93, + PLUS = 94, + MINUS = 95, + CONCAT = 96, + STAR = 97, + DIV = 98, + REM = 99, + ABS = 100, + EXPON = 101, + NUMERIC_LIT = 102, + ABORTABLE_PART = 103, + ABORT_STATEMENT = 104, + ACCEPT_ALTERNATIVE = 105, + ACCEPT_STATEMENT = 106, + ALLOCATOR = 107, + ASSIGNMENT_STATEMENT = 108, + ASYNCHRONOUS_SELECT = 109, + ATTRIBUTE_DEFINITION_CLAUSE = 110, + AT_CLAUSE = 111, + BLOCK_STATEMENT = 112, + CASE_STATEMENT = 113, + CASE_STATEMENT_ALTERNATIVE = 114, + CODE_STATEMENT = 115, + COMPONENT_DECLARATION = 116, + CONDITIONAL_ENTRY_CALL = 117, + CONTEXT_CLAUSE = 118, + DECLARATIVE_PART = 119, + DEFINING_IDENTIFIER_LIST = 120, + DELAY_ALTERNATIVE = 121, + DELAY_STATEMENT = 122, + DELTA_CONSTRAINT = 123, + DIGITS_CONSTRAINT = 124, + DISCRIMINANT_ASSOCIATION = 125, + DISCRIMINANT_CONSTRAINT = 126, + DISCRIMINANT_SPECIFICATION = 127, + ENTRY_BODY = 128, + ENTRY_CALL_ALTERNATIVE = 129, + ENTRY_CALL_STATEMENT = 130, + ENTRY_DECLARATION = 131, + ENTRY_INDEX_SPECIFICATION = 132, + ENUMERATION_REPESENTATION_CLAUSE = 133, + EXCEPTION_DECLARATION = 134, + EXCEPTION_HANDLER = 135, + EXCEPTION_RENAMING_DECLARATION = 136, + EXIT_STATEMENT = 137, + FORMAL_PACKAGE_DECLARATION = 138, + GENERIC_FORMAL_PART = 139, + GENERIC_PACKAGE_DECLARATION = 140, + GOTO_STATEMENT = 141, + HANDLED_SEQUENCE_OF_STATEMENTS = 142, + HANDLED_STMTS_OPT = 143, + IF_STATEMENT = 144, + INCOMPLETE_TYPE_DECLARATION = 145, + INDEXED_COMPONENT = 146, + INDEX_CONSTRAINT = 147, + LIBRARY_ITEM = 148, + LOOP_STATEMENT = 149, + NAME = 150, + NULL_STATEMENT = 151, + NUMBER_DECLARATION = 152, + OBJECT_DECLARATION = 153, + OBJECT_RENAMING_DECLARATION = 154, + OPERATOR_SYMBOL = 155, + PACKAGE_BODY = 156, + PACKAGE_BODY_STUB = 157, + PACKAGE_RENAMING_DECLARATION = 158, + PACKAGE_SPECIFICATION = 159, + PARAMETER_SPECIFICATION = 160, + PRIVATE_EXTENSION_DECLARATION = 161, + PRIVATE_TYPE_DECLARATION = 162, + PROTECTED_BODY = 163, + PROTECTED_BODY_STUB = 164, + PROTECTED_TYPE_DECLARATION = 165, + RAISE_STATEMENT = 166, + RANGE_ATTRIBUTE_REFERENCE = 167, + RECORD_REPRESENTATION_CLAUSE = 168, + REQUEUE_STATEMENT = 169, + RETURN_STATEMENT = 170, + SELECTIVE_ACCEPT = 171, + SEQUENCE_OF_STATEMENTS = 172, + SINGLE_PROTECTED_DECLARATION = 173, + SINGLE_TASK_DECLARATION = 174, + STATEMENT = 175, + SUBTYPE_DECLARATION = 176, + SUBTYPE_INDICATION = 177, + SUBTYPE_MARK = 178, + SUBUNIT = 179, + TASK_BODY = 180, + TASK_BODY_STUB = 181, + TASK_TYPE_DECLARATION = 182, + TERMINATE_ALTERNATIVE = 183, + TIMED_ENTRY_CALL = 184, + TRIGGERING_ALTERNATIVE = 185, + USE_CLAUSE = 186, + USE_TYPE_CLAUSE = 187, + VARIANT = 188, + VARIANT_PART = 189, + WITH_CLAUSE = 190, + ABSTRACT_FUNCTION_DECLARATION = 191, + ABSTRACT_PROCEDURE_DECLARATION = 192, + ACCESS_TO_FUNCTION_DECLARATION = 193, + ACCESS_TO_OBJECT_DECLARATION = 194, + ACCESS_TO_PROCEDURE_DECLARATION = 195, + ARRAY_OBJECT_DECLARATION = 196, + ARRAY_TYPE_DECLARATION = 197, + AND_THEN = 198, + BASIC_DECLARATIVE_ITEMS_OPT = 199, + BLOCK_BODY = 200, + BLOCK_BODY_OPT = 201, + CALL_STATEMENT = 202, + COMPONENT_CLAUSES_OPT = 203, + COMPONENT_ITEMS = 204, + COND_CLAUSE = 205, + DECIMAL_FIXED_POINT_DECLARATION = 206, + DECLARE_OPT = 207, + DERIVED_RECORD_EXTENSION = 208, + DISCRETE_SUBTYPE_DEF_OPT = 209, + DISCRIMINANT_SPECIFICATIONS = 210, + DISCRIM_PART_OPT = 211, + ELSE_OPT = 212, + ELSIFS_OPT = 213, + END_ID_OPT = 214, + ENTRY_INDEX_OPT = 215, + ENUMERATION_TYPE_DECLARATION = 216, + EXCEPT_HANDLER_PART_OPT = 217, + EXTENSION_OPT = 218, + FLOATING_POINT_DECLARATION = 219, + FORMAL_DECIMAL_FIXED_POINT_DECLARATION = 220, + FORMAL_DISCRETE_TYPE_DECLARATION = 221, + FORMAL_FLOATING_POINT_DECLARATION = 222, + FORMAL_FUNCTION_DECLARATION = 223, + FORMAL_MODULAR_TYPE_DECLARATION = 224, + FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION = 225, + FORMAL_ORDINARY_FIXED_POINT_DECLARATION = 226, + FORMAL_PART_OPT = 227, + FORMAL_PRIVATE_EXTENSION_DECLARATION = 228, + FORMAL_PRIVATE_TYPE_DECLARATION = 229, + FORMAL_PROCEDURE_DECLARATION = 230, + FORMAL_SIGNED_INTEGER_TYPE_DECLARATION = 231, + FUNCTION_BODY = 232, + FUNCTION_BODY_STUB = 233, + FUNCTION_DECLARATION = 234, + FUNCTION_RENAMING_DECLARATION = 235, + GENERIC_FUNCTION_DECLARATION = 236, + GENERIC_FUNCTION_INSTANTIATION = 237, + GENERIC_FUNCTION_RENAMING = 238, + GENERIC_PACKAGE_INSTANTIATION = 239, + GENERIC_PACKAGE_RENAMING = 240, + GENERIC_PROCEDURE_DECLARATION = 241, + GENERIC_PROCEDURE_INSTANTIATION = 242, + GENERIC_PROCEDURE_RENAMING = 243, + GUARD_OPT = 244, + IDENTIFIER_COLON_OPT = 245, + ID_OPT = 246, + INIT_OPT = 247, + ITERATION_SCHEME_OPT = 248, + LABEL_OPT = 249, + MARK_WITH_CONSTRAINT = 250, + MODIFIERS = 251, + MODULAR_TYPE_DECLARATION = 252, + MOD_CLAUSE_OPT = 253, + NOT_IN = 254, + ORDINARY_DERIVED_TYPE_DECLARATION = 255, + ORDINARY_FIXED_POINT_DECLARATION = 256, + OR_ELSE = 257, + OR_SELECT_OPT = 258, + PARENTHESIZED_PRIMARY = 259, + PRIVATE_DECLARATIVE_ITEMS_OPT = 260, + PRIVATE_TASK_ITEMS_OPT = 261, + PROCEDURE_BODY = 262, + PROCEDURE_BODY_STUB = 263, + PROCEDURE_DECLARATION = 264, + PROCEDURE_RENAMING_DECLARATION = 265, + PROT_MEMBER_DECLARATIONS = 266, + PROT_OP_BODIES_OPT = 267, + PROT_OP_DECLARATIONS = 268, + PROT_PRIVATE_OPT = 269, + RANGED_EXPRS = 270, + RANGE_CONSTRAINT = 271, + RECORD_TYPE_DECLARATION = 272, + SELECTOR_NAMES_OPT = 273, + SIGNED_INTEGER_TYPE_DECLARATION = 274, + TASK_ITEMS_OPT = 275, + UNARY_MINUS = 276, + UNARY_PLUS = 277, + VALUE = 278, + VALUES = 279, + VARIANTS = 280, + COMMENT_INTRO = 281, + OX = 282, + TIC_OR_CHARACTER_LITERAL = 283, + DIGIT = 284, + EXPONENT = 285, + EXTENDED_DIGIT = 286, + BASED_INTEGER = 287, + WS_ = 288, + COMMENT = 289, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_AdaTokenTypes_h_*/ diff --git a/languages/ada/AdaTokenTypes.hpp b/languages/ada/AdaTokenTypes.hpp deleted file mode 100644 index 918b1cfd..00000000 --- a/languages/ada/AdaTokenTypes.hpp +++ /dev/null @@ -1,306 +0,0 @@ -#ifndef INC_AdaTokenTypes_hpp_ -#define INC_AdaTokenTypes_hpp_ - -/* $ANTLR 2.7.7 (20070609): "ada.g" -> "AdaTokenTypes.hpp"$ */ - -#ifndef CUSTOM_API -# define CUSTOM_API -#endif - -#ifdef __cplusplus -struct CUSTOM_API AdaTokenTypes { -#endif - enum { - EOF_ = 1, - PRAGMA = 4, - IDENTIFIER = 5, - SEMI = 6, - LPAREN = 7, - COMMA = 8, - RPAREN = 9, - RIGHT_SHAFT = 10, - WITH = 11, - DOT = 12, - USE = 13, - TYPE = 14, - TIC = 15, - RANGE = 16, - DIGITS = 17, - DELTA = 18, - ACCESS = 19, - PRIVATE = 20, - PACKAGE = 21, - BODY = 22, - IS = 23, - PROCEDURE = 24, - FUNCTION = 25, - NEW = 26, - OTHERS = 27, - PIPE = 28, - DOT_DOT = 29, - ALL = 30, - COLON = 31, - IN = 32, - OUT = 33, - RENAMES = 34, - CHARACTER_LITERAL = 35, - CHAR_STRING = 36, - NuLL = 37, - RECORD = 38, - SEPARATE = 39, - ABSTRACT = 40, - RETURN = 41, - TASK = 42, - PROTECTED = 43, - BOX = 44, - ASSIGN = 45, - ENTRY = 46, - FOR = 47, - END = 48, - AT = 49, - MOD = 50, - SUBTYPE = 51, - EXCEPTION = 52, - CONSTANT = 53, - ARRAY = 54, - OF = 55, - ALIASED = 56, - CASE = 57, - WHEN = 58, - TAGGED = 59, - LIMITED = 60, - GENERIC = 61, - BEGIN = 62, - LT_LT = 63, - GT_GT = 64, - IF = 65, - THEN = 66, - ELSIF = 67, - ELSE = 68, - LOOP = 69, - WHILE = 70, - REVERSE = 71, - DECLARE = 72, - EXIT = 73, - GOTO = 74, - ACCEPT = 75, - DO = 76, - DELAY = 77, - UNTIL = 78, - SELECT = 79, - ABORT = 80, - OR = 81, - TERMINATE = 82, - RAISE = 83, - REQUEUE = 84, - AND = 85, - XOR = 86, - NOT = 87, - EQ = 88, - NE = 89, - LT_ = 90, - LE = 91, - GT = 92, - GE = 93, - PLUS = 94, - MINUS = 95, - CONCAT = 96, - STAR = 97, - DIV = 98, - REM = 99, - ABS = 100, - EXPON = 101, - NUMERIC_LIT = 102, - ABORTABLE_PART = 103, - ABORT_STATEMENT = 104, - ACCEPT_ALTERNATIVE = 105, - ACCEPT_STATEMENT = 106, - ALLOCATOR = 107, - ASSIGNMENT_STATEMENT = 108, - ASYNCHRONOUS_SELECT = 109, - ATTRIBUTE_DEFINITION_CLAUSE = 110, - AT_CLAUSE = 111, - BLOCK_STATEMENT = 112, - CASE_STATEMENT = 113, - CASE_STATEMENT_ALTERNATIVE = 114, - CODE_STATEMENT = 115, - COMPONENT_DECLARATION = 116, - CONDITIONAL_ENTRY_CALL = 117, - CONTEXT_CLAUSE = 118, - DECLARATIVE_PART = 119, - DEFINING_IDENTIFIER_LIST = 120, - DELAY_ALTERNATIVE = 121, - DELAY_STATEMENT = 122, - DELTA_CONSTRAINT = 123, - DIGITS_CONSTRAINT = 124, - DISCRIMINANT_ASSOCIATION = 125, - DISCRIMINANT_CONSTRAINT = 126, - DISCRIMINANT_SPECIFICATION = 127, - ENTRY_BODY = 128, - ENTRY_CALL_ALTERNATIVE = 129, - ENTRY_CALL_STATEMENT = 130, - ENTRY_DECLARATION = 131, - ENTRY_INDEX_SPECIFICATION = 132, - ENUMERATION_REPESENTATION_CLAUSE = 133, - EXCEPTION_DECLARATION = 134, - EXCEPTION_HANDLER = 135, - EXCEPTION_RENAMING_DECLARATION = 136, - EXIT_STATEMENT = 137, - FORMAL_PACKAGE_DECLARATION = 138, - GENERIC_FORMAL_PART = 139, - GENERIC_PACKAGE_DECLARATION = 140, - GOTO_STATEMENT = 141, - HANDLED_SEQUENCE_OF_STATEMENTS = 142, - HANDLED_STMTS_OPT = 143, - IF_STATEMENT = 144, - INCOMPLETE_TYPE_DECLARATION = 145, - INDEXED_COMPONENT = 146, - INDEX_CONSTRAINT = 147, - LIBRARY_ITEM = 148, - LOOP_STATEMENT = 149, - NAME = 150, - NULL_STATEMENT = 151, - NUMBER_DECLARATION = 152, - OBJECT_DECLARATION = 153, - OBJECT_RENAMING_DECLARATION = 154, - OPERATOR_SYMBOL = 155, - PACKAGE_BODY = 156, - PACKAGE_BODY_STUB = 157, - PACKAGE_RENAMING_DECLARATION = 158, - PACKAGE_SPECIFICATION = 159, - PARAMETER_SPECIFICATION = 160, - PRIVATE_EXTENSION_DECLARATION = 161, - PRIVATE_TYPE_DECLARATION = 162, - PROTECTED_BODY = 163, - PROTECTED_BODY_STUB = 164, - PROTECTED_TYPE_DECLARATION = 165, - RAISE_STATEMENT = 166, - RANGE_ATTRIBUTE_REFERENCE = 167, - RECORD_REPRESENTATION_CLAUSE = 168, - REQUEUE_STATEMENT = 169, - RETURN_STATEMENT = 170, - SELECTIVE_ACCEPT = 171, - SEQUENCE_OF_STATEMENTS = 172, - SINGLE_PROTECTED_DECLARATION = 173, - SINGLE_TASK_DECLARATION = 174, - STATEMENT = 175, - SUBTYPE_DECLARATION = 176, - SUBTYPE_INDICATION = 177, - SUBTYPE_MARK = 178, - SUBUNIT = 179, - TASK_BODY = 180, - TASK_BODY_STUB = 181, - TASK_TYPE_DECLARATION = 182, - TERMINATE_ALTERNATIVE = 183, - TIMED_ENTRY_CALL = 184, - TRIGGERING_ALTERNATIVE = 185, - USE_CLAUSE = 186, - USE_TYPE_CLAUSE = 187, - VARIANT = 188, - VARIANT_PART = 189, - WITH_CLAUSE = 190, - ABSTRACT_FUNCTION_DECLARATION = 191, - ABSTRACT_PROCEDURE_DECLARATION = 192, - ACCESS_TO_FUNCTION_DECLARATION = 193, - ACCESS_TO_OBJECT_DECLARATION = 194, - ACCESS_TO_PROCEDURE_DECLARATION = 195, - ARRAY_OBJECT_DECLARATION = 196, - ARRAY_TYPE_DECLARATION = 197, - AND_THEN = 198, - BASIC_DECLARATIVE_ITEMS_OPT = 199, - BLOCK_BODY = 200, - BLOCK_BODY_OPT = 201, - CALL_STATEMENT = 202, - COMPONENT_CLAUSES_OPT = 203, - COMPONENT_ITEMS = 204, - COND_CLAUSE = 205, - DECIMAL_FIXED_POINT_DECLARATION = 206, - DECLARE_OPT = 207, - DERIVED_RECORD_EXTENSION = 208, - DISCRETE_SUBTYPE_DEF_OPT = 209, - DISCRIMINANT_SPECIFICATIONS = 210, - DISCRIM_PART_OPT = 211, - ELSE_OPT = 212, - ELSIFS_OPT = 213, - END_ID_OPT = 214, - ENTRY_INDEX_OPT = 215, - ENUMERATION_TYPE_DECLARATION = 216, - EXCEPT_HANDLER_PART_OPT = 217, - EXTENSION_OPT = 218, - FLOATING_POINT_DECLARATION = 219, - FORMAL_DECIMAL_FIXED_POINT_DECLARATION = 220, - FORMAL_DISCRETE_TYPE_DECLARATION = 221, - FORMAL_FLOATING_POINT_DECLARATION = 222, - FORMAL_FUNCTION_DECLARATION = 223, - FORMAL_MODULAR_TYPE_DECLARATION = 224, - FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION = 225, - FORMAL_ORDINARY_FIXED_POINT_DECLARATION = 226, - FORMAL_PART_OPT = 227, - FORMAL_PRIVATE_EXTENSION_DECLARATION = 228, - FORMAL_PRIVATE_TYPE_DECLARATION = 229, - FORMAL_PROCEDURE_DECLARATION = 230, - FORMAL_SIGNED_INTEGER_TYPE_DECLARATION = 231, - FUNCTION_BODY = 232, - FUNCTION_BODY_STUB = 233, - FUNCTION_DECLARATION = 234, - FUNCTION_RENAMING_DECLARATION = 235, - GENERIC_FUNCTION_DECLARATION = 236, - GENERIC_FUNCTION_INSTANTIATION = 237, - GENERIC_FUNCTION_RENAMING = 238, - GENERIC_PACKAGE_INSTANTIATION = 239, - GENERIC_PACKAGE_RENAMING = 240, - GENERIC_PROCEDURE_DECLARATION = 241, - GENERIC_PROCEDURE_INSTANTIATION = 242, - GENERIC_PROCEDURE_RENAMING = 243, - GUARD_OPT = 244, - IDENTIFIER_COLON_OPT = 245, - ID_OPT = 246, - INIT_OPT = 247, - ITERATION_SCHEME_OPT = 248, - LABEL_OPT = 249, - MARK_WITH_CONSTRAINT = 250, - MODIFIERS = 251, - MODULAR_TYPE_DECLARATION = 252, - MOD_CLAUSE_OPT = 253, - NOT_IN = 254, - ORDINARY_DERIVED_TYPE_DECLARATION = 255, - ORDINARY_FIXED_POINT_DECLARATION = 256, - OR_ELSE = 257, - OR_SELECT_OPT = 258, - PARENTHESIZED_PRIMARY = 259, - PRIVATE_DECLARATIVE_ITEMS_OPT = 260, - PRIVATE_TASK_ITEMS_OPT = 261, - PROCEDURE_BODY = 262, - PROCEDURE_BODY_STUB = 263, - PROCEDURE_DECLARATION = 264, - PROCEDURE_RENAMING_DECLARATION = 265, - PROT_MEMBER_DECLARATIONS = 266, - PROT_OP_BODIES_OPT = 267, - PROT_OP_DECLARATIONS = 268, - PROT_PRIVATE_OPT = 269, - RANGED_EXPRS = 270, - RANGE_CONSTRAINT = 271, - RECORD_TYPE_DECLARATION = 272, - SELECTOR_NAMES_OPT = 273, - SIGNED_INTEGER_TYPE_DECLARATION = 274, - TASK_ITEMS_OPT = 275, - UNARY_MINUS = 276, - UNARY_PLUS = 277, - VALUE = 278, - VALUES = 279, - VARIANTS = 280, - COMMENT_INTRO = 281, - OX = 282, - TIC_OR_CHARACTER_LITERAL = 283, - DIGIT = 284, - EXPONENT = 285, - EXTENDED_DIGIT = 286, - BASED_INTEGER = 287, - WS_ = 288, - COMMENT = 289, - NULL_TREE_LOOKAHEAD = 3 - }; -#ifdef __cplusplus -}; -#endif -#endif /*INC_AdaTokenTypes_hpp_*/ diff --git a/languages/ada/AdaTreeParserSuper.cpp b/languages/ada/AdaTreeParserSuper.cpp index be5f0623..16e95182 100644 --- a/languages/ada/AdaTreeParserSuper.cpp +++ b/languages/ada/AdaTreeParserSuper.cpp @@ -1,11 +1,11 @@ /* $ANTLR 2.7.7 (20070609): "ada.tree.g" -> "AdaTreeParserSuper.cpp"$ */ -#include "AdaTreeParserSuper.hpp" -#include -#include -#include -#include -#include -#include +#include "AdaTreeParserSuper.h" +#include +#include +#include +#include +#include +#include #line 1 "ada.tree.g" #line 11 "AdaTreeParserSuper.cpp" AdaTreeParserSuper::AdaTreeParserSuper() diff --git a/languages/ada/AdaTreeParserSuper.h b/languages/ada/AdaTreeParserSuper.h new file mode 100644 index 00000000..cb35ac25 --- /dev/null +++ b/languages/ada/AdaTreeParserSuper.h @@ -0,0 +1,241 @@ +#ifndef INC_AdaTreeParserSuper_h_ +#define INC_AdaTreeParserSuper_h_ + +#include +#include "AdaTreeParserSuperTokenTypes.h" +/* $ANTLR 2.7.7 (20070609): "ada.tree.g" -> "AdaTreeParserSuper.h"$ */ +#include + +class CUSTOM_API AdaTreeParserSuper : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public AdaTreeParserSuperTokenTypes +{ +#line 1 "ada.tree.g" +#line 13 "AdaTreeParserSuper.h" +public: + AdaTreeParserSuper(); + static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); + int getNumTokens() const + { + return AdaTreeParserSuper::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return AdaTreeParserSuper::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return AdaTreeParserSuper::tokenNames; + } + public: void compilation_unit(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void context_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void library_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subunit(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void pragma(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void pragma_arg(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void expression(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void with_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void use_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void compound_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subtype_mark(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void attribute_id(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void modifiers(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprog_decl_or_rename_or_inst_or_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void def_id(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void pkg_body_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void generic_inst(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void pkg_spec_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void renames(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void generic_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void id_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void def_designator(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void end_id_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprog_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void formal_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void function_tail(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void value_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void value(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void ranged_expr_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void ranged_expr(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void simple_expression(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_dots(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_attrib_ref(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prefix(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void parameter_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void defining_identifier_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void init_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void definable_operator_symbol(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void parenthesized_primary(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void extension_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void spec_decl_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void basic_declarative_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void private_declarative_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void basic_decl_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void task_type_or_single_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_type_or_single_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void decl_common(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrim_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void task_definition_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void task_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void private_task_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_specifications(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entrydecls_repspecs_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void rep_spec(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrete_subtype_def_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrete_subtype_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subtype_ind(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void align_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void comp_loc_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void local_enum_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void enumeration_aggregate(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void protected_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_private_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_member_decl_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_op_decl_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_op_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void comp_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void component_subtype_def(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void enum_id_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_constraint_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void array_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void access_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void id_and_discrim(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void record_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void array_type_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void enumeration_literal_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void index_or_discrete_range_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void index_or_discrete_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void constraint_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void digits_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void delta_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void index_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrete_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_association(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void selector_names_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void selector_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void component_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void component_items(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void variant_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discriminant_direct_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void variant_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void variant(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void choice_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void choice(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void discrete_with_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void mark_with_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void generic_formal_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void generic_formal_parameter(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void formal_array_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void formal_access_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void id_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprogram_default_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void formal_package_actual_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void procedure_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void function_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void body_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void declarative_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void block_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void declarative_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void prot_op_bodies_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void block_body_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void handled_stmt_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprog_decl_or_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void except_handler_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void handled_stmts_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void statement(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void def_label_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void null_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void exit_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void return_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void goto_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void delay_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void abort_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void raise_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void requeue_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void accept_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void select_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void if_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void case_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void loop_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void block(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void call_or_assignment(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void cond_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void elsifs_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void else_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void condition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void alternative_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void case_statement_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void iteration_scheme_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void declare_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void label_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_body_formal_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_barrier(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_index_spec_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_call_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_index_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void triggering_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void abortable_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void selective_accept(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void entry_call_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void delay_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void stmts_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void guard_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void select_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void or_select_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void accept_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void exception_handler(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void identifier_colon_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void except_choice_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void exception_choice(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void operator_call(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void relation(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void range_or_mark(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void signed_term(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void term(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void factor(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void primary(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void name_or_qualified(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void allocator(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void subprogram_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void package_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void task_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); + public: void protected_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return returnAST; + } + +protected: + ANTLR_USE_NAMESPACE(antlr)RefAST returnAST; + ANTLR_USE_NAMESPACE(antlr)RefAST _retTree; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 291; +#else + enum { + NUM_TOKENS = 291 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; +}; + +#endif /*INC_AdaTreeParserSuper_h_*/ diff --git a/languages/ada/AdaTreeParserSuper.hpp b/languages/ada/AdaTreeParserSuper.hpp deleted file mode 100644 index a4d164f0..00000000 --- a/languages/ada/AdaTreeParserSuper.hpp +++ /dev/null @@ -1,241 +0,0 @@ -#ifndef INC_AdaTreeParserSuper_hpp_ -#define INC_AdaTreeParserSuper_hpp_ - -#include -#include "AdaTreeParserSuperTokenTypes.hpp" -/* $ANTLR 2.7.7 (20070609): "ada.tree.g" -> "AdaTreeParserSuper.hpp"$ */ -#include - -class CUSTOM_API AdaTreeParserSuper : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public AdaTreeParserSuperTokenTypes -{ -#line 1 "ada.tree.g" -#line 13 "AdaTreeParserSuper.hpp" -public: - AdaTreeParserSuper(); - static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); - int getNumTokens() const - { - return AdaTreeParserSuper::NUM_TOKENS; - } - const char* getTokenName( int type ) const - { - if( type > getNumTokens() ) return 0; - return AdaTreeParserSuper::tokenNames[type]; - } - const char* const* getTokenNames() const - { - return AdaTreeParserSuper::tokenNames; - } - public: void compilation_unit(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void context_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void library_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void subunit(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void pragma(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void pragma_arg(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void expression(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void with_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void use_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void compound_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void subtype_mark(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void attribute_id(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void modifiers(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void subprog_decl_or_rename_or_inst_or_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void def_id(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void pkg_body_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void generic_inst(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void pkg_spec_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void renames(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void generic_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void id_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void def_designator(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void end_id_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void subprog_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void formal_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void function_tail(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void value_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void value(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void ranged_expr_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void ranged_expr(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void simple_expression(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void range_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void range_dots(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void range_attrib_ref(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void prefix(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void parameter_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void defining_identifier_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void init_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void definable_operator_symbol(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void parenthesized_primary(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void extension_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void spec_decl_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void basic_declarative_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void private_declarative_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void basic_decl_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void task_type_or_single_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void prot_type_or_single_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void decl_common(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discrim_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void task_definition_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void task_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void private_task_items_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discriminant_specifications(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discriminant_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void entrydecls_repspecs_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void entry_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void rep_spec(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discrete_subtype_def_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discrete_subtype_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void subtype_ind(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void align_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void comp_loc_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void local_enum_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void enumeration_aggregate(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void protected_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void prot_private_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void prot_member_decl_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void prot_op_decl_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void prot_op_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void comp_decl(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void component_subtype_def(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void enum_id_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void range_constraint_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void array_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void access_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void id_and_discrim(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void record_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void array_type_definition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void enumeration_literal_specification(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void index_or_discrete_range_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void index_or_discrete_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void constraint_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void digits_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void delta_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void index_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discriminant_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discrete_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discriminant_association(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void selector_names_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void selector_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void component_list(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void component_items(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void variant_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discriminant_direct_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void variant_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void variant(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void choice_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void choice(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void discrete_with_range(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void mark_with_constraint(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void generic_formal_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void generic_formal_parameter(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void formal_array_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void formal_access_type_declaration(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void id_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void subprogram_default_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void formal_package_actual_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void procedure_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void function_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void body_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void declarative_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void block_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void declarative_item(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void prot_op_bodies_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void block_body_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void handled_stmt_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void entry_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void subprog_decl_or_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void statements(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void except_handler_part_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void handled_stmts_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void statement(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void def_label_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void null_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void exit_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void return_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void goto_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void delay_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void abort_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void raise_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void requeue_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void accept_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void select_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void if_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void case_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void loop_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void block(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void call_or_assignment(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void cond_clause(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void elsifs_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void else_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void condition(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void alternative_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void case_statement_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void iteration_scheme_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void declare_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void label_name(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void entry_body_formal_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void entry_barrier(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void entry_index_spec_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void entry_call_stmt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void entry_index_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void triggering_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void abortable_part(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void selective_accept(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void entry_call_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void delay_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void stmts_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void guard_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void select_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void or_select_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void accept_alternative(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void exception_handler(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void identifier_colon_opt(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void except_choice_s(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void exception_choice(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void operator_call(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void relation(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void range_or_mark(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void signed_term(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void term(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void factor(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void primary(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void name_or_qualified(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void allocator(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void subprogram_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void package_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void task_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); - public: void protected_body(ANTLR_USE_NAMESPACE(antlr)RefAST _t); -public: - ANTLR_USE_NAMESPACE(antlr)RefAST getAST() - { - return returnAST; - } - -protected: - ANTLR_USE_NAMESPACE(antlr)RefAST returnAST; - ANTLR_USE_NAMESPACE(antlr)RefAST _retTree; -private: - static const char* tokenNames[]; -#ifndef NO_STATIC_CONSTS - static const int NUM_TOKENS = 291; -#else - enum { - NUM_TOKENS = 291 - }; -#endif - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; - static const unsigned long _tokenSet_4_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; -}; - -#endif /*INC_AdaTreeParserSuper_hpp_*/ diff --git a/languages/ada/AdaTreeParserSuperTokenTypes.h b/languages/ada/AdaTreeParserSuperTokenTypes.h new file mode 100644 index 00000000..f6f75893 --- /dev/null +++ b/languages/ada/AdaTreeParserSuperTokenTypes.h @@ -0,0 +1,307 @@ +#ifndef INC_AdaTreeParserSuperTokenTypes_h_ +#define INC_AdaTreeParserSuperTokenTypes_h_ + +/* $ANTLR 2.7.7 (20070609): "ada.tree.g" -> "AdaTreeParserSuperTokenTypes.h"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API AdaTreeParserSuperTokenTypes { +#endif + enum { + EOF_ = 1, + PRAGMA = 4, + IDENTIFIER = 5, + SEMI = 6, + LPAREN = 7, + COMMA = 8, + RPAREN = 9, + RIGHT_SHAFT = 10, + WITH = 11, + DOT = 12, + USE = 13, + TYPE = 14, + TIC = 15, + RANGE = 16, + DIGITS = 17, + DELTA = 18, + ACCESS = 19, + PRIVATE = 20, + PACKAGE = 21, + BODY = 22, + IS = 23, + PROCEDURE = 24, + FUNCTION = 25, + NEW = 26, + OTHERS = 27, + PIPE = 28, + DOT_DOT = 29, + ALL = 30, + COLON = 31, + IN = 32, + OUT = 33, + RENAMES = 34, + CHARACTER_LITERAL = 35, + CHAR_STRING = 36, + NuLL = 37, + RECORD = 38, + SEPARATE = 39, + ABSTRACT = 40, + RETURN = 41, + TASK = 42, + PROTECTED = 43, + BOX = 44, + ASSIGN = 45, + ENTRY = 46, + FOR = 47, + END = 48, + AT = 49, + MOD = 50, + SUBTYPE = 51, + EXCEPTION = 52, + CONSTANT = 53, + ARRAY = 54, + OF = 55, + ALIASED = 56, + CASE = 57, + WHEN = 58, + TAGGED = 59, + LIMITED = 60, + GENERIC = 61, + BEGIN = 62, + LT_LT = 63, + GT_GT = 64, + IF = 65, + THEN = 66, + ELSIF = 67, + ELSE = 68, + LOOP = 69, + WHILE = 70, + REVERSE = 71, + DECLARE = 72, + EXIT = 73, + GOTO = 74, + ACCEPT = 75, + DO = 76, + DELAY = 77, + UNTIL = 78, + SELECT = 79, + ABORT = 80, + OR = 81, + TERMINATE = 82, + RAISE = 83, + REQUEUE = 84, + AND = 85, + XOR = 86, + NOT = 87, + EQ = 88, + NE = 89, + LT_ = 90, + LE = 91, + GT = 92, + GE = 93, + PLUS = 94, + MINUS = 95, + CONCAT = 96, + STAR = 97, + DIV = 98, + REM = 99, + ABS = 100, + EXPON = 101, + NUMERIC_LIT = 102, + ABORTABLE_PART = 103, + ABORT_STATEMENT = 104, + ACCEPT_ALTERNATIVE = 105, + ACCEPT_STATEMENT = 106, + ALLOCATOR = 107, + ASSIGNMENT_STATEMENT = 108, + ASYNCHRONOUS_SELECT = 109, + ATTRIBUTE_DEFINITION_CLAUSE = 110, + AT_CLAUSE = 111, + BLOCK_STATEMENT = 112, + CASE_STATEMENT = 113, + CASE_STATEMENT_ALTERNATIVE = 114, + CODE_STATEMENT = 115, + COMPONENT_DECLARATION = 116, + CONDITIONAL_ENTRY_CALL = 117, + CONTEXT_CLAUSE = 118, + DECLARATIVE_PART = 119, + DEFINING_IDENTIFIER_LIST = 120, + DELAY_ALTERNATIVE = 121, + DELAY_STATEMENT = 122, + DELTA_CONSTRAINT = 123, + DIGITS_CONSTRAINT = 124, + DISCRIMINANT_ASSOCIATION = 125, + DISCRIMINANT_CONSTRAINT = 126, + DISCRIMINANT_SPECIFICATION = 127, + ENTRY_BODY = 128, + ENTRY_CALL_ALTERNATIVE = 129, + ENTRY_CALL_STATEMENT = 130, + ENTRY_DECLARATION = 131, + ENTRY_INDEX_SPECIFICATION = 132, + ENUMERATION_REPESENTATION_CLAUSE = 133, + EXCEPTION_DECLARATION = 134, + EXCEPTION_HANDLER = 135, + EXCEPTION_RENAMING_DECLARATION = 136, + EXIT_STATEMENT = 137, + FORMAL_PACKAGE_DECLARATION = 138, + GENERIC_FORMAL_PART = 139, + GENERIC_PACKAGE_DECLARATION = 140, + GOTO_STATEMENT = 141, + HANDLED_SEQUENCE_OF_STATEMENTS = 142, + HANDLED_STMTS_OPT = 143, + IF_STATEMENT = 144, + INCOMPLETE_TYPE_DECLARATION = 145, + INDEXED_COMPONENT = 146, + INDEX_CONSTRAINT = 147, + LIBRARY_ITEM = 148, + LOOP_STATEMENT = 149, + NAME = 150, + NULL_STATEMENT = 151, + NUMBER_DECLARATION = 152, + OBJECT_DECLARATION = 153, + OBJECT_RENAMING_DECLARATION = 154, + OPERATOR_SYMBOL = 155, + PACKAGE_BODY = 156, + PACKAGE_BODY_STUB = 157, + PACKAGE_RENAMING_DECLARATION = 158, + PACKAGE_SPECIFICATION = 159, + PARAMETER_SPECIFICATION = 160, + PRIVATE_EXTENSION_DECLARATION = 161, + PRIVATE_TYPE_DECLARATION = 162, + PROTECTED_BODY = 163, + PROTECTED_BODY_STUB = 164, + PROTECTED_TYPE_DECLARATION = 165, + RAISE_STATEMENT = 166, + RANGE_ATTRIBUTE_REFERENCE = 167, + RECORD_REPRESENTATION_CLAUSE = 168, + REQUEUE_STATEMENT = 169, + RETURN_STATEMENT = 170, + SELECTIVE_ACCEPT = 171, + SEQUENCE_OF_STATEMENTS = 172, + SINGLE_PROTECTED_DECLARATION = 173, + SINGLE_TASK_DECLARATION = 174, + STATEMENT = 175, + SUBTYPE_DECLARATION = 176, + SUBTYPE_INDICATION = 177, + SUBTYPE_MARK = 178, + SUBUNIT = 179, + TASK_BODY = 180, + TASK_BODY_STUB = 181, + TASK_TYPE_DECLARATION = 182, + TERMINATE_ALTERNATIVE = 183, + TIMED_ENTRY_CALL = 184, + TRIGGERING_ALTERNATIVE = 185, + USE_CLAUSE = 186, + USE_TYPE_CLAUSE = 187, + VARIANT = 188, + VARIANT_PART = 189, + WITH_CLAUSE = 190, + ABSTRACT_FUNCTION_DECLARATION = 191, + ABSTRACT_PROCEDURE_DECLARATION = 192, + ACCESS_TO_FUNCTION_DECLARATION = 193, + ACCESS_TO_OBJECT_DECLARATION = 194, + ACCESS_TO_PROCEDURE_DECLARATION = 195, + ARRAY_OBJECT_DECLARATION = 196, + ARRAY_TYPE_DECLARATION = 197, + AND_THEN = 198, + BASIC_DECLARATIVE_ITEMS_OPT = 199, + BLOCK_BODY = 200, + BLOCK_BODY_OPT = 201, + CALL_STATEMENT = 202, + COMPONENT_CLAUSES_OPT = 203, + COMPONENT_ITEMS = 204, + COND_CLAUSE = 205, + DECIMAL_FIXED_POINT_DECLARATION = 206, + DECLARE_OPT = 207, + DERIVED_RECORD_EXTENSION = 208, + DISCRETE_SUBTYPE_DEF_OPT = 209, + DISCRIMINANT_SPECIFICATIONS = 210, + DISCRIM_PART_OPT = 211, + ELSE_OPT = 212, + ELSIFS_OPT = 213, + END_ID_OPT = 214, + ENTRY_INDEX_OPT = 215, + ENUMERATION_TYPE_DECLARATION = 216, + EXCEPT_HANDLER_PART_OPT = 217, + EXTENSION_OPT = 218, + FLOATING_POINT_DECLARATION = 219, + FORMAL_DECIMAL_FIXED_POINT_DECLARATION = 220, + FORMAL_DISCRETE_TYPE_DECLARATION = 221, + FORMAL_FLOATING_POINT_DECLARATION = 222, + FORMAL_FUNCTION_DECLARATION = 223, + FORMAL_MODULAR_TYPE_DECLARATION = 224, + FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION = 225, + FORMAL_ORDINARY_FIXED_POINT_DECLARATION = 226, + FORMAL_PART_OPT = 227, + FORMAL_PRIVATE_EXTENSION_DECLARATION = 228, + FORMAL_PRIVATE_TYPE_DECLARATION = 229, + FORMAL_PROCEDURE_DECLARATION = 230, + FORMAL_SIGNED_INTEGER_TYPE_DECLARATION = 231, + FUNCTION_BODY = 232, + FUNCTION_BODY_STUB = 233, + FUNCTION_DECLARATION = 234, + FUNCTION_RENAMING_DECLARATION = 235, + GENERIC_FUNCTION_DECLARATION = 236, + GENERIC_FUNCTION_INSTANTIATION = 237, + GENERIC_FUNCTION_RENAMING = 238, + GENERIC_PACKAGE_INSTANTIATION = 239, + GENERIC_PACKAGE_RENAMING = 240, + GENERIC_PROCEDURE_DECLARATION = 241, + GENERIC_PROCEDURE_INSTANTIATION = 242, + GENERIC_PROCEDURE_RENAMING = 243, + GUARD_OPT = 244, + IDENTIFIER_COLON_OPT = 245, + ID_OPT = 246, + INIT_OPT = 247, + ITERATION_SCHEME_OPT = 248, + LABEL_OPT = 249, + MARK_WITH_CONSTRAINT = 250, + MODIFIERS = 251, + MODULAR_TYPE_DECLARATION = 252, + MOD_CLAUSE_OPT = 253, + NOT_IN = 254, + ORDINARY_DERIVED_TYPE_DECLARATION = 255, + ORDINARY_FIXED_POINT_DECLARATION = 256, + OR_ELSE = 257, + OR_SELECT_OPT = 258, + PARENTHESIZED_PRIMARY = 259, + PRIVATE_DECLARATIVE_ITEMS_OPT = 260, + PRIVATE_TASK_ITEMS_OPT = 261, + PROCEDURE_BODY = 262, + PROCEDURE_BODY_STUB = 263, + PROCEDURE_DECLARATION = 264, + PROCEDURE_RENAMING_DECLARATION = 265, + PROT_MEMBER_DECLARATIONS = 266, + PROT_OP_BODIES_OPT = 267, + PROT_OP_DECLARATIONS = 268, + PROT_PRIVATE_OPT = 269, + RANGED_EXPRS = 270, + RANGE_CONSTRAINT = 271, + RECORD_TYPE_DECLARATION = 272, + SELECTOR_NAMES_OPT = 273, + SIGNED_INTEGER_TYPE_DECLARATION = 274, + TASK_ITEMS_OPT = 275, + UNARY_MINUS = 276, + UNARY_PLUS = 277, + VALUE = 278, + VALUES = 279, + VARIANTS = 280, + COMMENT_INTRO = 281, + OX = 282, + TIC_OR_CHARACTER_LITERAL = 283, + DIGIT = 284, + EXPONENT = 285, + EXTENDED_DIGIT = 286, + BASED_INTEGER = 287, + WS_ = 288, + COMMENT = 289, + CHARACTER_STRING = 290, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_AdaTreeParserSuperTokenTypes_h_*/ diff --git a/languages/ada/AdaTreeParserSuperTokenTypes.hpp b/languages/ada/AdaTreeParserSuperTokenTypes.hpp deleted file mode 100644 index 924b7415..00000000 --- a/languages/ada/AdaTreeParserSuperTokenTypes.hpp +++ /dev/null @@ -1,307 +0,0 @@ -#ifndef INC_AdaTreeParserSuperTokenTypes_hpp_ -#define INC_AdaTreeParserSuperTokenTypes_hpp_ - -/* $ANTLR 2.7.7 (20070609): "ada.tree.g" -> "AdaTreeParserSuperTokenTypes.hpp"$ */ - -#ifndef CUSTOM_API -# define CUSTOM_API -#endif - -#ifdef __cplusplus -struct CUSTOM_API AdaTreeParserSuperTokenTypes { -#endif - enum { - EOF_ = 1, - PRAGMA = 4, - IDENTIFIER = 5, - SEMI = 6, - LPAREN = 7, - COMMA = 8, - RPAREN = 9, - RIGHT_SHAFT = 10, - WITH = 11, - DOT = 12, - USE = 13, - TYPE = 14, - TIC = 15, - RANGE = 16, - DIGITS = 17, - DELTA = 18, - ACCESS = 19, - PRIVATE = 20, - PACKAGE = 21, - BODY = 22, - IS = 23, - PROCEDURE = 24, - FUNCTION = 25, - NEW = 26, - OTHERS = 27, - PIPE = 28, - DOT_DOT = 29, - ALL = 30, - COLON = 31, - IN = 32, - OUT = 33, - RENAMES = 34, - CHARACTER_LITERAL = 35, - CHAR_STRING = 36, - NuLL = 37, - RECORD = 38, - SEPARATE = 39, - ABSTRACT = 40, - RETURN = 41, - TASK = 42, - PROTECTED = 43, - BOX = 44, - ASSIGN = 45, - ENTRY = 46, - FOR = 47, - END = 48, - AT = 49, - MOD = 50, - SUBTYPE = 51, - EXCEPTION = 52, - CONSTANT = 53, - ARRAY = 54, - OF = 55, - ALIASED = 56, - CASE = 57, - WHEN = 58, - TAGGED = 59, - LIMITED = 60, - GENERIC = 61, - BEGIN = 62, - LT_LT = 63, - GT_GT = 64, - IF = 65, - THEN = 66, - ELSIF = 67, - ELSE = 68, - LOOP = 69, - WHILE = 70, - REVERSE = 71, - DECLARE = 72, - EXIT = 73, - GOTO = 74, - ACCEPT = 75, - DO = 76, - DELAY = 77, - UNTIL = 78, - SELECT = 79, - ABORT = 80, - OR = 81, - TERMINATE = 82, - RAISE = 83, - REQUEUE = 84, - AND = 85, - XOR = 86, - NOT = 87, - EQ = 88, - NE = 89, - LT_ = 90, - LE = 91, - GT = 92, - GE = 93, - PLUS = 94, - MINUS = 95, - CONCAT = 96, - STAR = 97, - DIV = 98, - REM = 99, - ABS = 100, - EXPON = 101, - NUMERIC_LIT = 102, - ABORTABLE_PART = 103, - ABORT_STATEMENT = 104, - ACCEPT_ALTERNATIVE = 105, - ACCEPT_STATEMENT = 106, - ALLOCATOR = 107, - ASSIGNMENT_STATEMENT = 108, - ASYNCHRONOUS_SELECT = 109, - ATTRIBUTE_DEFINITION_CLAUSE = 110, - AT_CLAUSE = 111, - BLOCK_STATEMENT = 112, - CASE_STATEMENT = 113, - CASE_STATEMENT_ALTERNATIVE = 114, - CODE_STATEMENT = 115, - COMPONENT_DECLARATION = 116, - CONDITIONAL_ENTRY_CALL = 117, - CONTEXT_CLAUSE = 118, - DECLARATIVE_PART = 119, - DEFINING_IDENTIFIER_LIST = 120, - DELAY_ALTERNATIVE = 121, - DELAY_STATEMENT = 122, - DELTA_CONSTRAINT = 123, - DIGITS_CONSTRAINT = 124, - DISCRIMINANT_ASSOCIATION = 125, - DISCRIMINANT_CONSTRAINT = 126, - DISCRIMINANT_SPECIFICATION = 127, - ENTRY_BODY = 128, - ENTRY_CALL_ALTERNATIVE = 129, - ENTRY_CALL_STATEMENT = 130, - ENTRY_DECLARATION = 131, - ENTRY_INDEX_SPECIFICATION = 132, - ENUMERATION_REPESENTATION_CLAUSE = 133, - EXCEPTION_DECLARATION = 134, - EXCEPTION_HANDLER = 135, - EXCEPTION_RENAMING_DECLARATION = 136, - EXIT_STATEMENT = 137, - FORMAL_PACKAGE_DECLARATION = 138, - GENERIC_FORMAL_PART = 139, - GENERIC_PACKAGE_DECLARATION = 140, - GOTO_STATEMENT = 141, - HANDLED_SEQUENCE_OF_STATEMENTS = 142, - HANDLED_STMTS_OPT = 143, - IF_STATEMENT = 144, - INCOMPLETE_TYPE_DECLARATION = 145, - INDEXED_COMPONENT = 146, - INDEX_CONSTRAINT = 147, - LIBRARY_ITEM = 148, - LOOP_STATEMENT = 149, - NAME = 150, - NULL_STATEMENT = 151, - NUMBER_DECLARATION = 152, - OBJECT_DECLARATION = 153, - OBJECT_RENAMING_DECLARATION = 154, - OPERATOR_SYMBOL = 155, - PACKAGE_BODY = 156, - PACKAGE_BODY_STUB = 157, - PACKAGE_RENAMING_DECLARATION = 158, - PACKAGE_SPECIFICATION = 159, - PARAMETER_SPECIFICATION = 160, - PRIVATE_EXTENSION_DECLARATION = 161, - PRIVATE_TYPE_DECLARATION = 162, - PROTECTED_BODY = 163, - PROTECTED_BODY_STUB = 164, - PROTECTED_TYPE_DECLARATION = 165, - RAISE_STATEMENT = 166, - RANGE_ATTRIBUTE_REFERENCE = 167, - RECORD_REPRESENTATION_CLAUSE = 168, - REQUEUE_STATEMENT = 169, - RETURN_STATEMENT = 170, - SELECTIVE_ACCEPT = 171, - SEQUENCE_OF_STATEMENTS = 172, - SINGLE_PROTECTED_DECLARATION = 173, - SINGLE_TASK_DECLARATION = 174, - STATEMENT = 175, - SUBTYPE_DECLARATION = 176, - SUBTYPE_INDICATION = 177, - SUBTYPE_MARK = 178, - SUBUNIT = 179, - TASK_BODY = 180, - TASK_BODY_STUB = 181, - TASK_TYPE_DECLARATION = 182, - TERMINATE_ALTERNATIVE = 183, - TIMED_ENTRY_CALL = 184, - TRIGGERING_ALTERNATIVE = 185, - USE_CLAUSE = 186, - USE_TYPE_CLAUSE = 187, - VARIANT = 188, - VARIANT_PART = 189, - WITH_CLAUSE = 190, - ABSTRACT_FUNCTION_DECLARATION = 191, - ABSTRACT_PROCEDURE_DECLARATION = 192, - ACCESS_TO_FUNCTION_DECLARATION = 193, - ACCESS_TO_OBJECT_DECLARATION = 194, - ACCESS_TO_PROCEDURE_DECLARATION = 195, - ARRAY_OBJECT_DECLARATION = 196, - ARRAY_TYPE_DECLARATION = 197, - AND_THEN = 198, - BASIC_DECLARATIVE_ITEMS_OPT = 199, - BLOCK_BODY = 200, - BLOCK_BODY_OPT = 201, - CALL_STATEMENT = 202, - COMPONENT_CLAUSES_OPT = 203, - COMPONENT_ITEMS = 204, - COND_CLAUSE = 205, - DECIMAL_FIXED_POINT_DECLARATION = 206, - DECLARE_OPT = 207, - DERIVED_RECORD_EXTENSION = 208, - DISCRETE_SUBTYPE_DEF_OPT = 209, - DISCRIMINANT_SPECIFICATIONS = 210, - DISCRIM_PART_OPT = 211, - ELSE_OPT = 212, - ELSIFS_OPT = 213, - END_ID_OPT = 214, - ENTRY_INDEX_OPT = 215, - ENUMERATION_TYPE_DECLARATION = 216, - EXCEPT_HANDLER_PART_OPT = 217, - EXTENSION_OPT = 218, - FLOATING_POINT_DECLARATION = 219, - FORMAL_DECIMAL_FIXED_POINT_DECLARATION = 220, - FORMAL_DISCRETE_TYPE_DECLARATION = 221, - FORMAL_FLOATING_POINT_DECLARATION = 222, - FORMAL_FUNCTION_DECLARATION = 223, - FORMAL_MODULAR_TYPE_DECLARATION = 224, - FORMAL_ORDINARY_DERIVED_TYPE_DECLARATION = 225, - FORMAL_ORDINARY_FIXED_POINT_DECLARATION = 226, - FORMAL_PART_OPT = 227, - FORMAL_PRIVATE_EXTENSION_DECLARATION = 228, - FORMAL_PRIVATE_TYPE_DECLARATION = 229, - FORMAL_PROCEDURE_DECLARATION = 230, - FORMAL_SIGNED_INTEGER_TYPE_DECLARATION = 231, - FUNCTION_BODY = 232, - FUNCTION_BODY_STUB = 233, - FUNCTION_DECLARATION = 234, - FUNCTION_RENAMING_DECLARATION = 235, - GENERIC_FUNCTION_DECLARATION = 236, - GENERIC_FUNCTION_INSTANTIATION = 237, - GENERIC_FUNCTION_RENAMING = 238, - GENERIC_PACKAGE_INSTANTIATION = 239, - GENERIC_PACKAGE_RENAMING = 240, - GENERIC_PROCEDURE_DECLARATION = 241, - GENERIC_PROCEDURE_INSTANTIATION = 242, - GENERIC_PROCEDURE_RENAMING = 243, - GUARD_OPT = 244, - IDENTIFIER_COLON_OPT = 245, - ID_OPT = 246, - INIT_OPT = 247, - ITERATION_SCHEME_OPT = 248, - LABEL_OPT = 249, - MARK_WITH_CONSTRAINT = 250, - MODIFIERS = 251, - MODULAR_TYPE_DECLARATION = 252, - MOD_CLAUSE_OPT = 253, - NOT_IN = 254, - ORDINARY_DERIVED_TYPE_DECLARATION = 255, - ORDINARY_FIXED_POINT_DECLARATION = 256, - OR_ELSE = 257, - OR_SELECT_OPT = 258, - PARENTHESIZED_PRIMARY = 259, - PRIVATE_DECLARATIVE_ITEMS_OPT = 260, - PRIVATE_TASK_ITEMS_OPT = 261, - PROCEDURE_BODY = 262, - PROCEDURE_BODY_STUB = 263, - PROCEDURE_DECLARATION = 264, - PROCEDURE_RENAMING_DECLARATION = 265, - PROT_MEMBER_DECLARATIONS = 266, - PROT_OP_BODIES_OPT = 267, - PROT_OP_DECLARATIONS = 268, - PROT_PRIVATE_OPT = 269, - RANGED_EXPRS = 270, - RANGE_CONSTRAINT = 271, - RECORD_TYPE_DECLARATION = 272, - SELECTOR_NAMES_OPT = 273, - SIGNED_INTEGER_TYPE_DECLARATION = 274, - TASK_ITEMS_OPT = 275, - UNARY_MINUS = 276, - UNARY_PLUS = 277, - VALUE = 278, - VALUES = 279, - VARIANTS = 280, - COMMENT_INTRO = 281, - OX = 282, - TIC_OR_CHARACTER_LITERAL = 283, - DIGIT = 284, - EXPONENT = 285, - EXTENDED_DIGIT = 286, - BASED_INTEGER = 287, - WS_ = 288, - COMMENT = 289, - CHARACTER_STRING = 290, - NULL_TREE_LOOKAHEAD = 3 - }; -#ifdef __cplusplus -}; -#endif -#endif /*INC_AdaTreeParserSuperTokenTypes_hpp_*/ diff --git a/languages/ada/Makefile.am b/languages/ada/Makefile.am index d45a2add..26fe8c2c 100644 --- a/languages/ada/Makefile.am +++ b/languages/ada/Makefile.am @@ -20,13 +20,13 @@ EXTRA_DIST = ada.g ada.tree.g ada.store.g ## The following three rules assume that you have Java installed, ## ANTLR installed, and you have the antlr jar in your CLASSPATH. -#AdaLexer.hpp AdaLexer.cpp AdaParser.hpp AdaParser.cpp: ada.g +#AdaLexer.h AdaLexer.cpp AdaParser.h AdaParser.cpp: ada.g # antlr ada.g -#AdaTreeParserSuper.hpp AdaTreeParserSuper.cpp: ada.tree.g +#AdaTreeParserSuper.h AdaTreeParserSuper.cpp: ada.tree.g # antlr ada.tree.g -#AdaStoreWalker.hpp AdaStoreWalker.cpp: ada.store.g +#AdaStoreWalker.h AdaStoreWalker.cpp: ada.store.g # antlr -glib ada.tree.g ada.store.g genparser: diff --git a/languages/ada/README.dox b/languages/ada/README.dox index e71e6d45..017b3aed 100644 --- a/languages/ada/README.dox +++ b/languages/ada/README.dox @@ -2,10 +2,10 @@ Ada Language Support The ANTLR Ada core support files are: - - ada.g -- contains AdaLexer and AdaParser, requires AdaAST.hpp and adasupport.cpp + - ada.g -- contains AdaLexer and AdaParser, requires AdaAST.h and adasupport.cpp - ada.tree.g -- contains the AdaTreeParserSuper - - AdaAST.hpp -- definition of the AST node used by ada.g - - adasupport.hpp -- general purpose utilities + - AdaAST.h -- definition of the AST node used by ada.g + - adasupport.h -- general purpose utilities - adasupport.cpp -- implementation of general purpose utilities and implementation of AdaParser class methods from ada.g These are ANTLR master files. diff --git a/languages/ada/ada.g b/languages/ada/ada.g index 5f97952b..164c2187 100644 --- a/languages/ada/ada.g +++ b/languages/ada/ada.g @@ -27,8 +27,8 @@ header "pre_include_hpp" { -#include // antlr wants this -#include "AdaAST.hpp" +#include // antlr wants this +#include "AdaAST.h" #include "preambles.h" } diff --git a/languages/ada/ada.store.g b/languages/ada/ada.store.g index 31dccf99..658bfcfa 100644 --- a/languages/ada/ada.store.g +++ b/languages/ada/ada.store.g @@ -9,8 +9,8 @@ header "pre_include_hpp" { #include #include -#include "AdaAST.hpp" -#include "ada_utils.hpp" +#include "AdaAST.h" +#include "ada_utils.h" } header "post_include_hpp" { diff --git a/languages/ada/ada_utils.cpp b/languages/ada/ada_utils.cpp index d7b8bbf7..e12306ea 100644 --- a/languages/ada/ada_utils.cpp +++ b/languages/ada/ada_utils.cpp @@ -11,8 +11,8 @@ #include -#include "ada_utils.hpp" -#include "adasupport.hpp" +#include "ada_utils.h" +#include "adasupport.h" TQString qtext (const RefAdaAST& n) { diff --git a/languages/ada/ada_utils.h b/languages/ada/ada_utils.h new file mode 100644 index 00000000..ae4f9011 --- /dev/null +++ b/languages/ada/ada_utils.h @@ -0,0 +1,15 @@ +/* + */ +#ifndef ADA_UTILS_H +#define ADA_UTILS_H + +#include +#include "AdaAST.h" + +TQString qtext (const RefAdaAST& n); +TQStringList qnamelist (const RefAdaAST& n); +TQString ada_spec_filename (const TQString& comp_unit_name); +TQString fq_specfilename (const TQString& comp_unit_name); + +#endif + diff --git a/languages/ada/ada_utils.hpp b/languages/ada/ada_utils.hpp deleted file mode 100644 index 25c9fabd..00000000 --- a/languages/ada/ada_utils.hpp +++ /dev/null @@ -1,15 +0,0 @@ -/* - */ -#ifndef ADA_UTILS_H -#define ADA_UTILS_H - -#include -#include "AdaAST.hpp" - -TQString qtext (const RefAdaAST& n); -TQStringList qnamelist (const RefAdaAST& n); -TQString ada_spec_filename (const TQString& comp_unit_name); -TQString fq_specfilename (const TQString& comp_unit_name); - -#endif - diff --git a/languages/ada/adasupport.cpp b/languages/ada/adasupport.cpp index 6b877b7b..69baa66d 100644 --- a/languages/ada/adasupport.cpp +++ b/languages/ada/adasupport.cpp @@ -4,10 +4,10 @@ #include #include #include -#include -#include "AdaParser.hpp" -#include "AdaTokenTypes.hpp" -#include "adasupport.hpp" +#include +#include "AdaParser.h" +#include "AdaTokenTypes.h" +#include "adasupport.h" #define eq !strcmp diff --git a/languages/ada/adasupport.h b/languages/ada/adasupport.h new file mode 100644 index 00000000..f6bfddee --- /dev/null +++ b/languages/ada/adasupport.h @@ -0,0 +1,13 @@ +/* + */ +#ifndef ADASUPPORT_H +#define ADASUPPORT_H + +#include +#include "AdaAST.h" + +std::string text (const RefAdaAST& n); +int txteq (RefAdaAST n1, RefAdaAST n2); + +#endif + diff --git a/languages/ada/adasupport.hpp b/languages/ada/adasupport.hpp deleted file mode 100644 index 9d65e0e5..00000000 --- a/languages/ada/adasupport.hpp +++ /dev/null @@ -1,13 +0,0 @@ -/* - */ -#ifndef ADASUPPORT_H -#define ADASUPPORT_H - -#include -#include "AdaAST.hpp" - -std::string text (const RefAdaAST& n); -int txteq (RefAdaAST n1, RefAdaAST n2); - -#endif - diff --git a/languages/ada/adasupportpart.cpp b/languages/ada/adasupportpart.cpp index e08ef9a3..0d87f0a7 100644 --- a/languages/ada/adasupportpart.cpp +++ b/languages/ada/adasupportpart.cpp @@ -28,10 +28,10 @@ #include "problemreporter.h" #include "backgroundparser.h" -#include "AdaLexer.hpp" -#include "AdaParser.hpp" -#include "AdaStoreWalker.hpp" -#include "AdaAST.hpp" +#include "AdaLexer.h" +#include "AdaParser.h" +#include "AdaStoreWalker.h" +#include "AdaAST.h" #include diff --git a/languages/ada/backgroundparser.cpp b/languages/ada/backgroundparser.cpp index 68607851..4b77abcd 100644 --- a/languages/ada/backgroundparser.cpp +++ b/languages/ada/backgroundparser.cpp @@ -11,9 +11,9 @@ #include "backgroundparser.h" #include "problemreporter.h" -#include "AdaLexer.hpp" -#include "AdaParser.hpp" -#include "AdaAST.hpp" +#include "AdaLexer.h" +#include "AdaParser.h" +#include "AdaAST.h" #include #include diff --git a/languages/cpp/app_templates/gnome2mmapp/Makefile.am b/languages/cpp/app_templates/gnome2mmapp/Makefile.am index f86ae76c..bca35481 100644 --- a/languages/cpp/app_templates/gnome2mmapp/Makefile.am +++ b/languages/cpp/app_templates/gnome2mmapp/Makefile.am @@ -1,7 +1,7 @@ -dataFiles = acconfig.h autogen.sh gnome2mm.glade main_window.cc \ - main_window_glade.hh Makefile.am app-Makefile.am \ - configure.in gnome2mm.gladep main_window.hh \ - app.kdevelop gnome2mm.cc gnome2mmapp main_window_glade.cc\ +dataFiles = acconfig.h autogen.sh gnome2mm.glade main_window.cpp \ + main_window_glade.h Makefile.am app-Makefile.am \ + configure.in gnome2mm.gladep main_window.h \ + app.kdevelop gnome2mm.cpp gnome2mmapp main_window_glade.cpp\ src-Makefile.am config.h gnome2mmapp.png templateName = gnome2mmapp @@ -18,4 +18,4 @@ $(templateName).tar.gz: ${dataFiles} archivedir = ${appwizarddatadir} archive_DATA = $(templateName).tar.gz ${templateName}.png -CLEANFILES = *.tar.gz \ No newline at end of file +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/gnome2mmapp/gnome2mm.cc b/languages/cpp/app_templates/gnome2mmapp/gnome2mm.cc deleted file mode 100644 index 8a33b9ff..00000000 --- a/languages/cpp/app_templates/gnome2mmapp/gnome2mm.cc +++ /dev/null @@ -1,22 +0,0 @@ -%{CC_TEMPLATE} - -#include -#include -#include - -#include "main_window.hh" - -int main(int argc, char **argv) -{ -#if defined(ENABLE_NLS) - bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); - textdomain (GETTEXT_PACKAGE); -#endif //ENABLE_NLS - - Gnome::Main m(PACKAGE, VERSION, argc, argv); - - main_window *main_window = new class main_window(); - m.run(); - delete main_window; - return 0; -} diff --git a/languages/cpp/app_templates/gnome2mmapp/gnome2mm.cpp b/languages/cpp/app_templates/gnome2mmapp/gnome2mm.cpp new file mode 100644 index 00000000..be1ab196 --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/gnome2mm.cpp @@ -0,0 +1,22 @@ +%{CC_TEMPLATE} + +#include +#include +#include + +#include "main_window.h" + +int main(int argc, char **argv) +{ +#if defined(ENABLE_NLS) + bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); + textdomain (GETTEXT_PACKAGE); +#endif //ENABLE_NLS + + Gnome::Main m(PACKAGE, VERSION, argc, argv); + + main_window *main_window = new class main_window(); + m.run(); + delete main_window; + return 0; +} diff --git a/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.kdevtemplate b/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.kdevtemplate index 3b13385f..21dbd814 100644 --- a/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.kdevtemplate +++ b/languages/cpp/app_templates/gnome2mmapp/gnome2mmapp.kdevtemplate @@ -75,28 +75,28 @@ Dest=%{dest}/src/Makefile.am [FILE10] Type=install -Source=%{src}/gnome2mm.cc -Dest=%{dest}/src/%{APPNAMELC}.cc +Source=%{src}/gnome2mm.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp [FILE11] Type=install -Source=%{src}/main_window.hh -Dest=%{dest}/src/main_window.hh +Source=%{src}/main_window.h +Dest=%{dest}/src/main_window.h [FILE12] Type=install -Source=%{src}/main_window.cc -Dest=%{dest}/src/main_window.cc +Source=%{src}/main_window.cpp +Dest=%{dest}/src/main_window.cpp [FILE13] Type=install -Source=%{src}/main_window_glade.hh -Dest=%{dest}/src/main_window_glade.hh +Source=%{src}/main_window_glade.h +Dest=%{dest}/src/main_window_glade.h [FILE14] Type=install -Source=%{src}/main_window_glade.cc -Dest=%{dest}/src/main_window_glade.cc +Source=%{src}/main_window_glade.cpp +Dest=%{dest}/src/main_window_glade.cpp [MSG] Type=message diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window.cc b/languages/cpp/app_templates/gnome2mmapp/main_window.cc deleted file mode 100644 index 4c73911b..00000000 --- a/languages/cpp/app_templates/gnome2mmapp/main_window.cc +++ /dev/null @@ -1,16 +0,0 @@ -%{CC_TEMPLATE} - -// newer (non customized) versions of this file go to main_window.cc_new - -// This file is for your program, I won't touch it again! - -#include "config.h" -#include "main_window.hh" - -#include - -gint main_window::quit(GdkEventAny *ev) -{ - Gtk::Main::quit(); -} - diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window.cpp b/languages/cpp/app_templates/gnome2mmapp/main_window.cpp new file mode 100644 index 00000000..152a660c --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/main_window.cpp @@ -0,0 +1,14 @@ +%{CC_TEMPLATE} + +// This file is for your program, I won't touch it again! + +#include "config.h" +#include "main_window.h" + +#include + +gint main_window::quit(GdkEventAny *ev) +{ + Gtk::Main::quit(); +} + diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window.h b/languages/cpp/app_templates/gnome2mmapp/main_window.h new file mode 100644 index 00000000..80ac8c70 --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/main_window.h @@ -0,0 +1,17 @@ +%{HH_TEMPLATE} + +// you might replace +// class foo : public foo_glade { ... }; +// by +// typedef foo_glade foo; +// if you didn't make any modifications to the widget + +#ifndef _MAIN_WINDOW_H +# include "main_window_glade.h" +# define _MAIN_WINDOW_H +class main_window : public main_window_glade +{ +protected: + virtual gint quit(GdkEventAny *ev); +}; +#endif diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window.hh b/languages/cpp/app_templates/gnome2mmapp/main_window.hh deleted file mode 100644 index ae93336b..00000000 --- a/languages/cpp/app_templates/gnome2mmapp/main_window.hh +++ /dev/null @@ -1,19 +0,0 @@ -%{HH_TEMPLATE} - -// newer (non customized) versions of this file go to main_window.hh_new - -// you might replace -// class foo : public foo_glade { ... }; -// by -// typedef foo_glade foo; -// if you didn't make any modifications to the widget - -#ifndef _MAIN_WINDOW_HH -# include "main_window_glade.hh" -# define _MAIN_WINDOW_HH -class main_window : public main_window_glade -{ -protected: - virtual gint quit(GdkEventAny *ev); -}; -#endif diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window_glade.cc b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.cc deleted file mode 100644 index bea6c857..00000000 --- a/languages/cpp/app_templates/gnome2mmapp/main_window_glade.cc +++ /dev/null @@ -1,30 +0,0 @@ -%{CC_TEMPLATE} - -// DO NOT EDIT THIS FILE ! It was created using -// glade-- /home/amp8165/Projects/gnome2mm/gnome2mm.glade -// for gtk 2.2.4 and gtkmm 1.2.10 -// -// Please modify the corresponding derived classes in ./src/main_window.cc - -#include "config.h" -#include -#include "main_window_glade.hh" -#include -#include - -main_window_glade::main_window_glade( -) : Gtk::Window(GTK_WINDOW_TOPLEVEL) -{ main_window = this; - - Gtk::AccelGroup *main_window_accgrp = Gtk::AccelGroup::create(); - gmm_data = new GlademmData(main_window_accgrp); - main_window->set_title(_("%{APPNAME} Project")); - main_window->set_modal(false); - main_window->add_accel_group(*(gmm_data->getAccelGroup())); - main_window->show(); - main_window->delete_event.connect(SigC::slot(this, &main_window_glade::quit)); -} - -main_window_glade::~main_window_glade() -{ delete gmm_data; -} diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window_glade.cpp b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.cpp new file mode 100644 index 00000000..577d3576 --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.cpp @@ -0,0 +1,30 @@ +%{CC_TEMPLATE} + +// DO NOT EDIT THIS FILE ! It was created using +// glade-- /home/amp8165/Projects/gnome2mm/gnome2mm.glade +// for gtk 2.2.4 and gtkmm 1.2.10 +// +// Please modify the corresponding derived classes in ./src/main_window.cpp + +#include "config.h" +#include +#include "main_window_glade.h" +#include +#include + +main_window_glade::main_window_glade( +) : Gtk::Window(GTK_WINDOW_TOPLEVEL) +{ main_window = this; + + Gtk::AccelGroup *main_window_accgrp = Gtk::AccelGroup::create(); + gmm_data = new GlademmData(main_window_accgrp); + main_window->set_title(_("%{APPNAME} Project")); + main_window->set_modal(false); + main_window->add_accel_group(*(gmm_data->getAccelGroup())); + main_window->show(); + main_window->delete_event.connect(SigC::slot(this, &main_window_glade::quit)); +} + +main_window_glade::~main_window_glade() +{ delete gmm_data; +} diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window_glade.h b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.h new file mode 100644 index 00000000..1793dbdc --- /dev/null +++ b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.h @@ -0,0 +1,49 @@ +%{HH_TEMPLATE} + +// DO NOT EDIT THIS FILE ! It was created using +// glade-- /home/amp8165/Projects/gnome2mm/gnome2mm.glade +// for gtk 2.2.4 and gtkmm 1.2.10 +// +// Please modify the corresponding derived classes in ./src/main_window.h and./src/main_window.cpp + +#ifndef _MAIN_WINDOW_GLADE_H +# define _MAIN_WINDOW_GLADE_H + + +#if !defined(GLADEMM_DATA) +#define GLADEMM_DATA +#include + +class GlademmData +{ + + Gtk::AccelGroup *accgrp; +public: + + GlademmData(Gtk::AccelGroup *ag) : accgrp(ag) + { + } + + Gtk::AccelGroup * getAccelGroup() + { return accgrp; + } +}; +#endif //GLADEMM_DATA + +#include + +class main_window_glade : public Gtk::Window +{ + + GlademmData *gmm_data; +public: + class Gtk::Window *main_window; +protected: + + main_window_glade(); + + ~main_window_glade(); + + virtual gint quit(GdkEventAny *ev) = 0; +}; +#endif diff --git a/languages/cpp/app_templates/gnome2mmapp/main_window_glade.hh b/languages/cpp/app_templates/gnome2mmapp/main_window_glade.hh deleted file mode 100644 index 97a9302f..00000000 --- a/languages/cpp/app_templates/gnome2mmapp/main_window_glade.hh +++ /dev/null @@ -1,49 +0,0 @@ -%{HH_TEMPLATE} - -// DO NOT EDIT THIS FILE ! It was created using -// glade-- /home/amp8165/Projects/gnome2mm/gnome2mm.glade -// for gtk 2.2.4 and gtkmm 1.2.10 -// -// Please modify the corresponding derived classes in ./src/main_window.hh and./src/main_window.cc - -#ifndef _MAIN_WINDOW_GLADE_HH -# define _MAIN_WINDOW_GLADE_HH - - -#if !defined(GLADEMM_DATA) -#define GLADEMM_DATA -#include - -class GlademmData -{ - - Gtk::AccelGroup *accgrp; -public: - - GlademmData(Gtk::AccelGroup *ag) : accgrp(ag) - { - } - - Gtk::AccelGroup * getAccelGroup() - { return accgrp; - } -}; -#endif //GLADEMM_DATA - -#include - -class main_window_glade : public Gtk::Window -{ - - GlademmData *gmm_data; -public: - class Gtk::Window *main_window; -protected: - - main_window_glade(); - - ~main_window_glade(); - - virtual gint quit(GdkEventAny *ev) = 0; -}; -#endif diff --git a/languages/cpp/app_templates/gnome2mmapp/src-Makefile.am b/languages/cpp/app_templates/gnome2mmapp/src-Makefile.am index fe5ec32c..81df1152 100644 --- a/languages/cpp/app_templates/gnome2mmapp/src-Makefile.am +++ b/languages/cpp/app_templates/gnome2mmapp/src-Makefile.am @@ -1,13 +1,13 @@ bin_PROGRAMS = %{APPNAMELC} %{APPNAMELC}_SOURCES = \ - %{APPNAMELC}.cc\ - main_window_glade.cc \ - main_window.cc + %{APPNAMELC}.cpp\ + main_window_glade.cpp \ + main_window.cpp noinst_HEADERS = \ - main_window_glade.hh \ - main_window.hh + main_window_glade.h \ + main_window.h AM_CXXFLAGS = @CXXFLAGS@ @GNOMEMM_CFLAGS@ diff --git a/languages/cpp/app_templates/gtk2mmapp/CMakeLists.txt b/languages/cpp/app_templates/gtk2mmapp/CMakeLists.txt index 0a78898d..f152b532 100644 --- a/languages/cpp/app_templates/gtk2mmapp/CMakeLists.txt +++ b/languages/cpp/app_templates/gtk2mmapp/CMakeLists.txt @@ -10,10 +10,10 @@ ################################################# set( _tarball_content - acconfig.h autogen.sh gtk2mm.glade main_window.cc - main_window_glade.hh Makefile.am app-Makefile.am - configure.in gtk2mm.gladep main_window.hh app.kdevelop - gtk2mm.cc main_window_glade.cc src-Makefile.am config.h + acconfig.h autogen.sh gtk2mm.glade main_window.cpp + main_window_glade.h Makefile.am app-Makefile.am + configure.in gtk2mm.gladep main_window.h app.kdevelop + gtk2mm.cpp main_window_glade.cpp src-Makefile.am config.h gtk2mmapp.png ) list( SORT _tarball_content ) diff --git a/languages/cpp/app_templates/gtk2mmapp/Makefile.am b/languages/cpp/app_templates/gtk2mmapp/Makefile.am index 2069ade7..16978c39 100644 --- a/languages/cpp/app_templates/gtk2mmapp/Makefile.am +++ b/languages/cpp/app_templates/gtk2mmapp/Makefile.am @@ -1,7 +1,7 @@ -dataFiles = acconfig.h autogen.sh gtk2mm.glade main_window.cc \ - main_window_glade.hh Makefile.am app-Makefile.am \ - configure.in gtk2mm.gladep main_window.hh \ - app.kdevelop gtk2mm.cc main_window_glade.cc\ +dataFiles = acconfig.h autogen.sh gtk2mm.glade main_window.cpp \ + main_window_glade.h Makefile.am app-Makefile.am \ + configure.in gtk2mm.gladep main_window.h \ + app.kdevelop gtk2mm.cpp main_window_glade.cpp\ src-Makefile.am config.h gtk2mmapp.png templateName = gtk2mmapp @@ -18,4 +18,4 @@ $(templateName).tar.gz: ${dataFiles} archivedir = ${appwizarddatadir} archive_DATA = $(templateName).tar.gz ${templateName}.png -CLEANFILES = *.tar.gz \ No newline at end of file +CLEANFILES = *.tar.gz diff --git a/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc b/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc deleted file mode 100644 index 9845fede..00000000 --- a/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cc +++ /dev/null @@ -1,15 +0,0 @@ -%{CC_TEMPLATE} - -#include - -#include "main_window.hh" - -int main(int argc, char **argv) -{ - - Gtk::Main m(&argc, &argv); - - main_window main_window; - Gtk::Main::run(main_window); - return 0; -} diff --git a/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cpp b/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cpp new file mode 100644 index 00000000..30f39adf --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/gtk2mm.cpp @@ -0,0 +1,15 @@ +%{CC_TEMPLATE} + +#include + +#include "main_window.h" + +int main(int argc, char **argv) +{ + + Gtk::Main m(&argc, &argv); + + main_window main_window; + Gtk::Main::run(main_window); + return 0; +} diff --git a/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate b/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate index 35b51993..68b119a2 100644 --- a/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate +++ b/languages/cpp/app_templates/gtk2mmapp/gtk2mmapp.kdevtemplate @@ -71,28 +71,28 @@ Dest=%{dest}/src/Makefile.am [FILE10] Type=install -Source=%{src}/gtk2mm.cc -Dest=%{dest}/src/%{APPNAMELC}.cc +Source=%{src}/gtk2mm.cpp +Dest=%{dest}/src/%{APPNAMELC}.cpp [FILE11] Type=install -Source=%{src}/main_window.hh -Dest=%{dest}/src/main_window.hh +Source=%{src}/main_window.h +Dest=%{dest}/src/main_window.h [FILE12] Type=install -Source=%{src}/main_window.cc -Dest=%{dest}/src/main_window.cc +Source=%{src}/main_window.cpp +Dest=%{dest}/src/main_window.cpp [FILE13] Type=install -Source=%{src}/main_window_glade.hh -Dest=%{dest}/src/main_window_glade.hh +Source=%{src}/main_window_glade.h +Dest=%{dest}/src/main_window_glade.h [FILE14] Type=install -Source=%{src}/main_window_glade.cc -Dest=%{dest}/src/main_window_glade.cc +Source=%{src}/main_window_glade.cpp +Dest=%{dest}/src/main_window_glade.cpp [MSG] Type=message diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window.cc b/languages/cpp/app_templates/gtk2mmapp/main_window.cc deleted file mode 100644 index ad36b327..00000000 --- a/languages/cpp/app_templates/gtk2mmapp/main_window.cc +++ /dev/null @@ -1,12 +0,0 @@ -%{CC_TEMPLATE} - -// newer (non customized) versions of this file go to main_window.cc_new - -// This file is for your program, I won't touch it again! - -#include "config.h" -#include "main_window.hh" - -bool main_window::quit(GdkEventAny *ev) -{ return 0; -} diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window.cpp b/languages/cpp/app_templates/gtk2mmapp/main_window.cpp new file mode 100644 index 00000000..3a7df9cf --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/main_window.cpp @@ -0,0 +1,10 @@ +%{CC_TEMPLATE} + +// This file is for your program, I won't touch it again! + +#include "config.h" +#include "main_window.h" + +bool main_window::quit(GdkEventAny *ev) +{ return 0; +} diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window.h b/languages/cpp/app_templates/gtk2mmapp/main_window.h new file mode 100644 index 00000000..85daad4b --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/main_window.h @@ -0,0 +1,17 @@ +%{HH_TEMPLATE} + +// you might replace +// class foo : public foo_glade { ... }; +// by +// typedef foo_glade foo; +// if you didn't make any modifications to the widget + +#ifndef _MAIN_WINDOW_H +# include "main_window_glade.h" +# define _MAIN_WINDOW_H +class main_window : public main_window_glade +{ + + bool quit(GdkEventAny *ev); +}; +#endif diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window.hh b/languages/cpp/app_templates/gtk2mmapp/main_window.hh deleted file mode 100644 index 640e1461..00000000 --- a/languages/cpp/app_templates/gtk2mmapp/main_window.hh +++ /dev/null @@ -1,19 +0,0 @@ -%{HH_TEMPLATE} - -// newer (non customized) versions of this file go to main_window.hh_new - -// you might replace -// class foo : public foo_glade { ... }; -// by -// typedef foo_glade foo; -// if you didn't make any modifications to the widget - -#ifndef _MAIN_WINDOW_HH -# include "main_window_glade.hh" -# define _MAIN_WINDOW_HH -class main_window : public main_window_glade -{ - - bool quit(GdkEventAny *ev); -}; -#endif diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cc b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cc deleted file mode 100644 index 829855a8..00000000 --- a/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cc +++ /dev/null @@ -1,40 +0,0 @@ -%{CC_TEMPLATE} - -// DO NOT EDIT THIS FILE ! It was created using glade-- -// for gtk 2.8.3 and gtkmm 2.8.0 -// -// Please modify the corresponding derived classes in ./src/main_window.cc - - -#if defined __GNUC__ && __GNUC__ < 3 -#error This program will crash if compiled with g++ 2.x -// see the dynamic_cast bug in the gtkmm FAQ -#endif // -#include "config.h" -#include -#if GTKMM_MAJOR_VERSION==2 && GTKMM_MINOR_VERSION>2 -#include -#define GMM_GTKMM_22_24(a,b) b -#else //gtkmm 2.2 -#define GMM_GTKMM_22_24(a,b) a -#endif // -#include "main_window_glade.hh" -#include -#include - -main_window_glade::main_window_glade( -) : Gtk::Window(Gtk::WINDOW_TOPLEVEL) -{ main_window = this; - gmm_data = new GlademmData(get_accel_group()); - main_window->set_title("%{APPNAME} Project"); - main_window->set_modal(false); - main_window->property_window_position().set_value(Gtk::WIN_POS_CENTER); - main_window->set_resizable(true); - main_window->property_destroy_with_parent().set_value(false); - main_window->show(); - main_window->signal_delete_event().connect(SigC::slot(*this, &main_window_glade::quit), false); -} - -main_window_glade::~main_window_glade() -{ delete gmm_data; -} diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cpp b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cpp new file mode 100644 index 00000000..5bed4679 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.cpp @@ -0,0 +1,40 @@ +%{CC_TEMPLATE} + +// DO NOT EDIT THIS FILE ! It was created using glade-- +// for gtk 2.8.3 and gtkmm 2.8.0 +// +// Please modify the corresponding derived classes in ./src/main_window.cpp + + +#if defined __GNUC__ && __GNUC__ < 3 +#error This program will crash if compiled with g++ 2.x +// see the dynamic_cast bug in the gtkmm FAQ +#endif // +#include "config.h" +#include +#if GTKMM_MAJOR_VERSION==2 && GTKMM_MINOR_VERSION>2 +#include +#define GMM_GTKMM_22_24(a,b) b +#else //gtkmm 2.2 +#define GMM_GTKMM_22_24(a,b) a +#endif // +#include "main_window_glade.h" +#include +#include + +main_window_glade::main_window_glade( +) : Gtk::Window(Gtk::WINDOW_TOPLEVEL) +{ main_window = this; + gmm_data = new GlademmData(get_accel_group()); + main_window->set_title("%{APPNAME} Project"); + main_window->set_modal(false); + main_window->property_window_position().set_value(Gtk::WIN_POS_CENTER); + main_window->set_resizable(true); + main_window->property_destroy_with_parent().set_value(false); + main_window->show(); + main_window->signal_delete_event().connect(SigC::slot(*this, &main_window_glade::quit), false); +} + +main_window_glade::~main_window_glade() +{ delete gmm_data; +} diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window_glade.h b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.h new file mode 100644 index 00000000..726409b4 --- /dev/null +++ b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.h @@ -0,0 +1,48 @@ +%{HH_TEMPLATE} + +// DO NOT EDIT THIS FILE ! It was created using glade-- +// for gtk 2.8.3 and gtkmm 2.8.0 +// +// Please modify the corresponding derived classes in ./src/main_window.h and./src/main_window.cpp + +#ifndef _MAIN_WINDOW_GLADE_H +# define _MAIN_WINDOW_GLADE_H + + +#if !defined(GLADEMM_DATA) +#define GLADEMM_DATA +#include + +class GlademmData +{ + + Glib::RefPtr accgrp; +public: + + GlademmData(Glib::RefPtr ag) : accgrp(ag) + { + } + + Glib::RefPtr getAccelGroup() + { return accgrp; + } +}; +#endif //GLADEMM_DATA + +#include + +class main_window_glade : public Gtk::Window +{ + + GlademmData *gmm_data; +public: + class Gtk::Window * main_window; +protected: + + main_window_glade(); + + ~main_window_glade(); +private: + virtual bool quit(GdkEventAny *ev) = 0; +}; +#endif diff --git a/languages/cpp/app_templates/gtk2mmapp/main_window_glade.hh b/languages/cpp/app_templates/gtk2mmapp/main_window_glade.hh deleted file mode 100644 index 3c0cc27a..00000000 --- a/languages/cpp/app_templates/gtk2mmapp/main_window_glade.hh +++ /dev/null @@ -1,48 +0,0 @@ -%{HH_TEMPLATE} - -// DO NOT EDIT THIS FILE ! It was created using glade-- -// for gtk 2.8.3 and gtkmm 2.8.0 -// -// Please modify the corresponding derived classes in ./src/main_window.hh and./src/main_window.cc - -#ifndef _MAIN_WINDOW_GLADE_HH -# define _MAIN_WINDOW_GLADE_HH - - -#if !defined(GLADEMM_DATA) -#define GLADEMM_DATA -#include - -class GlademmData -{ - - Glib::RefPtr accgrp; -public: - - GlademmData(Glib::RefPtr ag) : accgrp(ag) - { - } - - Glib::RefPtr getAccelGroup() - { return accgrp; - } -}; -#endif //GLADEMM_DATA - -#include - -class main_window_glade : public Gtk::Window -{ - - GlademmData *gmm_data; -public: - class Gtk::Window * main_window; -protected: - - main_window_glade(); - - ~main_window_glade(); -private: - virtual bool quit(GdkEventAny *ev) = 0; -}; -#endif diff --git a/languages/cpp/app_templates/gtk2mmapp/src-Makefile.am b/languages/cpp/app_templates/gtk2mmapp/src-Makefile.am index a8c856e9..e61b92f5 100644 --- a/languages/cpp/app_templates/gtk2mmapp/src-Makefile.am +++ b/languages/cpp/app_templates/gtk2mmapp/src-Makefile.am @@ -1,13 +1,13 @@ bin_PROGRAMS = %{APPNAMELC} %{APPNAMELC}_SOURCES = \ - %{APPNAMELC}.cc\ - main_window_glade.cc \ - main_window.cc + %{APPNAMELC}.cpp\ + main_window_glade.cpp \ + main_window.cpp noinst_HEADERS = \ - main_window_glade.hh \ - main_window.hh + main_window_glade.h \ + main_window.h AM_CXXFLAGS = @CXXFLAGS@ @GTKMM_CFLAGS@ diff --git a/languages/java/JavaAST.h b/languages/java/JavaAST.h new file mode 100644 index 00000000..4d89452e --- /dev/null +++ b/languages/java/JavaAST.h @@ -0,0 +1,77 @@ +#ifndef JAVAAST_HPP +#define JAVAAST_HPP + +#include +#include + +class JavaAST; +typedef ANTLR_USE_NAMESPACE(antlr)ASTRefCount RefJavaAST; + +class JavaAST : public ANTLR_USE_NAMESPACE(antlr)CommonAST +{ +public: + JavaAST() + : m_line(0), m_column(0) {} + + virtual ~JavaAST() {} + + int getLine() const { return m_line; } + void setLine( int line ) { m_line = line; } + + int getColumn() const { return m_column; } + void setColumn( int column ) { m_column = column; } + + void initialize( ANTLR_USE_NAMESPACE(antlr)RefToken t ) + { + CommonAST::initialize(t); + m_line = t->getLine() - 1; + m_column = t->getColumn() - 1; + } + + void initialize( ANTLR_USE_NAMESPACE(antlr)RefAST t ) + { + CommonAST::initialize( t ); + + m_line = 0; + m_column = 0; + + RefJavaAST a( dynamic_cast(t.get()) ); + m_line = a->getLine(); + m_column = a->getColumn(); + } + + void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) + { + CommonAST::initialize( t, txt ); + m_line = 0; + m_column = 0; + } + + static ANTLR_USE_NAMESPACE(antlr)RefAST factory() + { + RefJavaAST n(new JavaAST); + return n.get(); + } + + +private: + int m_line; + int m_column; + +private: + JavaAST( const JavaAST& source ); + void operator = ( const JavaAST& source ); +}; + +namespace antlr +{ + +class JavaASTFactory: public ASTFactory +{ +public: + JavaASTFactory(): ASTFactory( "JavaAST", JavaAST::factory ) {} +}; + +} // namespace antlr + +#endif diff --git a/languages/java/JavaAST.hpp b/languages/java/JavaAST.hpp deleted file mode 100644 index 7108fca1..00000000 --- a/languages/java/JavaAST.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef JAVAAST_HPP -#define JAVAAST_HPP - -#include -#include - -class JavaAST; -typedef ANTLR_USE_NAMESPACE(antlr)ASTRefCount RefJavaAST; - -class JavaAST : public ANTLR_USE_NAMESPACE(antlr)CommonAST -{ -public: - JavaAST() - : m_line(0), m_column(0) {} - - virtual ~JavaAST() {} - - int getLine() const { return m_line; } - void setLine( int line ) { m_line = line; } - - int getColumn() const { return m_column; } - void setColumn( int column ) { m_column = column; } - - void initialize( ANTLR_USE_NAMESPACE(antlr)RefToken t ) - { - CommonAST::initialize(t); - m_line = t->getLine() - 1; - m_column = t->getColumn() - 1; - } - - void initialize( ANTLR_USE_NAMESPACE(antlr)RefAST t ) - { - CommonAST::initialize( t ); - - m_line = 0; - m_column = 0; - - RefJavaAST a( dynamic_cast(t.get()) ); - m_line = a->getLine(); - m_column = a->getColumn(); - } - - void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) - { - CommonAST::initialize( t, txt ); - m_line = 0; - m_column = 0; - } - - static ANTLR_USE_NAMESPACE(antlr)RefAST factory() - { - RefJavaAST n(new JavaAST); - return n.get(); - } - - -private: - int m_line; - int m_column; - -private: - JavaAST( const JavaAST& source ); - void operator = ( const JavaAST& source ); -}; - -namespace antlr -{ - -class JavaASTFactory: public ASTFactory -{ -public: - JavaASTFactory(): ASTFactory( "JavaAST", JavaAST::factory ) {} -}; - -} // namespace antlr - -#endif diff --git a/languages/java/JavaLexer.cpp b/languages/java/JavaLexer.cpp index 623e816f..4230b156 100644 --- a/languages/java/JavaLexer.cpp +++ b/languages/java/JavaLexer.cpp @@ -1,12 +1,12 @@ /* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaLexer.cpp"$ */ -#include "JavaLexer.hpp" -#include -#include -#include -#include -#include -#include -#include +#include "JavaLexer.h" +#include +#include +#include +#include +#include +#include +#include #line 1041 "java.g" diff --git a/languages/java/JavaLexer.h b/languages/java/JavaLexer.h new file mode 100644 index 00000000..e5b6fb1d --- /dev/null +++ b/languages/java/JavaLexer.h @@ -0,0 +1,132 @@ +#ifndef INC_JavaLexer_h_ +#define INC_JavaLexer_h_ + +#line 2 "java.g" + + #include "driver.h" + #include "JavaAST.h" + + #include + #include + + #define SET_POSITION(ast,t)\ + { \ + RefJavaAST(ast)->setLine( t->getLine() );\ + RefJavaAST(ast)->setColumn( t->getColumn() ); \ + } + +#line 19 "JavaLexer.h" +#include +/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaLexer.h"$ */ +#include +#include +#include +#include "JavaTokenTypes.h" +#include +class CUSTOM_API JavaLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public JavaTokenTypes +{ +#line 1058 "java.g" + +private: + Driver* m_driver; + +public: + void setDriver( Driver* d ) { m_driver = d; } + void setFileName( const TQString& fileName ) { m_driver->currentFileName() = fileName; } + + virtual void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(ex.getMessage().c_str()), ex.getLine(), ex.getColumn()) ); + } + + virtual void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(errorMessage.c_str()), getLine(), getColumn()) ); + } + + virtual void reportWarning( const ANTLR_USE_NAMESPACE(std)string& warnMessage ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(warnMessage.c_str()), getLine(), getColumn()) ); + } +#line 30 "JavaLexer.h" +private: + void initLiterals(); +public: + bool getCaseSensitiveLiterals() const + { + return true; + } +public: + JavaLexer(ANTLR_USE_NAMESPACE(std)istream& in); + JavaLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); + JavaLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); + ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); + public: void mQUESTION(bool _createToken); + public: void mLPAREN(bool _createToken); + public: void mRPAREN(bool _createToken); + public: void mLBRACK(bool _createToken); + public: void mRBRACK(bool _createToken); + public: void mLCURLY(bool _createToken); + public: void mRCURLY(bool _createToken); + public: void mCOLON(bool _createToken); + public: void mCOMMA(bool _createToken); + public: void mASSIGN(bool _createToken); + public: void mEQUAL(bool _createToken); + public: void mLNOT(bool _createToken); + public: void mBNOT(bool _createToken); + public: void mNOT_EQUAL(bool _createToken); + public: void mDIV(bool _createToken); + public: void mDIV_ASSIGN(bool _createToken); + public: void mPLUS(bool _createToken); + public: void mPLUS_ASSIGN(bool _createToken); + public: void mINC(bool _createToken); + public: void mMINUS(bool _createToken); + public: void mMINUS_ASSIGN(bool _createToken); + public: void mDEC(bool _createToken); + public: void mSTAR(bool _createToken); + public: void mSTAR_ASSIGN(bool _createToken); + public: void mMOD(bool _createToken); + public: void mMOD_ASSIGN(bool _createToken); + public: void mSR(bool _createToken); + public: void mSR_ASSIGN(bool _createToken); + public: void mBSR(bool _createToken); + public: void mBSR_ASSIGN(bool _createToken); + public: void mGE(bool _createToken); + public: void mGT(bool _createToken); + public: void mSL(bool _createToken); + public: void mSL_ASSIGN(bool _createToken); + public: void mLE(bool _createToken); + public: void mLT_(bool _createToken); + public: void mBXOR(bool _createToken); + public: void mBXOR_ASSIGN(bool _createToken); + public: void mBOR(bool _createToken); + public: void mBOR_ASSIGN(bool _createToken); + public: void mLOR(bool _createToken); + public: void mBAND(bool _createToken); + public: void mBAND_ASSIGN(bool _createToken); + public: void mLAND(bool _createToken); + public: void mSEMI(bool _createToken); + public: void mWS(bool _createToken); + public: void mSL_COMMENT(bool _createToken); + public: void mML_COMMENT(bool _createToken); + public: void mCHAR_LITERAL(bool _createToken); + protected: void mESC(bool _createToken); + public: void mSTRING_LITERAL(bool _createToken); + protected: void mHEX_DIGIT(bool _createToken); + protected: void mVOCAB(bool _createToken); + public: void mIDENT(bool _createToken); + public: void mNUM_INT(bool _createToken); + protected: void mEXPONENT(bool _createToken); + protected: void mFLOAT_SUFFIX(bool _createToken); +private: + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; +}; + +#endif /*INC_JavaLexer_h_*/ diff --git a/languages/java/JavaLexer.hpp b/languages/java/JavaLexer.hpp deleted file mode 100644 index 9d185686..00000000 --- a/languages/java/JavaLexer.hpp +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef INC_JavaLexer_hpp_ -#define INC_JavaLexer_hpp_ - -#line 2 "java.g" - - #include "driver.h" - #include "JavaAST.hpp" - - #include - #include - - #define SET_POSITION(ast,t)\ - { \ - RefJavaAST(ast)->setLine( t->getLine() );\ - RefJavaAST(ast)->setColumn( t->getColumn() ); \ - } - -#line 19 "JavaLexer.hpp" -#include -/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaLexer.hpp"$ */ -#include -#include -#include -#include "JavaTokenTypes.hpp" -#include -class CUSTOM_API JavaLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public JavaTokenTypes -{ -#line 1058 "java.g" - -private: - Driver* m_driver; - -public: - void setDriver( Driver* d ) { m_driver = d; } - void setFileName( const TQString& fileName ) { m_driver->currentFileName() = fileName; } - - virtual void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ - m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(ex.getMessage().c_str()), ex.getLine(), ex.getColumn()) ); - } - - virtual void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ - m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(errorMessage.c_str()), getLine(), getColumn()) ); - } - - virtual void reportWarning( const ANTLR_USE_NAMESPACE(std)string& warnMessage ){ - m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(warnMessage.c_str()), getLine(), getColumn()) ); - } -#line 30 "JavaLexer.hpp" -private: - void initLiterals(); -public: - bool getCaseSensitiveLiterals() const - { - return true; - } -public: - JavaLexer(ANTLR_USE_NAMESPACE(std)istream& in); - JavaLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); - JavaLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); - ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); - public: void mQUESTION(bool _createToken); - public: void mLPAREN(bool _createToken); - public: void mRPAREN(bool _createToken); - public: void mLBRACK(bool _createToken); - public: void mRBRACK(bool _createToken); - public: void mLCURLY(bool _createToken); - public: void mRCURLY(bool _createToken); - public: void mCOLON(bool _createToken); - public: void mCOMMA(bool _createToken); - public: void mASSIGN(bool _createToken); - public: void mEQUAL(bool _createToken); - public: void mLNOT(bool _createToken); - public: void mBNOT(bool _createToken); - public: void mNOT_EQUAL(bool _createToken); - public: void mDIV(bool _createToken); - public: void mDIV_ASSIGN(bool _createToken); - public: void mPLUS(bool _createToken); - public: void mPLUS_ASSIGN(bool _createToken); - public: void mINC(bool _createToken); - public: void mMINUS(bool _createToken); - public: void mMINUS_ASSIGN(bool _createToken); - public: void mDEC(bool _createToken); - public: void mSTAR(bool _createToken); - public: void mSTAR_ASSIGN(bool _createToken); - public: void mMOD(bool _createToken); - public: void mMOD_ASSIGN(bool _createToken); - public: void mSR(bool _createToken); - public: void mSR_ASSIGN(bool _createToken); - public: void mBSR(bool _createToken); - public: void mBSR_ASSIGN(bool _createToken); - public: void mGE(bool _createToken); - public: void mGT(bool _createToken); - public: void mSL(bool _createToken); - public: void mSL_ASSIGN(bool _createToken); - public: void mLE(bool _createToken); - public: void mLT_(bool _createToken); - public: void mBXOR(bool _createToken); - public: void mBXOR_ASSIGN(bool _createToken); - public: void mBOR(bool _createToken); - public: void mBOR_ASSIGN(bool _createToken); - public: void mLOR(bool _createToken); - public: void mBAND(bool _createToken); - public: void mBAND_ASSIGN(bool _createToken); - public: void mLAND(bool _createToken); - public: void mSEMI(bool _createToken); - public: void mWS(bool _createToken); - public: void mSL_COMMENT(bool _createToken); - public: void mML_COMMENT(bool _createToken); - public: void mCHAR_LITERAL(bool _createToken); - protected: void mESC(bool _createToken); - public: void mSTRING_LITERAL(bool _createToken); - protected: void mHEX_DIGIT(bool _createToken); - protected: void mVOCAB(bool _createToken); - public: void mIDENT(bool _createToken); - public: void mNUM_INT(bool _createToken); - protected: void mEXPONENT(bool _createToken); - protected: void mFLOAT_SUFFIX(bool _createToken); -private: - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; - static const unsigned long _tokenSet_4_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; -}; - -#endif /*INC_JavaLexer_hpp_*/ diff --git a/languages/java/JavaRecognizer.cpp b/languages/java/JavaRecognizer.cpp index 1021c6a0..7d010b49 100644 --- a/languages/java/JavaRecognizer.cpp +++ b/languages/java/JavaRecognizer.cpp @@ -1,8 +1,8 @@ /* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaRecognizer.cpp"$ */ -#include "JavaRecognizer.hpp" -#include -#include -#include +#include "JavaRecognizer.h" +#include +#include +#include #line 1 "java.g" #line 8 "JavaRecognizer.cpp" JavaRecognizer::JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k) diff --git a/languages/java/JavaRecognizer.h b/languages/java/JavaRecognizer.h new file mode 100644 index 00000000..32311a3d --- /dev/null +++ b/languages/java/JavaRecognizer.h @@ -0,0 +1,423 @@ +#ifndef INC_JavaRecognizer_h_ +#define INC_JavaRecognizer_h_ + +#line 2 "java.g" + + #include "driver.h" + #include "JavaAST.h" + + #include + #include + + #define SET_POSITION(ast,t)\ + { \ + RefJavaAST(ast)->setLine( t->getLine() );\ + RefJavaAST(ast)->setColumn( t->getColumn() ); \ + } + +#line 19 "JavaRecognizer.h" +#include +/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaRecognizer.h"$ */ +#include +#include +#include "JavaTokenTypes.h" +#include + +/** Java 1.3 Recognizer + * + * Run 'java Main [-showtree] directory-full-of-java-files' + * + * [The -showtree option pops up a Swing frame that shows + * the AST constructed from the parser.] + * + * Run 'java Main ' + * + * Contributing authors: + * John Mitchell johnm@non.net + * Terence Parr parrt@magelang.com + * John Lilley jlilley@empathy.com + * Scott Stanchfield thetick@magelang.com + * Markus Mohnen mohnen@informatik.rwth-aachen.de + * Peter Williams pete.williams@sun.com + * Allan Jacobs Allan.Jacobs@eng.sun.com + * Steve Messick messick@redhills.com + * John Pybus john@pybus.org + * + * Version 1.00 December 9, 1997 -- initial release + * Version 1.01 December 10, 1997 + * fixed bug in octal def (0..7 not 0..8) + * Version 1.10 August 1998 (parrt) + * added tree construction + * fixed definition of WS,comments for mac,pc,unix newlines + * added unary plus + * Version 1.11 (Nov 20, 1998) + * Added "shutup" option to turn off last ambig warning. + * Fixed inner class def to allow named class defs as statements + * synchronized requires compound not simple statement + * add [] after builtInType DOT class in primaryExpression + * "const" is reserved but not valid..removed from modifiers + * Version 1.12 (Feb 2, 1999) + * Changed LITERAL_xxx to xxx in tree grammar. + * Updated java.g to use tokens {...} now for 2.6.0 (new feature). + * + * Version 1.13 (Apr 23, 1999) + * Didn't have (stat)? for else clause in tree parser. + * Didn't gen ASTs for interface extends. Updated tree parser too. + * Updated to 2.6.0. + * Version 1.14 (Jun 20, 1999) + * Allowed final/abstract on local classes. + * Removed local interfaces from methods + * Put instanceof precedence where it belongs...in relationalExpr + * It also had expr not type as arg; fixed it. + * Missing ! on SEMI in classBlock + * fixed: (expr) + "string" was parsed incorrectly (+ as unary plus). + * fixed: didn't like Object[].class in parser or tree parser + * Version 1.15 (Jun 26, 1999) + * Screwed up rule with instanceof in it. :( Fixed. + * Tree parser didn't like (expr).something; fixed. + * Allowed multiple inheritance in tree grammar. oops. + * Version 1.16 (August 22, 1999) + * Extending an interface built a wacky tree: had extra EXTENDS. + * Tree grammar didn't allow multiple superinterfaces. + * Tree grammar didn't allow empty var initializer: {} + * Version 1.17 (October 12, 1999) + * ESC lexer rule allowed 399 max not 377 max. + * java.tree.g didn't handle the expression of synchronized + * statements. + * Version 1.18 (August 12, 2001) + * Terence updated to Java 2 Version 1.3 by + * observing/combining work of Allan Jacobs and Steve + * Messick. Handles 1.3 src. Summary: + * o primary didn't include boolean.class kind of thing + * o constructor calls parsed explicitly now: + * see explicitConstructorInvocation + * o add strictfp modifier + * o missing objBlock after new expression in tree grammar + * o merged local class definition alternatives, moved after declaration + * o fixed problem with ClassName.super.field + * o reordered some alternatives to make things more efficient + * o long and double constants were not differentiated from int/float + * o whitespace rule was inefficient: matched only one char + * o add an examples directory with some nasty 1.3 cases + * o made Main.java use buffered IO and a Reader for Unicode support + * o supports UNICODE? + * Using Unicode charVocabulay makes code file big, but only + * in the bitsets at the end. I need to make ANTLR generate + * unicode bitsets more efficiently. + * Version 1.19 (April 25, 2002) + * Terence added in nice fixes by John Pybus concerning floating + * constants and problems with super() calls. John did a nice + * reorg of the primary/postfix expression stuff to read better + * and makes f.g.super() parse properly (it was METHOD_CALL not + * a SUPER_CTOR_CALL). Also: + * + * o "finally" clause was a root...made it a child of "try" + * o Added stuff for asserts too for Java 1.4, but *commented out* + * as it is not backward compatible. + * + * Version 1.20 (October 27, 2002) + * + * Terence ended up reorging John Pybus' stuff to + * remove some nondeterminisms and some syntactic predicates. + * Note that the grammar is stricter now; e.g., this(...) must + * be the first statement. + * + * Trinary ?: operator wasn't working as array name: + * (isBig ? bigDigits : digits)[i]; + * + * Checked parser/tree parser on source for + * Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4, + * and the 110k-line jGuru server source. + * + * Version tracking now done with following ID: + * + * $Id$ + * + * This grammar is in the PUBLIC DOMAIN + */ +class CUSTOM_API JavaRecognizer : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public JavaTokenTypes +{ +#line 154 "java.g" + +private: + Driver* m_driver; + +public: + void setDriver( Driver* d ) { m_driver = d; } + void setFileName( const TQString& fileName ) { m_driver->currentFileName() = fileName; } + + void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(ex.getMessage().c_str()), ex.getLine(), ex.getColumn()) ); + } + + void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(errorMessage.c_str()), LT(1)->getLine(), LT(1)->getColumn()) ); + } + + void reportMessage( const ANTLR_USE_NAMESPACE(std)string& message ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(message.c_str()), LT(1)->getLine(), LT(1)->getColumn()) ); + } +#line 142 "JavaRecognizer.h" +public: + void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); +protected: + JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); +public: + JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); +protected: + JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); +public: + JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); + JavaRecognizer(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); + int getNumTokens() const + { + return JavaRecognizer::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return JavaRecognizer::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return JavaRecognizer::tokenNames; + } + public: void compilationUnit(); + public: void packageDefinition(); + public: void importDefinition(); + public: void typeDefinition(); + public: void identifier(); + public: void identifierStar(); + public: void modifiers(); + public: void classDefinition( + RefJavaAST modifiers + ); + public: void interfaceDefinition( + RefJavaAST modifiers + ); + public: void declaration(); + public: void typeSpec( + bool addImagNode + ); + public: void variableDefinitions( + RefJavaAST mods, RefJavaAST t + ); + public: void classTypeSpec( + bool addImagNode + ); + public: void builtInTypeSpec( + bool addImagNode + ); + public: void builtInType(); + public: void type(); + public: void modifier(); + public: void superClassClause(); + public: void implementsClause(); + public: void classBlock(); + public: void interfaceExtends(); + public: void field(); + public: void ctorHead(); + public: void constructorBody(); + public: void parameterDeclarationList(); + public: void declaratorBrackets( + RefJavaAST typ + ); + public: void throwsClause(); + public: void compoundStatement(); + public: void explicitConstructorInvocation(); + public: void statement(); + public: void argList(); + public: void variableDeclarator( + RefJavaAST mods, RefJavaAST t + ); + public: void varInitializer(); + public: void initializer(); + public: void arrayInitializer(); + public: void expression(); + public: void parameterDeclaration(); + public: void parameterModifier(); + public: void forInit(); + public: void forCond(); + public: void forIter(); + public: void casesGroup(); + public: void tryBlock(); + public: void aCase(); + public: void caseSList(); + public: void expressionList(); + public: void handler(); + public: void finallyClause(); + public: void assignmentExpression(); + public: void conditionalExpression(); + public: void logicalOrExpression(); + public: void logicalAndExpression(); + public: void inclusiveOrExpression(); + public: void exclusiveOrExpression(); + public: void andExpression(); + public: void equalityExpression(); + public: void relationalExpression(); + public: void shiftExpression(); + public: void additiveExpression(); + public: void multiplicativeExpression(); + public: void unaryExpression(); + public: void unaryExpressionNotPlusMinus(); + public: void postfixExpression(); + public: void primaryExpression(); + public: void newExpression(); + public: void identPrimary(); + public: void constant(); + public: void newArrayDeclarator(); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefJavaAST returnAST; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 152; +#else + enum { + NUM_TOKENS = 152 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; + static const unsigned long _tokenSet_5_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; + static const unsigned long _tokenSet_6_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; + static const unsigned long _tokenSet_7_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; + static const unsigned long _tokenSet_8_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; + static const unsigned long _tokenSet_9_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; + static const unsigned long _tokenSet_10_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10; + static const unsigned long _tokenSet_11_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11; + static const unsigned long _tokenSet_12_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12; + static const unsigned long _tokenSet_13_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13; + static const unsigned long _tokenSet_14_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14; + static const unsigned long _tokenSet_15_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_15; + static const unsigned long _tokenSet_16_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_16; + static const unsigned long _tokenSet_17_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_17; + static const unsigned long _tokenSet_18_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_18; + static const unsigned long _tokenSet_19_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_19; + static const unsigned long _tokenSet_20_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_20; + static const unsigned long _tokenSet_21_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_21; + static const unsigned long _tokenSet_22_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_22; + static const unsigned long _tokenSet_23_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_23; + static const unsigned long _tokenSet_24_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_24; + static const unsigned long _tokenSet_25_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_25; + static const unsigned long _tokenSet_26_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_26; + static const unsigned long _tokenSet_27_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_27; + static const unsigned long _tokenSet_28_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_28; + static const unsigned long _tokenSet_29_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_29; + static const unsigned long _tokenSet_30_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_30; + static const unsigned long _tokenSet_31_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_31; + static const unsigned long _tokenSet_32_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_32; + static const unsigned long _tokenSet_33_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_33; + static const unsigned long _tokenSet_34_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_34; + static const unsigned long _tokenSet_35_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_35; + static const unsigned long _tokenSet_36_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_36; + static const unsigned long _tokenSet_37_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_37; + static const unsigned long _tokenSet_38_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_38; + static const unsigned long _tokenSet_39_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_39; + static const unsigned long _tokenSet_40_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_40; + static const unsigned long _tokenSet_41_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_41; + static const unsigned long _tokenSet_42_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_42; + static const unsigned long _tokenSet_43_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_43; + static const unsigned long _tokenSet_44_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_44; + static const unsigned long _tokenSet_45_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_45; + static const unsigned long _tokenSet_46_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_46; + static const unsigned long _tokenSet_47_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_47; + static const unsigned long _tokenSet_48_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_48; + static const unsigned long _tokenSet_49_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_49; + static const unsigned long _tokenSet_50_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_50; + static const unsigned long _tokenSet_51_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_51; + static const unsigned long _tokenSet_52_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_52; + static const unsigned long _tokenSet_53_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_53; + static const unsigned long _tokenSet_54_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_54; + static const unsigned long _tokenSet_55_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_55; + static const unsigned long _tokenSet_56_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_56; + static const unsigned long _tokenSet_57_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_57; + static const unsigned long _tokenSet_58_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_58; + static const unsigned long _tokenSet_59_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_59; + static const unsigned long _tokenSet_60_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_60; + static const unsigned long _tokenSet_61_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_61; + static const unsigned long _tokenSet_62_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_62; + static const unsigned long _tokenSet_63_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_63; + static const unsigned long _tokenSet_64_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_64; + static const unsigned long _tokenSet_65_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_65; + static const unsigned long _tokenSet_66_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_66; +}; + +#endif /*INC_JavaRecognizer_h_*/ diff --git a/languages/java/JavaRecognizer.hpp b/languages/java/JavaRecognizer.hpp deleted file mode 100644 index fab59972..00000000 --- a/languages/java/JavaRecognizer.hpp +++ /dev/null @@ -1,423 +0,0 @@ -#ifndef INC_JavaRecognizer_hpp_ -#define INC_JavaRecognizer_hpp_ - -#line 2 "java.g" - - #include "driver.h" - #include "JavaAST.hpp" - - #include - #include - - #define SET_POSITION(ast,t)\ - { \ - RefJavaAST(ast)->setLine( t->getLine() );\ - RefJavaAST(ast)->setColumn( t->getColumn() ); \ - } - -#line 19 "JavaRecognizer.hpp" -#include -/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaRecognizer.hpp"$ */ -#include -#include -#include "JavaTokenTypes.hpp" -#include - -/** Java 1.3 Recognizer - * - * Run 'java Main [-showtree] directory-full-of-java-files' - * - * [The -showtree option pops up a Swing frame that shows - * the AST constructed from the parser.] - * - * Run 'java Main ' - * - * Contributing authors: - * John Mitchell johnm@non.net - * Terence Parr parrt@magelang.com - * John Lilley jlilley@empathy.com - * Scott Stanchfield thetick@magelang.com - * Markus Mohnen mohnen@informatik.rwth-aachen.de - * Peter Williams pete.williams@sun.com - * Allan Jacobs Allan.Jacobs@eng.sun.com - * Steve Messick messick@redhills.com - * John Pybus john@pybus.org - * - * Version 1.00 December 9, 1997 -- initial release - * Version 1.01 December 10, 1997 - * fixed bug in octal def (0..7 not 0..8) - * Version 1.10 August 1998 (parrt) - * added tree construction - * fixed definition of WS,comments for mac,pc,unix newlines - * added unary plus - * Version 1.11 (Nov 20, 1998) - * Added "shutup" option to turn off last ambig warning. - * Fixed inner class def to allow named class defs as statements - * synchronized requires compound not simple statement - * add [] after builtInType DOT class in primaryExpression - * "const" is reserved but not valid..removed from modifiers - * Version 1.12 (Feb 2, 1999) - * Changed LITERAL_xxx to xxx in tree grammar. - * Updated java.g to use tokens {...} now for 2.6.0 (new feature). - * - * Version 1.13 (Apr 23, 1999) - * Didn't have (stat)? for else clause in tree parser. - * Didn't gen ASTs for interface extends. Updated tree parser too. - * Updated to 2.6.0. - * Version 1.14 (Jun 20, 1999) - * Allowed final/abstract on local classes. - * Removed local interfaces from methods - * Put instanceof precedence where it belongs...in relationalExpr - * It also had expr not type as arg; fixed it. - * Missing ! on SEMI in classBlock - * fixed: (expr) + "string" was parsed incorrectly (+ as unary plus). - * fixed: didn't like Object[].class in parser or tree parser - * Version 1.15 (Jun 26, 1999) - * Screwed up rule with instanceof in it. :( Fixed. - * Tree parser didn't like (expr).something; fixed. - * Allowed multiple inheritance in tree grammar. oops. - * Version 1.16 (August 22, 1999) - * Extending an interface built a wacky tree: had extra EXTENDS. - * Tree grammar didn't allow multiple superinterfaces. - * Tree grammar didn't allow empty var initializer: {} - * Version 1.17 (October 12, 1999) - * ESC lexer rule allowed 399 max not 377 max. - * java.tree.g didn't handle the expression of synchronized - * statements. - * Version 1.18 (August 12, 2001) - * Terence updated to Java 2 Version 1.3 by - * observing/combining work of Allan Jacobs and Steve - * Messick. Handles 1.3 src. Summary: - * o primary didn't include boolean.class kind of thing - * o constructor calls parsed explicitly now: - * see explicitConstructorInvocation - * o add strictfp modifier - * o missing objBlock after new expression in tree grammar - * o merged local class definition alternatives, moved after declaration - * o fixed problem with ClassName.super.field - * o reordered some alternatives to make things more efficient - * o long and double constants were not differentiated from int/float - * o whitespace rule was inefficient: matched only one char - * o add an examples directory with some nasty 1.3 cases - * o made Main.java use buffered IO and a Reader for Unicode support - * o supports UNICODE? - * Using Unicode charVocabulay makes code file big, but only - * in the bitsets at the end. I need to make ANTLR generate - * unicode bitsets more efficiently. - * Version 1.19 (April 25, 2002) - * Terence added in nice fixes by John Pybus concerning floating - * constants and problems with super() calls. John did a nice - * reorg of the primary/postfix expression stuff to read better - * and makes f.g.super() parse properly (it was METHOD_CALL not - * a SUPER_CTOR_CALL). Also: - * - * o "finally" clause was a root...made it a child of "try" - * o Added stuff for asserts too for Java 1.4, but *commented out* - * as it is not backward compatible. - * - * Version 1.20 (October 27, 2002) - * - * Terence ended up reorging John Pybus' stuff to - * remove some nondeterminisms and some syntactic predicates. - * Note that the grammar is stricter now; e.g., this(...) must - * be the first statement. - * - * Trinary ?: operator wasn't working as array name: - * (isBig ? bigDigits : digits)[i]; - * - * Checked parser/tree parser on source for - * Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4, - * and the 110k-line jGuru server source. - * - * Version tracking now done with following ID: - * - * $Id$ - * - * This grammar is in the PUBLIC DOMAIN - */ -class CUSTOM_API JavaRecognizer : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public JavaTokenTypes -{ -#line 154 "java.g" - -private: - Driver* m_driver; - -public: - void setDriver( Driver* d ) { m_driver = d; } - void setFileName( const TQString& fileName ) { m_driver->currentFileName() = fileName; } - - void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ - m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(ex.getMessage().c_str()), ex.getLine(), ex.getColumn()) ); - } - - void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ - m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(errorMessage.c_str()), LT(1)->getLine(), LT(1)->getColumn()) ); - } - - void reportMessage( const ANTLR_USE_NAMESPACE(std)string& message ){ - m_driver->addProblem( m_driver->currentFileName(), Problem( TQString::fromLocal8Bit(message.c_str()), LT(1)->getLine(), LT(1)->getColumn()) ); - } -#line 142 "JavaRecognizer.hpp" -public: - void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); -protected: - JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); -public: - JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); -protected: - JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); -public: - JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); - JavaRecognizer(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); - int getNumTokens() const - { - return JavaRecognizer::NUM_TOKENS; - } - const char* getTokenName( int type ) const - { - if( type > getNumTokens() ) return 0; - return JavaRecognizer::tokenNames[type]; - } - const char* const* getTokenNames() const - { - return JavaRecognizer::tokenNames; - } - public: void compilationUnit(); - public: void packageDefinition(); - public: void importDefinition(); - public: void typeDefinition(); - public: void identifier(); - public: void identifierStar(); - public: void modifiers(); - public: void classDefinition( - RefJavaAST modifiers - ); - public: void interfaceDefinition( - RefJavaAST modifiers - ); - public: void declaration(); - public: void typeSpec( - bool addImagNode - ); - public: void variableDefinitions( - RefJavaAST mods, RefJavaAST t - ); - public: void classTypeSpec( - bool addImagNode - ); - public: void builtInTypeSpec( - bool addImagNode - ); - public: void builtInType(); - public: void type(); - public: void modifier(); - public: void superClassClause(); - public: void implementsClause(); - public: void classBlock(); - public: void interfaceExtends(); - public: void field(); - public: void ctorHead(); - public: void constructorBody(); - public: void parameterDeclarationList(); - public: void declaratorBrackets( - RefJavaAST typ - ); - public: void throwsClause(); - public: void compoundStatement(); - public: void explicitConstructorInvocation(); - public: void statement(); - public: void argList(); - public: void variableDeclarator( - RefJavaAST mods, RefJavaAST t - ); - public: void varInitializer(); - public: void initializer(); - public: void arrayInitializer(); - public: void expression(); - public: void parameterDeclaration(); - public: void parameterModifier(); - public: void forInit(); - public: void forCond(); - public: void forIter(); - public: void casesGroup(); - public: void tryBlock(); - public: void aCase(); - public: void caseSList(); - public: void expressionList(); - public: void handler(); - public: void finallyClause(); - public: void assignmentExpression(); - public: void conditionalExpression(); - public: void logicalOrExpression(); - public: void logicalAndExpression(); - public: void inclusiveOrExpression(); - public: void exclusiveOrExpression(); - public: void andExpression(); - public: void equalityExpression(); - public: void relationalExpression(); - public: void shiftExpression(); - public: void additiveExpression(); - public: void multiplicativeExpression(); - public: void unaryExpression(); - public: void unaryExpressionNotPlusMinus(); - public: void postfixExpression(); - public: void primaryExpression(); - public: void newExpression(); - public: void identPrimary(); - public: void constant(); - public: void newArrayDeclarator(); -public: - ANTLR_USE_NAMESPACE(antlr)RefAST getAST() - { - return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); - } - -protected: - RefJavaAST returnAST; -private: - static const char* tokenNames[]; -#ifndef NO_STATIC_CONSTS - static const int NUM_TOKENS = 152; -#else - enum { - NUM_TOKENS = 152 - }; -#endif - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; - static const unsigned long _tokenSet_4_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; - static const unsigned long _tokenSet_5_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; - static const unsigned long _tokenSet_6_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; - static const unsigned long _tokenSet_7_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; - static const unsigned long _tokenSet_8_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; - static const unsigned long _tokenSet_9_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; - static const unsigned long _tokenSet_10_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10; - static const unsigned long _tokenSet_11_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11; - static const unsigned long _tokenSet_12_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12; - static const unsigned long _tokenSet_13_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13; - static const unsigned long _tokenSet_14_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14; - static const unsigned long _tokenSet_15_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_15; - static const unsigned long _tokenSet_16_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_16; - static const unsigned long _tokenSet_17_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_17; - static const unsigned long _tokenSet_18_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_18; - static const unsigned long _tokenSet_19_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_19; - static const unsigned long _tokenSet_20_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_20; - static const unsigned long _tokenSet_21_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_21; - static const unsigned long _tokenSet_22_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_22; - static const unsigned long _tokenSet_23_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_23; - static const unsigned long _tokenSet_24_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_24; - static const unsigned long _tokenSet_25_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_25; - static const unsigned long _tokenSet_26_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_26; - static const unsigned long _tokenSet_27_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_27; - static const unsigned long _tokenSet_28_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_28; - static const unsigned long _tokenSet_29_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_29; - static const unsigned long _tokenSet_30_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_30; - static const unsigned long _tokenSet_31_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_31; - static const unsigned long _tokenSet_32_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_32; - static const unsigned long _tokenSet_33_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_33; - static const unsigned long _tokenSet_34_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_34; - static const unsigned long _tokenSet_35_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_35; - static const unsigned long _tokenSet_36_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_36; - static const unsigned long _tokenSet_37_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_37; - static const unsigned long _tokenSet_38_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_38; - static const unsigned long _tokenSet_39_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_39; - static const unsigned long _tokenSet_40_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_40; - static const unsigned long _tokenSet_41_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_41; - static const unsigned long _tokenSet_42_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_42; - static const unsigned long _tokenSet_43_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_43; - static const unsigned long _tokenSet_44_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_44; - static const unsigned long _tokenSet_45_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_45; - static const unsigned long _tokenSet_46_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_46; - static const unsigned long _tokenSet_47_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_47; - static const unsigned long _tokenSet_48_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_48; - static const unsigned long _tokenSet_49_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_49; - static const unsigned long _tokenSet_50_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_50; - static const unsigned long _tokenSet_51_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_51; - static const unsigned long _tokenSet_52_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_52; - static const unsigned long _tokenSet_53_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_53; - static const unsigned long _tokenSet_54_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_54; - static const unsigned long _tokenSet_55_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_55; - static const unsigned long _tokenSet_56_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_56; - static const unsigned long _tokenSet_57_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_57; - static const unsigned long _tokenSet_58_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_58; - static const unsigned long _tokenSet_59_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_59; - static const unsigned long _tokenSet_60_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_60; - static const unsigned long _tokenSet_61_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_61; - static const unsigned long _tokenSet_62_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_62; - static const unsigned long _tokenSet_63_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_63; - static const unsigned long _tokenSet_64_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_64; - static const unsigned long _tokenSet_65_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_65; - static const unsigned long _tokenSet_66_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_66; -}; - -#endif /*INC_JavaRecognizer_hpp_*/ diff --git a/languages/java/JavaStoreWalker.cpp b/languages/java/JavaStoreWalker.cpp index 1bdb9522..763f95e7 100644 --- a/languages/java/JavaStoreWalker.cpp +++ b/languages/java/JavaStoreWalker.cpp @@ -1,11 +1,11 @@ /* $ANTLR 2.7.7 (20061129): "java.store.g" -> "JavaStoreWalker.cpp"$ */ -#include "JavaStoreWalker.hpp" -#include -#include -#include -#include -#include -#include +#include "JavaStoreWalker.h" +#include +#include +#include +#include +#include +#include #line 1 "java.store.g" #line 11 "JavaStoreWalker.cpp" JavaStoreWalker::JavaStoreWalker() diff --git a/languages/java/JavaStoreWalker.h b/languages/java/JavaStoreWalker.h new file mode 100644 index 00000000..244c0978 --- /dev/null +++ b/languages/java/JavaStoreWalker.h @@ -0,0 +1,164 @@ +#ifndef INC_JavaStoreWalker_h_ +#define INC_JavaStoreWalker_h_ + +#line 3 "java.store.g" + + #include + #include "JavaAST.h" + + #include + #include + #include + #include + +#line 15 "JavaStoreWalker.h" +#include +#include "JavaStoreWalkerTokenTypes.h" +/* $ANTLR 2.7.7 (20061129): "java.store.g" -> "JavaStoreWalker.h"$ */ +#include + +#line 13 "java.store.g" + + #include + + #include + +#line 27 "JavaStoreWalker.h" +/** Java 1.2 AST Recognizer Grammar + * + * Author: + * Terence Parr parrt@magelang.com + * + * Version tracking now done with following ID: + * + * $Id$ + * + * This grammar is in the PUBLIC DOMAIN + * + * BUGS + */ +class CUSTOM_API JavaStoreWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public JavaStoreWalkerTokenTypes +{ +#line 43 "java.store.g" + +private: + TQStringList m_currentScope; + CodeModel* m_model; + FileDom m_file; + TQValueStack m_currentClass; + int m_currentAccess; + int m_anon; + ANTLR_USE_NAMESPACE(antlr)JavaASTFactory ast_factory; + +public: + void setCodeModel( CodeModel* model ) + { + m_model = model; + } + + void setFile( FileDom file ) + { + m_file = file; + } + + void init() + { + m_currentScope.clear(); + m_currentAccess = CodeModelItem::Public; + m_anon = 0; + + initializeASTFactory (ast_factory); + setASTFactory (&ast_factory); + } +#line 44 "JavaStoreWalker.h" +public: + JavaStoreWalker(); + static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); + int getNumTokens() const + { + return JavaStoreWalker::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return JavaStoreWalker::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return JavaStoreWalker::tokenNames; + } + public: void compilationUnit(RefJavaAST _t); + public: TQString packageDefinition(RefJavaAST _t); + public: TQString importDefinition(RefJavaAST _t); + public: void typeDefinition(RefJavaAST _t); + public: TQString identifier(RefJavaAST _t); + public: TQString identifierStar(RefJavaAST _t); + public: TQStringList modifiers(RefJavaAST _t); + public: TQStringList extendsClause(RefJavaAST _t); + public: TQStringList implementsClause(RefJavaAST _t); + public: void objBlock(RefJavaAST _t, + ClassDom klass + ); + public: void interfaceBlock(RefJavaAST _t, + ClassDom klass + ); + public: TQString typeSpec(RefJavaAST _t); + public: TQString typeSpecArray(RefJavaAST _t); + public: TQString type(RefJavaAST _t); + public: void builtInType(RefJavaAST _t); + public: void modifier(RefJavaAST _t); + public: FunctionDom methodDecl(RefJavaAST _t); + public: VariableDom variableDef(RefJavaAST _t); + public: FunctionDom ctorDef(RefJavaAST _t); + public: FunctionDom methodDef(RefJavaAST _t); + public: void slist(RefJavaAST _t); + public: void methodHead(RefJavaAST _t, + FunctionDom meth + ); + public: void variableDeclarator(RefJavaAST _t, + VariableDom attr + ); + public: void varInitializer(RefJavaAST _t); + public: ArgumentDom parameterDef(RefJavaAST _t); + public: void objectinitializer(RefJavaAST _t); + public: void initializer(RefJavaAST _t); + public: void expression(RefJavaAST _t); + public: void arrayInitializer(RefJavaAST _t); + public: void throwsClause(RefJavaAST _t); + public: void stat(RefJavaAST _t); + public: void elist(RefJavaAST _t); + public: void caseGroup(RefJavaAST _t); + public: void tryBlock(RefJavaAST _t); + public: void handler(RefJavaAST _t); + public: void expr(RefJavaAST _t); + public: void primaryExpression(RefJavaAST _t); + public: void arrayIndex(RefJavaAST _t); + public: void newExpression(RefJavaAST _t); + public: void constant(RefJavaAST _t); + public: void newArrayDeclarator(RefJavaAST _t); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefJavaAST returnAST; + RefJavaAST _retTree; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 153; +#else + enum { + NUM_TOKENS = 153 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; +}; + +#endif /*INC_JavaStoreWalker_h_*/ diff --git a/languages/java/JavaStoreWalker.hpp b/languages/java/JavaStoreWalker.hpp deleted file mode 100644 index 676163ad..00000000 --- a/languages/java/JavaStoreWalker.hpp +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef INC_JavaStoreWalker_hpp_ -#define INC_JavaStoreWalker_hpp_ - -#line 3 "java.store.g" - - #include - #include "JavaAST.hpp" - - #include - #include - #include - #include - -#line 15 "JavaStoreWalker.hpp" -#include -#include "JavaStoreWalkerTokenTypes.hpp" -/* $ANTLR 2.7.7 (20061129): "java.store.g" -> "JavaStoreWalker.hpp"$ */ -#include - -#line 13 "java.store.g" - - #include - - #include - -#line 27 "JavaStoreWalker.hpp" -/** Java 1.2 AST Recognizer Grammar - * - * Author: - * Terence Parr parrt@magelang.com - * - * Version tracking now done with following ID: - * - * $Id$ - * - * This grammar is in the PUBLIC DOMAIN - * - * BUGS - */ -class CUSTOM_API JavaStoreWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public JavaStoreWalkerTokenTypes -{ -#line 43 "java.store.g" - -private: - TQStringList m_currentScope; - CodeModel* m_model; - FileDom m_file; - TQValueStack m_currentClass; - int m_currentAccess; - int m_anon; - ANTLR_USE_NAMESPACE(antlr)JavaASTFactory ast_factory; - -public: - void setCodeModel( CodeModel* model ) - { - m_model = model; - } - - void setFile( FileDom file ) - { - m_file = file; - } - - void init() - { - m_currentScope.clear(); - m_currentAccess = CodeModelItem::Public; - m_anon = 0; - - initializeASTFactory (ast_factory); - setASTFactory (&ast_factory); - } -#line 44 "JavaStoreWalker.hpp" -public: - JavaStoreWalker(); - static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); - int getNumTokens() const - { - return JavaStoreWalker::NUM_TOKENS; - } - const char* getTokenName( int type ) const - { - if( type > getNumTokens() ) return 0; - return JavaStoreWalker::tokenNames[type]; - } - const char* const* getTokenNames() const - { - return JavaStoreWalker::tokenNames; - } - public: void compilationUnit(RefJavaAST _t); - public: TQString packageDefinition(RefJavaAST _t); - public: TQString importDefinition(RefJavaAST _t); - public: void typeDefinition(RefJavaAST _t); - public: TQString identifier(RefJavaAST _t); - public: TQString identifierStar(RefJavaAST _t); - public: TQStringList modifiers(RefJavaAST _t); - public: TQStringList extendsClause(RefJavaAST _t); - public: TQStringList implementsClause(RefJavaAST _t); - public: void objBlock(RefJavaAST _t, - ClassDom klass - ); - public: void interfaceBlock(RefJavaAST _t, - ClassDom klass - ); - public: TQString typeSpec(RefJavaAST _t); - public: TQString typeSpecArray(RefJavaAST _t); - public: TQString type(RefJavaAST _t); - public: void builtInType(RefJavaAST _t); - public: void modifier(RefJavaAST _t); - public: FunctionDom methodDecl(RefJavaAST _t); - public: VariableDom variableDef(RefJavaAST _t); - public: FunctionDom ctorDef(RefJavaAST _t); - public: FunctionDom methodDef(RefJavaAST _t); - public: void slist(RefJavaAST _t); - public: void methodHead(RefJavaAST _t, - FunctionDom meth - ); - public: void variableDeclarator(RefJavaAST _t, - VariableDom attr - ); - public: void varInitializer(RefJavaAST _t); - public: ArgumentDom parameterDef(RefJavaAST _t); - public: void objectinitializer(RefJavaAST _t); - public: void initializer(RefJavaAST _t); - public: void expression(RefJavaAST _t); - public: void arrayInitializer(RefJavaAST _t); - public: void throwsClause(RefJavaAST _t); - public: void stat(RefJavaAST _t); - public: void elist(RefJavaAST _t); - public: void caseGroup(RefJavaAST _t); - public: void tryBlock(RefJavaAST _t); - public: void handler(RefJavaAST _t); - public: void expr(RefJavaAST _t); - public: void primaryExpression(RefJavaAST _t); - public: void arrayIndex(RefJavaAST _t); - public: void newExpression(RefJavaAST _t); - public: void constant(RefJavaAST _t); - public: void newArrayDeclarator(RefJavaAST _t); -public: - ANTLR_USE_NAMESPACE(antlr)RefAST getAST() - { - return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); - } - -protected: - RefJavaAST returnAST; - RefJavaAST _retTree; -private: - static const char* tokenNames[]; -#ifndef NO_STATIC_CONSTS - static const int NUM_TOKENS = 153; -#else - enum { - NUM_TOKENS = 153 - }; -#endif - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; -}; - -#endif /*INC_JavaStoreWalker_hpp_*/ diff --git a/languages/java/JavaStoreWalkerTokenTypes.h b/languages/java/JavaStoreWalkerTokenTypes.h new file mode 100644 index 00000000..d8a07893 --- /dev/null +++ b/languages/java/JavaStoreWalkerTokenTypes.h @@ -0,0 +1,169 @@ +#ifndef INC_JavaStoreWalkerTokenTypes_h_ +#define INC_JavaStoreWalkerTokenTypes_h_ + +/* $ANTLR 2.7.7 (20061129): "java.store.g" -> "JavaStoreWalkerTokenTypes.h"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API JavaStoreWalkerTokenTypes { +#endif + enum { + EOF_ = 1, + BLOCK = 4, + MODIFIERS = 5, + OBJBLOCK = 6, + SLIST = 7, + CTOR_DEF = 8, + METHOD_DEF = 9, + VARIABLE_DEF = 10, + INSTANCE_INIT = 11, + STATIC_INIT = 12, + TYPE = 13, + CLASS_DEF = 14, + INTERFACE_DEF = 15, + PACKAGE_DEF = 16, + ARRAY_DECLARATOR = 17, + EXTENDS_CLAUSE = 18, + IMPLEMENTS_CLAUSE = 19, + PARAMETERS = 20, + PARAMETER_DEF = 21, + LABELED_STAT = 22, + TYPECAST = 23, + INDEX_OP = 24, + POST_INC = 25, + POST_DEC = 26, + METHOD_CALL = 27, + EXPR = 28, + ARRAY_INIT = 29, + IMPORT = 30, + UNARY_MINUS = 31, + UNARY_PLUS = 32, + CASE_GROUP = 33, + ELIST = 34, + FOR_INIT = 35, + FOR_CONDITION = 36, + FOR_ITERATOR = 37, + EMPTY_STAT = 38, + FINAL = 39, + ABSTRACT = 40, + STRICTFP = 41, + SUPER_CTOR_CALL = 42, + CTOR_CALL = 43, + LITERAL_package = 44, + SEMI = 45, + LITERAL_import = 46, + LBRACK = 47, + RBRACK = 48, + LITERAL_void = 49, + LITERAL_boolean = 50, + LITERAL_byte = 51, + LITERAL_char = 52, + LITERAL_short = 53, + LITERAL_int = 54, + LITERAL_float = 55, + LITERAL_long = 56, + LITERAL_double = 57, + IDENT = 58, + DOT = 59, + STAR = 60, + LITERAL_private = 61, + LITERAL_public = 62, + LITERAL_protected = 63, + LITERAL_static = 64, + LITERAL_transient = 65, + LITERAL_native = 66, + LITERAL_threadsafe = 67, + LITERAL_synchronized = 68, + LITERAL_volatile = 69, + LITERAL_class = 70, + LITERAL_extends = 71, + LITERAL_interface = 72, + LCURLY = 73, + RCURLY = 74, + COMMA = 75, + LITERAL_implements = 76, + LPAREN = 77, + RPAREN = 78, + LITERAL_this = 79, + LITERAL_super = 80, + ASSIGN = 81, + LITERAL_throws = 82, + COLON = 83, + LITERAL_if = 84, + LITERAL_else = 85, + LITERAL_for = 86, + LITERAL_while = 87, + LITERAL_do = 88, + LITERAL_break = 89, + LITERAL_continue = 90, + LITERAL_return = 91, + LITERAL_switch = 92, + LITERAL_throw = 93, + LITERAL_case = 94, + LITERAL_default = 95, + LITERAL_try = 96, + LITERAL_finally = 97, + LITERAL_catch = 98, + PLUS_ASSIGN = 99, + MINUS_ASSIGN = 100, + STAR_ASSIGN = 101, + DIV_ASSIGN = 102, + MOD_ASSIGN = 103, + SR_ASSIGN = 104, + BSR_ASSIGN = 105, + SL_ASSIGN = 106, + BAND_ASSIGN = 107, + BXOR_ASSIGN = 108, + BOR_ASSIGN = 109, + QUESTION = 110, + LOR = 111, + LAND = 112, + BOR = 113, + BXOR = 114, + BAND = 115, + NOT_EQUAL = 116, + EQUAL = 117, + LT_ = 118, + GT = 119, + LE = 120, + GE = 121, + LITERAL_instanceof = 122, + SL = 123, + SR = 124, + BSR = 125, + PLUS = 126, + MINUS = 127, + DIV = 128, + MOD = 129, + INC = 130, + DEC = 131, + BNOT = 132, + LNOT = 133, + LITERAL_true = 134, + LITERAL_false = 135, + LITERAL_null = 136, + LITERAL_new = 137, + NUM_INT = 138, + CHAR_LITERAL = 139, + STRING_LITERAL = 140, + NUM_FLOAT = 141, + NUM_LONG = 142, + NUM_DOUBLE = 143, + WS = 144, + SL_COMMENT = 145, + ML_COMMENT = 146, + ESC = 147, + HEX_DIGIT = 148, + VOCAB = 149, + EXPONENT = 150, + FLOAT_SUFFIX = 151, + LITERAL_const = 152, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_JavaStoreWalkerTokenTypes_h_*/ diff --git a/languages/java/JavaStoreWalkerTokenTypes.hpp b/languages/java/JavaStoreWalkerTokenTypes.hpp deleted file mode 100644 index 44322944..00000000 --- a/languages/java/JavaStoreWalkerTokenTypes.hpp +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef INC_JavaStoreWalkerTokenTypes_hpp_ -#define INC_JavaStoreWalkerTokenTypes_hpp_ - -/* $ANTLR 2.7.7 (20061129): "java.store.g" -> "JavaStoreWalkerTokenTypes.hpp"$ */ - -#ifndef CUSTOM_API -# define CUSTOM_API -#endif - -#ifdef __cplusplus -struct CUSTOM_API JavaStoreWalkerTokenTypes { -#endif - enum { - EOF_ = 1, - BLOCK = 4, - MODIFIERS = 5, - OBJBLOCK = 6, - SLIST = 7, - CTOR_DEF = 8, - METHOD_DEF = 9, - VARIABLE_DEF = 10, - INSTANCE_INIT = 11, - STATIC_INIT = 12, - TYPE = 13, - CLASS_DEF = 14, - INTERFACE_DEF = 15, - PACKAGE_DEF = 16, - ARRAY_DECLARATOR = 17, - EXTENDS_CLAUSE = 18, - IMPLEMENTS_CLAUSE = 19, - PARAMETERS = 20, - PARAMETER_DEF = 21, - LABELED_STAT = 22, - TYPECAST = 23, - INDEX_OP = 24, - POST_INC = 25, - POST_DEC = 26, - METHOD_CALL = 27, - EXPR = 28, - ARRAY_INIT = 29, - IMPORT = 30, - UNARY_MINUS = 31, - UNARY_PLUS = 32, - CASE_GROUP = 33, - ELIST = 34, - FOR_INIT = 35, - FOR_CONDITION = 36, - FOR_ITERATOR = 37, - EMPTY_STAT = 38, - FINAL = 39, - ABSTRACT = 40, - STRICTFP = 41, - SUPER_CTOR_CALL = 42, - CTOR_CALL = 43, - LITERAL_package = 44, - SEMI = 45, - LITERAL_import = 46, - LBRACK = 47, - RBRACK = 48, - LITERAL_void = 49, - LITERAL_boolean = 50, - LITERAL_byte = 51, - LITERAL_char = 52, - LITERAL_short = 53, - LITERAL_int = 54, - LITERAL_float = 55, - LITERAL_long = 56, - LITERAL_double = 57, - IDENT = 58, - DOT = 59, - STAR = 60, - LITERAL_private = 61, - LITERAL_public = 62, - LITERAL_protected = 63, - LITERAL_static = 64, - LITERAL_transient = 65, - LITERAL_native = 66, - LITERAL_threadsafe = 67, - LITERAL_synchronized = 68, - LITERAL_volatile = 69, - LITERAL_class = 70, - LITERAL_extends = 71, - LITERAL_interface = 72, - LCURLY = 73, - RCURLY = 74, - COMMA = 75, - LITERAL_implements = 76, - LPAREN = 77, - RPAREN = 78, - LITERAL_this = 79, - LITERAL_super = 80, - ASSIGN = 81, - LITERAL_throws = 82, - COLON = 83, - LITERAL_if = 84, - LITERAL_else = 85, - LITERAL_for = 86, - LITERAL_while = 87, - LITERAL_do = 88, - LITERAL_break = 89, - LITERAL_continue = 90, - LITERAL_return = 91, - LITERAL_switch = 92, - LITERAL_throw = 93, - LITERAL_case = 94, - LITERAL_default = 95, - LITERAL_try = 96, - LITERAL_finally = 97, - LITERAL_catch = 98, - PLUS_ASSIGN = 99, - MINUS_ASSIGN = 100, - STAR_ASSIGN = 101, - DIV_ASSIGN = 102, - MOD_ASSIGN = 103, - SR_ASSIGN = 104, - BSR_ASSIGN = 105, - SL_ASSIGN = 106, - BAND_ASSIGN = 107, - BXOR_ASSIGN = 108, - BOR_ASSIGN = 109, - QUESTION = 110, - LOR = 111, - LAND = 112, - BOR = 113, - BXOR = 114, - BAND = 115, - NOT_EQUAL = 116, - EQUAL = 117, - LT_ = 118, - GT = 119, - LE = 120, - GE = 121, - LITERAL_instanceof = 122, - SL = 123, - SR = 124, - BSR = 125, - PLUS = 126, - MINUS = 127, - DIV = 128, - MOD = 129, - INC = 130, - DEC = 131, - BNOT = 132, - LNOT = 133, - LITERAL_true = 134, - LITERAL_false = 135, - LITERAL_null = 136, - LITERAL_new = 137, - NUM_INT = 138, - CHAR_LITERAL = 139, - STRING_LITERAL = 140, - NUM_FLOAT = 141, - NUM_LONG = 142, - NUM_DOUBLE = 143, - WS = 144, - SL_COMMENT = 145, - ML_COMMENT = 146, - ESC = 147, - HEX_DIGIT = 148, - VOCAB = 149, - EXPONENT = 150, - FLOAT_SUFFIX = 151, - LITERAL_const = 152, - NULL_TREE_LOOKAHEAD = 3 - }; -#ifdef __cplusplus -}; -#endif -#endif /*INC_JavaStoreWalkerTokenTypes_hpp_*/ diff --git a/languages/java/JavaTokenTypes.h b/languages/java/JavaTokenTypes.h new file mode 100644 index 00000000..8689c5ef --- /dev/null +++ b/languages/java/JavaTokenTypes.h @@ -0,0 +1,168 @@ +#ifndef INC_JavaTokenTypes_h_ +#define INC_JavaTokenTypes_h_ + +/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaTokenTypes.h"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API JavaTokenTypes { +#endif + enum { + EOF_ = 1, + BLOCK = 4, + MODIFIERS = 5, + OBJBLOCK = 6, + SLIST = 7, + CTOR_DEF = 8, + METHOD_DEF = 9, + VARIABLE_DEF = 10, + INSTANCE_INIT = 11, + STATIC_INIT = 12, + TYPE = 13, + CLASS_DEF = 14, + INTERFACE_DEF = 15, + PACKAGE_DEF = 16, + ARRAY_DECLARATOR = 17, + EXTENDS_CLAUSE = 18, + IMPLEMENTS_CLAUSE = 19, + PARAMETERS = 20, + PARAMETER_DEF = 21, + LABELED_STAT = 22, + TYPECAST = 23, + INDEX_OP = 24, + POST_INC = 25, + POST_DEC = 26, + METHOD_CALL = 27, + EXPR = 28, + ARRAY_INIT = 29, + IMPORT = 30, + UNARY_MINUS = 31, + UNARY_PLUS = 32, + CASE_GROUP = 33, + ELIST = 34, + FOR_INIT = 35, + FOR_CONDITION = 36, + FOR_ITERATOR = 37, + EMPTY_STAT = 38, + FINAL = 39, + ABSTRACT = 40, + STRICTFP = 41, + SUPER_CTOR_CALL = 42, + CTOR_CALL = 43, + LITERAL_package = 44, + SEMI = 45, + LITERAL_import = 46, + LBRACK = 47, + RBRACK = 48, + LITERAL_void = 49, + LITERAL_boolean = 50, + LITERAL_byte = 51, + LITERAL_char = 52, + LITERAL_short = 53, + LITERAL_int = 54, + LITERAL_float = 55, + LITERAL_long = 56, + LITERAL_double = 57, + IDENT = 58, + DOT = 59, + STAR = 60, + LITERAL_private = 61, + LITERAL_public = 62, + LITERAL_protected = 63, + LITERAL_static = 64, + LITERAL_transient = 65, + LITERAL_native = 66, + LITERAL_threadsafe = 67, + LITERAL_synchronized = 68, + LITERAL_volatile = 69, + LITERAL_class = 70, + LITERAL_extends = 71, + LITERAL_interface = 72, + LCURLY = 73, + RCURLY = 74, + COMMA = 75, + LITERAL_implements = 76, + LPAREN = 77, + RPAREN = 78, + LITERAL_this = 79, + LITERAL_super = 80, + ASSIGN = 81, + LITERAL_throws = 82, + COLON = 83, + LITERAL_if = 84, + LITERAL_else = 85, + LITERAL_for = 86, + LITERAL_while = 87, + LITERAL_do = 88, + LITERAL_break = 89, + LITERAL_continue = 90, + LITERAL_return = 91, + LITERAL_switch = 92, + LITERAL_throw = 93, + LITERAL_case = 94, + LITERAL_default = 95, + LITERAL_try = 96, + LITERAL_finally = 97, + LITERAL_catch = 98, + PLUS_ASSIGN = 99, + MINUS_ASSIGN = 100, + STAR_ASSIGN = 101, + DIV_ASSIGN = 102, + MOD_ASSIGN = 103, + SR_ASSIGN = 104, + BSR_ASSIGN = 105, + SL_ASSIGN = 106, + BAND_ASSIGN = 107, + BXOR_ASSIGN = 108, + BOR_ASSIGN = 109, + QUESTION = 110, + LOR = 111, + LAND = 112, + BOR = 113, + BXOR = 114, + BAND = 115, + NOT_EQUAL = 116, + EQUAL = 117, + LT_ = 118, + GT = 119, + LE = 120, + GE = 121, + LITERAL_instanceof = 122, + SL = 123, + SR = 124, + BSR = 125, + PLUS = 126, + MINUS = 127, + DIV = 128, + MOD = 129, + INC = 130, + DEC = 131, + BNOT = 132, + LNOT = 133, + LITERAL_true = 134, + LITERAL_false = 135, + LITERAL_null = 136, + LITERAL_new = 137, + NUM_INT = 138, + CHAR_LITERAL = 139, + STRING_LITERAL = 140, + NUM_FLOAT = 141, + NUM_LONG = 142, + NUM_DOUBLE = 143, + WS = 144, + SL_COMMENT = 145, + ML_COMMENT = 146, + ESC = 147, + HEX_DIGIT = 148, + VOCAB = 149, + EXPONENT = 150, + FLOAT_SUFFIX = 151, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_JavaTokenTypes_h_*/ diff --git a/languages/java/JavaTokenTypes.hpp b/languages/java/JavaTokenTypes.hpp deleted file mode 100644 index e36fa54c..00000000 --- a/languages/java/JavaTokenTypes.hpp +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef INC_JavaTokenTypes_hpp_ -#define INC_JavaTokenTypes_hpp_ - -/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaTokenTypes.hpp"$ */ - -#ifndef CUSTOM_API -# define CUSTOM_API -#endif - -#ifdef __cplusplus -struct CUSTOM_API JavaTokenTypes { -#endif - enum { - EOF_ = 1, - BLOCK = 4, - MODIFIERS = 5, - OBJBLOCK = 6, - SLIST = 7, - CTOR_DEF = 8, - METHOD_DEF = 9, - VARIABLE_DEF = 10, - INSTANCE_INIT = 11, - STATIC_INIT = 12, - TYPE = 13, - CLASS_DEF = 14, - INTERFACE_DEF = 15, - PACKAGE_DEF = 16, - ARRAY_DECLARATOR = 17, - EXTENDS_CLAUSE = 18, - IMPLEMENTS_CLAUSE = 19, - PARAMETERS = 20, - PARAMETER_DEF = 21, - LABELED_STAT = 22, - TYPECAST = 23, - INDEX_OP = 24, - POST_INC = 25, - POST_DEC = 26, - METHOD_CALL = 27, - EXPR = 28, - ARRAY_INIT = 29, - IMPORT = 30, - UNARY_MINUS = 31, - UNARY_PLUS = 32, - CASE_GROUP = 33, - ELIST = 34, - FOR_INIT = 35, - FOR_CONDITION = 36, - FOR_ITERATOR = 37, - EMPTY_STAT = 38, - FINAL = 39, - ABSTRACT = 40, - STRICTFP = 41, - SUPER_CTOR_CALL = 42, - CTOR_CALL = 43, - LITERAL_package = 44, - SEMI = 45, - LITERAL_import = 46, - LBRACK = 47, - RBRACK = 48, - LITERAL_void = 49, - LITERAL_boolean = 50, - LITERAL_byte = 51, - LITERAL_char = 52, - LITERAL_short = 53, - LITERAL_int = 54, - LITERAL_float = 55, - LITERAL_long = 56, - LITERAL_double = 57, - IDENT = 58, - DOT = 59, - STAR = 60, - LITERAL_private = 61, - LITERAL_public = 62, - LITERAL_protected = 63, - LITERAL_static = 64, - LITERAL_transient = 65, - LITERAL_native = 66, - LITERAL_threadsafe = 67, - LITERAL_synchronized = 68, - LITERAL_volatile = 69, - LITERAL_class = 70, - LITERAL_extends = 71, - LITERAL_interface = 72, - LCURLY = 73, - RCURLY = 74, - COMMA = 75, - LITERAL_implements = 76, - LPAREN = 77, - RPAREN = 78, - LITERAL_this = 79, - LITERAL_super = 80, - ASSIGN = 81, - LITERAL_throws = 82, - COLON = 83, - LITERAL_if = 84, - LITERAL_else = 85, - LITERAL_for = 86, - LITERAL_while = 87, - LITERAL_do = 88, - LITERAL_break = 89, - LITERAL_continue = 90, - LITERAL_return = 91, - LITERAL_switch = 92, - LITERAL_throw = 93, - LITERAL_case = 94, - LITERAL_default = 95, - LITERAL_try = 96, - LITERAL_finally = 97, - LITERAL_catch = 98, - PLUS_ASSIGN = 99, - MINUS_ASSIGN = 100, - STAR_ASSIGN = 101, - DIV_ASSIGN = 102, - MOD_ASSIGN = 103, - SR_ASSIGN = 104, - BSR_ASSIGN = 105, - SL_ASSIGN = 106, - BAND_ASSIGN = 107, - BXOR_ASSIGN = 108, - BOR_ASSIGN = 109, - QUESTION = 110, - LOR = 111, - LAND = 112, - BOR = 113, - BXOR = 114, - BAND = 115, - NOT_EQUAL = 116, - EQUAL = 117, - LT_ = 118, - GT = 119, - LE = 120, - GE = 121, - LITERAL_instanceof = 122, - SL = 123, - SR = 124, - BSR = 125, - PLUS = 126, - MINUS = 127, - DIV = 128, - MOD = 129, - INC = 130, - DEC = 131, - BNOT = 132, - LNOT = 133, - LITERAL_true = 134, - LITERAL_false = 135, - LITERAL_null = 136, - LITERAL_new = 137, - NUM_INT = 138, - CHAR_LITERAL = 139, - STRING_LITERAL = 140, - NUM_FLOAT = 141, - NUM_LONG = 142, - NUM_DOUBLE = 143, - WS = 144, - SL_COMMENT = 145, - ML_COMMENT = 146, - ESC = 147, - HEX_DIGIT = 148, - VOCAB = 149, - EXPONENT = 150, - FLOAT_SUFFIX = 151, - NULL_TREE_LOOKAHEAD = 3 - }; -#ifdef __cplusplus -}; -#endif -#endif /*INC_JavaTokenTypes_hpp_*/ diff --git a/languages/java/Makefile.am b/languages/java/Makefile.am index a1a1e812..f4a05f62 100644 --- a/languages/java/Makefile.am +++ b/languages/java/Makefile.am @@ -22,10 +22,10 @@ JavaStoreWalker.cpp javasupport_utils.cpp problemreporter.cpp driver.cpp kdevdri EXTRA_DIST = java.g java.tree.g java.store.g -#JavaLexer.hpp JavaLexer.cpp JavaRecognizer.hpp JavaRecognizer.cpp: # java.g +#JavaLexer.h JavaLexer.cpp JavaRecognizer.h JavaRecognizer.cpp: # java.g # antlr java.g -#JavaStoreWalker.hpp JavaStoreWalker.cpp: # java.store.g +#JavaStoreWalker.h JavaStoreWalker.cpp: # java.store.g # antlr java.store.g METASOURCES = AUTO diff --git a/languages/java/backgroundparser.h b/languages/java/backgroundparser.h index fee2bc78..4823cf43 100644 --- a/languages/java/backgroundparser.h +++ b/languages/java/backgroundparser.h @@ -13,7 +13,7 @@ #define BACKGROUNDPARSER_H #include "driver.h" -#include "JavaAST.hpp" +#include "JavaAST.h" #include #include diff --git a/languages/java/driver.cpp b/languages/java/driver.cpp index c22bc9ce..3fbcd07b 100644 --- a/languages/java/driver.cpp +++ b/languages/java/driver.cpp @@ -17,9 +17,9 @@ Boston, MA 02110-1301, USA. */ -#include "JavaAST.hpp" -#include "JavaLexer.hpp" -#include "JavaRecognizer.hpp" +#include "JavaAST.h" +#include "JavaLexer.h" +#include "JavaRecognizer.h" #include #include diff --git a/languages/java/driver.h b/languages/java/driver.h index def7e400..3575ccfb 100644 --- a/languages/java/driver.h +++ b/languages/java/driver.h @@ -20,7 +20,7 @@ #ifndef DRIVER_H #define DRIVER_H -#include "JavaAST.hpp" +#include "JavaAST.h" #include #include diff --git a/languages/java/java.g b/languages/java/java.g index 1f825ec5..4228a573 100644 --- a/languages/java/java.g +++ b/languages/java/java.g @@ -1,7 +1,7 @@ header "pre_include_hpp" { #include "driver.h" - #include "JavaAST.hpp" + #include "JavaAST.h" #include #include diff --git a/languages/java/java.store.g b/languages/java/java.store.g index b69b7323..cc545c64 100644 --- a/languages/java/java.store.g +++ b/languages/java/java.store.g @@ -2,7 +2,7 @@ header "pre_include_hpp" { #include - #include "JavaAST.hpp" + #include "JavaAST.h" #include #include diff --git a/languages/java/javasupportpart.cpp b/languages/java/javasupportpart.cpp index f9bbbd88..50571ba6 100644 --- a/languages/java/javasupportpart.cpp +++ b/languages/java/javasupportpart.cpp @@ -23,8 +23,8 @@ #include "kdevdriver.h" #include "javasupport_utils.h" -#include "JavaStoreWalker.hpp" -#include "JavaAST.hpp" +#include "JavaStoreWalker.h" +#include "JavaAST.h" #include #include diff --git a/languages/java/kdevdriver.cpp b/languages/java/kdevdriver.cpp index d19a20c3..d3cffb68 100644 --- a/languages/java/kdevdriver.cpp +++ b/languages/java/kdevdriver.cpp @@ -1,6 +1,6 @@ #include "kdevdriver.h" -#include "JavaLexer.hpp" +#include "JavaLexer.h" #include #include diff --git a/languages/pascal/Makefile.am b/languages/pascal/Makefile.am index 9d168734..5d4b3513 100644 --- a/languages/pascal/Makefile.am +++ b/languages/pascal/Makefile.am @@ -23,10 +23,10 @@ genparser: antlr pascal.g && antlr pascal.tree.g ## The following rules assume that you have Java and ANTLR installed, -#PascalLexer.hpp PascalLexer.cpp PascalParser.hpp PascalParser.cpp: pascal.g +#PascalLexer.h PascalLexer.cpp PascalParser.h PascalParser.cpp: pascal.g # antlr pascal.g -#PascalStoreWalker.hpp PascalStoreWalker.cpp: pascal.tree.g +#PascalStoreWalker.h PascalStoreWalker.cpp: pascal.tree.g # antlr pascal.tree.g templatedir = ${kde_datadir}/kdevabbrev/templates diff --git a/languages/pascal/PascalAST.h b/languages/pascal/PascalAST.h new file mode 100644 index 00000000..1e3df014 --- /dev/null +++ b/languages/pascal/PascalAST.h @@ -0,0 +1,51 @@ +#ifndef PASCALAST_HPP +#define PASCALAST_HPP + +#include + +class PascalAST; +typedef antlr::ASTRefCount RefPascalAST; + +class PascalAST : public antlr::CommonAST { +public: + PascalAST() + : m_line(0), m_column(0) {} + + ~PascalAST() {} + + int getLine() const { return m_line; } + void setLine( int line ) { m_line = line; } + + int getColumn() const { return m_column; } + void setColumn( int column ) { m_column = column; } + + void initialize( antlr::RefToken t ) { + antlr::CommonAST::initialize(t); + m_line = t->getLine() - 1; + m_column = t->getColumn() - 1; + } + + void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt) { + setType(t); + setText(txt); + m_line = 0; + m_column = 0; + } + + void addChild( RefPascalAST c ) { + antlr::RefAST n( c.get() ); + antlr::BaseAST::addChild( n ); + } + + static antlr::RefAST factory( void ) { + RefPascalAST n(new PascalAST); + return n.get(); + } + +private: + int m_line; + int m_column; +}; + + +#endif diff --git a/languages/pascal/PascalAST.hpp b/languages/pascal/PascalAST.hpp deleted file mode 100644 index 3df4ea50..00000000 --- a/languages/pascal/PascalAST.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef PASCALAST_HPP -#define PASCALAST_HPP - -#include - -class PascalAST; -typedef antlr::ASTRefCount RefPascalAST; - -class PascalAST : public antlr::CommonAST { -public: - PascalAST() - : m_line(0), m_column(0) {} - - ~PascalAST() {} - - int getLine() const { return m_line; } - void setLine( int line ) { m_line = line; } - - int getColumn() const { return m_column; } - void setColumn( int column ) { m_column = column; } - - void initialize( antlr::RefToken t ) { - antlr::CommonAST::initialize(t); - m_line = t->getLine() - 1; - m_column = t->getColumn() - 1; - } - - void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt) { - setType(t); - setText(txt); - m_line = 0; - m_column = 0; - } - - void addChild( RefPascalAST c ) { - antlr::RefAST n( c.get() ); - antlr::BaseAST::addChild( n ); - } - - static antlr::RefAST factory( void ) { - RefPascalAST n(new PascalAST); - return n.get(); - } - -private: - int m_line; - int m_column; -}; - - -#endif diff --git a/languages/pascal/PascalLexer.cpp b/languages/pascal/PascalLexer.cpp index 28f532f8..c140ee51 100644 --- a/languages/pascal/PascalLexer.cpp +++ b/languages/pascal/PascalLexer.cpp @@ -1,12 +1,12 @@ /* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalLexer.cpp"$ */ -#include "PascalLexer.hpp" -#include -#include -#include -#include -#include -#include -#include +#include "PascalLexer.h" +#include +#include +#include +#include +#include +#include +#include #line 1 "pascal.g" #line 13 "PascalLexer.cpp" diff --git a/languages/pascal/PascalLexer.h b/languages/pascal/PascalLexer.h new file mode 100644 index 00000000..e2043c2f --- /dev/null +++ b/languages/pascal/PascalLexer.h @@ -0,0 +1,121 @@ +#ifndef INC_PascalLexer_h_ +#define INC_PascalLexer_h_ + +#line 29 "pascal.g" + + #include "problemreporter.h" + #include "PascalAST.h" + + #include + #include + + #define SET_POSITION(ast,t)\ + { \ + RefPascalAST(ast)->setLine( t->getLine() );\ + RefPascalAST(ast)->setColumn( t->getColumn() ); \ + } + +#line 19 "PascalLexer.h" +#include +/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalLexer.h"$ */ +#include +#include +#include +#include "PascalTokenTypes.h" +#include +class CUSTOM_API PascalLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public PascalTokenTypes +{ +#line 1067 "pascal.g" + +private: + ProblemReporter* m_problemReporter; + unsigned int m_numberOfErrors; + +public: + void resetErrors() { m_numberOfErrors = 0; } + unsigned int numberOfErrors() const { return m_numberOfErrors; } + void setProblemReporter( ProblemReporter* r ) { m_problemReporter = r; } + + virtual void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_problemReporter->reportError( ex.getMessage().c_str(), + ex.getFilename().c_str(), + ex.getLine(), + ex.getColumn() ); + ++m_numberOfErrors; + } + + virtual void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_problemReporter->reportError( errorMessage.c_str(), + getFilename().c_str(), + getLine(), getColumn() ); + ++m_numberOfErrors; + } + + virtual void reportWarning( const ANTLR_USE_NAMESPACE(std)string& warnMessage ){ + m_problemReporter->reportWarning( warnMessage.c_str(), + getFilename().c_str(), + getLine(), getColumn() ); + } +#line 30 "PascalLexer.h" +private: + void initLiterals(); +public: + bool getCaseSensitiveLiterals() const + { + return false; + } +public: + PascalLexer(ANTLR_USE_NAMESPACE(std)istream& in); + PascalLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); + PascalLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); + ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); + public: void mPLUS(bool _createToken); + public: void mMINUS(bool _createToken); + public: void mSTAR(bool _createToken); + public: void mSLASH(bool _createToken); + public: void mASSIGN(bool _createToken); + public: void mCOMMA(bool _createToken); + public: void mSEMI(bool _createToken); + public: void mCOLON(bool _createToken); + public: void mEQUAL(bool _createToken); + public: void mNOT_EQUAL(bool _createToken); + public: void mLTH(bool _createToken); + public: void mLE(bool _createToken); + public: void mGE(bool _createToken); + public: void mGT(bool _createToken); + public: void mLPAREN(bool _createToken); + public: void mRPAREN(bool _createToken); + public: void mLBRACK(bool _createToken); + public: void mLBRACK2(bool _createToken); + public: void mRBRACK(bool _createToken); + public: void mRBRACK2(bool _createToken); + public: void mPOINTER(bool _createToken); + public: void mAT(bool _createToken); + public: void mDOT(bool _createToken); + public: void mLCURLY(bool _createToken); + public: void mRCURLY(bool _createToken); + public: void mPLUSEQ(bool _createToken); + public: void mMINUSEQ(bool _createToken); + public: void mSTAREQ(bool _createToken); + public: void mSLASHQE(bool _createToken); + public: void mWS(bool _createToken); + public: void mCOMMENT_1(bool _createToken); + public: void mCOMMENT_2(bool _createToken); + public: void mCOMMENT_3(bool _createToken); + public: void mIDENT(bool _createToken); + public: void mSTRING_LITERAL(bool _createToken); + public: void mNUM_INT(bool _createToken); + protected: void mEXPONENT(bool _createToken); +private: + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; +}; + +#endif /*INC_PascalLexer_h_*/ diff --git a/languages/pascal/PascalLexer.hpp b/languages/pascal/PascalLexer.hpp deleted file mode 100644 index 99a14959..00000000 --- a/languages/pascal/PascalLexer.hpp +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef INC_PascalLexer_hpp_ -#define INC_PascalLexer_hpp_ - -#line 29 "pascal.g" - - #include "problemreporter.h" - #include "PascalAST.hpp" - - #include - #include - - #define SET_POSITION(ast,t)\ - { \ - RefPascalAST(ast)->setLine( t->getLine() );\ - RefPascalAST(ast)->setColumn( t->getColumn() ); \ - } - -#line 19 "PascalLexer.hpp" -#include -/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalLexer.hpp"$ */ -#include -#include -#include -#include "PascalTokenTypes.hpp" -#include -class CUSTOM_API PascalLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public PascalTokenTypes -{ -#line 1067 "pascal.g" - -private: - ProblemReporter* m_problemReporter; - unsigned int m_numberOfErrors; - -public: - void resetErrors() { m_numberOfErrors = 0; } - unsigned int numberOfErrors() const { return m_numberOfErrors; } - void setProblemReporter( ProblemReporter* r ) { m_problemReporter = r; } - - virtual void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ - m_problemReporter->reportError( ex.getMessage().c_str(), - ex.getFilename().c_str(), - ex.getLine(), - ex.getColumn() ); - ++m_numberOfErrors; - } - - virtual void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ - m_problemReporter->reportError( errorMessage.c_str(), - getFilename().c_str(), - getLine(), getColumn() ); - ++m_numberOfErrors; - } - - virtual void reportWarning( const ANTLR_USE_NAMESPACE(std)string& warnMessage ){ - m_problemReporter->reportWarning( warnMessage.c_str(), - getFilename().c_str(), - getLine(), getColumn() ); - } -#line 30 "PascalLexer.hpp" -private: - void initLiterals(); -public: - bool getCaseSensitiveLiterals() const - { - return false; - } -public: - PascalLexer(ANTLR_USE_NAMESPACE(std)istream& in); - PascalLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); - PascalLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); - ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); - public: void mPLUS(bool _createToken); - public: void mMINUS(bool _createToken); - public: void mSTAR(bool _createToken); - public: void mSLASH(bool _createToken); - public: void mASSIGN(bool _createToken); - public: void mCOMMA(bool _createToken); - public: void mSEMI(bool _createToken); - public: void mCOLON(bool _createToken); - public: void mEQUAL(bool _createToken); - public: void mNOT_EQUAL(bool _createToken); - public: void mLTH(bool _createToken); - public: void mLE(bool _createToken); - public: void mGE(bool _createToken); - public: void mGT(bool _createToken); - public: void mLPAREN(bool _createToken); - public: void mRPAREN(bool _createToken); - public: void mLBRACK(bool _createToken); - public: void mLBRACK2(bool _createToken); - public: void mRBRACK(bool _createToken); - public: void mRBRACK2(bool _createToken); - public: void mPOINTER(bool _createToken); - public: void mAT(bool _createToken); - public: void mDOT(bool _createToken); - public: void mLCURLY(bool _createToken); - public: void mRCURLY(bool _createToken); - public: void mPLUSEQ(bool _createToken); - public: void mMINUSEQ(bool _createToken); - public: void mSTAREQ(bool _createToken); - public: void mSLASHQE(bool _createToken); - public: void mWS(bool _createToken); - public: void mCOMMENT_1(bool _createToken); - public: void mCOMMENT_2(bool _createToken); - public: void mCOMMENT_3(bool _createToken); - public: void mIDENT(bool _createToken); - public: void mSTRING_LITERAL(bool _createToken); - public: void mNUM_INT(bool _createToken); - protected: void mEXPONENT(bool _createToken); -private: - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; -}; - -#endif /*INC_PascalLexer_hpp_*/ diff --git a/languages/pascal/PascalParser.cpp b/languages/pascal/PascalParser.cpp index 51d620ff..e45cdb4e 100644 --- a/languages/pascal/PascalParser.cpp +++ b/languages/pascal/PascalParser.cpp @@ -1,8 +1,8 @@ /* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalParser.cpp"$ */ -#include "PascalParser.hpp" -#include -#include -#include +#include "PascalParser.h" +#include +#include +#include #line 1 "pascal.g" #line 8 "PascalParser.cpp" PascalParser::PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k) diff --git a/languages/pascal/PascalParser.h b/languages/pascal/PascalParser.h new file mode 100644 index 00000000..19cbc397 --- /dev/null +++ b/languages/pascal/PascalParser.h @@ -0,0 +1,422 @@ +#ifndef INC_PascalParser_h_ +#define INC_PascalParser_h_ + +#line 29 "pascal.g" + + #include "problemreporter.h" + #include "PascalAST.h" + + #include + #include + + #define SET_POSITION(ast,t)\ + { \ + RefPascalAST(ast)->setLine( t->getLine() );\ + RefPascalAST(ast)->setColumn( t->getColumn() ); \ + } + +#line 19 "PascalParser.h" +#include +/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalParser.h"$ */ +#include +#include +#include "PascalTokenTypes.h" +#include + +class CUSTOM_API PascalParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public PascalTokenTypes +{ +#line 90 "pascal.g" + +private: + unsigned int m_numberOfErrors; + ProblemReporter* m_problemReporter; + +public: + void resetErrors() { m_numberOfErrors = 0; } + unsigned int numberOfErrors() const { return m_numberOfErrors; } + void setProblemReporter( ProblemReporter* r ) { m_problemReporter = r; } + + void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_problemReporter->reportError( ex.getMessage().c_str(), + ex.getFilename().c_str(), + ex.getLine(), + ex.getColumn() ); + ++m_numberOfErrors; + } + + void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_problemReporter->reportError( errorMessage.c_str(), + getFilename().c_str(), + LT(1)->getLine(), + LT(1)->getColumn() ); + ++m_numberOfErrors; + } + + void reportMessage( const ANTLR_USE_NAMESPACE(std)string& message ){ + m_problemReporter->reportMessage( message.c_str(), + getFilename().c_str(), + LT(1)->getLine(), + LT(1)->getColumn() ); + } +#line 30 "PascalParser.h" +public: + void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); +protected: + PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); +public: + PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); +protected: + PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); +public: + PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); + PascalParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); + int getNumTokens() const + { + return PascalParser::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return PascalParser::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return PascalParser::tokenNames; + } + public: void compilationUnit(); + public: void program(); + public: void library(); + public: void unit(); + public: void programHeading(); + public: void usesClause(); + public: void block(); + public: void identifier(); + public: void libraryBlock(); + public: void exportsClause(); + public: void declarationPart(); + public: void statementPart(); + public: void exportsList(); + public: void exportsEntry(); + public: void integerConstant(); + public: void stringConstant(); + public: void identifierList(); + public: void interfacePart(); + public: void implementationPart(); + public: void initializationPart(); + public: void finalizationPart(); + public: void realizationPart(); + public: void constantDeclarationPart(); + public: void typeDeclarationPart(); + public: void procedureHeadersPart(); + public: void statement(); + public: void labelDeclarationPart(); + public: void resourcestringDeclarationPart(); + public: void variableDeclarationPart(); + public: void procedureAndFunctionDeclarationPart(); + public: void label(); + public: void constantDeclaration(); + public: void typedConstantDeclaration(); + public: void stringConstantDeclaration(); + public: void string(); + public: void typeDeclaration(); + public: void variableDeclaration(); + public: void type(); + public: void procedureAndFunctionDeclaration(); + public: void procedureDeclaration(); + public: void functionDeclaration(); + public: void constructorDeclaration(); + public: void destructorDeclaration(); + public: void compoundStatement(); + public: void procedureHeader(); + public: void subroutineBlock(); + public: void functionHeader(); + public: void qualifiedMethodIdentifier(); + public: void formalParameterList(); + public: void modifiers(); + public: void externalDirective(); + public: void functionHeaderEnding(); + public: void parameterDeclaration(); + public: void valueParameter(); + public: void variableParameter(); + public: void constantParameter(); + public: void untypedParameterPart(); + public: void callModifiers(); + public: void expression(); + public: void typedConstant(); + public: void constant(); + public: void recordConstant(); + public: void arrayConstant(); + public: void proceduralConstant(); + public: void addressConstant(); + public: void simpleType(); + public: void subrangeTypeOrTypeIdentifier(); + public: void enumeratedType(); + public: void stringType(); + public: void structuredType(); + public: void pointerType(); + public: void proceduralType(); + public: void ordinalType(); + public: void realType(); + public: void typeIdentifier(); + public: void subrangeType(); + public: void assignedEnumList(); + public: void unsignedInteger(); + public: void arrayType(); + public: void recordType(); + public: void objectType(); + public: void classType(); + public: void setType(); + public: void fileType(); + public: void arrayIndexType(); + public: void arraySubrangeType(); + public: void fieldList(); + public: void fixedField(); + public: void variantPart(); + public: void variant(); + public: void proceduralTypePart1(); + public: void heritage(); + public: void componentList(); + public: void objectVisibilitySpecifier(); + public: void fieldDefinition(); + public: void methodDefinition(); + public: void constructorHeader(); + public: void destructorHeader(); + public: void methodDirectives(); + public: void classComponentList(); + public: void classVisibilitySpecifier(); + public: void classMethodDefinition(); + public: void propertyDefinition(); + public: void classMethodDirectives(); + public: void directiveVariants(); + public: void propertyInterface(); + public: void propertySpecifiers(); + public: void propertyParameterList(); + public: void readSpecifier(); + public: void writeSpecifier(); + public: void defaultSpecifier(); + public: void fieldOrMethod(); + public: void simpleExpression(); + public: void expressionSign(); + public: void term(); + public: void factor(); + public: void identifierOrValueTypecastOrFunctionCall(); + public: void unsignedConstant(); + public: void setConstructor(); + public: void addressFactor(); + public: void expressions(); + public: void functionCall(); + public: void actualParameterList(); + public: void setGroup(); + public: void valueTypecast(); + public: void simpleStatement(); + public: void structuredStatement(); + public: void assignmentStatement(); + public: void procedureStatement(); + public: void gotoStatement(); + public: void raiseStatement(); + public: void identifierOrArrayIdentifier(); + public: void assignmentOperator(); + public: void repetitiveStatement(); + public: void conditionalStatement(); + public: void exceptionStatement(); + public: void withStatement(); + public: void ifStatement(); + public: void caseStatement(); + public: void forStatement(); + public: void repeatStatement(); + public: void whileStatement(); + public: void caseListElement(); + public: void constList(); + public: void forList(); + public: void initialValue(); + public: void finalValue(); + public: void recordVariableList(); + public: void variable(); + public: void operatorDefinition(); + public: void assignmentOperatorDefinition(); + public: void arithmeticOperatorDefinition(); + public: void comparisonOperatorDefinition(); + public: void tryStatement(); + public: void statements(); + public: void exceptOrFinallyPart(); + public: void exceptionHandlers(); + public: void exceptionHandler(); + public: void sign(); + public: void constantChr(); + public: void unsignedNumber(); + public: void unsignedReal(); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefPascalAST returnAST; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 190; +#else + enum { + NUM_TOKENS = 190 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; + static const unsigned long _tokenSet_5_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; + static const unsigned long _tokenSet_6_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; + static const unsigned long _tokenSet_7_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; + static const unsigned long _tokenSet_8_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; + static const unsigned long _tokenSet_9_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; + static const unsigned long _tokenSet_10_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10; + static const unsigned long _tokenSet_11_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11; + static const unsigned long _tokenSet_12_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12; + static const unsigned long _tokenSet_13_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13; + static const unsigned long _tokenSet_14_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14; + static const unsigned long _tokenSet_15_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_15; + static const unsigned long _tokenSet_16_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_16; + static const unsigned long _tokenSet_17_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_17; + static const unsigned long _tokenSet_18_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_18; + static const unsigned long _tokenSet_19_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_19; + static const unsigned long _tokenSet_20_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_20; + static const unsigned long _tokenSet_21_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_21; + static const unsigned long _tokenSet_22_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_22; + static const unsigned long _tokenSet_23_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_23; + static const unsigned long _tokenSet_24_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_24; + static const unsigned long _tokenSet_25_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_25; + static const unsigned long _tokenSet_26_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_26; + static const unsigned long _tokenSet_27_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_27; + static const unsigned long _tokenSet_28_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_28; + static const unsigned long _tokenSet_29_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_29; + static const unsigned long _tokenSet_30_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_30; + static const unsigned long _tokenSet_31_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_31; + static const unsigned long _tokenSet_32_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_32; + static const unsigned long _tokenSet_33_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_33; + static const unsigned long _tokenSet_34_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_34; + static const unsigned long _tokenSet_35_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_35; + static const unsigned long _tokenSet_36_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_36; + static const unsigned long _tokenSet_37_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_37; + static const unsigned long _tokenSet_38_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_38; + static const unsigned long _tokenSet_39_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_39; + static const unsigned long _tokenSet_40_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_40; + static const unsigned long _tokenSet_41_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_41; + static const unsigned long _tokenSet_42_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_42; + static const unsigned long _tokenSet_43_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_43; + static const unsigned long _tokenSet_44_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_44; + static const unsigned long _tokenSet_45_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_45; + static const unsigned long _tokenSet_46_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_46; + static const unsigned long _tokenSet_47_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_47; + static const unsigned long _tokenSet_48_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_48; + static const unsigned long _tokenSet_49_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_49; + static const unsigned long _tokenSet_50_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_50; + static const unsigned long _tokenSet_51_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_51; + static const unsigned long _tokenSet_52_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_52; + static const unsigned long _tokenSet_53_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_53; + static const unsigned long _tokenSet_54_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_54; + static const unsigned long _tokenSet_55_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_55; + static const unsigned long _tokenSet_56_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_56; + static const unsigned long _tokenSet_57_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_57; + static const unsigned long _tokenSet_58_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_58; + static const unsigned long _tokenSet_59_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_59; + static const unsigned long _tokenSet_60_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_60; + static const unsigned long _tokenSet_61_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_61; + static const unsigned long _tokenSet_62_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_62; + static const unsigned long _tokenSet_63_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_63; + static const unsigned long _tokenSet_64_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_64; + static const unsigned long _tokenSet_65_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_65; + static const unsigned long _tokenSet_66_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_66; + static const unsigned long _tokenSet_67_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_67; + static const unsigned long _tokenSet_68_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_68; + static const unsigned long _tokenSet_69_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_69; + static const unsigned long _tokenSet_70_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_70; + static const unsigned long _tokenSet_71_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_71; + static const unsigned long _tokenSet_72_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_72; + static const unsigned long _tokenSet_73_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_73; + static const unsigned long _tokenSet_74_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_74; + static const unsigned long _tokenSet_75_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_75; + static const unsigned long _tokenSet_76_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_76; +}; + +#endif /*INC_PascalParser_h_*/ diff --git a/languages/pascal/PascalParser.hpp b/languages/pascal/PascalParser.hpp deleted file mode 100644 index dfd4e5f2..00000000 --- a/languages/pascal/PascalParser.hpp +++ /dev/null @@ -1,422 +0,0 @@ -#ifndef INC_PascalParser_hpp_ -#define INC_PascalParser_hpp_ - -#line 29 "pascal.g" - - #include "problemreporter.h" - #include "PascalAST.hpp" - - #include - #include - - #define SET_POSITION(ast,t)\ - { \ - RefPascalAST(ast)->setLine( t->getLine() );\ - RefPascalAST(ast)->setColumn( t->getColumn() ); \ - } - -#line 19 "PascalParser.hpp" -#include -/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalParser.hpp"$ */ -#include -#include -#include "PascalTokenTypes.hpp" -#include - -class CUSTOM_API PascalParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public PascalTokenTypes -{ -#line 90 "pascal.g" - -private: - unsigned int m_numberOfErrors; - ProblemReporter* m_problemReporter; - -public: - void resetErrors() { m_numberOfErrors = 0; } - unsigned int numberOfErrors() const { return m_numberOfErrors; } - void setProblemReporter( ProblemReporter* r ) { m_problemReporter = r; } - - void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ - m_problemReporter->reportError( ex.getMessage().c_str(), - ex.getFilename().c_str(), - ex.getLine(), - ex.getColumn() ); - ++m_numberOfErrors; - } - - void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ - m_problemReporter->reportError( errorMessage.c_str(), - getFilename().c_str(), - LT(1)->getLine(), - LT(1)->getColumn() ); - ++m_numberOfErrors; - } - - void reportMessage( const ANTLR_USE_NAMESPACE(std)string& message ){ - m_problemReporter->reportMessage( message.c_str(), - getFilename().c_str(), - LT(1)->getLine(), - LT(1)->getColumn() ); - } -#line 30 "PascalParser.hpp" -public: - void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); -protected: - PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); -public: - PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); -protected: - PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); -public: - PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); - PascalParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); - int getNumTokens() const - { - return PascalParser::NUM_TOKENS; - } - const char* getTokenName( int type ) const - { - if( type > getNumTokens() ) return 0; - return PascalParser::tokenNames[type]; - } - const char* const* getTokenNames() const - { - return PascalParser::tokenNames; - } - public: void compilationUnit(); - public: void program(); - public: void library(); - public: void unit(); - public: void programHeading(); - public: void usesClause(); - public: void block(); - public: void identifier(); - public: void libraryBlock(); - public: void exportsClause(); - public: void declarationPart(); - public: void statementPart(); - public: void exportsList(); - public: void exportsEntry(); - public: void integerConstant(); - public: void stringConstant(); - public: void identifierList(); - public: void interfacePart(); - public: void implementationPart(); - public: void initializationPart(); - public: void finalizationPart(); - public: void realizationPart(); - public: void constantDeclarationPart(); - public: void typeDeclarationPart(); - public: void procedureHeadersPart(); - public: void statement(); - public: void labelDeclarationPart(); - public: void resourcestringDeclarationPart(); - public: void variableDeclarationPart(); - public: void procedureAndFunctionDeclarationPart(); - public: void label(); - public: void constantDeclaration(); - public: void typedConstantDeclaration(); - public: void stringConstantDeclaration(); - public: void string(); - public: void typeDeclaration(); - public: void variableDeclaration(); - public: void type(); - public: void procedureAndFunctionDeclaration(); - public: void procedureDeclaration(); - public: void functionDeclaration(); - public: void constructorDeclaration(); - public: void destructorDeclaration(); - public: void compoundStatement(); - public: void procedureHeader(); - public: void subroutineBlock(); - public: void functionHeader(); - public: void qualifiedMethodIdentifier(); - public: void formalParameterList(); - public: void modifiers(); - public: void externalDirective(); - public: void functionHeaderEnding(); - public: void parameterDeclaration(); - public: void valueParameter(); - public: void variableParameter(); - public: void constantParameter(); - public: void untypedParameterPart(); - public: void callModifiers(); - public: void expression(); - public: void typedConstant(); - public: void constant(); - public: void recordConstant(); - public: void arrayConstant(); - public: void proceduralConstant(); - public: void addressConstant(); - public: void simpleType(); - public: void subrangeTypeOrTypeIdentifier(); - public: void enumeratedType(); - public: void stringType(); - public: void structuredType(); - public: void pointerType(); - public: void proceduralType(); - public: void ordinalType(); - public: void realType(); - public: void typeIdentifier(); - public: void subrangeType(); - public: void assignedEnumList(); - public: void unsignedInteger(); - public: void arrayType(); - public: void recordType(); - public: void objectType(); - public: void classType(); - public: void setType(); - public: void fileType(); - public: void arrayIndexType(); - public: void arraySubrangeType(); - public: void fieldList(); - public: void fixedField(); - public: void variantPart(); - public: void variant(); - public: void proceduralTypePart1(); - public: void heritage(); - public: void componentList(); - public: void objectVisibilitySpecifier(); - public: void fieldDefinition(); - public: void methodDefinition(); - public: void constructorHeader(); - public: void destructorHeader(); - public: void methodDirectives(); - public: void classComponentList(); - public: void classVisibilitySpecifier(); - public: void classMethodDefinition(); - public: void propertyDefinition(); - public: void classMethodDirectives(); - public: void directiveVariants(); - public: void propertyInterface(); - public: void propertySpecifiers(); - public: void propertyParameterList(); - public: void readSpecifier(); - public: void writeSpecifier(); - public: void defaultSpecifier(); - public: void fieldOrMethod(); - public: void simpleExpression(); - public: void expressionSign(); - public: void term(); - public: void factor(); - public: void identifierOrValueTypecastOrFunctionCall(); - public: void unsignedConstant(); - public: void setConstructor(); - public: void addressFactor(); - public: void expressions(); - public: void functionCall(); - public: void actualParameterList(); - public: void setGroup(); - public: void valueTypecast(); - public: void simpleStatement(); - public: void structuredStatement(); - public: void assignmentStatement(); - public: void procedureStatement(); - public: void gotoStatement(); - public: void raiseStatement(); - public: void identifierOrArrayIdentifier(); - public: void assignmentOperator(); - public: void repetitiveStatement(); - public: void conditionalStatement(); - public: void exceptionStatement(); - public: void withStatement(); - public: void ifStatement(); - public: void caseStatement(); - public: void forStatement(); - public: void repeatStatement(); - public: void whileStatement(); - public: void caseListElement(); - public: void constList(); - public: void forList(); - public: void initialValue(); - public: void finalValue(); - public: void recordVariableList(); - public: void variable(); - public: void operatorDefinition(); - public: void assignmentOperatorDefinition(); - public: void arithmeticOperatorDefinition(); - public: void comparisonOperatorDefinition(); - public: void tryStatement(); - public: void statements(); - public: void exceptOrFinallyPart(); - public: void exceptionHandlers(); - public: void exceptionHandler(); - public: void sign(); - public: void constantChr(); - public: void unsignedNumber(); - public: void unsignedReal(); -public: - ANTLR_USE_NAMESPACE(antlr)RefAST getAST() - { - return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); - } - -protected: - RefPascalAST returnAST; -private: - static const char* tokenNames[]; -#ifndef NO_STATIC_CONSTS - static const int NUM_TOKENS = 190; -#else - enum { - NUM_TOKENS = 190 - }; -#endif - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; - static const unsigned long _tokenSet_4_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; - static const unsigned long _tokenSet_5_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; - static const unsigned long _tokenSet_6_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; - static const unsigned long _tokenSet_7_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; - static const unsigned long _tokenSet_8_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; - static const unsigned long _tokenSet_9_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; - static const unsigned long _tokenSet_10_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10; - static const unsigned long _tokenSet_11_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11; - static const unsigned long _tokenSet_12_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12; - static const unsigned long _tokenSet_13_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13; - static const unsigned long _tokenSet_14_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14; - static const unsigned long _tokenSet_15_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_15; - static const unsigned long _tokenSet_16_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_16; - static const unsigned long _tokenSet_17_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_17; - static const unsigned long _tokenSet_18_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_18; - static const unsigned long _tokenSet_19_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_19; - static const unsigned long _tokenSet_20_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_20; - static const unsigned long _tokenSet_21_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_21; - static const unsigned long _tokenSet_22_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_22; - static const unsigned long _tokenSet_23_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_23; - static const unsigned long _tokenSet_24_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_24; - static const unsigned long _tokenSet_25_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_25; - static const unsigned long _tokenSet_26_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_26; - static const unsigned long _tokenSet_27_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_27; - static const unsigned long _tokenSet_28_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_28; - static const unsigned long _tokenSet_29_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_29; - static const unsigned long _tokenSet_30_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_30; - static const unsigned long _tokenSet_31_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_31; - static const unsigned long _tokenSet_32_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_32; - static const unsigned long _tokenSet_33_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_33; - static const unsigned long _tokenSet_34_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_34; - static const unsigned long _tokenSet_35_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_35; - static const unsigned long _tokenSet_36_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_36; - static const unsigned long _tokenSet_37_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_37; - static const unsigned long _tokenSet_38_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_38; - static const unsigned long _tokenSet_39_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_39; - static const unsigned long _tokenSet_40_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_40; - static const unsigned long _tokenSet_41_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_41; - static const unsigned long _tokenSet_42_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_42; - static const unsigned long _tokenSet_43_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_43; - static const unsigned long _tokenSet_44_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_44; - static const unsigned long _tokenSet_45_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_45; - static const unsigned long _tokenSet_46_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_46; - static const unsigned long _tokenSet_47_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_47; - static const unsigned long _tokenSet_48_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_48; - static const unsigned long _tokenSet_49_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_49; - static const unsigned long _tokenSet_50_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_50; - static const unsigned long _tokenSet_51_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_51; - static const unsigned long _tokenSet_52_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_52; - static const unsigned long _tokenSet_53_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_53; - static const unsigned long _tokenSet_54_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_54; - static const unsigned long _tokenSet_55_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_55; - static const unsigned long _tokenSet_56_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_56; - static const unsigned long _tokenSet_57_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_57; - static const unsigned long _tokenSet_58_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_58; - static const unsigned long _tokenSet_59_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_59; - static const unsigned long _tokenSet_60_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_60; - static const unsigned long _tokenSet_61_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_61; - static const unsigned long _tokenSet_62_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_62; - static const unsigned long _tokenSet_63_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_63; - static const unsigned long _tokenSet_64_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_64; - static const unsigned long _tokenSet_65_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_65; - static const unsigned long _tokenSet_66_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_66; - static const unsigned long _tokenSet_67_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_67; - static const unsigned long _tokenSet_68_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_68; - static const unsigned long _tokenSet_69_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_69; - static const unsigned long _tokenSet_70_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_70; - static const unsigned long _tokenSet_71_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_71; - static const unsigned long _tokenSet_72_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_72; - static const unsigned long _tokenSet_73_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_73; - static const unsigned long _tokenSet_74_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_74; - static const unsigned long _tokenSet_75_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_75; - static const unsigned long _tokenSet_76_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_76; -}; - -#endif /*INC_PascalParser_hpp_*/ diff --git a/languages/pascal/PascalStoreWalker.cpp b/languages/pascal/PascalStoreWalker.cpp index 96c69fe4..b56897df 100644 --- a/languages/pascal/PascalStoreWalker.cpp +++ b/languages/pascal/PascalStoreWalker.cpp @@ -1,11 +1,11 @@ /* $ANTLR 2.7.7 (20061129): "pascal.tree.g" -> "PascalStoreWalker.cpp"$ */ -#include "PascalStoreWalker.hpp" -#include -#include -#include -#include -#include -#include +#include "PascalStoreWalker.h" +#include +#include +#include +#include +#include +#include #line 1 "pascal.tree.g" #line 11 "PascalStoreWalker.cpp" PascalStoreWalker::PascalStoreWalker() diff --git a/languages/pascal/PascalStoreWalker.h b/languages/pascal/PascalStoreWalker.h new file mode 100644 index 00000000..ceece541 --- /dev/null +++ b/languages/pascal/PascalStoreWalker.h @@ -0,0 +1,172 @@ +#ifndef INC_PascalStoreWalker_h_ +#define INC_PascalStoreWalker_h_ + +#line 20 "pascal.tree.g" + + #include + #include "PascalAST.h" + + #include + #include + #include + +#line 14 "PascalStoreWalker.h" +#include +#include "PascalStoreWalkerTokenTypes.h" +/* $ANTLR 2.7.7 (20061129): "pascal.tree.g" -> "PascalStoreWalker.h"$ */ +#include + +#line 29 "pascal.tree.g" + + #include + #include + +#line 25 "PascalStoreWalker.h" +class CUSTOM_API PascalStoreWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public PascalStoreWalkerTokenTypes +{ +#line 47 "pascal.tree.g" + +private: + TQString m_fileName; + TQStringList m_currentScope; + int m_currentAccess; + int m_anon; + CodeModel* m_model; + +public: + void setCodeModel( CodeModel* model ) { m_model = model; } + CodeModel* codeModel() { return m_model; } + const CodeModel* codeModel() const { return m_model; } + + TQString fileName() const { return m_fileName; } + void setFileName( const TQString& fileName ) { m_fileName = fileName; } + + void init(){ + m_currentScope.clear(); + m_currentAccess = CodeModelItem::Public; + m_anon = 0; + } + + void wipeout() { m_model->wipeout(); } +#line 29 "PascalStoreWalker.h" +public: + PascalStoreWalker(); + static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); + int getNumTokens() const + { + return PascalStoreWalker::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return PascalStoreWalker::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return PascalStoreWalker::tokenNames; + } + public: void program(RefPascalAST _t); + public: void programHeading(RefPascalAST _t); + public: void block(RefPascalAST _t); + public: void identifierList(RefPascalAST _t); + public: void identifier(RefPascalAST _t); + public: void labelDeclarationPart(RefPascalAST _t); + public: void constantDefinitionPart(RefPascalAST _t); + public: void typeDefinitionPart(RefPascalAST _t); + public: void variableDeclarationPart(RefPascalAST _t); + public: void procedureAndFunctionDeclarationPart(RefPascalAST _t); + public: void usesUnitsPart(RefPascalAST _t); + public: void compoundStatement(RefPascalAST _t); + public: void label(RefPascalAST _t); + public: void constantDefinition(RefPascalAST _t); + public: void constant(RefPascalAST _t); + public: void string(RefPascalAST _t); + public: void typeDefinition(RefPascalAST _t); + public: void type(RefPascalAST _t); + public: void formalParameterList(RefPascalAST _t); + public: void resultType(RefPascalAST _t); + public: void typeIdentifier(RefPascalAST _t); + public: void structuredType(RefPascalAST _t); + public: void unpackedStructuredType(RefPascalAST _t); + public: void arrayType(RefPascalAST _t); + public: void recordType(RefPascalAST _t); + public: void setType(RefPascalAST _t); + public: void fileType(RefPascalAST _t); + public: void typeList(RefPascalAST _t); + public: void fieldList(RefPascalAST _t); + public: void fixedPart(RefPascalAST _t); + public: void variantPart(RefPascalAST _t); + public: void recordSection(RefPascalAST _t); + public: void tag(RefPascalAST _t); + public: void variant(RefPascalAST _t); + public: void constList(RefPascalAST _t); + public: void variableDeclaration(RefPascalAST _t); + public: void procedureOrFunctionDeclaration(RefPascalAST _t); + public: void procedureDeclaration(RefPascalAST _t); + public: void functionDeclaration(RefPascalAST _t); + public: void formalParameterSection(RefPascalAST _t); + public: void parameterGroup(RefPascalAST _t); + public: void statement(RefPascalAST _t); + public: void unlabelledStatement(RefPascalAST _t); + public: void simpleStatement(RefPascalAST _t); + public: void structuredStatement(RefPascalAST _t); + public: void assignmentStatement(RefPascalAST _t); + public: void procedureStatement(RefPascalAST _t); + public: void gotoStatement(RefPascalAST _t); + public: void variable(RefPascalAST _t); + public: void expression(RefPascalAST _t); + public: void functionDesignator(RefPascalAST _t); + public: void set(RefPascalAST _t); + public: void parameterList(RefPascalAST _t); + public: void actualParameter(RefPascalAST _t); + public: void element(RefPascalAST _t); + public: void conditionalStatement(RefPascalAST _t); + public: void repetetiveStatement(RefPascalAST _t); + public: void withStatement(RefPascalAST _t); + public: void statements(RefPascalAST _t); + public: void ifStatement(RefPascalAST _t); + public: void caseStatement(RefPascalAST _t); + public: void caseListElement(RefPascalAST _t); + public: void whileStatement(RefPascalAST _t); + public: void repeatStatement(RefPascalAST _t); + public: void forStatement(RefPascalAST _t); + public: void forList(RefPascalAST _t); + public: void initialValue(RefPascalAST _t); + public: void finalValue(RefPascalAST _t); + public: void recordVariableList(RefPascalAST _t); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefPascalAST returnAST; + RefPascalAST _retTree; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 190; +#else + enum { + NUM_TOKENS = 190 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; + static const unsigned long _tokenSet_5_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; + static const unsigned long _tokenSet_6_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; +}; + +#endif /*INC_PascalStoreWalker_h_*/ diff --git a/languages/pascal/PascalStoreWalker.hpp b/languages/pascal/PascalStoreWalker.hpp deleted file mode 100644 index ada7c020..00000000 --- a/languages/pascal/PascalStoreWalker.hpp +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef INC_PascalStoreWalker_hpp_ -#define INC_PascalStoreWalker_hpp_ - -#line 20 "pascal.tree.g" - - #include - #include "PascalAST.hpp" - - #include - #include - #include - -#line 14 "PascalStoreWalker.hpp" -#include -#include "PascalStoreWalkerTokenTypes.hpp" -/* $ANTLR 2.7.7 (20061129): "pascal.tree.g" -> "PascalStoreWalker.hpp"$ */ -#include - -#line 29 "pascal.tree.g" - - #include - #include - -#line 25 "PascalStoreWalker.hpp" -class CUSTOM_API PascalStoreWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public PascalStoreWalkerTokenTypes -{ -#line 47 "pascal.tree.g" - -private: - TQString m_fileName; - TQStringList m_currentScope; - int m_currentAccess; - int m_anon; - CodeModel* m_model; - -public: - void setCodeModel( CodeModel* model ) { m_model = model; } - CodeModel* codeModel() { return m_model; } - const CodeModel* codeModel() const { return m_model; } - - TQString fileName() const { return m_fileName; } - void setFileName( const TQString& fileName ) { m_fileName = fileName; } - - void init(){ - m_currentScope.clear(); - m_currentAccess = CodeModelItem::Public; - m_anon = 0; - } - - void wipeout() { m_model->wipeout(); } -#line 29 "PascalStoreWalker.hpp" -public: - PascalStoreWalker(); - static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); - int getNumTokens() const - { - return PascalStoreWalker::NUM_TOKENS; - } - const char* getTokenName( int type ) const - { - if( type > getNumTokens() ) return 0; - return PascalStoreWalker::tokenNames[type]; - } - const char* const* getTokenNames() const - { - return PascalStoreWalker::tokenNames; - } - public: void program(RefPascalAST _t); - public: void programHeading(RefPascalAST _t); - public: void block(RefPascalAST _t); - public: void identifierList(RefPascalAST _t); - public: void identifier(RefPascalAST _t); - public: void labelDeclarationPart(RefPascalAST _t); - public: void constantDefinitionPart(RefPascalAST _t); - public: void typeDefinitionPart(RefPascalAST _t); - public: void variableDeclarationPart(RefPascalAST _t); - public: void procedureAndFunctionDeclarationPart(RefPascalAST _t); - public: void usesUnitsPart(RefPascalAST _t); - public: void compoundStatement(RefPascalAST _t); - public: void label(RefPascalAST _t); - public: void constantDefinition(RefPascalAST _t); - public: void constant(RefPascalAST _t); - public: void string(RefPascalAST _t); - public: void typeDefinition(RefPascalAST _t); - public: void type(RefPascalAST _t); - public: void formalParameterList(RefPascalAST _t); - public: void resultType(RefPascalAST _t); - public: void typeIdentifier(RefPascalAST _t); - public: void structuredType(RefPascalAST _t); - public: void unpackedStructuredType(RefPascalAST _t); - public: void arrayType(RefPascalAST _t); - public: void recordType(RefPascalAST _t); - public: void setType(RefPascalAST _t); - public: void fileType(RefPascalAST _t); - public: void typeList(RefPascalAST _t); - public: void fieldList(RefPascalAST _t); - public: void fixedPart(RefPascalAST _t); - public: void variantPart(RefPascalAST _t); - public: void recordSection(RefPascalAST _t); - public: void tag(RefPascalAST _t); - public: void variant(RefPascalAST _t); - public: void constList(RefPascalAST _t); - public: void variableDeclaration(RefPascalAST _t); - public: void procedureOrFunctionDeclaration(RefPascalAST _t); - public: void procedureDeclaration(RefPascalAST _t); - public: void functionDeclaration(RefPascalAST _t); - public: void formalParameterSection(RefPascalAST _t); - public: void parameterGroup(RefPascalAST _t); - public: void statement(RefPascalAST _t); - public: void unlabelledStatement(RefPascalAST _t); - public: void simpleStatement(RefPascalAST _t); - public: void structuredStatement(RefPascalAST _t); - public: void assignmentStatement(RefPascalAST _t); - public: void procedureStatement(RefPascalAST _t); - public: void gotoStatement(RefPascalAST _t); - public: void variable(RefPascalAST _t); - public: void expression(RefPascalAST _t); - public: void functionDesignator(RefPascalAST _t); - public: void set(RefPascalAST _t); - public: void parameterList(RefPascalAST _t); - public: void actualParameter(RefPascalAST _t); - public: void element(RefPascalAST _t); - public: void conditionalStatement(RefPascalAST _t); - public: void repetetiveStatement(RefPascalAST _t); - public: void withStatement(RefPascalAST _t); - public: void statements(RefPascalAST _t); - public: void ifStatement(RefPascalAST _t); - public: void caseStatement(RefPascalAST _t); - public: void caseListElement(RefPascalAST _t); - public: void whileStatement(RefPascalAST _t); - public: void repeatStatement(RefPascalAST _t); - public: void forStatement(RefPascalAST _t); - public: void forList(RefPascalAST _t); - public: void initialValue(RefPascalAST _t); - public: void finalValue(RefPascalAST _t); - public: void recordVariableList(RefPascalAST _t); -public: - ANTLR_USE_NAMESPACE(antlr)RefAST getAST() - { - return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); - } - -protected: - RefPascalAST returnAST; - RefPascalAST _retTree; -private: - static const char* tokenNames[]; -#ifndef NO_STATIC_CONSTS - static const int NUM_TOKENS = 190; -#else - enum { - NUM_TOKENS = 190 - }; -#endif - - static const unsigned long _tokenSet_0_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; - static const unsigned long _tokenSet_1_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; - static const unsigned long _tokenSet_2_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; - static const unsigned long _tokenSet_3_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; - static const unsigned long _tokenSet_4_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; - static const unsigned long _tokenSet_5_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; - static const unsigned long _tokenSet_6_data_[]; - static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; -}; - -#endif /*INC_PascalStoreWalker_hpp_*/ diff --git a/languages/pascal/PascalStoreWalkerTokenTypes.h b/languages/pascal/PascalStoreWalkerTokenTypes.h new file mode 100644 index 00000000..4631429c --- /dev/null +++ b/languages/pascal/PascalStoreWalkerTokenTypes.h @@ -0,0 +1,206 @@ +#ifndef INC_PascalStoreWalkerTokenTypes_h_ +#define INC_PascalStoreWalkerTokenTypes_h_ + +/* $ANTLR 2.7.7 (20061129): "pascal.tree.g" -> "PascalStoreWalkerTokenTypes.h"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API PascalStoreWalkerTokenTypes { +#endif + enum { + EOF_ = 1, + BLOCK = 4, + IDLIST = 5, + ELIST = 6, + FUNC_CALL = 7, + PROC_CALL = 8, + SCALARTYPE = 9, + TYPELIST = 10, + VARIANT_TAG = 11, + VARIANT_TAG_NO_ID = 12, + VARIANT_CASE = 13, + CONSTLIST = 14, + FIELDLIST = 15, + ARGDECLS = 16, + VARDECL = 17, + ARGDECL = 18, + ARGLIST = 19, + TYPEDECL = 20, + FIELD = 21, + DOT = 22, + LIBRARY = 23, + SEMI = 24, + END = 25, + EXPORTS = 26, + COMMA = 27, + LITERAL_index = 28, + LITERAL_name = 29, + USES = 30, + UNIT = 31, + INTERFACE = 32, + IMPLEMENTATION = 33, + BEGIN = 34, + PROGRAM = 35, + LPAREN = 36, + RPAREN = 37, + INITIALIZATION = 38, + FINALIZATION = 39, + LABEL = 40, + CONST = 41, + RESOURCESTRING = 42, + EQUAL = 43, + TYPE = 44, + VAR = 45, + COLON = 46, + PROCEDURE = 47, + FORWARD = 48, + FUNCTION = 49, + ARRAY = 50, + OF = 51, + EXTERNAL = 52, + PUBLIC = 53, + ALIAS = 54, + INTERRUPT = 55, + EXPORT = 56, + REGISTER = 57, + PASCAL = 58, + CDECL = 59, + STDCALL = 60, + POPSTACK = 61, + SAVEREGISTERS = 62, + INLINE = 63, + SAFECALL = 64, + NEAR = 65, + FAR = 66, + NUM_INT = 67, + INTEGER = 68, + SHORTINT = 69, + SMALLINT = 70, + LONGINT = 71, + INT64 = 72, + BYTE = 73, + WORD = 74, + CARDINAL = 75, + TQWORD = 76, + BOOLEAN = 77, + BYTEBOOL = 78, + LONGBOOL = 79, + CHAR = 80, + DOTDOT = 81, + ASSIGN = 82, + REAL = 83, + SINGLE = 84, + DOUBLE = 85, + EXTENDED = 86, + COMP = 87, + STRING = 88, + LBRACK = 89, + RBRACK = 90, + PACKED = 91, + RECORD = 92, + CASE = 93, + SET = 94, + FILE = 95, + POINTER = 96, + OBJECT = 97, + VIRTUAL = 98, + ABSTRACT = 99, + PRIVATE = 100, + PROTECTED = 101, + CONSTRUCTOR = 102, + DESTRUCTOR = 103, + CLASS = 104, + OVERRIDE = 105, + MESSAGE = 106, + PUBLISHED = 107, + PROPERTY = 108, + LITERAL_read = 109, + LITERAL_write = 110, + DEFAULT = 111, + LITERAL_nodefault = 112, + LE = 113, + GE = 114, + LTH = 115, + GT = 116, + NOT_EQUAL = 117, + IN = 118, + IS = 119, + PLUS = 120, + MINUS = 121, + OR = 122, + XOR = 123, + STAR = 124, + SLASH = 125, + DIV = 126, + MOD = 127, + AND = 128, + SHL = 129, + SHR = 130, + NOT = 131, + TRUE = 132, + FALSE = 133, + AT = 134, + PLUSEQ = 135, + MINUSEQ = 136, + STAREQ = 137, + SLASHQE = 138, + GOTO = 139, + IF = 140, + THEN = 141, + ELSE = 142, + WHILE = 143, + DO = 144, + REPEAT = 145, + UNTIL = 146, + FOR = 147, + TO = 148, + DOWNTO = 149, + WITH = 150, + LBRACK2 = 151, + RBRACK2 = 152, + OPERATOR = 153, + RAISE = 154, + TRY = 155, + EXCEPT = 156, + FINALLY = 157, + ON = 158, + STRING_LITERAL = 159, + CHR = 160, + NIL = 161, + NUM_REAL = 162, + IDENT = 163, + ABSOLUTE = 164, + AS = 165, + ASM = 166, + ASSEMBLER = 167, + BREAK = 168, + CONTINUE = 169, + DISPOSE = 170, + EXIT = 171, + INHERITED = 172, + NEW = 173, + SELF = 174, + TQT_METHOD = 175, + ADDSUBOR = 176, + ASSIGNEQUAL = 177, + SIGN = 178, + FUNC = 179, + NODE_NOT_EMIT = 180, + MYASTVAR = 181, + LF = 182, + LCURLY = 183, + RCURLY = 184, + WS = 185, + COMMENT_1 = 186, + COMMENT_2 = 187, + COMMENT_3 = 188, + EXPONENT = 189, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_PascalStoreWalkerTokenTypes_h_*/ diff --git a/languages/pascal/PascalStoreWalkerTokenTypes.hpp b/languages/pascal/PascalStoreWalkerTokenTypes.hpp deleted file mode 100644 index cd9e0c81..00000000 --- a/languages/pascal/PascalStoreWalkerTokenTypes.hpp +++ /dev/null @@ -1,206 +0,0 @@ -#ifndef INC_PascalStoreWalkerTokenTypes_hpp_ -#define INC_PascalStoreWalkerTokenTypes_hpp_ - -/* $ANTLR 2.7.7 (20061129): "pascal.tree.g" -> "PascalStoreWalkerTokenTypes.hpp"$ */ - -#ifndef CUSTOM_API -# define CUSTOM_API -#endif - -#ifdef __cplusplus -struct CUSTOM_API PascalStoreWalkerTokenTypes { -#endif - enum { - EOF_ = 1, - BLOCK = 4, - IDLIST = 5, - ELIST = 6, - FUNC_CALL = 7, - PROC_CALL = 8, - SCALARTYPE = 9, - TYPELIST = 10, - VARIANT_TAG = 11, - VARIANT_TAG_NO_ID = 12, - VARIANT_CASE = 13, - CONSTLIST = 14, - FIELDLIST = 15, - ARGDECLS = 16, - VARDECL = 17, - ARGDECL = 18, - ARGLIST = 19, - TYPEDECL = 20, - FIELD = 21, - DOT = 22, - LIBRARY = 23, - SEMI = 24, - END = 25, - EXPORTS = 26, - COMMA = 27, - LITERAL_index = 28, - LITERAL_name = 29, - USES = 30, - UNIT = 31, - INTERFACE = 32, - IMPLEMENTATION = 33, - BEGIN = 34, - PROGRAM = 35, - LPAREN = 36, - RPAREN = 37, - INITIALIZATION = 38, - FINALIZATION = 39, - LABEL = 40, - CONST = 41, - RESOURCESTRING = 42, - EQUAL = 43, - TYPE = 44, - VAR = 45, - COLON = 46, - PROCEDURE = 47, - FORWARD = 48, - FUNCTION = 49, - ARRAY = 50, - OF = 51, - EXTERNAL = 52, - PUBLIC = 53, - ALIAS = 54, - INTERRUPT = 55, - EXPORT = 56, - REGISTER = 57, - PASCAL = 58, - CDECL = 59, - STDCALL = 60, - POPSTACK = 61, - SAVEREGISTERS = 62, - INLINE = 63, - SAFECALL = 64, - NEAR = 65, - FAR = 66, - NUM_INT = 67, - INTEGER = 68, - SHORTINT = 69, - SMALLINT = 70, - LONGINT = 71, - INT64 = 72, - BYTE = 73, - WORD = 74, - CARDINAL = 75, - TQWORD = 76, - BOOLEAN = 77, - BYTEBOOL = 78, - LONGBOOL = 79, - CHAR = 80, - DOTDOT = 81, - ASSIGN = 82, - REAL = 83, - SINGLE = 84, - DOUBLE = 85, - EXTENDED = 86, - COMP = 87, - STRING = 88, - LBRACK = 89, - RBRACK = 90, - PACKED = 91, - RECORD = 92, - CASE = 93, - SET = 94, - FILE = 95, - POINTER = 96, - OBJECT = 97, - VIRTUAL = 98, - ABSTRACT = 99, - PRIVATE = 100, - PROTECTED = 101, - CONSTRUCTOR = 102, - DESTRUCTOR = 103, - CLASS = 104, - OVERRIDE = 105, - MESSAGE = 106, - PUBLISHED = 107, - PROPERTY = 108, - LITERAL_read = 109, - LITERAL_write = 110, - DEFAULT = 111, - LITERAL_nodefault = 112, - LE = 113, - GE = 114, - LTH = 115, - GT = 116, - NOT_EQUAL = 117, - IN = 118, - IS = 119, - PLUS = 120, - MINUS = 121, - OR = 122, - XOR = 123, - STAR = 124, - SLASH = 125, - DIV = 126, - MOD = 127, - AND = 128, - SHL = 129, - SHR = 130, - NOT = 131, - TRUE = 132, - FALSE = 133, - AT = 134, - PLUSEQ = 135, - MINUSEQ = 136, - STAREQ = 137, - SLASHQE = 138, - GOTO = 139, - IF = 140, - THEN = 141, - ELSE = 142, - WHILE = 143, - DO = 144, - REPEAT = 145, - UNTIL = 146, - FOR = 147, - TO = 148, - DOWNTO = 149, - WITH = 150, - LBRACK2 = 151, - RBRACK2 = 152, - OPERATOR = 153, - RAISE = 154, - TRY = 155, - EXCEPT = 156, - FINALLY = 157, - ON = 158, - STRING_LITERAL = 159, - CHR = 160, - NIL = 161, - NUM_REAL = 162, - IDENT = 163, - ABSOLUTE = 164, - AS = 165, - ASM = 166, - ASSEMBLER = 167, - BREAK = 168, - CONTINUE = 169, - DISPOSE = 170, - EXIT = 171, - INHERITED = 172, - NEW = 173, - SELF = 174, - TQT_METHOD = 175, - ADDSUBOR = 176, - ASSIGNEQUAL = 177, - SIGN = 178, - FUNC = 179, - NODE_NOT_EMIT = 180, - MYASTVAR = 181, - LF = 182, - LCURLY = 183, - RCURLY = 184, - WS = 185, - COMMENT_1 = 186, - COMMENT_2 = 187, - COMMENT_3 = 188, - EXPONENT = 189, - NULL_TREE_LOOKAHEAD = 3 - }; -#ifdef __cplusplus -}; -#endif -#endif /*INC_PascalStoreWalkerTokenTypes_hpp_*/ diff --git a/languages/pascal/PascalTokenTypes.h b/languages/pascal/PascalTokenTypes.h new file mode 100644 index 00000000..42e97d53 --- /dev/null +++ b/languages/pascal/PascalTokenTypes.h @@ -0,0 +1,209 @@ +#ifndef INC_PascalTokenTypes_h_ +#define INC_PascalTokenTypes_h_ + +#undef TRUE +#undef FALSE + +/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalTokenTypes.h"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API PascalTokenTypes { +#endif + enum { + EOF_ = 1, + BLOCK = 4, + IDLIST = 5, + ELIST = 6, + FUNC_CALL = 7, + PROC_CALL = 8, + SCALARTYPE = 9, + TYPELIST = 10, + VARIANT_TAG = 11, + VARIANT_TAG_NO_ID = 12, + VARIANT_CASE = 13, + CONSTLIST = 14, + FIELDLIST = 15, + ARGDECLS = 16, + VARDECL = 17, + ARGDECL = 18, + ARGLIST = 19, + TYPEDECL = 20, + FIELD = 21, + DOT = 22, + LIBRARY = 23, + SEMI = 24, + END = 25, + EXPORTS = 26, + COMMA = 27, + LITERAL_index = 28, + LITERAL_name = 29, + USES = 30, + UNIT = 31, + INTERFACE = 32, + IMPLEMENTATION = 33, + BEGIN = 34, + PROGRAM = 35, + LPAREN = 36, + RPAREN = 37, + INITIALIZATION = 38, + FINALIZATION = 39, + LABEL = 40, + CONST = 41, + RESOURCESTRING = 42, + EQUAL = 43, + TYPE = 44, + VAR = 45, + COLON = 46, + PROCEDURE = 47, + FORWARD = 48, + FUNCTION = 49, + ARRAY = 50, + OF = 51, + EXTERNAL = 52, + PUBLIC = 53, + ALIAS = 54, + INTERRUPT = 55, + EXPORT = 56, + REGISTER = 57, + PASCAL = 58, + CDECL = 59, + STDCALL = 60, + POPSTACK = 61, + SAVEREGISTERS = 62, + INLINE = 63, + SAFECALL = 64, + NEAR = 65, + FAR = 66, + NUM_INT = 67, + INTEGER = 68, + SHORTINT = 69, + SMALLINT = 70, + LONGINT = 71, + INT64 = 72, + BYTE = 73, + WORD = 74, + CARDINAL = 75, + TQWORD = 76, + BOOLEAN = 77, + BYTEBOOL = 78, + LONGBOOL = 79, + CHAR = 80, + DOTDOT = 81, + ASSIGN = 82, + REAL = 83, + SINGLE = 84, + DOUBLE = 85, + EXTENDED = 86, + COMP = 87, + STRING = 88, + LBRACK = 89, + RBRACK = 90, + PACKED = 91, + RECORD = 92, + CASE = 93, + SET = 94, + FILE = 95, + POINTER = 96, + OBJECT = 97, + VIRTUAL = 98, + ABSTRACT = 99, + PRIVATE = 100, + PROTECTED = 101, + CONSTRUCTOR = 102, + DESTRUCTOR = 103, + CLASS = 104, + OVERRIDE = 105, + MESSAGE = 106, + PUBLISHED = 107, + PROPERTY = 108, + LITERAL_read = 109, + LITERAL_write = 110, + DEFAULT = 111, + LITERAL_nodefault = 112, + LE = 113, + GE = 114, + LTH = 115, + GT = 116, + NOT_EQUAL = 117, + IN = 118, + IS = 119, + PLUS = 120, + MINUS = 121, + OR = 122, + XOR = 123, + STAR = 124, + SLASH = 125, + DIV = 126, + MOD = 127, + AND = 128, + SHL = 129, + SHR = 130, + NOT = 131, + TRUE = 132, + FALSE = 133, + AT = 134, + PLUSEQ = 135, + MINUSEQ = 136, + STAREQ = 137, + SLASHQE = 138, + GOTO = 139, + IF = 140, + THEN = 141, + ELSE = 142, + WHILE = 143, + DO = 144, + REPEAT = 145, + UNTIL = 146, + FOR = 147, + TO = 148, + DOWNTO = 149, + WITH = 150, + LBRACK2 = 151, + RBRACK2 = 152, + OPERATOR = 153, + RAISE = 154, + TRY = 155, + EXCEPT = 156, + FINALLY = 157, + ON = 158, + STRING_LITERAL = 159, + CHR = 160, + NIL = 161, + NUM_REAL = 162, + IDENT = 163, + ABSOLUTE = 164, + AS = 165, + ASM = 166, + ASSEMBLER = 167, + BREAK = 168, + CONTINUE = 169, + DISPOSE = 170, + EXIT = 171, + INHERITED = 172, + NEW = 173, + SELF = 174, + TQT_METHOD = 175, + ADDSUBOR = 176, + ASSIGNEQUAL = 177, + SIGN = 178, + FUNC = 179, + NODE_NOT_EMIT = 180, + MYASTVAR = 181, + LF = 182, + LCURLY = 183, + RCURLY = 184, + WS = 185, + COMMENT_1 = 186, + COMMENT_2 = 187, + COMMENT_3 = 188, + EXPONENT = 189, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_PascalTokenTypes_h_*/ diff --git a/languages/pascal/PascalTokenTypes.hpp b/languages/pascal/PascalTokenTypes.hpp deleted file mode 100644 index 007269b0..00000000 --- a/languages/pascal/PascalTokenTypes.hpp +++ /dev/null @@ -1,209 +0,0 @@ -#ifndef INC_PascalTokenTypes_hpp_ -#define INC_PascalTokenTypes_hpp_ - -#undef TRUE -#undef FALSE - -/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalTokenTypes.hpp"$ */ - -#ifndef CUSTOM_API -# define CUSTOM_API -#endif - -#ifdef __cplusplus -struct CUSTOM_API PascalTokenTypes { -#endif - enum { - EOF_ = 1, - BLOCK = 4, - IDLIST = 5, - ELIST = 6, - FUNC_CALL = 7, - PROC_CALL = 8, - SCALARTYPE = 9, - TYPELIST = 10, - VARIANT_TAG = 11, - VARIANT_TAG_NO_ID = 12, - VARIANT_CASE = 13, - CONSTLIST = 14, - FIELDLIST = 15, - ARGDECLS = 16, - VARDECL = 17, - ARGDECL = 18, - ARGLIST = 19, - TYPEDECL = 20, - FIELD = 21, - DOT = 22, - LIBRARY = 23, - SEMI = 24, - END = 25, - EXPORTS = 26, - COMMA = 27, - LITERAL_index = 28, - LITERAL_name = 29, - USES = 30, - UNIT = 31, - INTERFACE = 32, - IMPLEMENTATION = 33, - BEGIN = 34, - PROGRAM = 35, - LPAREN = 36, - RPAREN = 37, - INITIALIZATION = 38, - FINALIZATION = 39, - LABEL = 40, - CONST = 41, - RESOURCESTRING = 42, - EQUAL = 43, - TYPE = 44, - VAR = 45, - COLON = 46, - PROCEDURE = 47, - FORWARD = 48, - FUNCTION = 49, - ARRAY = 50, - OF = 51, - EXTERNAL = 52, - PUBLIC = 53, - ALIAS = 54, - INTERRUPT = 55, - EXPORT = 56, - REGISTER = 57, - PASCAL = 58, - CDECL = 59, - STDCALL = 60, - POPSTACK = 61, - SAVEREGISTERS = 62, - INLINE = 63, - SAFECALL = 64, - NEAR = 65, - FAR = 66, - NUM_INT = 67, - INTEGER = 68, - SHORTINT = 69, - SMALLINT = 70, - LONGINT = 71, - INT64 = 72, - BYTE = 73, - WORD = 74, - CARDINAL = 75, - TQWORD = 76, - BOOLEAN = 77, - BYTEBOOL = 78, - LONGBOOL = 79, - CHAR = 80, - DOTDOT = 81, - ASSIGN = 82, - REAL = 83, - SINGLE = 84, - DOUBLE = 85, - EXTENDED = 86, - COMP = 87, - STRING = 88, - LBRACK = 89, - RBRACK = 90, - PACKED = 91, - RECORD = 92, - CASE = 93, - SET = 94, - FILE = 95, - POINTER = 96, - OBJECT = 97, - VIRTUAL = 98, - ABSTRACT = 99, - PRIVATE = 100, - PROTECTED = 101, - CONSTRUCTOR = 102, - DESTRUCTOR = 103, - CLASS = 104, - OVERRIDE = 105, - MESSAGE = 106, - PUBLISHED = 107, - PROPERTY = 108, - LITERAL_read = 109, - LITERAL_write = 110, - DEFAULT = 111, - LITERAL_nodefault = 112, - LE = 113, - GE = 114, - LTH = 115, - GT = 116, - NOT_EQUAL = 117, - IN = 118, - IS = 119, - PLUS = 120, - MINUS = 121, - OR = 122, - XOR = 123, - STAR = 124, - SLASH = 125, - DIV = 126, - MOD = 127, - AND = 128, - SHL = 129, - SHR = 130, - NOT = 131, - TRUE = 132, - FALSE = 133, - AT = 134, - PLUSEQ = 135, - MINUSEQ = 136, - STAREQ = 137, - SLASHQE = 138, - GOTO = 139, - IF = 140, - THEN = 141, - ELSE = 142, - WHILE = 143, - DO = 144, - REPEAT = 145, - UNTIL = 146, - FOR = 147, - TO = 148, - DOWNTO = 149, - WITH = 150, - LBRACK2 = 151, - RBRACK2 = 152, - OPERATOR = 153, - RAISE = 154, - TRY = 155, - EXCEPT = 156, - FINALLY = 157, - ON = 158, - STRING_LITERAL = 159, - CHR = 160, - NIL = 161, - NUM_REAL = 162, - IDENT = 163, - ABSOLUTE = 164, - AS = 165, - ASM = 166, - ASSEMBLER = 167, - BREAK = 168, - CONTINUE = 169, - DISPOSE = 170, - EXIT = 171, - INHERITED = 172, - NEW = 173, - SELF = 174, - TQT_METHOD = 175, - ADDSUBOR = 176, - ASSIGNEQUAL = 177, - SIGN = 178, - FUNC = 179, - NODE_NOT_EMIT = 180, - MYASTVAR = 181, - LF = 182, - LCURLY = 183, - RCURLY = 184, - WS = 185, - COMMENT_1 = 186, - COMMENT_2 = 187, - COMMENT_3 = 188, - EXPONENT = 189, - NULL_TREE_LOOKAHEAD = 3 - }; -#ifdef __cplusplus -}; -#endif -#endif /*INC_PascalTokenTypes_hpp_*/ diff --git a/languages/pascal/backgroundparser.cpp b/languages/pascal/backgroundparser.cpp index ff202374..df9c85dc 100644 --- a/languages/pascal/backgroundparser.cpp +++ b/languages/pascal/backgroundparser.cpp @@ -13,12 +13,12 @@ #include "backgroundparser.h" #include "problemreporter.h" -#include "PascalLexer.hpp" -#include "PascalParser.hpp" -#include "PascalAST.hpp" +#include "PascalLexer.h" +#include "PascalParser.h" +#include "PascalAST.h" #include #include -#include +#include BackgroundParser::BackgroundParser( ProblemReporter* reporter, const TQString& source, diff --git a/languages/pascal/pascal.g b/languages/pascal/pascal.g index fde5dcb8..59407423 100644 --- a/languages/pascal/pascal.g +++ b/languages/pascal/pascal.g @@ -28,7 +28,7 @@ header "pre_include_hpp" { #include "problemreporter.h" - #include "PascalAST.hpp" + #include "PascalAST.h" #include #include diff --git a/languages/pascal/pascal.tree.g b/languages/pascal/pascal.tree.g index c597afb8..d90503c4 100644 --- a/languages/pascal/pascal.tree.g +++ b/languages/pascal/pascal.tree.g @@ -19,7 +19,7 @@ header "pre_include_hpp" { #include - #include "PascalAST.hpp" + #include "PascalAST.h" #include #include diff --git a/languages/pascal/pascalsupport_part.cpp b/languages/pascal/pascalsupport_part.cpp index 69cbebf8..a61ab6a0 100644 --- a/languages/pascal/pascalsupport_part.cpp +++ b/languages/pascal/pascalsupport_part.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include "catalog.h" #include @@ -31,9 +31,9 @@ #include "pascalsupport_part.h" #include "problemreporter.h" -#include "PascalLexer.hpp" -#include "PascalParser.hpp" -#include "PascalStoreWalker.hpp" +#include "PascalLexer.h" +#include "PascalParser.h" +#include "PascalStoreWalker.h" struct PascalSupportPartData{ ProblemReporter* problemReporter; diff --git a/lib/antlr/README b/lib/antlr/README index 6ca0913b..1f6d902d 100644 --- a/lib/antlr/README +++ b/lib/antlr/README @@ -64,7 +64,7 @@ and compile with an option to define away the word 'std', such as CC .... -Dstd= .... -Also in the antlr subdirectory there's a file config.hpp. Tweak this one to +Also in the antlr subdirectory there's a file config.h. Tweak this one to enable/disable the different bells and whistles used in the rest of the code. Don't forget to submit those changes back to us (along with compiler info) so we can incorporate them in our next release! diff --git a/lib/antlr/TODO b/lib/antlr/TODO index 51d104c3..0b97e6e5 100644 --- a/lib/antlr/TODO +++ b/lib/antlr/TODO @@ -10,7 +10,7 @@ * On Thu, Sep 21, 2000 at 12:33:48AM -0700, John Lambert wrote: > 1) The literal EOF is not defined and causes the define of EOF_CHAR in - > CharScanner.hpp to fail. + > CharScanner.h to fail. ANTLR with STL Port. Changing the EOF define to char_traits::eof() breaks things for gcc-2.95.2. Fix this in next release portably. diff --git a/lib/antlr/antlr/ANTLRException.h b/lib/antlr/antlr/ANTLRException.h new file mode 100644 index 00000000..b67f5771 --- /dev/null +++ b/lib/antlr/antlr/ANTLRException.h @@ -0,0 +1,59 @@ +#ifndef INC_ANTLRException_h__ +#define INC_ANTLRException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API ANTLRException +{ +public: + /// Create ANTLR base exception without error message + ANTLRException() : text("") + { + } + /// Create ANTLR base exception with error message + ANTLRException(const ANTLR_USE_NAMESPACE(std)string& s) + : text(s) + { + } + virtual ~ANTLRException() throw() + { + } + + /** Return complete error message with line/column number info (if present) + * @note for your own exceptions override this one. Call getMessage from + * here to get the 'clean' error message stored in the text attribute. + */ + virtual ANTLR_USE_NAMESPACE(std)string toString() const + { + return text; + } + + /** Return error message without additional info (if present) + * @note when making your own exceptions classes override toString + * and call in toString getMessage which relays the text attribute + * from here. + */ + virtual ANTLR_USE_NAMESPACE(std)string getMessage() const + { + return text; + } +private: + ANTLR_USE_NAMESPACE(std)string text; +}; +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_ANTLRException_h__ diff --git a/lib/antlr/antlr/ANTLRException.hpp b/lib/antlr/antlr/ANTLRException.hpp deleted file mode 100644 index 426595a2..00000000 --- a/lib/antlr/antlr/ANTLRException.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef INC_ANTLRException_hpp__ -#define INC_ANTLRException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API ANTLRException -{ -public: - /// Create ANTLR base exception without error message - ANTLRException() : text("") - { - } - /// Create ANTLR base exception with error message - ANTLRException(const ANTLR_USE_NAMESPACE(std)string& s) - : text(s) - { - } - virtual ~ANTLRException() throw() - { - } - - /** Return complete error message with line/column number info (if present) - * @note for your own exceptions override this one. Call getMessage from - * here to get the 'clean' error message stored in the text attribute. - */ - virtual ANTLR_USE_NAMESPACE(std)string toString() const - { - return text; - } - - /** Return error message without additional info (if present) - * @note when making your own exceptions classes override toString - * and call in toString getMessage which relays the text attribute - * from here. - */ - virtual ANTLR_USE_NAMESPACE(std)string getMessage() const - { - return text; - } -private: - ANTLR_USE_NAMESPACE(std)string text; -}; -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ANTLRException_hpp__ diff --git a/lib/antlr/antlr/ANTLRUtil.h b/lib/antlr/antlr/ANTLRUtil.h new file mode 100644 index 00000000..33f37792 --- /dev/null +++ b/lib/antlr/antlr/ANTLRUtil.h @@ -0,0 +1,53 @@ +#ifndef INC_ANTLRUtil_h__ +#define INC_ANTLRUtil_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** Eat whitespace from the input stream + * @param is the stream to read from + */ +ANTLR_USE_NAMESPACE(std)istream& eatwhite( ANTLR_USE_NAMESPACE(std)istream& is ); + +/** Read a string enclosed by '"' from a stream. Also handles escaping of \". + * Skips leading whitespace. + * @param in the istream to read from. + * @returns the string read from file exclusive the '"' + * @throws ios_base::failure if string is badly formatted + */ +ANTLR_USE_NAMESPACE(std)string read_string( ANTLR_USE_NAMESPACE(std)istream& in ); + +/* Read a ([A-Z][0-9][a-z]_)* kindoff thing. Skips leading whitespace. + * @param in the istream to read from. + */ +ANTLR_USE_NAMESPACE(std)string read_identifier( ANTLR_USE_NAMESPACE(std)istream& in ); + +/** Read a attribute="value" thing. Leading whitespace is skipped. + * Between attribute and '=' no whitespace is allowed. After the '=' it is + * permitted. + * @param in the istream to read from. + * @param attribute string the attribute name is put in + * @param value string the value of the attribute is put in + * @throws ios_base::failure if something is fishy. E.g. malformed quoting + * or missing '=' + */ +void read_AttributeNValue( ANTLR_USE_NAMESPACE(std)istream& in, + ANTLR_USE_NAMESPACE(std)string& attribute, + ANTLR_USE_NAMESPACE(std)string& value ); + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif diff --git a/lib/antlr/antlr/ANTLRUtil.hpp b/lib/antlr/antlr/ANTLRUtil.hpp deleted file mode 100644 index 4732588c..00000000 --- a/lib/antlr/antlr/ANTLRUtil.hpp +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef INC_ANTLRUtil_hpp__ -#define INC_ANTLRUtil_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Eat whitespace from the input stream - * @param is the stream to read from - */ -ANTLR_USE_NAMESPACE(std)istream& eatwhite( ANTLR_USE_NAMESPACE(std)istream& is ); - -/** Read a string enclosed by '"' from a stream. Also handles escaping of \". - * Skips leading whitespace. - * @param in the istream to read from. - * @returns the string read from file exclusive the '"' - * @throws ios_base::failure if string is badly formatted - */ -ANTLR_USE_NAMESPACE(std)string read_string( ANTLR_USE_NAMESPACE(std)istream& in ); - -/* Read a ([A-Z][0-9][a-z]_)* kindoff thing. Skips leading whitespace. - * @param in the istream to read from. - */ -ANTLR_USE_NAMESPACE(std)string read_identifier( ANTLR_USE_NAMESPACE(std)istream& in ); - -/** Read a attribute="value" thing. Leading whitespace is skipped. - * Between attribute and '=' no whitespace is allowed. After the '=' it is - * permitted. - * @param in the istream to read from. - * @param attribute string the attribute name is put in - * @param value string the value of the attribute is put in - * @throws ios_base::failure if something is fishy. E.g. malformed quoting - * or missing '=' - */ -void read_AttributeNValue( ANTLR_USE_NAMESPACE(std)istream& in, - ANTLR_USE_NAMESPACE(std)string& attribute, - ANTLR_USE_NAMESPACE(std)string& value ); - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif diff --git a/lib/antlr/antlr/AST.h b/lib/antlr/antlr/AST.h new file mode 100644 index 00000000..49d11b76 --- /dev/null +++ b/lib/antlr/antlr/AST.h @@ -0,0 +1,166 @@ +#ifndef INC_AST_h__ +#define INC_AST_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +struct ASTRef; + +class ANTLR_API AST { +public: + AST() : ref(0) {} + AST(const AST&) : ref(0) {} + virtual ~AST() {} + + /// Return the type name for this AST node. (for XML output) + virtual const char* typeName( void ) const = 0; + /// Clone this AST node. + virtual RefAST clone( void ) const = 0; + /// Is node t equal to this in terms of token type and text? + virtual bool equals(RefAST t) const = 0; + /** Is t an exact structural and equals() match of this tree. The + * 'this' reference is considered the start of a sibling list. + */ + virtual bool equalsList(RefAST t) const = 0; + + /** Is 't' a subtree of this list? The siblings of the root are NOT ignored. + */ + virtual bool equalsListPartial(RefAST t) const = 0; + /** Is tree rooted at 'this' equal to 't'? The siblings of 'this' are + * ignored. + */ + virtual bool equalsTree(RefAST t) const = 0; + /** Is 't' a subtree of the tree rooted at 'this'? The siblings of + * 'this' are ignored. + */ + virtual bool equalsTreePartial(RefAST t) const = 0; + + /** Walk the tree looking for all exact subtree matches. Return + * a vector of RefAST that lets the caller walk the list + * of subtree roots found herein. + */ + virtual ANTLR_USE_NAMESPACE(std)vector findAll(RefAST t) = 0; + + /** Walk the tree looking for all subtrees. Return + * a vector of RefAST that lets the caller walk the list + * of subtree roots found herein. + */ + virtual ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST t) = 0; + + /// Add a node to the end of the child list for this node + virtual void addChild(RefAST c) = 0; + /// Get the number of children. Returns 0 if the node is a leaf + virtual size_t getNumberOfChildren() const = 0; + + /// Get the first child of this node; null if no children + virtual RefAST getFirstChild() const = 0; + /// Get the next sibling in line after this one + virtual RefAST getNextSibling() const = 0; + + /// Get the token text for this node + virtual ANTLR_USE_NAMESPACE(std)string getText() const = 0; + /// Get the token type for this node + virtual int getType() const = 0; + + /** Various initialization routines. Used by several factories to initialize + * an AST element. + */ + virtual void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) = 0; + virtual void initialize(RefAST t) = 0; + virtual void initialize(RefToken t) = 0; + +#ifdef ANTLR_SUPPORT_XML + /** initialize this node from the contents of a stream. + * @param in the stream to read the AST attributes from. + */ + virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in ) = 0; +#endif + + /// Set the first child of a node. + virtual void setFirstChild(RefAST c) = 0; + /// Set the next sibling after this one. + virtual void setNextSibling(RefAST n) = 0; + + /// Set the token text for this node + virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt) = 0; + /// Set the token type for this node + virtual void setType(int type) = 0; + + /// Return this AST node as a string + virtual ANTLR_USE_NAMESPACE(std)string toString() const = 0; + + /// Print out a child-sibling tree in LISP notation + virtual ANTLR_USE_NAMESPACE(std)string toStringList() const = 0; + virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const = 0; + +#ifdef ANTLR_SUPPORT_XML + /** get attributes of this node to 'out'. Override to customize XML + * output. + * @param out the stream to write the AST attributes to. + * @returns if a explicit closetag should be written + */ + virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const = 0; + + /** Print a symbol over ostream. Overload this one to customize the XML + * output for AST derived AST-types + * @param output stream + */ + virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const = 0; + + /** Dump AST contents in XML format to output stream. + * Works in conjunction with to_stream method. Overload that one is + * derived classes to customize behaviour. + * @param output stream to write to string to put the stuff in. + * @param ast RefAST object to write. + */ + friend ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast ); +#endif + +private: + friend struct ASTRef; + ASTRef* ref; + + AST(RefAST other); + AST& operator=(const AST& other); + AST& operator=(RefAST other); +}; + +#ifdef ANTLR_SUPPORT_XML +inline ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast ) +{ + ast->toStream(output); + return output; +} +#endif + +extern ANTLR_API RefAST nullAST; +extern ANTLR_API AST* const nullASTptr; + +#ifdef NEEDS_OPERATOR_LESS_THAN +// RK: apparently needed by MSVC and a SUN CC, up to and including +// 2.7.2 this was undefined ? +inline bool operator<( RefAST l, RefAST r ) +{ + return nullAST == l ? ( nullAST == r ? false : true ) : l->getType() < r->getType(); +} +#endif + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_AST_h__ diff --git a/lib/antlr/antlr/AST.hpp b/lib/antlr/antlr/AST.hpp deleted file mode 100644 index b01a60a9..00000000 --- a/lib/antlr/antlr/AST.hpp +++ /dev/null @@ -1,166 +0,0 @@ -#ifndef INC_AST_hpp__ -#define INC_AST_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -struct ASTRef; - -class ANTLR_API AST { -public: - AST() : ref(0) {} - AST(const AST&) : ref(0) {} - virtual ~AST() {} - - /// Return the type name for this AST node. (for XML output) - virtual const char* typeName( void ) const = 0; - /// Clone this AST node. - virtual RefAST clone( void ) const = 0; - /// Is node t equal to this in terms of token type and text? - virtual bool equals(RefAST t) const = 0; - /** Is t an exact structural and equals() match of this tree. The - * 'this' reference is considered the start of a sibling list. - */ - virtual bool equalsList(RefAST t) const = 0; - - /** Is 't' a subtree of this list? The siblings of the root are NOT ignored. - */ - virtual bool equalsListPartial(RefAST t) const = 0; - /** Is tree rooted at 'this' equal to 't'? The siblings of 'this' are - * ignored. - */ - virtual bool equalsTree(RefAST t) const = 0; - /** Is 't' a subtree of the tree rooted at 'this'? The siblings of - * 'this' are ignored. - */ - virtual bool equalsTreePartial(RefAST t) const = 0; - - /** Walk the tree looking for all exact subtree matches. Return - * a vector of RefAST that lets the caller walk the list - * of subtree roots found herein. - */ - virtual ANTLR_USE_NAMESPACE(std)vector findAll(RefAST t) = 0; - - /** Walk the tree looking for all subtrees. Return - * a vector of RefAST that lets the caller walk the list - * of subtree roots found herein. - */ - virtual ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST t) = 0; - - /// Add a node to the end of the child list for this node - virtual void addChild(RefAST c) = 0; - /// Get the number of children. Returns 0 if the node is a leaf - virtual size_t getNumberOfChildren() const = 0; - - /// Get the first child of this node; null if no children - virtual RefAST getFirstChild() const = 0; - /// Get the next sibling in line after this one - virtual RefAST getNextSibling() const = 0; - - /// Get the token text for this node - virtual ANTLR_USE_NAMESPACE(std)string getText() const = 0; - /// Get the token type for this node - virtual int getType() const = 0; - - /** Various initialization routines. Used by several factories to initialize - * an AST element. - */ - virtual void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) = 0; - virtual void initialize(RefAST t) = 0; - virtual void initialize(RefToken t) = 0; - -#ifdef ANTLR_SUPPORT_XML - /** initialize this node from the contents of a stream. - * @param in the stream to read the AST attributes from. - */ - virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in ) = 0; -#endif - - /// Set the first child of a node. - virtual void setFirstChild(RefAST c) = 0; - /// Set the next sibling after this one. - virtual void setNextSibling(RefAST n) = 0; - - /// Set the token text for this node - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt) = 0; - /// Set the token type for this node - virtual void setType(int type) = 0; - - /// Return this AST node as a string - virtual ANTLR_USE_NAMESPACE(std)string toString() const = 0; - - /// Print out a child-sibling tree in LISP notation - virtual ANTLR_USE_NAMESPACE(std)string toStringList() const = 0; - virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const = 0; - -#ifdef ANTLR_SUPPORT_XML - /** get attributes of this node to 'out'. Override to customize XML - * output. - * @param out the stream to write the AST attributes to. - * @returns if a explicit closetag should be written - */ - virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const = 0; - - /** Print a symbol over ostream. Overload this one to customize the XML - * output for AST derived AST-types - * @param output stream - */ - virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const = 0; - - /** Dump AST contents in XML format to output stream. - * Works in conjunction with to_stream method. Overload that one is - * derived classes to customize behaviour. - * @param output stream to write to string to put the stuff in. - * @param ast RefAST object to write. - */ - friend ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast ); -#endif - -private: - friend struct ASTRef; - ASTRef* ref; - - AST(RefAST other); - AST& operator=(const AST& other); - AST& operator=(RefAST other); -}; - -#ifdef ANTLR_SUPPORT_XML -inline ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast ) -{ - ast->toStream(output); - return output; -} -#endif - -extern ANTLR_API RefAST nullAST; -extern ANTLR_API AST* const nullASTptr; - -#ifdef NEEDS_OPERATOR_LESS_THAN -// RK: apparently needed by MSVC and a SUN CC, up to and including -// 2.7.2 this was undefined ? -inline bool operator<( RefAST l, RefAST r ) -{ - return nullAST == l ? ( nullAST == r ? false : true ) : l->getType() < r->getType(); -} -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_AST_hpp__ diff --git a/lib/antlr/antlr/ASTArray.h b/lib/antlr/antlr/ASTArray.h new file mode 100644 index 00000000..134fc1fb --- /dev/null +++ b/lib/antlr/antlr/ASTArray.h @@ -0,0 +1,45 @@ +#ifndef INC_ASTArray_h__ +#define INC_ASTArray_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** ASTArray is a class that allows ANTLR to + * generate code that can create and initialize an array + * in one expression, like: + * (new ASTArray(3))->add(x)->add(y)->add(z) + */ +class ANTLR_API ASTArray { +public: + int size; // = 0; + ANTLR_USE_NAMESPACE(std)vector array; + + ASTArray(int capacity) + : size(0) + , array(capacity) + { + } + + ASTArray* add(RefAST node) + { + array[size++] = node; + return this; + } +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_ASTArray_h__ diff --git a/lib/antlr/antlr/ASTArray.hpp b/lib/antlr/antlr/ASTArray.hpp deleted file mode 100644 index 2d224d32..00000000 --- a/lib/antlr/antlr/ASTArray.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef INC_ASTArray_hpp__ -#define INC_ASTArray_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** ASTArray is a class that allows ANTLR to - * generate code that can create and initialize an array - * in one expression, like: - * (new ASTArray(3))->add(x)->add(y)->add(z) - */ -class ANTLR_API ASTArray { -public: - int size; // = 0; - ANTLR_USE_NAMESPACE(std)vector array; - - ASTArray(int capacity) - : size(0) - , array(capacity) - { - } - - ASTArray* add(RefAST node) - { - array[size++] = node; - return this; - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTArray_hpp__ diff --git a/lib/antlr/antlr/ASTFactory.h b/lib/antlr/antlr/ASTFactory.h new file mode 100644 index 00000000..04d626d9 --- /dev/null +++ b/lib/antlr/antlr/ASTFactory.h @@ -0,0 +1,165 @@ +#ifndef INC_ASTFactory_h__ +#define INC_ASTFactory_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include +#include + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +// Using these extra types to appease MSVC +typedef RefAST (*factory_type_)(); +typedef ANTLR_USE_NAMESPACE(std)pair< const char*, factory_type_ > factory_descriptor_; +typedef ANTLR_USE_NAMESPACE(std)vector< factory_descriptor_* > factory_descriptor_list_; + +/** AST Super Factory shared by TreeParser and Parser. + * This super factory maintains a map of all AST node types to their respective + * AST factories. One instance should be shared among a parser/treeparser + * chain. + * + * @todo check all this code for possible use of references in + * stead of RefAST's. + */ +class ANTLR_API ASTFactory { +public: + typedef factory_type_ factory_type; + typedef factory_descriptor_ factory_descriptor; + typedef factory_descriptor_list_ factory_descriptor_list; +protected: + /* The mapping of AST node type to factory.. + */ + factory_descriptor default_factory_descriptor; + factory_descriptor_list nodeFactories; +public: + /// Make new factory. Per default (Ref)CommonAST instances are generated. + ASTFactory(); + /** Initialize factory with a non default node type. + * factory_node_name should be the name of the AST node type the factory + * generates. (should exist during the existance of this ASTFactory + * instance) + */ + ASTFactory( const char* factory_node_name, factory_type factory ); + /// Destroy factory + virtual ~ASTFactory(); + + /// Register a node factory for the node type type with name ast_name + void registerFactory( int type, const char* ast_name, factory_type factory ); + /// Set the maximum node (AST) type this factory may encounter + void setMaxNodeType( int type ); + + /// Add a child to the current AST + void addASTChild(ASTPair& currentAST, RefAST child); + /// Create new empty AST node. The right default type shou + virtual RefAST create(); + /// Create AST node of the right type for 'type' + RefAST create(int type); + /// Create AST node of the right type for 'type' and initialize with txt + RefAST create(int type, const ANTLR_USE_NAMESPACE(std)string& txt); + /// Create duplicate of tr + RefAST create(RefAST tr); + /// Create new AST node and initialize contents from a token. + RefAST create(RefToken tok); + /// Create new AST node and initialize contents from a stream. + RefAST create(const ANTLR_USE_NAMESPACE(std)string& txt, ANTLR_USE_NAMESPACE(std)istream& infile ); + /** Deep copy a single node. This function the new clone() methods in the + * AST interface. Returns a new RefAST(nullASTptr) if t is null. + */ + RefAST dup(RefAST t); + /// Duplicate tree including siblings of root. + RefAST dupList(RefAST t); + /** Duplicate a tree, assuming this is a root node of a tree-- + * duplicate that node and what's below; ignore siblings of root node. + */ + RefAST dupTree(RefAST t); + /** Make a tree from a list of nodes. The first element in the + * array is the root. If the root is null, then the tree is + * a simple list not a tree. Handles null children nodes correctly. + * For example, make(a, b, null, c) yields tree (a b c). make(null,a,b) + * yields tree (nil a b). + */ + RefAST make(ANTLR_USE_NAMESPACE(std)vector& nodes); + /** Make a tree from a list of nodes, where the nodes are contained + * in an ASTArray object. The ASTArray is deleted after use. + * @todo FIXME! I have a feeling we can get rid of this ugly ASTArray thing + */ + RefAST make(ASTArray* nodes); + /// Make an AST the root of current AST + void makeASTRoot(ASTPair& currentAST, RefAST root); + + /** Set a new default AST type. + * factory_node_name should be the name of the AST node type the factory + * generates. (should exist during the existance of this ASTFactory + * instance). + * Only change factory between parser runs. You might get unexpected results + * otherwise. + */ + void setASTNodeFactory( const char* factory_node_name, factory_type factory ); + +#ifdef ANTLR_SUPPORT_XML + /** Load a XML AST from stream. Make sure you have all the factories + * registered before use. + * @note this 'XML' stuff is quite rough still. YMMV. + */ + RefAST LoadAST( ANTLR_USE_NAMESPACE(std)istream& infile ); +#endif +protected: + void loadChildren( ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ); + void loadSiblings( ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ); + bool checkCloseTag( ANTLR_USE_NAMESPACE(std)istream& infile ); + +#ifdef ANTLR_VECTOR_HAS_AT + /// construct a node of 'type' + inline RefAST getNodeOfType( unsigned int type ) + { + return RefAST(nodeFactories.at(type)->second()); + } + /// get the name of the node 'type' + const char* getASTNodeType( unsigned int type ) + { + return nodeFactories.at(type)->first; + } + /// get the factory used for node 'type' + factory_type getASTNodeFactory( unsigned int type ) + { + return nodeFactories.at(type)->second; + } +#else + inline RefAST getNodeOfType( unsigned int type ) + { + return RefAST(nodeFactories[type]->second()); + } + /// get the name of the node 'type' + const char* getASTNodeType( unsigned int type ) + { + return nodeFactories[type]->first; + } + factory_type getASTNodeFactory( unsigned int type ) + { + return nodeFactories[type]->second; + } +#endif + +private: + // no copying and such.. + ASTFactory( const ASTFactory& ); + ASTFactory& operator=( const ASTFactory& ); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_ASTFactory_h__ diff --git a/lib/antlr/antlr/ASTFactory.hpp b/lib/antlr/antlr/ASTFactory.hpp deleted file mode 100644 index 968ab6c5..00000000 --- a/lib/antlr/antlr/ASTFactory.hpp +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef INC_ASTFactory_hpp__ -#define INC_ASTFactory_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include -#include - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -// Using these extra types to appease MSVC -typedef RefAST (*factory_type_)(); -typedef ANTLR_USE_NAMESPACE(std)pair< const char*, factory_type_ > factory_descriptor_; -typedef ANTLR_USE_NAMESPACE(std)vector< factory_descriptor_* > factory_descriptor_list_; - -/** AST Super Factory shared by TreeParser and Parser. - * This super factory maintains a map of all AST node types to their respective - * AST factories. One instance should be shared among a parser/treeparser - * chain. - * - * @todo check all this code for possible use of references in - * stead of RefAST's. - */ -class ANTLR_API ASTFactory { -public: - typedef factory_type_ factory_type; - typedef factory_descriptor_ factory_descriptor; - typedef factory_descriptor_list_ factory_descriptor_list; -protected: - /* The mapping of AST node type to factory.. - */ - factory_descriptor default_factory_descriptor; - factory_descriptor_list nodeFactories; -public: - /// Make new factory. Per default (Ref)CommonAST instances are generated. - ASTFactory(); - /** Initialize factory with a non default node type. - * factory_node_name should be the name of the AST node type the factory - * generates. (should exist during the existance of this ASTFactory - * instance) - */ - ASTFactory( const char* factory_node_name, factory_type factory ); - /// Destroy factory - virtual ~ASTFactory(); - - /// Register a node factory for the node type type with name ast_name - void registerFactory( int type, const char* ast_name, factory_type factory ); - /// Set the maximum node (AST) type this factory may encounter - void setMaxNodeType( int type ); - - /// Add a child to the current AST - void addASTChild(ASTPair& currentAST, RefAST child); - /// Create new empty AST node. The right default type shou - virtual RefAST create(); - /// Create AST node of the right type for 'type' - RefAST create(int type); - /// Create AST node of the right type for 'type' and initialize with txt - RefAST create(int type, const ANTLR_USE_NAMESPACE(std)string& txt); - /// Create duplicate of tr - RefAST create(RefAST tr); - /// Create new AST node and initialize contents from a token. - RefAST create(RefToken tok); - /// Create new AST node and initialize contents from a stream. - RefAST create(const ANTLR_USE_NAMESPACE(std)string& txt, ANTLR_USE_NAMESPACE(std)istream& infile ); - /** Deep copy a single node. This function the new clone() methods in the - * AST interface. Returns a new RefAST(nullASTptr) if t is null. - */ - RefAST dup(RefAST t); - /// Duplicate tree including siblings of root. - RefAST dupList(RefAST t); - /** Duplicate a tree, assuming this is a root node of a tree-- - * duplicate that node and what's below; ignore siblings of root node. - */ - RefAST dupTree(RefAST t); - /** Make a tree from a list of nodes. The first element in the - * array is the root. If the root is null, then the tree is - * a simple list not a tree. Handles null children nodes correctly. - * For example, make(a, b, null, c) yields tree (a b c). make(null,a,b) - * yields tree (nil a b). - */ - RefAST make(ANTLR_USE_NAMESPACE(std)vector& nodes); - /** Make a tree from a list of nodes, where the nodes are contained - * in an ASTArray object. The ASTArray is deleted after use. - * @todo FIXME! I have a feeling we can get rid of this ugly ASTArray thing - */ - RefAST make(ASTArray* nodes); - /// Make an AST the root of current AST - void makeASTRoot(ASTPair& currentAST, RefAST root); - - /** Set a new default AST type. - * factory_node_name should be the name of the AST node type the factory - * generates. (should exist during the existance of this ASTFactory - * instance). - * Only change factory between parser runs. You might get unexpected results - * otherwise. - */ - void setASTNodeFactory( const char* factory_node_name, factory_type factory ); - -#ifdef ANTLR_SUPPORT_XML - /** Load a XML AST from stream. Make sure you have all the factories - * registered before use. - * @note this 'XML' stuff is quite rough still. YMMV. - */ - RefAST LoadAST( ANTLR_USE_NAMESPACE(std)istream& infile ); -#endif -protected: - void loadChildren( ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ); - void loadSiblings( ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ); - bool checkCloseTag( ANTLR_USE_NAMESPACE(std)istream& infile ); - -#ifdef ANTLR_VECTOR_HAS_AT - /// construct a node of 'type' - inline RefAST getNodeOfType( unsigned int type ) - { - return RefAST(nodeFactories.at(type)->second()); - } - /// get the name of the node 'type' - const char* getASTNodeType( unsigned int type ) - { - return nodeFactories.at(type)->first; - } - /// get the factory used for node 'type' - factory_type getASTNodeFactory( unsigned int type ) - { - return nodeFactories.at(type)->second; - } -#else - inline RefAST getNodeOfType( unsigned int type ) - { - return RefAST(nodeFactories[type]->second()); - } - /// get the name of the node 'type' - const char* getASTNodeType( unsigned int type ) - { - return nodeFactories[type]->first; - } - factory_type getASTNodeFactory( unsigned int type ) - { - return nodeFactories[type]->second; - } -#endif - -private: - // no copying and such.. - ASTFactory( const ASTFactory& ); - ASTFactory& operator=( const ASTFactory& ); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTFactory_hpp__ diff --git a/lib/antlr/antlr/ASTNULLType.h b/lib/antlr/antlr/ASTNULLType.h new file mode 100644 index 00000000..70d34cca --- /dev/null +++ b/lib/antlr/antlr/ASTNULLType.h @@ -0,0 +1,64 @@ +#ifndef INC_ASTNULLType_h__ +#define INC_ASTNULLType_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** There is only one instance of this class **/ +class ANTLR_API ASTNULLType : public AST { +public: + const char* typeName( void ) const; + RefAST clone( void ) const; + + void addChild(RefAST c); + size_t getNumberOfChildren() const; + void setFirstChild(RefAST c); + void setNextSibling(RefAST n); + + bool equals(RefAST t) const; + bool equalsList(RefAST t) const; + bool equalsListPartial(RefAST t) const; + bool equalsTree(RefAST t) const; + bool equalsTreePartial(RefAST t) const; + + ANTLR_USE_NAMESPACE(std)vector findAll(RefAST tree); + ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST subtree); + + RefAST getFirstChild() const; + RefAST getNextSibling() const; + + ANTLR_USE_NAMESPACE(std)string getText() const; + int getType() const; + + void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt); + void initialize(RefAST t); + void initialize(RefToken t); + void initialize(ANTLR_USE_NAMESPACE(std)istream& infile); + + void setText(const ANTLR_USE_NAMESPACE(std)string& text); + void setType(int ttype); + ANTLR_USE_NAMESPACE(std)string toString() const; + ANTLR_USE_NAMESPACE(std)string toStringList() const; + ANTLR_USE_NAMESPACE(std)string toStringTree() const; + + bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; + void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_ASTNULLType_h__ diff --git a/lib/antlr/antlr/ASTNULLType.hpp b/lib/antlr/antlr/ASTNULLType.hpp deleted file mode 100644 index 867f5e5b..00000000 --- a/lib/antlr/antlr/ASTNULLType.hpp +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef INC_ASTNULLType_hpp__ -#define INC_ASTNULLType_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** There is only one instance of this class **/ -class ANTLR_API ASTNULLType : public AST { -public: - const char* typeName( void ) const; - RefAST clone( void ) const; - - void addChild(RefAST c); - size_t getNumberOfChildren() const; - void setFirstChild(RefAST c); - void setNextSibling(RefAST n); - - bool equals(RefAST t) const; - bool equalsList(RefAST t) const; - bool equalsListPartial(RefAST t) const; - bool equalsTree(RefAST t) const; - bool equalsTreePartial(RefAST t) const; - - ANTLR_USE_NAMESPACE(std)vector findAll(RefAST tree); - ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST subtree); - - RefAST getFirstChild() const; - RefAST getNextSibling() const; - - ANTLR_USE_NAMESPACE(std)string getText() const; - int getType() const; - - void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt); - void initialize(RefAST t); - void initialize(RefToken t); - void initialize(ANTLR_USE_NAMESPACE(std)istream& infile); - - void setText(const ANTLR_USE_NAMESPACE(std)string& text); - void setType(int ttype); - ANTLR_USE_NAMESPACE(std)string toString() const; - ANTLR_USE_NAMESPACE(std)string toStringList() const; - ANTLR_USE_NAMESPACE(std)string toStringTree() const; - - bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; - void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTNULLType_hpp__ diff --git a/lib/antlr/antlr/ASTPair.h b/lib/antlr/antlr/ASTPair.h new file mode 100644 index 00000000..a3f52959 --- /dev/null +++ b/lib/antlr/antlr/ASTPair.h @@ -0,0 +1,57 @@ +#ifndef INC_ASTPair_h__ +#define INC_ASTPair_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** ASTPair: utility class used for manipulating a pair of ASTs + * representing the current AST root and current AST sibling. + * This exists to compensate for the lack of pointers or 'var' + * arguments in Java. + * + * OK, so we can do those things in C++, but it seems easier + * to stick with the Java way for now. + */ +class ANTLR_API ASTPair { +public: + RefAST root; // current root of tree + RefAST child; // current child to which siblings are added + + /** Make sure that child is the last sibling */ + void advanceChildToEnd() { + if (child) { + while (child->getNextSibling()) { + child = child->getNextSibling(); + } + } + } +// /** Copy an ASTPair. Don't call it clone() because we want type-safety */ +// ASTPair copy() { +// ASTPair tmp = new ASTPair(); +// tmp.root = root; +// tmp.child = child; +// return tmp; +// } + ANTLR_USE_NAMESPACE(std)string toString() const { + ANTLR_USE_NAMESPACE(std)string r = !root ? ANTLR_USE_NAMESPACE(std)string("null") : root->getText(); + ANTLR_USE_NAMESPACE(std)string c = !child ? ANTLR_USE_NAMESPACE(std)string("null") : child->getText(); + return "["+r+","+c+"]"; + } +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_ASTPair_h__ diff --git a/lib/antlr/antlr/ASTPair.hpp b/lib/antlr/antlr/ASTPair.hpp deleted file mode 100644 index d6237902..00000000 --- a/lib/antlr/antlr/ASTPair.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef INC_ASTPair_hpp__ -#define INC_ASTPair_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** ASTPair: utility class used for manipulating a pair of ASTs - * representing the current AST root and current AST sibling. - * This exists to compensate for the lack of pointers or 'var' - * arguments in Java. - * - * OK, so we can do those things in C++, but it seems easier - * to stick with the Java way for now. - */ -class ANTLR_API ASTPair { -public: - RefAST root; // current root of tree - RefAST child; // current child to which siblings are added - - /** Make sure that child is the last sibling */ - void advanceChildToEnd() { - if (child) { - while (child->getNextSibling()) { - child = child->getNextSibling(); - } - } - } -// /** Copy an ASTPair. Don't call it clone() because we want type-safety */ -// ASTPair copy() { -// ASTPair tmp = new ASTPair(); -// tmp.root = root; -// tmp.child = child; -// return tmp; -// } - ANTLR_USE_NAMESPACE(std)string toString() const { - ANTLR_USE_NAMESPACE(std)string r = !root ? ANTLR_USE_NAMESPACE(std)string("null") : root->getText(); - ANTLR_USE_NAMESPACE(std)string c = !child ? ANTLR_USE_NAMESPACE(std)string("null") : child->getText(); - return "["+r+","+c+"]"; - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTPair_hpp__ diff --git a/lib/antlr/antlr/ASTRefCount.h b/lib/antlr/antlr/ASTRefCount.h new file mode 100644 index 00000000..889ecc9d --- /dev/null +++ b/lib/antlr/antlr/ASTRefCount.h @@ -0,0 +1,98 @@ +#ifndef INC_ASTRefCount_h__ +# define INC_ASTRefCount_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +# include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + + class AST; + +struct ANTLR_API ASTRef +{ + AST* const ptr; + unsigned int count; + + ASTRef(AST* p); + ~ASTRef(); + ASTRef* increment() + { + ++count; + return this; + } + bool decrement() + { + return (--count==0); + } + + static ASTRef* getRef(const AST* p); +private: + ASTRef( const ASTRef& ); + ASTRef& operator=( const ASTRef& ); +}; + +template + class ANTLR_API ASTRefCount +{ +private: + ASTRef* ref; + +public: + ASTRefCount(const AST* p=0) + : ref(p ? ASTRef::getRef(p) : 0) + { + } + ASTRefCount(const ASTRefCount& other) + : ref(other.ref ? other.ref->increment() : 0) + { + } + ~ASTRefCount() + { + if (ref && ref->decrement()) + delete ref; + } + ASTRefCount& operator=(AST* other) + { + ASTRef* tmp = ASTRef::getRef(other); + + if (ref && ref->decrement()) + delete ref; + + ref=tmp; + + return *this; + } + ASTRefCount& operator=(const ASTRefCount& other) + { + if( other.ref != ref ) + { + ASTRef* tmp = other.ref ? other.ref->increment() : 0; + + if (ref && ref->decrement()) + delete ref; + + ref=tmp; + } + return *this; + } + + operator T* () const { return ref ? static_cast(ref->ptr) : 0; } + T* operator->() const { return ref ? static_cast(ref->ptr) : 0; } + T* get() const { return ref ? static_cast(ref->ptr) : 0; } +}; + +typedef ASTRefCount RefAST; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_ASTRefCount_h__ diff --git a/lib/antlr/antlr/ASTRefCount.hpp b/lib/antlr/antlr/ASTRefCount.hpp deleted file mode 100644 index f5ef4422..00000000 --- a/lib/antlr/antlr/ASTRefCount.hpp +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef INC_ASTRefCount_hpp__ -# define INC_ASTRefCount_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -# include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - - class AST; - -struct ANTLR_API ASTRef -{ - AST* const ptr; - unsigned int count; - - ASTRef(AST* p); - ~ASTRef(); - ASTRef* increment() - { - ++count; - return this; - } - bool decrement() - { - return (--count==0); - } - - static ASTRef* getRef(const AST* p); -private: - ASTRef( const ASTRef& ); - ASTRef& operator=( const ASTRef& ); -}; - -template - class ANTLR_API ASTRefCount -{ -private: - ASTRef* ref; - -public: - ASTRefCount(const AST* p=0) - : ref(p ? ASTRef::getRef(p) : 0) - { - } - ASTRefCount(const ASTRefCount& other) - : ref(other.ref ? other.ref->increment() : 0) - { - } - ~ASTRefCount() - { - if (ref && ref->decrement()) - delete ref; - } - ASTRefCount& operator=(AST* other) - { - ASTRef* tmp = ASTRef::getRef(other); - - if (ref && ref->decrement()) - delete ref; - - ref=tmp; - - return *this; - } - ASTRefCount& operator=(const ASTRefCount& other) - { - if( other.ref != ref ) - { - ASTRef* tmp = other.ref ? other.ref->increment() : 0; - - if (ref && ref->decrement()) - delete ref; - - ref=tmp; - } - return *this; - } - - operator T* () const { return ref ? static_cast(ref->ptr) : 0; } - T* operator->() const { return ref ? static_cast(ref->ptr) : 0; } - T* get() const { return ref ? static_cast(ref->ptr) : 0; } -}; - -typedef ASTRefCount RefAST; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ASTRefCount_hpp__ diff --git a/lib/antlr/antlr/BaseAST.h b/lib/antlr/antlr/BaseAST.h new file mode 100644 index 00000000..bb797f24 --- /dev/null +++ b/lib/antlr/antlr/BaseAST.h @@ -0,0 +1,193 @@ +#ifndef INC_BaseAST_h__ +#define INC_BaseAST_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API BaseAST; +typedef ASTRefCount RefBaseAST; + +class ANTLR_API BaseAST : public AST { +public: + BaseAST() : AST() + { + } + BaseAST(const BaseAST& other) + : AST(other) + { + } + virtual ~BaseAST() + { + } + + /// Return the class name + virtual const char* typeName( void ) const = 0; + + /// Clone this AST node. + virtual RefAST clone( void ) const = 0; + + /// Is node t equal to this in terms of token type and text? + virtual bool equals(RefAST t) const; + + /** Is t an exact structural and equals() match of this tree. The + * 'this' reference is considered the start of a sibling list. + */ + virtual bool equalsList(RefAST t) const; + + /** Is 't' a subtree of this list? The siblings of the root are NOT ignored. + */ + virtual bool equalsListPartial(RefAST t) const; + + /** Is tree rooted at 'this' equal to 't'? The siblings of 'this' are + * ignored. + */ + virtual bool equalsTree(RefAST t) const; + + /** Is 't' a subtree of the tree rooted at 'this'? The siblings of + * 'this' are ignored. + */ + virtual bool equalsTreePartial(RefAST t) const; + + /** Walk the tree looking for all exact subtree matches. Return + * an ASTEnumerator that lets the caller walk the list + * of subtree roots found herein. + */ + virtual ANTLR_USE_NAMESPACE(std)vector findAll(RefAST t); + + /** Walk the tree looking for all subtrees. Return + * an ASTEnumerator that lets the caller walk the list + * of subtree roots found herein. + */ + virtual ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST t); + + /// Add a node to the end of the child list for this node + virtual void addChild(RefAST c) + { + if( !c ) + return; + + RefBaseAST tmp = down; + + if (tmp) + { + while (tmp->right) + tmp = tmp->right; + tmp->right = c; + } + else + down = c; + } + + /** Get the number of child nodes of this node (shallow e.g. not of the + * whole tree it spans). + */ + virtual size_t getNumberOfChildren() const; + + /// Get the first child of this node; null if no children + virtual RefAST getFirstChild() const + { + return RefAST(down); + } + /// Get the next sibling in line after this one + virtual RefAST getNextSibling() const + { + return RefAST(right); + } + + /// Get the token text for this node + virtual ANTLR_USE_NAMESPACE(std)string getText() const + { + return ""; + } + /// Get the token type for this node + virtual int getType() const + { + return 0; + } + + /// Remove all children + virtual void removeChildren() + { + down = static_cast(static_cast(nullAST)); + } + + /// Set the first child of a node. + virtual void setFirstChild(RefAST c) + { + down = static_cast(static_cast(c)); + } + + /// Set the next sibling after this one. + virtual void setNextSibling(RefAST n) + { + right = static_cast(static_cast(n)); + } + + /// Set the token text for this node + virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt) + { + } + + /// Set the token type for this node + virtual void setType(int type) + { + } + +#ifdef ANTLR_SUPPORT_XML + /** print attributes of this node to 'out'. Override to customize XML + * output. + * @param out the stream to write the AST attributes to. + */ + virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const; + /** Write this subtree to a stream. Overload this one to customize the XML + * output for AST derived AST-types + * @param output stream + */ + virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; +#endif + + /// Return string representation for the AST + virtual ANTLR_USE_NAMESPACE(std)string toString() const + { + return getText(); + } + + /// Print out a child sibling tree in LISP notation + virtual ANTLR_USE_NAMESPACE(std)string toStringList() const; + virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const; +protected: + RefBaseAST down; + RefBaseAST right; +private: + void doWorkForFindAll(ANTLR_USE_NAMESPACE(std)vector& v, + RefAST target, + bool partialMatch); +}; + +/** Is node t equal to this in terms of token type and text? + */ +inline bool BaseAST::equals(RefAST t) const +{ + if (!t) + return false; + return ((getType() == t->getType()) && (getText() == t->getText())); +} + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_BaseAST_h__ diff --git a/lib/antlr/antlr/BaseAST.hpp b/lib/antlr/antlr/BaseAST.hpp deleted file mode 100644 index 1bfc4e56..00000000 --- a/lib/antlr/antlr/BaseAST.hpp +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef INC_BaseAST_hpp__ -#define INC_BaseAST_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API BaseAST; -typedef ASTRefCount RefBaseAST; - -class ANTLR_API BaseAST : public AST { -public: - BaseAST() : AST() - { - } - BaseAST(const BaseAST& other) - : AST(other) - { - } - virtual ~BaseAST() - { - } - - /// Return the class name - virtual const char* typeName( void ) const = 0; - - /// Clone this AST node. - virtual RefAST clone( void ) const = 0; - - /// Is node t equal to this in terms of token type and text? - virtual bool equals(RefAST t) const; - - /** Is t an exact structural and equals() match of this tree. The - * 'this' reference is considered the start of a sibling list. - */ - virtual bool equalsList(RefAST t) const; - - /** Is 't' a subtree of this list? The siblings of the root are NOT ignored. - */ - virtual bool equalsListPartial(RefAST t) const; - - /** Is tree rooted at 'this' equal to 't'? The siblings of 'this' are - * ignored. - */ - virtual bool equalsTree(RefAST t) const; - - /** Is 't' a subtree of the tree rooted at 'this'? The siblings of - * 'this' are ignored. - */ - virtual bool equalsTreePartial(RefAST t) const; - - /** Walk the tree looking for all exact subtree matches. Return - * an ASTEnumerator that lets the caller walk the list - * of subtree roots found herein. - */ - virtual ANTLR_USE_NAMESPACE(std)vector findAll(RefAST t); - - /** Walk the tree looking for all subtrees. Return - * an ASTEnumerator that lets the caller walk the list - * of subtree roots found herein. - */ - virtual ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST t); - - /// Add a node to the end of the child list for this node - virtual void addChild(RefAST c) - { - if( !c ) - return; - - RefBaseAST tmp = down; - - if (tmp) - { - while (tmp->right) - tmp = tmp->right; - tmp->right = c; - } - else - down = c; - } - - /** Get the number of child nodes of this node (shallow e.g. not of the - * whole tree it spans). - */ - virtual size_t getNumberOfChildren() const; - - /// Get the first child of this node; null if no children - virtual RefAST getFirstChild() const - { - return RefAST(down); - } - /// Get the next sibling in line after this one - virtual RefAST getNextSibling() const - { - return RefAST(right); - } - - /// Get the token text for this node - virtual ANTLR_USE_NAMESPACE(std)string getText() const - { - return ""; - } - /// Get the token type for this node - virtual int getType() const - { - return 0; - } - - /// Remove all children - virtual void removeChildren() - { - down = static_cast(static_cast(nullAST)); - } - - /// Set the first child of a node. - virtual void setFirstChild(RefAST c) - { - down = static_cast(static_cast(c)); - } - - /// Set the next sibling after this one. - virtual void setNextSibling(RefAST n) - { - right = static_cast(static_cast(n)); - } - - /// Set the token text for this node - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt) - { - } - - /// Set the token type for this node - virtual void setType(int type) - { - } - -#ifdef ANTLR_SUPPORT_XML - /** print attributes of this node to 'out'. Override to customize XML - * output. - * @param out the stream to write the AST attributes to. - */ - virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const; - /** Write this subtree to a stream. Overload this one to customize the XML - * output for AST derived AST-types - * @param output stream - */ - virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; -#endif - - /// Return string representation for the AST - virtual ANTLR_USE_NAMESPACE(std)string toString() const - { - return getText(); - } - - /// Print out a child sibling tree in LISP notation - virtual ANTLR_USE_NAMESPACE(std)string toStringList() const; - virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const; -protected: - RefBaseAST down; - RefBaseAST right; -private: - void doWorkForFindAll(ANTLR_USE_NAMESPACE(std)vector& v, - RefAST target, - bool partialMatch); -}; - -/** Is node t equal to this in terms of token type and text? - */ -inline bool BaseAST::equals(RefAST t) const -{ - if (!t) - return false; - return ((getType() == t->getType()) && (getText() == t->getText())); -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_BaseAST_hpp__ diff --git a/lib/antlr/antlr/BitSet.h b/lib/antlr/antlr/BitSet.h new file mode 100644 index 00000000..696a91a0 --- /dev/null +++ b/lib/antlr/antlr/BitSet.h @@ -0,0 +1,60 @@ +#ifndef INC_BitSet_h__ +#define INC_BitSet_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** A BitSet to replace java.util.BitSet. + * Primary differences are that most set operators return new sets + * as opposed to oring and anding "in place". Further, a number of + * operations were added. I cannot contain a BitSet because there + * is no way to access the internal bits (which I need for speed) + * and, because it is final, I cannot subclass to add functionality. + * Consider defining set degree. Without access to the bits, I must + * call a method n times to test the ith bit...ack! + * + * Also seems like or() from util is wrong when size of incoming set is bigger + * than this.length. + * + * This is a C++ version of the Java class described above, with only + * a handful of the methods implemented, because we don't need the + * others at runtime. It's really just a wrapper around vector, + * which should probably be changed to a wrapper around bitset, once + * bitset is more widely available. + * + * @author Terence Parr, MageLang Institute + * @author
Pete Wells + */ +class ANTLR_API BitSet { +private: + ANTLR_USE_NAMESPACE(std)vector storage; + +public: + BitSet( unsigned int nbits=64 ); + BitSet( const unsigned long* bits_, unsigned int nlongs); + ~BitSet(); + + void add( unsigned int el ); + + bool member( unsigned int el ) const; + + ANTLR_USE_NAMESPACE(std)vector toArray() const; +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_BitSet_h__ diff --git a/lib/antlr/antlr/BitSet.hpp b/lib/antlr/antlr/BitSet.hpp deleted file mode 100644 index f7619232..00000000 --- a/lib/antlr/antlr/BitSet.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef INC_BitSet_hpp__ -#define INC_BitSet_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A BitSet to replace java.util.BitSet. - * Primary differences are that most set operators return new sets - * as opposed to oring and anding "in place". Further, a number of - * operations were added. I cannot contain a BitSet because there - * is no way to access the internal bits (which I need for speed) - * and, because it is final, I cannot subclass to add functionality. - * Consider defining set degree. Without access to the bits, I must - * call a method n times to test the ith bit...ack! - * - * Also seems like or() from util is wrong when size of incoming set is bigger - * than this.length. - * - * This is a C++ version of the Java class described above, with only - * a handful of the methods implemented, because we don't need the - * others at runtime. It's really just a wrapper around vector, - * which should probably be changed to a wrapper around bitset, once - * bitset is more widely available. - * - * @author Terence Parr, MageLang Institute - * @author
Pete Wells - */ -class ANTLR_API BitSet { -private: - ANTLR_USE_NAMESPACE(std)vector storage; - -public: - BitSet( unsigned int nbits=64 ); - BitSet( const unsigned long* bits_, unsigned int nlongs); - ~BitSet(); - - void add( unsigned int el ); - - bool member( unsigned int el ) const; - - ANTLR_USE_NAMESPACE(std)vector toArray() const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_BitSet_hpp__ diff --git a/lib/antlr/antlr/CharBuffer.h b/lib/antlr/antlr/CharBuffer.h new file mode 100644 index 00000000..647fe466 --- /dev/null +++ b/lib/antlr/antlr/CharBuffer.h @@ -0,0 +1,56 @@ +#ifndef INC_CharBuffer_h__ +#define INC_CharBuffer_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include + +#include + +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/**A Stream of characters fed to the lexer from a InputStream that can + * be rewound via mark()/rewind() methods. + *

+ * A dynamic array is used to buffer up all the input characters. Normally, + * "k" characters are stored in the buffer. More characters may be stored + * during guess mode (testing syntactic predicate), or when LT(i>k) is + * referenced. + * Consumption of characters is deferred. In other words, reading the next + * character is not done by consume(), but deferred until needed by LA or LT. + *

+ * + * @see antlr.CharQueue + */ + +class ANTLR_API CharBuffer : public InputBuffer { +public: + /// Create a character buffer + CharBuffer( ANTLR_USE_NAMESPACE(std)istream& input ); + /// Get the next character from the stream + int getChar(); + +protected: + // character source + ANTLR_USE_NAMESPACE(std)istream& input; + +private: + // NOTE: Unimplemented + CharBuffer(const CharBuffer& other); + CharBuffer& operator=(const CharBuffer& other); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CharBuffer_h__ diff --git a/lib/antlr/antlr/CharBuffer.hpp b/lib/antlr/antlr/CharBuffer.hpp deleted file mode 100644 index fe2b1bc5..00000000 --- a/lib/antlr/antlr/CharBuffer.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef INC_CharBuffer_hpp__ -#define INC_CharBuffer_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include - -#include - -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**A Stream of characters fed to the lexer from a InputStream that can - * be rewound via mark()/rewind() methods. - *

- * A dynamic array is used to buffer up all the input characters. Normally, - * "k" characters are stored in the buffer. More characters may be stored - * during guess mode (testing syntactic predicate), or when LT(i>k) is - * referenced. - * Consumption of characters is deferred. In other words, reading the next - * character is not done by consume(), but deferred until needed by LA or LT. - *

- * - * @see antlr.CharQueue - */ - -class ANTLR_API CharBuffer : public InputBuffer { -public: - /// Create a character buffer - CharBuffer( ANTLR_USE_NAMESPACE(std)istream& input ); - /// Get the next character from the stream - int getChar(); - -protected: - // character source - ANTLR_USE_NAMESPACE(std)istream& input; - -private: - // NOTE: Unimplemented - CharBuffer(const CharBuffer& other); - CharBuffer& operator=(const CharBuffer& other); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CharBuffer_hpp__ diff --git a/lib/antlr/antlr/CharInputBuffer.h b/lib/antlr/antlr/CharInputBuffer.h new file mode 100644 index 00000000..8d4b3369 --- /dev/null +++ b/lib/antlr/antlr/CharInputBuffer.h @@ -0,0 +1,77 @@ +#ifndef INC_CharInputBuffer_h__ +# define INC_CharInputBuffer_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +# include +# include + +# ifdef HAS_NOT_CCTYPE_H +# include +# else +# include +# endif + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** CharInputBuffer.h provides an InputBuffer for plain character arrays (buffers). + */ +class CharInputBuffer : public InputBuffer +{ +public: + /** Construct a CharInputBuffer.h object with a char* buffer of 'size' + * if 'owner' is true, then the buffer will be delete[]-ed on destruction. + * @note it is assumed the buffer was allocated with new[]! + */ + CharInputBuffer( unsigned char* buf, size_t size, bool owner = false ) + : buffer(buf) + , ptr(buf) + , end(buf + size) + , delete_buffer(owner) + { + } + + /** Destructor + * @note If you're using malloced data, then you probably need to change + * this destructor. Or better use this class as template for your own. + */ + ~CharInputBuffer( void ) + { + if( delete_buffer && buffer ) + delete [] buffer; + } + + /** Reset the CharInputBuffer to initial state + * Called from LexerInputState::reset. + * @see LexerInputState + */ + virtual inline void reset( void ) + { + InputBuffer::reset(); + ptr = buffer; + } + + virtual int getChar( void ) + { + return (ptr < end) ? *ptr++ : EOF; + } + +protected: + unsigned char* buffer; ///< the buffer with data + unsigned char* ptr; ///< position ptr into the buffer + unsigned char* end; ///< end sentry for buffer + bool delete_buffer; ///< flag signifying if we have to delete the buffer +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif diff --git a/lib/antlr/antlr/CharInputBuffer.hpp b/lib/antlr/antlr/CharInputBuffer.hpp deleted file mode 100644 index 543972a3..00000000 --- a/lib/antlr/antlr/CharInputBuffer.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef INC_CharInputBuffer_hpp__ -# define INC_CharInputBuffer_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -# include -# include - -# ifdef HAS_NOT_CCTYPE_H -# include -# else -# include -# endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** CharInputBuffer.hpp provides an InputBuffer for plain character arrays (buffers). - */ -class CharInputBuffer : public InputBuffer -{ -public: - /** Construct a CharInputBuffer.hpp object with a char* buffer of 'size' - * if 'owner' is true, then the buffer will be delete[]-ed on destruction. - * @note it is assumed the buffer was allocated with new[]! - */ - CharInputBuffer( unsigned char* buf, size_t size, bool owner = false ) - : buffer(buf) - , ptr(buf) - , end(buf + size) - , delete_buffer(owner) - { - } - - /** Destructor - * @note If you're using malloced data, then you probably need to change - * this destructor. Or better use this class as template for your own. - */ - ~CharInputBuffer( void ) - { - if( delete_buffer && buffer ) - delete [] buffer; - } - - /** Reset the CharInputBuffer to initial state - * Called from LexerInputState::reset. - * @see LexerInputState - */ - virtual inline void reset( void ) - { - InputBuffer::reset(); - ptr = buffer; - } - - virtual int getChar( void ) - { - return (ptr < end) ? *ptr++ : EOF; - } - -protected: - unsigned char* buffer; ///< the buffer with data - unsigned char* ptr; ///< position ptr into the buffer - unsigned char* end; ///< end sentry for buffer - bool delete_buffer; ///< flag signifying if we have to delete the buffer -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif diff --git a/lib/antlr/antlr/CharScanner.h b/lib/antlr/antlr/CharScanner.h new file mode 100644 index 00000000..9ad6fc7b --- /dev/null +++ b/lib/antlr/antlr/CharScanner.h @@ -0,0 +1,576 @@ +#ifndef INC_CharScanner_h__ +#define INC_CharScanner_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include + +#include + +#ifdef HAS_NOT_CCTYPE_H +#include +#else +#include +#endif +#include +#include + +#if ( _MSC_VER == 1200 ) +// VC6 seems to need this +// note that this is not a standard C++ include file. +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API CharScanner; + +ANTLR_C_USING(tolower) + +#ifdef ANTLR_REALLY_NO_STRCASECMP +// Apparently, neither strcasecmp nor stricmp is standard, and Codewarrior +// on the mac has neither... +inline int strcasecmp(const char *s1, const char *s2) +{ + while (true) + { + char c1 = tolower(*s1++), + c2 = tolower(*s2++); + if (c1 < c2) return -1; + if (c1 > c2) return 1; + if (c1 == 0) return 0; + } +} +#else +#ifdef NO_STRCASECMP +ANTLR_C_USING(stricmp) +#else +ANTLR_C_USING(strcasecmp) +#endif +#endif + +/** Functor for the literals map + */ +class ANTLR_API CharScannerLiteralsLess : public ANTLR_USE_NAMESPACE(std)binary_function { +private: + const CharScanner* scanner; +public: +#ifdef NO_TEMPLATE_PARTS + CharScannerLiteralsLess() {} // not really used, definition to appease MSVC +#endif + CharScannerLiteralsLess(const CharScanner* theScanner) + : scanner(theScanner) + { + } + bool operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const; +// defaults are good enough.. + // CharScannerLiteralsLess(const CharScannerLiteralsLess&); + // CharScannerLiteralsLess& operator=(const CharScannerLiteralsLess&); +}; + +/** Superclass of generated lexers + */ +class ANTLR_API CharScanner : public TokenStream { +protected: + typedef RefToken (*factory_type)(); +public: + CharScanner(InputBuffer& cb, bool case_sensitive ); + CharScanner(InputBuffer* cb, bool case_sensitive ); + CharScanner(const LexerSharedInputState& state, bool case_sensitive ); + + virtual ~CharScanner() + { + } + + virtual int LA(unsigned int i); + + virtual void append(char c) + { + if (saveConsumedInput) + { + size_t l = text.length(); + + if ((l%256) == 0) + text.reserve(l+256); + + text.replace(l,0,&c,1); + } + } + + virtual void append(const ANTLR_USE_NAMESPACE(std)string& s) + { + if( saveConsumedInput ) + text += s; + } + + virtual void commit() + { + inputState->getInput().commit(); + } + + /** called by the generated lexer to do error recovery, override to + * customize the behaviour. + */ + virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) + { + consume(); + consumeUntil(tokenSet); + } + + virtual void consume() + { + if (inputState->guessing == 0) + { + int c = LA(1); + if (caseSensitive) + { + append(c); + } + else + { + // use input.LA(), not LA(), to get original case + // CharScanner.LA() would toLower it. + append(inputState->getInput().LA(1)); + } + + // RK: in a sense I don't like this automatic handling. + if (c == '\t') + tab(); + else + inputState->column++; + } + inputState->getInput().consume(); + } + + /** Consume chars until one matches the given char */ + virtual void consumeUntil(int c) + { + for(;;) + { + int la_1 = LA(1); + if( la_1 == EOF_CHAR || la_1 == c ) + break; + consume(); + } + } + + /** Consume chars until one matches the given set */ + virtual void consumeUntil(const BitSet& set) + { + for(;;) + { + int la_1 = LA(1); + if( la_1 == EOF_CHAR || set.member(la_1) ) + break; + consume(); + } + } + + /// Mark the current position and return a id for it + virtual unsigned int mark() + { + return inputState->getInput().mark(); + } + /// Rewind the scanner to a previously marked position + virtual void rewind(unsigned int pos) + { + inputState->getInput().rewind(pos); + } + + /// See if input contains character 'c' throw MismatchedCharException if not + virtual void match(int c) + { + int la_1 = LA(1); + if ( la_1 != c ) + throw MismatchedCharException(la_1, c, false, this); + consume(); + } + + /** See if input contains element from bitset b + * throw MismatchedCharException if not + */ + virtual void match(const BitSet& b) + { + int la_1 = LA(1); + + if ( !b.member(la_1) ) + throw MismatchedCharException( la_1, b, false, this ); + consume(); + } + + /** See if input contains string 's' throw MismatchedCharException if not + * @note the string cannot match EOF + */ + virtual void match( const char* s ) + { + while( *s != '\0' ) + { + // the & 0xFF is here to prevent sign extension lateron + int la_1 = LA(1), c = (*s++ & 0xFF); + + if ( la_1 != c ) + throw MismatchedCharException(la_1, c, false, this); + + consume(); + } + } + /** See if input contains string 's' throw MismatchedCharException if not + * @note the string cannot match EOF + */ + virtual void match(const ANTLR_USE_NAMESPACE(std)string& s) + { + size_t len = s.length(); + + for (size_t i = 0; i < len; i++) + { + // the & 0xFF is here to prevent sign extension lateron + int la_1 = LA(1), c = (s[i] & 0xFF); + + if ( la_1 != c ) + throw MismatchedCharException(la_1, c, false, this); + + consume(); + } + } + /** See if input does not contain character 'c' + * throw MismatchedCharException if not + */ + virtual void matchNot(int c) + { + int la_1 = LA(1); + + if ( la_1 == c ) + throw MismatchedCharException(la_1, c, true, this); + + consume(); + } + /** See if input contains character in range c1-c2 + * throw MismatchedCharException if not + */ + virtual void matchRange(int c1, int c2) + { + int la_1 = LA(1); + + if ( la_1 < c1 || la_1 > c2 ) + throw MismatchedCharException(la_1, c1, c2, false, this); + + consume(); + } + + virtual bool getCaseSensitive() const + { + return caseSensitive; + } + + virtual void setCaseSensitive(bool t) + { + caseSensitive = t; + } + + virtual bool getCaseSensitiveLiterals() const=0; + + /// Get the line the scanner currently is in (starts at 1) + virtual int getLine() const + { + return inputState->line; + } + + /// set the line number + virtual void setLine(int l) + { + inputState->line = l; + } + + /// Get the column the scanner currently is in (starts at 1) + virtual int getColumn() const + { + return inputState->column; + } + /// set the column number + virtual void setColumn(int c) + { + inputState->column = c; + } + + /// get the filename for the file currently used + virtual const ANTLR_USE_NAMESPACE(std)string& getFilename() const + { + return inputState->filename; + } + /// Set the filename the scanner is using (used in error messages) + virtual void setFilename(const ANTLR_USE_NAMESPACE(std)string& f) + { + inputState->filename = f; + } + + virtual bool getCommitToPath() const + { + return commitToPath; + } + + virtual void setCommitToPath(bool commit) + { + commitToPath = commit; + } + + /** return a copy of the current text buffer */ + virtual const ANTLR_USE_NAMESPACE(std)string& getText() const + { + return text; + } + + virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s) + { + text = s; + } + + virtual void resetText() + { + text = ""; + inputState->tokenStartColumn = inputState->column; + inputState->tokenStartLine = inputState->line; + } + + virtual RefToken getTokenObject() const + { + return _returnToken; + } + + /** Used to keep track of line breaks, needs to be called from + * within generated lexers when a \n \r is encountered. + */ + virtual void newline() + { + ++inputState->line; + inputState->column = 1; + } + + /** Advance the current column number by an appropriate amount according + * to the tabsize. This method needs to be explicitly called from the + * lexer rules encountering tabs. + */ + virtual void tab() + { + int c = getColumn(); + int nc = ( ((c-1)/tabsize) + 1) * tabsize + 1; // calculate tab stop + setColumn( nc ); + } + /// set the tabsize. Returns the old tabsize + int setTabsize( int size ) + { + int oldsize = tabsize; + tabsize = size; + return oldsize; + } + /// Return the tabsize used by the scanner + int getTabSize() const + { + return tabsize; + } + + /** Report exception errors caught in nextToken() */ + virtual void reportError(const RecognitionException& e); + + /** Parser error-reporting function can be overridden in subclass */ + virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); + + /** Parser warning-reporting function can be overridden in subclass */ + virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); + + virtual InputBuffer& getInputBuffer() + { + return inputState->getInput(); + } + + virtual LexerSharedInputState getInputState() + { + return inputState; + } + + /** set the input state for the lexer. + * @note state is a reference counted object, hence no reference */ + virtual void setInputState(LexerSharedInputState state) + { + inputState = state; + } + + /// Set the factory for created tokens + virtual void setTokenObjectFactory(factory_type factory) + { + tokenFactory = factory; + } + + /** Test the token text against the literals table + * Override this method to perform a different literals test + */ + virtual int testLiteralsTable(int ttype) const + { + ANTLR_USE_NAMESPACE(std)map::const_iterator i = literals.find(text); + if (i != literals.end()) + ttype = (*i).second; + return ttype; + } + + /** Test the text passed in against the literals table + * Override this method to perform a different literals test + * This is used primarily when you want to test a portion of + * a token + */ + virtual int testLiteralsTable(const ANTLR_USE_NAMESPACE(std)string& txt,int ttype) const + { + ANTLR_USE_NAMESPACE(std)map::const_iterator i = literals.find(txt); + if (i != literals.end()) + ttype = (*i).second; + return ttype; + } + + /// Override this method to get more specific case handling + virtual int toLower(int c) const + { + // test on EOF_CHAR for buggy (?) STLPort tolower (or HPUX tolower?) + // also VC++ 6.0 does this. (see fix 422 (is reverted by this fix) + // this one is more structural. Maybe make this configurable. + return (c == EOF_CHAR ? EOF_CHAR : tolower(c)); + } + + /** This method is called by YourLexer::nextToken() when the lexer has + * hit EOF condition. EOF is NOT a character. + * This method is not called if EOF is reached during + * syntactic predicate evaluation or during evaluation + * of normal lexical rules, which presumably would be + * an IOException. This traps the "normal" EOF condition. + * + * uponEOF() is called after the complete evaluation of + * the previous token and only if your parser asks + * for another token beyond that last non-EOF token. + * + * You might want to throw token or char stream exceptions + * like: "Heh, premature eof" or a retry stream exception + * ("I found the end of this file, go back to referencing file"). + */ + virtual void uponEOF() + { + } + + /// Methods used to change tracing behavior + virtual void traceIndent(); + virtual void traceIn(const char* rname); + virtual void traceOut(const char* rname); + +#ifndef NO_STATIC_CONSTS + static const int EOF_CHAR = EOF; +#else + enum { + EOF_CHAR = EOF + }; +#endif +protected: + ANTLR_USE_NAMESPACE(std)string text; ///< Text of current token + /// flag indicating wether consume saves characters + bool saveConsumedInput; + factory_type tokenFactory; ///< Factory for tokens + bool caseSensitive; ///< Is this lexer case sensitive + ANTLR_USE_NAMESPACE(std)map literals; // set by subclass + + RefToken _returnToken; ///< used to return tokens w/o using return val + + /// Input state, gives access to input stream, shared among different lexers + LexerSharedInputState inputState; + + /** Used during filter mode to indicate that path is desired. + * A subsequent scan error will report an error as usual + * if acceptPath=true; + */ + bool commitToPath; + + int tabsize; ///< tab size the scanner uses. + + /// Create a new RefToken of type t + virtual RefToken makeToken(int t) + { + RefToken tok = tokenFactory(); + tok->setType(t); + tok->setColumn(inputState->tokenStartColumn); + tok->setLine(inputState->tokenStartLine); + return tok; + } + + /** Tracer class, used when -traceLexer is passed to antlr + */ + class Tracer { + private: + CharScanner* parser; + const char* text; + + Tracer(const Tracer& other); // undefined + Tracer& operator=(const Tracer& other); // undefined + public: + Tracer( CharScanner* p,const char* t ) + : parser(p), text(t) + { + parser->traceIn(text); + } + ~Tracer() + { + parser->traceOut(text); + } + }; + + int traceDepth; +private: + CharScanner( const CharScanner& other ); // undefined + CharScanner& operator=( const CharScanner& other ); // undefined + +#ifndef NO_STATIC_CONSTS + static const int NO_CHAR = 0; +#else + enum { + NO_CHAR = 0 + }; +#endif +}; + +inline int CharScanner::LA(unsigned int i) +{ + int c = inputState->getInput().LA(i); + + if ( caseSensitive ) + return c; + else + return toLower(c); // VC 6 tolower bug caught in toLower. +} + +inline bool CharScannerLiteralsLess::operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const +{ + if (scanner->getCaseSensitiveLiterals()) + return ANTLR_USE_NAMESPACE(std)less()(x,y); + else + { +#ifdef NO_STRCASECMP + return (stricmp(x.c_str(),y.c_str())<0); +#else + return (strcasecmp(x.c_str(),y.c_str())<0); +#endif + } +} + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CharScanner_h__ diff --git a/lib/antlr/antlr/CharScanner.hpp b/lib/antlr/antlr/CharScanner.hpp deleted file mode 100644 index f7e58520..00000000 --- a/lib/antlr/antlr/CharScanner.hpp +++ /dev/null @@ -1,576 +0,0 @@ -#ifndef INC_CharScanner_hpp__ -#define INC_CharScanner_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include - -#include - -#ifdef HAS_NOT_CCTYPE_H -#include -#else -#include -#endif -#include -#include - -#if ( _MSC_VER == 1200 ) -// VC6 seems to need this -// note that this is not a standard C++ include file. -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CharScanner; - -ANTLR_C_USING(tolower) - -#ifdef ANTLR_REALLY_NO_STRCASECMP -// Apparently, neither strcasecmp nor stricmp is standard, and Codewarrior -// on the mac has neither... -inline int strcasecmp(const char *s1, const char *s2) -{ - while (true) - { - char c1 = tolower(*s1++), - c2 = tolower(*s2++); - if (c1 < c2) return -1; - if (c1 > c2) return 1; - if (c1 == 0) return 0; - } -} -#else -#ifdef NO_STRCASECMP -ANTLR_C_USING(stricmp) -#else -ANTLR_C_USING(strcasecmp) -#endif -#endif - -/** Functor for the literals map - */ -class ANTLR_API CharScannerLiteralsLess : public ANTLR_USE_NAMESPACE(std)binary_function { -private: - const CharScanner* scanner; -public: -#ifdef NO_TEMPLATE_PARTS - CharScannerLiteralsLess() {} // not really used, definition to appease MSVC -#endif - CharScannerLiteralsLess(const CharScanner* theScanner) - : scanner(theScanner) - { - } - bool operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const; -// defaults are good enough.. - // CharScannerLiteralsLess(const CharScannerLiteralsLess&); - // CharScannerLiteralsLess& operator=(const CharScannerLiteralsLess&); -}; - -/** Superclass of generated lexers - */ -class ANTLR_API CharScanner : public TokenStream { -protected: - typedef RefToken (*factory_type)(); -public: - CharScanner(InputBuffer& cb, bool case_sensitive ); - CharScanner(InputBuffer* cb, bool case_sensitive ); - CharScanner(const LexerSharedInputState& state, bool case_sensitive ); - - virtual ~CharScanner() - { - } - - virtual int LA(unsigned int i); - - virtual void append(char c) - { - if (saveConsumedInput) - { - size_t l = text.length(); - - if ((l%256) == 0) - text.reserve(l+256); - - text.replace(l,0,&c,1); - } - } - - virtual void append(const ANTLR_USE_NAMESPACE(std)string& s) - { - if( saveConsumedInput ) - text += s; - } - - virtual void commit() - { - inputState->getInput().commit(); - } - - /** called by the generated lexer to do error recovery, override to - * customize the behaviour. - */ - virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) - { - consume(); - consumeUntil(tokenSet); - } - - virtual void consume() - { - if (inputState->guessing == 0) - { - int c = LA(1); - if (caseSensitive) - { - append(c); - } - else - { - // use input.LA(), not LA(), to get original case - // CharScanner.LA() would toLower it. - append(inputState->getInput().LA(1)); - } - - // RK: in a sense I don't like this automatic handling. - if (c == '\t') - tab(); - else - inputState->column++; - } - inputState->getInput().consume(); - } - - /** Consume chars until one matches the given char */ - virtual void consumeUntil(int c) - { - for(;;) - { - int la_1 = LA(1); - if( la_1 == EOF_CHAR || la_1 == c ) - break; - consume(); - } - } - - /** Consume chars until one matches the given set */ - virtual void consumeUntil(const BitSet& set) - { - for(;;) - { - int la_1 = LA(1); - if( la_1 == EOF_CHAR || set.member(la_1) ) - break; - consume(); - } - } - - /// Mark the current position and return a id for it - virtual unsigned int mark() - { - return inputState->getInput().mark(); - } - /// Rewind the scanner to a previously marked position - virtual void rewind(unsigned int pos) - { - inputState->getInput().rewind(pos); - } - - /// See if input contains character 'c' throw MismatchedCharException if not - virtual void match(int c) - { - int la_1 = LA(1); - if ( la_1 != c ) - throw MismatchedCharException(la_1, c, false, this); - consume(); - } - - /** See if input contains element from bitset b - * throw MismatchedCharException if not - */ - virtual void match(const BitSet& b) - { - int la_1 = LA(1); - - if ( !b.member(la_1) ) - throw MismatchedCharException( la_1, b, false, this ); - consume(); - } - - /** See if input contains string 's' throw MismatchedCharException if not - * @note the string cannot match EOF - */ - virtual void match( const char* s ) - { - while( *s != '\0' ) - { - // the & 0xFF is here to prevent sign extension lateron - int la_1 = LA(1), c = (*s++ & 0xFF); - - if ( la_1 != c ) - throw MismatchedCharException(la_1, c, false, this); - - consume(); - } - } - /** See if input contains string 's' throw MismatchedCharException if not - * @note the string cannot match EOF - */ - virtual void match(const ANTLR_USE_NAMESPACE(std)string& s) - { - size_t len = s.length(); - - for (size_t i = 0; i < len; i++) - { - // the & 0xFF is here to prevent sign extension lateron - int la_1 = LA(1), c = (s[i] & 0xFF); - - if ( la_1 != c ) - throw MismatchedCharException(la_1, c, false, this); - - consume(); - } - } - /** See if input does not contain character 'c' - * throw MismatchedCharException if not - */ - virtual void matchNot(int c) - { - int la_1 = LA(1); - - if ( la_1 == c ) - throw MismatchedCharException(la_1, c, true, this); - - consume(); - } - /** See if input contains character in range c1-c2 - * throw MismatchedCharException if not - */ - virtual void matchRange(int c1, int c2) - { - int la_1 = LA(1); - - if ( la_1 < c1 || la_1 > c2 ) - throw MismatchedCharException(la_1, c1, c2, false, this); - - consume(); - } - - virtual bool getCaseSensitive() const - { - return caseSensitive; - } - - virtual void setCaseSensitive(bool t) - { - caseSensitive = t; - } - - virtual bool getCaseSensitiveLiterals() const=0; - - /// Get the line the scanner currently is in (starts at 1) - virtual int getLine() const - { - return inputState->line; - } - - /// set the line number - virtual void setLine(int l) - { - inputState->line = l; - } - - /// Get the column the scanner currently is in (starts at 1) - virtual int getColumn() const - { - return inputState->column; - } - /// set the column number - virtual void setColumn(int c) - { - inputState->column = c; - } - - /// get the filename for the file currently used - virtual const ANTLR_USE_NAMESPACE(std)string& getFilename() const - { - return inputState->filename; - } - /// Set the filename the scanner is using (used in error messages) - virtual void setFilename(const ANTLR_USE_NAMESPACE(std)string& f) - { - inputState->filename = f; - } - - virtual bool getCommitToPath() const - { - return commitToPath; - } - - virtual void setCommitToPath(bool commit) - { - commitToPath = commit; - } - - /** return a copy of the current text buffer */ - virtual const ANTLR_USE_NAMESPACE(std)string& getText() const - { - return text; - } - - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s) - { - text = s; - } - - virtual void resetText() - { - text = ""; - inputState->tokenStartColumn = inputState->column; - inputState->tokenStartLine = inputState->line; - } - - virtual RefToken getTokenObject() const - { - return _returnToken; - } - - /** Used to keep track of line breaks, needs to be called from - * within generated lexers when a \n \r is encountered. - */ - virtual void newline() - { - ++inputState->line; - inputState->column = 1; - } - - /** Advance the current column number by an appropriate amount according - * to the tabsize. This method needs to be explicitly called from the - * lexer rules encountering tabs. - */ - virtual void tab() - { - int c = getColumn(); - int nc = ( ((c-1)/tabsize) + 1) * tabsize + 1; // calculate tab stop - setColumn( nc ); - } - /// set the tabsize. Returns the old tabsize - int setTabsize( int size ) - { - int oldsize = tabsize; - tabsize = size; - return oldsize; - } - /// Return the tabsize used by the scanner - int getTabSize() const - { - return tabsize; - } - - /** Report exception errors caught in nextToken() */ - virtual void reportError(const RecognitionException& e); - - /** Parser error-reporting function can be overridden in subclass */ - virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); - - /** Parser warning-reporting function can be overridden in subclass */ - virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); - - virtual InputBuffer& getInputBuffer() - { - return inputState->getInput(); - } - - virtual LexerSharedInputState getInputState() - { - return inputState; - } - - /** set the input state for the lexer. - * @note state is a reference counted object, hence no reference */ - virtual void setInputState(LexerSharedInputState state) - { - inputState = state; - } - - /// Set the factory for created tokens - virtual void setTokenObjectFactory(factory_type factory) - { - tokenFactory = factory; - } - - /** Test the token text against the literals table - * Override this method to perform a different literals test - */ - virtual int testLiteralsTable(int ttype) const - { - ANTLR_USE_NAMESPACE(std)map::const_iterator i = literals.find(text); - if (i != literals.end()) - ttype = (*i).second; - return ttype; - } - - /** Test the text passed in against the literals table - * Override this method to perform a different literals test - * This is used primarily when you want to test a portion of - * a token - */ - virtual int testLiteralsTable(const ANTLR_USE_NAMESPACE(std)string& txt,int ttype) const - { - ANTLR_USE_NAMESPACE(std)map::const_iterator i = literals.find(txt); - if (i != literals.end()) - ttype = (*i).second; - return ttype; - } - - /// Override this method to get more specific case handling - virtual int toLower(int c) const - { - // test on EOF_CHAR for buggy (?) STLPort tolower (or HPUX tolower?) - // also VC++ 6.0 does this. (see fix 422 (is reverted by this fix) - // this one is more structural. Maybe make this configurable. - return (c == EOF_CHAR ? EOF_CHAR : tolower(c)); - } - - /** This method is called by YourLexer::nextToken() when the lexer has - * hit EOF condition. EOF is NOT a character. - * This method is not called if EOF is reached during - * syntactic predicate evaluation or during evaluation - * of normal lexical rules, which presumably would be - * an IOException. This traps the "normal" EOF condition. - * - * uponEOF() is called after the complete evaluation of - * the previous token and only if your parser asks - * for another token beyond that last non-EOF token. - * - * You might want to throw token or char stream exceptions - * like: "Heh, premature eof" or a retry stream exception - * ("I found the end of this file, go back to referencing file"). - */ - virtual void uponEOF() - { - } - - /// Methods used to change tracing behavior - virtual void traceIndent(); - virtual void traceIn(const char* rname); - virtual void traceOut(const char* rname); - -#ifndef NO_STATIC_CONSTS - static const int EOF_CHAR = EOF; -#else - enum { - EOF_CHAR = EOF - }; -#endif -protected: - ANTLR_USE_NAMESPACE(std)string text; ///< Text of current token - /// flag indicating wether consume saves characters - bool saveConsumedInput; - factory_type tokenFactory; ///< Factory for tokens - bool caseSensitive; ///< Is this lexer case sensitive - ANTLR_USE_NAMESPACE(std)map literals; // set by subclass - - RefToken _returnToken; ///< used to return tokens w/o using return val - - /// Input state, gives access to input stream, shared among different lexers - LexerSharedInputState inputState; - - /** Used during filter mode to indicate that path is desired. - * A subsequent scan error will report an error as usual - * if acceptPath=true; - */ - bool commitToPath; - - int tabsize; ///< tab size the scanner uses. - - /// Create a new RefToken of type t - virtual RefToken makeToken(int t) - { - RefToken tok = tokenFactory(); - tok->setType(t); - tok->setColumn(inputState->tokenStartColumn); - tok->setLine(inputState->tokenStartLine); - return tok; - } - - /** Tracer class, used when -traceLexer is passed to antlr - */ - class Tracer { - private: - CharScanner* parser; - const char* text; - - Tracer(const Tracer& other); // undefined - Tracer& operator=(const Tracer& other); // undefined - public: - Tracer( CharScanner* p,const char* t ) - : parser(p), text(t) - { - parser->traceIn(text); - } - ~Tracer() - { - parser->traceOut(text); - } - }; - - int traceDepth; -private: - CharScanner( const CharScanner& other ); // undefined - CharScanner& operator=( const CharScanner& other ); // undefined - -#ifndef NO_STATIC_CONSTS - static const int NO_CHAR = 0; -#else - enum { - NO_CHAR = 0 - }; -#endif -}; - -inline int CharScanner::LA(unsigned int i) -{ - int c = inputState->getInput().LA(i); - - if ( caseSensitive ) - return c; - else - return toLower(c); // VC 6 tolower bug caught in toLower. -} - -inline bool CharScannerLiteralsLess::operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const -{ - if (scanner->getCaseSensitiveLiterals()) - return ANTLR_USE_NAMESPACE(std)less()(x,y); - else - { -#ifdef NO_STRCASECMP - return (stricmp(x.c_str(),y.c_str())<0); -#else - return (strcasecmp(x.c_str(),y.c_str())<0); -#endif - } -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CharScanner_hpp__ diff --git a/lib/antlr/antlr/CharStreamException.h b/lib/antlr/antlr/CharStreamException.h new file mode 100644 index 00000000..291593f2 --- /dev/null +++ b/lib/antlr/antlr/CharStreamException.h @@ -0,0 +1,29 @@ +#ifndef INC_CharStreamException_h__ +#define INC_CharStreamException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API CharStreamException : public ANTLRException { +public: + CharStreamException(const ANTLR_USE_NAMESPACE(std)string& s) + : ANTLRException(s) {} + ~CharStreamException() throw() {} +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CharStreamException_h__ diff --git a/lib/antlr/antlr/CharStreamException.hpp b/lib/antlr/antlr/CharStreamException.hpp deleted file mode 100644 index a49e3bbb..00000000 --- a/lib/antlr/antlr/CharStreamException.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef INC_CharStreamException_hpp__ -#define INC_CharStreamException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CharStreamException : public ANTLRException { -public: - CharStreamException(const ANTLR_USE_NAMESPACE(std)string& s) - : ANTLRException(s) {} - ~CharStreamException() throw() {} -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CharStreamException_hpp__ diff --git a/lib/antlr/antlr/CharStreamIOException.h b/lib/antlr/antlr/CharStreamIOException.h new file mode 100644 index 00000000..011aaf1f --- /dev/null +++ b/lib/antlr/antlr/CharStreamIOException.h @@ -0,0 +1,31 @@ +#ifndef INC_CharStreamIOException_h__ +#define INC_CharStreamIOException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API CharStreamIOException : public CharStreamException { +public: + ANTLR_USE_NAMESPACE(std)exception io; + + CharStreamIOException(ANTLR_USE_NAMESPACE(std)exception& e) + : CharStreamException(e.what()), io(e) {} + ~CharStreamIOException() throw() {} +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CharStreamIOException_h__ diff --git a/lib/antlr/antlr/CharStreamIOException.hpp b/lib/antlr/antlr/CharStreamIOException.hpp deleted file mode 100644 index e3e3111e..00000000 --- a/lib/antlr/antlr/CharStreamIOException.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef INC_CharStreamIOException_hpp__ -#define INC_CharStreamIOException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CharStreamIOException : public CharStreamException { -public: - ANTLR_USE_NAMESPACE(std)exception io; - - CharStreamIOException(ANTLR_USE_NAMESPACE(std)exception& e) - : CharStreamException(e.what()), io(e) {} - ~CharStreamIOException() throw() {} -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CharStreamIOException_hpp__ diff --git a/lib/antlr/antlr/CircularQueue.h b/lib/antlr/antlr/CircularQueue.h new file mode 100644 index 00000000..89c593a1 --- /dev/null +++ b/lib/antlr/antlr/CircularQueue.h @@ -0,0 +1,100 @@ +#ifndef INC_CircularQueue_h__ +#define INC_CircularQueue_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +// Resize every 5000 items +#define OFFSET_MAX_RESIZE 5000 + +template +class ANTLR_API CircularQueue { +public: + CircularQueue() + : storage() + , m_offset(0) + { + } + ~CircularQueue() + { + } + + /// Clear the queue + inline void clear( void ) + { + m_offset = 0; + storage.clear(); + } + + /// @todo this should use at or should have a check + inline T elementAt( size_t idx ) const + { + return storage[idx+m_offset]; + } + void removeFirst() + { + if (m_offset >= OFFSET_MAX_RESIZE) + { + storage.erase( storage.begin(), storage.begin() + m_offset + 1 ); + m_offset = 0; + } + else + ++m_offset; + } + inline void removeItems( size_t nb ) + { + // it would be nice if we would not get called with nb > entries + // (or to be precise when entries() == 0) + // This case is possible when lexer/parser::recover() calls + // consume+consumeUntil when the queue is empty. + // In recover the consume says to prepare to read another + // character/token. Then in the subsequent consumeUntil the + // LA() call will trigger + // syncConsume which calls this method *before* the same queue + // has been sufficiently filled. + if( nb > entries() ) + nb = entries(); + + if (m_offset >= OFFSET_MAX_RESIZE) + { + storage.erase( storage.begin(), storage.begin() + m_offset + nb ); + m_offset = 0; + } + else + m_offset += nb; + } + inline void append(const T& t) + { + storage.push_back(t); + } + inline size_t entries() const + { + return storage.size() - m_offset; + } + +private: + ANTLR_USE_NAMESPACE(std)vector storage; + size_t m_offset; + + CircularQueue(const CircularQueue&); + const CircularQueue& operator=(const CircularQueue&); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CircularQueue_h__ diff --git a/lib/antlr/antlr/CircularQueue.hpp b/lib/antlr/antlr/CircularQueue.hpp deleted file mode 100644 index 506b4f56..00000000 --- a/lib/antlr/antlr/CircularQueue.hpp +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef INC_CircularQueue_hpp__ -#define INC_CircularQueue_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -// Resize every 5000 items -#define OFFSET_MAX_RESIZE 5000 - -template -class ANTLR_API CircularQueue { -public: - CircularQueue() - : storage() - , m_offset(0) - { - } - ~CircularQueue() - { - } - - /// Clear the queue - inline void clear( void ) - { - m_offset = 0; - storage.clear(); - } - - /// @todo this should use at or should have a check - inline T elementAt( size_t idx ) const - { - return storage[idx+m_offset]; - } - void removeFirst() - { - if (m_offset >= OFFSET_MAX_RESIZE) - { - storage.erase( storage.begin(), storage.begin() + m_offset + 1 ); - m_offset = 0; - } - else - ++m_offset; - } - inline void removeItems( size_t nb ) - { - // it would be nice if we would not get called with nb > entries - // (or to be precise when entries() == 0) - // This case is possible when lexer/parser::recover() calls - // consume+consumeUntil when the queue is empty. - // In recover the consume says to prepare to read another - // character/token. Then in the subsequent consumeUntil the - // LA() call will trigger - // syncConsume which calls this method *before* the same queue - // has been sufficiently filled. - if( nb > entries() ) - nb = entries(); - - if (m_offset >= OFFSET_MAX_RESIZE) - { - storage.erase( storage.begin(), storage.begin() + m_offset + nb ); - m_offset = 0; - } - else - m_offset += nb; - } - inline void append(const T& t) - { - storage.push_back(t); - } - inline size_t entries() const - { - return storage.size() - m_offset; - } - -private: - ANTLR_USE_NAMESPACE(std)vector storage; - size_t m_offset; - - CircularQueue(const CircularQueue&); - const CircularQueue& operator=(const CircularQueue&); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CircularQueue_hpp__ diff --git a/lib/antlr/antlr/CommonAST.h b/lib/antlr/antlr/CommonAST.h new file mode 100644 index 00000000..a89f5f01 --- /dev/null +++ b/lib/antlr/antlr/CommonAST.h @@ -0,0 +1,110 @@ +#ifndef INC_CommonAST_h__ +#define INC_CommonAST_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API CommonAST : public BaseAST { +public: + CommonAST() + : BaseAST() + , ttype( Token::INVALID_TYPE ) + , text() + { + } + + CommonAST( RefToken t ) + : BaseAST() + , ttype( t->getType() ) + , text( t->getText() ) + { + } + + CommonAST( const CommonAST& other ) + : BaseAST(other) + , ttype(other.ttype) + , text(other.text) + { + } + + virtual ~CommonAST() + { + } + + virtual const char* typeName( void ) const + { + return CommonAST::TYPE_NAME; + } + + /// Clone this AST node. + virtual RefAST clone( void ) const + { + CommonAST *ast = new CommonAST( *this ); + return RefAST(ast); + } + + virtual ANTLR_USE_NAMESPACE(std)string getText() const + { + return text; + } + virtual int getType() const + { + return ttype; + } + + virtual void initialize( int t, const ANTLR_USE_NAMESPACE(std)string& txt ) + { + setType(t); + setText(txt); + } + + virtual void initialize( RefAST t ) + { + setType(t->getType()); + setText(t->getText()); + } + virtual void initialize( RefToken t ) + { + setType(t->getType()); + setText(t->getText()); + } + +#ifdef ANTLR_SUPPORT_XML + virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in ); +#endif + + virtual void setText( const ANTLR_USE_NAMESPACE(std)string& txt ) + { + text = txt; + } + virtual void setType( int type ) + { + ttype = type; + } + + static RefAST factory(); + + static const char* const TYPE_NAME; +protected: + int ttype; + ANTLR_USE_NAMESPACE(std)string text; +}; + +typedef ASTRefCount RefCommonAST; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CommonAST_h__ diff --git a/lib/antlr/antlr/CommonAST.hpp b/lib/antlr/antlr/CommonAST.hpp deleted file mode 100644 index 091d7b6e..00000000 --- a/lib/antlr/antlr/CommonAST.hpp +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef INC_CommonAST_hpp__ -#define INC_CommonAST_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CommonAST : public BaseAST { -public: - CommonAST() - : BaseAST() - , ttype( Token::INVALID_TYPE ) - , text() - { - } - - CommonAST( RefToken t ) - : BaseAST() - , ttype( t->getType() ) - , text( t->getText() ) - { - } - - CommonAST( const CommonAST& other ) - : BaseAST(other) - , ttype(other.ttype) - , text(other.text) - { - } - - virtual ~CommonAST() - { - } - - virtual const char* typeName( void ) const - { - return CommonAST::TYPE_NAME; - } - - /// Clone this AST node. - virtual RefAST clone( void ) const - { - CommonAST *ast = new CommonAST( *this ); - return RefAST(ast); - } - - virtual ANTLR_USE_NAMESPACE(std)string getText() const - { - return text; - } - virtual int getType() const - { - return ttype; - } - - virtual void initialize( int t, const ANTLR_USE_NAMESPACE(std)string& txt ) - { - setType(t); - setText(txt); - } - - virtual void initialize( RefAST t ) - { - setType(t->getType()); - setText(t->getText()); - } - virtual void initialize( RefToken t ) - { - setType(t->getType()); - setText(t->getText()); - } - -#ifdef ANTLR_SUPPORT_XML - virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in ); -#endif - - virtual void setText( const ANTLR_USE_NAMESPACE(std)string& txt ) - { - text = txt; - } - virtual void setType( int type ) - { - ttype = type; - } - - static RefAST factory(); - - static const char* const TYPE_NAME; -protected: - int ttype; - ANTLR_USE_NAMESPACE(std)string text; -}; - -typedef ASTRefCount RefCommonAST; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonAST_hpp__ diff --git a/lib/antlr/antlr/CommonASTWithHiddenTokens.h b/lib/antlr/antlr/CommonASTWithHiddenTokens.h new file mode 100644 index 00000000..01772835 --- /dev/null +++ b/lib/antlr/antlr/CommonASTWithHiddenTokens.h @@ -0,0 +1,60 @@ +#ifndef INC_CommonASTWithHiddenTokens_h__ +#define INC_CommonASTWithHiddenTokens_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** A CommonAST whose initialization copies hidden token + * information from the Token used to create a node. + */ +class ANTLR_API CommonASTWithHiddenTokens : public CommonAST { +public: + CommonASTWithHiddenTokens(); + virtual ~CommonASTWithHiddenTokens(); + virtual const char* typeName( void ) const + { + return CommonASTWithHiddenTokens::TYPE_NAME; + } + /// Clone this AST node. + virtual RefAST clone( void ) const; + + // Borland C++ builder seems to need the decl's of the first two... + virtual void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt); + virtual void initialize(RefAST t); + virtual void initialize(RefToken t); + + virtual RefToken getHiddenAfter() const + { + return hiddenAfter; + } + + virtual RefToken getHiddenBefore() const + { + return hiddenBefore; + } + + static RefAST factory(); + + static const char* const TYPE_NAME; +protected: + RefToken hiddenBefore,hiddenAfter; // references to hidden tokens +}; + +typedef ASTRefCount RefCommonASTWithHiddenTokens; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CommonASTWithHiddenTokens_h__ diff --git a/lib/antlr/antlr/CommonASTWithHiddenTokens.hpp b/lib/antlr/antlr/CommonASTWithHiddenTokens.hpp deleted file mode 100644 index cac7c83e..00000000 --- a/lib/antlr/antlr/CommonASTWithHiddenTokens.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef INC_CommonASTWithHiddenTokens_hpp__ -#define INC_CommonASTWithHiddenTokens_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A CommonAST whose initialization copies hidden token - * information from the Token used to create a node. - */ -class ANTLR_API CommonASTWithHiddenTokens : public CommonAST { -public: - CommonASTWithHiddenTokens(); - virtual ~CommonASTWithHiddenTokens(); - virtual const char* typeName( void ) const - { - return CommonASTWithHiddenTokens::TYPE_NAME; - } - /// Clone this AST node. - virtual RefAST clone( void ) const; - - // Borland C++ builder seems to need the decl's of the first two... - virtual void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt); - virtual void initialize(RefAST t); - virtual void initialize(RefToken t); - - virtual RefToken getHiddenAfter() const - { - return hiddenAfter; - } - - virtual RefToken getHiddenBefore() const - { - return hiddenBefore; - } - - static RefAST factory(); - - static const char* const TYPE_NAME; -protected: - RefToken hiddenBefore,hiddenAfter; // references to hidden tokens -}; - -typedef ASTRefCount RefCommonASTWithHiddenTokens; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonASTWithHiddenTokens_hpp__ diff --git a/lib/antlr/antlr/CommonHiddenStreamToken.h b/lib/antlr/antlr/CommonHiddenStreamToken.h new file mode 100644 index 00000000..8f0e2e38 --- /dev/null +++ b/lib/antlr/antlr/CommonHiddenStreamToken.h @@ -0,0 +1,41 @@ +#ifndef INC_CommonHiddenStreamToken_h__ +#define INC_CommonHiddenStreamToken_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API CommonHiddenStreamToken : public CommonToken { +protected: + RefToken hiddenBefore; + RefToken hiddenAfter; + +public: + CommonHiddenStreamToken(); + CommonHiddenStreamToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt); + CommonHiddenStreamToken(const ANTLR_USE_NAMESPACE(std)string& s); + + RefToken getHiddenAfter(); + RefToken getHiddenBefore(); + + static RefToken factory(); + + void setHiddenAfter(RefToken t); + void setHiddenBefore(RefToken t); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CommonHiddenStreamToken_h__ diff --git a/lib/antlr/antlr/CommonHiddenStreamToken.hpp b/lib/antlr/antlr/CommonHiddenStreamToken.hpp deleted file mode 100644 index f3b78c44..00000000 --- a/lib/antlr/antlr/CommonHiddenStreamToken.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef INC_CommonHiddenStreamToken_hpp__ -#define INC_CommonHiddenStreamToken_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CommonHiddenStreamToken : public CommonToken { -protected: - RefToken hiddenBefore; - RefToken hiddenAfter; - -public: - CommonHiddenStreamToken(); - CommonHiddenStreamToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt); - CommonHiddenStreamToken(const ANTLR_USE_NAMESPACE(std)string& s); - - RefToken getHiddenAfter(); - RefToken getHiddenBefore(); - - static RefToken factory(); - - void setHiddenAfter(RefToken t); - void setHiddenBefore(RefToken t); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonHiddenStreamToken_hpp__ diff --git a/lib/antlr/antlr/CommonToken.h b/lib/antlr/antlr/CommonToken.h new file mode 100644 index 00000000..6f8d4973 --- /dev/null +++ b/lib/antlr/antlr/CommonToken.h @@ -0,0 +1,83 @@ +#ifndef INC_CommonToken_h__ +#define INC_CommonToken_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API CommonToken : public Token { +public: + CommonToken(); + CommonToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt); + CommonToken(const ANTLR_USE_NAMESPACE(std)string& s); + + /// return contents of token + virtual ANTLR_USE_NAMESPACE(std)string getText() const + { + return text; + } + + /// set contents of token + virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s) + { + text = s; + } + + /** get the line the token is at (starting at 1) + * @see CharScanner::newline() + * @see CharScanner::tab() + */ + virtual int getLine() const + { + return line; + } + /** gt the column the token is at (starting at 1) + * @see CharScanner::newline() + * @see CharScanner::tab() + */ + virtual int getColumn() const + { + return col; + } + + /// set line for token + virtual void setLine(int l) + { + line = l; + } + /// set column for token + virtual void setColumn(int c) + { + col = c; + } + + virtual ANTLR_USE_NAMESPACE(std)string toString() const; + static RefToken factory(); + +protected: + // most tokens will want line and text information + int line; + int col; + ANTLR_USE_NAMESPACE(std)string text; + +private: + CommonToken(const CommonToken&); + const CommonToken& operator=(const CommonToken&); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CommonToken_h__ diff --git a/lib/antlr/antlr/CommonToken.hpp b/lib/antlr/antlr/CommonToken.hpp deleted file mode 100644 index 51d17b42..00000000 --- a/lib/antlr/antlr/CommonToken.hpp +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef INC_CommonToken_hpp__ -#define INC_CommonToken_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API CommonToken : public Token { -public: - CommonToken(); - CommonToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt); - CommonToken(const ANTLR_USE_NAMESPACE(std)string& s); - - /// return contents of token - virtual ANTLR_USE_NAMESPACE(std)string getText() const - { - return text; - } - - /// set contents of token - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s) - { - text = s; - } - - /** get the line the token is at (starting at 1) - * @see CharScanner::newline() - * @see CharScanner::tab() - */ - virtual int getLine() const - { - return line; - } - /** gt the column the token is at (starting at 1) - * @see CharScanner::newline() - * @see CharScanner::tab() - */ - virtual int getColumn() const - { - return col; - } - - /// set line for token - virtual void setLine(int l) - { - line = l; - } - /// set column for token - virtual void setColumn(int c) - { - col = c; - } - - virtual ANTLR_USE_NAMESPACE(std)string toString() const; - static RefToken factory(); - -protected: - // most tokens will want line and text information - int line; - int col; - ANTLR_USE_NAMESPACE(std)string text; - -private: - CommonToken(const CommonToken&); - const CommonToken& operator=(const CommonToken&); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonToken_hpp__ diff --git a/lib/antlr/antlr/IOException.h b/lib/antlr/antlr/IOException.h new file mode 100644 index 00000000..b616adf8 --- /dev/null +++ b/lib/antlr/antlr/IOException.h @@ -0,0 +1,45 @@ +#ifndef INC_IOException_h__ +#define INC_IOException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** Generic IOException used inside support code. (thrown by XML I/O routs) + * basically this is something I'm using since a lot of compilers don't + * support ios_base::failure. + */ +class ANTLR_API IOException : public ANTLRException +{ +public: + ANTLR_USE_NAMESPACE(std)exception io; + + IOException( ANTLR_USE_NAMESPACE(std)exception& e ) + : ANTLRException(e.what()) + { + } + IOException( const ANTLR_USE_NAMESPACE(std)string& mesg ) + : ANTLRException(mesg) + { + } + virtual ~IOException() throw() + { + } +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_IOException_h__ diff --git a/lib/antlr/antlr/IOException.hpp b/lib/antlr/antlr/IOException.hpp deleted file mode 100644 index 22566ecc..00000000 --- a/lib/antlr/antlr/IOException.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef INC_IOException_hpp__ -#define INC_IOException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Generic IOException used inside support code. (thrown by XML I/O routs) - * basically this is something I'm using since a lot of compilers don't - * support ios_base::failure. - */ -class ANTLR_API IOException : public ANTLRException -{ -public: - ANTLR_USE_NAMESPACE(std)exception io; - - IOException( ANTLR_USE_NAMESPACE(std)exception& e ) - : ANTLRException(e.what()) - { - } - IOException( const ANTLR_USE_NAMESPACE(std)string& mesg ) - : ANTLRException(mesg) - { - } - virtual ~IOException() throw() - { - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_IOException_hpp__ diff --git a/lib/antlr/antlr/InputBuffer.h b/lib/antlr/antlr/InputBuffer.h new file mode 100644 index 00000000..f71f73e8 --- /dev/null +++ b/lib/antlr/antlr/InputBuffer.h @@ -0,0 +1,146 @@ +#ifndef INC_InputBuffer_h__ +#define INC_InputBuffer_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** A Stream of characters fed to the lexer from a InputStream that can + * be rewound via mark()/rewind() methods. + *

+ * A dynamic array is used to buffer up all the input characters. Normally, + * "k" characters are stored in the buffer. More characters may be stored during + * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. + * Consumption of characters is deferred. In other words, reading the next + * character is not done by conume(), but deferred until needed by LA or LT. + *

+ * + * @see antlr.CharQueue + */ +class ANTLR_API InputBuffer { +public: + /** Create a character buffer */ + InputBuffer() + : nMarkers(0) + , markerOffset(0) + , numToConsume(0) + { + } + + virtual ~InputBuffer() + { + } + + /// Reset the input buffer to empty state + virtual inline void reset( void ) + { + nMarkers = 0; + markerOffset = 0; + numToConsume = 0; + queue.clear(); + } + + /** This method updates the state of the input buffer so that + * the text matched since the most recent mark() is no longer + * held by the buffer. So, you either do a mark/rewind for + * failed predicate or mark/commit to keep on parsing without + * rewinding the input. + */ + inline void commit( void ) + { + nMarkers--; + } + + /** Mark another character for deferred consumption */ + virtual inline void consume() + { + numToConsume++; + } + + /** Ensure that the character buffer is sufficiently full */ + virtual void fill(unsigned int amount); + + /** Override this in subclasses to get the next character */ + virtual int getChar()=0; + + /** Get a lookahead character */ + virtual inline int LA(unsigned int i) + { + fill(i); + return queue.elementAt(markerOffset + i - 1); + } + + /** Return an integer marker that can be used to rewind the buffer to + * its current state. + */ + virtual unsigned int mark(); + /// Are there any marks active in the InputBuffer + virtual inline bool isMarked() const + { + return (nMarkers != 0); + } + /** Rewind the character buffer to a marker. + * @param mark Marker returned previously from mark() + */ + virtual void rewind(unsigned int mark); + + /** Get the number of non-consumed characters + */ + virtual unsigned int entries() const; + + ANTLR_USE_NAMESPACE(std)string getLAChars() const; + + ANTLR_USE_NAMESPACE(std)string getMarkedChars() const; + +protected: + // char source + // leave to subclasses + + // Number of active markers + unsigned int nMarkers; // = 0; + + // Additional offset used when markers are active + unsigned int markerOffset; // = 0; + + // Number of calls to consume() since last LA() or LT() call + unsigned int numToConsume; // = 0; + + // Circular queue + CircularQueue queue; + + /** Sync up deferred consumption */ + void syncConsume(); + +private: + InputBuffer(const InputBuffer& other); + InputBuffer& operator=(const InputBuffer& other); +}; + +/** Sync up deferred consumption */ +inline void InputBuffer::syncConsume() { + if (numToConsume > 0) + { + if (nMarkers > 0) + markerOffset += numToConsume; + else + queue.removeItems( numToConsume ); + numToConsume = 0; + } +} + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_InputBuffer_h__ diff --git a/lib/antlr/antlr/InputBuffer.hpp b/lib/antlr/antlr/InputBuffer.hpp deleted file mode 100644 index b979ef8c..00000000 --- a/lib/antlr/antlr/InputBuffer.hpp +++ /dev/null @@ -1,146 +0,0 @@ -#ifndef INC_InputBuffer_hpp__ -#define INC_InputBuffer_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A Stream of characters fed to the lexer from a InputStream that can - * be rewound via mark()/rewind() methods. - *

- * A dynamic array is used to buffer up all the input characters. Normally, - * "k" characters are stored in the buffer. More characters may be stored during - * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. - * Consumption of characters is deferred. In other words, reading the next - * character is not done by conume(), but deferred until needed by LA or LT. - *

- * - * @see antlr.CharQueue - */ -class ANTLR_API InputBuffer { -public: - /** Create a character buffer */ - InputBuffer() - : nMarkers(0) - , markerOffset(0) - , numToConsume(0) - { - } - - virtual ~InputBuffer() - { - } - - /// Reset the input buffer to empty state - virtual inline void reset( void ) - { - nMarkers = 0; - markerOffset = 0; - numToConsume = 0; - queue.clear(); - } - - /** This method updates the state of the input buffer so that - * the text matched since the most recent mark() is no longer - * held by the buffer. So, you either do a mark/rewind for - * failed predicate or mark/commit to keep on parsing without - * rewinding the input. - */ - inline void commit( void ) - { - nMarkers--; - } - - /** Mark another character for deferred consumption */ - virtual inline void consume() - { - numToConsume++; - } - - /** Ensure that the character buffer is sufficiently full */ - virtual void fill(unsigned int amount); - - /** Override this in subclasses to get the next character */ - virtual int getChar()=0; - - /** Get a lookahead character */ - virtual inline int LA(unsigned int i) - { - fill(i); - return queue.elementAt(markerOffset + i - 1); - } - - /** Return an integer marker that can be used to rewind the buffer to - * its current state. - */ - virtual unsigned int mark(); - /// Are there any marks active in the InputBuffer - virtual inline bool isMarked() const - { - return (nMarkers != 0); - } - /** Rewind the character buffer to a marker. - * @param mark Marker returned previously from mark() - */ - virtual void rewind(unsigned int mark); - - /** Get the number of non-consumed characters - */ - virtual unsigned int entries() const; - - ANTLR_USE_NAMESPACE(std)string getLAChars() const; - - ANTLR_USE_NAMESPACE(std)string getMarkedChars() const; - -protected: - // char source - // leave to subclasses - - // Number of active markers - unsigned int nMarkers; // = 0; - - // Additional offset used when markers are active - unsigned int markerOffset; // = 0; - - // Number of calls to consume() since last LA() or LT() call - unsigned int numToConsume; // = 0; - - // Circular queue - CircularQueue queue; - - /** Sync up deferred consumption */ - void syncConsume(); - -private: - InputBuffer(const InputBuffer& other); - InputBuffer& operator=(const InputBuffer& other); -}; - -/** Sync up deferred consumption */ -inline void InputBuffer::syncConsume() { - if (numToConsume > 0) - { - if (nMarkers > 0) - markerOffset += numToConsume; - else - queue.removeItems( numToConsume ); - numToConsume = 0; - } -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_InputBuffer_hpp__ diff --git a/lib/antlr/antlr/LLkParser.h b/lib/antlr/antlr/LLkParser.h new file mode 100644 index 00000000..d9d2d9fd --- /dev/null +++ b/lib/antlr/antlr/LLkParser.h @@ -0,0 +1,67 @@ +#ifndef INC_LLkParser_h__ +#define INC_LLkParser_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/**An LL(k) parser. + * + * @see antlr.Token + * @see antlr.TokenBuffer + * @see antlr.LL1Parser + */ +class ANTLR_API LLkParser : public Parser { +public: + LLkParser(const ParserSharedInputState& lexer, int k_); + + LLkParser(TokenBuffer& tokenBuf, int k_); + + LLkParser(TokenStream& lexer, int k_); + + /** Consume another token from the input stream. Can only write sequentially! + * If you need 3 tokens ahead, you must consume() 3 times. + *

+ * Note that it is possible to overwrite tokens that have not been matched. + * For example, calling consume() 3 times when k=2, means that the first token + * consumed will be overwritten with the 3rd. + */ + virtual inline void consume() + { + inputState->getInput().consume(); + } + + virtual inline int LA(unsigned int i) + { + return inputState->getInput().LA(i); + } + + virtual inline RefToken LT(unsigned int i) + { + return inputState->getInput().LT(i); + } +protected: + /// the lookahead this LL(k) parser is using. + int k; +private: + void trace(const char* ee, const char* rname); +public: + virtual void traceIn(const char* rname); + virtual void traceOut(const char* rname); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_LLkParser_h__ diff --git a/lib/antlr/antlr/LLkParser.hpp b/lib/antlr/antlr/LLkParser.hpp deleted file mode 100644 index 32acd3dd..00000000 --- a/lib/antlr/antlr/LLkParser.hpp +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef INC_LLkParser_hpp__ -#define INC_LLkParser_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**An LL(k) parser. - * - * @see antlr.Token - * @see antlr.TokenBuffer - * @see antlr.LL1Parser - */ -class ANTLR_API LLkParser : public Parser { -public: - LLkParser(const ParserSharedInputState& lexer, int k_); - - LLkParser(TokenBuffer& tokenBuf, int k_); - - LLkParser(TokenStream& lexer, int k_); - - /** Consume another token from the input stream. Can only write sequentially! - * If you need 3 tokens ahead, you must consume() 3 times. - *

- * Note that it is possible to overwrite tokens that have not been matched. - * For example, calling consume() 3 times when k=2, means that the first token - * consumed will be overwritten with the 3rd. - */ - virtual inline void consume() - { - inputState->getInput().consume(); - } - - virtual inline int LA(unsigned int i) - { - return inputState->getInput().LA(i); - } - - virtual inline RefToken LT(unsigned int i) - { - return inputState->getInput().LT(i); - } -protected: - /// the lookahead this LL(k) parser is using. - int k; -private: - void trace(const char* ee, const char* rname); -public: - virtual void traceIn(const char* rname); - virtual void traceOut(const char* rname); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_LLkParser_hpp__ diff --git a/lib/antlr/antlr/LexerSharedInputState.h b/lib/antlr/antlr/LexerSharedInputState.h new file mode 100644 index 00000000..3f5c26e5 --- /dev/null +++ b/lib/antlr/antlr/LexerSharedInputState.h @@ -0,0 +1,156 @@ +#ifndef INC_LexerSharedInputState_h__ +#define INC_LexerSharedInputState_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** This object contains the data associated with an + * input stream of characters. Multiple lexers + * share a single LexerSharedInputState to lex + * the same input stream. + */ +class ANTLR_API LexerInputState { +public: + /** Construct a new LexerInputState + * @param inbuf the InputBuffer to read from. The object is deleted together + * with the LexerInputState object. + */ + LexerInputState(InputBuffer* inbuf) + : column(1) + , line(1) + , tokenStartColumn(1) + , tokenStartLine(1) + , guessing(0) + , filename("") + , input(inbuf) + , inputResponsible(true) + { + } + + /** Construct a new LexerInputState + * @param inbuf the InputBuffer to read from. + */ + LexerInputState(InputBuffer& inbuf) + : column(1) + , line(1) + , tokenStartColumn(1) + , tokenStartLine(1) + , guessing(0) + , filename("") + , input(&inbuf) + , inputResponsible(false) + { + } + + /** Construct a new LexerInputState + * @param in an istream to read from. + * @see antlr.CharBuffer + */ + LexerInputState(ANTLR_USE_NAMESPACE(std)istream& in) + : column(1) + , line(1) + , tokenStartColumn(1) + , tokenStartLine(1) + , guessing(0) + , filename("") + , input(new CharBuffer(in)) + , inputResponsible(true) + { + } + + /** Reset the LexerInputState with a specified stream and filename. + * This method is a hack, dunno what I was thinking when I added it. + * This should actually be done in a subclass. + * @deprecated + */ + virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in, const char* file = "" ) + { + column = 1; + line = 1; + tokenStartColumn = 1; + tokenStartLine = 1; + guessing = 0; + filename = file; + + if( input && inputResponsible ) + delete input; + + input = new CharBuffer(in); + inputResponsible = true; + } + + /** Reset the LexerInputState to initial state. + * The underlying InputBuffer is also reset. + */ + virtual void reset( void ) + { + column = 1; + line = 1; + tokenStartColumn = 1; + tokenStartLine = 1; + guessing = 0; + input->reset(); + } + + /** Set the file position of the SharedLexerInputState. + * @param line_ line number to be set + * @param column_ column number to be set + */ + void setPosition( int line_, int column_ ) + { + line = line_; + column = column_; + } + + virtual ~LexerInputState() + { + if (inputResponsible) + delete input; + } + + int column; + int line; + int tokenStartColumn; + int tokenStartLine; + int guessing; + /** What file (if known) caused the problem? */ + ANTLR_USE_NAMESPACE(std)string filename; + InputBuffer& getInput(); +private: + /// Input buffer we use + InputBuffer* input; + /// Who is responsible for cleaning up the InputBuffer? + bool inputResponsible; + + // we don't want these: + LexerInputState(const LexerInputState&); + LexerInputState& operator=(const LexerInputState&); +}; + +inline InputBuffer& LexerInputState::getInput() +{ + return *input; +} + +/// A reference counted LexerInputState object +typedef RefCount LexerSharedInputState; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_LexerSharedInputState_h__ diff --git a/lib/antlr/antlr/LexerSharedInputState.hpp b/lib/antlr/antlr/LexerSharedInputState.hpp deleted file mode 100644 index 2571bda3..00000000 --- a/lib/antlr/antlr/LexerSharedInputState.hpp +++ /dev/null @@ -1,156 +0,0 @@ -#ifndef INC_LexerSharedInputState_hpp__ -#define INC_LexerSharedInputState_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This object contains the data associated with an - * input stream of characters. Multiple lexers - * share a single LexerSharedInputState to lex - * the same input stream. - */ -class ANTLR_API LexerInputState { -public: - /** Construct a new LexerInputState - * @param inbuf the InputBuffer to read from. The object is deleted together - * with the LexerInputState object. - */ - LexerInputState(InputBuffer* inbuf) - : column(1) - , line(1) - , tokenStartColumn(1) - , tokenStartLine(1) - , guessing(0) - , filename("") - , input(inbuf) - , inputResponsible(true) - { - } - - /** Construct a new LexerInputState - * @param inbuf the InputBuffer to read from. - */ - LexerInputState(InputBuffer& inbuf) - : column(1) - , line(1) - , tokenStartColumn(1) - , tokenStartLine(1) - , guessing(0) - , filename("") - , input(&inbuf) - , inputResponsible(false) - { - } - - /** Construct a new LexerInputState - * @param in an istream to read from. - * @see antlr.CharBuffer - */ - LexerInputState(ANTLR_USE_NAMESPACE(std)istream& in) - : column(1) - , line(1) - , tokenStartColumn(1) - , tokenStartLine(1) - , guessing(0) - , filename("") - , input(new CharBuffer(in)) - , inputResponsible(true) - { - } - - /** Reset the LexerInputState with a specified stream and filename. - * This method is a hack, dunno what I was thinking when I added it. - * This should actually be done in a subclass. - * @deprecated - */ - virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in, const char* file = "" ) - { - column = 1; - line = 1; - tokenStartColumn = 1; - tokenStartLine = 1; - guessing = 0; - filename = file; - - if( input && inputResponsible ) - delete input; - - input = new CharBuffer(in); - inputResponsible = true; - } - - /** Reset the LexerInputState to initial state. - * The underlying InputBuffer is also reset. - */ - virtual void reset( void ) - { - column = 1; - line = 1; - tokenStartColumn = 1; - tokenStartLine = 1; - guessing = 0; - input->reset(); - } - - /** Set the file position of the SharedLexerInputState. - * @param line_ line number to be set - * @param column_ column number to be set - */ - void setPosition( int line_, int column_ ) - { - line = line_; - column = column_; - } - - virtual ~LexerInputState() - { - if (inputResponsible) - delete input; - } - - int column; - int line; - int tokenStartColumn; - int tokenStartLine; - int guessing; - /** What file (if known) caused the problem? */ - ANTLR_USE_NAMESPACE(std)string filename; - InputBuffer& getInput(); -private: - /// Input buffer we use - InputBuffer* input; - /// Who is responsible for cleaning up the InputBuffer? - bool inputResponsible; - - // we don't want these: - LexerInputState(const LexerInputState&); - LexerInputState& operator=(const LexerInputState&); -}; - -inline InputBuffer& LexerInputState::getInput() -{ - return *input; -} - -/// A reference counted LexerInputState object -typedef RefCount LexerSharedInputState; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_LexerSharedInputState_hpp__ diff --git a/lib/antlr/antlr/Makefile.am b/lib/antlr/antlr/Makefile.am index 717c43c0..b866634c 100644 --- a/lib/antlr/antlr/Makefile.am +++ b/lib/antlr/antlr/Makefile.am @@ -1,2 +1,2 @@ -noinst_HEADERS = ANTLRException.hpp ANTLRUtil.hpp AST.hpp ASTArray.hpp ASTFactory.hpp ASTNULLType.hpp ASTPair.hpp ASTRefCount.hpp BaseAST.hpp BitSet.hpp CharBuffer.hpp CharInputBuffer.hpp CharScanner.hpp CharStreamException.hpp CharStreamIOException.hpp CircularQueue.hpp CommonAST.hpp CommonASTWithHiddenTokens.hpp CommonHiddenStreamToken.hpp CommonToken.hpp InputBuffer.hpp IOException.hpp LLkParser.hpp LexerSharedInputState.hpp MismatchedCharException.hpp MismatchedTokenException.hpp NoViableAltException.hpp NoViableAltForCharException.hpp Parser.hpp ParserSharedInputState.hpp RecognitionException.hpp RefCount.hpp SemanticException.hpp String.hpp Token.hpp TokenBuffer.hpp TokenStream.hpp TokenStreamBasicFilter.hpp TokenStreamException.hpp TokenStreamHiddenTokenFilter.hpp TokenStreamIOException.hpp TokenStreamRecognitionException.hpp TokenStreamRetryException.hpp TokenStreamSelector.hpp TreeParser.hpp TreeParserSharedInputState.hpp config.hpp +noinst_HEADERS = ANTLRException.h ANTLRUtil.h AST.h ASTArray.h ASTFactory.h ASTNULLType.h ASTPair.h ASTRefCount.h BaseAST.h BitSet.h CharBuffer.h CharInputBuffer.h CharScanner.h CharStreamException.h CharStreamIOException.h CircularQueue.h CommonAST.h CommonASTWithHiddenTokens.h CommonHiddenStreamToken.h CommonToken.h InputBuffer.h IOException.h LLkParser.h LexerSharedInputState.h MismatchedCharException.h MismatchedTokenException.h NoViableAltException.h NoViableAltForCharException.h Parser.h ParserSharedInputState.h RecognitionException.h RefCount.h SemanticException.h String.h Token.h TokenBuffer.h TokenStream.h TokenStreamBasicFilter.h TokenStreamException.h TokenStreamHiddenTokenFilter.h TokenStreamIOException.h TokenStreamRecognitionException.h TokenStreamRetryException.h TokenStreamSelector.h TreeParser.h TreeParserSharedInputState.h config.h diff --git a/lib/antlr/antlr/MismatchedCharException.h b/lib/antlr/antlr/MismatchedCharException.h new file mode 100644 index 00000000..2f0b9be4 --- /dev/null +++ b/lib/antlr/antlr/MismatchedCharException.h @@ -0,0 +1,102 @@ +#ifndef INC_MismatchedCharException_h__ +#define INC_MismatchedCharException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class CharScanner; + +class ANTLR_API MismatchedCharException : public RecognitionException { +public: + // Types of chars +#ifndef NO_STATIC_CONSTS + static const int CHAR = 1; + static const int NOT_CHAR = 2; + static const int RANGE = 3; + static const int NOT_RANGE = 4; + static const int SET = 5; + static const int NOT_SET = 6; +#else + enum { + CHAR = 1, + NOT_CHAR = 2, + RANGE = 3, + NOT_RANGE = 4, + SET = 5, + NOT_SET = 6 + }; +#endif + +public: + // One of the above + int mismatchType; + + // what was found on the input stream + int foundChar; + + // For CHAR/NOT_CHAR and RANGE/NOT_RANGE + int expecting; + + // For RANGE/NOT_RANGE (expecting is lower bound of range) + int upper; + + // For SET/NOT_SET + BitSet set; + +protected: + // who knows...they may want to ask scanner questions + CharScanner* scanner; + +public: + MismatchedCharException(); + + // Expected range / not range + MismatchedCharException( + int c, + int lower, + int upper_, + bool matchNot, + CharScanner* scanner_ + ); + + // Expected token / not token + MismatchedCharException( + int c, + int expecting_, + bool matchNot, + CharScanner* scanner_ + ); + + // Expected BitSet / not BitSet + MismatchedCharException( + int c, + BitSet set_, + bool matchNot, + CharScanner* scanner_ + ); + + ~MismatchedCharException() throw() {} + + /** + * Returns a clean error message (no line number/column information) + */ + ANTLR_USE_NAMESPACE(std)string getMessage() const; +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_MismatchedCharException_h__ diff --git a/lib/antlr/antlr/MismatchedCharException.hpp b/lib/antlr/antlr/MismatchedCharException.hpp deleted file mode 100644 index cc77f9e4..00000000 --- a/lib/antlr/antlr/MismatchedCharException.hpp +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef INC_MismatchedCharException_hpp__ -#define INC_MismatchedCharException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class CharScanner; - -class ANTLR_API MismatchedCharException : public RecognitionException { -public: - // Types of chars -#ifndef NO_STATIC_CONSTS - static const int CHAR = 1; - static const int NOT_CHAR = 2; - static const int RANGE = 3; - static const int NOT_RANGE = 4; - static const int SET = 5; - static const int NOT_SET = 6; -#else - enum { - CHAR = 1, - NOT_CHAR = 2, - RANGE = 3, - NOT_RANGE = 4, - SET = 5, - NOT_SET = 6 - }; -#endif - -public: - // One of the above - int mismatchType; - - // what was found on the input stream - int foundChar; - - // For CHAR/NOT_CHAR and RANGE/NOT_RANGE - int expecting; - - // For RANGE/NOT_RANGE (expecting is lower bound of range) - int upper; - - // For SET/NOT_SET - BitSet set; - -protected: - // who knows...they may want to ask scanner questions - CharScanner* scanner; - -public: - MismatchedCharException(); - - // Expected range / not range - MismatchedCharException( - int c, - int lower, - int upper_, - bool matchNot, - CharScanner* scanner_ - ); - - // Expected token / not token - MismatchedCharException( - int c, - int expecting_, - bool matchNot, - CharScanner* scanner_ - ); - - // Expected BitSet / not BitSet - MismatchedCharException( - int c, - BitSet set_, - bool matchNot, - CharScanner* scanner_ - ); - - ~MismatchedCharException() throw() {} - - /** - * Returns a clean error message (no line number/column information) - */ - ANTLR_USE_NAMESPACE(std)string getMessage() const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_MismatchedCharException_hpp__ diff --git a/lib/antlr/antlr/MismatchedTokenException.h b/lib/antlr/antlr/MismatchedTokenException.h new file mode 100644 index 00000000..af3bdb8c --- /dev/null +++ b/lib/antlr/antlr/MismatchedTokenException.h @@ -0,0 +1,144 @@ +#ifndef INC_MismatchedTokenException_h__ +#define INC_MismatchedTokenException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API MismatchedTokenException : public RecognitionException { +public: + MismatchedTokenException(); + + /// Expected range / not range + MismatchedTokenException( + const char* const* tokenNames_, + const int numTokens_, + RefAST node_, + int lower, + int upper_, + bool matchNot + ); + + // Expected token / not token + MismatchedTokenException( + const char* const* tokenNames_, + const int numTokens_, + RefAST node_, + int expecting_, + bool matchNot + ); + + // Expected BitSet / not BitSet + MismatchedTokenException( + const char* const* tokenNames_, + const int numTokens_, + RefAST node_, + BitSet set_, + bool matchNot + ); + + // Expected range / not range + MismatchedTokenException( + const char* const* tokenNames_, + const int numTokens_, + RefToken token_, + int lower, + int upper_, + bool matchNot, + const ANTLR_USE_NAMESPACE(std)string& fileName_ + ); + + // Expected token / not token + MismatchedTokenException( + const char* const* tokenNames_, + const int numTokens_, + RefToken token_, + int expecting_, + bool matchNot, + const ANTLR_USE_NAMESPACE(std)string& fileName_ + ); + + // Expected BitSet / not BitSet + MismatchedTokenException( + const char* const* tokenNames_, + const int numTokens_, + RefToken token_, + BitSet set_, + bool matchNot, + const ANTLR_USE_NAMESPACE(std)string& fileName_ + ); + ~MismatchedTokenException() throw() {} + + /** + * Returns a clean error message (no line number/column information) + */ + ANTLR_USE_NAMESPACE(std)string getMessage() const; + +public: + /// The token that was encountered + const RefToken token; + /// The offending AST node if tree walking + const RefAST node; + /// taken from node or token object + ANTLR_USE_NAMESPACE(std)string tokenText; + + /// Types of tokens +#ifndef NO_STATIC_CONSTS + static const int TOKEN = 1; + static const int NOT_TOKEN = 2; + static const int RANGE = 3; + static const int NOT_RANGE = 4; + static const int SET = 5; + static const int NOT_SET = 6; +#else + enum { + TOKEN = 1, + NOT_TOKEN = 2, + RANGE = 3, + NOT_RANGE = 4, + SET = 5, + NOT_SET = 6 + }; +#endif + +public: + /// One of the above + int mismatchType; + + /// For TOKEN/NOT_TOKEN and RANGE/NOT_RANGE + int expecting; + + /// For RANGE/NOT_RANGE (expecting is lower bound of range) + int upper; + + /// For SET/NOT_SET + BitSet set; + +private: + /// Token names array for formatting + const char* const* tokenNames; + /// Max number of tokens in tokenNames + const int numTokens; + /// Return token name for tokenType + ANTLR_USE_NAMESPACE(std)string tokenName(int tokenType) const; +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_MismatchedTokenException_h__ diff --git a/lib/antlr/antlr/MismatchedTokenException.hpp b/lib/antlr/antlr/MismatchedTokenException.hpp deleted file mode 100644 index 47fb44e6..00000000 --- a/lib/antlr/antlr/MismatchedTokenException.hpp +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef INC_MismatchedTokenException_hpp__ -#define INC_MismatchedTokenException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API MismatchedTokenException : public RecognitionException { -public: - MismatchedTokenException(); - - /// Expected range / not range - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefAST node_, - int lower, - int upper_, - bool matchNot - ); - - // Expected token / not token - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefAST node_, - int expecting_, - bool matchNot - ); - - // Expected BitSet / not BitSet - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefAST node_, - BitSet set_, - bool matchNot - ); - - // Expected range / not range - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefToken token_, - int lower, - int upper_, - bool matchNot, - const ANTLR_USE_NAMESPACE(std)string& fileName_ - ); - - // Expected token / not token - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefToken token_, - int expecting_, - bool matchNot, - const ANTLR_USE_NAMESPACE(std)string& fileName_ - ); - - // Expected BitSet / not BitSet - MismatchedTokenException( - const char* const* tokenNames_, - const int numTokens_, - RefToken token_, - BitSet set_, - bool matchNot, - const ANTLR_USE_NAMESPACE(std)string& fileName_ - ); - ~MismatchedTokenException() throw() {} - - /** - * Returns a clean error message (no line number/column information) - */ - ANTLR_USE_NAMESPACE(std)string getMessage() const; - -public: - /// The token that was encountered - const RefToken token; - /// The offending AST node if tree walking - const RefAST node; - /// taken from node or token object - ANTLR_USE_NAMESPACE(std)string tokenText; - - /// Types of tokens -#ifndef NO_STATIC_CONSTS - static const int TOKEN = 1; - static const int NOT_TOKEN = 2; - static const int RANGE = 3; - static const int NOT_RANGE = 4; - static const int SET = 5; - static const int NOT_SET = 6; -#else - enum { - TOKEN = 1, - NOT_TOKEN = 2, - RANGE = 3, - NOT_RANGE = 4, - SET = 5, - NOT_SET = 6 - }; -#endif - -public: - /// One of the above - int mismatchType; - - /// For TOKEN/NOT_TOKEN and RANGE/NOT_RANGE - int expecting; - - /// For RANGE/NOT_RANGE (expecting is lower bound of range) - int upper; - - /// For SET/NOT_SET - BitSet set; - -private: - /// Token names array for formatting - const char* const* tokenNames; - /// Max number of tokens in tokenNames - const int numTokens; - /// Return token name for tokenType - ANTLR_USE_NAMESPACE(std)string tokenName(int tokenType) const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_MismatchedTokenException_hpp__ diff --git a/lib/antlr/antlr/NoViableAltException.h b/lib/antlr/antlr/NoViableAltException.h new file mode 100644 index 00000000..492c7b06 --- /dev/null +++ b/lib/antlr/antlr/NoViableAltException.h @@ -0,0 +1,40 @@ +#ifndef INC_NoViableAltException_h__ +#define INC_NoViableAltException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API NoViableAltException : public RecognitionException { +public: + const RefToken token; + const RefAST node; // handles parsing and treeparsing + + NoViableAltException(RefAST t); + NoViableAltException(RefToken t,const ANTLR_USE_NAMESPACE(std)string& fileName_); + + ~NoViableAltException() throw() {} + + /** + * Returns a clean error message (no line number/column information) + */ + ANTLR_USE_NAMESPACE(std)string getMessage() const; +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_NoViableAltException_h__ diff --git a/lib/antlr/antlr/NoViableAltException.hpp b/lib/antlr/antlr/NoViableAltException.hpp deleted file mode 100644 index 22236c90..00000000 --- a/lib/antlr/antlr/NoViableAltException.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef INC_NoViableAltException_hpp__ -#define INC_NoViableAltException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API NoViableAltException : public RecognitionException { -public: - const RefToken token; - const RefAST node; // handles parsing and treeparsing - - NoViableAltException(RefAST t); - NoViableAltException(RefToken t,const ANTLR_USE_NAMESPACE(std)string& fileName_); - - ~NoViableAltException() throw() {} - - /** - * Returns a clean error message (no line number/column information) - */ - ANTLR_USE_NAMESPACE(std)string getMessage() const; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_NoViableAltException_hpp__ diff --git a/lib/antlr/antlr/NoViableAltForCharException.h b/lib/antlr/antlr/NoViableAltForCharException.h new file mode 100644 index 00000000..9c592544 --- /dev/null +++ b/lib/antlr/antlr/NoViableAltForCharException.h @@ -0,0 +1,41 @@ +#ifndef INC_NoViableAltForCharException_h__ +# define INC_NoViableAltForCharException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +# include +# include +# include + +# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr +{ +# endif + +class ANTLR_API NoViableAltForCharException : public RecognitionException +{ +public: + NoViableAltForCharException(int c, CharScanner* scanner); + NoViableAltForCharException(int c, const ANTLR_USE_NAMESPACE(std)string& fileName_, + int line_, int column_); + + virtual ~NoViableAltForCharException() throw() + { + } + + /// Returns a clean error message (no line number/column information) + ANTLR_USE_NAMESPACE(std)string getMessage() const; +protected: + int foundChar; +}; + +# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +# endif + +#endif //INC_NoViableAltForCharException_h__ diff --git a/lib/antlr/antlr/NoViableAltForCharException.hpp b/lib/antlr/antlr/NoViableAltForCharException.hpp deleted file mode 100644 index 0b16a0ea..00000000 --- a/lib/antlr/antlr/NoViableAltForCharException.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef INC_NoViableAltForCharException_hpp__ -# define INC_NoViableAltForCharException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -# include -# include -# include - -# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr -{ -# endif - -class ANTLR_API NoViableAltForCharException : public RecognitionException -{ -public: - NoViableAltForCharException(int c, CharScanner* scanner); - NoViableAltForCharException(int c, const ANTLR_USE_NAMESPACE(std)string& fileName_, - int line_, int column_); - - virtual ~NoViableAltForCharException() throw() - { - } - - /// Returns a clean error message (no line number/column information) - ANTLR_USE_NAMESPACE(std)string getMessage() const; -protected: - int foundChar; -}; - -# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -# endif - -#endif //INC_NoViableAltForCharException_hpp__ diff --git a/lib/antlr/antlr/Parser.h b/lib/antlr/antlr/Parser.h new file mode 100644 index 00000000..4c53c433 --- /dev/null +++ b/lib/antlr/antlr/Parser.h @@ -0,0 +1,319 @@ +#ifndef INC_Parser_h__ +#define INC_Parser_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +extern bool DEBUG_PARSER; + +/** A generic ANTLR parser (LL(k) for k>=1) containing a bunch of + * utility routines useful at any lookahead depth. We distinguish between + * the LL(1) and LL(k) parsers because of efficiency. This may not be + * necessary in the near future. + * + * Each parser object contains the state of the parse including a lookahead + * cache (the form of which is determined by the subclass), whether or + * not the parser is in guess mode, where tokens come from, etc... + * + *

+ * During guess mode, the current lookahead token(s) and token type(s) + * cache must be saved because the token stream may not have been informed + * to save the token (via mark) before the try block. + * Guessing is started by: + *

    + *
  1. saving the lookahead cache. + *
  2. marking the current position in the TokenBuffer. + *
  3. increasing the guessing level. + *
+ * + * After guessing, the parser state is restored by: + *
    + *
  1. restoring the lookahead cache. + *
  2. rewinding the TokenBuffer. + *
  3. decreasing the guessing level. + *
+ * + * @see antlr.Token + * @see antlr.TokenBuffer + * @see antlr.TokenStream + * @see antlr.LL1Parser + * @see antlr.LLkParser + * + * @todo add constructors with ASTFactory. + */ +class ANTLR_API Parser { +protected: + Parser(TokenBuffer& input) + : inputState(new ParserInputState(input)), astFactory(0), traceDepth(0) + { + } + Parser(TokenBuffer* input) + : inputState(new ParserInputState(input)), astFactory(0), traceDepth(0) + { + } + Parser(const ParserSharedInputState& state) + : inputState(state), astFactory(0), traceDepth(0) + { + } +public: + virtual ~Parser() + { + } + + /** Return the token type of the ith token of lookahead where i=1 + * is the current token being examined by the parser (i.e., it + * has not been matched yet). + */ + virtual int LA(unsigned int i)=0; + + /// Return the i-th token of lookahead + virtual RefToken LT(unsigned int i)=0; + + /** DEPRECATED! Specify the factory to be used during tree building. (Compulsory) + * Setting the factory is nowadays compulsory. + * @see setASTFactory + */ + virtual void setASTNodeFactory( ASTFactory *factory ) + { + astFactory = factory; + } + /** Specify the factory to be used during tree building. (Compulsory) + * Setting the factory is nowadays compulsory. + */ + virtual void setASTFactory( ASTFactory *factory ) + { + astFactory = factory; + } + /** Return a pointer to the ASTFactory used. + * So you might use it in subsequent treewalkers or to reload AST's + * from disk. + */ + virtual ASTFactory* getASTFactory() + { + return astFactory; + } + /** Get the root AST node of the generated AST. When using a custom AST type + * or heterogenous AST's, you'll have to convert it to the right type + * yourself. + */ + virtual RefAST getAST() = 0; + + /// Return the filename of the input file. + virtual inline ANTLR_USE_NAMESPACE(std)string getFilename() const + { + return inputState->filename; + } + /// Set the filename of the input file (used for error reporting). + virtual void setFilename(const ANTLR_USE_NAMESPACE(std)string& f) + { + inputState->filename = f; + } + + virtual void setInputState(ParserSharedInputState state) + { + inputState = state; + } + virtual inline ParserSharedInputState getInputState() const + { + return inputState; + } + + /// Get another token object from the token stream + virtual void consume()=0; + /// Consume tokens until one matches the given token + virtual void consumeUntil(int tokenType) + { + while (LA(1) != Token::EOF_TYPE && LA(1) != tokenType) + consume(); + } + + /// Consume tokens until one matches the given token set + virtual void consumeUntil(const BitSet& set) + { + while (LA(1) != Token::EOF_TYPE && !set.member(LA(1))) + consume(); + } + + /** Make sure current lookahead symbol matches token type t. + * Throw an exception upon mismatch, which is catch by either the + * error handler or by the syntactic predicate. + */ + virtual void match(int t) + { + if ( DEBUG_PARSER ) + { + traceIndent(); + ANTLR_USE_NAMESPACE(std)cout << "enter match(" << t << ") with LA(1)=" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; + } + if ( LA(1) != t ) + { + if ( DEBUG_PARSER ) + { + traceIndent(); + ANTLR_USE_NAMESPACE(std)cout << "token mismatch: " << LA(1) << "!=" << t << ANTLR_USE_NAMESPACE(std)endl; + } + throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), t, false, getFilename()); + } + else + { + // mark token as consumed -- fetch next token deferred until LA/LT + consume(); + } + } + + virtual void matchNot(int t) + { + if ( LA(1)==t ) + { + // Throws inverted-sense exception + throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), t, true, getFilename()); + } + else + { + // mark token as consumed -- fetch next token deferred until LA/LT + consume(); + } + } + + /** Make sure current lookahead symbol matches the given set + * Throw an exception upon mismatch, which is catch by either the + * error handler or by the syntactic predicate. + */ + virtual void match(const BitSet& b) + { + if ( DEBUG_PARSER ) + { + traceIndent(); + ANTLR_USE_NAMESPACE(std)cout << "enter match(" << "bitset" /*b.toString()*/ + << ") with LA(1)=" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; + } + if ( !b.member(LA(1)) ) + { + if ( DEBUG_PARSER ) + { + traceIndent(); + ANTLR_USE_NAMESPACE(std)cout << "token mismatch: " << LA(1) << " not member of " + << "bitset" /*b.toString()*/ << ANTLR_USE_NAMESPACE(std)endl; + } + throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), b, false, getFilename()); + } + else + { + // mark token as consumed -- fetch next token deferred until LA/LT + consume(); + } + } + + /** Mark a spot in the input and return the position. + * Forwarded to TokenBuffer. + */ + virtual inline unsigned int mark() + { + return inputState->getInput().mark(); + } + /// rewind to a previously marked position + virtual inline void rewind(unsigned int pos) + { + inputState->getInput().rewind(pos); + } + /** called by the generated parser to do error recovery, override to + * customize the behaviour. + */ + virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) + { + consume(); + consumeUntil(tokenSet); + } + + /// Parser error-reporting function can be overridden in subclass + virtual void reportError(const RecognitionException& ex); + /// Parser error-reporting function can be overridden in subclass + virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); + /// Parser warning-reporting function can be overridden in subclass + virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); + + /// get the token name for the token number 'num' + virtual const char* getTokenName(int num) const = 0; + /// get a vector with all token names + virtual const char* const* getTokenNames() const = 0; + /** Get the number of tokens defined. + * This one should be overridden in subclasses. + */ + virtual int getNumTokens(void) const = 0; + + /** Set or change the input token buffer */ +// void setTokenBuffer(TokenBuffer* t); + + virtual void traceIndent(); + virtual void traceIn(const char* rname); + virtual void traceOut(const char* rname); +protected: +// void setTokenNames(const char** tokenNames_); + + ParserSharedInputState inputState; + +// /// AST return value for a rule is squirreled away here +// RefAST returnAST; + + /// AST support code; parser and treeparser delegate to this object + ASTFactory *astFactory; + + // used to keep track of the indentation for the trace + int traceDepth; + + /** Utility class which allows tracing to work even when exceptions are + * thrown. + */ + class Tracer { /*{{{*/ + private: + Parser* parser; + const char* text; + public: + Tracer(Parser* p,const char * t) + : parser(p), text(t) + { + parser->traceIn(text); + } + ~Tracer() + { +#ifdef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION + // Only give trace if there's no uncaught exception.. + if(!ANTLR_USE_NAMESPACE(std)uncaught_exception()) +#endif + parser->traceOut(text); + } + private: + Tracer(const Tracer&); // undefined + const Tracer& operator=(const Tracer&); // undefined + /*}}}*/ + }; +private: + Parser(const Parser&); // undefined + const Parser& operator=(const Parser&); // undefined +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_Parser_h__ diff --git a/lib/antlr/antlr/Parser.hpp b/lib/antlr/antlr/Parser.hpp deleted file mode 100644 index f74be2a8..00000000 --- a/lib/antlr/antlr/Parser.hpp +++ /dev/null @@ -1,319 +0,0 @@ -#ifndef INC_Parser_hpp__ -#define INC_Parser_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -extern bool DEBUG_PARSER; - -/** A generic ANTLR parser (LL(k) for k>=1) containing a bunch of - * utility routines useful at any lookahead depth. We distinguish between - * the LL(1) and LL(k) parsers because of efficiency. This may not be - * necessary in the near future. - * - * Each parser object contains the state of the parse including a lookahead - * cache (the form of which is determined by the subclass), whether or - * not the parser is in guess mode, where tokens come from, etc... - * - *

- * During guess mode, the current lookahead token(s) and token type(s) - * cache must be saved because the token stream may not have been informed - * to save the token (via mark) before the try block. - * Guessing is started by: - *

    - *
  1. saving the lookahead cache. - *
  2. marking the current position in the TokenBuffer. - *
  3. increasing the guessing level. - *
- * - * After guessing, the parser state is restored by: - *
    - *
  1. restoring the lookahead cache. - *
  2. rewinding the TokenBuffer. - *
  3. decreasing the guessing level. - *
- * - * @see antlr.Token - * @see antlr.TokenBuffer - * @see antlr.TokenStream - * @see antlr.LL1Parser - * @see antlr.LLkParser - * - * @todo add constructors with ASTFactory. - */ -class ANTLR_API Parser { -protected: - Parser(TokenBuffer& input) - : inputState(new ParserInputState(input)), astFactory(0), traceDepth(0) - { - } - Parser(TokenBuffer* input) - : inputState(new ParserInputState(input)), astFactory(0), traceDepth(0) - { - } - Parser(const ParserSharedInputState& state) - : inputState(state), astFactory(0), traceDepth(0) - { - } -public: - virtual ~Parser() - { - } - - /** Return the token type of the ith token of lookahead where i=1 - * is the current token being examined by the parser (i.e., it - * has not been matched yet). - */ - virtual int LA(unsigned int i)=0; - - /// Return the i-th token of lookahead - virtual RefToken LT(unsigned int i)=0; - - /** DEPRECATED! Specify the factory to be used during tree building. (Compulsory) - * Setting the factory is nowadays compulsory. - * @see setASTFactory - */ - virtual void setASTNodeFactory( ASTFactory *factory ) - { - astFactory = factory; - } - /** Specify the factory to be used during tree building. (Compulsory) - * Setting the factory is nowadays compulsory. - */ - virtual void setASTFactory( ASTFactory *factory ) - { - astFactory = factory; - } - /** Return a pointer to the ASTFactory used. - * So you might use it in subsequent treewalkers or to reload AST's - * from disk. - */ - virtual ASTFactory* getASTFactory() - { - return astFactory; - } - /** Get the root AST node of the generated AST. When using a custom AST type - * or heterogenous AST's, you'll have to convert it to the right type - * yourself. - */ - virtual RefAST getAST() = 0; - - /// Return the filename of the input file. - virtual inline ANTLR_USE_NAMESPACE(std)string getFilename() const - { - return inputState->filename; - } - /// Set the filename of the input file (used for error reporting). - virtual void setFilename(const ANTLR_USE_NAMESPACE(std)string& f) - { - inputState->filename = f; - } - - virtual void setInputState(ParserSharedInputState state) - { - inputState = state; - } - virtual inline ParserSharedInputState getInputState() const - { - return inputState; - } - - /// Get another token object from the token stream - virtual void consume()=0; - /// Consume tokens until one matches the given token - virtual void consumeUntil(int tokenType) - { - while (LA(1) != Token::EOF_TYPE && LA(1) != tokenType) - consume(); - } - - /// Consume tokens until one matches the given token set - virtual void consumeUntil(const BitSet& set) - { - while (LA(1) != Token::EOF_TYPE && !set.member(LA(1))) - consume(); - } - - /** Make sure current lookahead symbol matches token type t. - * Throw an exception upon mismatch, which is catch by either the - * error handler or by the syntactic predicate. - */ - virtual void match(int t) - { - if ( DEBUG_PARSER ) - { - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "enter match(" << t << ") with LA(1)=" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; - } - if ( LA(1) != t ) - { - if ( DEBUG_PARSER ) - { - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "token mismatch: " << LA(1) << "!=" << t << ANTLR_USE_NAMESPACE(std)endl; - } - throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), t, false, getFilename()); - } - else - { - // mark token as consumed -- fetch next token deferred until LA/LT - consume(); - } - } - - virtual void matchNot(int t) - { - if ( LA(1)==t ) - { - // Throws inverted-sense exception - throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), t, true, getFilename()); - } - else - { - // mark token as consumed -- fetch next token deferred until LA/LT - consume(); - } - } - - /** Make sure current lookahead symbol matches the given set - * Throw an exception upon mismatch, which is catch by either the - * error handler or by the syntactic predicate. - */ - virtual void match(const BitSet& b) - { - if ( DEBUG_PARSER ) - { - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "enter match(" << "bitset" /*b.toString()*/ - << ") with LA(1)=" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; - } - if ( !b.member(LA(1)) ) - { - if ( DEBUG_PARSER ) - { - traceIndent(); - ANTLR_USE_NAMESPACE(std)cout << "token mismatch: " << LA(1) << " not member of " - << "bitset" /*b.toString()*/ << ANTLR_USE_NAMESPACE(std)endl; - } - throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), b, false, getFilename()); - } - else - { - // mark token as consumed -- fetch next token deferred until LA/LT - consume(); - } - } - - /** Mark a spot in the input and return the position. - * Forwarded to TokenBuffer. - */ - virtual inline unsigned int mark() - { - return inputState->getInput().mark(); - } - /// rewind to a previously marked position - virtual inline void rewind(unsigned int pos) - { - inputState->getInput().rewind(pos); - } - /** called by the generated parser to do error recovery, override to - * customize the behaviour. - */ - virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) - { - consume(); - consumeUntil(tokenSet); - } - - /// Parser error-reporting function can be overridden in subclass - virtual void reportError(const RecognitionException& ex); - /// Parser error-reporting function can be overridden in subclass - virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); - /// Parser warning-reporting function can be overridden in subclass - virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); - - /// get the token name for the token number 'num' - virtual const char* getTokenName(int num) const = 0; - /// get a vector with all token names - virtual const char* const* getTokenNames() const = 0; - /** Get the number of tokens defined. - * This one should be overridden in subclasses. - */ - virtual int getNumTokens(void) const = 0; - - /** Set or change the input token buffer */ -// void setTokenBuffer(TokenBuffer* t); - - virtual void traceIndent(); - virtual void traceIn(const char* rname); - virtual void traceOut(const char* rname); -protected: -// void setTokenNames(const char** tokenNames_); - - ParserSharedInputState inputState; - -// /// AST return value for a rule is squirreled away here -// RefAST returnAST; - - /// AST support code; parser and treeparser delegate to this object - ASTFactory *astFactory; - - // used to keep track of the indentation for the trace - int traceDepth; - - /** Utility class which allows tracing to work even when exceptions are - * thrown. - */ - class Tracer { /*{{{*/ - private: - Parser* parser; - const char* text; - public: - Tracer(Parser* p,const char * t) - : parser(p), text(t) - { - parser->traceIn(text); - } - ~Tracer() - { -#ifdef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION - // Only give trace if there's no uncaught exception.. - if(!ANTLR_USE_NAMESPACE(std)uncaught_exception()) -#endif - parser->traceOut(text); - } - private: - Tracer(const Tracer&); // undefined - const Tracer& operator=(const Tracer&); // undefined - /*}}}*/ - }; -private: - Parser(const Parser&); // undefined - const Parser& operator=(const Parser&); // undefined -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_Parser_hpp__ diff --git a/lib/antlr/antlr/ParserSharedInputState.h b/lib/antlr/antlr/ParserSharedInputState.h new file mode 100644 index 00000000..1c0a8152 --- /dev/null +++ b/lib/antlr/antlr/ParserSharedInputState.h @@ -0,0 +1,92 @@ +#ifndef INC_ParserSharedInputState_h__ +#define INC_ParserSharedInputState_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** This object contains the data associated with an + * input stream of tokens. Multiple parsers + * share a single ParserSharedInputState to parse + * the same stream of tokens. + */ +class ANTLR_API ParserInputState { +public: + /** Construct a new ParserInputState + * @param in the TokenBuffer to read from. The object is deleted together + * with the ParserInputState object. + */ + ParserInputState( TokenBuffer* in ) + : guessing(0) + , filename() + , input(in) + , inputResponsible(true) + { + } + /** Construct a new ParserInputState + * @param in the TokenBuffer to read from. + */ + ParserInputState( TokenBuffer& in ) + : guessing(0) + , filename("") + , input(&in) + , inputResponsible(false) + { + } + + virtual ~ParserInputState() + { + if (inputResponsible) + delete input; + } + + TokenBuffer& getInput( void ) + { + return *input; + } + + /// Reset the ParserInputState and the underlying TokenBuffer + void reset( void ) + { + input->reset(); + guessing = 0; + } + +public: + /** Are we guessing (guessing>0)? */ + int guessing; + /** What file (if known) caused the problem? + * @todo wrap this one.. + */ + ANTLR_USE_NAMESPACE(std)string filename; +private: + /** Where to get token objects */ + TokenBuffer* input; + /// Do we need to free the TokenBuffer or is it owned by another.. + bool inputResponsible; + + // we don't want these: + ParserInputState(const ParserInputState&); + ParserInputState& operator=(const ParserInputState&); +}; + +/// A reference counted ParserInputState +typedef RefCount ParserSharedInputState; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_ParserSharedInputState_h__ diff --git a/lib/antlr/antlr/ParserSharedInputState.hpp b/lib/antlr/antlr/ParserSharedInputState.hpp deleted file mode 100644 index b011bc15..00000000 --- a/lib/antlr/antlr/ParserSharedInputState.hpp +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef INC_ParserSharedInputState_hpp__ -#define INC_ParserSharedInputState_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This object contains the data associated with an - * input stream of tokens. Multiple parsers - * share a single ParserSharedInputState to parse - * the same stream of tokens. - */ -class ANTLR_API ParserInputState { -public: - /** Construct a new ParserInputState - * @param in the TokenBuffer to read from. The object is deleted together - * with the ParserInputState object. - */ - ParserInputState( TokenBuffer* in ) - : guessing(0) - , filename() - , input(in) - , inputResponsible(true) - { - } - /** Construct a new ParserInputState - * @param in the TokenBuffer to read from. - */ - ParserInputState( TokenBuffer& in ) - : guessing(0) - , filename("") - , input(&in) - , inputResponsible(false) - { - } - - virtual ~ParserInputState() - { - if (inputResponsible) - delete input; - } - - TokenBuffer& getInput( void ) - { - return *input; - } - - /// Reset the ParserInputState and the underlying TokenBuffer - void reset( void ) - { - input->reset(); - guessing = 0; - } - -public: - /** Are we guessing (guessing>0)? */ - int guessing; - /** What file (if known) caused the problem? - * @todo wrap this one.. - */ - ANTLR_USE_NAMESPACE(std)string filename; -private: - /** Where to get token objects */ - TokenBuffer* input; - /// Do we need to free the TokenBuffer or is it owned by another.. - bool inputResponsible; - - // we don't want these: - ParserInputState(const ParserInputState&); - ParserInputState& operator=(const ParserInputState&); -}; - -/// A reference counted ParserInputState -typedef RefCount ParserSharedInputState; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_ParserSharedInputState_hpp__ diff --git a/lib/antlr/antlr/RecognitionException.h b/lib/antlr/antlr/RecognitionException.h new file mode 100644 index 00000000..3d7604ee --- /dev/null +++ b/lib/antlr/antlr/RecognitionException.h @@ -0,0 +1,66 @@ +#ifndef INC_RecognitionException_h__ +# define INC_RecognitionException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +# include +# include + +# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr +{ +# endif + class ANTLR_API RecognitionException : public ANTLRException + { + public: + RecognitionException(); + RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s); + RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s, + const ANTLR_USE_NAMESPACE(std)string& fileName, + int line, int column ); + + virtual ~RecognitionException() throw() + { + } + + /// Return file where mishap occurred. + virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() + { + return fileName; + } + /** + * @return the line number that this exception happened on. + */ + virtual int getLine() const throw() + { + return line; + } + /** + * @return the column number that this exception happened on. + */ + virtual int getColumn() const throw() + { + return column; + } + + /// Return complete error message with line/column number info (if present) + virtual ANTLR_USE_NAMESPACE(std)string toString() const; + + /// See what file/line/column info is present and return it as a string + virtual ANTLR_USE_NAMESPACE(std)string getFileLineColumnString() const; + protected: + ANTLR_USE_NAMESPACE(std)string fileName; // not used by treeparsers + int line; // not used by treeparsers + int column; // not used by treeparsers + }; + +# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +# endif + +#endif //INC_RecognitionException_h__ diff --git a/lib/antlr/antlr/RecognitionException.hpp b/lib/antlr/antlr/RecognitionException.hpp deleted file mode 100644 index e61bc620..00000000 --- a/lib/antlr/antlr/RecognitionException.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef INC_RecognitionException_hpp__ -# define INC_RecognitionException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -# include -# include - -# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr -{ -# endif - class ANTLR_API RecognitionException : public ANTLRException - { - public: - RecognitionException(); - RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s); - RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s, - const ANTLR_USE_NAMESPACE(std)string& fileName, - int line, int column ); - - virtual ~RecognitionException() throw() - { - } - - /// Return file where mishap occurred. - virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() - { - return fileName; - } - /** - * @return the line number that this exception happened on. - */ - virtual int getLine() const throw() - { - return line; - } - /** - * @return the column number that this exception happened on. - */ - virtual int getColumn() const throw() - { - return column; - } - - /// Return complete error message with line/column number info (if present) - virtual ANTLR_USE_NAMESPACE(std)string toString() const; - - /// See what file/line/column info is present and return it as a string - virtual ANTLR_USE_NAMESPACE(std)string getFileLineColumnString() const; - protected: - ANTLR_USE_NAMESPACE(std)string fileName; // not used by treeparsers - int line; // not used by treeparsers - int column; // not used by treeparsers - }; - -# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -# endif - -#endif //INC_RecognitionException_hpp__ diff --git a/lib/antlr/antlr/RefCount.h b/lib/antlr/antlr/RefCount.h new file mode 100644 index 00000000..93df952e --- /dev/null +++ b/lib/antlr/antlr/RefCount.h @@ -0,0 +1,80 @@ +#ifndef INC_RefCount_h__ +#define INC_RefCount_h__ +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +template +class ANTLR_API RefCount { +private: + struct Ref { + T* const ptr; + unsigned int count; + + Ref(T* p) : ptr(p), count(1) {} + ~Ref() {delete ptr;} + Ref* increment() {++count;return this;} + bool decrement() {return (--count==0);} + private: + Ref(const Ref&); + Ref& operator=(const Ref&); + }* ref; + +public: + explicit RefCount(T* p = 0) + : ref(p ? new Ref(p) : 0) + { + } + RefCount(const RefCount& other) + : ref(other.ref ? other.ref->increment() : 0) + { + } + ~RefCount() + { + if (ref && ref->decrement()) + delete ref; + } + RefCount& operator=(const RefCount& other) + { + Ref* tmp = other.ref ? other.ref->increment() : 0; + if (ref && ref->decrement()) + delete ref; + ref = tmp; + return *this; + } + + operator T* () const + { + return ref ? ref->ptr : 0; + } + + T* operator->() const + { + return ref ? ref->ptr : 0; + } + + T* get() const + { + return ref ? ref->ptr : 0; + } + + template operator RefCount() + { + return RefCount(ref); + } +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_RefCount_h__ diff --git a/lib/antlr/antlr/RefCount.hpp b/lib/antlr/antlr/RefCount.hpp deleted file mode 100644 index 8546a049..00000000 --- a/lib/antlr/antlr/RefCount.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef INC_RefCount_hpp__ -#define INC_RefCount_hpp__ -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -template -class ANTLR_API RefCount { -private: - struct Ref { - T* const ptr; - unsigned int count; - - Ref(T* p) : ptr(p), count(1) {} - ~Ref() {delete ptr;} - Ref* increment() {++count;return this;} - bool decrement() {return (--count==0);} - private: - Ref(const Ref&); - Ref& operator=(const Ref&); - }* ref; - -public: - explicit RefCount(T* p = 0) - : ref(p ? new Ref(p) : 0) - { - } - RefCount(const RefCount& other) - : ref(other.ref ? other.ref->increment() : 0) - { - } - ~RefCount() - { - if (ref && ref->decrement()) - delete ref; - } - RefCount& operator=(const RefCount& other) - { - Ref* tmp = other.ref ? other.ref->increment() : 0; - if (ref && ref->decrement()) - delete ref; - ref = tmp; - return *this; - } - - operator T* () const - { - return ref ? ref->ptr : 0; - } - - T* operator->() const - { - return ref ? ref->ptr : 0; - } - - T* get() const - { - return ref ? ref->ptr : 0; - } - - template operator RefCount() - { - return RefCount(ref); - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_RefCount_hpp__ diff --git a/lib/antlr/antlr/SemanticException.h b/lib/antlr/antlr/SemanticException.h new file mode 100644 index 00000000..05c5c5fe --- /dev/null +++ b/lib/antlr/antlr/SemanticException.h @@ -0,0 +1,40 @@ +#ifndef INC_SemanticException_h__ +#define INC_SemanticException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API SemanticException : public RecognitionException { +public: + SemanticException(const ANTLR_USE_NAMESPACE(std)string& s) + : RecognitionException(s) + { + } + SemanticException(const ANTLR_USE_NAMESPACE(std)string& s, + const ANTLR_USE_NAMESPACE(std)string& fileName_, + int line_,int column_) + : RecognitionException(s,fileName_,line_,column_) + { + } + + ~SemanticException() throw() + { + } +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_SemanticException_h__ diff --git a/lib/antlr/antlr/SemanticException.hpp b/lib/antlr/antlr/SemanticException.hpp deleted file mode 100644 index dc68d5a9..00000000 --- a/lib/antlr/antlr/SemanticException.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef INC_SemanticException_hpp__ -#define INC_SemanticException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API SemanticException : public RecognitionException { -public: - SemanticException(const ANTLR_USE_NAMESPACE(std)string& s) - : RecognitionException(s) - { - } - SemanticException(const ANTLR_USE_NAMESPACE(std)string& s, - const ANTLR_USE_NAMESPACE(std)string& fileName_, - int line_,int column_) - : RecognitionException(s,fileName_,line_,column_) - { - } - - ~SemanticException() throw() - { - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_SemanticException_hpp__ diff --git a/lib/antlr/antlr/String.h b/lib/antlr/antlr/String.h new file mode 100644 index 00000000..7e406c1a --- /dev/null +++ b/lib/antlr/antlr/String.h @@ -0,0 +1,27 @@ +#ifndef INC_String_h__ +#define INC_String_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +ANTLR_API ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, const int rhs ); +ANTLR_API ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, size_t rhs ); + +ANTLR_API ANTLR_USE_NAMESPACE(std)string charName( int ch ); + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_String_h__ diff --git a/lib/antlr/antlr/String.hpp b/lib/antlr/antlr/String.hpp deleted file mode 100644 index 7e6dde5a..00000000 --- a/lib/antlr/antlr/String.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef INC_String_hpp__ -#define INC_String_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -ANTLR_API ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, const int rhs ); -ANTLR_API ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, size_t rhs ); - -ANTLR_API ANTLR_USE_NAMESPACE(std)string charName( int ch ); - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_String_hpp__ diff --git a/lib/antlr/antlr/Token.h b/lib/antlr/antlr/Token.h new file mode 100644 index 00000000..88f747ba --- /dev/null +++ b/lib/antlr/antlr/Token.h @@ -0,0 +1,108 @@ +#ifndef INC_Token_h__ +#define INC_Token_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +struct TokenRef; + +/** A token is minimally a token type. Subclasses can add the text matched + * for the token and line info. + */ +class ANTLR_API Token +{ +public: + // constants +#ifndef NO_STATIC_CONSTS + static const int MIN_USER_TYPE = 4; + static const int NULL_TREE_LOOKAHEAD = 3; + static const int INVALID_TYPE = 0; + static const int EOF_TYPE = 1; + static const int SKIP = -1; +#else + enum { + MIN_USER_TYPE = 4, + NULL_TREE_LOOKAHEAD = 3, + INVALID_TYPE = 0, + EOF_TYPE = 1, + SKIP = -1 + }; +#endif + + Token() + : ref(0) + , type(INVALID_TYPE) + { + } + Token(int t) + : ref(0) + , type(t) + { + } + Token(int t, const ANTLR_USE_NAMESPACE(std)string& txt) + : ref(0) + , type(t) + { + setText(txt); + } + virtual ~Token() + { + } + + virtual int getColumn() const; + virtual int getLine() const; + virtual ANTLR_USE_NAMESPACE(std)string getText() const; + virtual const ANTLR_USE_NAMESPACE(std)string& getFilename() const; + virtual int getType() const; + + virtual void setColumn(int c); + + virtual void setLine(int l); + virtual void setText(const ANTLR_USE_NAMESPACE(std)string& t); + virtual void setType(int t); + + virtual void setFilename( const std::string& file ); + + virtual ANTLR_USE_NAMESPACE(std)string toString() const; + +private: + friend struct TokenRef; + TokenRef* ref; + + int type; ///< the type of the token + + Token(RefToken other); + Token& operator=(const Token& other); + Token& operator=(RefToken other); + + Token(const Token&); +}; + +extern ANTLR_API RefToken nullToken; + +#ifdef NEEDS_OPERATOR_LESS_THAN +// RK: Added after 2.7.2 previously it was undefined. +// AL: what to return if l and/or r point to nullToken??? +inline bool operator<( RefToken l, RefToken r ) +{ + return nullToken == l ? ( nullToken == r ? false : true ) : l->getType() < r->getType(); +} +#endif + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_Token_h__ diff --git a/lib/antlr/antlr/Token.hpp b/lib/antlr/antlr/Token.hpp deleted file mode 100644 index cd56fc3c..00000000 --- a/lib/antlr/antlr/Token.hpp +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef INC_Token_hpp__ -#define INC_Token_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -struct TokenRef; - -/** A token is minimally a token type. Subclasses can add the text matched - * for the token and line info. - */ -class ANTLR_API Token -{ -public: - // constants -#ifndef NO_STATIC_CONSTS - static const int MIN_USER_TYPE = 4; - static const int NULL_TREE_LOOKAHEAD = 3; - static const int INVALID_TYPE = 0; - static const int EOF_TYPE = 1; - static const int SKIP = -1; -#else - enum { - MIN_USER_TYPE = 4, - NULL_TREE_LOOKAHEAD = 3, - INVALID_TYPE = 0, - EOF_TYPE = 1, - SKIP = -1 - }; -#endif - - Token() - : ref(0) - , type(INVALID_TYPE) - { - } - Token(int t) - : ref(0) - , type(t) - { - } - Token(int t, const ANTLR_USE_NAMESPACE(std)string& txt) - : ref(0) - , type(t) - { - setText(txt); - } - virtual ~Token() - { - } - - virtual int getColumn() const; - virtual int getLine() const; - virtual ANTLR_USE_NAMESPACE(std)string getText() const; - virtual const ANTLR_USE_NAMESPACE(std)string& getFilename() const; - virtual int getType() const; - - virtual void setColumn(int c); - - virtual void setLine(int l); - virtual void setText(const ANTLR_USE_NAMESPACE(std)string& t); - virtual void setType(int t); - - virtual void setFilename( const std::string& file ); - - virtual ANTLR_USE_NAMESPACE(std)string toString() const; - -private: - friend struct TokenRef; - TokenRef* ref; - - int type; ///< the type of the token - - Token(RefToken other); - Token& operator=(const Token& other); - Token& operator=(RefToken other); - - Token(const Token&); -}; - -extern ANTLR_API RefToken nullToken; - -#ifdef NEEDS_OPERATOR_LESS_THAN -// RK: Added after 2.7.2 previously it was undefined. -// AL: what to return if l and/or r point to nullToken??? -inline bool operator<( RefToken l, RefToken r ) -{ - return nullToken == l ? ( nullToken == r ? false : true ) : l->getType() < r->getType(); -} -#endif - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_Token_hpp__ diff --git a/lib/antlr/antlr/TokenBuffer.h b/lib/antlr/antlr/TokenBuffer.h new file mode 100644 index 00000000..5832ef6e --- /dev/null +++ b/lib/antlr/antlr/TokenBuffer.h @@ -0,0 +1,121 @@ +#ifndef INC_TokenBuffer_h__ +#define INC_TokenBuffer_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/**A Stream of Token objects fed to the parser from a TokenStream that can + * be rewound via mark()/rewind() methods. + *

+ * A dynamic array is used to buffer up all the input tokens. Normally, + * "k" tokens are stored in the buffer. More tokens may be stored during + * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. + * Consumption of tokens is deferred. In other words, reading the next + * token is not done by conume(), but deferred until needed by LA or LT. + *

+ * + * @todo: see if we can integrate this one with InputBuffer into one template + * or so. + * + * @see antlr.Token + * @see antlr.TokenStream + * @see antlr.TokenQueue + */ +class ANTLR_API TokenBuffer { +public: + /** Create a token buffer */ + TokenBuffer(TokenStream& input_); + virtual ~TokenBuffer(); + + /// Reset the input buffer to empty state + inline void reset( void ) + { + nMarkers = 0; + markerOffset = 0; + numToConsume = 0; + queue.clear(); + } + + /** Get a lookahead token value */ + int LA( unsigned int i ); + + /** Get a lookahead token */ + RefToken LT( unsigned int i ); + + /** Return an integer marker that can be used to rewind the buffer to + * its current state. + */ + unsigned int mark(); + + /**Rewind the token buffer to a marker. + * @param mark Marker returned previously from mark() + */ + void rewind(unsigned int mark); + + /** Mark another token for deferred consumption */ + inline void consume() + { + numToConsume++; + } + + /// Return the number of entries in the TokenBuffer + virtual unsigned int entries() const; + +private: + /** Ensure that the token buffer is sufficiently full */ + void fill(unsigned int amount); + /** Sync up deferred consumption */ + void syncConsume(); + +protected: + /// Token source + TokenStream& input; + + /// Number of active markers + unsigned int nMarkers; + + /// Additional offset used when markers are active + unsigned int markerOffset; + + /// Number of calls to consume() since last LA() or LT() call + unsigned int numToConsume; + + /// Circular queue with Tokens + CircularQueue queue; + +private: + TokenBuffer(const TokenBuffer& other); + const TokenBuffer& operator=(const TokenBuffer& other); +}; + +/** Sync up deferred consumption */ +inline void TokenBuffer::syncConsume() +{ + if (numToConsume > 0) + { + if (nMarkers > 0) + markerOffset += numToConsume; + else + queue.removeItems( numToConsume ); + + numToConsume = 0; + } +} + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenBuffer_h__ diff --git a/lib/antlr/antlr/TokenBuffer.hpp b/lib/antlr/antlr/TokenBuffer.hpp deleted file mode 100644 index 3077eead..00000000 --- a/lib/antlr/antlr/TokenBuffer.hpp +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef INC_TokenBuffer_hpp__ -#define INC_TokenBuffer_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**A Stream of Token objects fed to the parser from a TokenStream that can - * be rewound via mark()/rewind() methods. - *

- * A dynamic array is used to buffer up all the input tokens. Normally, - * "k" tokens are stored in the buffer. More tokens may be stored during - * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. - * Consumption of tokens is deferred. In other words, reading the next - * token is not done by conume(), but deferred until needed by LA or LT. - *

- * - * @todo: see if we can integrate this one with InputBuffer into one template - * or so. - * - * @see antlr.Token - * @see antlr.TokenStream - * @see antlr.TokenQueue - */ -class ANTLR_API TokenBuffer { -public: - /** Create a token buffer */ - TokenBuffer(TokenStream& input_); - virtual ~TokenBuffer(); - - /// Reset the input buffer to empty state - inline void reset( void ) - { - nMarkers = 0; - markerOffset = 0; - numToConsume = 0; - queue.clear(); - } - - /** Get a lookahead token value */ - int LA( unsigned int i ); - - /** Get a lookahead token */ - RefToken LT( unsigned int i ); - - /** Return an integer marker that can be used to rewind the buffer to - * its current state. - */ - unsigned int mark(); - - /**Rewind the token buffer to a marker. - * @param mark Marker returned previously from mark() - */ - void rewind(unsigned int mark); - - /** Mark another token for deferred consumption */ - inline void consume() - { - numToConsume++; - } - - /// Return the number of entries in the TokenBuffer - virtual unsigned int entries() const; - -private: - /** Ensure that the token buffer is sufficiently full */ - void fill(unsigned int amount); - /** Sync up deferred consumption */ - void syncConsume(); - -protected: - /// Token source - TokenStream& input; - - /// Number of active markers - unsigned int nMarkers; - - /// Additional offset used when markers are active - unsigned int markerOffset; - - /// Number of calls to consume() since last LA() or LT() call - unsigned int numToConsume; - - /// Circular queue with Tokens - CircularQueue queue; - -private: - TokenBuffer(const TokenBuffer& other); - const TokenBuffer& operator=(const TokenBuffer& other); -}; - -/** Sync up deferred consumption */ -inline void TokenBuffer::syncConsume() -{ - if (numToConsume > 0) - { - if (nMarkers > 0) - markerOffset += numToConsume; - else - queue.removeItems( numToConsume ); - - numToConsume = 0; - } -} - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenBuffer_hpp__ diff --git a/lib/antlr/antlr/TokenRefCount.h b/lib/antlr/antlr/TokenRefCount.h new file mode 100644 index 00000000..6b2042b7 --- /dev/null +++ b/lib/antlr/antlr/TokenRefCount.h @@ -0,0 +1,98 @@ +#ifndef INC_TokenRefCount_h__ +# define INC_TokenRefCount_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id:$ + */ + +# include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class Token; + +struct ANTLR_API TokenRef +{ + Token* const ptr; + unsigned int count; + + TokenRef(Token* p); + ~TokenRef(); + TokenRef* increment() + { + ++count; + return this; + } + bool decrement() + { + return (--count==0); + } + + static TokenRef* getRef(const Token* p); +private: + TokenRef( const TokenRef& ); + TokenRef& operator=( const TokenRef& ); +}; + +template + class ANTLR_API TokenRefCount +{ +private: + TokenRef* ref; + +public: + TokenRefCount(const Token* p=0) + : ref(p ? TokenRef::getRef(p) : 0) + { + } + TokenRefCount(const TokenRefCount& other) + : ref(other.ref ? other.ref->increment() : 0) + { + } + ~TokenRefCount() + { + if (ref && ref->decrement()) + delete ref; + } + TokenRefCount& operator=(Token* other) + { + TokenRef* tmp = TokenRef::getRef(other); + + if (ref && ref->decrement()) + delete ref; + + ref=tmp; + + return *this; + } + TokenRefCount& operator=(const TokenRefCount& other) + { + if( other.ref != ref ) + { + TokenRef* tmp = other.ref ? other.ref->increment() : 0; + + if (ref && ref->decrement()) + delete ref; + + ref=tmp; + } + return *this; + } + + operator T* () const { return ref ? static_cast(ref->ptr) : 0; } + T* operator->() const { return ref ? static_cast(ref->ptr) : 0; } + T* get() const { return ref ? static_cast(ref->ptr) : 0; } +}; + +typedef TokenRefCount RefToken; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenRefCount_h__ diff --git a/lib/antlr/antlr/TokenRefCount.hpp b/lib/antlr/antlr/TokenRefCount.hpp deleted file mode 100644 index 9ccbb98c..00000000 --- a/lib/antlr/antlr/TokenRefCount.hpp +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef INC_TokenRefCount_hpp__ -# define INC_TokenRefCount_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -# include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class Token; - -struct ANTLR_API TokenRef -{ - Token* const ptr; - unsigned int count; - - TokenRef(Token* p); - ~TokenRef(); - TokenRef* increment() - { - ++count; - return this; - } - bool decrement() - { - return (--count==0); - } - - static TokenRef* getRef(const Token* p); -private: - TokenRef( const TokenRef& ); - TokenRef& operator=( const TokenRef& ); -}; - -template - class ANTLR_API TokenRefCount -{ -private: - TokenRef* ref; - -public: - TokenRefCount(const Token* p=0) - : ref(p ? TokenRef::getRef(p) : 0) - { - } - TokenRefCount(const TokenRefCount& other) - : ref(other.ref ? other.ref->increment() : 0) - { - } - ~TokenRefCount() - { - if (ref && ref->decrement()) - delete ref; - } - TokenRefCount& operator=(Token* other) - { - TokenRef* tmp = TokenRef::getRef(other); - - if (ref && ref->decrement()) - delete ref; - - ref=tmp; - - return *this; - } - TokenRefCount& operator=(const TokenRefCount& other) - { - if( other.ref != ref ) - { - TokenRef* tmp = other.ref ? other.ref->increment() : 0; - - if (ref && ref->decrement()) - delete ref; - - ref=tmp; - } - return *this; - } - - operator T* () const { return ref ? static_cast(ref->ptr) : 0; } - T* operator->() const { return ref ? static_cast(ref->ptr) : 0; } - T* get() const { return ref ? static_cast(ref->ptr) : 0; } -}; - -typedef TokenRefCount RefToken; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenRefCount_hpp__ diff --git a/lib/antlr/antlr/TokenStream.h b/lib/antlr/antlr/TokenStream.h new file mode 100644 index 00000000..d7fc688b --- /dev/null +++ b/lib/antlr/antlr/TokenStream.h @@ -0,0 +1,34 @@ +#ifndef INC_TokenStream_h__ +#define INC_TokenStream_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** This interface allows any object to pretend it is a stream + * of tokens. + * @author Terence Parr, MageLang Institute + */ +class ANTLR_API TokenStream { +public: + virtual RefToken nextToken()=0; + virtual ~TokenStream() + { + } +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenStream_h__ diff --git a/lib/antlr/antlr/TokenStream.hpp b/lib/antlr/antlr/TokenStream.hpp deleted file mode 100644 index dbf83a8c..00000000 --- a/lib/antlr/antlr/TokenStream.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef INC_TokenStream_hpp__ -#define INC_TokenStream_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This interface allows any object to pretend it is a stream - * of tokens. - * @author Terence Parr, MageLang Institute - */ -class ANTLR_API TokenStream { -public: - virtual RefToken nextToken()=0; - virtual ~TokenStream() - { - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStream_hpp__ diff --git a/lib/antlr/antlr/TokenStreamBasicFilter.h b/lib/antlr/antlr/TokenStreamBasicFilter.h new file mode 100644 index 00000000..51862169 --- /dev/null +++ b/lib/antlr/antlr/TokenStreamBasicFilter.h @@ -0,0 +1,46 @@ +#ifndef INC_TokenStreamBasicFilter_h__ +#define INC_TokenStreamBasicFilter_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** This object is a TokenStream that passes through all + * tokens except for those that you tell it to discard. + * There is no buffering of the tokens. + */ +class ANTLR_API TokenStreamBasicFilter : public TokenStream { + /** The set of token types to discard */ +protected: + BitSet discardMask; + + /** The input stream */ +protected: + TokenStream* input; + +public: + TokenStreamBasicFilter(TokenStream& input_); + + void discard(int ttype); + + void discard(const BitSet& mask); + + RefToken nextToken(); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenStreamBasicFilter_h__ diff --git a/lib/antlr/antlr/TokenStreamBasicFilter.hpp b/lib/antlr/antlr/TokenStreamBasicFilter.hpp deleted file mode 100644 index bcdb131c..00000000 --- a/lib/antlr/antlr/TokenStreamBasicFilter.hpp +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef INC_TokenStreamBasicFilter_hpp__ -#define INC_TokenStreamBasicFilter_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This object is a TokenStream that passes through all - * tokens except for those that you tell it to discard. - * There is no buffering of the tokens. - */ -class ANTLR_API TokenStreamBasicFilter : public TokenStream { - /** The set of token types to discard */ -protected: - BitSet discardMask; - - /** The input stream */ -protected: - TokenStream* input; - -public: - TokenStreamBasicFilter(TokenStream& input_); - - void discard(int ttype); - - void discard(const BitSet& mask); - - RefToken nextToken(); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamBasicFilter_hpp__ diff --git a/lib/antlr/antlr/TokenStreamException.h b/lib/antlr/antlr/TokenStreamException.h new file mode 100644 index 00000000..7bffddca --- /dev/null +++ b/lib/antlr/antlr/TokenStreamException.h @@ -0,0 +1,41 @@ +#ifndef INC_TokenStreamException_h__ +#define INC_TokenStreamException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** Baseclass for exceptions thrown by classes implementing the TokenStream + * interface. + * @see TokenStream + */ +class ANTLR_API TokenStreamException : public ANTLRException { +public: + TokenStreamException() + : ANTLRException() + { + } + TokenStreamException(const ANTLR_USE_NAMESPACE(std)string& s) + : ANTLRException(s) + { + } + virtual ~TokenStreamException() throw() + { + } +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenStreamException_h__ diff --git a/lib/antlr/antlr/TokenStreamException.hpp b/lib/antlr/antlr/TokenStreamException.hpp deleted file mode 100644 index dbddb442..00000000 --- a/lib/antlr/antlr/TokenStreamException.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef INC_TokenStreamException_hpp__ -#define INC_TokenStreamException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Baseclass for exceptions thrown by classes implementing the TokenStream - * interface. - * @see TokenStream - */ -class ANTLR_API TokenStreamException : public ANTLRException { -public: - TokenStreamException() - : ANTLRException() - { - } - TokenStreamException(const ANTLR_USE_NAMESPACE(std)string& s) - : ANTLRException(s) - { - } - virtual ~TokenStreamException() throw() - { - } -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamException_hpp__ diff --git a/lib/antlr/antlr/TokenStreamHiddenTokenFilter.h b/lib/antlr/antlr/TokenStreamHiddenTokenFilter.h new file mode 100644 index 00000000..2597ce58 --- /dev/null +++ b/lib/antlr/antlr/TokenStreamHiddenTokenFilter.h @@ -0,0 +1,95 @@ +#ifndef INC_TokenStreamHiddenTokenFilter_h__ +#define INC_TokenStreamHiddenTokenFilter_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/**This object filters a token stream coming from a lexer + * or another TokenStream so that only certain token channels + * get transmitted to the parser. + * + * Any of the channels can be filtered off as "hidden" channels whose + * tokens can be accessed from the parser. + */ +class ANTLR_API TokenStreamHiddenTokenFilter : public TokenStreamBasicFilter { + // protected BitSet discardMask; +protected: + BitSet hideMask; + +private: + RefToken nextMonitoredToken; + +protected: + /** track tail of hidden list emanating from previous + * monitored token + */ + RefToken lastHiddenToken; + + RefToken firstHidden; // = null; + +public: + TokenStreamHiddenTokenFilter(TokenStream& input); + +protected: + void consume(); + +private: + void consumeFirst(); + +public: + BitSet getDiscardMask() const; + + /** Return a ptr to the hidden token appearing immediately after + * token t in the input stream. + */ + RefToken getHiddenAfter(RefToken t); + + /** Return a ptr to the hidden token appearing immediately before + * token t in the input stream. + */ + RefToken getHiddenBefore(RefToken t); + + BitSet getHideMask() const; + + /** Return the first hidden token if one appears + * before any monitored token. + */ + RefToken getInitialHiddenToken(); + + void hide(int m); + + void hide(const BitSet& mask); + +protected: + RefToken LA(int i); + +public: +/** Return the next monitored token. + * Test the token following the monitored token. + * If following is another monitored token, save it + * for the next invocation of nextToken (like a single + * lookahead token) and return it then. + * If following is unmonitored, nondiscarded (hidden) + * channel token, add it to the monitored token. + * + * Note: EOF must be a monitored Token. + */ + RefToken nextToken(); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenStreamHiddenTokenFilter_h__ diff --git a/lib/antlr/antlr/TokenStreamHiddenTokenFilter.hpp b/lib/antlr/antlr/TokenStreamHiddenTokenFilter.hpp deleted file mode 100644 index ed007a7a..00000000 --- a/lib/antlr/antlr/TokenStreamHiddenTokenFilter.hpp +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef INC_TokenStreamHiddenTokenFilter_hpp__ -#define INC_TokenStreamHiddenTokenFilter_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/**This object filters a token stream coming from a lexer - * or another TokenStream so that only certain token channels - * get transmitted to the parser. - * - * Any of the channels can be filtered off as "hidden" channels whose - * tokens can be accessed from the parser. - */ -class ANTLR_API TokenStreamHiddenTokenFilter : public TokenStreamBasicFilter { - // protected BitSet discardMask; -protected: - BitSet hideMask; - -private: - RefToken nextMonitoredToken; - -protected: - /** track tail of hidden list emanating from previous - * monitored token - */ - RefToken lastHiddenToken; - - RefToken firstHidden; // = null; - -public: - TokenStreamHiddenTokenFilter(TokenStream& input); - -protected: - void consume(); - -private: - void consumeFirst(); - -public: - BitSet getDiscardMask() const; - - /** Return a ptr to the hidden token appearing immediately after - * token t in the input stream. - */ - RefToken getHiddenAfter(RefToken t); - - /** Return a ptr to the hidden token appearing immediately before - * token t in the input stream. - */ - RefToken getHiddenBefore(RefToken t); - - BitSet getHideMask() const; - - /** Return the first hidden token if one appears - * before any monitored token. - */ - RefToken getInitialHiddenToken(); - - void hide(int m); - - void hide(const BitSet& mask); - -protected: - RefToken LA(int i); - -public: -/** Return the next monitored token. - * Test the token following the monitored token. - * If following is another monitored token, save it - * for the next invocation of nextToken (like a single - * lookahead token) and return it then. - * If following is unmonitored, nondiscarded (hidden) - * channel token, add it to the monitored token. - * - * Note: EOF must be a monitored Token. - */ - RefToken nextToken(); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamHiddenTokenFilter_hpp__ diff --git a/lib/antlr/antlr/TokenStreamIOException.h b/lib/antlr/antlr/TokenStreamIOException.h new file mode 100644 index 00000000..db2d8677 --- /dev/null +++ b/lib/antlr/antlr/TokenStreamIOException.h @@ -0,0 +1,40 @@ +#ifndef INC_TokenStreamIOException_h__ +#define INC_TokenStreamIOException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class TokenStreamIOException : public TokenStreamException { +public: + TokenStreamIOException() + : TokenStreamException() + { + } + TokenStreamIOException(const ANTLR_USE_NAMESPACE(std)exception& e) + : TokenStreamException(e.what()) + , io(e) + { + } + ~TokenStreamIOException() throw() + { + } +private: + ANTLR_USE_NAMESPACE(std)exception io; +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenStreamIOException_h__ diff --git a/lib/antlr/antlr/TokenStreamIOException.hpp b/lib/antlr/antlr/TokenStreamIOException.hpp deleted file mode 100644 index fff72ced..00000000 --- a/lib/antlr/antlr/TokenStreamIOException.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef INC_TokenStreamIOException_hpp__ -#define INC_TokenStreamIOException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class TokenStreamIOException : public TokenStreamException { -public: - TokenStreamIOException() - : TokenStreamException() - { - } - TokenStreamIOException(const ANTLR_USE_NAMESPACE(std)exception& e) - : TokenStreamException(e.what()) - , io(e) - { - } - ~TokenStreamIOException() throw() - { - } -private: - ANTLR_USE_NAMESPACE(std)exception io; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamIOException_hpp__ diff --git a/lib/antlr/antlr/TokenStreamRecognitionException.h b/lib/antlr/antlr/TokenStreamRecognitionException.h new file mode 100644 index 00000000..2c4b9548 --- /dev/null +++ b/lib/antlr/antlr/TokenStreamRecognitionException.h @@ -0,0 +1,57 @@ +#ifndef INC_TokenStreamRecognitionException_h__ +#define INC_TokenStreamRecognitionException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** Exception thrown from generated lexers when there's no default error + * handler specified. + * @see TokenStream + */ +class TokenStreamRecognitionException : public TokenStreamException { +public: + TokenStreamRecognitionException(RecognitionException& re) + : TokenStreamException(re.getMessage()) + , recog(re) + { + } + virtual ~TokenStreamRecognitionException() throw() + { + } + virtual ANTLR_USE_NAMESPACE(std)string toString() const + { + return recog.getFileLineColumnString()+getMessage(); + } + + virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() + { + return recog.getFilename(); + } + virtual int getLine() const throw() + { + return recog.getLine(); + } + virtual int getColumn() const throw() + { + return recog.getColumn(); + } +private: + RecognitionException recog; +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenStreamRecognitionException_h__ diff --git a/lib/antlr/antlr/TokenStreamRecognitionException.hpp b/lib/antlr/antlr/TokenStreamRecognitionException.hpp deleted file mode 100644 index 687d7814..00000000 --- a/lib/antlr/antlr/TokenStreamRecognitionException.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef INC_TokenStreamRecognitionException_hpp__ -#define INC_TokenStreamRecognitionException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** Exception thrown from generated lexers when there's no default error - * handler specified. - * @see TokenStream - */ -class TokenStreamRecognitionException : public TokenStreamException { -public: - TokenStreamRecognitionException(RecognitionException& re) - : TokenStreamException(re.getMessage()) - , recog(re) - { - } - virtual ~TokenStreamRecognitionException() throw() - { - } - virtual ANTLR_USE_NAMESPACE(std)string toString() const - { - return recog.getFileLineColumnString()+getMessage(); - } - - virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() - { - return recog.getFilename(); - } - virtual int getLine() const throw() - { - return recog.getLine(); - } - virtual int getColumn() const throw() - { - return recog.getColumn(); - } -private: - RecognitionException recog; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamRecognitionException_hpp__ diff --git a/lib/antlr/antlr/TokenStreamRetryException.h b/lib/antlr/antlr/TokenStreamRetryException.h new file mode 100644 index 00000000..bb3dcf2d --- /dev/null +++ b/lib/antlr/antlr/TokenStreamRetryException.h @@ -0,0 +1,28 @@ +#ifndef INC_TokenStreamRetryException_h__ +#define INC_TokenStreamRetryException_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class TokenStreamRetryException : public TokenStreamException { +public: + TokenStreamRetryException() {} + ~TokenStreamRetryException() throw() {} +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenStreamRetryException_h__ diff --git a/lib/antlr/antlr/TokenStreamRetryException.hpp b/lib/antlr/antlr/TokenStreamRetryException.hpp deleted file mode 100644 index 5af21cde..00000000 --- a/lib/antlr/antlr/TokenStreamRetryException.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef INC_TokenStreamRetryException_hpp__ -#define INC_TokenStreamRetryException_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class TokenStreamRetryException : public TokenStreamException { -public: - TokenStreamRetryException() {} - ~TokenStreamRetryException() throw() {} -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamRetryException_hpp__ diff --git a/lib/antlr/antlr/TokenStreamRewriteEngine.h b/lib/antlr/antlr/TokenStreamRewriteEngine.h new file mode 100644 index 00000000..20f3e8f4 --- /dev/null +++ b/lib/antlr/antlr/TokenStreamRewriteEngine.h @@ -0,0 +1,439 @@ +#ifndef INC_TokenStreamRewriteEngine_h__ +#define INC_TokenStreamRewriteEngine_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** This token stream tracks the *entire* token stream coming from + * a lexer, but does not pass on the whitespace (or whatever else + * you want to discard) to the parser. + * + * This class can then be asked for the ith token in the input stream. + * Useful for dumping out the input stream exactly after doing some + * augmentation or other manipulations. Tokens are index from 0..n-1 + * + * You can insert stuff, replace, and delete chunks. Note that the + * operations are done lazily--only if you convert the buffer to a + * String. This is very efficient because you are not moving data around + * all the time. As the buffer of tokens is converted to strings, the + * toString() method(s) check to see if there is an operation at the + * current index. If so, the operation is done and then normal String + * rendering continues on the buffer. This is like having multiple Turing + * machine instruction streams (programs) operating on a single input tape. :) + * + * Since the operations are done lazily at toString-time, operations do not + * screw up the token index values. That is, an insert operation at token + * index i does not change the index values for tokens i+1..n-1. + * + * Because operations never actually alter the buffer, you may always get + * the original token stream back without undoing anything. Since + * the instructions are queued up, you can easily simulate transactions and + * roll back any changes if there is an error just by removing instructions. + * For example, + * + * TokenStreamRewriteEngine rewriteEngine = + * new TokenStreamRewriteEngine(lexer); + * JavaRecognizer parser = new JavaRecognizer(rewriteEngine); + * ... + * rewriteEngine.insertAfter("pass1", t, "foobar");} + * rewriteEngine.insertAfter("pass2", u, "start");} + * System.out.println(rewriteEngine.toString("pass1")); + * System.out.println(rewriteEngine.toString("pass2")); + * + * You can also have multiple "instruction streams" and get multiple + * rewrites from a single pass over the input. Just name the instruction + * streams and use that name again when printing the buffer. This could be + * useful for generating a C file and also its header file--all from the + * same buffer. + * + * If you don't use named rewrite streams, a "default" stream is used. + * + * Terence Parr, parrt@cs.usfca.edu + * University of San Francisco + * February 2004 + */ +class TokenStreamRewriteEngine : public TokenStream +{ +public: + typedef ANTLR_USE_NAMESPACE(std)vector token_list; + static const char* DEFAULT_PROGRAM_NAME; +#ifndef NO_STATIC_CONSTS + static const size_t MIN_TOKEN_INDEX; + static const int PROGRAM_INIT_SIZE; +#else + enum { + MIN_TOKEN_INDEX = 0, + PROGRAM_INIT_SIZE = 100 + }; +#endif + + struct tokenToStream { + tokenToStream( ANTLR_USE_NAMESPACE(std)ostream& o ) : out(o) {} + template void operator() ( const T& t ) { + out << t->getText(); + } + ANTLR_USE_NAMESPACE(std)ostream& out; + }; + + class RewriteOperation { + protected: + RewriteOperation( size_t idx, const ANTLR_USE_NAMESPACE(std)string& txt ) + : index(idx), text(txt) + { + } + public: + virtual ~RewriteOperation() + { + } + /** Execute the rewrite operation by possibly adding to the buffer. + * Return the index of the next token to operate on. + */ + virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& /* out */ ) { + return index; + } + virtual size_t getIndex() const { + return index; + } + virtual const char* type() const { + return "RewriteOperation"; + } + protected: + size_t index; + ANTLR_USE_NAMESPACE(std)string text; + }; + + struct executeOperation { + ANTLR_USE_NAMESPACE(std)ostream& out; + executeOperation( ANTLR_USE_NAMESPACE(std)ostream& s ) : out(s) {} + void operator () ( RewriteOperation* t ) { + t->execute(out); + } + }; + + /// list of rewrite operations + typedef ANTLR_USE_NAMESPACE(std)list operation_list; + /// map program name to tuple + typedef ANTLR_USE_NAMESPACE(std)map program_map; + + class InsertBeforeOp : public RewriteOperation + { + public: + InsertBeforeOp( size_t index, const ANTLR_USE_NAMESPACE(std)string& text ) + : RewriteOperation(index, text) + { + } + virtual ~InsertBeforeOp() {} + virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& out ) + { + out << text; + return index; + } + virtual const char* type() const { + return "InsertBeforeOp"; + } + }; + + class ReplaceOp : public RewriteOperation + { + public: + ReplaceOp(size_t from, size_t to, ANTLR_USE_NAMESPACE(std)string text) + : RewriteOperation(from,text) + , lastIndex(to) + { + } + virtual ~ReplaceOp() {} + virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& out ) { + out << text; + return lastIndex+1; + } + virtual const char* type() const { + return "ReplaceOp"; + } + protected: + size_t lastIndex; + }; + + class DeleteOp : public ReplaceOp { + public: + DeleteOp(size_t from, size_t to) + : ReplaceOp(from,to,"") + { + } + virtual const char* type() const { + return "DeleteOp"; + } + }; + + TokenStreamRewriteEngine(TokenStream& upstream); + + TokenStreamRewriteEngine(TokenStream& upstream, size_t initialSize); + + RefToken nextToken( void ); + + void rollback(size_t instructionIndex) { + rollback(DEFAULT_PROGRAM_NAME, instructionIndex); + } + + /** Rollback the instruction stream for a program so that + * the indicated instruction (via instructionIndex) is no + * longer in the stream. UNTESTED! + */ + void rollback(const ANTLR_USE_NAMESPACE(std)string& programName, + size_t instructionIndex ); + + void deleteProgram() { + deleteProgram(DEFAULT_PROGRAM_NAME); + } + + /** Reset the program so that no instructions exist */ + void deleteProgram(const ANTLR_USE_NAMESPACE(std)string& programName) { + rollback(programName, MIN_TOKEN_INDEX); + } + + void insertAfter( RefTokenWithIndex t, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + insertAfter(DEFAULT_PROGRAM_NAME, t, text); + } + + void insertAfter(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) { + insertAfter(DEFAULT_PROGRAM_NAME, index, text); + } + + void insertAfter( const ANTLR_USE_NAMESPACE(std)string& programName, + RefTokenWithIndex t, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + insertAfter(programName, t->getIndex(), text); + } + + void insertAfter( const ANTLR_USE_NAMESPACE(std)string& programName, + size_t index, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + // to insert after, just insert before next index (even if past end) + insertBefore(programName,index+1, text); + } + + void insertBefore( RefTokenWithIndex t, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + // std::cout << "insertBefore index " << t->getIndex() << " " << text << std::endl; + insertBefore(DEFAULT_PROGRAM_NAME, t, text); + } + + void insertBefore(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) { + insertBefore(DEFAULT_PROGRAM_NAME, index, text); + } + + void insertBefore( const ANTLR_USE_NAMESPACE(std)string& programName, + RefTokenWithIndex t, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + insertBefore(programName, t->getIndex(), text); + } + + void insertBefore( const ANTLR_USE_NAMESPACE(std)string& programName, + size_t index, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + addToSortedRewriteList(programName, new InsertBeforeOp(index,text)); + } + + void replace(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) + { + replace(DEFAULT_PROGRAM_NAME, index, index, text); + } + + void replace( size_t from, size_t to, + const ANTLR_USE_NAMESPACE(std)string& text) + { + replace(DEFAULT_PROGRAM_NAME, from, to, text); + } + + void replace( RefTokenWithIndex indexT, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + replace(DEFAULT_PROGRAM_NAME, indexT->getIndex(), indexT->getIndex(), text); + } + + void replace( RefTokenWithIndex from, + RefTokenWithIndex to, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + replace(DEFAULT_PROGRAM_NAME, from, to, text); + } + + void replace(const ANTLR_USE_NAMESPACE(std)string& programName, + size_t from, size_t to, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + addToSortedRewriteList(programName,new ReplaceOp(from, to, text)); + } + + void replace( const ANTLR_USE_NAMESPACE(std)string& programName, + RefTokenWithIndex from, + RefTokenWithIndex to, + const ANTLR_USE_NAMESPACE(std)string& text ) + { + replace(programName, + from->getIndex(), + to->getIndex(), + text); + } + + void remove(size_t index) { + remove(DEFAULT_PROGRAM_NAME, index, index); + } + + void remove(size_t from, size_t to) { + remove(DEFAULT_PROGRAM_NAME, from, to); + } + + void remove(RefTokenWithIndex indexT) { + remove(DEFAULT_PROGRAM_NAME, indexT, indexT); + } + + void remove(RefTokenWithIndex from, RefTokenWithIndex to) { + remove(DEFAULT_PROGRAM_NAME, from, to); + } + + void remove( const ANTLR_USE_NAMESPACE(std)string& programName, + size_t from, size_t to) + { + replace(programName,from,to,""); + } + + void remove( const ANTLR_USE_NAMESPACE(std)string& programName, + RefTokenWithIndex from, RefTokenWithIndex to ) + { + replace(programName,from,to,""); + } + + void discard(int ttype) { + discardMask.add(ttype); + } + + RefToken getToken( size_t i ) + { + return RefToken(tokens.at(i)); + } + + size_t getTokenStreamSize() const { + return tokens.size(); + } + + void originalToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { + ANTLR_USE_NAMESPACE(std)for_each( tokens.begin(), tokens.end(), tokenToStream(out) ); + } + + void originalToStream( ANTLR_USE_NAMESPACE(std)ostream& out, + size_t start, size_t end ) const; + + void toStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { + toStream( out, MIN_TOKEN_INDEX, getTokenStreamSize()); + } + + void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, + const ANTLR_USE_NAMESPACE(std)string& programName ) const + { + toStream( out, programName, MIN_TOKEN_INDEX, getTokenStreamSize()); + } + + void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, + size_t start, size_t end ) const + { + toStream(out, DEFAULT_PROGRAM_NAME, start, end); + } + + void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, + const ANTLR_USE_NAMESPACE(std)string& programName, + size_t firstToken, size_t lastToken ) const; + + void toDebugStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { + toDebugStream( out, MIN_TOKEN_INDEX, getTokenStreamSize()); + } + + void toDebugStream( ANTLR_USE_NAMESPACE(std)ostream& out, + size_t start, size_t end ) const; + + size_t getLastRewriteTokenIndex() const { + return getLastRewriteTokenIndex(DEFAULT_PROGRAM_NAME); + } + + /** Return the last index for the program named programName + * return 0 if the program does not exist or the program is empty. + * (Note this is different from the java implementation that returns -1) + */ + size_t getLastRewriteTokenIndex(const ANTLR_USE_NAMESPACE(std)string& programName) const { + program_map::const_iterator rewrites = programs.find(programName); + + if( rewrites == programs.end() ) + return 0; + + const operation_list& prog = rewrites->second; + if( !prog.empty() ) + { + operation_list::const_iterator last = prog.end(); + --last; + return (*last)->getIndex(); + } + return 0; + } + +protected: + /** If op.index > lastRewriteTokenIndexes, just add to the end. + * Otherwise, do linear */ + void addToSortedRewriteList(RewriteOperation* op) { + addToSortedRewriteList(DEFAULT_PROGRAM_NAME, op); + } + + void addToSortedRewriteList( const ANTLR_USE_NAMESPACE(std)string& programName, + RewriteOperation* op ); + +protected: + /** Who do we suck tokens from? */ + TokenStream& stream; + /** track index of tokens */ + size_t index; + + /** Track the incoming list of tokens */ + token_list tokens; + + /** You may have multiple, named streams of rewrite operations. + * I'm calling these things "programs." + * Maps String (name) -> rewrite (List) + */ + program_map programs; + + /** Which (whitespace) token(s) to throw out */ + BitSet discardMask; +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif diff --git a/lib/antlr/antlr/TokenStreamRewriteEngine.hpp b/lib/antlr/antlr/TokenStreamRewriteEngine.hpp deleted file mode 100644 index 9fab08c2..00000000 --- a/lib/antlr/antlr/TokenStreamRewriteEngine.hpp +++ /dev/null @@ -1,439 +0,0 @@ -#ifndef INC_TokenStreamRewriteEngine_hpp__ -#define INC_TokenStreamRewriteEngine_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This token stream tracks the *entire* token stream coming from - * a lexer, but does not pass on the whitespace (or whatever else - * you want to discard) to the parser. - * - * This class can then be asked for the ith token in the input stream. - * Useful for dumping out the input stream exactly after doing some - * augmentation or other manipulations. Tokens are index from 0..n-1 - * - * You can insert stuff, replace, and delete chunks. Note that the - * operations are done lazily--only if you convert the buffer to a - * String. This is very efficient because you are not moving data around - * all the time. As the buffer of tokens is converted to strings, the - * toString() method(s) check to see if there is an operation at the - * current index. If so, the operation is done and then normal String - * rendering continues on the buffer. This is like having multiple Turing - * machine instruction streams (programs) operating on a single input tape. :) - * - * Since the operations are done lazily at toString-time, operations do not - * screw up the token index values. That is, an insert operation at token - * index i does not change the index values for tokens i+1..n-1. - * - * Because operations never actually alter the buffer, you may always get - * the original token stream back without undoing anything. Since - * the instructions are queued up, you can easily simulate transactions and - * roll back any changes if there is an error just by removing instructions. - * For example, - * - * TokenStreamRewriteEngine rewriteEngine = - * new TokenStreamRewriteEngine(lexer); - * JavaRecognizer parser = new JavaRecognizer(rewriteEngine); - * ... - * rewriteEngine.insertAfter("pass1", t, "foobar");} - * rewriteEngine.insertAfter("pass2", u, "start");} - * System.out.println(rewriteEngine.toString("pass1")); - * System.out.println(rewriteEngine.toString("pass2")); - * - * You can also have multiple "instruction streams" and get multiple - * rewrites from a single pass over the input. Just name the instruction - * streams and use that name again when printing the buffer. This could be - * useful for generating a C file and also its header file--all from the - * same buffer. - * - * If you don't use named rewrite streams, a "default" stream is used. - * - * Terence Parr, parrt@cs.usfca.edu - * University of San Francisco - * February 2004 - */ -class TokenStreamRewriteEngine : public TokenStream -{ -public: - typedef ANTLR_USE_NAMESPACE(std)vector token_list; - static const char* DEFAULT_PROGRAM_NAME; -#ifndef NO_STATIC_CONSTS - static const size_t MIN_TOKEN_INDEX; - static const int PROGRAM_INIT_SIZE; -#else - enum { - MIN_TOKEN_INDEX = 0, - PROGRAM_INIT_SIZE = 100 - }; -#endif - - struct tokenToStream { - tokenToStream( ANTLR_USE_NAMESPACE(std)ostream& o ) : out(o) {} - template void operator() ( const T& t ) { - out << t->getText(); - } - ANTLR_USE_NAMESPACE(std)ostream& out; - }; - - class RewriteOperation { - protected: - RewriteOperation( size_t idx, const ANTLR_USE_NAMESPACE(std)string& txt ) - : index(idx), text(txt) - { - } - public: - virtual ~RewriteOperation() - { - } - /** Execute the rewrite operation by possibly adding to the buffer. - * Return the index of the next token to operate on. - */ - virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& /* out */ ) { - return index; - } - virtual size_t getIndex() const { - return index; - } - virtual const char* type() const { - return "RewriteOperation"; - } - protected: - size_t index; - ANTLR_USE_NAMESPACE(std)string text; - }; - - struct executeOperation { - ANTLR_USE_NAMESPACE(std)ostream& out; - executeOperation( ANTLR_USE_NAMESPACE(std)ostream& s ) : out(s) {} - void operator () ( RewriteOperation* t ) { - t->execute(out); - } - }; - - /// list of rewrite operations - typedef ANTLR_USE_NAMESPACE(std)list operation_list; - /// map program name to tuple - typedef ANTLR_USE_NAMESPACE(std)map program_map; - - class InsertBeforeOp : public RewriteOperation - { - public: - InsertBeforeOp( size_t index, const ANTLR_USE_NAMESPACE(std)string& text ) - : RewriteOperation(index, text) - { - } - virtual ~InsertBeforeOp() {} - virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& out ) - { - out << text; - return index; - } - virtual const char* type() const { - return "InsertBeforeOp"; - } - }; - - class ReplaceOp : public RewriteOperation - { - public: - ReplaceOp(size_t from, size_t to, ANTLR_USE_NAMESPACE(std)string text) - : RewriteOperation(from,text) - , lastIndex(to) - { - } - virtual ~ReplaceOp() {} - virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& out ) { - out << text; - return lastIndex+1; - } - virtual const char* type() const { - return "ReplaceOp"; - } - protected: - size_t lastIndex; - }; - - class DeleteOp : public ReplaceOp { - public: - DeleteOp(size_t from, size_t to) - : ReplaceOp(from,to,"") - { - } - virtual const char* type() const { - return "DeleteOp"; - } - }; - - TokenStreamRewriteEngine(TokenStream& upstream); - - TokenStreamRewriteEngine(TokenStream& upstream, size_t initialSize); - - RefToken nextToken( void ); - - void rollback(size_t instructionIndex) { - rollback(DEFAULT_PROGRAM_NAME, instructionIndex); - } - - /** Rollback the instruction stream for a program so that - * the indicated instruction (via instructionIndex) is no - * longer in the stream. UNTESTED! - */ - void rollback(const ANTLR_USE_NAMESPACE(std)string& programName, - size_t instructionIndex ); - - void deleteProgram() { - deleteProgram(DEFAULT_PROGRAM_NAME); - } - - /** Reset the program so that no instructions exist */ - void deleteProgram(const ANTLR_USE_NAMESPACE(std)string& programName) { - rollback(programName, MIN_TOKEN_INDEX); - } - - void insertAfter( RefTokenWithIndex t, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - insertAfter(DEFAULT_PROGRAM_NAME, t, text); - } - - void insertAfter(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) { - insertAfter(DEFAULT_PROGRAM_NAME, index, text); - } - - void insertAfter( const ANTLR_USE_NAMESPACE(std)string& programName, - RefTokenWithIndex t, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - insertAfter(programName, t->getIndex(), text); - } - - void insertAfter( const ANTLR_USE_NAMESPACE(std)string& programName, - size_t index, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - // to insert after, just insert before next index (even if past end) - insertBefore(programName,index+1, text); - } - - void insertBefore( RefTokenWithIndex t, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - // std::cout << "insertBefore index " << t->getIndex() << " " << text << std::endl; - insertBefore(DEFAULT_PROGRAM_NAME, t, text); - } - - void insertBefore(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) { - insertBefore(DEFAULT_PROGRAM_NAME, index, text); - } - - void insertBefore( const ANTLR_USE_NAMESPACE(std)string& programName, - RefTokenWithIndex t, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - insertBefore(programName, t->getIndex(), text); - } - - void insertBefore( const ANTLR_USE_NAMESPACE(std)string& programName, - size_t index, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - addToSortedRewriteList(programName, new InsertBeforeOp(index,text)); - } - - void replace(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) - { - replace(DEFAULT_PROGRAM_NAME, index, index, text); - } - - void replace( size_t from, size_t to, - const ANTLR_USE_NAMESPACE(std)string& text) - { - replace(DEFAULT_PROGRAM_NAME, from, to, text); - } - - void replace( RefTokenWithIndex indexT, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - replace(DEFAULT_PROGRAM_NAME, indexT->getIndex(), indexT->getIndex(), text); - } - - void replace( RefTokenWithIndex from, - RefTokenWithIndex to, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - replace(DEFAULT_PROGRAM_NAME, from, to, text); - } - - void replace(const ANTLR_USE_NAMESPACE(std)string& programName, - size_t from, size_t to, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - addToSortedRewriteList(programName,new ReplaceOp(from, to, text)); - } - - void replace( const ANTLR_USE_NAMESPACE(std)string& programName, - RefTokenWithIndex from, - RefTokenWithIndex to, - const ANTLR_USE_NAMESPACE(std)string& text ) - { - replace(programName, - from->getIndex(), - to->getIndex(), - text); - } - - void remove(size_t index) { - remove(DEFAULT_PROGRAM_NAME, index, index); - } - - void remove(size_t from, size_t to) { - remove(DEFAULT_PROGRAM_NAME, from, to); - } - - void remove(RefTokenWithIndex indexT) { - remove(DEFAULT_PROGRAM_NAME, indexT, indexT); - } - - void remove(RefTokenWithIndex from, RefTokenWithIndex to) { - remove(DEFAULT_PROGRAM_NAME, from, to); - } - - void remove( const ANTLR_USE_NAMESPACE(std)string& programName, - size_t from, size_t to) - { - replace(programName,from,to,""); - } - - void remove( const ANTLR_USE_NAMESPACE(std)string& programName, - RefTokenWithIndex from, RefTokenWithIndex to ) - { - replace(programName,from,to,""); - } - - void discard(int ttype) { - discardMask.add(ttype); - } - - RefToken getToken( size_t i ) - { - return RefToken(tokens.at(i)); - } - - size_t getTokenStreamSize() const { - return tokens.size(); - } - - void originalToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { - ANTLR_USE_NAMESPACE(std)for_each( tokens.begin(), tokens.end(), tokenToStream(out) ); - } - - void originalToStream( ANTLR_USE_NAMESPACE(std)ostream& out, - size_t start, size_t end ) const; - - void toStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { - toStream( out, MIN_TOKEN_INDEX, getTokenStreamSize()); - } - - void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, - const ANTLR_USE_NAMESPACE(std)string& programName ) const - { - toStream( out, programName, MIN_TOKEN_INDEX, getTokenStreamSize()); - } - - void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, - size_t start, size_t end ) const - { - toStream(out, DEFAULT_PROGRAM_NAME, start, end); - } - - void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, - const ANTLR_USE_NAMESPACE(std)string& programName, - size_t firstToken, size_t lastToken ) const; - - void toDebugStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { - toDebugStream( out, MIN_TOKEN_INDEX, getTokenStreamSize()); - } - - void toDebugStream( ANTLR_USE_NAMESPACE(std)ostream& out, - size_t start, size_t end ) const; - - size_t getLastRewriteTokenIndex() const { - return getLastRewriteTokenIndex(DEFAULT_PROGRAM_NAME); - } - - /** Return the last index for the program named programName - * return 0 if the program does not exist or the program is empty. - * (Note this is different from the java implementation that returns -1) - */ - size_t getLastRewriteTokenIndex(const ANTLR_USE_NAMESPACE(std)string& programName) const { - program_map::const_iterator rewrites = programs.find(programName); - - if( rewrites == programs.end() ) - return 0; - - const operation_list& prog = rewrites->second; - if( !prog.empty() ) - { - operation_list::const_iterator last = prog.end(); - --last; - return (*last)->getIndex(); - } - return 0; - } - -protected: - /** If op.index > lastRewriteTokenIndexes, just add to the end. - * Otherwise, do linear */ - void addToSortedRewriteList(RewriteOperation* op) { - addToSortedRewriteList(DEFAULT_PROGRAM_NAME, op); - } - - void addToSortedRewriteList( const ANTLR_USE_NAMESPACE(std)string& programName, - RewriteOperation* op ); - -protected: - /** Who do we suck tokens from? */ - TokenStream& stream; - /** track index of tokens */ - size_t index; - - /** Track the incoming list of tokens */ - token_list tokens; - - /** You may have multiple, named streams of rewrite operations. - * I'm calling these things "programs." - * Maps String (name) -> rewrite (List) - */ - program_map programs; - - /** Which (whitespace) token(s) to throw out */ - BitSet discardMask; -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif diff --git a/lib/antlr/antlr/TokenStreamSelector.h b/lib/antlr/antlr/TokenStreamSelector.h new file mode 100644 index 00000000..2ed91d72 --- /dev/null +++ b/lib/antlr/antlr/TokenStreamSelector.h @@ -0,0 +1,87 @@ +#ifndef INC_TokenStreamSelector_h__ +#define INC_TokenStreamSelector_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** A token stream MUX (multiplexor) knows about n token streams + * and can multiplex them onto the same channel for use by token + * stream consumer like a parser. This is a way to have multiple + * lexers break up the same input stream for a single parser. + * Or, you can have multiple instances of the same lexer handle + * multiple input streams; this works great for includes. + */ +class ANTLR_API TokenStreamSelector : public TokenStream { +protected: + /** The set of inputs to the MUX */ +#ifdef OS_NO_ALLOCATOR + typedef ANTLR_USE_NAMESPACE(std)less lessp; + typedef ANTLR_USE_NAMESPACE(std)map inputStreamNames_coll; +#else + typedef ANTLR_USE_NAMESPACE(std)map inputStreamNames_coll; +#endif + inputStreamNames_coll inputStreamNames; + + /** The currently-selected token stream input */ + TokenStream* input; + + /** Used to track stack of input streams */ +#ifdef OS_NO_ALLOCATOR + typedef ANTLR_USE_NAMESPACE(std)stack > streamStack_coll; +#else + typedef ANTLR_USE_NAMESPACE(std)stack streamStack_coll; +#endif + streamStack_coll streamStack; + +public: + TokenStreamSelector(); + ~TokenStreamSelector(); + + void addInputStream(TokenStream* stream, const ANTLR_USE_NAMESPACE(std)string& key); + + /// Return the stream from which tokens are being pulled at the moment. + TokenStream* getCurrentStream() const; + + TokenStream* getStream(const ANTLR_USE_NAMESPACE(std)string& sname) const; + + RefToken nextToken(); + + TokenStream* pop(); + + void push(TokenStream* stream); + + void push(const ANTLR_USE_NAMESPACE(std)string& sname); + + /** Abort recognition of current Token and try again. + * A stream can push a new stream (for include files + * for example, and then retry(), which will cause + * the current stream to abort back to this.nextToken(). + * this.nextToken() then asks for a token from the + * current stream, which is the new "substream." + */ + void retry(); + + /** Set the stream without pushing old stream */ + void select(TokenStream* stream); + + void select(const ANTLR_USE_NAMESPACE(std)string& sname); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TokenStreamSelector_h__ diff --git a/lib/antlr/antlr/TokenStreamSelector.hpp b/lib/antlr/antlr/TokenStreamSelector.hpp deleted file mode 100644 index 1dab8797..00000000 --- a/lib/antlr/antlr/TokenStreamSelector.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef INC_TokenStreamSelector_hpp__ -#define INC_TokenStreamSelector_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** A token stream MUX (multiplexor) knows about n token streams - * and can multiplex them onto the same channel for use by token - * stream consumer like a parser. This is a way to have multiple - * lexers break up the same input stream for a single parser. - * Or, you can have multiple instances of the same lexer handle - * multiple input streams; this works great for includes. - */ -class ANTLR_API TokenStreamSelector : public TokenStream { -protected: - /** The set of inputs to the MUX */ -#ifdef OS_NO_ALLOCATOR - typedef ANTLR_USE_NAMESPACE(std)less lessp; - typedef ANTLR_USE_NAMESPACE(std)map inputStreamNames_coll; -#else - typedef ANTLR_USE_NAMESPACE(std)map inputStreamNames_coll; -#endif - inputStreamNames_coll inputStreamNames; - - /** The currently-selected token stream input */ - TokenStream* input; - - /** Used to track stack of input streams */ -#ifdef OS_NO_ALLOCATOR - typedef ANTLR_USE_NAMESPACE(std)stack > streamStack_coll; -#else - typedef ANTLR_USE_NAMESPACE(std)stack streamStack_coll; -#endif - streamStack_coll streamStack; - -public: - TokenStreamSelector(); - ~TokenStreamSelector(); - - void addInputStream(TokenStream* stream, const ANTLR_USE_NAMESPACE(std)string& key); - - /// Return the stream from which tokens are being pulled at the moment. - TokenStream* getCurrentStream() const; - - TokenStream* getStream(const ANTLR_USE_NAMESPACE(std)string& sname) const; - - RefToken nextToken(); - - TokenStream* pop(); - - void push(TokenStream* stream); - - void push(const ANTLR_USE_NAMESPACE(std)string& sname); - - /** Abort recognition of current Token and try again. - * A stream can push a new stream (for include files - * for example, and then retry(), which will cause - * the current stream to abort back to this.nextToken(). - * this.nextToken() then asks for a token from the - * current stream, which is the new "substream." - */ - void retry(); - - /** Set the stream without pushing old stream */ - void select(TokenStream* stream); - - void select(const ANTLR_USE_NAMESPACE(std)string& sname); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TokenStreamSelector_hpp__ diff --git a/lib/antlr/antlr/TokenWithIndex.h b/lib/antlr/antlr/TokenWithIndex.h new file mode 100644 index 00000000..d7511996 --- /dev/null +++ b/lib/antlr/antlr/TokenWithIndex.h @@ -0,0 +1,84 @@ +#ifndef INC_TokenWithIndex_h__ +#define INC_TokenWithIndex_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id:$ + */ + +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API TokenWithIndex : public ANTLR_USE_NAMESPACE(antlr)CommonToken { +public: + // static size_t count; + TokenWithIndex() : CommonToken(), index(0) + { + // std::cout << __PRETTY_FUNCTION__ << std::endl; + // count++; + } + TokenWithIndex(int t, const ANTLR_USE_NAMESPACE(std)string& txt) + : CommonToken(t,txt) + , index(0) + { + // std::cout << __PRETTY_FUNCTION__ << std::endl; + // count++; + } + TokenWithIndex(const ANTLR_USE_NAMESPACE(std)string& s) + : CommonToken(s) + , index(0) + { + // std::cout << __PRETTY_FUNCTION__ << std::endl; + // count++; + } + ~TokenWithIndex() + { + // count--; + } + void setIndex( size_t idx ) + { + index = idx; + } + size_t getIndex( void ) const + { + return index; + } + + ANTLR_USE_NAMESPACE(std)string toString() const + { + return ANTLR_USE_NAMESPACE(std)string("[")+ + index+ + ":\""+ + getText()+"\",<"+ + getType()+">,line="+ + getLine()+",column="+ + getColumn()+"]"; + } + + static RefToken factory() + { + return RefToken(new TokenWithIndex()); + } + +protected: + size_t index; + +private: + TokenWithIndex(const TokenWithIndex&); + const TokenWithIndex& operator=(const TokenWithIndex&); +}; + +typedef TokenRefCount RefTokenWithIndex; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_CommonToken_h__ diff --git a/lib/antlr/antlr/TokenWithIndex.hpp b/lib/antlr/antlr/TokenWithIndex.hpp deleted file mode 100644 index e4a3e37e..00000000 --- a/lib/antlr/antlr/TokenWithIndex.hpp +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef INC_TokenWithIndex_hpp__ -#define INC_TokenWithIndex_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id:$ - */ - -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API TokenWithIndex : public ANTLR_USE_NAMESPACE(antlr)CommonToken { -public: - // static size_t count; - TokenWithIndex() : CommonToken(), index(0) - { - // std::cout << __PRETTY_FUNCTION__ << std::endl; - // count++; - } - TokenWithIndex(int t, const ANTLR_USE_NAMESPACE(std)string& txt) - : CommonToken(t,txt) - , index(0) - { - // std::cout << __PRETTY_FUNCTION__ << std::endl; - // count++; - } - TokenWithIndex(const ANTLR_USE_NAMESPACE(std)string& s) - : CommonToken(s) - , index(0) - { - // std::cout << __PRETTY_FUNCTION__ << std::endl; - // count++; - } - ~TokenWithIndex() - { - // count--; - } - void setIndex( size_t idx ) - { - index = idx; - } - size_t getIndex( void ) const - { - return index; - } - - ANTLR_USE_NAMESPACE(std)string toString() const - { - return ANTLR_USE_NAMESPACE(std)string("[")+ - index+ - ":\""+ - getText()+"\",<"+ - getType()+">,line="+ - getLine()+",column="+ - getColumn()+"]"; - } - - static RefToken factory() - { - return RefToken(new TokenWithIndex()); - } - -protected: - size_t index; - -private: - TokenWithIndex(const TokenWithIndex&); - const TokenWithIndex& operator=(const TokenWithIndex&); -}; - -typedef TokenRefCount RefTokenWithIndex; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_CommonToken_hpp__ diff --git a/lib/antlr/antlr/TreeParser.h b/lib/antlr/antlr/TreeParser.h new file mode 100644 index 00000000..ab293d49 --- /dev/null +++ b/lib/antlr/antlr/TreeParser.h @@ -0,0 +1,155 @@ +#ifndef INC_TreeParser_h__ +#define INC_TreeParser_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +class ANTLR_API TreeParser { +public: + TreeParser() + : astFactory(0) + , inputState(new TreeParserInputState()) + , traceDepth(0) + { + } + + TreeParser(const TreeParserSharedInputState& state) + : astFactory(0) + , inputState(state) + , traceDepth(0) + { + } + + virtual ~TreeParser() + { + } + + /// Get the AST return value squirreled away in the parser + virtual RefAST getAST() = 0; + + /** Make sure current lookahead symbol matches the given set + * Throw an exception upon mismatch, which is caught by either the + * error handler or by a syntactic predicate. + */ + virtual void match(RefAST t, const BitSet& b) + { + if ( !t || t==ASTNULL || !b.member(t->getType()) ) + throw MismatchedTokenException( getTokenNames(), getNumTokens(), + t, b, false ); + } + + /** Specify the AST factory to be used during tree building. (Compulsory) + * Setting the factory is compulsory (if you intend to modify + * the tree in the treeparser). The AST Factory is shared between + * parser (who builds the initial AST) and treeparser. + * @see Parser::getASTFactory() + */ + virtual void setASTFactory(ASTFactory* factory) + { + astFactory = factory; + } + /// Return pointer to ASTFactory + virtual ASTFactory* getASTFactory() const + { + return astFactory; + } + /// Get the name for token 'num' + virtual const char* getTokenName(int num) const = 0; + /// Return the number of tokens defined + virtual int getNumTokens() const = 0; + /// Return an array of getNumTokens() token names + virtual const char* const* getTokenNames() const = 0; + + /// Parser error-reporting function can be overridden in subclass + virtual void reportError(const RecognitionException& ex); + /// Parser error-reporting function can be overridden in subclass + virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); + /// Parser warning-reporting function can be overridden in subclass + virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); + + /// These are used during when traceTreeParser commandline option is passed. + virtual void traceIndent(); + virtual void traceIn(const char* rname, RefAST t); + virtual void traceOut(const char* rname, RefAST t); + + /** The AST Null object; the parsing cursor is set to this when + * it is found to be null. This way, we can test the + * token type of a node without having to have tests for 0 + * everywhere. + */ + static RefAST ASTNULL; + +protected: + virtual void match(RefAST t, int ttype) + { + if (!t || t == ASTNULL || t->getType() != ttype ) + throw MismatchedTokenException( getTokenNames(), getNumTokens(), + t, ttype, false ); + } + + virtual void matchNot(RefAST t, int ttype) + { + if ( !t || t == ASTNULL || t->getType() == ttype ) + throw MismatchedTokenException( getTokenNames(), getNumTokens(), + t, ttype, true ); + } + + /** AST support code; parser and treeparser delegate to this object */ + ASTFactory* astFactory; + + /// The input state of this tree parser. + TreeParserSharedInputState inputState; + + /** Used to keep track of indent depth with -traceTreeParser */ + int traceDepth; + + /** Utility class which allows tracing to work even when exceptions are + * thrown. + */ + class Tracer { + private: + TreeParser* parser; + const char* text; + RefAST tree; + public: + Tracer(TreeParser* p, const char* t, RefAST a) + : parser(p), text(t), tree(a) + { + parser->traceIn(text,tree); + } + ~Tracer() + { + parser->traceOut(text,tree); + } + private: + Tracer(const Tracer&); // undefined + const Tracer& operator=(const Tracer&); // undefined + }; + +private: + // no copying of treeparser instantiations... + TreeParser(const TreeParser& other); + TreeParser& operator=(const TreeParser& other); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TreeParser_h__ diff --git a/lib/antlr/antlr/TreeParser.hpp b/lib/antlr/antlr/TreeParser.hpp deleted file mode 100644 index aeee3f9d..00000000 --- a/lib/antlr/antlr/TreeParser.hpp +++ /dev/null @@ -1,155 +0,0 @@ -#ifndef INC_TreeParser_hpp__ -#define INC_TreeParser_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -class ANTLR_API TreeParser { -public: - TreeParser() - : astFactory(0) - , inputState(new TreeParserInputState()) - , traceDepth(0) - { - } - - TreeParser(const TreeParserSharedInputState& state) - : astFactory(0) - , inputState(state) - , traceDepth(0) - { - } - - virtual ~TreeParser() - { - } - - /// Get the AST return value squirreled away in the parser - virtual RefAST getAST() = 0; - - /** Make sure current lookahead symbol matches the given set - * Throw an exception upon mismatch, which is caught by either the - * error handler or by a syntactic predicate. - */ - virtual void match(RefAST t, const BitSet& b) - { - if ( !t || t==ASTNULL || !b.member(t->getType()) ) - throw MismatchedTokenException( getTokenNames(), getNumTokens(), - t, b, false ); - } - - /** Specify the AST factory to be used during tree building. (Compulsory) - * Setting the factory is compulsory (if you intend to modify - * the tree in the treeparser). The AST Factory is shared between - * parser (who builds the initial AST) and treeparser. - * @see Parser::getASTFactory() - */ - virtual void setASTFactory(ASTFactory* factory) - { - astFactory = factory; - } - /// Return pointer to ASTFactory - virtual ASTFactory* getASTFactory() const - { - return astFactory; - } - /// Get the name for token 'num' - virtual const char* getTokenName(int num) const = 0; - /// Return the number of tokens defined - virtual int getNumTokens() const = 0; - /// Return an array of getNumTokens() token names - virtual const char* const* getTokenNames() const = 0; - - /// Parser error-reporting function can be overridden in subclass - virtual void reportError(const RecognitionException& ex); - /// Parser error-reporting function can be overridden in subclass - virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); - /// Parser warning-reporting function can be overridden in subclass - virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); - - /// These are used during when traceTreeParser commandline option is passed. - virtual void traceIndent(); - virtual void traceIn(const char* rname, RefAST t); - virtual void traceOut(const char* rname, RefAST t); - - /** The AST Null object; the parsing cursor is set to this when - * it is found to be null. This way, we can test the - * token type of a node without having to have tests for 0 - * everywhere. - */ - static RefAST ASTNULL; - -protected: - virtual void match(RefAST t, int ttype) - { - if (!t || t == ASTNULL || t->getType() != ttype ) - throw MismatchedTokenException( getTokenNames(), getNumTokens(), - t, ttype, false ); - } - - virtual void matchNot(RefAST t, int ttype) - { - if ( !t || t == ASTNULL || t->getType() == ttype ) - throw MismatchedTokenException( getTokenNames(), getNumTokens(), - t, ttype, true ); - } - - /** AST support code; parser and treeparser delegate to this object */ - ASTFactory* astFactory; - - /// The input state of this tree parser. - TreeParserSharedInputState inputState; - - /** Used to keep track of indent depth with -traceTreeParser */ - int traceDepth; - - /** Utility class which allows tracing to work even when exceptions are - * thrown. - */ - class Tracer { - private: - TreeParser* parser; - const char* text; - RefAST tree; - public: - Tracer(TreeParser* p, const char* t, RefAST a) - : parser(p), text(t), tree(a) - { - parser->traceIn(text,tree); - } - ~Tracer() - { - parser->traceOut(text,tree); - } - private: - Tracer(const Tracer&); // undefined - const Tracer& operator=(const Tracer&); // undefined - }; - -private: - // no copying of treeparser instantiations... - TreeParser(const TreeParser& other); - TreeParser& operator=(const TreeParser& other); -}; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TreeParser_hpp__ diff --git a/lib/antlr/antlr/TreeParserSharedInputState.h b/lib/antlr/antlr/TreeParserSharedInputState.h new file mode 100644 index 00000000..3eb95641 --- /dev/null +++ b/lib/antlr/antlr/TreeParserSharedInputState.h @@ -0,0 +1,45 @@ +#ifndef INC_TreeParserSharedInputState_h__ +#define INC_TreeParserSharedInputState_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include +#include + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/** This object contains the data associated with an + * input AST. Multiple parsers + * share a single TreeParserSharedInputState to parse + * the same tree or to have the parser walk multiple + * trees. + */ +class ANTLR_API TreeParserInputState { +public: + TreeParserInputState() : guessing(0) {} + virtual ~TreeParserInputState() {} + +public: + /** Are we guessing (guessing>0)? */ + int guessing; //= 0; + +private: + // we don't want these: + TreeParserInputState(const TreeParserInputState&); + TreeParserInputState& operator=(const TreeParserInputState&); +}; + +typedef RefCount TreeParserSharedInputState; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_TreeParserSharedInputState_h__ diff --git a/lib/antlr/antlr/TreeParserSharedInputState.hpp b/lib/antlr/antlr/TreeParserSharedInputState.hpp deleted file mode 100644 index 76ec6840..00000000 --- a/lib/antlr/antlr/TreeParserSharedInputState.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef INC_TreeParserSharedInputState_hpp__ -#define INC_TreeParserSharedInputState_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -#include -#include - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -namespace antlr { -#endif - -/** This object contains the data associated with an - * input AST. Multiple parsers - * share a single TreeParserSharedInputState to parse - * the same tree or to have the parser walk multiple - * trees. - */ -class ANTLR_API TreeParserInputState { -public: - TreeParserInputState() : guessing(0) {} - virtual ~TreeParserInputState() {} - -public: - /** Are we guessing (guessing>0)? */ - int guessing; //= 0; - -private: - // we don't want these: - TreeParserInputState(const TreeParserInputState&); - TreeParserInputState& operator=(const TreeParserInputState&); -}; - -typedef RefCount TreeParserSharedInputState; - -#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE -} -#endif - -#endif //INC_TreeParserSharedInputState_hpp__ diff --git a/lib/antlr/antlr/config.h b/lib/antlr/antlr/config.h new file mode 100644 index 00000000..4d3456ec --- /dev/null +++ b/lib/antlr/antlr/config.h @@ -0,0 +1,290 @@ +#ifndef INC_config_h__ +#define INC_config_h__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +/* + * Just a simple configuration file to differentiate between the + * various compilers used and reconfigure stuff for any oddities of the + * compiler in question. + * + * These are the defaults. Per compiler these are amended. + */ +#define ANTLR_USE_NAMESPACE(_x_) _x_:: +#define ANTLR_USING_NAMESPACE(_x_) using namespace _x_; +#define ANTLR_CXX_SUPPORTS_NAMESPACE 1 +#define ANTLR_C_USING(_x_) +#define ANTLR_API +#ifndef CUSTOM_API +# define CUSTOM_API +#endif +#define ANTLR_IOS_BASE ios_base +/** define if cctype functions/macros need a std:: prefix. A lot of compilers + * define these as macros, in which case something barfs. + */ +#define ANTLR_CCTYPE_NEEDS_STD + +/// Define if C++ compiler supports std::uncaught_exception +#define ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION + +#define ANTLR_ATOI_IN_STD + +/******************************************************************************/ +/*{{{ Microsoft Visual C++ */ +// NOTE: If you provide patches for a specific MSVC version guard them for +// the specific version!!!! +// _MSC_VER == 1100 for Microsoft Visual C++ 5.0 +// _MSC_VER == 1200 for Microsoft Visual C++ 6.0 +// _MSC_VER == 1300 for Microsoft Visual C++ 7.0 +#if defined(_MSC_VER) + +# if _MSC_VER < 1300 +# define NOMINMAX +# pragma warning(disable : 4786) +# define min _cpp_min +# endif + +// This warning really gets on my nerves. +// It's the one about symbol longer than 256 chars, and it happens +// all the time with STL. +# pragma warning( disable : 4786 4231 ) +// this shuts up some DLL interface warnings for STL +# pragma warning( disable : 4251 ) + +# ifdef ANTLR_CXX_USE_STLPORT +# undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION +# endif + +# if ( _MSC_VER < 1300 ) && ( defined(ANTLR_EXPORTS) || defined(ANTLR_IMPORTS) ) +# error "DLL Build not supported on these MSVC versions." +// see comment in lib/cpp/src/dll.cpp +# endif + +// For the DLL support originally contributed by Stephen Naughton +// If you are building statically leave ANTLR_EXPORTS/ANTLR_IMPORTS undefined +// If you are building the DLL define ANTLR_EXPORTS +// If you are compiling code to be used with the DLL define ANTLR_IMPORTS +# ifdef ANTLR_EXPORTS +# undef ANTLR_API +# define ANTLR_API __declspec(dllexport) +# endif + +# ifdef ANTLR_IMPORTS +# undef ANTLR_API +# define ANTLR_API __declspec(dllimport) +# endif + +# if ( _MSC_VER < 1200 ) +// supposedly only for MSVC5 and before... +// Using vector requires operator<(X,X) to be defined +# define NEEDS_OPERATOR_LESS_THAN +# endif + +// VC6 +# if ( _MSC_VER == 1200 ) +# undef ANTLR_ATOI_IN_STD +# endif + +# if ( _MSC_VER < 1310 ) +// Supposedly only for MSVC7 and before... +// Not allowed to put 'static const int XXX=20;' in a class definition +# define NO_STATIC_CONSTS +# define NO_TEMPLATE_PARTS +# endif + +// No strcasecmp in the C library (so use stricmp instead) +// - Anyone know which is in which standard? +# define NO_STRCASECMP +# undef ANTLR_CCTYPE_NEEDS_STD +# define NO_STATIC_CONSTS +#endif // End of Microsoft Visual C++ + +/*}}}*/ +/******************************************************************************/ +/*{{{ SunPro Compiler (Using OBJECTSPACE STL) + *****************************************************************************/ +#ifdef __SUNPRO_CC + +# if (__SUNPRO_CC >= 0x500) + +# define NEEDS_OPERATOR_LESS_THAN +# define NO_TEMPLATE_PARTS + +# else + +# undef namespace +# define namespace + +# if (__SUNPRO_CC == 0x420) + +/* This code is specif to SunWspro Compiler 4.2, and will compile with + the objectspace 2.1 toolkit for Solaris2.6 */ +# define HAS_NOT_CASSERT_H +# define HAS_NOT_CSTRING_H +# define HAS_NOT_CCTYPE_H +# define HAS_NOT_CSTDIO_H +# define HAS_OSTREAM_H + +/* #define OS_SOLARIS_2_6 + #define OS_NO_WSTRING + #define OS_NO_ALLOCATORS + #define OS_MULTI_THREADED + #define OS_SOLARIS_NATIVE + #define OS_REALTIME + #define __OSVERSION__=5 + #define SVR4 + */ + +// ObjectSpace + some specific templates constructions with stl. +/* #define OS_NO_ALLOCATOR */ + +// This great compiler does not have the namespace feature. +# undef ANTLR_USE_NAMESPACE +# define ANTLR_USE_NAMESPACE(_x_) +# undef ANTLR_USING_NAMESPACE +# define ANTLR_USING_NAMESPACE(_x_) +# undef ANTLR_CXX_SUPPORTS_NAMESPACE +# endif // End __SUNPRO_CC == 0x420 + +# undef explicit +# define explicit + +# define exception os_exception +# define bad_exception os_bad_exception + +// Not allowed to put 'static const int XXX=20;' in a class definition +# define NO_STATIC_CONSTS +// Using vector requires operator<(X,X) to be defined +# define NEEDS_OPERATOR_LESS_THAN + +# endif + +# undef ANTLR_CCTYPE_NEEDS_STD + +#endif // end __SUNPRO_CC +/*}}}*/ +/*****************************************************************************/ +/*{{{ Inprise C++ Builder 3.0 + *****************************************************************************/ +#ifdef __BCPLUSPLUS__ +# define NO_TEMPLATE_PARTS +# define NO_STRCASECMP +# undef ANTLR_CCTYPE_NEEDS_STD +#endif // End of C++ Builder 3.0 +/*}}}*/ +/*****************************************************************************/ +/*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library ) + *****************************************************************************/ +#ifdef __IBMCPP__ + +// No strcasecmp in the C library (so use stricmp instead) +// - Anyone know which is in which standard? +#if (defined(_AIX) && (__IBMCPP__ >= 600)) +# define NO_STATIC_CONSTS +#else +# define NO_STRCASECMP +# undef ANTLR_CCTYPE_NEEDS_STD +#endif + +#endif // end IBM VisualAge C++ +/*}}}*/ +/*****************************************************************************/ +/*{{{ Metrowerks Codewarrior + *****************************************************************************/ +#ifdef __MWERKS__ +# if (__MWERKS__ <= 0x2201) +# define NO_TEMPLATE_PARTS +# endif + +// CW 6.0 and 7.0 still do not have it. +# define ANTLR_REALLY_NO_STRCASECMP + +# undef ANTLR_C_USING +# define ANTLR_C_USING(_x_) using std:: ## _x_; + +# define ANTLR_CCTYPE_NEEDS_STD +# undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION + +#endif // End of Metrowerks Codewarrior +/*}}}*/ +/*****************************************************************************/ +/*{{{ SGI Irix 6.5.10 MIPSPro compiler + *****************************************************************************/ +// (contributed by Anna Winkler) +// Note: you can't compile ANTLR with the MIPSPro compiler on +// anything < 6.5.10 because SGI just fixed a big bug dealing with +// namespaces in that release. +#ifdef __sgi +# define HAS_NOT_CCTYPE_H +# define HAS_NOT_CSTRING_H +# define HAS_NOT_CSTDIO_H +# undef ANTLR_CCTYPE_NEEDS_STD +#endif // End IRIX MIPSPro +/*}}}*/ +/*****************************************************************************/ +/*{{{ G++ in various incarnations + *****************************************************************************/ +// With the gcc-2.95 and 3.0 being in the near future we should start handling +// incompatabilities between the various libstdc++'s. +#if defined(__GNUC__) || defined(__GNUG__) +// gcc 2 branch.. +# if (__GNUC__ == 2 ) +# if (__GNUC_MINOR__ <= 8 ) +# undef ANTLR_USE_NAMESPACE +# define ANTLR_USE_NAMESPACE(_x_) +# undef ANTLR_USING_NAMESPACE +# define ANTLR_USING_NAMESPACE(_x_) +# undef ANTLR_CXX_SUPPORTS_NAMESPACE +# endif +# if (__GNUC_MINOR__ > 8 && __GNUC_MINOR__ <= 95 ) +# undef ANTLR_IOS_BASE +# define ANTLR_IOS_BASE ios +# undef ANTLR_CCTYPE_NEEDS_STD +// compiling with -ansi ? +# ifdef __STRICT_ANSI__ +# undef ANTLR_REALLY_NO_STRCASECMP +# define ANTLR_REALLY_NO_STRCASECMP +# endif +# else +// experimental .96 .97 branches.. +# undef ANTLR_CCTYPE_NEEDS_STD +# endif +# endif +#endif // ! __GNUC__ +/*}}}*/ +/*****************************************************************************/ +/*{{{ Digital CXX (Tru64) + *****************************************************************************/ +#ifdef __DECCXX +#define __USE_STD_IOSTREAM +#endif +/*}}}*/ +/*****************************************************************************/ +#ifdef __BORLANDC__ +# if __BORLANDC__ >= 560 +# include +# include +# define ANTLR_CCTYPE_NEEDS_STD +# else +# error "sorry, compiler is too old - consider an update." +# endif +#endif + +// Redefine these for backwards compatability.. +#undef ANTLR_BEGIN_NAMESPACE +#undef ANTLR_END_NAMESPACE + +#if ANTLR_CXX_SUPPORTS_NAMESPACE == 1 +# define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ { +# define ANTLR_END_NAMESPACE } +#else +# define ANTLR_BEGIN_NAMESPACE(_x_) +# define ANTLR_END_NAMESPACE +#endif + +#endif //INC_config_h__ diff --git a/lib/antlr/antlr/config.hpp b/lib/antlr/antlr/config.hpp deleted file mode 100644 index db8fb28a..00000000 --- a/lib/antlr/antlr/config.hpp +++ /dev/null @@ -1,290 +0,0 @@ -#ifndef INC_config_hpp__ -#define INC_config_hpp__ - -/* ANTLR Translator Generator - * Project led by Terence Parr at http://www.jGuru.com - * Software rights: http://www.antlr.org/license.html - * - * $Id$ - */ - -/* - * Just a simple configuration file to differentiate between the - * various compilers used and reconfigure stuff for any oddities of the - * compiler in question. - * - * These are the defaults. Per compiler these are amended. - */ -#define ANTLR_USE_NAMESPACE(_x_) _x_:: -#define ANTLR_USING_NAMESPACE(_x_) using namespace _x_; -#define ANTLR_CXX_SUPPORTS_NAMESPACE 1 -#define ANTLR_C_USING(_x_) -#define ANTLR_API -#ifndef CUSTOM_API -# define CUSTOM_API -#endif -#define ANTLR_IOS_BASE ios_base -/** define if cctype functions/macros need a std:: prefix. A lot of compilers - * define these as macros, in which case something barfs. - */ -#define ANTLR_CCTYPE_NEEDS_STD - -/// Define if C++ compiler supports std::uncaught_exception -#define ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION - -#define ANTLR_ATOI_IN_STD - -/******************************************************************************/ -/*{{{ Microsoft Visual C++ */ -// NOTE: If you provide patches for a specific MSVC version guard them for -// the specific version!!!! -// _MSC_VER == 1100 for Microsoft Visual C++ 5.0 -// _MSC_VER == 1200 for Microsoft Visual C++ 6.0 -// _MSC_VER == 1300 for Microsoft Visual C++ 7.0 -#if defined(_MSC_VER) - -# if _MSC_VER < 1300 -# define NOMINMAX -# pragma warning(disable : 4786) -# define min _cpp_min -# endif - -// This warning really gets on my nerves. -// It's the one about symbol longer than 256 chars, and it happens -// all the time with STL. -# pragma warning( disable : 4786 4231 ) -// this shuts up some DLL interface warnings for STL -# pragma warning( disable : 4251 ) - -# ifdef ANTLR_CXX_USE_STLPORT -# undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION -# endif - -# if ( _MSC_VER < 1300 ) && ( defined(ANTLR_EXPORTS) || defined(ANTLR_IMPORTS) ) -# error "DLL Build not supported on these MSVC versions." -// see comment in lib/cpp/src/dll.cpp -# endif - -// For the DLL support originally contributed by Stephen Naughton -// If you are building statically leave ANTLR_EXPORTS/ANTLR_IMPORTS undefined -// If you are building the DLL define ANTLR_EXPORTS -// If you are compiling code to be used with the DLL define ANTLR_IMPORTS -# ifdef ANTLR_EXPORTS -# undef ANTLR_API -# define ANTLR_API __declspec(dllexport) -# endif - -# ifdef ANTLR_IMPORTS -# undef ANTLR_API -# define ANTLR_API __declspec(dllimport) -# endif - -# if ( _MSC_VER < 1200 ) -// supposedly only for MSVC5 and before... -// Using vector requires operator<(X,X) to be defined -# define NEEDS_OPERATOR_LESS_THAN -# endif - -// VC6 -# if ( _MSC_VER == 1200 ) -# undef ANTLR_ATOI_IN_STD -# endif - -# if ( _MSC_VER < 1310 ) -// Supposedly only for MSVC7 and before... -// Not allowed to put 'static const int XXX=20;' in a class definition -# define NO_STATIC_CONSTS -# define NO_TEMPLATE_PARTS -# endif - -// No strcasecmp in the C library (so use stricmp instead) -// - Anyone know which is in which standard? -# define NO_STRCASECMP -# undef ANTLR_CCTYPE_NEEDS_STD -# define NO_STATIC_CONSTS -#endif // End of Microsoft Visual C++ - -/*}}}*/ -/******************************************************************************/ -/*{{{ SunPro Compiler (Using OBJECTSPACE STL) - *****************************************************************************/ -#ifdef __SUNPRO_CC - -# if (__SUNPRO_CC >= 0x500) - -# define NEEDS_OPERATOR_LESS_THAN -# define NO_TEMPLATE_PARTS - -# else - -# undef namespace -# define namespace - -# if (__SUNPRO_CC == 0x420) - -/* This code is specif to SunWspro Compiler 4.2, and will compile with - the objectspace 2.1 toolkit for Solaris2.6 */ -# define HAS_NOT_CASSERT_H -# define HAS_NOT_CSTRING_H -# define HAS_NOT_CCTYPE_H -# define HAS_NOT_CSTDIO_H -# define HAS_OSTREAM_H - -/* #define OS_SOLARIS_2_6 - #define OS_NO_WSTRING - #define OS_NO_ALLOCATORS - #define OS_MULTI_THREADED - #define OS_SOLARIS_NATIVE - #define OS_REALTIME - #define __OSVERSION__=5 - #define SVR4 - */ - -// ObjectSpace + some specific templates constructions with stl. -/* #define OS_NO_ALLOCATOR */ - -// This great compiler does not have the namespace feature. -# undef ANTLR_USE_NAMESPACE -# define ANTLR_USE_NAMESPACE(_x_) -# undef ANTLR_USING_NAMESPACE -# define ANTLR_USING_NAMESPACE(_x_) -# undef ANTLR_CXX_SUPPORTS_NAMESPACE -# endif // End __SUNPRO_CC == 0x420 - -# undef explicit -# define explicit - -# define exception os_exception -# define bad_exception os_bad_exception - -// Not allowed to put 'static const int XXX=20;' in a class definition -# define NO_STATIC_CONSTS -// Using vector requires operator<(X,X) to be defined -# define NEEDS_OPERATOR_LESS_THAN - -# endif - -# undef ANTLR_CCTYPE_NEEDS_STD - -#endif // end __SUNPRO_CC -/*}}}*/ -/*****************************************************************************/ -/*{{{ Inprise C++ Builder 3.0 - *****************************************************************************/ -#ifdef __BCPLUSPLUS__ -# define NO_TEMPLATE_PARTS -# define NO_STRCASECMP -# undef ANTLR_CCTYPE_NEEDS_STD -#endif // End of C++ Builder 3.0 -/*}}}*/ -/*****************************************************************************/ -/*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library ) - *****************************************************************************/ -#ifdef __IBMCPP__ - -// No strcasecmp in the C library (so use stricmp instead) -// - Anyone know which is in which standard? -#if (defined(_AIX) && (__IBMCPP__ >= 600)) -# define NO_STATIC_CONSTS -#else -# define NO_STRCASECMP -# undef ANTLR_CCTYPE_NEEDS_STD -#endif - -#endif // end IBM VisualAge C++ -/*}}}*/ -/*****************************************************************************/ -/*{{{ Metrowerks Codewarrior - *****************************************************************************/ -#ifdef __MWERKS__ -# if (__MWERKS__ <= 0x2201) -# define NO_TEMPLATE_PARTS -# endif - -// CW 6.0 and 7.0 still do not have it. -# define ANTLR_REALLY_NO_STRCASECMP - -# undef ANTLR_C_USING -# define ANTLR_C_USING(_x_) using std:: ## _x_; - -# define ANTLR_CCTYPE_NEEDS_STD -# undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION - -#endif // End of Metrowerks Codewarrior -/*}}}*/ -/*****************************************************************************/ -/*{{{ SGI Irix 6.5.10 MIPSPro compiler - *****************************************************************************/ -// (contributed by Anna Winkler) -// Note: you can't compile ANTLR with the MIPSPro compiler on -// anything < 6.5.10 because SGI just fixed a big bug dealing with -// namespaces in that release. -#ifdef __sgi -# define HAS_NOT_CCTYPE_H -# define HAS_NOT_CSTRING_H -# define HAS_NOT_CSTDIO_H -# undef ANTLR_CCTYPE_NEEDS_STD -#endif // End IRIX MIPSPro -/*}}}*/ -/*****************************************************************************/ -/*{{{ G++ in various incarnations - *****************************************************************************/ -// With the gcc-2.95 and 3.0 being in the near future we should start handling -// incompatabilities between the various libstdc++'s. -#if defined(__GNUC__) || defined(__GNUG__) -// gcc 2 branch.. -# if (__GNUC__ == 2 ) -# if (__GNUC_MINOR__ <= 8 ) -# undef ANTLR_USE_NAMESPACE -# define ANTLR_USE_NAMESPACE(_x_) -# undef ANTLR_USING_NAMESPACE -# define ANTLR_USING_NAMESPACE(_x_) -# undef ANTLR_CXX_SUPPORTS_NAMESPACE -# endif -# if (__GNUC_MINOR__ > 8 && __GNUC_MINOR__ <= 95 ) -# undef ANTLR_IOS_BASE -# define ANTLR_IOS_BASE ios -# undef ANTLR_CCTYPE_NEEDS_STD -// compiling with -ansi ? -# ifdef __STRICT_ANSI__ -# undef ANTLR_REALLY_NO_STRCASECMP -# define ANTLR_REALLY_NO_STRCASECMP -# endif -# else -// experimental .96 .97 branches.. -# undef ANTLR_CCTYPE_NEEDS_STD -# endif -# endif -#endif // ! __GNUC__ -/*}}}*/ -/*****************************************************************************/ -/*{{{ Digital CXX (Tru64) - *****************************************************************************/ -#ifdef __DECCXX -#define __USE_STD_IOSTREAM -#endif -/*}}}*/ -/*****************************************************************************/ -#ifdef __BORLANDC__ -# if __BORLANDC__ >= 560 -# include -# include -# define ANTLR_CCTYPE_NEEDS_STD -# else -# error "sorry, compiler is too old - consider an update." -# endif -#endif - -// Redefine these for backwards compatability.. -#undef ANTLR_BEGIN_NAMESPACE -#undef ANTLR_END_NAMESPACE - -#if ANTLR_CXX_SUPPORTS_NAMESPACE == 1 -# define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ { -# define ANTLR_END_NAMESPACE } -#else -# define ANTLR_BEGIN_NAMESPACE(_x_) -# define ANTLR_END_NAMESPACE -#endif - -#endif //INC_config_hpp__ diff --git a/lib/antlr/src/ANTLRUtil.cpp b/lib/antlr/src/ANTLRUtil.cpp index 30e7ba21..5df8db6d 100644 --- a/lib/antlr/src/ANTLRUtil.cpp +++ b/lib/antlr/src/ANTLRUtil.cpp @@ -5,8 +5,8 @@ * $Id$ */ -#include -#include +#include +#include #include #include diff --git a/lib/antlr/src/ASTFactory.cpp b/lib/antlr/src/ASTFactory.cpp index 98ce6b7a..55f1ce19 100644 --- a/lib/antlr/src/ASTFactory.cpp +++ b/lib/antlr/src/ASTFactory.cpp @@ -5,11 +5,11 @@ * $Id$ */ -#include "antlr/CommonAST.hpp" -#include "antlr/ANTLRException.hpp" -#include "antlr/IOException.hpp" -#include "antlr/ASTFactory.hpp" -#include "antlr/ANTLRUtil.hpp" +#include "antlr/CommonAST.h" +#include "antlr/ANTLRException.h" +#include "antlr/IOException.h" +#include "antlr/ASTFactory.h" +#include "antlr/ANTLRUtil.h" #include #include diff --git a/lib/antlr/src/ASTNULLType.cpp b/lib/antlr/src/ASTNULLType.cpp index 7dd62724..cc3d839d 100644 --- a/lib/antlr/src/ASTNULLType.cpp +++ b/lib/antlr/src/ASTNULLType.cpp @@ -5,9 +5,9 @@ * $Id$ */ -#include "antlr/config.hpp" -#include "antlr/AST.hpp" -#include "antlr/ASTNULLType.hpp" +#include "antlr/config.h" +#include "antlr/AST.h" +#include "antlr/ASTNULLType.h" #include diff --git a/lib/antlr/src/ASTRefCount.cpp b/lib/antlr/src/ASTRefCount.cpp index 0ca54df0..13294fb8 100644 --- a/lib/antlr/src/ASTRefCount.cpp +++ b/lib/antlr/src/ASTRefCount.cpp @@ -4,8 +4,8 @@ * * $Id$ */ -#include "antlr/ASTRefCount.hpp" -#include "antlr/AST.hpp" +#include "antlr/ASTRefCount.h" +#include "antlr/AST.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/BaseAST.cpp b/lib/antlr/src/BaseAST.cpp index f10f1e16..b5d1814f 100644 --- a/lib/antlr/src/BaseAST.cpp +++ b/lib/antlr/src/BaseAST.cpp @@ -5,12 +5,12 @@ * $Id$ */ -#include "antlr/config.hpp" +#include "antlr/config.h" #include -#include "antlr/AST.hpp" -#include "antlr/BaseAST.hpp" +#include "antlr/AST.h" +#include "antlr/BaseAST.h" ANTLR_USING_NAMESPACE(std) #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE diff --git a/lib/antlr/src/BitSet.cpp b/lib/antlr/src/BitSet.cpp index 2a32404a..c04b96c5 100644 --- a/lib/antlr/src/BitSet.cpp +++ b/lib/antlr/src/BitSet.cpp @@ -4,7 +4,7 @@ * * $Id$ */ -#include "antlr/BitSet.hpp" +#include "antlr/BitSet.h" #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE diff --git a/lib/antlr/src/CharBuffer.cpp b/lib/antlr/src/CharBuffer.cpp index a0e11eae..b5895e9f 100644 --- a/lib/antlr/src/CharBuffer.cpp +++ b/lib/antlr/src/CharBuffer.cpp @@ -5,7 +5,7 @@ * $Id$ */ -#include "antlr/CharBuffer.hpp" +#include "antlr/CharBuffer.h" #include //#include diff --git a/lib/antlr/src/CharScanner.cpp b/lib/antlr/src/CharScanner.cpp index d5b1f753..63545468 100644 --- a/lib/antlr/src/CharScanner.cpp +++ b/lib/antlr/src/CharScanner.cpp @@ -7,8 +7,8 @@ #include -#include "antlr/CharScanner.hpp" -#include "antlr/CommonToken.hpp" +#include "antlr/CharScanner.h" +#include "antlr/CommonToken.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/CommonAST.cpp b/lib/antlr/src/CommonAST.cpp index e132c0aa..a44e222f 100644 --- a/lib/antlr/src/CommonAST.cpp +++ b/lib/antlr/src/CommonAST.cpp @@ -4,13 +4,13 @@ * * $Id$ */ -#include "antlr/config.hpp" +#include "antlr/config.h" #include #include -#include "antlr/CommonAST.hpp" -#include "antlr/ANTLRUtil.hpp" +#include "antlr/CommonAST.h" +#include "antlr/ANTLRUtil.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/CommonASTWithHiddenTokens.cpp b/lib/antlr/src/CommonASTWithHiddenTokens.cpp index b0e1a3dd..21a6be61 100644 --- a/lib/antlr/src/CommonASTWithHiddenTokens.cpp +++ b/lib/antlr/src/CommonASTWithHiddenTokens.cpp @@ -4,12 +4,12 @@ * * $Id$ */ -#include "antlr/config.hpp" -#include "antlr/AST.hpp" -#include "antlr/BaseAST.hpp" -#include "antlr/CommonAST.hpp" -#include "antlr/CommonASTWithHiddenTokens.hpp" -#include "antlr/CommonHiddenStreamToken.hpp" +#include "antlr/config.h" +#include "antlr/AST.h" +#include "antlr/BaseAST.h" +#include "antlr/CommonAST.h" +#include "antlr/CommonASTWithHiddenTokens.h" +#include "antlr/CommonHiddenStreamToken.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/CommonHiddenStreamToken.cpp b/lib/antlr/src/CommonHiddenStreamToken.cpp index 9396a43b..3ccb69bc 100644 --- a/lib/antlr/src/CommonHiddenStreamToken.cpp +++ b/lib/antlr/src/CommonHiddenStreamToken.cpp @@ -4,7 +4,7 @@ * * $Id$ */ -#include "antlr/CommonHiddenStreamToken.hpp" +#include "antlr/CommonHiddenStreamToken.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/CommonToken.cpp b/lib/antlr/src/CommonToken.cpp index a223b239..db5f4716 100644 --- a/lib/antlr/src/CommonToken.cpp +++ b/lib/antlr/src/CommonToken.cpp @@ -5,8 +5,8 @@ * $Id$ */ -#include "antlr/CommonToken.hpp" -#include "antlr/String.hpp" +#include "antlr/CommonToken.h" +#include "antlr/String.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/InputBuffer.cpp b/lib/antlr/src/InputBuffer.cpp index c9eced7d..a65755d7 100644 --- a/lib/antlr/src/InputBuffer.cpp +++ b/lib/antlr/src/InputBuffer.cpp @@ -5,8 +5,8 @@ * $Id$ */ -#include "antlr/config.hpp" -#include "antlr/InputBuffer.hpp" +#include "antlr/config.h" +#include "antlr/InputBuffer.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/LLkParser.cpp b/lib/antlr/src/LLkParser.cpp index ab0d672a..c45447f5 100644 --- a/lib/antlr/src/LLkParser.cpp +++ b/lib/antlr/src/LLkParser.cpp @@ -5,7 +5,7 @@ * $Id$ */ -#include "antlr/LLkParser.hpp" +#include "antlr/LLkParser.h" #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE diff --git a/lib/antlr/src/MismatchedCharException.cpp b/lib/antlr/src/MismatchedCharException.cpp index e73dbf36..019743b0 100644 --- a/lib/antlr/src/MismatchedCharException.cpp +++ b/lib/antlr/src/MismatchedCharException.cpp @@ -5,9 +5,9 @@ * $Id$ */ -#include "antlr/CharScanner.hpp" -#include "antlr/MismatchedCharException.hpp" -#include "antlr/String.hpp" +#include "antlr/CharScanner.h" +#include "antlr/MismatchedCharException.h" +#include "antlr/String.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/MismatchedTokenException.cpp b/lib/antlr/src/MismatchedTokenException.cpp index 7fc349f7..52ceeec4 100644 --- a/lib/antlr/src/MismatchedTokenException.cpp +++ b/lib/antlr/src/MismatchedTokenException.cpp @@ -5,8 +5,8 @@ * $Id$ */ -#include "antlr/MismatchedTokenException.hpp" -#include "antlr/String.hpp" +#include "antlr/MismatchedTokenException.h" +#include "antlr/String.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/NoViableAltException.cpp b/lib/antlr/src/NoViableAltException.cpp index 94da2cc4..67406df7 100644 --- a/lib/antlr/src/NoViableAltException.cpp +++ b/lib/antlr/src/NoViableAltException.cpp @@ -5,8 +5,8 @@ * $Id$ */ -#include "antlr/NoViableAltException.hpp" -#include "antlr/String.hpp" +#include "antlr/NoViableAltException.h" +#include "antlr/String.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/NoViableAltForCharException.cpp b/lib/antlr/src/NoViableAltForCharException.cpp index 10d9447a..cee6afd9 100644 --- a/lib/antlr/src/NoViableAltForCharException.cpp +++ b/lib/antlr/src/NoViableAltForCharException.cpp @@ -5,8 +5,8 @@ * $Id$ */ -#include "antlr/NoViableAltForCharException.hpp" -#include "antlr/String.hpp" +#include "antlr/NoViableAltForCharException.h" +#include "antlr/String.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/Parser.cpp b/lib/antlr/src/Parser.cpp index 640da7b6..83b7aaa3 100644 --- a/lib/antlr/src/Parser.cpp +++ b/lib/antlr/src/Parser.cpp @@ -5,7 +5,7 @@ * $Id$ */ -#include "antlr/Parser.hpp" +#include "antlr/Parser.h" #include diff --git a/lib/antlr/src/RecognitionException.cpp b/lib/antlr/src/RecognitionException.cpp index 9c185ccc..54d3df71 100644 --- a/lib/antlr/src/RecognitionException.cpp +++ b/lib/antlr/src/RecognitionException.cpp @@ -5,8 +5,8 @@ * $Id$ */ -#include "antlr/RecognitionException.hpp" -#include "antlr/String.hpp" +#include "antlr/RecognitionException.h" +#include "antlr/String.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/String.cpp b/lib/antlr/src/String.cpp index ae70f479..6d8b43cf 100644 --- a/lib/antlr/src/String.cpp +++ b/lib/antlr/src/String.cpp @@ -5,7 +5,7 @@ * $Id$ */ -#include "antlr/String.hpp" +#include "antlr/String.h" #include diff --git a/lib/antlr/src/Token.cpp b/lib/antlr/src/Token.cpp index f8181634..44c1fcbe 100644 --- a/lib/antlr/src/Token.cpp +++ b/lib/antlr/src/Token.cpp @@ -5,8 +5,8 @@ * $Id$ */ -#include "antlr/Token.hpp" -#include "antlr/String.hpp" +#include "antlr/Token.h" +#include "antlr/String.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/TokenBuffer.cpp b/lib/antlr/src/TokenBuffer.cpp index ed69d6e0..d329aa58 100644 --- a/lib/antlr/src/TokenBuffer.cpp +++ b/lib/antlr/src/TokenBuffer.cpp @@ -5,7 +5,7 @@ * $Id$ */ -#include "antlr/TokenBuffer.hpp" +#include "antlr/TokenBuffer.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/TokenRefCount.cpp b/lib/antlr/src/TokenRefCount.cpp index 0afb0f84..4493c0d7 100644 --- a/lib/antlr/src/TokenRefCount.cpp +++ b/lib/antlr/src/TokenRefCount.cpp @@ -4,8 +4,8 @@ * * $Id:$ */ -#include "antlr/TokenRefCount.hpp" -#include "antlr/Token.hpp" +#include "antlr/TokenRefCount.h" +#include "antlr/Token.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/TokenStreamBasicFilter.cpp b/lib/antlr/src/TokenStreamBasicFilter.cpp index 982e8645..479ba76a 100644 --- a/lib/antlr/src/TokenStreamBasicFilter.cpp +++ b/lib/antlr/src/TokenStreamBasicFilter.cpp @@ -4,7 +4,7 @@ * * $Id$ */ -#include "antlr/TokenStreamBasicFilter.hpp" +#include "antlr/TokenStreamBasicFilter.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/TokenStreamHiddenTokenFilter.cpp b/lib/antlr/src/TokenStreamHiddenTokenFilter.cpp index 431df0c3..f55c9fc5 100644 --- a/lib/antlr/src/TokenStreamHiddenTokenFilter.cpp +++ b/lib/antlr/src/TokenStreamHiddenTokenFilter.cpp @@ -4,8 +4,8 @@ * * $Id$ */ -#include "antlr/TokenStreamHiddenTokenFilter.hpp" -#include "antlr/CommonHiddenStreamToken.hpp" +#include "antlr/TokenStreamHiddenTokenFilter.h" +#include "antlr/CommonHiddenStreamToken.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/TokenStreamRewriteEngine.cpp b/lib/antlr/src/TokenStreamRewriteEngine.cpp index 2f171eb6..8b0e8f3f 100644 --- a/lib/antlr/src/TokenStreamRewriteEngine.cpp +++ b/lib/antlr/src/TokenStreamRewriteEngine.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -10,10 +10,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/TokenStreamSelector.cpp b/lib/antlr/src/TokenStreamSelector.cpp index 602e50dc..26d697bc 100644 --- a/lib/antlr/src/TokenStreamSelector.cpp +++ b/lib/antlr/src/TokenStreamSelector.cpp @@ -4,8 +4,8 @@ * * $Id$ */ -#include "antlr/TokenStreamSelector.hpp" -#include "antlr/TokenStreamRetryException.hpp" +#include "antlr/TokenStreamSelector.h" +#include "antlr/TokenStreamRetryException.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/lib/antlr/src/TreeParser.cpp b/lib/antlr/src/TreeParser.cpp index 6b3f2ca1..dd48b37f 100644 --- a/lib/antlr/src/TreeParser.cpp +++ b/lib/antlr/src/TreeParser.cpp @@ -5,8 +5,8 @@ * $Id$ */ -#include "antlr/TreeParser.hpp" -#include "antlr/ASTNULLType.hpp" +#include "antlr/TreeParser.h" +#include "antlr/ASTNULLType.h" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { diff --git a/parts/tipofday/Makefile.am b/parts/tipofday/Makefile.am index 4ec54292..9b39f67a 100644 --- a/parts/tipofday/Makefile.am +++ b/parts/tipofday/Makefile.am @@ -19,6 +19,6 @@ rc_DATA = kdevpart_tipofday.rc rcdir = $(kde_datadir)/kdevtipofday messages: rc.cpp - $(PREPARETIPS) > tips.cc - $(XGETTEXT) *.cpp *.h tips.cc -o $(podir)/kdevtipofday.pot - rm -f tips.cc + $(PREPARETIPS) > tips.cpp + $(XGETTEXT) *.cpp *.h tips.cpp -o $(podir)/kdevtipofday.pot + rm -f tips.cpp -- cgit v1.2.3