├── zdk ├── NEWS ├── AUTHORS ├── ChangeLog ├── README ├── zls │ ├── zfc │ │ ├── stamp-h.in │ │ └── stamp-h │ ├── zlang │ │ ├── zlangc.ggo │ │ └── data │ │ │ ├── t4.z │ │ │ ├── t5.z │ │ │ ├── t2.z │ │ │ ├── t8.z │ │ │ └── standard.zh │ └── Makefile.am ├── COPYING ├── configure.in ├── auto ├── Makefile.am ├── mkinstalldirs └── acconfig.h ├── antlr-2.7.1 ├── lib │ ├── cpp │ │ ├── NEWS │ │ ├── AUTHORS │ │ ├── contrib │ │ │ ├── bcb4 │ │ │ │ └── README │ │ │ ├── MSCV6-dll │ │ │ │ ├── dll.cpp │ │ │ │ └── antlr.dsw │ │ │ └── MSCV6 │ │ │ │ ├── README │ │ │ │ └── libcpp.dsw │ │ ├── Makefile.am │ │ ├── antlr │ │ │ ├── TokenStreamRetryException.hpp │ │ │ ├── CharStreamException.hpp │ │ │ ├── TokenStreamException.hpp │ │ │ ├── CharStreamIOException.hpp │ │ │ ├── TokenStreamIOException.hpp │ │ │ ├── TokenStreamRecognitionException.hpp │ │ │ ├── CommonHiddenStreamToken.hpp │ │ │ ├── TokenStreamBasicFilter.hpp │ │ │ └── TreeParserSharedInputState.hpp │ │ ├── src │ │ │ ├── TreeParserSharedInputState.cpp │ │ │ ├── ParserSharedInputState.cpp │ │ │ ├── TokenStreamBasicFilter.cpp │ │ │ ├── CommonASTWithHiddenTokens.cpp │ │ │ └── CommonHiddenStreamToken.cpp │ │ ├── scripts │ │ │ ├── mkinstalldirs │ │ │ └── make_change_log.tcl │ │ └── configure.in │ └── sather │ │ ├── Library.module │ │ ├── Util │ │ ├── istream.sa │ │ ├── int_set.sa │ │ ├── Util.module │ │ ├── char_set.sa │ │ └── ifstream.sa │ │ └── Antlr │ │ ├── semantic_exception.sa │ │ ├── token_stream.sa │ │ ├── common_hidden_stream_token.sa │ │ ├── token.sa │ │ ├── tree_parser_shared_input_state.sa │ │ ├── file_line_formatter.sa │ │ ├── char_stream_exception.sa │ │ ├── token_stream_exception.sa │ │ ├── exception.sa │ │ ├── token_stream_retry_exception.sa │ │ ├── byte_buffer.sa │ │ ├── parser_shared_input_state.sa │ │ ├── token_stream_recognition_exception.sa │ │ ├── ast_array.sa │ │ └── scanner_exception.sa ├── examples │ ├── cpp │ │ ├── calc │ │ │ ├── test.in │ │ │ ├── Main.cpp │ │ │ └── calc.g │ │ ├── unicode │ │ │ ├── NOT_WORKING │ │ │ ├── test.in │ │ │ └── unicode.g │ │ ├── parseBinary │ │ │ ├── data │ │ │ ├── Main.cpp │ │ │ └── data.g │ │ ├── exprAST │ │ │ ├── test2.in │ │ │ ├── test.in │ │ │ └── Main.cpp │ │ ├── heteroAST │ │ │ ├── test.in │ │ │ ├── CalcAST.hpp │ │ │ ├── BinaryOperatorAST.hpp │ │ │ ├── Main.cpp │ │ │ ├── MULTNode.hpp │ │ │ └── PLUSNode.hpp │ │ ├── transform │ │ │ ├── test.in │ │ │ └── Main.cpp │ │ ├── lexRewrite │ │ │ ├── test.in │ │ │ └── Main.cpp │ │ ├── multiParser │ │ │ ├── test.in │ │ │ ├── Main.cpp │ │ │ └── simple.g │ │ ├── includeFile │ │ │ ├── subincl.h │ │ │ ├── test.c │ │ │ ├── incl.h │ │ │ └── Main.hpp │ │ ├── treewalk │ │ │ ├── simple.in │ │ │ ├── test.in │ │ │ └── Main.cpp │ │ ├── imagNodeAST │ │ │ ├── simple.in │ │ │ ├── test.in │ │ │ └── Main.cpp │ │ ├── multiLexer │ │ │ ├── CommonTokenTypes.txt │ │ │ ├── shiplist │ │ │ ├── test.in │ │ │ ├── javaparse.g │ │ │ ├── javadocparse.g │ │ │ └── javalex.g │ │ ├── filterWithRule │ │ │ ├── t.html │ │ │ ├── t.g │ │ │ └── Test.cpp │ │ ├── preserveWhiteSpace │ │ │ ├── readme.txt │ │ │ └── test.in │ │ ├── ASTsupport │ │ │ └── Main.cpp │ │ ├── filter │ │ │ ├── t.g │ │ │ └── Test.cpp │ │ ├── tinyc │ │ │ ├── input.c │ │ │ └── Main.cpp │ │ ├── flexLexer │ │ │ ├── T.java │ │ │ └── LexTokenStream.hpp │ │ ├── inherit.tinyc │ │ │ ├── subc.g │ │ │ ├── input.c │ │ │ ├── Main.cpp │ │ │ └── runtest.bat │ │ ├── IDL │ │ │ └── Main.cpp │ │ ├── java │ │ │ └── T.java │ │ ├── cleanup.ksh │ │ ├── columns │ │ │ └── column.g │ │ └── HTML │ │ │ └── Main.cpp │ ├── java │ │ ├── calc │ │ │ ├── test.in │ │ │ ├── shiplist │ │ │ └── calc.g │ │ ├── parseBinary │ │ │ ├── data │ │ │ ├── shiplist │ │ │ ├── Main.java │ │ │ ├── MkData.java │ │ │ └── data.g │ │ ├── exprAST │ │ │ ├── test2.in │ │ │ ├── test.in │ │ │ ├── shiplist │ │ │ └── Main.java │ │ ├── heteroAST │ │ │ ├── test.in │ │ │ ├── CalcAST.java │ │ │ ├── shiplist │ │ │ ├── BinaryOperatorAST.java │ │ │ ├── INTNode.java │ │ │ ├── Main.java │ │ │ ├── MULTNode.java │ │ │ └── PLUSNode.java │ │ ├── lexRewrite │ │ │ ├── test.in │ │ │ ├── shiplist │ │ │ └── Main.java │ │ ├── transform │ │ │ ├── test.in │ │ │ ├── shiplist │ │ │ └── Calc.java │ │ ├── ASTsupport │ │ │ ├── shiplist │ │ │ └── t.bat │ │ ├── columns │ │ │ ├── shiplist │ │ │ ├── test.in │ │ │ └── track.g │ │ ├── includeFile │ │ │ ├── subincl.h │ │ │ ├── test.c │ │ │ ├── incl.h │ │ │ └── shiplist │ │ ├── unicode │ │ │ ├── shiplist │ │ │ ├── test.in │ │ │ └── unicode.g │ │ ├── HTML │ │ │ ├── shiplist │ │ │ └── Main.java │ │ ├── IDL │ │ │ ├── shiplist │ │ │ └── Main.java │ │ ├── filter │ │ │ ├── shiplist │ │ │ ├── t.g │ │ │ └── Test.java │ │ ├── tinyc │ │ │ ├── shiplist │ │ │ └── input.c │ │ ├── filterWithRule │ │ │ ├── shiplist │ │ │ ├── t.html │ │ │ ├── t.g │ │ │ └── Test.java │ │ ├── imagNodeAST │ │ │ ├── simple.in │ │ │ ├── shiplist │ │ │ ├── test.in │ │ │ └── Main.java │ │ ├── treewalk │ │ │ ├── simple.in │ │ │ ├── shiplist │ │ │ ├── test.in │ │ │ └── Main.java │ │ ├── java │ │ │ ├── shiplist │ │ │ └── T.java │ │ ├── multiLexer │ │ │ ├── CommonTokenTypes.txt │ │ │ ├── shiplist │ │ │ ├── test.in │ │ │ ├── javadocparse.g │ │ │ ├── javaparse.g │ │ │ ├── javalex.g │ │ │ └── javadoclex.g │ │ ├── preserveWhiteSpace │ │ │ ├── shiplist │ │ │ ├── readme.txt │ │ │ └── test.in │ │ ├── inherit.tinyc │ │ │ ├── shiplist │ │ │ ├── subc.g │ │ │ ├── input.c │ │ │ ├── Main.java │ │ │ ├── runtest.sh │ │ │ └── runtest.bat │ │ ├── linkChecker │ │ │ ├── shiplist │ │ │ ├── LinkListener.java │ │ │ ├── test.html │ │ │ └── Main.java │ │ ├── pascal │ │ │ ├── shiplist │ │ │ ├── P_4_1.PAS │ │ │ ├── P_4_4.PAS │ │ │ ├── P_4_3.PAS │ │ │ ├── P_4_2.PAS │ │ │ ├── P_3_1.PAS │ │ │ ├── P_4_5.PAS │ │ │ └── P_0_1.PAS │ │ ├── tinybasic │ │ │ ├── GlobalScope.java │ │ │ ├── FunctionScope.java │ │ │ ├── ProgramScope.java │ │ │ ├── SubroutineScope.java │ │ │ ├── DTExecException.java │ │ │ ├── DTExitModuleException.java │ │ │ ├── try2.bas │ │ │ ├── DTSubroutine.java │ │ │ ├── DTFunction.java │ │ │ ├── try1.bas │ │ │ ├── shiplist │ │ │ ├── try.bas │ │ │ └── DTString.java │ │ └── cleanup.ksh │ └── sather │ │ ├── calc │ │ ├── test.in │ │ ├── Main.module │ │ ├── calc.g │ │ └── main.sa │ │ ├── parseBinary │ │ ├── data │ │ ├── Main.module │ │ ├── MkData.java │ │ ├── data.g │ │ └── main.sa │ │ ├── transform │ │ ├── test.in │ │ ├── Main.module │ │ └── main.sa │ │ ├── exprAST │ │ ├── test2.in │ │ ├── test.in │ │ ├── Main.module │ │ └── main.sa │ │ ├── heteroAST │ │ ├── test.in │ │ ├── Main.module │ │ └── main.sa │ │ ├── includeFile │ │ ├── subincl.h │ │ ├── test.c │ │ ├── incl.h │ │ └── Main.module │ │ ├── lexRewrite │ │ ├── test.in │ │ ├── Main.module │ │ └── main.sa │ │ ├── treewalk │ │ ├── simple.in │ │ ├── test.in │ │ ├── Main.module │ │ └── main.sa │ │ ├── imagNodeAST │ │ ├── simple.in │ │ ├── test.in │ │ ├── Main.module │ │ └── main.sa │ │ ├── multiLexer │ │ ├── CommonTokenTypes.txt │ │ ├── test.in │ │ ├── javaparse.g │ │ ├── javadocparse.g │ │ ├── Main.module │ │ └── javalex.g │ │ ├── filterWithRule │ │ ├── t.html │ │ ├── Main.module │ │ ├── t.g │ │ └── test.sa │ │ ├── ASTsupport │ │ └── Main.module │ │ ├── preserveWhiteSpace │ │ ├── readme.txt │ │ ├── test.in │ │ └── Main.module │ │ ├── filter │ │ ├── Main.module │ │ ├── t.g │ │ └── test.sa │ │ ├── IDL │ │ ├── Main.module │ │ └── main.sa │ │ ├── HTML │ │ ├── Main.module │ │ └── main.sa │ │ ├── tinyc │ │ ├── Main.module │ │ └── input.c │ │ ├── inherit.tinyc │ │ ├── Main.module │ │ ├── subc.g │ │ ├── input.c │ │ ├── main.sa │ │ └── runtest.bat │ │ ├── sather │ │ ├── Main.module │ │ └── main.sa │ │ └── java │ │ ├── Main.module │ │ └── T.java ├── antlr.jar ├── doc │ ├── logo.gif │ ├── closure.gif │ ├── optional.gif │ ├── subrule.gif │ ├── jguru-logo.gif │ ├── posclosure.gif │ ├── hidden.stream.gif │ ├── j-guru-blue.jpg │ ├── ANTLRException.gif │ ├── stream.selector.gif │ ├── stream.splitter.gif │ ├── stream.perspectives.gif │ └── lexer.to.parser.tokens.gif ├── antlr │ ├── debug │ │ ├── NewLineListener.java │ │ ├── TraceListener.java │ │ ├── SemanticPredicateListener.java │ │ ├── MessageListener.java │ │ ├── ParserController.java │ │ ├── ParserTokenListener.java │ │ ├── ListenerBase.java │ │ ├── DebuggingParser.java │ │ ├── TraceAdapter.java │ │ ├── ParserListener.java │ │ ├── SemanticPredicateAdapter.java │ │ ├── MessageAdapter.java │ │ ├── ParserTokenAdapter.java │ │ ├── ParserMatchListener.java │ │ ├── InputBufferListener.java │ │ ├── SyntacticPredicateListener.java │ │ ├── ParserMatchAdapter.java │ │ ├── SyntacticPredicateAdapter.java │ │ ├── Tracer.java │ │ ├── Event.java │ │ ├── SyntacticPredicateEvent.java │ │ ├── GuessingEvent.java │ │ ├── NewLineEvent.java │ │ ├── InputBufferAdapter.java │ │ ├── MessageEvent.java │ │ ├── InputBufferReporter.java │ │ └── ParserAdapter.java │ ├── ANTLRTokdefParserTokenTypes.txt │ ├── TokenStream.java │ ├── ASTVisitor.java │ ├── FileCopyException.java │ ├── collections │ │ ├── ASTEnumeration.java │ │ ├── impl │ │ │ ├── IntRange.java │ │ │ ├── LLCell.java │ │ │ └── ASTArray.java │ │ ├── Enumerator.java │ │ ├── Stack.java │ │ └── List.java │ ├── ANTLRException.java │ ├── actions │ │ ├── sather │ │ │ ├── ActionLexerTokenTypes.txt │ │ │ └── ActionLexerTokenTypes.java │ │ ├── cpp │ │ │ ├── ActionLexerTokenTypes.txt │ │ │ └── ActionLexerTokenTypes.java │ │ └── java │ │ │ ├── ActionLexerTokenTypes.txt │ │ │ └── ActionLexerTokenTypes.java │ ├── SemanticException.java │ ├── TokenStreamException.java │ ├── ANTLRTokdefParserTokenTypes.java │ ├── DefaultFileLineFormatter.java │ ├── StringLiteralSymbol.java │ ├── TokenStreamRetryException.java │ ├── CharFormatter.java │ ├── CharStreamIOException.java │ ├── GrammarSymbol.java │ ├── ANTLRError.java │ ├── CharStreamException.java │ ├── TreeParserSharedInputState.java │ ├── TokenStreamRecognitionException.java │ ├── ExceptionHandler.java │ ├── FileLineFormatter.java │ ├── TokenStreamIOException.java │ ├── SynPredBlock.java │ ├── ActionTransInfo.java │ ├── OneOrMoreBlock.java │ ├── ZeroOrMoreBlock.java │ ├── BlockWithImpliedExitPath.java │ ├── ParserSharedInputState.java │ ├── ActionElement.java │ ├── ExceptionSpec.java │ ├── CharLiteralElement.java │ ├── AlternativeElement.java │ ├── preprocessor │ │ ├── PreprocessorTokenTypes.txt │ │ └── Option.java │ ├── WildcardElement.java │ ├── RuleEndElement.java │ ├── BlockEndElement.java │ └── TreeElement.java ├── mkalljar └── build ├── doc └── Z-Language语言语法规范白皮书.pdf └── .gitignore /zdk/NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /zdk/AUTHORS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /zdk/ChangeLog: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /zdk/README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /zdk/zls/zfc/stamp-h.in: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /zdk/zls/zfc/stamp-h: -------------------------------------------------------------------------------- 1 | timestamp 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/calc/test.in: -------------------------------------------------------------------------------- 1 | 3+4*5; 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/unicode/NOT_WORKING: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/parseBinary/data: -------------------------------------------------------------------------------- 1 | a test -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/calc/test.in: -------------------------------------------------------------------------------- 1 | 3+4*5; 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/parseBinary/data: -------------------------------------------------------------------------------- 1 | a test -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/calc/test.in: -------------------------------------------------------------------------------- 1 | 3+4*5; 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/exprAST/test2.in: -------------------------------------------------------------------------------- 1 | 3+4 2 | 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/heteroAST/test.in: -------------------------------------------------------------------------------- 1 | 3+4*5+21; 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/transform/test.in: -------------------------------------------------------------------------------- 1 | 0+3+0*5+0; 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/exprAST/test2.in: -------------------------------------------------------------------------------- 1 | 3+4 2 | 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/heteroAST/test.in: -------------------------------------------------------------------------------- 1 | 3+4*5+21; 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/parseBinary/data: -------------------------------------------------------------------------------- 1 | a test -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/transform/test.in: -------------------------------------------------------------------------------- 1 | 0+3+0*5+0; -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/lexRewrite/test.in: -------------------------------------------------------------------------------- 1 | abc := ( 34 ) 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/multiParser/test.in: -------------------------------------------------------------------------------- 1 | A B C C B A 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/lexRewrite/test.in: -------------------------------------------------------------------------------- 1 | abc := ( 34 ) 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/transform/test.in: -------------------------------------------------------------------------------- 1 | 0+3+0*5+0; 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/exprAST/test2.in: -------------------------------------------------------------------------------- 1 | 3+4 2 | 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/heteroAST/test.in: -------------------------------------------------------------------------------- 1 | 3+4*5+21; 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/includeFile/subincl.h: -------------------------------------------------------------------------------- 1 | int z; 2 | 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/ASTsupport/shiplist: -------------------------------------------------------------------------------- 1 | t.bat 2 | test.g 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/columns/shiplist: -------------------------------------------------------------------------------- 1 | track.g 2 | test.in 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/includeFile/subincl.h: -------------------------------------------------------------------------------- 1 | int z; 2 | 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/unicode/shiplist: -------------------------------------------------------------------------------- 1 | unicode.g 2 | test.in 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/includeFile/subincl.h: -------------------------------------------------------------------------------- 1 | int z; 2 | 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/lexRewrite/test.in: -------------------------------------------------------------------------------- 1 | abc := ( 34 ) 2 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/exprAST/test.in: -------------------------------------------------------------------------------- 1 | 4 / (5+6) *f(x,y,z,1+2) 2 | 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/treewalk/simple.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3+4; 3 | } 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/HTML/shiplist: -------------------------------------------------------------------------------- 1 | html.g 2 | Main.java 3 | test.html 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/IDL/shiplist: -------------------------------------------------------------------------------- 1 | idl.g 2 | test.idl 3 | Main.java 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/calc/shiplist: -------------------------------------------------------------------------------- 1 | calc.g 2 | Calc.java 3 | test.in 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/exprAST/test.in: -------------------------------------------------------------------------------- 1 | 4 / (5+6) *f(x,y,z,1+2) 2 | 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/filter/shiplist: -------------------------------------------------------------------------------- 1 | Test.java 2 | t.g 3 | test.html 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinyc/shiplist: -------------------------------------------------------------------------------- 1 | input.c 2 | lexer.g 3 | tinyc.g 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/exprAST/test.in: -------------------------------------------------------------------------------- 1 | 4 / (5+6) *f(x,y,z,1+2) 2 | 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/imagNodeAST/simple.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3+4; 3 | } 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/filterWithRule/shiplist: -------------------------------------------------------------------------------- 1 | t.g 2 | t.html 3 | Test.java 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/imagNodeAST/simple.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3+4; 3 | } 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/transform/shiplist: -------------------------------------------------------------------------------- 1 | calc.g 2 | Calc.java 3 | test.in 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/treewalk/simple.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3+4; 3 | } 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/treewalk/simple.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3+4; 3 | } 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/lexRewrite/shiplist: -------------------------------------------------------------------------------- 1 | Main.java 2 | rewrite.g 3 | test.in 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/imagNodeAST/simple.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3+4; 3 | } 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/AUTHORS: -------------------------------------------------------------------------------- 1 | Author: 2 | Peter Wells 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Library.module: -------------------------------------------------------------------------------- 1 | Util/Util.module 2 | Antlr/Antlr.module 3 | 4 | -------------------------------------------------------------------------------- /zdk/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (C) since 2000 by Albert Zheng(郑立松) 2 | All rights reserved. 3 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/includeFile/test.c: -------------------------------------------------------------------------------- 1 | int a,b; 2 | #include "incl.h" 3 | int c; 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/exprAST/shiplist: -------------------------------------------------------------------------------- 1 | expr.g 2 | Main.java 3 | test.in 4 | test2.in 5 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/includeFile/test.c: -------------------------------------------------------------------------------- 1 | int a,b; 2 | #include "incl.h" 3 | int c; 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/java/shiplist: -------------------------------------------------------------------------------- 1 | java.g 2 | java.tree.g 3 | Main.java 4 | T.java 5 | -------------------------------------------------------------------------------- /zdk/configure.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/zdk/configure.in -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/parseBinary/shiplist: -------------------------------------------------------------------------------- 1 | data 2 | data.g 3 | Main.java 4 | MkData.java 5 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/treewalk/shiplist: -------------------------------------------------------------------------------- 1 | Main.java 2 | simple.in 3 | test.in 4 | treewalk.g 5 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/includeFile/test.c: -------------------------------------------------------------------------------- 1 | int a,b; 2 | #include "incl.h" 3 | int c; 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/antlr.jar -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/includeFile/incl.h: -------------------------------------------------------------------------------- 1 | 2 | int x; 3 | #include "subincl.h" 4 | int y; 5 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/imagNodeAST/shiplist: -------------------------------------------------------------------------------- 1 | Main.java 2 | simple.in 3 | test.in 4 | treewalk.g 5 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/includeFile/incl.h: -------------------------------------------------------------------------------- 1 | 2 | int x; 3 | #include "subincl.h" 4 | int y; 5 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/includeFile/incl.h: -------------------------------------------------------------------------------- 1 | 2 | int x; 3 | #include "subincl.h" 4 | int y; 5 | -------------------------------------------------------------------------------- /antlr-2.7.1/doc/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/logo.gif -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/columns/test.in: -------------------------------------------------------------------------------- 1 | 123456789012345678901234567890 2 | a one two three 3 | 34 z 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/includeFile/shiplist: -------------------------------------------------------------------------------- 1 | Main.java 2 | P.g 3 | test.c 4 | incl.h 5 | subincl.h 6 | -------------------------------------------------------------------------------- /zdk/zls/zlang/zlangc.ggo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/zdk/zls/zlang/zlangc.ggo -------------------------------------------------------------------------------- /antlr-2.7.1/doc/closure.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/closure.gif -------------------------------------------------------------------------------- /antlr-2.7.1/doc/optional.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/optional.gif -------------------------------------------------------------------------------- /antlr-2.7.1/doc/subrule.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/subrule.gif -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/multiLexer/CommonTokenTypes.txt: -------------------------------------------------------------------------------- 1 | Common 2 | JAVADOC_OPEN=4 3 | JAVADOC_CLOSE=5 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/ASTsupport/t.bat: -------------------------------------------------------------------------------- 1 | java antlr.Tool test.g 2 | javac *.java 3 | java SupportTest 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/multiLexer/CommonTokenTypes.txt: -------------------------------------------------------------------------------- 1 | Common 2 | JAVADOC_OPEN=4 3 | JAVADOC_CLOSE=5 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/preserveWhiteSpace/shiplist: -------------------------------------------------------------------------------- 1 | InstrMain.java 2 | instr.g 3 | readme.txt 4 | test.in 5 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/multiLexer/CommonTokenTypes.txt: -------------------------------------------------------------------------------- 1 | Common 2 | JAVADOC_OPEN=4 3 | JAVADOC_CLOSE=5 4 | -------------------------------------------------------------------------------- /doc/Z-Language语言语法规范白皮书.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/doc/Z-Language语言语法规范白皮书.pdf -------------------------------------------------------------------------------- /antlr-2.7.1/doc/jguru-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/jguru-logo.gif -------------------------------------------------------------------------------- /antlr-2.7.1/doc/posclosure.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/posclosure.gif -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/inherit.tinyc/shiplist: -------------------------------------------------------------------------------- 1 | input.c 2 | Main.java 3 | runtest.bat 4 | runtest.sh 5 | subc.g 6 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Util/istream.sa: -------------------------------------------------------------------------------- 1 | abstract class $ISTREAM is 2 | get : CHAR; 3 | eof_char: CHAR; 4 | end; 5 | -------------------------------------------------------------------------------- /antlr-2.7.1/doc/hidden.stream.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/hidden.stream.gif -------------------------------------------------------------------------------- /antlr-2.7.1/doc/j-guru-blue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/j-guru-blue.jpg -------------------------------------------------------------------------------- /antlr-2.7.1/doc/ANTLRException.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/ANTLRException.gif -------------------------------------------------------------------------------- /antlr-2.7.1/doc/stream.selector.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/stream.selector.gif -------------------------------------------------------------------------------- /antlr-2.7.1/doc/stream.splitter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/stream.splitter.gif -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Util/int_set.sa: -------------------------------------------------------------------------------- 1 | class INT_SET < $COPY, $ELT{INT} is 2 | include FSET{INT} has -> member ; 3 | end; 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/linkChecker/shiplist: -------------------------------------------------------------------------------- 1 | links.g 2 | Main.java 3 | test.html 4 | LinkChecker.java 5 | LinkListener.java 6 | -------------------------------------------------------------------------------- /antlr-2.7.1/doc/stream.perspectives.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/stream.perspectives.gif -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/unicode/test.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/examples/cpp/unicode/test.in -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/contrib/bcb4/README: -------------------------------------------------------------------------------- 1 | Project files for Borland C++Builder 4.0 to build antlr.lib 2 | 3 | Donated by Ross Bencina 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/doc/lexer.to.parser.tokens.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/doc/lexer.to.parser.tokens.gif -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/imagNodeAST/test.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3; 3 | if ( 6 ) j = 7; else j = 8; 4 | while ( 9 ) { 5 | k = j; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/treewalk/test.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3+4*5; 3 | if ( 6 ) j = 7; else j = 8; 4 | while ( 9 ) { 5 | k = 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/unicode/test.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AlbertZheng/zlang-zvm/HEAD/antlr-2.7.1/examples/java/unicode/test.in -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/imagNodeAST/test.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3; 3 | if ( 6 ) j = 7; else j = 8; 4 | while ( 9 ) { 5 | k = j; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/heteroAST/CalcAST.java: -------------------------------------------------------------------------------- 1 | public abstract class CalcAST extends antlr.BaseAST { 2 | public abstract int value(); 3 | } 4 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/treewalk/test.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3+4*5; 3 | if ( 6 ) j = 7; else j = 8; 4 | while ( 9 ) { 5 | k = 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/imagNodeAST/test.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3; 3 | if ( 6 ) j = 7; else j = 8; 4 | while ( 9 ) { 5 | k = j; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/treewalk/test.in: -------------------------------------------------------------------------------- 1 | { 2 | i = 3+4*5; 3 | if ( 6 ) j = 7; else j = 8; 4 | while ( 9 ) { 5 | k = 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/filterWithRule/t.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | dsfkjdsfklj 5 |
6 | foo 7 | 8 | hi 9 | 10 | 11 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/filter/t.g: -------------------------------------------------------------------------------- 1 | class T extends Lexer; 2 | options { 3 | k=2; 4 | filter=true; 5 | } 6 | 7 | P : "

