Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
LLkParser.java
Package: antlr-2_7_0.zip [view]
Upload User: afrynkmhm
Upload Date: 2007-01-06
Package Size: 1262k
Code Size: 2k
Category:
Compiler program
Development Platform:
Others
- package antlr;
- /* ANTLR Translator Generator
- * Project led by Terence Parr at http://www.jGuru.com
- * Software rights: http://www.antlr.org/RIGHTS.html
- *
- * $Id: //depot/code/org.antlr/release/antlr-2.7.0/antlr/LLkParser.java#1 $
- */
- import java.io.IOException;
- /**An LL(k) parser.
- *
- * @see antlr.Token
- * @see antlr.TokenBuffer
- * @see antlr.LL1Parser
- */
- public class LLkParser extends Parser {
- int k;
- public LLkParser(int k_) {
- k = k_;
- //TokenBuffer tokenBuf = new TokenBuffer(null);
- //setTokenBuffer(tokenBuf);
- }
- public LLkParser(ParserSharedInputState state, int k_) {
- k = k_;
- inputState = state;
- }
- public LLkParser(TokenBuffer tokenBuf, int k_) {
- k = k_;
- setTokenBuffer(tokenBuf);
- }
- public LLkParser(TokenStream lexer, int k_) {
- k = k_;
- TokenBuffer tokenBuf = new TokenBuffer(lexer);
- setTokenBuffer(tokenBuf);
- }
- /**Consume another token from the input stream. Can only write sequentially!
- * If you need 3 tokens ahead, you must consume() 3 times.
- * <p>
- * Note that it is possible to overwrite tokens that have not been matched.
- * For example, calling consume() 3 times when k=2, means that the first token
- * consumed will be overwritten with the 3rd.
- */
- public void consume() {
- inputState.input.consume();
- }
- public int LA(int i) throws TokenStreamException {
- return inputState.input.LA(i);
- }
- public Token LT(int i) throws TokenStreamException {
- return inputState.input.LT(i);
- }
- private void trace(String ee, String rname) throws TokenStreamException {
- System.out.print(ee + rname + ((inputState.guessing>0)?"; [guessing]":"; "));
- for (int i = 1; i <= k; i++)
- {
- if (i != 1) {
- System.out.print(", ");
- }
- System.out.print("LA(" + i + ")==" + LT(i).getText());
- }
- System.out.println("");
- }
- public void traceIn(String rname) throws TokenStreamException {
- trace("enter ", rname);
- }
- public void traceOut(String rname) throws TokenStreamException {
- trace("exit ", rname);
- }
- }