" ; 8 | BR: "
" ; 9 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/multiLexer/shiplist: -------------------------------------------------------------------------------- 1 | CommonTokenTypes.txt 2 | Main.cpp 3 | javadoclex.g 4 | javadocparse.g 5 | javalex.g 6 | javaparse.g 7 | test.in 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/multiLexer/test.in: -------------------------------------------------------------------------------- 1 | /** a javadoc comment 2 | * @param foo 3 | * @exception IOException 4 | * blah blah 5 | */ 6 | int abc; 7 | -------------------------------------------------------------------------------- /zdk/auto: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | aclocal 4 | touch zls/zfc/stamp-h 5 | autoheader 6 | libtoolize --automake --copy 7 | automake --add-missing --copy 8 | autoconf 9 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/filterWithRule/t.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | dsfkjdsfklj 5 |
6 | foo 7 | 8 | hi 9 |

10 | 11 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/multiLexer/shiplist: -------------------------------------------------------------------------------- 1 | Main.java 2 | javaparse.g 3 | javadocparse.g 4 | javalex.g 5 | javadoclex.g 6 | test.in 7 | CommonTokenTypes.txt 8 | 9 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/multiLexer/test.in: -------------------------------------------------------------------------------- 1 | /** a javadoc comment 2 | * @param foo 3 | * @exception IOException 4 | * blah blah 5 | */ 6 | int abc; 7 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/filterWithRule/t.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | dsfkjdsfklj 5 |
6 | foo 7 | 8 | hi 9 |

10 | 11 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/multiLexer/test.in: -------------------------------------------------------------------------------- 1 | /** a javadoc comment 2 | * @param foo 3 | * @exception IOException 4 | * blah blah 5 | */ 6 | int abc; 7 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/preserveWhiteSpace/readme.txt: -------------------------------------------------------------------------------- 1 | See http://www.antlr.org/fieldguide/whitespace for a description of 2 | this translator. 3 | 4 | Peace, 5 | Terence 6 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/pascal/shiplist: -------------------------------------------------------------------------------- 1 | pascal.g 2 | P_0_1.PAS 3 | P_3_1.PAS 4 | P_4_1.PAS 5 | P_4_2.PAS 6 | P_4_3.PAS 7 | P_4_4.PAS 8 | P_4_5.PAS 9 | P_8_2.PAS 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/ASTsupport/Main.module: -------------------------------------------------------------------------------- 1 | -o main AST_TEST.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has AST_TEST_TOKENTYPES.sa AST_TEST_TOKENTYPES 6 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/preserveWhiteSpace/readme.txt: -------------------------------------------------------------------------------- 1 | See http://www.antlr.org/fieldguide/whitespace for a description of 2 | this translator. 3 | 4 | Peace, 5 | Terence 6 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/preserveWhiteSpace/readme.txt: -------------------------------------------------------------------------------- 1 | See http://www.antlr.org/fieldguide/whitespace for a description of 2 | this translator. 3 | 4 | Peace, 5 | Terence 6 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/ASTsupport/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "SupportTest.hpp" 3 | 4 | int main() 5 | { 6 | SupportTest::main(); 7 | return 0; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/filter/Main.module: -------------------------------------------------------------------------------- 1 | -o main test.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has T.sa T 6 | -has T_TOKENTYPES.sa T_TOKENTYPES 7 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/NewLineListener.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface NewLineListener extends ListenerBase { 4 | 5 | 6 | public void hitNewLine(NewLineEvent e); 7 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/GlobalScope.java: -------------------------------------------------------------------------------- 1 | package tinybasic; 2 | 3 | class GlobalScope extends Scope{ 4 | public GlobalScope(Scope prev){ 5 | super(prev); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/filterWithRule/Main.module: -------------------------------------------------------------------------------- 1 | -o main test.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has T.sa T 6 | -has T_TOKENTYPES.sa T_TOKENTYPES 7 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/heteroAST/shiplist: -------------------------------------------------------------------------------- 1 | calc.g 2 | Main.java 3 | test.in 4 | BinaryOperatorAST.java 5 | CalcAST.java 6 | INTNode.java 7 | MULTNode.java 8 | PLUSNode.java 9 | 10 | 11 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/filter/t.g: -------------------------------------------------------------------------------- 1 | options { 2 | language="Cpp"; 3 | } 4 | 5 | class T extends Lexer; 6 | options { 7 | k=2; 8 | filter=true; 9 | } 10 | 11 | P : "

" ; 12 | BR: "
" ; 13 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/linkChecker/LinkListener.java: -------------------------------------------------------------------------------- 1 | interface LinkListener { 2 | public void hrefReference(String target, int line); 3 | public void imageReference(String imageFileName, int line); 4 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/lexRewrite/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has REWRITE.sa REWRITE 6 | -has REWRITE_TOKENTYPES.sa REWRITE_TOKENTYPES 7 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/FunctionScope.java: -------------------------------------------------------------------------------- 1 | package tinybasic; 2 | 3 | class FunctionScope extends Scope{ 4 | public FunctionScope(Scope prev){ 5 | super(prev); 6 | } 7 | 8 | 9 | } 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/ProgramScope.java: -------------------------------------------------------------------------------- 1 | package tinybasic; 2 | 3 | class ProgramScope extends Scope{ 4 | 5 | public ProgramScope(Scope prev){ 6 | super(prev); 7 | } 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/SubroutineScope.java: -------------------------------------------------------------------------------- 1 | package tinybasic; 2 | 3 | class SubroutineScope extends Scope{ 4 | public SubroutineScope(Scope prev){ 5 | super(prev); 6 | } 7 | 8 | 9 | } 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/TraceListener.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface TraceListener extends ListenerBase { 4 | 5 | 6 | public void enterRule(TraceEvent e); 7 | public void exitRule(TraceEvent e); 8 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/filter/t.g: -------------------------------------------------------------------------------- 1 | options { 2 | language = "Sather"; 3 | } 4 | 5 | class T extends Lexer; 6 | options { 7 | k=2; 8 | filter=true; 9 | } 10 | 11 | P : "

" ; 12 | BR: "
" ; 13 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/preserveWhiteSpace/test.in: -------------------------------------------------------------------------------- 1 | // start comment 2 | // another comment 3 | 4 | a = 2; 5 | g(); 6 | { 7 | a=3*4; 8 | } 9 | if 3 then f(4 + b); 10 | else { 11 | b =a; // assign 12 | } 13 | // final 14 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/IDL/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has IDL_LEXER.sa IDL_LEXER 6 | -has IDL_TOKENTYPES.sa IDL_TOKENTYPES 7 | -has IDL_PARSER.sa IDL_PARSER 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src antlr 2 | # Get global config 3 | CXXFLAGS=@CXXFLAGS@ $(DEBUG_CXXFLAGS) 4 | 5 | LIBTOOL_DEPS = @LIBTOOL_DEPS@ 6 | libtool: $(LIBTOOL_DEPS) 7 | $(SHELL) ./config.status --recheck 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/contrib/MSCV6-dll/dll.cpp: -------------------------------------------------------------------------------- 1 | #define STRICT 2 | #define WIN32_LEAN_AND_MEAN 3 | #include 4 | 5 | BOOL APIENTRY DllMain(HANDLE module_, DWORD reason_, LPVOID) 6 | { 7 | return TRUE; 8 | } 9 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/SemanticPredicateListener.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface SemanticPredicateListener extends ListenerBase { 4 | 5 | 6 | public void semanticPredicateEvaluated(SemanticPredicateEvent e); 7 | } -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Util/Util.module: -------------------------------------------------------------------------------- 1 | -has istream.sa $ISTREAM 2 | -has ifstream.sa IFSTREAM 3 | -has circular_queue.sa CIRCULAR_QUEUE 4 | -has char_set.sa CHAR_SET 5 | -has int_set.sa INT_SET 6 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/MessageListener.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface MessageListener extends ListenerBase { 4 | 5 | 6 | public void reportError(MessageEvent e); 7 | public void reportWarning(MessageEvent e); 8 | } -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/ParserController.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface ParserController extends ParserListener { 4 | 5 | 6 | public void checkBreak(); 7 | public void setParserEventSupport(ParserEventSupport p); 8 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/HTML/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has HTML_LEXER.sa HTML_LEXER 6 | -has HTML_TOKENTYPES.sa HTML_TOKENTYPES 7 | -has HTML_PARSER.sa HTML_PARSER 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/pascal/P_4_1.PAS: -------------------------------------------------------------------------------- 1 | { program 4.1 2 | the compound statement } 3 | 4 | program beginend(output); 5 | 6 | var 7 | sum : integer; 8 | 9 | begin 10 | sum := 3 + 5; 11 | writeln(sum, -sum); 12 | end. -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/ParserTokenListener.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface ParserTokenListener extends ListenerBase { 4 | 5 | 6 | public void parserConsume(ParserTokenEvent e); 7 | public void parserLA(ParserTokenEvent e); 8 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/preserveWhiteSpace/test.in: -------------------------------------------------------------------------------- 1 | // start comment 2 | // another comment 3 | 4 | a = 2; 5 | g(); 6 | { 7 | a=3*4; 8 | } 9 | if 3 then f(4 + b); 10 | else { 11 | b =a; // assign 12 | } 13 | // final 14 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/preserveWhiteSpace/test.in: -------------------------------------------------------------------------------- 1 | // start comment 2 | // another comment 3 | 4 | a = 2; 5 | g(); 6 | { 7 | a=3*4; 8 | } 9 | if 3 then f(4 + b); 10 | else { 11 | b =a; // assign 12 | } 13 | // final 14 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/ListenerBase.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | import java.util.EventListener; 4 | 5 | public interface ListenerBase extends EventListener { 6 | 7 | 8 | public void doneParsing(TraceEvent e); 9 | public void refresh(); 10 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/exprAST/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has EXPR_LEXER.sa EXPR_LEXER 6 | -has EXPR_PARSER_TOKENTYPES.sa EXPR_PARSER_TOKENTYPES 7 | -has EXPR_PARSER.sa EXPR_PARSER 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/DebuggingParser.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | /** 4 | * This type was created in VisualAge. 5 | */ 6 | public interface DebuggingParser { 7 | 8 | 9 | public String getRuleName(int n); 10 | public String getSemPredName(int n); 11 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/tinyc/input.c: -------------------------------------------------------------------------------- 1 | int i; 2 | int *i; 3 | 4 | int f(char c, char *d) 5 | { 6 | int f; 7 | c = '\033'+'\47'+'\''+'\\'; 8 | d = " \" '\\' foo"; 9 | i = c+3*f; 10 | if ( i ) { 11 | f = c; 12 | } 13 | else { 14 | f = 1; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/DTExecException.java: -------------------------------------------------------------------------------- 1 | package tinybasic; 2 | 3 | //import antlr.ParserException; 4 | 5 | public class DTExecException extends RuntimeException{ 6 | 7 | 8 | public DTExecException(String s){ 9 | super(s); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/semantic_exception.sa: -------------------------------------------------------------------------------- 1 | 2 | abstract class $ANTLR_SEMANTIC_EXCEPTION < $ANTLR_RECOGNITION_EXCEPTION is 3 | str : STR; 4 | end; 5 | 6 | class ANTLR_SEMANTIC_EXCEPTION < $ANTLR_SEMANTIC_EXCEPTION is 7 | include ANTLR_RECOGNITION_EXCEPTION; 8 | end; 9 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/tinyc/Main.module: -------------------------------------------------------------------------------- 1 | -o main TINYC_PARSER.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has TINYC_LEXER.sa TINYC_LEXER 6 | -has TINYC_PARSER_TOKENTYPES.sa TINYC_PARSER_TOKENTYPES 7 | -has TINYC_TOKENTYPES.sa TINYC_TOKENTYPES 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ANTLRTokdefParserTokenTypes.txt: -------------------------------------------------------------------------------- 1 | ANTLRTokdefParser // output token vocab name 2 | ID=4 3 | STRING=5 4 | ASSIGN=6 5 | LPAREN=7 6 | RPAREN=8 7 | INT=9 8 | WS=10 9 | SL_COMMENT=11 10 | ML_COMMENT=12 11 | ESC=13 12 | DIGIT=14 13 | XDIGIT=15 14 | VOCAB=16 15 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/DTExitModuleException.java: -------------------------------------------------------------------------------- 1 | package tinybasic; 2 | 3 | //import antlr.ParserException; 4 | 5 | public class DTExitModuleException extends DTExecException{ 6 | 7 | 8 | public DTExitModuleException(String s){ 9 | super(s); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/parseBinary/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has DATA_LEXER.sa DATA_LEXER 6 | -has DATA_PARSER_TOKENTYPES.sa DATA_PARSER_TOKENTYPES 7 | -has DATA_PARSER.sa DATA_PARSER 8 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinyc/input.c: -------------------------------------------------------------------------------- 1 | int i; 2 | int *i; 3 | 4 | int f(char c, char *d) 5 | { 6 | int f; 7 | c = '\033'+'\47'+'\''+'\\'; 8 | d = " \" '\\' foo"; 9 | i = c+3*f; 10 | if ( i ) { 11 | f = c; 12 | } 13 | else { 14 | f = 1; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/tinyc/input.c: -------------------------------------------------------------------------------- 1 | int i; 2 | int *i; 3 | 4 | int f(char c, char *d) 5 | { 6 | int f; 7 | c = '\033'+'\47'+'\''+'\\'; 8 | d = " \" '\\' foo"; 9 | i = c+3*f; 10 | if ( i ) { 11 | f = c; 12 | } 13 | else { 14 | f = 1; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/flexLexer/T.java: -------------------------------------------------------------------------------- 1 | class T { 2 | static { int i; } 3 | 4 | void foo() { 5 | class U { int i; } 6 | Class c = int[].class; 7 | t.new T(); 8 | ((T)t).method(); 9 | this( (int) (r * 255), (int) (g * 255)); 10 | return "[i=" + (value) + "]"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/TraceAdapter.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class TraceAdapter implements TraceListener { 4 | 5 | 6 | public void doneParsing(TraceEvent e) {} 7 | public void enterRule(TraceEvent e) {} 8 | public void exitRule(TraceEvent e) {} 9 | public void refresh() {} 10 | } -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/ParserListener.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface ParserListener extends SemanticPredicateListener, 4 | ParserMatchListener, 5 | MessageListener, 6 | ParserTokenListener, 7 | TraceListener, 8 | SyntacticPredicateListener { 9 | } -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/SemanticPredicateAdapter.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class SemanticPredicateAdapter implements SemanticPredicateListener { 4 | 5 | 6 | public void doneParsing(TraceEvent e) {} 7 | public void refresh() {} 8 | public void semanticPredicateEvaluated(SemanticPredicateEvent e) {} 9 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/inherit.tinyc/subc.g: -------------------------------------------------------------------------------- 1 | options { 2 | mangleLiteralPrefix = "TK_"; 3 | } 4 | 5 | class MyCParser extends TinyCParser; 6 | 7 | 8 | // add initializers to variables 9 | variable 10 | { 11 | // init action 12 | } 13 | : type declarator (ASSIGN aexpr)? SEMI 14 | ; 15 | 16 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/MessageAdapter.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class MessageAdapter implements MessageListener { 4 | 5 | 6 | public void doneParsing(TraceEvent e) {} 7 | public void refresh() {} 8 | public void reportError(MessageEvent e) {} 9 | public void reportWarning(MessageEvent e) {} 10 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/inherit.tinyc/subc.g: -------------------------------------------------------------------------------- 1 | options { 2 | mangleLiteralPrefix = "TK_"; 3 | language="Cpp"; 4 | } 5 | 6 | class MyCParser extends TinyCParser; 7 | 8 | 9 | // add initializers to variables 10 | variable 11 | { 12 | // init action 13 | } 14 | : type declarator (ASSIGN aexpr)? SEMI 15 | ; 16 | 17 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/treewalk/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has LANG_LEXER.sa LANG_LEXER 6 | -has LANG_PARSER_TOKENTYPES.sa LANG_PARSER_TOKENTYPES 7 | -has LANG_PARSER.sa LANG_PARSER 8 | -has LANG_WALKER.sa LANG_WALKER 9 | 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/calc/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has CALC_LEXER.sa CALC_LEXER 6 | -has CALC_PARSER_TOKENTYPES.sa CALC_PARSER_TOKENTYPES 7 | -has CALC_PARSER.sa CALC_PARSER 8 | -has CALC_TREE_WALKER.sa CALC_TREE_WALKER 9 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/imagNodeAST/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has LANG_LEXER.sa LANG_LEXER 6 | -has LANG_PARSER_TOKENTYPES.sa LANG_PARSER_TOKENTYPES 7 | -has LANG_PARSER.sa LANG_PARSER 8 | -has LANG_WALKER.sa LANG_WALKER 9 | 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/inherit.tinyc/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has ../tinyc/TINYC_LEXER.sa TINYC_LEXER 6 | -has ../tinyc/TINYC_TOKENTYPES.sa TINYC_TOKENTYPES 7 | -has MYC_PARSER.sa MYC_PARSER 8 | -has MYC_PARSER_TOKENTYPES.sa MYC_PARSER_TOKENTYPES 9 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/ParserTokenAdapter.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class ParserTokenAdapter implements ParserTokenListener { 4 | 5 | 6 | public void doneParsing(TraceEvent e) {} 7 | public void parserConsume(ParserTokenEvent e) {} 8 | public void parserLA(ParserTokenEvent e) {} 9 | public void refresh() {} 10 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/multiLexer/javadocparse.g: -------------------------------------------------------------------------------- 1 | class DemoJavaDocParser extends Parser; 2 | options { 3 | importVocab=JavaDoc; 4 | } 5 | 6 | content 7 | : ( p:PARAM // includes ID as part of PARAM 8 | {System.out.println("found: "+p.getText());} 9 | | e:EXCEPTION 10 | {System.out.println("found: "+e.getText());} 11 | )* 12 | ; 13 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/pascal/P_4_4.PAS: -------------------------------------------------------------------------------- 1 | { program 4.4 2 | compute h(n) = 1 + 1/2 + 1/3 +...+ 1/n } 3 | 4 | program egfor(input, output); 5 | 6 | var 7 | i, n : integer; 8 | h : real; 9 | 10 | begin 11 | read(n); 12 | write(n); 13 | h := 0; 14 | for i:= n downto 1 do 15 | h := h + 1/i; 16 | writeln(h); 17 | end. -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/includeFile/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has P_LEXER.sa P_LEXER 6 | -has P_PARSER_TOKENTYPES.sa P_PARSER_TOKENTYPES 7 | -has P_PARSER.sa P_PARSER 8 | -has main.sa M 9 | -has main.sa MAIN 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/inherit.tinyc/subc.g: -------------------------------------------------------------------------------- 1 | options { 2 | language = "Sather"; 3 | mangleLiteralPrefix = "TK_"; 4 | } 5 | 6 | class MYC_PARSER extends TINYC_PARSER; 7 | 8 | 9 | // add initializers to variables 10 | variable 11 | { 12 | -- init action 13 | } 14 | : type_ declarator (ASSIGN aexpr)? SEMI 15 | ; 16 | 17 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/preserveWhiteSpace/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has INSTR_LEXER.sa INSTR_LEXER 6 | -has INSTR_PARSER_TOKENTYPES.sa INSTR_PARSER_TOKENTYPES 7 | -has INSTR_PARSER.sa INSTR_PARSER 8 | -has INSTR_TREE_WALKER.sa INSTR_TREE_WALKER 9 | 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/heteroAST/BinaryOperatorAST.java: -------------------------------------------------------------------------------- 1 | public abstract class BinaryOperatorAST extends CalcAST { 2 | public CalcAST left() { 3 | return (CalcAST)getFirstChild(); 4 | } 5 | 6 | public CalcAST right() { 7 | CalcAST t = left(); 8 | if ( t==null ) return null; 9 | return (CalcAST)t.getNextSibling(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/try2.bas: -------------------------------------------------------------------------------- 1 | PROGRAM ( ChainParameterString$ , DebugMode% ) 2 | 3 | dim a%(2,3) 4 | 5 | a%(1,2)=7 6 | 7 | print a%(1,2) 8 | 9 | x%=3 10 | 11 | call xyz(x%,2,a%(,)) 12 | 13 | end 14 | 15 | 16 | sub xyz( y% , z% ,b%(,) ) 17 | 18 | print "Are tou Watching?",y%,z%,b%(1,2) 19 | 20 | exit sub 21 | 22 | end sub 23 | 24 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/ParserMatchListener.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface ParserMatchListener extends ListenerBase { 4 | 5 | 6 | public void parserMatch(ParserMatchEvent e); 7 | public void parserMatchNot(ParserMatchEvent e); 8 | public void parserMismatch(ParserMatchEvent e); 9 | public void parserMismatchNot(ParserMatchEvent e); 10 | } -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/InputBufferListener.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface InputBufferListener extends ListenerBase { 4 | 5 | 6 | public void inputBufferConsume(InputBufferEvent e); 7 | public void inputBufferLA(InputBufferEvent e); 8 | public void inputBufferMark(InputBufferEvent e); 9 | public void inputBufferRewind(InputBufferEvent e); 10 | } -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/SyntacticPredicateListener.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public interface SyntacticPredicateListener extends ListenerBase { 4 | 5 | 6 | public void syntacticPredicateFailed(SyntacticPredicateEvent e); 7 | public void syntacticPredicateStarted(SyntacticPredicateEvent e); 8 | public void syntacticPredicateSucceeded(SyntacticPredicateEvent e); 9 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/inherit.tinyc/input.c: -------------------------------------------------------------------------------- 1 | int i = 4; // look: tinyc cannot do this, but we can! 2 | int *i; 3 | 4 | int f(char c, char *d) 5 | { 6 | int f = 5; // look: tinyc cannot do this, but we can! 7 | c = '\033'+'\47'+'\''+'\\'; 8 | d = " \" '\\' foo"; 9 | i = c+3*f; 10 | if ( i ) { 11 | f = c; 12 | } 13 | else { 14 | f = 1; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/linkChecker/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | Hi. Click here for more info. 5 |

6 | 7 | missing. 8 | 9 | 10 |

11 | Here is an image 12 | Here is an image 13 | Here is an image 14 | 15 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/pascal/P_4_3.PAS: -------------------------------------------------------------------------------- 1 | { program 4.3 2 | compute h(n) = 1 + 1/2 + 1/3 +...+ 1/n } 3 | 4 | program egrepeat(input, output); 5 | 6 | var 7 | n : integer; 8 | h : real; 9 | 10 | begin 11 | read(n); 12 | write(n); 13 | h := 0; 14 | repeat 15 | h := h + 1/n; 16 | n := n - 1; 17 | until n=0; 18 | writeln(h); 19 | end. -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/DTSubroutine.java: -------------------------------------------------------------------------------- 1 | package tinybasic; 2 | import java.util.Vector; 3 | import antlr.collections.AST; 4 | 5 | public class DTSubroutine extends DTCodeType { 6 | 7 | public DTSubroutine(AST entry,AST cb,Scope scope,Vector args,String name){ 8 | super(entry,cb,scope,args,name); 9 | } 10 | 11 | 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/sather/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has SATHER_LEXER.sa SATHER_LEXER 6 | -has SATHER_TOKENTYPES.sa SATHER_TOKENTYPES 7 | -has SATHER_PARSER.sa SATHER_PARSER 8 | 9 | (* 10 | -has SATHER_TREE_WALKER.sa SATHER_TREE_WALKER 11 | *) 12 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/heteroAST/CalcAST.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_CalcAST_hpp__ 2 | #define INC_CalcAST_hpp__ 3 | 4 | #include "antlr/BaseAST.hpp" 5 | 6 | class CalcAST : public ANTLR_USE_NAMESPACE(antlr)BaseAST { 7 | public: 8 | virtual int value() const=0; 9 | }; 10 | 11 | typedef ANTLR_USE_NAMESPACE(antlr)ASTRefCount RefCalcAST; 12 | 13 | #endif //INC_CalcAST_hpp__ 14 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/tinyc/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "TinyCLexer.hpp" 3 | #include "TinyCParser.hpp" 4 | 5 | int main() 6 | { 7 | try { 8 | TinyCLexer lexer(std::cin); 9 | TinyCParser parser(lexer); 10 | parser.program(); 11 | } catch(std::exception& e) { 12 | std::cerr << "exception: " << e.what() << std::endl; 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/filterWithRule/t.g: -------------------------------------------------------------------------------- 1 | class T extends Lexer; 2 | options { 3 | k=2; 4 | filter=IGNORE; 5 | charVocabulary = '\3'..'\177'; 6 | } 7 | 8 | P : "

" ; 9 | BR: "
" ; 10 | 11 | protected 12 | IGNORE 13 | : '<' (~'>')* '>' {System.out.println("invalid tag: "+$getText);} 14 | | ( "\r\n" | '\r' | '\n' ) {newline();} 15 | | . 16 | ; 17 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/multiLexer/javaparse.g: -------------------------------------------------------------------------------- 1 | class DemoJavaParser extends Parser; 2 | options { 3 | importVocab=Java; 4 | } 5 | 6 | input 7 | : ( (javadoc)? INT ID SEMI )+ 8 | ; 9 | 10 | javadoc 11 | : JAVADOC_OPEN 12 | { 13 | DemoJavaDocParser jdocparser = new DemoJavaDocParser(getInputState()); 14 | jdocparser.content(); 15 | } 16 | JAVADOC_CLOSE 17 | ; 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/DTFunction.java: -------------------------------------------------------------------------------- 1 | package tinybasic; 2 | import java.util.Vector; 3 | import antlr.collections.AST; 4 | 5 | public class DTFunction extends DTCodeType { 6 | 7 | public DTFunction(int _ttype,AST entry,AST cb,Scope scope,Vector args,String name){ 8 | super(entry,cb,scope,args,name); 9 | } 10 | 11 | 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/IDL/Main.cpp: -------------------------------------------------------------------------------- 1 | #include "IDLLexer.hpp" 2 | #include "IDLParser.hpp" 3 | #include 4 | 5 | int main() 6 | { 7 | ANTLR_USING_NAMESPACE(std) 8 | 9 | try { 10 | IDLLexer lexer(cin); 11 | IDLParser parser(lexer); 12 | parser.specification(); 13 | } catch(exception& e) { 14 | cerr << "exception: " << e.what() << endl; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .classpath 3 | .project 4 | .settings 5 | 6 | # Visual Studio Code 7 | .vscode 8 | .antlr 9 | 10 | # / 11 | /.cvsignore 12 | /work 13 | 14 | # /tests/ 15 | /tests/junit*.properties 16 | 17 | # /bin/ 18 | /bin 19 | 20 | # Mac 21 | *.DS_Store 22 | 23 | # gnu configure 24 | config.cache 25 | config.log 26 | config.status 27 | 28 | *.iml 29 | .idea 30 | .deps 31 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/inherit.tinyc/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "TinyCLexer.hpp" 3 | #include "MyCParser.hpp" 4 | 5 | int main() 6 | { 7 | ANTLR_USING_NAMESPACE(std) 8 | 9 | try { 10 | TinyCLexer lexer(cin); 11 | MyCParser parser(lexer); 12 | parser.program(); 13 | } catch(exception& e) { 14 | cerr << "exception: " << e.what() << endl; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/inherit.tinyc/input.c: -------------------------------------------------------------------------------- 1 | int i = 4; // look: tinyc cannot do this, but we can! 2 | int *i; 3 | 4 | int f(char c, char *d) 5 | { 6 | int f = 5; // look: tinyc cannot do this, but we can! 7 | c = '\033'+'\47'+'\''+'\\'; 8 | d = " \" '\\' foo"; 9 | i = c+3*f; 10 | if ( i ) { 11 | f = c; 12 | } 13 | else { 14 | f = 1; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/pascal/P_4_2.PAS: -------------------------------------------------------------------------------- 1 | { program 4.2 2 | compute h(n) = 1 + 1/2 + 1/3 +...+ 1/n } 3 | 4 | program egwhile(input, output); 5 | 6 | var 7 | n : integer; 8 | h : real; 9 | 10 | begin 11 | read(n); 12 | write(n); 13 | h := 0; 14 | while n>0 do 15 | bein 16 | h := h + 1/n; 17 | n := n - 1; 18 | end; 19 | writeln(h); 20 | end. -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/lexRewrite/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Rewrite.hpp" 3 | 4 | int main() 5 | { 6 | ANTLR_USING_NAMESPACE(std) 7 | try { 8 | Rewrite lexer(cin); 9 | lexer.mSTART(true); 10 | cout << "result Token=" << lexer.getTokenObject()->toString() << endl; 11 | } catch(exception& e) { 12 | cerr << "exception: " << e.what() << endl; 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/parseBinary/Main.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | class Main { 4 | public static void main(String[] args) { 5 | try { 6 | DataLexer lexer = new DataLexer(new DataInputStream(System.in)); 7 | DataParser parser = new DataParser(lexer); 8 | parser.file(); 9 | } catch(Exception e) { 10 | System.err.println("exception: "+e); 11 | } 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/inherit.tinyc/input.c: -------------------------------------------------------------------------------- 1 | int i = 4; // look: tinyc cannot do this, but we can! 2 | int *i; 3 | 4 | int f(char c, char *d) 5 | { 6 | int f = 5; // look: tinyc cannot do this, but we can! 7 | c = '\033'+'\47'+'\''+'\\'; 8 | d = " \" '\\' foo"; 9 | i = c+3*f; 10 | if ( i ) { 11 | f = c; 12 | } 13 | else { 14 | f = 1; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/java/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has JAVA_LEXER.sa JAVA_LEXER 6 | -has JAVA_TOKENTYPES.sa JAVA_TOKENTYPES 7 | -has JAVA_RECOGNIZER.sa JAVA_RECOGNIZER 8 | -has JAVA_TREE_PARSER.sa JAVA_TREE_PARSER 9 | -has JAVA_TREE_PARSER_TOKENTYPES.sa JAVA_TREE_PARSER_TOKENTYPES 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/TokenStream.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/TokenStream.java#1 $ 8 | */ 9 | 10 | public interface TokenStream { 11 | public Token nextToken() throws TokenStreamException; 12 | } 13 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/transform/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has CALC_LEXER.sa CALC_LEXER 6 | -has CALC_PARSER_TOKENTYPES.sa CALC_PARSER_TOKENTYPES 7 | -has CALC_PARSER.sa CALC_PARSER 8 | -has CALC_TREE_WALKER.sa CALC_TREE_WALKER 9 | -has conv.sa CONV 10 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/parseBinary/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "DataLexer.hpp" 3 | #include "DataParser.hpp" 4 | 5 | int main(int argc,char* argv[]) 6 | { 7 | ANTLR_USING_NAMESPACE(std) 8 | try { 9 | DataLexer lexer(cin); 10 | DataParser parser(lexer); 11 | parser.file(); 12 | } catch(std::exception& e) { 13 | std::cerr << "exception: " << e.what() << std::endl; 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/lexRewrite/Main.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | class Main { 4 | public static void main(String[] args) { 5 | try { 6 | Rewrite lexer = new Rewrite(new DataInputStream(System.in)); 7 | lexer.mSTART(true); 8 | System.out.println("result Token="+lexer.getTokenObject()); 9 | } catch(Exception e) { 10 | System.err.println("exception: "+e); 11 | } 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /zdk/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # $Header: /backup/cvsroot/project/pnids/zdk/Makefile.am,v 1.2 2001/11/02 19:48:00 zls Exp $ 3 | # 4 | # $Date: 2001/11/02 19:48:00 $ 5 | # 6 | # $Revision: 1.2 $ 7 | # 8 | # $Name: $ 9 | # 10 | # $Author: zls $ 11 | # 12 | # Copyright(C) since 1998 by Albert Zheng - 郑立松, All Rights Reserved. 13 | # 14 | # lisong.zheng@gmail.com 15 | # 16 | # $State: Exp $ 17 | # 18 | 19 | 20 | SUBDIRS = zls 21 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ASTVisitor.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/ASTVisitor.java#1 $ 8 | */ 9 | 10 | import antlr.collections.AST; 11 | 12 | public interface ASTVisitor{ 13 | public void visit(AST node); 14 | } 15 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/token_stream.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/token_stream.sa#1 $ 8 | 9 | *) 10 | 11 | abstract class $ANTLR_TOKEN_STREAM{TOKEN < $ANTLR_TOKEN} is 12 | next_token : TOKEN; 13 | end; 14 | 15 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Util/char_set.sa: -------------------------------------------------------------------------------- 1 | class CHAR_SET is 2 | 3 | include ARRAY{BOOL}; 4 | 5 | create ( ba : ARRAY{BOOL} ) : SAME 6 | pre ~void(ba) is 7 | res ::= new( ba.size ); 8 | -- copy: expensive 9 | loop 10 | res.set!( ba.elt! ); 11 | end; 12 | return res; 13 | end; 14 | 15 | member( c : CHAR ) : BOOL is 16 | return aget( c.int ); 17 | end; 18 | 19 | end; 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/inherit.tinyc/Main.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | //import TinyCTokenTypes; 3 | 4 | class Main { 5 | public static void main(String[] args) { 6 | try { 7 | TinyCLexer lexer = new TinyCLexer(new DataInputStream(System.in)); 8 | MyCParser parser = new MyCParser(lexer); 9 | parser.program(); 10 | } catch(Exception e) { 11 | System.err.println("exception: "+e); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/FileCopyException.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/FileCopyException.java#1 $ 8 | */ 9 | 10 | class FileCopyException extends java.io.IOException { 11 | public FileCopyException(String msg) { super(msg); } 12 | } 13 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/ParserMatchAdapter.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class ParserMatchAdapter implements ParserMatchListener { 4 | 5 | 6 | public void doneParsing(TraceEvent e) {} 7 | public void parserMatch(ParserMatchEvent e) {} 8 | public void parserMatchNot(ParserMatchEvent e) {} 9 | public void parserMismatch(ParserMatchEvent e) {} 10 | public void parserMismatchNot(ParserMatchEvent e) {} 11 | public void refresh() {} 12 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/IDL/Main.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import antlr.*; 3 | 4 | public class Main { 5 | public static void main(String[] args) { 6 | try { 7 | IDLLexer lexer = new IDLLexer(new DataInputStream(System.in)); 8 | IDLParser parser = new IDLParser(lexer); 9 | parser.specification(); 10 | } catch(Exception e) { 11 | System.err.println("exception: "+e); 12 | } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/java/T.java: -------------------------------------------------------------------------------- 1 | class T { 2 | static { int i; } 3 | 4 | void foo() { 5 | final class U { int i; } 6 | Class c = int[].class; 7 | Class d = Object[].class; 8 | t.new T(); 9 | ((T)t).method(); 10 | this( (int) (r * 255), (int) (g * 255)); 11 | return "[i=" + (value) + "]"; 12 | int q = (int)+3; 13 | int z = (int)4; 14 | int y = (z)+5; 15 | String s = (String) "ff"; 16 | String t = (s)+"blort"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/multiLexer/javaparse.g: -------------------------------------------------------------------------------- 1 | options { 2 | language = "Sather"; 3 | } 4 | 5 | class DEMO_JAVA_PARSER extends Parser; 6 | options { 7 | importVocab=JAVA; 8 | } 9 | 10 | input 11 | : ( (javadoc)? INT ID SEMI )+ 12 | ; 13 | 14 | javadoc 15 | : JAVADOC_OPEN 16 | { 17 | javadoc_parser ::= #DEMO_JAVADOC_PARSER{TOKEN,AST}( input_state ); 18 | javadoc_parser.content; 19 | } 20 | JAVADOC_CLOSE 21 | ; 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/collections/ASTEnumeration.java: -------------------------------------------------------------------------------- 1 | package antlr.collections; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/collections/ASTEnumeration.java#1 $ 8 | */ 9 | 10 | public interface ASTEnumeration { 11 | public boolean hasMoreNodes(); 12 | public AST nextNode(); 13 | } 14 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/filterWithRule/t.g: -------------------------------------------------------------------------------- 1 | options { 2 | language="Cpp"; 3 | } 4 | 5 | { 6 | #include 7 | } 8 | 9 | class T extends Lexer; 10 | options { 11 | k=2; 12 | filter=IGNORE; 13 | charVocabulary = '\3'..'\177'; 14 | } 15 | 16 | P : "

" ; 17 | BR: "
" ; 18 | 19 | protected 20 | IGNORE 21 | : '<' (~'>')* '>' {std::cout << "invalid tag: " << $getText << std::endl;} 22 | | ( "\r\n" | '\r' | '\n' ) {newline();} 23 | | . 24 | ; 25 | -------------------------------------------------------------------------------- /zdk/zls/zlang/data/t4.z: -------------------------------------------------------------------------------- 1 | void gf1() 2 | { 3 | } 4 | 5 | udword gf2(ipaddress ip) 6 | { 7 | string s = "\x0"; 8 | table astring = { -7301 = "zls\0zls", 0x7401 = "zlj" }; 9 | udword udw = 100; 10 | gf1(); 11 | while (udw) 12 | { 13 | if (udw > 10) 14 | { 15 | udw = udw + 100; 16 | break; 17 | } 18 | else 19 | { 20 | udw = gf2(ip); 21 | continue; 22 | } 23 | } 24 | return(udw); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/multiLexer/javaparse.g: -------------------------------------------------------------------------------- 1 | options { 2 | language="Cpp"; 3 | } 4 | 5 | { 6 | #include "DemoJavaDocParser.hpp" 7 | } 8 | 9 | class DemoJavaParser extends Parser; 10 | options { 11 | importVocab=Java; 12 | } 13 | 14 | input 15 | : ( (javadoc)? INT ID SEMI )+ 16 | ; 17 | 18 | javadoc 19 | : JAVADOC_OPEN 20 | { 21 | DemoJavaDocParser jdocparser(getInputState()); 22 | jdocparser.content(); 23 | } 24 | JAVADOC_CLOSE 25 | ; 26 | 27 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/SyntacticPredicateAdapter.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class SyntacticPredicateAdapter implements SyntacticPredicateListener { 4 | 5 | 6 | public void doneParsing(TraceEvent e) {} 7 | public void refresh() {} 8 | public void syntacticPredicateFailed(SyntacticPredicateEvent e) {} 9 | public void syntacticPredicateStarted(SyntacticPredicateEvent e) {} 10 | public void syntacticPredicateSucceeded(SyntacticPredicateEvent e) {} 11 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/java/T.java: -------------------------------------------------------------------------------- 1 | class T { 2 | static { int i; } 3 | 4 | void foo() { 5 | final class U { int i; } 6 | Class c = int[].class; 7 | Class d = Object[].class; 8 | t.new T(); 9 | ((T)t).method(); 10 | this( (int) (r * 255), (int) (g * 255)); 11 | return "[i=" + (value) + "]"; 12 | int q = (int)+3; 13 | int z = (int)4; 14 | int y = (z)+5; 15 | String s = (String) "ff"; 16 | String t = (s)+"blort"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/java/T.java: -------------------------------------------------------------------------------- 1 | class T { 2 | static { int i; } 3 | 4 | void foo() { 5 | final class U { int i; } 6 | Class c = int[].class; 7 | Class d = Object[].class; 8 | t.new T(); 9 | ((T)t).method(); 10 | this( (int) (r * 255), (int) (g * 255)); 11 | return "[i=" + (value) + "]"; 12 | int q = (int)+3; 13 | int z = (int)4; 14 | int y = (z)+5; 15 | String s = (String) "ff"; 16 | String t = (s)+"blort"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /zdk/zls/zlang/data/t5.z: -------------------------------------------------------------------------------- 1 | table gf1(table & ras, sdword sdw, sdword & rsdw) 2 | { 3 | udword udw; 4 | gf1(ras, sdw, rsdw); 5 | //gf1(ras, sdw, udw); // Semantic error 6 | //gf1(gf1(ras, sdw, rsdw), sdw, rsdw); // Semantic error 7 | return ras; 8 | } 9 | 10 | static void lf1() 11 | { 12 | table as; 13 | sdword sdw; 14 | table asdw; 15 | 16 | gf1(as, sdw, sdw); 17 | gf1(as, sdw, asdw[1]); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/multiLexer/javadocparse.g: -------------------------------------------------------------------------------- 1 | options { 2 | language="Cpp"; 3 | } 4 | 5 | { 6 | #include 7 | } 8 | 9 | class DemoJavaDocParser extends Parser; 10 | options { 11 | importVocab=JavaDoc; 12 | } 13 | 14 | content 15 | : ( p:PARAM // includes ID as part of PARAM 16 | {std::cout << "found: " << p->getText() << std::endl;} 17 | | e:EXCEPTION 18 | {std::cout << "found: " << e->getText() << std::endl;} 19 | )* 20 | ; 21 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/multiLexer/javadocparse.g: -------------------------------------------------------------------------------- 1 | options { 2 | language = "Sather"; 3 | } 4 | 5 | class DEMO_JAVADOC_PARSER extends Parser; 6 | options { 7 | importVocab=JAVADOC; 8 | } 9 | { 10 | println ( s : STR ) is 11 | #OUT + s + "\n"; 12 | end; 13 | } 14 | 15 | content 16 | : ( p:PARAM // includes ID as part of PARAM 17 | {println("found: " + p.text);} 18 | | e:EXCEPTION 19 | {println("found: " + e.text);} 20 | )* 21 | ; 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Util/ifstream.sa: -------------------------------------------------------------------------------- 1 | class IFSTREAM < $ISTREAM is 2 | 3 | include FILE open_for_read -> FILE_open_for_read; 4 | 5 | get : CHAR is 6 | return get_char; 7 | end; 8 | 9 | const eof_char : CHAR := '\377'; 10 | 11 | open_for_read ( file_name : STR ) : SAME is 12 | file : SAME := FILE_open_for_read( file_name ); 13 | if ( void(file.fp) ) then 14 | return void 15 | end; 16 | return file; 17 | end; 18 | 19 | end; 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/mkalljar: -------------------------------------------------------------------------------- 1 | # 2 | # A shell script that builds the antlrall.jar file 3 | # The debugging event stuff does not get included by this script. 4 | # 5 | # $Id: //depot/code/org.antlr/main/main/mkantlrall.jar#1 $ 6 | # 7 | jar cvf antlrall.jar \ 8 | antlr/actions/cpp/*.class \ 9 | antlr/actions/java/*.class \ 10 | antlr/actions/sather/*.class \ 11 | antlr/*.class \ 12 | antlr/collections/*.class \ 13 | antlr/collections/impl/*.class \ 14 | antlr/preprocessor/*.class 15 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/includeFile/Main.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_Main_hpp__ 2 | #define INC_Main_hpp__ 3 | 4 | #include "antlr/TokenStreamSelector.hpp" 5 | 6 | class PParser; 7 | class PLexer; 8 | 9 | // Define a selector that can handle nested include files. 10 | // These variables are public so the parser/lexer can see them. 11 | extern ANTLR_USE_NAMESPACE(antlr)TokenStreamSelector selector; 12 | extern PParser* parser; 13 | extern PLexer* mainLexer; 14 | 15 | #endif //INC_Main_hpp__ 16 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/linkChecker/Main.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | public class Main { 4 | public static void main(String[] args) { 5 | if ( args.length==0 ) { 6 | System.out.println("java Main document.html"); 7 | } 8 | else { 9 | LinkChecker chk = new LinkChecker(args[0]); 10 | try { 11 | chk.doCheck(); 12 | } 13 | catch (IOException io) { 14 | System.err.println("IOException: "+io.getMessage()); 15 | io.printStackTrace(); 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ANTLRException.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/ANTLRException.java#1 $ 8 | */ 9 | 10 | public class ANTLRException extends Exception { 11 | 12 | public ANTLRException() { 13 | super(); 14 | } 15 | public ANTLRException(String s) { 16 | super(s); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/flexLexer/LexTokenStream.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_LexTokenStream_hpp__ 2 | #define INC_LexTokenStream_hpp__ 3 | 4 | #include 5 | #include "antlr/TokenStream.hpp" 6 | 7 | class LexTokenStream : public ANTLR_USE_NAMESPACE(antlr)TokenStream { 8 | public: 9 | LexTokenStream(std::FILE* fp); 10 | void newLine(); 11 | ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); 12 | private: 13 | int line; 14 | bool reachedEOF; 15 | }; 16 | 17 | #endif //INC_LexTokenStream_hpp__ 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/parseBinary/MkData.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | class MkData { 4 | public static void main(String[] args) throws Exception { 5 | byte data[] = {0, // begin short 6 | 0x01, 0x12, 7 | 0x01, // begin string 8 | (byte)'a', (byte)' ', (byte)'t', (byte)'e', 9 | (byte)'s', (byte)'t', 10 | 0x02 // end string 11 | }; 12 | FileOutputStream f = new FileOutputStream("data"); 13 | f.write(data); 14 | f.close(); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/try1.bas: -------------------------------------------------------------------------------- 1 | PROGRAM ( ChainParameterString$ , DebugMode% ) 2 | 3 | x%=2 4 | 5 | 6 | do until x%=5 7 | x% = x% +1 8 | print x% 9 | loop 10 | 11 | do 12 | x%=x%+1 13 | print x%,x%,"Hello World" 14 | 15 | loop until x%=7 16 | 17 | if x% = 1 then 18 | print 21 19 | else if x% = 2 then 20 | print 22 21 | else if x% = 5 then 22 | print 23 23 | else 24 | print 24 25 | end if 26 | 27 | for x%=1 to 3 28 | y%=x% 29 | print x% , y%+2 30 | next x% 31 | 32 | y% = 2 33 | 34 | end 35 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/actions/sather/ActionLexerTokenTypes.txt: -------------------------------------------------------------------------------- 1 | // $ANTLR 2.7.1a3: action.g -> ActionLexerTokenTypes.txt$ 2 | ActionLexer // output token vocab name 3 | ACTION=4 4 | STUFF=5 5 | AST_ITEM=6 6 | TEXT_ITEM=7 7 | TREE=8 8 | TREE_ELEMENT=9 9 | AST_CONSTRUCTOR=10 10 | AST_CTOR_ELEMENT=11 11 | ID_ELEMENT=12 12 | TEXT_ARG=13 13 | TEXT_ARG_ELEMENT=14 14 | TEXT_ARG_ID_ELEMENT=15 15 | ARG=16 16 | ID=17 17 | VAR_ASSIGN=18 18 | CHAR=19 19 | STRING=20 20 | ESC=21 21 | DIGIT=22 22 | INT=23 23 | INT_OR_FLOAT=24 24 | WS=25 25 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/parseBinary/MkData.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | class MkData { 4 | public static void main(String[] args) throws Exception { 5 | byte data[] = {0, // begin short 6 | 0x01, 0x12, 7 | 0x01, // begin string 8 | (byte)'a', (byte)' ', (byte)'t', (byte)'e', 9 | (byte)'s', (byte)'t', 10 | 0x02 // end string 11 | }; 12 | FileOutputStream f = new FileOutputStream("data"); 13 | f.write(data); 14 | f.close(); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/build: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #SRC=/home/parrt/depot/code/org.antlr/main/main/antlr 3 | SRC=`pwd`/antlr 4 | COMPILER="jikes" 5 | 6 | echo Compiling ANTLR 7 | cd $SRC; $COMPILER *.java 8 | cd $SRC/actions/cpp; $COMPILER *.java 9 | cd $SRC/actions/java; $COMPILER *.java 10 | cd $SRC/actions/sather; $COMPILER *.java 11 | cd $SRC/collections; $COMPILER *.java 12 | cd $SRC/collections/impl; $COMPILER *.java 13 | cd $SRC/debug; $COMPILER *.java 14 | cd $SRC/debug/misc; $COMPILER *.java 15 | cd $SRC/preprocessor; $COMPILER *.java 16 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/heteroAST/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has CALC_LEXER.sa CALC_LEXER 6 | -has CALC_PARSER_TOKENTYPES.sa CALC_PARSER_TOKENTYPES 7 | -has CALC_PARSER.sa CALC_PARSER 8 | 9 | -has calc_ast.sa $CALC_AST 10 | -has calc_ast.sa CALC_AST 11 | -has calc_ast.sa INT_NODE 12 | -has calc_ast.sa MULT_NODE 13 | -has calc_ast.sa PLUS_NODE 14 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/antlr/TokenStreamRetryException.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_TokenStreamRetryException_hpp__ 2 | #define INC_TokenStreamRetryException_hpp__ 3 | 4 | #include "antlr/config.hpp" 5 | #include "antlr/TokenStreamException.hpp" 6 | 7 | ANTLR_BEGIN_NAMESPACE(antlr) 8 | 9 | class TokenStreamRetryException : public TokenStreamException { 10 | public: 11 | TokenStreamRetryException() {} 12 | ~TokenStreamRetryException() throw() {} 13 | }; 14 | 15 | ANTLR_END_NAMESPACE 16 | 17 | #endif //INC_TokenStreamRetryException_hpp__ 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/antlr/CharStreamException.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_CharStreamException_hpp__ 2 | #define INC_CharStreamException_hpp__ 3 | 4 | #include "antlr/config.hpp" 5 | #include "antlr/ANTLRException.hpp" 6 | 7 | ANTLR_BEGIN_NAMESPACE(antlr) 8 | 9 | class CharStreamException : public ANTLRException { 10 | public: 11 | CharStreamException(const ANTLR_USE_NAMESPACE(std)string& s) 12 | : ANTLRException(s) {} 13 | ~CharStreamException() throw() {} 14 | }; 15 | 16 | ANTLR_END_NAMESPACE 17 | 18 | #endif //INC_CharStreamException_hpp__ 19 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/common_hidden_stream_token.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/common_hidden_stream_token.sa#1 $ 8 | 9 | *) 10 | 11 | class ANTLR_COMMON_HIDDEN_STREAM_TOKEN < $ANTLR_TOKEN is 12 | 13 | include ANTLR_COMMON_TOKEN; 14 | 15 | attr hidden_before : SAME; 16 | attr hidden_after : SAME; 17 | 18 | end; 19 | -------------------------------------------------------------------------------- /zdk/zls/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # $Header: /backup/cvsroot/project/pnids/zdk/zls/Makefile.am,v 1.2 2001/11/02 19:53:26 zls Exp $ 3 | # 4 | # $Date: 2001/11/02 19:53:26 $ 5 | # 6 | # $Revision: 1.2 $ 7 | # 8 | # $Name: $ 9 | # 10 | # $Author: zls $ 11 | # 12 | # Copyright(C) since 1998 by Albert Zheng - 郑立松, All Rights Reserved. 13 | # 14 | # lisong.zheng@gmail.com 15 | # 16 | # $State: Exp $ 17 | # 18 | 19 | 20 | SUBDIRS = zfc zvm zlang 21 | 22 | # 指示这个目录下要被安装的include文件及被安装位置 23 | #pkginclude_HEADERS = config.h 24 | #pkgincludedir = ${includedir}/zls 25 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/cleanup.ksh: -------------------------------------------------------------------------------- 1 | #!/bin/ksh 2 | for ex in * 3 | do 4 | if [ -d $ex ] 5 | then 6 | echo "Cleaning up" $ex 7 | if [ -f $ex/shiplist ] 8 | then 9 | cp $ex/shiplist /tmp 10 | for q in `cat $ex/shiplist` 11 | do 12 | #echo "saving" $ex/$q 13 | mv $ex/$q /tmp 14 | done 15 | #echo "caterizing dir" 16 | rm $ex/* 17 | mv /tmp/shiplist $ex 18 | for i in `cat $ex/shiplist` 19 | do 20 | #echo "restoring" $i 21 | mv /tmp/$i $ex 22 | done 23 | else 24 | echo $ex "has no shiplist; ignoring..." 25 | fi 26 | fi 27 | done 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/cleanup.ksh: -------------------------------------------------------------------------------- 1 | #!/bin/ksh 2 | for ex in * 3 | do 4 | if [ -d $ex ] 5 | then 6 | echo "Cleaning up" $ex 7 | if [ -f $ex/shiplist ] 8 | then 9 | cp $ex/shiplist /tmp 10 | for q in `cat $ex/shiplist` 11 | do 12 | #echo "saving" $ex/$q 13 | mv $ex/$q /tmp 14 | done 15 | #echo "caterizing dir" 16 | rm $ex/* 17 | mv /tmp/shiplist $ex 18 | for i in `cat $ex/shiplist` 19 | do 20 | #echo "restoring" $i 21 | mv /tmp/$i $ex 22 | done 23 | else 24 | echo $ex "has no shiplist; ignoring..." 25 | fi 26 | fi 27 | done 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/actions/cpp/ActionLexerTokenTypes.txt: -------------------------------------------------------------------------------- 1 | // $ANTLR 2.7.1: action.g -> ActionLexerTokenTypes.txt$ 2 | ActionLexer // output token vocab name 3 | ACTION=4 4 | STUFF=5 5 | AST_ITEM=6 6 | TEXT_ITEM=7 7 | TREE=8 8 | TREE_ELEMENT=9 9 | AST_CONSTRUCTOR=10 10 | AST_CTOR_ELEMENT=11 11 | ID_ELEMENT=12 12 | TEXT_ARG=13 13 | TEXT_ARG_ELEMENT=14 14 | TEXT_ARG_ID_ELEMENT=15 15 | ARG=16 16 | ID=17 17 | VAR_ASSIGN=18 18 | COMMENT=19 19 | SL_COMMENT=20 20 | ML_COMMENT=21 21 | CHAR=22 22 | STRING=23 23 | ESC=24 24 | DIGIT=25 25 | INT=26 26 | INT_OR_FLOAT=27 27 | WS=28 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/parseBinary/data.g: -------------------------------------------------------------------------------- 1 | class DataParser extends Parser; 2 | 3 | file: ( sh:SHORT {System.out.println(sh.getText());} 4 | | st:STRING {System.out.println("\""+st.getText()+"\"");} 5 | )+ 6 | ; 7 | 8 | class DataLexer extends Lexer; 9 | options { 10 | charVocabulary = '\u0000'..'\u00FF'; 11 | } 12 | 13 | SHORT 14 | : '\0' high:. lo:. 15 | { 16 | int v = (((int)high)<<8) + lo; 17 | $setText(""+v); 18 | } 19 | ; 20 | 21 | STRING 22 | : '\1'! // begin string (discard) 23 | ( ~'\2' )* 24 | '\2'! // end string (discard) 25 | ; 26 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/actions/java/ActionLexerTokenTypes.txt: -------------------------------------------------------------------------------- 1 | // $ANTLR 2.7.1a4: action.g -> ActionLexerTokenTypes.txt$ 2 | ActionLexer // output token vocab name 3 | ACTION=4 4 | STUFF=5 5 | AST_ITEM=6 6 | TEXT_ITEM=7 7 | TREE=8 8 | TREE_ELEMENT=9 9 | AST_CONSTRUCTOR=10 10 | AST_CTOR_ELEMENT=11 11 | ID_ELEMENT=12 12 | TEXT_ARG=13 13 | TEXT_ARG_ELEMENT=14 14 | TEXT_ARG_ID_ELEMENT=15 15 | ARG=16 16 | ID=17 17 | VAR_ASSIGN=18 18 | COMMENT=19 19 | SL_COMMENT=20 20 | ML_COMMENT=21 21 | CHAR=22 22 | STRING=23 23 | ESC=24 24 | DIGIT=25 25 | INT=26 26 | INT_OR_FLOAT=27 27 | WS=28 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/treewalk/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "LangLexer.hpp" 3 | #include "LangParser.hpp" 4 | #include "LangWalker.hpp" 5 | 6 | int main() 7 | { 8 | ANTLR_USING_NAMESPACE(std) 9 | try { 10 | LangLexer lexer(cin); 11 | LangParser parser(lexer); 12 | parser.block(); 13 | cout << parser.getAST()->toStringList() << endl; 14 | LangWalker walker; 15 | walker.block(parser.getAST()); // walk tree 16 | cout << "done walking" << endl; 17 | } catch(exception& e) { 18 | cerr << "exception: " << e.what() << endl; 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/shiplist: -------------------------------------------------------------------------------- 1 | Context.java 2 | DTArray1D.java 3 | DTArray2D.java 4 | DTArray3D.java 5 | DTCodeType.java 6 | DTDataType.java 7 | DTDataTypeProxy.java 8 | DTExecException.java 9 | DTExitModuleException.java 10 | DTFloat.java 11 | DTFunction.java 12 | DTInteger.java 13 | DTString.java 14 | DTSubroutine.java 15 | FunctionScope.java 16 | GlobalScope.java 17 | Main.java 18 | Makefile 19 | ProgramScope.java 20 | README.txt 21 | Scope.java 22 | SubroutineScope.java 23 | TinyBasic.g 24 | TinyBasicTreeWalker.g 25 | try.bas 26 | try1.bas 27 | try2.bas 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/src/TreeParserSharedInputState.cpp: -------------------------------------------------------------------------------- 1 | #include "antlr/TreeParserSharedInputState.hpp" 2 | 3 | ANTLR_BEGIN_NAMESPACE(antlr) 4 | 5 | /** This object contains the data associated with an 6 | * input AST. Multiple parsers 7 | * share a single TreeParserSharedInputState to parse 8 | * the same tree or to have the parser walk multiple 9 | * trees. 10 | */ 11 | 12 | TreeParserInputState::TreeParserInputState() 13 | : guessing(0) 14 | { 15 | } 16 | 17 | TreeParserInputState::~TreeParserInputState() 18 | { 19 | } 20 | 21 | ANTLR_END_NAMESPACE 22 | 23 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/token.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/token.sa#1 $ 8 | 9 | *) 10 | 11 | abstract class $ANTLR_TOKEN is 12 | 13 | column : INT; 14 | line : INT; 15 | text : STR; 16 | ttype : INT; 17 | str : STR; 18 | 19 | column ( i: INT ); 20 | line ( i: INT ); 21 | text ( s: STR ); 22 | ttype ( i: INT ); 23 | 24 | end; 25 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/SemanticException.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/SemanticException.java#1 $ 8 | */ 9 | 10 | public class SemanticException extends RecognitionException { 11 | public SemanticException(String s) { 12 | super(s); 13 | } 14 | public SemanticException(String s, String fileName, int line) { 15 | super(s, fileName, line); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/filter/Test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "T.hpp" 3 | 4 | int main() 5 | { 6 | ANTLR_USING_NAMESPACE(std) 7 | ANTLR_USING_NAMESPACE(antlr) 8 | 9 | try { 10 | T lexer(cin); 11 | bool done = false; 12 | while ( !done ) { 13 | RefToken t = lexer.nextToken(); 14 | cout << "Token: " << t->toString() << endl; 15 | if ( t->getType()==Token::EOF_TYPE ) { 16 | done = true; 17 | } 18 | } 19 | cout << "done lexing..." << endl; 20 | } catch(exception& e) { 21 | cerr << "exception: " << e.what() << endl; 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/pascal/P_3_1.PAS: -------------------------------------------------------------------------------- 1 | { program 3.1 2 | example of constant definition part } 3 | 4 | program convert(output); 5 | 6 | const 7 | addin = 32; 8 | mulby = 1.8; 9 | low = 0; 10 | high = 39; 11 | seperator = '------------'; 12 | 13 | var 14 | degree : low..high; 15 | 16 | begin 17 | writeln(seperator); 18 | for degree := low to high do 19 | begin 20 | write(degree, 'c', round(degree * mulby + addin), 'f'); 21 | if ndd(degree) then writeln 22 | end; 23 | writeln; 24 | writeln(seperator) 25 | end. 26 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/filterWithRule/Test.cpp: -------------------------------------------------------------------------------- 1 | #include "T.hpp" 2 | #include 3 | 4 | int main() 5 | { 6 | ANTLR_USING_NAMESPACE(std) 7 | ANTLR_USING_NAMESPACE(antlr) 8 | try { 9 | T lexer(cin); 10 | bool done = false; 11 | while ( !done ) { 12 | RefToken t = lexer.nextToken(); 13 | cout << "Token: " << t->toString() << endl; 14 | if ( t->getType()==Token::EOF_TYPE ) { 15 | done = true; 16 | } 17 | } 18 | cout << "done lexing..." << endl; 19 | } catch(exception& e) { 20 | cerr << "exception: " << e.what() << endl; 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/collections/impl/IntRange.java: -------------------------------------------------------------------------------- 1 | package antlr.collections.impl; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/collections/impl/IntRange.java#1 $ 8 | */ 9 | 10 | public class IntRange { 11 | int begin, end; 12 | 13 | 14 | public IntRange(int begin, int end) { 15 | this.begin = begin; 16 | this.end = end; 17 | } 18 | public String toString() { 19 | return begin+".."+end; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/multiLexer/javalex.g: -------------------------------------------------------------------------------- 1 | class DemoJavaLexer extends Lexer; 2 | options { 3 | k=2; 4 | importVocab = Common; 5 | exportVocab = Java; 6 | } 7 | 8 | tokens { 9 | INT="int"; 10 | } 11 | 12 | JAVADOC_OPEN 13 | : "/**" {Main.selector.push("doclexer");} 14 | ; 15 | 16 | ID : ('a'..'z')+ ; 17 | SEMI: ';' ; 18 | WS : ( ' ' 19 | | '\t' 20 | | '\f' 21 | // handle newlines 22 | | ( "\r\n" // Evil DOS 23 | | '\r' // Macintosh 24 | | '\n' // Unix (the right way) 25 | ) 26 | { newline(); } 27 | ) 28 | { $setType(Token.SKIP); } 29 | ; 30 | 31 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/antlr/TokenStreamException.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_TokenStreamException_hpp__ 2 | #define INC_TokenStreamException_hpp__ 3 | 4 | #include "antlr/config.hpp" 5 | #include "antlr/ANTLRException.hpp" 6 | 7 | ANTLR_BEGIN_NAMESPACE(antlr) 8 | 9 | class TokenStreamException : public ANTLRException { 10 | public: 11 | TokenStreamException() {} 12 | TokenStreamException(const ANTLR_USE_NAMESPACE(std)string& s) 13 | : ANTLRException(s) {} 14 | virtual ~TokenStreamException() throw() {} 15 | }; 16 | 17 | ANTLR_END_NAMESPACE 18 | 19 | #endif //INC_TokenStreamException_hpp__ 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/TokenStreamException.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/TokenStreamException.java#1 $ 8 | */ 9 | 10 | /** 11 | * Anything that goes wrong while generating a stream of tokens. 12 | */ 13 | public class TokenStreamException extends ANTLRException { 14 | public TokenStreamException() { 15 | } 16 | public TokenStreamException(String s) { 17 | super(s); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/Tracer.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class Tracer extends TraceAdapter implements TraceListener { 4 | String indent=""; // TBD: should be StringBuffer 5 | 6 | 7 | protected void dedent() { 8 | if (indent.length() < 2) 9 | indent = ""; 10 | else 11 | indent = indent.substring(2); 12 | } 13 | public void enterRule(TraceEvent e) { 14 | System.out.println(indent+e); 15 | indent(); 16 | } 17 | public void exitRule(TraceEvent e) { 18 | dedent(); 19 | System.out.println(indent+e); 20 | } 21 | protected void indent() { 22 | indent += " "; 23 | } 24 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/filter/Test.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import antlr.*; 3 | 4 | class Test { 5 | public static void main(String[] args) { 6 | try { 7 | T lexer = new T(new DataInputStream(System.in)); 8 | boolean done = false; 9 | while ( !done ) { 10 | Token t = lexer.nextToken(); 11 | System.out.println("Token: "+t); 12 | if ( t.getType()==Token.EOF_TYPE ) { 13 | done = true; 14 | } 15 | } 16 | System.out.println("done lexing..."); 17 | } catch(Exception e) { 18 | System.err.println("exception: "+e); 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/Event.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | import java.util.EventObject; 4 | 5 | public abstract class Event extends EventObject { 6 | private int type; 7 | 8 | 9 | public Event(Object source) { 10 | super(source); 11 | } 12 | public Event(Object source, int type) { 13 | super(source); 14 | setType(type); 15 | } 16 | public int getType() { 17 | return type; 18 | } 19 | void setType(int type) { 20 | this.type = type; 21 | } 22 | /** This should NOT be called from anyone other than ParserEventSupport! */ 23 | void setValues(int type) { 24 | setType(type); 25 | } 26 | } -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/SyntacticPredicateEvent.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class SyntacticPredicateEvent extends GuessingEvent { 4 | 5 | 6 | public SyntacticPredicateEvent(Object source) { 7 | super(source); 8 | } 9 | public SyntacticPredicateEvent(Object source, int type) { 10 | super(source, type); 11 | } 12 | /** This should NOT be called from anyone other than ParserEventSupport! */ 13 | void setValues(int type, int guessing) { 14 | super.setValues(type, guessing); 15 | } 16 | public String toString() { 17 | return "SyntacticPredicateEvent [" + getGuessing() + "]"; 18 | } 19 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/filterWithRule/Test.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import antlr.*; 3 | 4 | class Test { 5 | public static void main(String[] args) { 6 | try { 7 | T lexer = new T(new DataInputStream(System.in)); 8 | boolean done = false; 9 | while ( !done ) { 10 | Token t = lexer.nextToken(); 11 | System.out.println("Token: "+t); 12 | if ( t.getType()==Token.EOF_TYPE ) { 13 | done = true; 14 | } 15 | } 16 | System.out.println("done lexing..."); 17 | } catch(Exception e) { 18 | System.err.println("exception: "+e); 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ANTLRTokdefParserTokenTypes.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* 4 | * ANTLR-generated file resulting from grammar tokdef.g 5 | * 6 | * Terence Parr, MageLang Institute 7 | * ANTLR Version 2.7.0a2; 1989-1999 8 | */ 9 | public interface ANTLRTokdefParserTokenTypes { 10 | int EOF = 1; 11 | int NULL_TREE_LOOKAHEAD = 3; 12 | int ID = 4; 13 | int STRING = 5; 14 | int ASSIGN = 6; 15 | int LPAREN = 7; 16 | int RPAREN = 8; 17 | int INT = 9; 18 | int WS = 10; 19 | int SL_COMMENT = 11; 20 | int ML_COMMENT = 12; 21 | int ESC = 13; 22 | int DIGIT = 14; 23 | int XDIGIT = 15; 24 | int VOCAB = 16; 25 | } -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/DefaultFileLineFormatter.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/DefaultFileLineFormatter.java#1 $ 8 | */ 9 | 10 | public class DefaultFileLineFormatter extends FileLineFormatter { 11 | public String getFormatString(String fileName, int line) { 12 | if ( fileName != null ) { 13 | return fileName+":"+line+": "; 14 | } 15 | else { 16 | return "line "+line+": "; 17 | } 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/try.bas: -------------------------------------------------------------------------------- 1 | PROGRAM ( ChainParameterString$ , DebugMode% ) 2 | 3 | 4 | a$="hello" 5 | 6 | x%=2 7 | 8 | 9 | do until x%=5 10 | x% = x% +1 11 | print x% 12 | loop 13 | 14 | do 15 | x%=x%+1 16 | print x%,x%,"To Java Programmer",a$ 17 | 18 | loop until x%=7 19 | 20 | if x% = 1 then 21 | 22 | print 21 23 | 24 | else if x% = 2 then 25 | 26 | print 22 27 | 28 | else if x% = 5 then 29 | 30 | print 23 31 | 32 | else 33 | print 24 34 | 35 | end if 36 | 37 | for x%=1 to 3 38 | y%=x% 39 | print x% , y%+2 40 | next x% 41 | 42 | y% = 2 43 | 44 | end 45 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/treewalk/Main.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import antlr.DumpASTVisitor; 3 | 4 | class Main { 5 | public static void main(String[] args) { 6 | try { 7 | LangLexer lexer = new LangLexer(new DataInputStream(System.in)); 8 | LangParser parser = new LangParser(lexer); 9 | parser.block(); 10 | System.out.println(parser.getAST().toStringList()); 11 | LangWalker walker = new LangWalker(); 12 | walker.block(parser.getAST()); // walk tree 13 | System.out.println("done walking"); 14 | } catch(Exception e) { 15 | System.err.println("exception: "+e); 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/multiLexer/Main.module: -------------------------------------------------------------------------------- 1 | -o main main.sa 2 | 3 | ../../../lib/sather/Library.module 4 | 5 | -has DEMO_JAVA_LEXER.sa DEMO_JAVA_LEXER 6 | -has DEMO_JAVA_PARSER.sa DEMO_JAVA_PARSER 7 | -has DEMO_JAVA_PARSER_TOKENTYPES.sa DEMO_JAVA_PARSER_TOKENTYPES 8 | -has DEMO_JAVADOC_LEXER.sa DEMO_JAVADOC_LEXER 9 | -has DEMO_JAVADOC_PARSER.sa DEMO_JAVADOC_PARSER 10 | -has DEMO_JAVADOC_PARSER_TOKENTYPES.sa DEMO_JAVADOC_PARSER_TOKENTYPES 11 | -has JAVA_TOKENTYPES.sa JAVA_TOKENTYPES 12 | -has JAVADOC_TOKENTYPES.sa JAVADOC_TOKENTYPES 13 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/tree_parser_shared_input_state.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/tree_parser_shared_input_state.sa#1 $ 8 | 9 | *) 10 | 11 | class ANTLR_TREE_PARSER_SHARED_INPUT_STATE is 12 | -- are we guessing? 13 | attr guessing : INT; 14 | 15 | create : SAME is 16 | res : SAME := new; 17 | res.guessing := 0; 18 | return res; 19 | end; 20 | 21 | end; 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/filterWithRule/t.g: -------------------------------------------------------------------------------- 1 | options { 2 | language = "Sather"; 3 | } 4 | 5 | class T extends Lexer; 6 | options { 7 | k=2; 8 | filter=IGNORE; 9 | charVocabulary = '\3'..'\177'; 10 | } 11 | 12 | { 13 | -- used here temporarily to circumvent translation of 14 | -- the "#OUT" in the IGNORE action. 15 | println( msg: STR ) is 16 | #OUT + msg + "\n"; 17 | end; 18 | } 19 | 20 | P : "

" ; 21 | BR: "
" ; 22 | 23 | protected 24 | IGNORE 25 | : '<' (~'>')* '>' { println( "invalid tag: " + %getText ); } 26 | | ( "\r\n" | '\r' | '\n' ) {newline;} 27 | | . 28 | ; 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/antlr/CharStreamIOException.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_CharStreamIOException_hpp__ 2 | #define INC_CharStreamIOException_hpp__ 3 | 4 | #include "antlr/config.hpp" 5 | #include "antlr/CharStreamException.hpp" 6 | 7 | ANTLR_BEGIN_NAMESPACE(antlr) 8 | 9 | class CharStreamIOException : public CharStreamException { 10 | public: 11 | ANTLR_USE_NAMESPACE(std)exception io; 12 | 13 | CharStreamIOException(ANTLR_USE_NAMESPACE(std)exception& e) 14 | : CharStreamException(e.what()), io(e) {} 15 | ~CharStreamIOException() throw() {} 16 | }; 17 | 18 | ANTLR_END_NAMESPACE 19 | 20 | #endif //INC_CharStreamIOException_hpp__ 21 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/contrib/MSCV6/README: -------------------------------------------------------------------------------- 1 | To: antlr-interest@egroups.com 2 | From: "Millaway, John" 3 | Date: Wed, 5 Jul 2000 10:13:31 -0400 4 | 5 | > Can someone tell me where how to build antlr CPP Library with 6 | > MS Visual C++? 7 | > Where can I get the workspace? Thanks 8 | 9 | Here is a project/workspace that will make antlr.lib and antlrd.lib. Put 10 | these in your antrl-2xxx/lib/cpp directory. 11 | 12 | The steps to build the libs yourself are simple: 13 | 1. Create a win32 static library project. 14 | 2. Enable RTTI. 15 | 3. Add the .cpp and .hpp files to the project. 16 | 17 | -John 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/file_line_formatter.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/file_line_formatter.sa#1 $ 8 | 9 | *) 10 | 11 | class ANTLR_FILE_LINE_FORMATTER is 12 | 13 | format_string( file_name : STR , line : INT ) : STR is 14 | if ( void(file_name) ) then 15 | return "line(" + line + "), "; 16 | else 17 | return file_name + ": line(" + line + "), "; 18 | end; 19 | end; 20 | 21 | end; 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/StringLiteralSymbol.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/StringLiteralSymbol.java#1 $ 8 | */ 9 | 10 | class StringLiteralSymbol extends TokenSymbol { 11 | protected String label; // was this string literal labeled? 12 | 13 | 14 | public StringLiteralSymbol(String r) { 15 | super(r); 16 | } 17 | public String getLabel() { return label; } 18 | public void setLabel(String label) {this.label = label;} 19 | } 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/char_stream_exception.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/char_stream_exception.sa#1 $ 8 | 9 | *) 10 | 11 | -- Anything that goes wrong while generating a stream of characters 12 | abstract class $ANTLR_CHAR_STREAM_EXCEPTION < $ANTLR_EXCEPTION is 13 | str : STR; 14 | message : STR; 15 | end; 16 | 17 | class ANTLR_CHAR_STREAM_EXCEPTION < $ANTLR_CHAR_STREAM_EXCEPTION is 18 | include ANTLR_EXCEPTION; 19 | end; 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/token_stream_exception.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/token_stream_exception.sa#1 $ 8 | 9 | *) 10 | 11 | -- Anything that goes wrong while generating a stream of tokens. 12 | abstract class $ANTLR_TOKEN_STREAM_EXCEPTION < $ANTLR_EXCEPTION is 13 | str : STR; 14 | message : STR; 15 | end; 16 | 17 | class ANTLR_TOKEN_STREAM_EXCEPTION < $ANTLR_TOKEN_STREAM_EXCEPTION is 18 | include ANTLR_EXCEPTION; 19 | end; 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/TokenStreamRetryException.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/TokenStreamRetryException.java#1 $ 8 | */ 9 | 10 | /** 11 | * Aborted recognition of current token. Try to get one again. 12 | * Used by TokenStreamSelector.retry() to force nextToken() 13 | * of stream to re-enter and retry. 14 | */ 15 | public class TokenStreamRetryException extends TokenStreamException { 16 | public TokenStreamRetryException() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /zdk/zls/zlang/data/t2.z: -------------------------------------------------------------------------------- 1 | extern string GstringDefaultDomain; 2 | extern table GetIPv4Address(string stringHostName); 3 | 4 | string GstringHostName; 5 | 6 | sdword GetIPv4AddressCount(string stringHostName) 7 | { 8 | string stringLookup = GstringDefaultDomain + GstringHostName; 9 | table tableAddresses; 10 | tableAddresses = GetIPv4Address(stringLookup); 11 | return 8; 12 | } 13 | 14 | static bool foo() 15 | { 16 | table asdw; 17 | sdword sdw; 18 | udword udw; 19 | double df; 20 | 21 | asdw[1] = udw + asdw[1] + df; 22 | asdw[1] = sdw; 23 | udw = (udword)asdw[1]; 24 | 25 | return true; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/CharFormatter.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/CharFormatter.java#1 $ 8 | */ 9 | 10 | /** Interface used by BitSet to format elements of the set when 11 | * converting to string 12 | */ 13 | public interface CharFormatter { 14 | 15 | 16 | public String escapeChar(int c, boolean forCharLiteral); 17 | public String escapeString(String s); 18 | public String literalChar(int c); 19 | public String literalString(String s); 20 | } 21 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/CharStreamIOException.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/CharStreamIOException.java#1 $ 8 | */ 9 | 10 | import java.io.IOException; 11 | 12 | /** 13 | * Wrap an IOException in a CharStreamException 14 | */ 15 | public class CharStreamIOException extends CharStreamException { 16 | public IOException io; 17 | 18 | public CharStreamIOException(IOException io) { 19 | super(io.getMessage()); 20 | this.io = io; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/GuessingEvent.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public abstract class GuessingEvent extends Event { 4 | private int guessing; 5 | 6 | 7 | public GuessingEvent(Object source) { 8 | super(source); 9 | } 10 | public GuessingEvent(Object source, int type) { 11 | super(source, type); 12 | } 13 | public int getGuessing() { 14 | return guessing; 15 | } 16 | void setGuessing(int guessing) { 17 | this.guessing = guessing; 18 | } 19 | /** This should NOT be called from anyone other than ParserEventSupport! */ 20 | void setValues(int type, int guessing) { 21 | super.setValues(type); 22 | setGuessing(guessing); 23 | } 24 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/columns/column.g: -------------------------------------------------------------------------------- 1 | // adapted from snippet sent to the antlr-interest list by Remi Koutcherawy 2 | options { 3 | language="Cpp"; 4 | } 5 | 6 | { 7 | #include "L.hpp" 8 | 9 | int main( void ) 10 | { 11 | L lexer(cin); 12 | P parser(lexer); 13 | 14 | parser.start(); 15 | } 16 | } 17 | class P extends Parser; 18 | start 19 | : ((t:NB 20 | { cout << "\"" << t->getText() << "\"" 21 | << " line " << t->getLine() << " col " << t->getColumn() 22 | << endl; 23 | } 24 | )* NL)* 25 | ; 26 | 27 | class L extends Lexer; 28 | NL : '\n' {newline();} 29 | ; 30 | NB : ('0'..'9') 31 | ; 32 | 33 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/GrammarSymbol.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/GrammarSymbol.java#1 $ 8 | */ 9 | 10 | /**A GrammarSymbol is a generic symbol that can be 11 | * added to the symbol table for a grammar. 12 | */ 13 | abstract class GrammarSymbol { 14 | protected String id; 15 | 16 | public GrammarSymbol() {} 17 | public GrammarSymbol(String s) { id = s; } 18 | public String getId() { return id; } 19 | public void setId(String s) { id = s; } 20 | } 21 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/pascal/P_4_5.PAS: -------------------------------------------------------------------------------- 1 | { program 4.5 2 | compute the cosine using the expansion: 3 | cos(x) = 1 - x**2/(2*1) + x**4/(4*3*2*1) - ... } 4 | 5 | program cosine(input, output); 6 | 7 | const 8 | eps = 1e-14; 9 | 10 | var 11 | x, sx, s, t : real; 12 | i, k, n : integer; 13 | 14 | begin 15 | read(n); 16 | for i:=1 to n do 17 | begin 18 | read(x); 19 | t := 1; k := 0; s := 1; sx := sqr(x); 20 | while abs(t) > eps*abs(s) do 21 | begin 22 | k := k+2; 23 | t := -t*sx/(k*(k-1)); 24 | s := s+t; 25 | wnd; { error here! } 26 | writeln(x,s,k div 2) 27 | end 28 | end. 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ANTLRError.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/ANTLRError.java#1 $ 8 | */ 9 | 10 | public class ANTLRError extends Error { 11 | 12 | /** 13 | * ANTLRError constructor comment. 14 | */ 15 | public ANTLRError() { 16 | super(); 17 | } 18 | 19 | /** 20 | * ANTLRError constructor comment. 21 | * @param s java.lang.String 22 | */ 23 | public ANTLRError(String s) { 24 | super(s); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/CharStreamException.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/CharStreamException.java#1 $ 8 | */ 9 | 10 | /** 11 | * Anything that goes wrong while generating a stream of characters 12 | */ 13 | public class CharStreamException extends ANTLRException { 14 | /** 15 | * CharStreamException constructor comment. 16 | * @param s java.lang.String 17 | */ 18 | public CharStreamException(String s) { 19 | super(s); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/NewLineEvent.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class NewLineEvent extends Event { 4 | private int line; 5 | 6 | 7 | public NewLineEvent(Object source) { 8 | super(source); 9 | } 10 | public NewLineEvent(Object source, int line) { 11 | super(source); 12 | setValues(line); 13 | } 14 | public int getLine() { 15 | return line; 16 | } 17 | void setLine(int line) { 18 | this.line = line; 19 | } 20 | /** This should NOT be called from anyone other than ParserEventSupport! */ 21 | void setValues(int line) { 22 | setLine(line); 23 | } 24 | public String toString() { 25 | return "NewLineEvent [" + line + "]"; 26 | } 27 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/pascal/P_0_1.PAS: -------------------------------------------------------------------------------- 1 | { program 0.1 2 | assuming annual inflation rates of 7, 8, and 10 per cent, 3 | find the factor by which the frank, dollar, pound 4 | sterlinh, mark, or guilder will have been devalued in 5 | 1, 2, ... n years.} 6 | 7 | program inflation(output); 8 | 9 | const 10 | n = 10; 11 | var 12 | i : integer; 13 | w1, w2, w3 : real; 14 | 15 | begin 16 | i := 0; 17 | w1 := 1.0; 18 | w2 := 1.0; 19 | w3 := 1.0; 20 | 21 | repeat 22 | i := i + 1; 23 | w1 := w1 * 1.07; 24 | w2 := w2 * 1.08; 25 | w3 := w3 * 1.10; 26 | writeln(i, w1, w2, w3); 27 | until i=n 28 | end. 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/HTML/Main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Simple class for testing antlr-generated HTML parser/lexer. 3 | Alexander Hinds, Magelang Institute 4 | ahinds@magelang.com 5 | 6 | */ 7 | 8 | #include 9 | #include "HTMLLexer.hpp" 10 | #include "HTMLParser.hpp" 11 | #include "antlr/TokenBuffer.hpp" 12 | 13 | int main(int argc,char* argv[]) 14 | { 15 | ANTLR_USING_NAMESPACE(std) 16 | ANTLR_USING_NAMESPACE(antlr) 17 | try { 18 | HTMLLexer lexer(cin); 19 | TokenBuffer buffer(lexer); 20 | HTMLParser parser(buffer); 21 | parser.document(); 22 | } catch(exception& e) { 23 | cerr << "exception: " << e.what() << endl; 24 | return 1; 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/imagNodeAST/Main.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import antlr.DumpASTVisitor; 3 | 4 | class Main { 5 | public static void main(String[] args) { 6 | try { 7 | LangLexer lexer = new LangLexer(new DataInputStream(System.in)); 8 | LangParser parser = new LangParser(lexer); 9 | parser.block(); 10 | antlr.CommonAST a = (antlr.CommonAST)parser.getAST(); 11 | System.out.println(a.toStringList()); 12 | LangWalker walker = new LangWalker(); 13 | walker.block(a); // walk tree 14 | System.out.println("done walking"); 15 | } catch(Exception e) { 16 | System.err.println("exception: "+e); 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/contrib/MSCV6/libcpp.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "libcpp"=".\libcpp.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/exception.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/exception.sa#1 $ 8 | 9 | *) 10 | 11 | abstract class $ANTLR_EXCEPTION < $STR is 12 | str : STR; 13 | end; 14 | 15 | class ANTLR_EXCEPTION < $ANTLR_EXCEPTION is 16 | attr str : STR; 17 | 18 | message : STR is 19 | return str; 20 | end; 21 | 22 | create ( s : STR ) : SAME is 23 | res ::= new; 24 | res.str := s; 25 | return res; 26 | end; 27 | 28 | end; 29 | 30 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/imagNodeAST/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "LangLexer.hpp" 3 | #include "LangParser.hpp" 4 | #include "LangWalker.hpp" 5 | 6 | int main() 7 | { 8 | ANTLR_USING_NAMESPACE(std) 9 | ANTLR_USING_NAMESPACE(antlr) 10 | try { 11 | LangLexer lexer(cin); 12 | LangParser parser(lexer); 13 | parser.block(); 14 | // antlr.CommonAST a = (antlr.CommonAST)parser.getAST(); 15 | RefAST a = parser.getAST(); 16 | cout << a->toStringList() << endl; 17 | LangWalker walker; 18 | walker.block(a); // walk tree 19 | cout << "done walking" << endl; 20 | } catch(exception& e) { 21 | cout << "exception: "<< e.what() << endl; 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/heteroAST/BinaryOperatorAST.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_BinaryOperatorAST_hpp__ 2 | #define INC_BinaryOperatorAST_hpp__ 3 | 4 | //#include "antlr/ASTNode.hpp" 5 | #include "antlr/AST.hpp" 6 | #include "CalcAST.hpp" 7 | 8 | class BinaryOperatorAST : public CalcAST { 9 | public: 10 | RefCalcAST left() const 11 | { 12 | return RefCalcAST(getFirstChild()); 13 | } 14 | 15 | RefCalcAST right() const 16 | { 17 | RefCalcAST t = left(); 18 | if ( !t ) return t; 19 | return RefCalcAST(t->getNextSibling()); 20 | } 21 | }; 22 | 23 | typedef ANTLR_USE_NAMESPACE(antlr)ASTRefCount RefBinaryOperatorAST; 24 | 25 | #endif //INC_BinaryOperatorAST_hpp__ 26 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/multiLexer/javalex.g: -------------------------------------------------------------------------------- 1 | options { 2 | language = "Sather"; 3 | } 4 | 5 | class DEMO_JAVA_LEXER extends Lexer; 6 | options { 7 | k=2; 8 | importVocab = Common; 9 | exportVocab = JAVA; 10 | } 11 | 12 | tokens { 13 | INT="int"; 14 | } 15 | 16 | JAVADOC_OPEN 17 | : "/**" {MAIN::selector.push("javadoc");} 18 | ; 19 | 20 | ID : ('a'..'z')+ ; 21 | SEMI: ';' ; 22 | WS : ( ' ' 23 | | '\t' 24 | | '\f' 25 | // handle newlines 26 | | ( "\r\n" // Evil DOS 27 | | '\r' // Macintosh 28 | | '\n' // Unix (the right way) 29 | ) 30 | { newline; } 31 | ) 32 | { %setType(ANTLR_COMMON_TOKEN::SKIP); } 33 | ; 34 | 35 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/TreeParserSharedInputState.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/TreeParserSharedInputState.java#1 $ 8 | */ 9 | 10 | /** This object contains the data associated with an 11 | * input AST. Multiple parsers 12 | * share a single TreeParserSharedInputState to parse 13 | * the same tree or to have the parser walk multiple 14 | * trees. 15 | */ 16 | public class TreeParserSharedInputState { 17 | /** Are we guessing (guessing>0)? */ 18 | public int guessing = 0; 19 | } 20 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/antlr/TokenStreamIOException.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_TokenStreamIOException_hpp__ 2 | #define INC_TokenStreamIOException_hpp__ 3 | 4 | #include "antlr/config.hpp" 5 | #include "antlr/TokenStreamException.hpp" 6 | #include 7 | 8 | ANTLR_BEGIN_NAMESPACE(antlr) 9 | 10 | class TokenStreamIOException : public TokenStreamException { 11 | public: 12 | ANTLR_USE_NAMESPACE(std)exception io; 13 | 14 | TokenStreamIOException() {} 15 | TokenStreamIOException(const ANTLR_USE_NAMESPACE(std)exception& e) 16 | : TokenStreamException(e.what()), io(e) {} 17 | ~TokenStreamIOException() throw() {} 18 | }; 19 | 20 | ANTLR_END_NAMESPACE 21 | 22 | #endif //INC_TokenStreamIOException_hpp__ 23 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/antlr/TokenStreamRecognitionException.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_TokenStreamRecognitionException_hpp__ 2 | #define INC_TokenStreamRecognitionException_hpp__ 3 | 4 | #include "antlr/config.hpp" 5 | #include "antlr/TokenStreamException.hpp" 6 | #include 7 | 8 | ANTLR_BEGIN_NAMESPACE(antlr) 9 | 10 | class TokenStreamRecognitionException : public TokenStreamException { 11 | public: 12 | RecognitionException recog; 13 | 14 | TokenStreamRecognitionException(RecognitionException& re) 15 | : TokenStreamException(re.getMessage()), recog(re) {} 16 | ~TokenStreamRecognitionException() throw() {} 17 | }; 18 | 19 | ANTLR_END_NAMESPACE 20 | 21 | #endif //INC_TokenStreamRecognitionException_hpp__ 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/TokenStreamRecognitionException.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/TokenStreamRecognitionException.java#1 $ 8 | */ 9 | 10 | /** 11 | * Wraps a RecognitionException in a TokenStreamException so you 12 | * can pass it along. 13 | */ 14 | public class TokenStreamRecognitionException extends TokenStreamException { 15 | public RecognitionException recog; 16 | public TokenStreamRecognitionException(RecognitionException re) { 17 | super(re.getMessage()); 18 | this.recog = re; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/lexRewrite/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | lexer ::= #REWRITE{ANTLR_COMMON_TOKEN}( f ); 17 | 18 | protect 19 | lexer.mSTART(true); 20 | lexer.println( "result Token=" + lexer.token.str ); 21 | when $ANTLR_RECOGNITION_EXCEPTION then 22 | #ERR + "exception: " + exception.str; 23 | end; 24 | 25 | end; 26 | end; 27 | 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/parseBinary/data.g: -------------------------------------------------------------------------------- 1 | options { 2 | language = "Sather"; 3 | } 4 | 5 | class DATA_PARSER extends Parser; 6 | { 7 | println ( s : STR ) is 8 | #OUT + s + "\n"; 9 | end; 10 | } 11 | 12 | file: ( sh:SHORT {println(sh.text);} 13 | | st:STRING {println("\"" + st.text + "\"");} 14 | )+ 15 | ; 16 | 17 | class DATA_LEXER extends Lexer; 18 | options { 19 | charVocabulary = '\u0000'..'\u00FF'; 20 | } 21 | 22 | SHORT 23 | : '\0' high:. lo:. 24 | { 25 | v : INT := high.int.lshift(8) + lo.int; 26 | %setText(""+v); 27 | } 28 | ; 29 | 30 | STRING 31 | : '\1'! // begin string (discard) 32 | ( ~'\2' )* 33 | '\2'! // end string (discard) 34 | ; 35 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/InputBufferAdapter.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | /** A dummy implementation of a CharBufferListener -- this class is not 4 | * meant to be used by itself -- it's meant to be subclassed */ 5 | public abstract class InputBufferAdapter implements InputBufferListener { 6 | 7 | 8 | public void doneParsing(TraceEvent e) { 9 | } 10 | /** 11 | * charConsumed method comment. 12 | */ 13 | public void inputBufferConsume(InputBufferEvent e) { 14 | } 15 | /** 16 | * charLA method comment. 17 | */ 18 | public void inputBufferLA(InputBufferEvent e) { 19 | } 20 | public void inputBufferMark(InputBufferEvent e) {} 21 | public void inputBufferRewind(InputBufferEvent e) {} 22 | public void refresh() { 23 | } 24 | } -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/token_stream_retry_exception.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/token_stream_retry_exception.sa#1 $ 8 | 9 | *) 10 | 11 | -- Aborted recognition of current token. Try to get one again. 12 | -- Used by ANTLR_TOKEN_STREAM_SELECTOR::retry to force next_token 13 | -- of stream to re-enter and retry. 14 | 15 | class ANTLR_TOKEN_STREAM_RETRY_EXCEPTION < $ANTLR_TOKEN_STREAM_EXCEPTION is 16 | include ANTLR_TOKEN_STREAM_EXCEPTION; 17 | 18 | create : SAME is 19 | return #SAME(""); 20 | end; 21 | end; 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/ExceptionHandler.java#1 $ 8 | */ 9 | 10 | class ExceptionHandler { 11 | // Type of the ANTLR exception class to catch and the variable decl 12 | protected Token exceptionTypeAndName; 13 | // The action to be executed when the exception is caught 14 | protected Token action; 15 | 16 | 17 | public ExceptionHandler(Token exceptionTypeAndName_, 18 | Token action_) { 19 | exceptionTypeAndName = exceptionTypeAndName_; 20 | action = action_; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/FileLineFormatter.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/FileLineFormatter.java#2 $ 8 | */ 9 | 10 | public abstract class FileLineFormatter { 11 | 12 | private static FileLineFormatter formatter = new DefaultFileLineFormatter(); 13 | 14 | public static FileLineFormatter getFormatter() { 15 | return formatter; 16 | } 17 | 18 | public static void setFormatter(FileLineFormatter f) { 19 | formatter = f; 20 | } 21 | 22 | public abstract String getFormatString(String fileName, int line); 23 | } 24 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/TokenStreamIOException.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/TokenStreamIOException.java#1 $ 8 | */ 9 | 10 | import java.io.IOException; 11 | 12 | /** 13 | * Wraps an IOException in a TokenStreamException 14 | */ 15 | public class TokenStreamIOException extends TokenStreamException { 16 | public IOException io; 17 | /** 18 | * TokenStreamIOException constructor comment. 19 | * @param s java.lang.String 20 | */ 21 | public TokenStreamIOException(IOException io) { 22 | super(io.getMessage()); 23 | this.io = io; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/collections/impl/LLCell.java: -------------------------------------------------------------------------------- 1 | package antlr.collections.impl; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/collections/impl/LLCell.java#1 $ 8 | */ 9 | 10 | /**A linked list cell, which contains a ref to the object and next cell. 11 | * The data,next members are public to this class, but not outside the 12 | * collections.impl package. 13 | * 14 | * @author Terence Parr 15 | * MageLang Institute 16 | */ 17 | class LLCell { 18 | Object data; 19 | LLCell next; 20 | 21 | 22 | public LLCell(Object o) { data=o; } 23 | } 24 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/HTML/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | Simple class for testing antlr-generated HTML parser/lexer. 3 | Alexander Hinds, Magelang Institute 4 | ahinds@magelang.com 5 | 6 | */ 7 | 8 | 9 | import java.io.*; 10 | import antlr.*; 11 | import HTMLLexer; 12 | import HTMLParser; 13 | 14 | public class Main { 15 | public static void main(String[] args) { 16 | try { 17 | HTMLLexer lexer = new HTMLLexer(new DataInputStream(System.in)); 18 | TokenBuffer buffer = new TokenBuffer(lexer); 19 | HTMLParser parser = new HTMLParser(buffer); 20 | parser.document(); 21 | } catch(Exception e) { 22 | System.err.println("exception: "+e); 23 | System.exit(1); 24 | } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/IDL/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #IDL_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | parser ::= #IDL_PARSER{ANTLR_COMMON_TOKEN,ANTLR_COMMON_AST}( lexer ); 19 | 20 | parser.specification; 21 | 22 | when $ANTLR_RECOGNITION_EXCEPTION then 23 | #ERR + "exception: " + exception.str + "\n"; 24 | end; 25 | 26 | end; 27 | end; 28 | 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/parseBinary/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #DATA_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | parser ::= #DATA_PARSER{ANTLR_COMMON_TOKEN,ANTLR_COMMON_AST}( lexer ); 19 | 20 | parser.file; 21 | 22 | when $ANTLR_RECOGNITION_EXCEPTION then 23 | #ERR + "exception: " + exception.str + "\n"; 24 | end; 25 | 26 | end; 27 | end; 28 | 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/collections/Enumerator.java: -------------------------------------------------------------------------------- 1 | package antlr.collections; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/collections/Enumerator.java#1 $ 8 | */ 9 | 10 | public interface Enumerator { 11 | /**Return the element under the cursor; return null if !valid() or 12 | * if called before first next() call. 13 | */ 14 | public Object cursor(); 15 | /**Return the next element in the enumeration; first call to next() 16 | * returns the first element. 17 | */ 18 | public Object next(); 19 | /**Any more elements in the enumeration? */ 20 | public boolean valid(); 21 | } 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/heteroAST/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "CalcLexer.hpp" 3 | #include "CalcParser.hpp" 4 | #include "CalcAST.hpp" 5 | 6 | int main() 7 | { 8 | ANTLR_USING_NAMESPACE(std) 9 | ANTLR_USING_NAMESPACE(antlr) 10 | 11 | try { 12 | CalcLexer lexer(cin); 13 | CalcParser parser(lexer); 14 | // Parse the input expression 15 | parser.expr(); 16 | RefCalcAST t = RefCalcAST(parser.getAST()); 17 | 18 | // Print the resulting tree out in LISP notation 19 | cout << t->toStringTree() << endl; 20 | 21 | // Compute value and return 22 | int r = t->value(); 23 | cout << "value is " << r << endl; 24 | } catch(exception& e) { 25 | cerr << "exception: " << e.what() << endl; 26 | // e.printStackTrace(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/multiParser/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "SimpleLexer.hpp" 3 | #include "SimpleParser.hpp" 4 | #include "SimpleParser2.hpp" 5 | #include "antlr/TokenBuffer.hpp" 6 | 7 | int main() 8 | { 9 | using namespace std; 10 | try { 11 | SimpleLexer lexer(cin); 12 | TokenBuffer buffer(lexer); 13 | 14 | /* Invoke first parser */ 15 | cout << "first parser" << endl; 16 | SimpleParser parser(buffer); 17 | parser.simple(); 18 | 19 | /* When first parser runs out, invoke secnond parser */ 20 | cout << "second parser" << endl; 21 | SimpleParser2 parser2(buffer); 22 | parser2.simple(); 23 | 24 | } catch(exception& e) { 25 | cerr << "exception: " << e.what() << endl; 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/SynPredBlock.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/SynPredBlock.java#1 $ 8 | */ 9 | 10 | class SynPredBlock extends AlternativeBlock { 11 | 12 | 13 | public SynPredBlock(Grammar g) { 14 | super(g); 15 | } 16 | public SynPredBlock(Grammar g, int line) { 17 | super(g, line, false); 18 | } 19 | public void generate() { 20 | grammar.generator.gen(this); 21 | } 22 | public Lookahead look(int k) { 23 | return grammar.theLLkAnalyzer.look(k, this); 24 | } 25 | public String toString() { 26 | return super.toString() + "=>"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ActionTransInfo.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/ActionTransInfo.java#1 $ 8 | */ 9 | 10 | /** 11 | * This class contains information about how an action 12 | * was translated (using the AST conversion rules). 13 | */ 14 | public class ActionTransInfo { 15 | public boolean assignToRoot = false; // somebody did a "#rule = " 16 | public String refRuleRoot = null; // somebody referenced #rule; string is translated var 17 | 18 | 19 | public String toString() { 20 | return "assignToRoot:"+assignToRoot+", refRuleRoot:"+refRuleRoot; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/transform/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "CalcLexer.hpp" 3 | #include "CalcParser.hpp" 4 | #include "CalcTreeWalker.hpp" 5 | 6 | int main() 7 | { 8 | ANTLR_USING_NAMESPACE(std) 9 | ANTLR_USING_NAMESPACE(antlr) 10 | try { 11 | CalcLexer lexer(cin); 12 | CalcParser parser(lexer); 13 | // Parse the input expression 14 | parser.expr(); 15 | RefAST t = parser.getAST(); 16 | // Print the resulting tree out in LISP notation 17 | cout << t->toStringList() << endl; 18 | CalcTreeWalker walker; 19 | // Traverse the tree created by the parser 20 | walker.expr(t); 21 | t = walker.getAST(); 22 | cout << t->toStringList() << endl; 23 | } catch(exception& e) { 24 | cerr << "exception: " << e.what() << endl; 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/OneOrMoreBlock.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/OneOrMoreBlock.java#1 $ 8 | */ 9 | 10 | class OneOrMoreBlock extends BlockWithImpliedExitPath { 11 | 12 | 13 | public OneOrMoreBlock(Grammar g) { 14 | super(g); 15 | } 16 | public OneOrMoreBlock(Grammar g, int line) { 17 | super(g, line); 18 | } 19 | public void generate() { 20 | grammar.generator.gen(this); 21 | } 22 | public Lookahead look(int k) { 23 | return grammar.theLLkAnalyzer.look(k, this); 24 | } 25 | public String toString() { 26 | return super.toString() + "+"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ZeroOrMoreBlock.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/ZeroOrMoreBlock.java#1 $ 8 | */ 9 | 10 | class ZeroOrMoreBlock extends BlockWithImpliedExitPath { 11 | 12 | 13 | public ZeroOrMoreBlock(Grammar g) { 14 | super(g); 15 | } 16 | public ZeroOrMoreBlock(Grammar g, int line) { 17 | super(g, line); 18 | } 19 | public void generate() { 20 | grammar.generator.gen(this); 21 | } 22 | public Lookahead look(int k) { 23 | return grammar.theLLkAnalyzer.look(k, this); 24 | } 25 | public String toString() { 26 | return super.toString() + "*"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/actions/sather/ActionLexerTokenTypes.java: -------------------------------------------------------------------------------- 1 | // $ANTLR 2.7.1: "action.g" -> "ActionLexer.java"$ 2 | 3 | package antlr.actions.sather; 4 | 5 | public interface ActionLexerTokenTypes { 6 | int EOF = 1; 7 | int NULL_TREE_LOOKAHEAD = 3; 8 | int ACTION = 4; 9 | int STUFF = 5; 10 | int AST_ITEM = 6; 11 | int TEXT_ITEM = 7; 12 | int TREE = 8; 13 | int TREE_ELEMENT = 9; 14 | int AST_CONSTRUCTOR = 10; 15 | int AST_CTOR_ELEMENT = 11; 16 | int ID_ELEMENT = 12; 17 | int TEXT_ARG = 13; 18 | int TEXT_ARG_ELEMENT = 14; 19 | int TEXT_ARG_ID_ELEMENT = 15; 20 | int ARG = 16; 21 | int ID = 17; 22 | int VAR_ASSIGN = 18; 23 | int CHAR = 19; 24 | int STRING = 20; 25 | int ESC = 21; 26 | int DIGIT = 22; 27 | int INT = 23; 28 | int INT_OR_FLOAT = 24; 29 | int WS = 25; 30 | } 31 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/byte_buffer.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/byte_buffer.sa#1 $ 8 | 9 | *) 10 | 11 | class ANTLR_BYTE_BUFFER is 12 | 13 | include ANTLR_INPUT_BUFFER; 14 | 15 | create( in : $ISTREAM ) : SAME pre ~void(in) is 16 | res : SAME := new; 17 | res.input := in; 18 | res.init; 19 | return res; 20 | end; 21 | 22 | fill ( amount : INT ) is 23 | sync_consume; 24 | 25 | loop while!( queue.num_entries < amount + marker_offset ); 26 | queue.append( input.get ); 27 | end; 28 | 29 | end; 30 | 31 | 32 | end; 33 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/collections/Stack.java: -------------------------------------------------------------------------------- 1 | package antlr.collections; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/collections/Stack.java#1 $ 8 | */ 9 | 10 | import java.util.NoSuchElementException; 11 | 12 | /** A simple stack definition; restrictive in that you cannot 13 | * access arbitrary stack elements. 14 | * 15 | * @author Terence Parr 16 | * MageLang Institute 17 | */ 18 | public interface Stack { 19 | public int height(); 20 | public Object pop() throws NoSuchElementException; 21 | public void push(Object o); 22 | public Object top() throws NoSuchElementException; 23 | } 24 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/parseBinary/data.g: -------------------------------------------------------------------------------- 1 | options { 2 | language="Cpp"; 3 | } 4 | 5 | { 6 | #include 7 | } 8 | 9 | class DataParser extends Parser; 10 | 11 | file: ( sh:SHORT {std::cout << sh->getText() << std::endl;} 12 | | st:STRING {std::cout << "\"" << st->getText() << "\"" << std::endl;} 13 | )+ 14 | ; 15 | 16 | { 17 | #include "antlr/String.hpp" 18 | } 19 | 20 | class DataLexer extends Lexer; 21 | options { 22 | charVocabulary = '\u0000'..'\u00FF'; 23 | } 24 | 25 | SHORT 26 | : '\0' high:. lo:. 27 | { 28 | ANTLR_USING_NAMESPACE(antlr) // to pick up operator+ 29 | int v = (((int)high)<<8) + lo; 30 | $setText(std::string("")+v); 31 | } 32 | ; 33 | 34 | STRING 35 | : '\1'! // begin string (discard) 36 | ( ~'\2' )* 37 | '\2'! // end string (discard) 38 | ; 39 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/parser_shared_input_state.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/parser_shared_input_state.sa#1 $ 8 | 9 | *) 10 | 11 | class ANTLR_PARSER_SHARED_INPUT_STATE{TOKEN < $ANTLR_TOKEN} is 12 | 13 | -- Where to get token objects 14 | attr input : ANTLR_TOKEN_BUFFER{TOKEN}; 15 | 16 | -- Are we guessing (guessing>0)? 17 | attr guessing : INT; 18 | 19 | -- What file (if known) caused the problem? 20 | attr file_name : STR; 21 | 22 | create : SAME is 23 | res : SAME := new; 24 | res.guessing := 0; 25 | return res; 26 | end; 27 | 28 | end; 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/token_stream_recognition_exception.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/token_stream_recognition_exception.sa#1 $ 8 | 9 | *) 10 | 11 | -- Wraps a ANTLR_RECOGNITION_EXCEPTION in a 12 | -- ANTLR_TOKEN_STREAM_EXCEPTION so you can pass it along. 13 | 14 | abstract class $ANTLR_TOKEN_STREAM_RECOGNITION_EXCEPTION 15 | < $ANTLR_TOKEN_STREAM_EXCEPTION is 16 | str : STR; 17 | message : STR; 18 | end; 19 | 20 | class ANTLR_TOKEN_STREAM_RECOGNITION_EXCEPTION 21 | < $ANTLR_TOKEN_STREAM_RECOGNITION_EXCEPTION is 22 | include ANTLR_TOKEN_STREAM_EXCEPTION; 23 | end; 24 | -------------------------------------------------------------------------------- /zdk/zls/zlang/data/t8.z: -------------------------------------------------------------------------------- 1 | // 测试temp variable和short circuit 2 | 3 | ipaddress func1() 4 | { 5 | return {10.8.8.8}; 6 | } 7 | 8 | 9 | bool Test() 10 | { 11 | sdword sdw1 = 1, sdw2, sdw3, sdw4; 12 | string s1 = ((s1 + s2) + (s3 + s4)) + ((s1 + s2) + (s3 + s4)), s2; 13 | bool b = func1() != func1(); 14 | string s3, s4; 15 | 16 | s3 = ((s1 + s2) + (s3 + s4)) + ((s1 + s2) + (s3 + s4)); 17 | s4 = (s1 + s2) + (s3 + s4); 18 | 19 | b = func1() != func1(); 20 | b = func1() != {a3ws1}; 21 | 22 | if ((sdw1 + sdw2) || (sdw3 + sdw4)) 23 | { 24 | return true; 25 | } 26 | else 27 | { 28 | return false; 29 | } 30 | 31 | sdw1 = (sdw1 + sdw2) || (sdw3 + sdw4); 32 | sdw1 = (sdw1 + sdw2) && (sdw3 + sdw4); 33 | 34 | return true; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/collections/List.java: -------------------------------------------------------------------------------- 1 | package antlr.collections; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/collections/List.java#1 $ 8 | */ 9 | 10 | import java.util.Enumeration; 11 | import java.util.NoSuchElementException; 12 | 13 | /**A simple List interface that describes operations 14 | * on a list. 15 | */ 16 | public interface List { 17 | public void add(Object o); // can insert at head or append. 18 | public void append(Object o); 19 | public Object elementAt(int index) throws NoSuchElementException; 20 | public Enumeration elements(); 21 | public boolean includes(Object o); 22 | public int length(); 23 | } 24 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/tinybasic/DTString.java: -------------------------------------------------------------------------------- 1 | package tinybasic; 2 | 3 | public class DTString extends DTDataType{ 4 | protected String s=null; 5 | 6 | public DTString(Scope scope,DTDataType tbd){ 7 | super(scope,STR_VAR); 8 | this.s=tbd.getString(); 9 | } 10 | 11 | public DTString(Scope scope,String s){ 12 | super(scope,STR_VAR); 13 | this.s=s; 14 | } 15 | 16 | public void setString(String s){ 17 | this.s=s; 18 | } 19 | public String getString(){ 20 | return s; 21 | } 22 | 23 | public int compareTo(Object o){ 24 | return s.compareTo(((DTDataType)o).getString()); 25 | } 26 | 27 | public void assign(DTDataType tbd){ 28 | setString(tbd); 29 | } 30 | 31 | public String toString(){ 32 | return s.toString(); 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/HTML/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #HTML_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | buffer ::= #ANTLR_TOKEN_BUFFER{ANTLR_COMMON_TOKEN}( lexer ); 19 | parser ::= #HTML_PARSER{ANTLR_COMMON_TOKEN,ANTLR_COMMON_AST}( buffer ); 20 | 21 | parser.document; 22 | 23 | when $ANTLR_RECOGNITION_EXCEPTION then 24 | #ERR + "exception: " + exception.str + "\n"; 25 | end; 26 | 27 | end; 28 | end; 29 | 30 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/inherit.tinyc/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #TINYC_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | parser ::= #MYC_PARSER{ANTLR_COMMON_TOKEN,ANTLR_COMMON_AST}( lexer ); 19 | 20 | parser.program; 21 | 22 | t ::= parser.ast; 23 | 24 | #OUT + t.str_list + "\n"; 25 | 26 | when $ANTLR_RECOGNITION_EXCEPTION then 27 | #ERR + "exception: " + exception.str + "\n"; 28 | end; 29 | 30 | end; 31 | end; 32 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/columns/track.g: -------------------------------------------------------------------------------- 1 | class L extends Lexer; 2 | 3 | { 4 | private static boolean done = false; 5 | 6 | public void uponEOF() throws TokenStreamException, CharStreamException { 7 | done=true; 8 | } 9 | 10 | /** set tabs to 4, just round column up to next tab + 1 11 | 12345678901234567890 12 | x x x x 13 | */ 14 | public void tab() { 15 | int t = 4; 16 | int c = getColumn(); 17 | int nc = (((c-1)/t)+1)*t+1; 18 | setColumn( nc ); 19 | } 20 | 21 | public static void main(String[] args) throws Exception { 22 | L lexer = new L(System.in); 23 | while ( !done ) { 24 | Token t = lexer.nextToken(); 25 | System.out.println("Token: "+t); 26 | } 27 | } 28 | } 29 | 30 | INT : ('0'..'9')+ ; 31 | 32 | ID : ('a'..'z')+ ; 33 | 34 | WS : (' '|'\t'|'\n'{newline();})+ {$setType(Token.SKIP);} 35 | ; 36 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/filter/test.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | t ::= #T{ANTLR_COMMON_TOKEN}( f ); 17 | token : $ANTLR_TOKEN; 18 | 19 | protect 20 | loop 21 | token := t.next_token; 22 | if ( token.ttype = T_TOKENTYPES::EOF ) then 23 | break!; 24 | end; 25 | #OUT + token.str + '\n'; 26 | end; 27 | when $ANTLR_RECOGNITION_EXCEPTION then 28 | #ERR + "error: " + exception.str; 29 | end; 30 | 31 | end; 32 | end; 33 | 34 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/BlockWithImpliedExitPath.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/BlockWithImpliedExitPath.java#1 $ 8 | */ 9 | 10 | abstract class BlockWithImpliedExitPath extends AlternativeBlock { 11 | protected int exitLookaheadDepth; // lookahead needed to handle optional path 12 | /** lookahead to bypass block; set 13 | * by deterministic(). 1..k of Lookahead 14 | */ 15 | protected Lookahead[] exitCache = new Lookahead[grammar.maxk+1]; 16 | 17 | 18 | public BlockWithImpliedExitPath(Grammar g) { 19 | super(g); 20 | } 21 | public BlockWithImpliedExitPath(Grammar g, int line) { 22 | super(g, line, false); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/filterWithRule/test.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | t ::= #T{ANTLR_COMMON_TOKEN}( f ); 17 | token : $ANTLR_TOKEN; 18 | 19 | protect 20 | loop 21 | token := t.next_token; 22 | if ( token.ttype = T_TOKENTYPES::EOF ) then 23 | break!; 24 | end; 25 | #OUT + token.str + '\n'; 26 | end; 27 | when $ANTLR_RECOGNITION_EXCEPTION then 28 | #ERR + "error: " + exception.str; 29 | end; 30 | 31 | end; 32 | end; 33 | 34 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/sather/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | 18 | lexer ::= #SATHER_LEXER{ANTLR_COMMON_TOKEN}( f ); 19 | parser ::= #SATHER_PARSER{ANTLR_COMMON_TOKEN, ANTLR_COMMON_AST}( lexer ); 20 | 21 | parser.parse; 22 | 23 | t : ANTLR_COMMON_AST := parser.ast; 24 | 25 | #OUT + t.str_list + "\n"; 26 | 27 | when $ANTLR_EXCEPTION then 28 | #ERR + "exception: " + exception.str + "\n"; 29 | end; 30 | 31 | end; 32 | end; 33 | 34 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ParserSharedInputState.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/ParserSharedInputState.java#1 $ 8 | */ 9 | 10 | /** This object contains the data associated with an 11 | * input stream of tokens. Multiple parsers 12 | * share a single ParserSharedInputState to parse 13 | * the same stream of tokens. 14 | */ 15 | public class ParserSharedInputState { 16 | /** Where to get token objects */ 17 | protected TokenBuffer input; 18 | 19 | /** Are we guessing (guessing>0)? */ 20 | public int guessing = 0; 21 | 22 | /** What file (if known) caused the problem? */ 23 | protected String filename; 24 | } 25 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ActionElement.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/ActionElement.java#1 $ 8 | */ 9 | 10 | class ActionElement extends AlternativeElement { 11 | protected String actionText; 12 | protected boolean isSemPred = false; 13 | 14 | 15 | public ActionElement(Grammar g, Token t) { 16 | super(g); 17 | actionText = t.getText(); 18 | line = t.getLine(); 19 | } 20 | public void generate() { 21 | grammar.generator.gen(this); 22 | } 23 | public Lookahead look(int k) { 24 | return grammar.theLLkAnalyzer.look(k, this); 25 | } 26 | public String toString() { 27 | return " "+actionText + (isSemPred?"?":""); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/ExceptionSpec.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/ExceptionSpec.java#1 $ 8 | */ 9 | 10 | import antlr.collections.impl.Vector; 11 | 12 | class ExceptionSpec 13 | { 14 | // Non-null if this refers to a labeled rule 15 | // Use a token instead of a string to get the line information 16 | protected Token label; 17 | 18 | // List of ExceptionHandler (catch phrases) 19 | protected Vector handlers; 20 | 21 | 22 | public ExceptionSpec(Token label_) { 23 | label = label_; 24 | handlers = new Vector(); 25 | } 26 | public void addHandler(ExceptionHandler handler) { 27 | handlers.appendElement(handler); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/inherit.tinyc/runtest.bat: -------------------------------------------------------------------------------- 1 | rem 2 | rem Demonstrate how to subclass a grammar and actually get it to compile. 3 | rem Biggest issue is making sure ANTLR, compiler, and interpreter can see 4 | rem the supergrammar and classes needed by it. In this case, the subgrammar 5 | rem uses the supergrammar's lexer; it must be visible for the compiler and 6 | rem interpreter. 7 | rem 8 | rem If you put a lexer here in this dir, you would not need all this 9 | rem classpath crap. 10 | rem 11 | java antlr.Tool -glib "..\tinyc\tinyc.g" subc.g 12 | javac -classpath c:\jdk1.1.7A\lib\classes.zip;.;..\tinyc;d:\Projects\antlr-2.5.0 *.java 13 | rem 14 | rem have to change the next classpath to point to your 2.5.0 directory not mine. 15 | rem 16 | java -classpath c:\jdk1.1.7A\lib\classes.zip;.;..\tinyc;d:\Projects\antlr-2.5.0 Main < input.c 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/actions/cpp/ActionLexerTokenTypes.java: -------------------------------------------------------------------------------- 1 | // $ANTLR 2.7.1: "action.g" -> "ActionLexer.java"$ 2 | 3 | package antlr.actions.cpp; 4 | 5 | public interface ActionLexerTokenTypes { 6 | int EOF = 1; 7 | int NULL_TREE_LOOKAHEAD = 3; 8 | int ACTION = 4; 9 | int STUFF = 5; 10 | int AST_ITEM = 6; 11 | int TEXT_ITEM = 7; 12 | int TREE = 8; 13 | int TREE_ELEMENT = 9; 14 | int AST_CONSTRUCTOR = 10; 15 | int AST_CTOR_ELEMENT = 11; 16 | int ID_ELEMENT = 12; 17 | int TEXT_ARG = 13; 18 | int TEXT_ARG_ELEMENT = 14; 19 | int TEXT_ARG_ID_ELEMENT = 15; 20 | int ARG = 16; 21 | int ID = 17; 22 | int VAR_ASSIGN = 18; 23 | int COMMENT = 19; 24 | int SL_COMMENT = 20; 25 | int ML_COMMENT = 21; 26 | int CHAR = 22; 27 | int STRING = 23; 28 | int ESC = 24; 29 | int DIGIT = 25; 30 | int INT = 26; 31 | int INT_OR_FLOAT = 27; 32 | int WS = 28; 33 | } 34 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/actions/java/ActionLexerTokenTypes.java: -------------------------------------------------------------------------------- 1 | // $ANTLR 2.7.1: "action.g" -> "ActionLexer.java"$ 2 | 3 | package antlr.actions.java; 4 | 5 | public interface ActionLexerTokenTypes { 6 | int EOF = 1; 7 | int NULL_TREE_LOOKAHEAD = 3; 8 | int ACTION = 4; 9 | int STUFF = 5; 10 | int AST_ITEM = 6; 11 | int TEXT_ITEM = 7; 12 | int TREE = 8; 13 | int TREE_ELEMENT = 9; 14 | int AST_CONSTRUCTOR = 10; 15 | int AST_CTOR_ELEMENT = 11; 16 | int ID_ELEMENT = 12; 17 | int TEXT_ARG = 13; 18 | int TEXT_ARG_ELEMENT = 14; 19 | int TEXT_ARG_ID_ELEMENT = 15; 20 | int ARG = 16; 21 | int ID = 17; 22 | int VAR_ASSIGN = 18; 23 | int COMMENT = 19; 24 | int SL_COMMENT = 20; 25 | int ML_COMMENT = 21; 26 | int CHAR = 22; 27 | int STRING = 23; 28 | int ESC = 24; 29 | int DIGIT = 25; 30 | int INT = 26; 31 | int INT_OR_FLOAT = 27; 32 | int WS = 28; 33 | } 34 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/collections/impl/ASTArray.java: -------------------------------------------------------------------------------- 1 | package antlr.collections.impl; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/collections/impl/ASTArray.java#1 $ 8 | */ 9 | 10 | import antlr.collections.AST; 11 | 12 | /** ASTArray is a class that allows ANTLR to 13 | * generate code that can create and initialize an array 14 | * in one expression, like: 15 | * (new ASTArray(3)).add(x).add(y).add(z) 16 | */ 17 | public class ASTArray { 18 | public int size = 0; 19 | public AST[] array; 20 | 21 | 22 | public ASTArray(int capacity) { 23 | array = new AST[capacity]; 24 | } 25 | public ASTArray add(AST node) { 26 | array[size++] = node; 27 | return this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/src/ParserSharedInputState.cpp: -------------------------------------------------------------------------------- 1 | #include "antlr/ParserSharedInputState.hpp" 2 | 3 | ANTLR_BEGIN_NAMESPACE(antlr) 4 | 5 | /** This object contains the data associated with an 6 | * input stream of tokens. Multiple parsers 7 | * share a single ParserSharedInputState to parse 8 | * the same stream of tokens. 9 | */ 10 | 11 | ParserInputState::ParserInputState(TokenBuffer* input_) 12 | : guessing(0) 13 | , input(input_) 14 | , inputResponsible(true) 15 | { 16 | } 17 | 18 | ParserInputState::ParserInputState(TokenBuffer& input_) 19 | : guessing(0) 20 | , input(&input_) 21 | , inputResponsible(false) 22 | { 23 | } 24 | 25 | ParserInputState::~ParserInputState() 26 | { 27 | if (inputResponsible) 28 | delete input; 29 | } 30 | 31 | TokenBuffer& ParserInputState::getInput() 32 | { 33 | return *input; 34 | } 35 | 36 | ANTLR_END_NAMESPACE 37 | 38 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/transform/Calc.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import antlr.CommonAST; 3 | import antlr.collections.AST; 4 | import antlr.DumpASTVisitor; 5 | 6 | class Calc { 7 | public static void main(String[] args) { 8 | try { 9 | CalcLexer lexer = new CalcLexer(new DataInputStream(System.in)); 10 | CalcParser parser = new CalcParser(lexer); 11 | // Parse the input expression 12 | parser.expr(); 13 | CommonAST t = (CommonAST)parser.getAST(); 14 | // Print the resulting tree out in LISP notation 15 | System.out.println(t.toStringList()); 16 | CalcTreeWalker walker = new CalcTreeWalker(); 17 | // Traverse the tree created by the parser 18 | walker.expr(t); 19 | t = (CommonAST)walker.getAST(); 20 | System.out.println(t.toStringList()); 21 | } catch(Exception e) { 22 | System.err.println("exception: "+e); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/heteroAST/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #CALC_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | parser ::= #CALC_PARSER{ANTLR_COMMON_TOKEN, $CALC_AST}( lexer ); 19 | 20 | parser.expr; 21 | 22 | t : $CALC_AST := parser.ast; 23 | 24 | #OUT + t.str_tree + "\n"; 25 | 26 | #OUT + "value is " + t.val + "\n"; 27 | 28 | when $ANTLR_RECOGNITION_EXCEPTION then 29 | #ERR + "exception: " + exception.str + "\n"; 30 | end; 31 | 32 | end; 33 | end; 34 | 35 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/antlr/CommonHiddenStreamToken.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_CommonHiddenStreamToken_hpp__ 2 | #define INC_CommonHiddenStreamToken_hpp__ 3 | 4 | #include "antlr/config.hpp" 5 | #include "antlr/CommonToken.hpp" 6 | 7 | ANTLR_BEGIN_NAMESPACE(antlr) 8 | 9 | class CommonHiddenStreamToken : public CommonToken { 10 | protected: 11 | RefToken hiddenBefore; 12 | RefToken hiddenAfter; 13 | 14 | public: 15 | CommonHiddenStreamToken(); 16 | CommonHiddenStreamToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt); 17 | CommonHiddenStreamToken(const ANTLR_USE_NAMESPACE(std)string& s); 18 | 19 | RefToken getHiddenAfter(); 20 | RefToken getHiddenBefore(); 21 | 22 | static RefToken factory(); 23 | 24 | void setHiddenAfter(RefToken t); 25 | void setHiddenBefore(RefToken t); 26 | }; 27 | 28 | ANTLR_END_NAMESPACE 29 | 30 | #endif //INC_CommonHiddenStreamToken_hpp__ 31 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/CharLiteralElement.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/CharLiteralElement.java#1 $ 8 | */ 9 | 10 | class CharLiteralElement extends GrammarAtom { 11 | 12 | 13 | public CharLiteralElement(LexerGrammar g, Token t, boolean inverted, int autoGenType) { 14 | super(g, t, AUTO_GEN_NONE); 15 | tokenType = ANTLRLexer.tokenTypeForCharLiteral(t.getText()); 16 | g.charVocabulary.add(tokenType); 17 | line = t.getLine(); 18 | not = inverted; 19 | this.autoGenType = autoGenType; 20 | } 21 | public void generate() { 22 | grammar.generator.gen(this); 23 | } 24 | public Lookahead look(int k) { 25 | return grammar.theLLkAnalyzer.look(k, this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/exprAST/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ExprLexer.hpp" 3 | #include "ExprParser.hpp" 4 | #include "antlr/AST.hpp" 5 | #include "antlr/CommonAST.hpp" 6 | 7 | int main() 8 | { 9 | ANTLR_USING_NAMESPACE(std) 10 | ANTLR_USING_NAMESPACE(antlr) 11 | try { 12 | ExprLexer lexer(cin); 13 | ExprParser parser(lexer); 14 | 15 | // set the type of tree node to create; this is default action 16 | // so it is unnecessary to do it here, but demos capability. 17 | parser.setASTNodeFactory(&CommonAST::factory); 18 | 19 | parser.expr(); 20 | RefCommonAST ast = RefCommonAST(parser.getAST()); 21 | // RefAST ast = parser.getAST(); 22 | if (ast) { 23 | cout << ast->toStringList() << endl; 24 | } else { 25 | cout << "null AST" << endl; 26 | } 27 | } catch(exception& e) { 28 | cerr << "exception: " << e.what() << endl; 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/unicode/unicode.g: -------------------------------------------------------------------------------- 1 | class L extends Lexer; 2 | 3 | options { 4 | // Allow any char but \uFFFF (16 bit -1) 5 | charVocabulary='\u0000'..'\uFFFE'; 6 | } 7 | 8 | { 9 | private static boolean done = false; 10 | 11 | public void uponEOF() throws TokenStreamException, CharStreamException { 12 | done=true; 13 | } 14 | 15 | public static void main(String[] args) throws Exception { 16 | L lexer = new L(System.in); 17 | while ( !done ) { 18 | Token t = lexer.nextToken(); 19 | System.out.println("Token: "+t); 20 | } 21 | } 22 | } 23 | 24 | ID : ID_START_LETTER ( ID_LETTER )* 25 | ; 26 | 27 | WS : (' '|'\n') {$setType(Token.SKIP);} 28 | ; 29 | 30 | protected 31 | ID_START_LETTER 32 | : '$' 33 | | '_' 34 | | 'a'..'z' 35 | | '\u0080'..'\ufffe' 36 | ; 37 | 38 | protected 39 | ID_LETTER 40 | : ID_START_LETTER 41 | | '0'..'9' 42 | ; 43 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/src/TokenStreamBasicFilter.cpp: -------------------------------------------------------------------------------- 1 | #include "antlr/TokenStreamBasicFilter.hpp" 2 | 3 | ANTLR_BEGIN_NAMESPACE(antlr) 4 | 5 | /** This object is a TokenStream that passes through all 6 | * tokens except for those that you tell it to discard. 7 | * There is no buffering of the tokens. 8 | */ 9 | TokenStreamBasicFilter::TokenStreamBasicFilter(TokenStream& input_) 10 | : input(&input_) 11 | { 12 | } 13 | 14 | void TokenStreamBasicFilter::discard(int ttype) 15 | { 16 | discardMask.add(ttype); 17 | } 18 | 19 | void TokenStreamBasicFilter::discard(const BitSet& mask) 20 | { 21 | discardMask = mask; 22 | } 23 | 24 | RefToken TokenStreamBasicFilter::nextToken() 25 | { 26 | RefToken tok = input->nextToken(); 27 | while ( tok && discardMask.member(tok->getType()) ) { 28 | tok = input->nextToken(); 29 | } 30 | return tok; 31 | } 32 | 33 | ANTLR_END_NAMESPACE 34 | 35 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/AlternativeElement.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/AlternativeElement.java#1 $ 8 | */ 9 | 10 | abstract class AlternativeElement extends GrammarElement { 11 | AlternativeElement next; 12 | protected int autoGenType = AUTO_GEN_NONE; 13 | 14 | protected String enclosingRuleName; 15 | 16 | 17 | public AlternativeElement(Grammar g) { 18 | super(g); 19 | } 20 | public AlternativeElement(Grammar g, int autoGenType_) { 21 | super(g); 22 | autoGenType = autoGenType_; 23 | } 24 | public int getAutoGenType() { 25 | return autoGenType; 26 | } 27 | public String getLabel() { 28 | return null; 29 | } 30 | public void setLabel(String label) {} 31 | } 32 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/MessageEvent.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class MessageEvent extends Event { 4 | private String text; 5 | public static int WARNING = 0; 6 | public static int ERROR = 1; 7 | 8 | 9 | public MessageEvent(Object source) { 10 | super(source); 11 | } 12 | public MessageEvent(Object source, int type, String text) { 13 | super(source); 14 | setValues(type,text); 15 | } 16 | public String getText() { 17 | return text; 18 | } 19 | void setText(String text) { 20 | this.text = text; 21 | } 22 | /** This should NOT be called from anyone other than ParserEventSupport! */ 23 | void setValues(int type, String text) { 24 | super.setValues(type); 25 | setText(text); 26 | } 27 | public String toString() { 28 | return "ParserMessageEvent [" + 29 | (getType()==WARNING?"warning,":"error,") + 30 | getText() + "]"; 31 | } 32 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/unicode/unicode.g: -------------------------------------------------------------------------------- 1 | options { 2 | language="Cpp"; 3 | } 4 | 5 | class L extends Lexer; 6 | 7 | options 8 | { 9 | // Allow any char but \uFFFF (16 bit -1) 10 | charVocabulary='\u0000'..'\uFFFE'; 11 | } 12 | 13 | { 14 | bool done; 15 | 16 | public void uponEOF() 17 | { 18 | done = true; 19 | } 20 | 21 | int main(int argc, char **argv) 22 | { 23 | done = false; 24 | L lexer = new L(std::stdin); 25 | while ( !done ) 26 | { 27 | Token t = lexer.nextToken(); 28 | cout << "Token: " << t.getText() << endl;; 29 | } 30 | } 31 | } 32 | 33 | ID : ID_START_LETTER ( ID_LETTER )* 34 | ; 35 | 36 | WS : (' '|'\n') {$setType(Token.SKIP); 37 | } 38 | ; 39 | 40 | protected 41 | ID_START_LETTER 42 | : '$' 43 | | '_' 44 | | 'a'..'z' 45 | | '\u0080'..'\ufffe' 46 | ; 47 | 48 | protected 49 | ID_LETTER 50 | : ID_START_LETTER 51 | | '0'..'9' 52 | ; 53 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/exprAST/Main.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import ExprLexer; 3 | import ExprParser; 4 | import antlr.collections.AST; 5 | 6 | class Main { 7 | public static void main(String[] args) { 8 | try { 9 | ExprLexer lexer = new ExprLexer(new DataInputStream(System.in)); 10 | ExprParser parser = new ExprParser(lexer); 11 | 12 | // set the type of tree node to create; this is default action 13 | // so it is unnecessary to do it here, but demos capability. 14 | parser.setASTNodeType("antlr.CommonAST"); 15 | 16 | parser.expr(); 17 | antlr.CommonAST ast = (antlr.CommonAST)parser.getAST(); 18 | if (ast != null) { 19 | System.out.println(ast.toStringList()); 20 | } else { 21 | System.out.println("null AST"); 22 | } 23 | } catch(Exception e) { 24 | System.err.println("exception: "+e); 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/src/CommonASTWithHiddenTokens.cpp: -------------------------------------------------------------------------------- 1 | #include "antlr/config.hpp" 2 | #include "antlr/CommonASTWithHiddenTokens.hpp" 3 | #include "antlr/CommonHiddenStreamToken.hpp" 4 | 5 | ANTLR_BEGIN_NAMESPACE(antlr) 6 | 7 | void CommonASTWithHiddenTokens::initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt) 8 | { 9 | CommonAST::initialize(t,txt); 10 | } 11 | 12 | void CommonASTWithHiddenTokens::initialize(RefAST t) 13 | { 14 | CommonAST::initialize(t); 15 | } 16 | 17 | void CommonASTWithHiddenTokens::initialize(RefToken t) 18 | { 19 | CommonAST::initialize(t); 20 | hiddenBefore = static_cast(t.get())->getHiddenBefore(); 21 | hiddenAfter = static_cast(t.get())->getHiddenAfter(); 22 | } 23 | 24 | RefAST CommonASTWithHiddenTokens::factory() 25 | { 26 | return RefAST(new CommonASTWithHiddenTokens); 27 | } 28 | 29 | ANTLR_END_NAMESPACE 30 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/heteroAST/INTNode.java: -------------------------------------------------------------------------------- 1 | import antlr.BaseAST; 2 | import antlr.Token; 3 | import antlr.collections.AST; 4 | import java.io.*; 5 | 6 | /** A simple node to represent an INT */ 7 | public class INTNode extends CalcAST { 8 | int v=0; 9 | 10 | public INTNode(Token tok) { 11 | v = Integer.parseInt(tok.getText()); 12 | } 13 | 14 | /** Compute value of subtree; this is heterogeneous part :) */ 15 | public int value() { 16 | return v; 17 | } 18 | 19 | public String toString() { 20 | return " "+v; 21 | } 22 | 23 | public void xmlSerializeNode(Writer out) throws IOException { 24 | out.write(""+v+""); 25 | } 26 | 27 | // satisfy abstract methods from BaseAST 28 | public void initialize(int t, String txt) { 29 | } 30 | public void initialize(AST t) { 31 | } 32 | public void initialize(Token tok) { 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/inherit.tinyc/runtest.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Demonstrate how to subclass a grammar and actually get it to compile. 3 | # Biggest issue is making sure ANTLR, compiler, and interpreter can see 4 | # the supergrammar and classes needed by it. In this case, the subgrammar 5 | # uses the supergrammar's lexer; it must be visible for the compiler and 6 | # interpreter. 7 | # 8 | # If you put a lexer here in this dir, you would not need all this 9 | # classpath crap. 10 | # 11 | java antlr.Tool -glib "../tinyc/tinyc.g" subc.g 12 | javac -classpath '/usr/local/src/jdk117_v3/lib/classes.zip:.:../tinyc:/home/parrt/depot/code/org.antlr/test/antlr-2.7.0a11' *.java 13 | # 14 | # have to change the next classpath to point to your 2.6.0 directory not mine. 15 | # 16 | java -classpath '/usr/local/src/jdk117_v3/lib/classes.zip:.:../tinyc:/home/parrt/depot/code/org.antlr/test/antlr-2.7.0a11' Main < input.c 17 | 18 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/InputBufferReporter.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class InputBufferReporter implements InputBufferListener { 4 | 5 | 6 | /** 7 | * doneParsing method comment. 8 | */ 9 | public void doneParsing(TraceEvent e) { 10 | } 11 | public void inputBufferChanged(InputBufferEvent e) { 12 | System.out.println(e); 13 | } 14 | /** 15 | * charBufferConsume method comment. 16 | */ 17 | public void inputBufferConsume(InputBufferEvent e) { 18 | System.out.println(e); 19 | } 20 | /** 21 | * charBufferLA method comment. 22 | */ 23 | public void inputBufferLA(InputBufferEvent e) { 24 | System.out.println(e); 25 | } 26 | public void inputBufferMark(InputBufferEvent e) { 27 | System.out.println(e); 28 | } 29 | public void inputBufferRewind(InputBufferEvent e) { 30 | System.out.println(e); 31 | } 32 | /** 33 | * refresh method comment. 34 | */ 35 | public void refresh() { 36 | } 37 | } -------------------------------------------------------------------------------- /zdk/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ 8 | 9 | errstatus=0 10 | 11 | for file 12 | do 13 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 14 | shift 15 | 16 | pathcomp= 17 | for d 18 | do 19 | pathcomp="$pathcomp$d" 20 | case "$pathcomp" in 21 | -* ) pathcomp=./$pathcomp ;; 22 | esac 23 | 24 | if test ! -d "$pathcomp"; then 25 | echo "mkdir $pathcomp" 26 | 27 | mkdir "$pathcomp" || lasterr=$? 28 | 29 | if test ! -d "$pathcomp"; then 30 | errstatus=$lasterr 31 | fi 32 | fi 33 | 34 | pathcomp="$pathcomp/" 35 | done 36 | done 37 | 38 | exit $errstatus 39 | 40 | # mkinstalldirs ends here 41 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/exprAST/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #EXPR_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | parser ::= #EXPR_PARSER{ANTLR_COMMON_TOKEN,ANTLR_COMMON_AST}( lexer ); 19 | 20 | parser.expr; 21 | 22 | ast ::= parser.ast; 23 | 24 | if ( ~void(ast) ) then 25 | #OUT + ast.str_list + "\n"; 26 | else 27 | #OUT + "void $ANTLR_AST\n" 28 | end; 29 | 30 | when $ANTLR_RECOGNITION_EXCEPTION then 31 | #ERR + "exception: " + exception.str + "\n"; 32 | end; 33 | 34 | end; 35 | end; 36 | 37 | -------------------------------------------------------------------------------- /zdk/acconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Put any default '#undef' or '#define' here, they will be copied to top of 'config.h.in'. 3 | */ 4 | @TOP@ 5 | 6 | 7 | /* 8 | * Here are requied macros by 'AC_DEFINE()' in 'configure.in'. 9 | */ 10 | #undef __linux__ 11 | #undef __solaris__ 12 | 13 | #undef ENABLE_DEBUG_ZLS_malloc 14 | #undef ENABLE_THREADS 15 | #undef HAVE_PTHREAD_H 16 | #undef HAVE_CXX_EH 17 | #undef HAVE_CXX_NS 18 | #undef HAVE_CXX_STL 19 | #undef ENABLE_OVERLOAD_OPERATOR_NEW 20 | #undef NDEBUG 21 | 22 | #undef HAVE_ASM_ATOMIC_H 23 | #undef HAVE_SYS_ATOMIC_H 24 | #undef HAVE_ATOMIC 25 | #undef HAVE_PTHREAD_MUTEX_RECURSIVE 26 | #undef HAVE_STRUCT_ICMPHDR 27 | #undef HAVE_TCP_STATES 28 | #undef HAVE_STRUCT_UDPHDR 29 | 30 | #undef ENABLE_ZVM_DEBUG 31 | #undef ENABLE_ZVM_OPTIMIZATION 32 | 33 | 34 | @BOTTOM@ 35 | /* 36 | * Put any default '#undef' or '#define' here, they will be copied to bottom of 'config.h.in'. 37 | */ 38 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/inherit.tinyc/runtest.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | rem 3 | rem Demonstrate how to subclass a grammar and actually get it to compile. 4 | rem Biggest issue is making sure ANTLR, compiler, and interpreter can see 5 | rem the supergrammar and classes needed by it. In this case, the subgrammar 6 | rem uses the supergrammar's lexer; it must be visible for the compiler and 7 | rem interpreter. 8 | rem 9 | rem If you put a lexer here in this dir, you would not need all this 10 | rem classpath crap. 11 | rem 12 | echo on 13 | java antlr.Tool -glib "..\tinyc\tinyc.g" subc.g 14 | javac -classpath c:\jdk1.1.7A\lib\classes.zip;.;..\tinyc;d:\Projects\antlr-2.6.0 *.java 15 | echo off 16 | rem 17 | rem have to change the next classpath to point to your 2.6.0 directory not mine. 18 | rem 19 | echo on 20 | java -classpath c:\jdk1.1.7A\lib\classes.zip;.;..\tinyc;d:\Projects\antlr-2.6.0 Main < input.c 21 | 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/inherit.tinyc/runtest.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | rem 3 | rem Demonstrate how to subclass a grammar and actually get it to compile. 4 | rem Biggest issue is making sure ANTLR, compiler, and interpreter can see 5 | rem the supergrammar and classes needed by it. In this case, the subgrammar 6 | rem uses the supergrammar's lexer; it must be visible for the compiler and 7 | rem interpreter. 8 | rem 9 | rem If you put a lexer here in this dir, you would not need all this 10 | rem classpath crap. 11 | rem 12 | echo on 13 | java antlr.Tool -glib "..\tinyc\tinyc.g" subc.g 14 | javac -classpath c:\jdk1.1.7A\lib\classes.zip;.;..\tinyc;d:\Projects\antlr-2.6.0 *.java 15 | echo off 16 | rem 17 | rem have to change the next classpath to point to your 2.6.0 directory not mine. 18 | rem 19 | echo on 20 | java -classpath c:\jdk1.1.7A\lib\classes.zip;.;..\tinyc;d:\Projects\antlr-2.6.0 Main < input.c 21 | 22 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/ast_array.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/ast_array.sa#1 $ 8 | 9 | *) 10 | 11 | class ANTLR_AST_ARRAY{AST < $ANTLR_AST{AST}} < $ARR{AST} is 12 | 13 | include ARRAY{AST} create->super_create; 14 | 15 | private attr num_added : INT; 16 | 17 | -- intended to allow call chaining of the type: 18 | -- array.add(x).add(y).add(z) 19 | -- Whatever.. 20 | 21 | create( capacity : INT ) : SAME is 22 | res : SAME := super_create( capacity ); 23 | res.num_added := 0; 24 | return res; 25 | end; 26 | 27 | add( ast : AST ) : SAME is 28 | aset( num_added, ast ); 29 | num_added := num_added + 1; 30 | return self; 31 | end; 32 | end; 33 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/preprocessor/PreprocessorTokenTypes.txt: -------------------------------------------------------------------------------- 1 | // $ANTLR 2.7.1a4: preproc.g -> PreprocessorTokenTypes.txt$ 2 | Preprocessor // output token vocab name 3 | LITERAL_tokens="tokens"=4 4 | HEADER_ACTION=5 5 | ACTION=6 6 | LITERAL_class="class"=7 7 | ID=8 8 | LITERAL_extends="extends"=9 9 | SEMI=10 10 | TOKENS_SPEC=11 11 | OPTIONS_START=12 12 | ASSIGN_RHS=13 13 | RCURLY=14 14 | LITERAL_protected="protected"=15 15 | LITERAL_private="private"=16 16 | LITERAL_public="public"=17 17 | BANG=18 18 | ARG_ACTION=19 19 | LITERAL_returns="returns"=20 20 | RULE_BLOCK=21 21 | LITERAL_throws="throws"=22 22 | COMMA=23 23 | LITERAL_exception="exception"=24 24 | LITERAL_catch="catch"=25 25 | SUBRULE_BLOCK=26 26 | ALT=27 27 | ELEMENT=28 28 | ID_OR_KEYWORD=29 29 | CURLY_BLOCK_SCARF=30 30 | WS=31 31 | NEWLINE=32 32 | COMMENT=33 33 | SL_COMMENT=34 34 | ML_COMMENT=35 35 | CHAR_LITERAL=36 36 | STRING_LITERAL=37 37 | ESC=38 38 | DIGIT=39 39 | XDIGIT=40 40 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/contrib/MSCV6-dll/antlr.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "DLL"=".\DLL.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "LIB"=".\LIB.dsp" - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | Global: 31 | 32 | Package=<5> 33 | {{{ 34 | }}} 35 | 36 | Package=<3> 37 | {{{ 38 | }}} 39 | 40 | ############################################################################### 41 | 42 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/scripts/mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ 8 | 9 | errstatus=0 10 | 11 | for file 12 | do 13 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 14 | shift 15 | 16 | pathcomp= 17 | for d 18 | do 19 | pathcomp="$pathcomp$d" 20 | case "$pathcomp" in 21 | -* ) pathcomp=./$pathcomp ;; 22 | esac 23 | 24 | if test ! -d "$pathcomp"; then 25 | echo "mkdir $pathcomp" 26 | 27 | mkdir "$pathcomp" || lasterr=$? 28 | 29 | if test ! -d "$pathcomp"; then 30 | errstatus=$lasterr 31 | fi 32 | fi 33 | 34 | pathcomp="$pathcomp/" 35 | done 36 | done 37 | 38 | exit $errstatus 39 | 40 | # mkinstalldirs ends here 41 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/multiLexer/javalex.g: -------------------------------------------------------------------------------- 1 | header { 2 | #include "antlr/TokenStreamSelector.hpp" 3 | } 4 | 5 | options { 6 | language="Cpp"; 7 | } 8 | 9 | class DemoJavaLexer extends Lexer; 10 | options { 11 | k=2; 12 | importVocab = Common; 13 | exportVocab = Java; 14 | } 15 | 16 | tokens { 17 | INT="int"; 18 | } 19 | 20 | { 21 | private: 22 | ANTLR_USE_NAMESPACE(antlr)TokenStreamSelector* selector; 23 | public: 24 | void setSelector(ANTLR_USE_NAMESPACE(antlr)TokenStreamSelector* selector_) { 25 | selector=selector_; 26 | } 27 | } 28 | 29 | JAVADOC_OPEN 30 | : "/**" {selector->push("doclexer");} 31 | ; 32 | 33 | ID : ('a'..'z')+ ; 34 | SEMI: ';' ; 35 | WS_ : ( ' ' 36 | | '\t' 37 | | '\f' 38 | // handle newlines 39 | | ( "\r\n" // Evil DOS 40 | | '\r' // Macintosh 41 | | '\n' // Unix (the right way) 42 | ) 43 | { newline(); } 44 | ) 45 | { $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); } 46 | ; 47 | 48 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/antlr/TokenStreamBasicFilter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_TokenStreamBasicFilter_hpp__ 2 | #define INC_TokenStreamBasicFilter_hpp__ 3 | 4 | #include "antlr/config.hpp" 5 | #include "antlr/BitSet.hpp" 6 | #include "antlr/TokenStream.hpp" 7 | 8 | ANTLR_BEGIN_NAMESPACE(antlr) 9 | 10 | /** This object is a TokenStream that passes through all 11 | * tokens except for those that you tell it to discard. 12 | * There is no buffering of the tokens. 13 | */ 14 | class TokenStreamBasicFilter : public TokenStream { 15 | /** The set of token types to discard */ 16 | protected: 17 | BitSet discardMask; 18 | 19 | /** The input stream */ 20 | protected: 21 | TokenStream* input; 22 | 23 | public: 24 | TokenStreamBasicFilter(TokenStream& input_); 25 | 26 | void discard(int ttype); 27 | 28 | void discard(const BitSet& mask); 29 | 30 | RefToken nextToken(); 31 | }; 32 | 33 | ANTLR_END_NAMESPACE 34 | 35 | #endif //INC_TokenStreamBasicFilter_hpp__ 36 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/imagNodeAST/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #LANG_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | parser ::= #LANG_PARSER{ANTLR_COMMON_TOKEN,ANTLR_COMMON_AST}( lexer ); 19 | 20 | parser.block; 21 | 22 | t : ANTLR_COMMON_AST := parser.ast; 23 | 24 | #OUT + t.str_list + "\n"; 25 | 26 | walker ::= #LANG_WALKER{ANTLR_COMMON_AST}; 27 | walker.block(t); 28 | 29 | #OUT + "done walking\n"; 30 | 31 | when $ANTLR_EXCEPTION then 32 | #ERR + "exception: " + exception.str + "\n"; 33 | end; 34 | 35 | end; 36 | end; 37 | 38 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/WildcardElement.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/WildcardElement.java#1 $ 8 | */ 9 | 10 | class WildcardElement extends GrammarAtom { 11 | protected String label; 12 | 13 | public WildcardElement(Grammar g, Token t, int autoGenType) { 14 | super(g, t, autoGenType); 15 | line = t.getLine(); 16 | } 17 | public void generate() { 18 | grammar.generator.gen(this); 19 | } 20 | public String getLabel() { 21 | return label; 22 | } 23 | public Lookahead look(int k) { 24 | return grammar.theLLkAnalyzer.look(k, this); 25 | } 26 | public void setLabel(String label_) { 27 | label = label_; 28 | } 29 | public String toString() { 30 | String s = " "; 31 | if ( label!=null ) s += label+":"; 32 | return s + "."; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/heteroAST/MULTNode.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_MULTNode_hpp__ 2 | #define INC_MULTNode_hpp__ 3 | 4 | #include "BinaryOperatorAST.hpp" 5 | 6 | /** A simple node to represent MULT operation */ 7 | class MULTNode : public BinaryOperatorAST { 8 | public: 9 | MULTNode(ANTLR_USE_NAMESPACE(antlr)RefToken tok) { 10 | } 11 | 12 | /** Compute value of subtree; this is heterogeneous part :) */ 13 | int value() const { 14 | return left()->value() * right()->value(); 15 | } 16 | 17 | ANTLR_USE_NAMESPACE(std)string toString() const { 18 | return " *"; 19 | } 20 | 21 | // satisfy abstract methods from BaseAST 22 | void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) { 23 | } 24 | void initialize(ANTLR_USE_NAMESPACE(antlr)RefAST t) { 25 | } 26 | void initialize(ANTLR_USE_NAMESPACE(antlr)RefToken tok) { 27 | } 28 | }; 29 | 30 | typedef ANTLR_USE_NAMESPACE(antlr)ASTRefCount RefMULTNode; 31 | 32 | #endif //INC_MULTNode_hpp__ 33 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/heteroAST/PLUSNode.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_PLUSNode_hpp__ 2 | #define INC_PLUSNode_hpp__ 3 | 4 | #include "BinaryOperatorAST.hpp" 5 | 6 | /** A simple node to represent PLUS operation */ 7 | class PLUSNode : public BinaryOperatorAST { 8 | public: 9 | PLUSNode(ANTLR_USE_NAMESPACE(antlr)RefToken tok) { 10 | } 11 | 12 | /** Compute value of subtree; this is heterogeneous part :) */ 13 | int value() const { 14 | return left()->value() + right()->value(); 15 | } 16 | 17 | ANTLR_USE_NAMESPACE(std)string toString() const { 18 | return " +"; 19 | } 20 | 21 | // satisfy abstract methods from BaseAST 22 | void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) { 23 | } 24 | void initialize(ANTLR_USE_NAMESPACE(antlr)RefAST t) { 25 | } 26 | void initialize(ANTLR_USE_NAMESPACE(antlr)RefToken tok) { 27 | } 28 | }; 29 | 30 | typedef ANTLR_USE_NAMESPACE(antlr)ASTRefCount RefPLUSNode; 31 | 32 | #endif //INC_PLUSNode_hpp__ 33 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/treewalk/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #LANG_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | parser ::= #LANG_PARSER{ANTLR_COMMON_TOKEN,ANTLR_COMMON_AST}( lexer ); 19 | 20 | parser.block; 21 | 22 | t : ANTLR_COMMON_AST := parser.ast; 23 | 24 | #OUT + t.str_list + "\n"; 25 | 26 | walker ::= #LANG_WALKER{ANTLR_COMMON_AST}; 27 | walker.block(t); 28 | 29 | #OUT + "done walking\n"; 30 | 31 | when $ANTLR_RECOGNITION_EXCEPTION then 32 | #ERR + "exception: " + exception.str + "\n"; 33 | end; 34 | 35 | end; 36 | end; 37 | 38 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/RuleEndElement.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/RuleEndElement.java#1 $ 8 | */ 9 | 10 | /**Contains a list of all places that reference 11 | * this enclosing rule. Useful for FOLLOW computations. 12 | */ 13 | class RuleEndElement extends BlockEndElement { 14 | protected Lookahead[] cache; // Each rule can cache it's lookahead computation. 15 | // The FOLLOW(rule) is stored in this cache. 16 | // 1..k 17 | protected boolean noFOLLOW; 18 | 19 | 20 | public RuleEndElement(Grammar g) { 21 | super(g); 22 | cache = new Lookahead[g.maxk+1]; 23 | } 24 | public Lookahead look(int k) { 25 | return grammar.theLLkAnalyzer.look(k, this); 26 | } 27 | public String toString() { 28 | //return " [RuleEnd]"; 29 | return ""; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/configure.in: -------------------------------------------------------------------------------- 1 | AC_INIT(src/Parser.cpp) 2 | 3 | PACKAGE=libantlr 4 | VERSION="2.7.1" 5 | LIBANTLR_SO_VERSION=0:0:0 6 | 7 | AC_CONFIG_AUX_DIR(scripts) 8 | AM_INIT_AUTOMAKE($PACKAGE, $VERSION) 9 | 10 | AM_DISABLE_SHARED 11 | AM_PROG_LIBTOOL 12 | AC_PROG_CXX 13 | AC_PROG_CXXCPP 14 | AC_PROG_RANLIB 15 | 16 | test "$ac_cv_prog_gxx" = 'yes' && CXXFLAGS="$CXXFLAGS -W -Wall -pipe -D_PTHREADS" 17 | 18 | dnl 19 | dnl Debug mode 20 | dnl 21 | AC_ARG_ENABLE(debug, 22 | [ --disable-debug Turn off debugging], 23 | [ 24 | case "${enableval}" in 25 | yes) debug=true ;; 26 | no ) debug=false ;; 27 | * ) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; 28 | esac 29 | ], 30 | [ 31 | debug=true 32 | ] 33 | ) 34 | AM_CONDITIONAL(DEBUG, test x$debug = xtrue) 35 | 36 | AC_SUBST(LIBANTLR_SO_VERSION) 37 | AC_SUBST(LIBTOOL_DEPS) 38 | 39 | AC_OUTPUT(Makefile \ 40 | src/Makefile \ 41 | antlr/Makefile) 42 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/BlockEndElement.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/BlockEndElement.java#1 $ 8 | */ 9 | 10 | /**All alternative blocks are "terminated" by BlockEndElements unless 11 | * they are rule blocks (in which case they use RuleEndElement). 12 | */ 13 | class BlockEndElement extends AlternativeElement { 14 | protected boolean[] lock; // for analysis; used to avoid infinite loops 15 | protected AlternativeBlock block;// ending blocks know what block they terminate 16 | 17 | 18 | public BlockEndElement(Grammar g) { 19 | super(g); 20 | lock = new boolean[g.maxk+1]; 21 | } 22 | public Lookahead look(int k) { 23 | return grammar.theLLkAnalyzer.look(k, this); 24 | } 25 | public String toString() { 26 | //return " [BlkEnd]"; 27 | return ""; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/TreeElement.java: -------------------------------------------------------------------------------- 1 | package antlr; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/TreeElement.java#1 $ 8 | */ 9 | 10 | /** A TreeElement is a block with one alternative and a root node */ 11 | class TreeElement extends AlternativeBlock { 12 | GrammarAtom root; 13 | 14 | 15 | public TreeElement(Grammar g, int line) { 16 | super(g, line, false); 17 | } 18 | public void generate() { 19 | grammar.generator.gen(this); 20 | } 21 | public Lookahead look(int k) { 22 | return grammar.theLLkAnalyzer.look(k, this); 23 | } 24 | public String toString() { 25 | String s = " #(" + root; 26 | Alternative a = (Alternative)alternatives.elementAt(0); 27 | AlternativeElement p = a.head; 28 | while ( p!=null ) { 29 | s += p; 30 | p = p.next; 31 | } 32 | return s + " )"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/calc/Main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "antlr/AST.hpp" 3 | #include "CalcLexer.hpp" 4 | #include "CalcParser.hpp" 5 | #include "CalcTreeWalker.hpp" 6 | 7 | int main() 8 | { 9 | ANTLR_USING_NAMESPACE(std) 10 | ANTLR_USING_NAMESPACE(antlr) 11 | try 12 | { 13 | CalcLexer lexer(cin); 14 | lexer.setFilename(""); 15 | 16 | CalcParser parser(lexer); 17 | parser.setFilename(""); 18 | 19 | // Parse the input expression 20 | parser.expr(); 21 | RefAST t = parser.getAST(); 22 | if( t ) 23 | { 24 | // Print the resulting tree out in LISP notation 25 | cout << t->toStringTree() << endl; 26 | CalcTreeWalker walker; 27 | 28 | // Traverse the tree created by the parser 29 | float r = walker.expr(t); 30 | cout << "value is " << r << endl; 31 | } 32 | else 33 | cout << "No tree produced" << endl; 34 | 35 | } 36 | catch(exception& e) 37 | { 38 | cerr << "exception: " << e.what() << endl; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/calc/calc.g: -------------------------------------------------------------------------------- 1 | class CalcParser extends Parser; 2 | options { 3 | buildAST = true; // uses CommonAST by default 4 | } 5 | 6 | expr 7 | : mexpr (PLUS^ mexpr)* SEMI! 8 | ; 9 | 10 | mexpr 11 | : atom (STAR^ atom)* 12 | ; 13 | 14 | atom: INT 15 | ; 16 | 17 | class CalcLexer extends Lexer; 18 | 19 | WS : (' ' 20 | | '\t' 21 | | '\n' 22 | | '\r') 23 | { _ttype = Token.SKIP; } 24 | ; 25 | 26 | LPAREN: '(' 27 | ; 28 | 29 | RPAREN: ')' 30 | ; 31 | 32 | STAR: '*' 33 | ; 34 | 35 | PLUS: '+' 36 | ; 37 | 38 | SEMI: ';' 39 | ; 40 | 41 | protected 42 | DIGIT 43 | : '0'..'9' 44 | ; 45 | 46 | INT : (DIGIT)+ 47 | ; 48 | 49 | class CalcTreeWalker extends TreeParser; 50 | 51 | expr returns [float r] 52 | { 53 | float a,b; 54 | r=0; 55 | } 56 | : #(PLUS a=expr b=expr) {r = a+b;} 57 | | #(STAR a=expr b=expr) {r = a*b;} 58 | | i:INT {r = (float)Integer.parseInt(i.getText());} 59 | ; 60 | 61 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/heteroAST/Main.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import antlr.CommonAST; 3 | import antlr.collections.AST; 4 | 5 | class Main { 6 | public static void main(String[] args) { 7 | try { 8 | CalcLexer lexer = new CalcLexer(new DataInputStream(System.in)); 9 | CalcParser parser = new CalcParser(lexer); 10 | // Parse the input expression 11 | parser.expr(); 12 | CalcAST t = (CalcAST)parser.getAST(); 13 | 14 | // Print the resulting tree out in LISP notation 15 | System.out.println(t.toStringTree()); 16 | 17 | // XML serialize the tree, showing 18 | // different physical node class types 19 | Writer w = new OutputStreamWriter(System.out); 20 | t.xmlSerialize(w); 21 | w.write("\n"); 22 | w.flush(); 23 | 24 | // Compute value and return 25 | int r = t.value(); 26 | System.out.println("value is "+r); 27 | } catch(Exception e) { 28 | System.err.println("exception: "+e); 29 | e.printStackTrace(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/calc/calc.g: -------------------------------------------------------------------------------- 1 | options { 2 | language="Cpp"; 3 | } 4 | 5 | class CalcParser extends Parser; 6 | options { 7 | buildAST = true; // uses CommonAST by default 8 | } 9 | 10 | expr 11 | : mexpr (PLUS^ mexpr)* SEMI! 12 | ; 13 | 14 | mexpr 15 | : atom (STAR^ atom)* 16 | ; 17 | 18 | atom: INT 19 | ; 20 | 21 | class CalcLexer extends Lexer; 22 | 23 | WS_ : (' ' 24 | | '\t' 25 | | '\n' 26 | | '\r') 27 | { _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; } 28 | ; 29 | 30 | LPAREN: '(' 31 | ; 32 | 33 | RPAREN: ')' 34 | ; 35 | 36 | STAR: '*' 37 | ; 38 | 39 | PLUS: '+' 40 | ; 41 | 42 | SEMI: ';' 43 | ; 44 | 45 | protected 46 | DIGIT 47 | : '0'..'9' 48 | ; 49 | 50 | INT : (DIGIT)+ 51 | ; 52 | 53 | class CalcTreeWalker extends TreeParser; 54 | 55 | expr returns [float r] 56 | { 57 | float a,b; 58 | r=0; 59 | } 60 | : #(PLUS a=expr b=expr) {r = a+b;} 61 | | #(STAR a=expr b=expr) {r = a*b;} 62 | | i:INT {r = atof(i->getText().c_str());} 63 | ; 64 | 65 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/multiLexer/javadoclex.g: -------------------------------------------------------------------------------- 1 | class DemoJavaDocLexer extends Lexer; 2 | options { 3 | k=2; 4 | importVocab = Common; 5 | exportVocab = JavaDoc; 6 | filter=true; 7 | } 8 | 9 | PARAM 10 | : "@param" ' ' ID 11 | ; 12 | 13 | EXCEPTION 14 | : "@exception" ' ' ID 15 | ; 16 | 17 | protected 18 | ID : ('a'..'z'|'A'..'Z')+ 19 | ; 20 | 21 | /** This rule simply prevents JAVADOC_CLOSE from being 22 | * called for every '*' in a comment. Calling JAVADOC_CLOSE 23 | * will fail for simple '*' and cause an exception, which 24 | * is slow. In other words, the grammar will work without 25 | * this rule, but is slower. 26 | */ 27 | STAR: '*' {$setType(Token.SKIP);} 28 | ; 29 | 30 | JAVADOC_CLOSE 31 | : "*/" {Main.selector.pop();} 32 | ; 33 | 34 | /** Ignore whitespace inside JavaDoc comments */ 35 | NEWLINE 36 | : ( "\r\n" // Evil DOS 37 | | '\r' // Macintosh 38 | | '\n' // Unix (the right way) 39 | ) 40 | { newline(); $setType(Token.SKIP); } 41 | ; 42 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/transform/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #CALC_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | parser ::= #CALC_PARSER{ANTLR_COMMON_TOKEN,ANTLR_COMMON_AST}( lexer ); 19 | 20 | parser.expr; 21 | 22 | t : ANTLR_COMMON_AST := parser.ast; 23 | 24 | #OUT + t.str_list + "\n"; 25 | 26 | walker ::= #CALC_TREE_WALKER{ANTLR_COMMON_AST}; 27 | walker.expr(t); 28 | 29 | t := walker.ast; 30 | 31 | #OUT + t.str_list + "\n"; 32 | 33 | when $ANTLR_RECOGNITION_EXCEPTION then 34 | #ERR + "exception: " + exception.str + "\n"; 35 | end; 36 | 37 | end; 38 | end; 39 | 40 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/debug/ParserAdapter.java: -------------------------------------------------------------------------------- 1 | package antlr.debug; 2 | 3 | public class ParserAdapter implements ParserListener { 4 | 5 | 6 | public void doneParsing(TraceEvent e) {} 7 | public void enterRule(TraceEvent e) {} 8 | public void exitRule(TraceEvent e) {} 9 | public void parserConsume(ParserTokenEvent e) {} 10 | public void parserLA(ParserTokenEvent e) {} 11 | public void parserMatch(ParserMatchEvent e) {} 12 | public void parserMatchNot(ParserMatchEvent e) {} 13 | public void parserMismatch(ParserMatchEvent e) {} 14 | public void parserMismatchNot(ParserMatchEvent e) {} 15 | public void refresh() {} 16 | public void reportError(MessageEvent e) {} 17 | public void reportWarning(MessageEvent e) {} 18 | public void semanticPredicateEvaluated(SemanticPredicateEvent e) {} 19 | public void syntacticPredicateFailed(SyntacticPredicateEvent e) {} 20 | public void syntacticPredicateStarted(SyntacticPredicateEvent e) {} 21 | public void syntacticPredicateSucceeded(SyntacticPredicateEvent e) {} 22 | } -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/heteroAST/MULTNode.java: -------------------------------------------------------------------------------- 1 | import antlr.BaseAST; 2 | import antlr.Token; 3 | import antlr.collections.AST; 4 | import java.io.*; 5 | 6 | /** A simple node to represent MULT operation */ 7 | public class MULTNode extends BinaryOperatorAST { 8 | public MULTNode(Token tok) { 9 | } 10 | 11 | /** Compute value of subtree; this is heterogeneous part :) */ 12 | public int value() { 13 | return left().value() * right().value(); 14 | } 15 | 16 | public String toString() { 17 | return " *"; 18 | } 19 | 20 | public void xmlSerializeRootOpen(Writer out) throws IOException { 21 | out.write(""); 22 | } 23 | 24 | public void xmlSerializeRootClose(Writer out) throws IOException { 25 | out.write(""); 26 | } 27 | 28 | // satisfy abstract methods from BaseAST 29 | public void initialize(int t, String txt) { 30 | } 31 | public void initialize(AST t) { 32 | } 33 | public void initialize(Token tok) { 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/java/heteroAST/PLUSNode.java: -------------------------------------------------------------------------------- 1 | import antlr.BaseAST; 2 | import antlr.Token; 3 | import antlr.collections.AST; 4 | import java.io.*; 5 | 6 | /** A simple node to represent PLUS operation */ 7 | public class PLUSNode extends BinaryOperatorAST { 8 | public PLUSNode(Token tok) { 9 | } 10 | 11 | /** Compute value of subtree; this is heterogeneous part :) */ 12 | public int value() { 13 | return left().value() + right().value(); 14 | } 15 | 16 | public String toString() { 17 | return " +"; 18 | } 19 | 20 | public void xmlSerializeRootOpen(Writer out) throws IOException { 21 | out.write(""); 22 | } 23 | 24 | public void xmlSerializeRootClose(Writer out) throws IOException { 25 | out.write(""); 26 | } 27 | 28 | // satisfy abstract methods from BaseAST 29 | public void initialize(int t, String txt) { 30 | } 31 | public void initialize(AST t) { 32 | } 33 | public void initialize(Token tok) { 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/sather/Antlr/scanner_exception.sa: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | ANTLR Translator Generator 4 | Project led by Terence Parr at http://www.jGuru.com 5 | Software rights: http://www.antlr.org/RIGHTS.html 6 | 7 | $Id: //depot/code/org.antlr/release/antlr-2.7.1/lib/sather/Antlr/scanner_exception.sa#1 $ 8 | 9 | *) 10 | 11 | class ANTLR_SCANNER_EXCEPTION < $STR is 12 | 13 | attr what : STR; 14 | attr line : INT; 15 | -- attr column : INT; 16 | -- attr c : INT; 17 | 18 | create : SAME is 19 | res : SAME := new; 20 | res.what := "scanner error"; 21 | return res; 22 | end; 23 | 24 | create ( m : STR ) : SAME is 25 | res : SAME := new; 26 | res.what := m; 27 | return res; 28 | end; 29 | 30 | create ( w : STR , l : INT ) : SAME is 31 | res : SAME := new; 32 | res.what := w; 33 | res.line := l; 34 | return res; 35 | end; 36 | 37 | str : STR is 38 | return "line(" + line + "), " + what; 39 | end; 40 | 41 | end; 42 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/antlr/TreeParserSharedInputState.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INC_TreeParserSharedInputState_hpp__ 2 | #define INC_TreeParserSharedInputState_hpp__ 3 | 4 | #include "antlr/config.hpp" 5 | #include "antlr/RefCount.hpp" 6 | 7 | ANTLR_BEGIN_NAMESPACE(antlr) 8 | 9 | /** This object contains the data associated with an 10 | * input AST. Multiple parsers 11 | * share a single TreeParserSharedInputState to parse 12 | * the same tree or to have the parser walk multiple 13 | * trees. 14 | */ 15 | class TreeParserInputState { 16 | public: 17 | TreeParserInputState(); 18 | ~TreeParserInputState(); 19 | 20 | public: 21 | /** Are we guessing (guessing>0)? */ 22 | int guessing; //= 0; 23 | 24 | private: 25 | // we don't want these: 26 | TreeParserInputState(const TreeParserInputState&); 27 | TreeParserInputState& operator=(const TreeParserInputState&); 28 | }; 29 | 30 | typedef RefCount TreeParserSharedInputState; 31 | 32 | ANTLR_END_NAMESPACE 33 | 34 | #endif //INC_TreeParserSharedInputState_hpp__ 35 | -------------------------------------------------------------------------------- /antlr-2.7.1/antlr/preprocessor/Option.java: -------------------------------------------------------------------------------- 1 | package antlr.preprocessor; 2 | 3 | /* ANTLR Translator Generator 4 | * Project led by Terence Parr at http://www.jGuru.com 5 | * Software rights: http://www.antlr.org/RIGHTS.html 6 | * 7 | * $Id: //depot/code/org.antlr/release/antlr-2.7.1/antlr/preprocessor/Option.java#1 $ 8 | */ 9 | 10 | import antlr.collections.impl.Vector; 11 | 12 | class Option { 13 | protected String name; 14 | protected String rhs; 15 | protected Grammar enclosingGrammar; 16 | 17 | public Option(String n, String rhs, Grammar gr) { 18 | name = n; 19 | this.rhs = rhs; 20 | setEnclosingGrammar(gr); 21 | } 22 | public Grammar getEnclosingGrammar() {return enclosingGrammar;} 23 | public String getName() { return name; } 24 | public String getRHS() { return rhs; } 25 | public void setEnclosingGrammar(Grammar g) { enclosingGrammar=g; } 26 | public void setName(String n) {name=n;} 27 | public void setRHS(String rhs) {this.rhs = rhs;} 28 | public String toString() { 29 | return "\t"+name+"="+rhs; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /zdk/zls/zlang/data/standard.zh: -------------------------------------------------------------------------------- 1 | #ifndef __ZLang_Standard_Library_zh__ 2 | #define __ZLang_Standard_Library_zh__ 3 | 4 | extern void PrintBool(bool b); 5 | extern void PrintByte(byte uch); 6 | extern void PrintSDWORD(sdword sdw); 7 | extern void PrintUDWORD(udword udw); 8 | extern void PrintSQWORD(sqword sqw); 9 | 10 | extern void PrintUQWORD(uqword uqw); 11 | 12 | extern void PrintDouble(double df); 13 | extern void PrintString(string s); 14 | extern void PrintPPort(pport port); 15 | extern void PrintIPAddress(ipaddress ip); 16 | 17 | extern void PrintlnBool(bool b); 18 | extern void PrintlnByte(byte uch); 19 | extern void PrintlnSDWORD(sdword sdw); 20 | extern void PrintlnUDWORD(udword udw); 21 | extern void PrintlnSQWORD(sqword sqw); 22 | 23 | extern void PrintlnUQWORD(uqword uqw); 24 | 25 | extern void PrintlnDouble(double df); 26 | extern void PrintlnString(string s); 27 | extern void PrintlnPPort(pport port); 28 | extern void PrintlnIPAddress(ipaddress ip); 29 | 30 | extern uqword Time(); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/calc/calc.g: -------------------------------------------------------------------------------- 1 | options { 2 | language = "Sather"; 3 | } 4 | 5 | class CALC_PARSER extends Parser; 6 | options { 7 | buildAST = true; // uses CommonAST by default 8 | } 9 | expr 10 | : mexpr (PLUS^ mexpr)* SEMI! 11 | ; 12 | 13 | mexpr 14 | : atom (STAR^ atom)* 15 | ; 16 | 17 | atom: INT 18 | ; 19 | 20 | class CALC_LEXER extends Lexer; 21 | 22 | WS : (' ' 23 | | '\t' 24 | | '\n' 25 | | '\r') 26 | { sa_ttype := ANTLR_COMMON_TOKEN::SKIP; } 27 | ; 28 | 29 | LPAREN: '(' 30 | ; 31 | 32 | RPAREN: ')' 33 | ; 34 | 35 | STAR: '*' 36 | ; 37 | 38 | PLUS: '+' 39 | ; 40 | 41 | SEMI: ';' 42 | ; 43 | 44 | protected 45 | DIGIT 46 | : '0'..'9' 47 | ; 48 | 49 | INT : (DIGIT)+ 50 | ; 51 | 52 | class CALC_TREE_WALKER extends TreeParser; 53 | 54 | expr returns [ r : FLT ] 55 | { 56 | a , b : FLT; 57 | r := 0.0; 58 | } 59 | : #(PLUS a=expr b=expr) {r := a+b;} 60 | | #(STAR a=expr b=expr) {r := a*b;} 61 | | i:INT {r := #FLT( i.text );} 62 | ; 63 | 64 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/sather/calc/main.sa: -------------------------------------------------------------------------------- 1 | class MAIN is 2 | main ( args : ARRAY{STR} ) is 3 | 4 | if ( args.size < 2 ) then 5 | #OUT + "usage " + args[0] + " \n"; 6 | return; 7 | end; 8 | 9 | f : IFSTREAM := IFSTREAM::open_for_read( args[1] ); 10 | 11 | if ( void(f) ) then 12 | #OUT + "file \"" + args[1] + "\" not found\n"; 13 | return; 14 | end; 15 | 16 | protect 17 | lexer ::= #CALC_LEXER{ANTLR_COMMON_TOKEN}( f ); 18 | lexer.file_name( args[1] ); 19 | 20 | parser ::= #CALC_PARSER{ANTLR_COMMON_TOKEN, ANTLR_COMMON_AST}( lexer ); 21 | parser.file_name( args[1] ); 22 | 23 | parser.expr; 24 | 25 | t : ANTLR_COMMON_AST := parser.ast; 26 | 27 | #OUT + t.str_tree + "\n"; 28 | 29 | walker ::= #CALC_TREE_WALKER{ANTLR_COMMON_AST}; 30 | r : FLT := walker.expr(t); 31 | 32 | #OUT + "value is " + r + "\n"; 33 | 34 | when $ANTLR_RECOGNITION_EXCEPTION then 35 | #ERR + "exception: " + exception.str + "\n"; 36 | end; 37 | 38 | end; 39 | end; 40 | 41 | -------------------------------------------------------------------------------- /antlr-2.7.1/examples/cpp/multiParser/simple.g: -------------------------------------------------------------------------------- 1 | /* This grammar demonstrates the use of two parsers sharing a token 2 | * vocabulary with a single lexer. 3 | */ 4 | 5 | header { 6 | /* empty header */ 7 | } 8 | 9 | options { 10 | language=Cpp; 11 | } 12 | 13 | 14 | 15 | 16 | class SimpleParser extends Parser; 17 | options { 18 | k=2; 19 | tokenVocabulary=Simple; 20 | } 21 | 22 | simple : (x)+; 23 | x : 24 | (a)=> a 25 | | 26 | b 27 | ; 28 | a : A B C; 29 | b : A B D; 30 | 31 | 32 | class SimpleParser2 extends Parser; 33 | options { 34 | k=3; 35 | tokenVocabulary=Simple; 36 | } 37 | 38 | simple : (x)+; 39 | x : 40 | a 41 | | 42 | b 43 | ; 44 | a : C B A; 45 | b : D B A; 46 | 47 | class SimpleLexer extends Lexer; 48 | 49 | options { 50 | tokenVocabulary=Simple; 51 | } 52 | 53 | WS_ : (' ' 54 | | '\t' 55 | | '\n' 56 | | '\r') 57 | { _ttype = Token::SKIP; } 58 | ; 59 | 60 | 61 | A : 'a' | 'A' ; 62 | B : 'b' | 'B' ; 63 | C : 'c' | 'C' ; 64 | D : 'd' | 'D' ; 65 | 66 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/scripts/make_change_log.tcl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # the next line restarts using tclsh \ 3 | exec tclsh $0 $* 4 | 5 | catch {set file [open "|p4 changes -l ./... ../../antlr/CppCodeGenerator.java ../../antlr/actions/cpp/..." r]} 6 | 7 | set cnt 0 8 | set changes {} 9 | set text "" 10 | set change_nr -1 11 | while {![eof $file]} { 12 | set line [gets $file] 13 | 14 | if { [regexp -- {^Change ([0-9]+).*$} $line dummy tmp] } { 15 | # append the number to the list of found changes 16 | lappend changes $tmp 17 | 18 | if { $change_nr != -1 } { 19 | # were already working on change.. 20 | # so we have text to store.. 21 | set description($change_nr) "$text" 22 | } 23 | 24 | # remember number... 25 | set change_nr $tmp 26 | # reinit text 27 | set text "[string trim $line]\n" 28 | } else { 29 | append text " [string trim $line]\n" 30 | } 31 | } 32 | 33 | catch {close $file} 34 | 35 | set sorted_changes [lsort -integer -decreasing $changes] 36 | 37 | foreach change $sorted_changes { 38 | puts $description($change) 39 | } 40 | -------------------------------------------------------------------------------- /antlr-2.7.1/lib/cpp/src/CommonHiddenStreamToken.cpp: -------------------------------------------------------------------------------- 1 | #include "antlr/CommonHiddenStreamToken.hpp" 2 | 3 | ANTLR_BEGIN_NAMESPACE(antlr) 4 | 5 | CommonHiddenStreamToken::CommonHiddenStreamToken() 6 | : CommonToken() 7 | { 8 | } 9 | 10 | CommonHiddenStreamToken::CommonHiddenStreamToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt) 11 | : CommonToken(t,txt) 12 | { 13 | } 14 | 15 | CommonHiddenStreamToken::CommonHiddenStreamToken(const ANTLR_USE_NAMESPACE(std)string& s) 16 | : CommonToken(s) 17 | { 18 | } 19 | 20 | RefToken CommonHiddenStreamToken::getHiddenAfter() 21 | { 22 | return hiddenAfter; 23 | } 24 | 25 | RefToken CommonHiddenStreamToken::getHiddenBefore() 26 | { 27 | return hiddenBefore; 28 | } 29 | 30 | RefToken CommonHiddenStreamToken::factory() 31 | { 32 | return RefToken(new CommonHiddenStreamToken); 33 | } 34 | 35 | void CommonHiddenStreamToken::setHiddenAfter(RefToken t) 36 | { 37 | hiddenAfter = t; 38 | } 39 | 40 | void CommonHiddenStreamToken::setHiddenBefore(RefToken t) 41 | { 42 | hiddenBefore = t; 43 | } 44 | 45 | ANTLR_END_NAMESPACE 46 | 47 | --------------------------------------------------------------------------------