javacc-5.0.orig/0000755000175000017500000000000011247044055012532 5ustar mkochmkochjavacc-5.0.orig/test/0000755000175000017500000000000011247044055013511 5ustar mkochmkochjavacc-5.0.orig/test/imports/0000755000175000017500000000000011247044054015205 5ustar mkochmkochjavacc-5.0.orig/test/imports/Parser.jj0000644000175000017500000000372410726264152017000 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { STATIC=false; OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Parser) import java.util.Map; import java.util.HashMap; public class Parser { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } } PARSER_END(Parser) TOKEN_MGR_DECLS : { Map map = new HashMap(); } TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> } Map CompilationUnit() : { Map map; } { "A" { map = new HashMap(); } { return map; } } javacc-5.0.orig/test/imports/build.xml0000644000175000017500000000360711165261216017034 0ustar mkochmkoch javacc-5.0.orig/test/javaFiles/0000755000175000017500000000000011247044055015415 5ustar mkochmkochjavacc-5.0.orig/test/javaFiles/Parser.jj0000644000175000017500000000361410722653636017212 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { STATIC=false; OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Parser) /** * Test the creation / modification of Java Files (Token.java etc). **/ public class Parser { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } } PARSER_END(Parser) TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> } void CompilationUnit() : {} { ("A" | "B" )* } javacc-5.0.orig/test/javaFiles/ModifiedSimpleNode.java0000644000175000017500000000417710752305554021775 0ustar mkochmkoch/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.1 */ /* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY= */ /* This comment inserted to make the checksum mismatch */ public class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; protected Object value; protected Tree parser; public SimpleNode(int i) { id = i; } public SimpleNode(Tree p, int i) { this(i); parser = p; } public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } public void jjtSetValue(Object value) { this.value = value; } public Object jjtGetValue() { return value; } /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return TreeTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode)children[i]; if (n != null) { n.dump(prefix + " "); } } } } } /* JavaCC - OriginalChecksum=86c4603fd0a98eb480a899b295902806 (do not edit this line) */ javacc-5.0.orig/test/javaFiles/Multi.jjt0000644000175000017500000000361610723552171017227 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { MULTI=true; STATIC=false; OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Tree) /** * Test the creation / modification of Java Files (Token.java etc). **/ public class Tree { public static void main(String args[]) throws Exception { Tree t = new Tree(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } } PARSER_END(Tree) TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> } void CompilationUnit() : {} { ("A" | "B" )* } javacc-5.0.orig/test/javaFiles/ChangedOptionsSimpleCharStream.java0000644000175000017500000002742510752305554024327 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ /* JavaCCOptions:STATIC=true */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; /** Position in buffer. */ public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 8; protected void setTabSize(int i) { tabSize = i; } protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } /** * @deprecated * @see #getEndColumn */ public int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } /* JavaCC - OriginalChecksum=c3b970b0cc7cb434c1a41c40f81370b5 (do not edit this line) */ javacc-5.0.orig/test/javaFiles/BaseSimpleCharStream.java0000644000175000017500000002742610752305554022275 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ /* JavaCCOptions:STATIC=false */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; /** Position in buffer. */ public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 8; protected void setTabSize(int i) { tabSize = i; } protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } /** * @deprecated * @see #getEndColumn */ public int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } /* JavaCC - OriginalChecksum=c3b970b0cc7cb434c1a41c40f81370b5 (do not edit this line) */ javacc-5.0.orig/test/javaFiles/ModifiedOldSimpleCharStream.java0000644000175000017500000002742610752305554023602 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 2.0 */ /* JavaCCOptions:STATIC=false */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; /** Position in buffer. */ public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 8; protected void setTabSize(int i) { tabSize = i; } protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } /** * @deprecated * @see #getEndColumn */ public int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } /* JavaCC - OriginalChecksum=c3b970b0cc7cb434c1a41c40f81370b5 (do not edit this line) */ javacc-5.0.orig/test/javaFiles/OldSimpleCharStream.java0000644000175000017500000002742610752305554022141 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 2.0 */ /* JavaCCOptions:STATIC=false */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; /** Position in buffer. */ public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 8; protected void setTabSize(int i) { tabSize = i; } protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } /** * @deprecated * @see #getEndColumn */ public int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } /* JavaCC - OriginalChecksum=c3b970b0cc7cb434c1a41c40f81370b5 (do not edit this line) */ javacc-5.0.orig/test/javaFiles/ModifiedSimpleCharStream.java0000644000175000017500000002752510752305554023143 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ /* JavaCCOptions:STATIC=false */ /* this comment added to produce a mismatch with checksum */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; /** Position in buffer. */ public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 8; protected void setTabSize(int i) { tabSize = i; } protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } /** * @deprecated * @see #getEndColumn */ public int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } /* JavaCC - OriginalChecksum=c3b970b0cc7cb434c1a41c40f81370b5 (do not edit this line) */ javacc-5.0.orig/test/javaFiles/README.txt0000644000175000017500000000051711065705537017125 0ustar mkochmkochTests the creation of the near bolier-plate Java Files, created by JavaFiles.java. It checks that files are recreated automatically if they are unchanged, but not modified if they have changed. It also checks that incompatible options are handled correctly. See also "javaFileGeneration" test, which checks the contents of the files. javacc-5.0.orig/test/javaFiles/Tree.jjt0000644000175000017500000000360210722653636017036 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { STATIC=false; OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Tree) /** * Test the creation / modification of Java Files (Token.java etc). **/ public class Tree { public static void main(String args[]) throws Exception { Tree t = new Tree(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } } PARSER_END(Tree) TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> } void CompilationUnit() : {} { ("A" | "B" )* } javacc-5.0.orig/test/javaFiles/build.xml0000644000175000017500000002021311165261220017226 0ustar mkochmkoch Test 1 - Initial Creation ${test1.out} Test 2 - Recreate Unchanged ${test2.out} Test 3 - Compatible Modified. ${test3.out} Test 4 - Modified Old. ${test4.out} Test 5 - Changed Options. ${test5.out} Test 6 - Create JJtree Nodes ${test6.out} Test 7 - Create JJtree Nodes ${test7.out} Test 8 - Regenerate JJtree Nodes ${test8.out} Test 9 - Incompatible JJtree Nodes ${test9.out} javacc-5.0.orig/test/javaFiles/StaticParser.jj0000644000175000017500000000361310722653636020361 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { STATIC=true; OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Parser) /** * Test the creation / modification of Java Files (Token.java etc). **/ public class Parser { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } } PARSER_END(Parser) TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> } void CompilationUnit() : {} { ("A" | "B" )* } javacc-5.0.orig/test/javaFiles/BaseSimpleNode.java0000644000175000017500000000410310752305554021114 0ustar mkochmkoch/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.1 */ /* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY= */ public class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; protected Object value; protected Tree parser; public SimpleNode(int i) { id = i; } public SimpleNode(Tree p, int i) { this(i); parser = p; } public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } public void jjtSetValue(Object value) { this.value = value; } public Object jjtGetValue() { return value; } /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return TreeTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode)children[i]; if (n != null) { n.dump(prefix + " "); } } } } } /* JavaCC - OriginalChecksum=86c4603fd0a98eb480a899b295902806 (do not edit this line) */ javacc-5.0.orig/test/javaFiles/IncompatSimpleNode.java0000644000175000017500000000410410752305554022015 0ustar mkochmkoch/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.1 */ /* JavaCCOptions:MULTI=false,NODE_USES_PARSER=true,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY= */ public class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; protected Object value; protected Tree parser; public SimpleNode(int i) { id = i; } public SimpleNode(Tree p, int i) { this(i); parser = p; } public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } public void jjtSetValue(Object value) { this.value = value; } public Object jjtGetValue() { return value; } /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return TreeTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode)children[i]; if (n != null) { n.dump(prefix + " "); } } } } } /* JavaCC - OriginalChecksum=86c4603fd0a98eb480a899b295902806 (do not edit this line) */ javacc-5.0.orig/test/newToken/0000755000175000017500000000000011247044055015303 5ustar mkochmkochjavacc-5.0.orig/test/newToken/Parser.jj0000644000175000017500000000354710724130425017071 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { STATIC=false; OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Parser) /** * Test the creation of Tokens **/ public class Parser { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } } PARSER_END(Parser) TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> } void CompilationUnit() : {} { ("A" | "B" )* } javacc-5.0.orig/test/newToken/OldToken.java0000644000175000017500000000710510724130425017664 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.1 */ /** * Describes the input token stream. */ public class Token { /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument contructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); } } public static Token newToken(int ofKind) { return newToken(ofKind, null); } } javacc-5.0.orig/test/newToken/ParserTokenFactory.jj0000644000175000017500000000361110724130425021412 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { TOKEN_FACTORY="my.token.Factory"; STATIC=false; OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Parser) /** * Test the creation of Tokens **/ public class Parser { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } } PARSER_END(Parser) TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> } void CompilationUnit() : {} { ("A" | "B" )* } javacc-5.0.orig/test/newToken/build.xml0000644000175000017500000000572210772170017017132 0ustar mkochmkoch javacc-5.0.orig/test/javacodeLA/0000755000175000017500000000000011247044055015502 5ustar mkochmkochjavacc-5.0.orig/test/javacodeLA/build.xml0000644000175000017500000001566211165261220017327 0ustar mkochmkoch Test 1 ${test1.out} Test 2 ${test2.out} Test 3 ${test3.out} Test 4 ${test4.out} Test 5 ${test5.out} Test 6 ${test6.out} Test 7 ${test7.out} ${test7.err} Test 8 ${test8.out} Test 9 ${test9.out} ${test9.err} Test 10 ${test10.out} ${test10.err} Test 11 ${test11.out} Test 12 ${test12.out} ${test12.err} Test 13 ${test13.out} ${test13.err} javacc-5.0.orig/test/javacodeLA/javacode.jj0000644000175000017500000000662410722653636017623 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(JavacodeTest) /** * A test to verify the interaction between JAVACODE * productions and lookajead. **/ public class JavacodeTest { public static void main(String args[]) throws Exception { JavacodeTest t = new JavacodeTest(System.in); System.out.print("Answer is: "); try { switch (args[0].charAt(0)) { case 'j': Javacode(); break; case 'n': NoJavacode(); break; case 'i': IndirectJavacode(); break; case 'I': IndirectJavacode2(); break; case 'N': JavacodeNoLa(); break; } } catch (Exception e) { System.out.println("Oops."); System.out.println(e.getMessage()); throw(e); } System.out.println("."); } public static boolean isC() { return getToken(1).image.equals("C"); } } PARSER_END(JavacodeTest) TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> } void Javacode() : {} { (A() | LOOKAHEAD( "C" ) javacode_method() | D() )* } void JavacodeNoLa() : {} { (A() | javacode_method() | D() ) } /* * Similar non-javacode constructs are allowed. This checks a pointless * (but legal) case. */ void NoJavacode() : {} { (A() | LOOKAHEAD( "C" ) B() | D() )* } /* * For sematic lookahead, the LA executes as expected (only * succeeds if both the semantic and normal LA succeeds). */ void Semantic() : {} { (A() | LOOKAHEAD( {isC()} ) B() | D() )* } void IndirectJavacode() : {} { ( A() | Ind() | B() ) } void IndirectJavacode2() : {} { ( A() | LOOKAHEAD("X") Ind() | B() ) } void Ind() : {} { javacode_method() } void A() : { } { "A" { System.out.print("A"); } } void B() : { } { "B" { System.out.print("B"); } } void C() : { } { "C" { System.out.print("C"); } } void D() : { } { "D" { System.out.print("D"); } } JAVACODE void javacode_method() { Token t = getNextToken(); System.out.print("javacode " + t.image); } javacc-5.0.orig/test/lom/0000755000175000017500000000000011247044055014300 5ustar mkochmkochjavacc-5.0.orig/test/lom/Parser.jj0000644000175000017500000000410610743237237016070 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { STATIC=false; OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Parser) /** * Test lengthOfMatch **/ public class Parser { public static void main(String args[]) throws Exception { Parser t = new Parser(new java.io.StringReader("PLAIN_STRING abc B")); while (t.getNextToken().kind != EOF) { } } } PARSER_END(Parser) TOKEN : { < PLAIN_STRING: "PLAIN_STRING"> { System.out.println("PLAIN_STRING=" + lengthOfMatch); } | < REGEXP: (["a" - "z"])+ > { System.out.println("a-z=" + lengthOfMatch); } | < CHOICE: "A" | "B"> { System.out.println("A|B=" + lengthOfMatch); } } SKIP : { " " { System.out.println("space=" + lengthOfMatch); } } javacc-5.0.orig/test/lom/build.xml0000644000175000017500000000466511165261220016126 0ustar mkochmkoch ${test.out} javacc-5.0.orig/test/javaFileGeneration/0000755000175000017500000000000011247044054017245 5ustar mkochmkochjavacc-5.0.orig/test/javaFileGeneration/Parser.jj0000644000175000017500000000345611065705531021040 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Parser) public class Parser { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } } PARSER_END(Parser) TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> } void CompilationUnit() : {} { ("A" | "B" )* } javacc-5.0.orig/test/javaFileGeneration/template.txt0000644000175000017500000000102111067674047021626 0ustar mkochmkochHello, world #if falseArg Shouldn't be here. #else But this should -->${stringValue}<-- #fi #if true True1 ${stringValue:-Should not be here} ${noSuchVar:-Should be here} #if trueArg True2 #else False 1 #fi #else False 2 #if true Not expected #else Not expected 2 #fi #fi This should say no: ${falseArg?yes:no} This should say yes: ${trueArg?yes:no} This should say someString: ${trueArg?${stringValue}:} This should say xxsomeStringxx: ${not_found?${stringValue}:xx${stringValue}xx} The end. javacc-5.0.orig/test/javaFileGeneration/README.txt0000644000175000017500000000012311065705531020741 0ustar mkochmkochTests the contents of the near bolier-plate Java Files, created by JavaFiles.java. javacc-5.0.orig/test/javaFileGeneration/build.xml0000644000175000017500000001724411067702664021106 0ustar mkochmkoch Static Parser Non-static Parser No-Keep-Line Parser Not Public test-generator javacc-5.0.orig/test/javaFileGeneration/expected/0000755000175000017500000000000011247044054021046 5ustar mkochmkochjavacc-5.0.orig/test/javaFileGeneration/expected/not-public/0000755000175000017500000000000011247044054023122 5ustar mkochmkochjavacc-5.0.orig/test/javaFileGeneration/expected/not-public/TokenMgrError.java0000644000175000017500000001045011227705230026523 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ /** Token Manager Error. */ class TokenMgrError extends Error { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their escaped (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ /** No arg constructor. */ public TokenMgrError() { } /** Constructor with message and reason. */ public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } /** Full Constructor. */ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } /* JavaCC - OriginalChecksum=213b79f187f0414966168064c54e0ec2 (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/not-public/Parser.java0000644000175000017500000001516111220171200025206 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Parser.java */ public class Parser implements ParserConstants { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } static final public void CompilationUnit() throws ParseException { label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case A: case B: ; break; default: jj_la1[0] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case A: jj_consume_token(A); break; case B: jj_consume_token(B); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(0); } static private boolean jj_initialized_once = false; /** Generated Token Manager. */ static public ParserTokenManager token_source; static SimpleCharStream jj_input_stream; /** Current token. */ static public Token token; /** Next token. */ static public Token jj_nt; static private int jj_ntk; static private int jj_gen; static final private int[] jj_la1 = new int[2]; static private int[] jj_la1_0; static { jj_la1_init_0(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x6,0x6,}; } /** Constructor with InputStream. */ public Parser(java.io.InputStream stream) { this(stream, null); } /** Constructor with InputStream and supplied encoding */ public Parser(java.io.InputStream stream, String encoding) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Constructor. */ public Parser(java.io.Reader stream) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ static public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public Parser(ParserTokenManager tm) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } static private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } /** Get the next Token. */ static final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ static final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } static private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } static private java.util.List jj_expentries = new java.util.ArrayList(); static private int[] jj_expentry; static private int jj_kind = -1; /** Generate ParseException. */ static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[5]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 2; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); } /** Constructor with message. */ public ParseException(String message) { super(message); } /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * It uses "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser) the correct error message * gets displayed. */ private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += " " + tokenImage[tok.kind]; retval += " \""; retval += add_escapes(tok.image); retval += " \""; tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected.toString(); return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ static String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } /* JavaCC - OriginalChecksum=c5a983a229aa877dc2b3b3b9933cdd6b (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/not-public/ParserTokenManager.java0000644000175000017500000001166611067702665027540 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */ /** Token Manager. */ class ParserTokenManager implements ParserConstants { /** Debug output. */ public static java.io.PrintStream debugStream = System.out; /** Set debug output. */ public static void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } static private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } static private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 65: return jjStopAtPos(0, 1); case 66: return jjStopAtPos(0, 2); case 67: return jjStopAtPos(0, 3); case 68: return jjStopAtPos(0, 4); default : return 1; } } static final int[] jjnextStates = { }; /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", "\101", "\102", "\103", "\104", }; /** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", }; static protected SimpleCharStream input_stream; static private final int[] jjrounds = new int[0]; static private final int[] jjstateSet = new int[0]; static protected char curChar; /** Constructor. */ public ParserTokenManager(SimpleCharStream stream){ if (input_stream != null) throw new TokenMgrError("ERROR: Second call to constructor of static lexer. You must use ReInit() to initialize the static variables.", TokenMgrError.STATIC_LEXER_ERROR); input_stream = stream; } /** Constructor. */ public ParserTokenManager(SimpleCharStream stream, int lexState){ this(stream); SwitchTo(lexState); } /** Reinitialise parser. */ static public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } static private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 0; i-- > 0;) jjrounds[i] = 0x80000000; } /** Reinitialise parser. */ static public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } /** Switch to specified lex state. */ static public void SwitchTo(int lexState) { if (lexState >= 1 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } static protected Token jjFillToken() { final Token t; final String curTokenImage; final int beginLine; final int endLine; final int beginColumn; final int endColumn; String im = jjstrLiteralImages[jjmatchedKind]; curTokenImage = (im == null) ? input_stream.GetImage() : im; beginLine = input_stream.getBeginLine(); beginColumn = input_stream.getBeginColumn(); endLine = input_stream.getEndLine(); endColumn = input_stream.getEndColumn(); t = Token.newToken(jjmatchedKind, curTokenImage); t.beginLine = beginLine; t.endLine = endLine; t.beginColumn = beginColumn; t.endColumn = endColumn; return t; } static int curLexState = 0; static int defaultLexState = 0; static int jjnewStateCnt; static int jjround; static int jjmatchedPos; static int jjmatchedKind; /** Get the next Token. */ public static Token getNextToken() { Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); matchedToken = jjFillToken(); return matchedToken; } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } static private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } static private void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } static private void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } } javacc-5.0.orig/test/javaFileGeneration/expected/not-public/Token.java0000644000175000017500000000772111227705230025052 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=false */ /** * Describes the input token stream. */ class Token implements java.io.Serializable { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument constructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); } } public static Token newToken(int ofKind) { return newToken(ofKind, null); } } /* JavaCC - OriginalChecksum=169c5b3c60b1aef218bf367bf1938a64 (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/not-public/ParserConstants.java0000644000175000017500000000112011067702665027121 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ /** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ interface ParserConstants { /** End of File. */ int EOF = 0; /** RegularExpression Id. */ int A = 1; /** RegularExpression Id. */ int B = 2; /** RegularExpression Id. */ int C = 3; /** RegularExpression Id. */ int D = 4; /** Lexical state. */ int DEFAULT = 0; /** Literal token values. */ String[] tokenImage = { "", "\"A\"", "\"B\"", "\"C\"", "\"D\"", }; } javacc-5.0.orig/test/javaFileGeneration/expected/not-public/SimpleCharStream.java0000644000175000017500000002760611227705227027207 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=false */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = true; static int bufsize; static int available; static int tokenBegin; /** Position in buffer. */ static public int bufpos = -1; static protected int bufline[]; static protected int bufcolumn[]; static protected int column = 0; static protected int line = 1; static protected boolean prevCharIsCR = false; static protected boolean prevCharIsLF = false; static protected java.io.Reader inputStream; static protected char[] buffer; static protected int maxNextCharInd = 0; static protected int inBuf = 0; static protected int tabSize = 8; static protected void setTabSize(int i) { tabSize = i; } static protected int getTabSize(int i) { return tabSize; } static protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ static public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } static protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ static public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } @Deprecated /** * @deprecated * @see #getEndColumn */ static public int getColumn() { return bufcolumn[bufpos]; } @Deprecated /** * @deprecated * @see #getEndLine */ static public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ static public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ static public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ static public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ static public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ static public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { if (inputStream != null) throw new Error("\n ERROR: Second call to the constructor of a static SimpleCharStream.\n" + " You must either use ReInit() or set the JavaCC option STATIC to false\n" + " during the generation of this class."); inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ static public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ static public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ static public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ static public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } /* JavaCC - OriginalChecksum=57ae6febdeb179190375b93599662b46 (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/non-static/0000755000175000017500000000000011247044054023125 5ustar mkochmkochjavacc-5.0.orig/test/javaFileGeneration/expected/non-static/TokenMgrError.java0000644000175000017500000001045711227705227026543 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ /** Token Manager Error. */ public class TokenMgrError extends Error { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their escaped (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ /** No arg constructor. */ public TokenMgrError() { } /** Constructor with message and reason. */ public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } /** Full Constructor. */ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } /* JavaCC - OriginalChecksum=3f827858bf5c87e5502cccca67d9b325 (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/non-static/Parser.java0000644000175000017500000001263711220171177025233 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Parser.java */ public class Parser implements ParserConstants { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } final public void CompilationUnit() throws ParseException { label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case A: case B: ; break; default: jj_la1[0] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case A: jj_consume_token(A); break; case B: jj_consume_token(B); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(0); } /** Generated Token Manager. */ public ParserTokenManager token_source; SimpleCharStream jj_input_stream; /** Current token. */ public Token token; /** Next token. */ public Token jj_nt; private int jj_ntk; private int jj_gen; final private int[] jj_la1 = new int[2]; static private int[] jj_la1_0; static { jj_la1_init_0(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x6,0x6,}; } /** Constructor with InputStream. */ public Parser(java.io.InputStream stream) { this(stream, null); } /** Constructor with InputStream and supplied encoding */ public Parser(java.io.InputStream stream, String encoding) { try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Constructor. */ public Parser(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public Parser(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } /** Get the next Token. */ final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } private java.util.List jj_expentries = new java.util.ArrayList(); private int[] jj_expentry; private int jj_kind = -1; /** Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[5]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 2; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); } /** Constructor with message. */ public ParseException(String message) { super(message); } /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * It uses "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser) the correct error message * gets displayed. */ private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += " " + tokenImage[tok.kind]; retval += " \""; retval += add_escapes(tok.image); retval += " \""; tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected.toString(); return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ static String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } /* JavaCC - OriginalChecksum=c5a983a229aa877dc2b3b3b9933cdd6b (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/non-static/ParserTokenManager.java0000644000175000017500000001133411065705533027526 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */ /** Token Manager. */ public class ParserTokenManager implements ParserConstants { /** Debug output. */ public java.io.PrintStream debugStream = System.out; /** Set debug output. */ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 65: return jjStopAtPos(0, 1); case 66: return jjStopAtPos(0, 2); case 67: return jjStopAtPos(0, 3); case 68: return jjStopAtPos(0, 4); default : return 1; } } static final int[] jjnextStates = { }; /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", "\101", "\102", "\103", "\104", }; /** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", }; protected SimpleCharStream input_stream; private final int[] jjrounds = new int[0]; private final int[] jjstateSet = new int[0]; protected char curChar; /** Constructor. */ public ParserTokenManager(SimpleCharStream stream){ if (SimpleCharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream; } /** Constructor. */ public ParserTokenManager(SimpleCharStream stream, int lexState){ this(stream); SwitchTo(lexState); } /** Reinitialise parser. */ public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 0; i-- > 0;) jjrounds[i] = 0x80000000; } /** Reinitialise parser. */ public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } /** Switch to specified lex state. */ public void SwitchTo(int lexState) { if (lexState >= 1 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } protected Token jjFillToken() { final Token t; final String curTokenImage; final int beginLine; final int endLine; final int beginColumn; final int endColumn; String im = jjstrLiteralImages[jjmatchedKind]; curTokenImage = (im == null) ? input_stream.GetImage() : im; beginLine = input_stream.getBeginLine(); beginColumn = input_stream.getBeginColumn(); endLine = input_stream.getEndLine(); endColumn = input_stream.getEndColumn(); t = Token.newToken(jjmatchedKind, curTokenImage); t.beginLine = beginLine; t.endLine = endLine; t.beginColumn = beginColumn; t.endColumn = endColumn; return t; } int curLexState = 0; int defaultLexState = 0; int jjnewStateCnt; int jjround; int jjmatchedPos; int jjmatchedKind; /** Get the next Token. */ public Token getNextToken() { Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); matchedToken = jjFillToken(); return matchedToken; } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } private void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } private void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } } javacc-5.0.orig/test/javaFileGeneration/expected/non-static/Token.java0000644000175000017500000000772711227705227025071 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ /** * Describes the input token stream. */ public class Token implements java.io.Serializable { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument constructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); } } public static Token newToken(int ofKind) { return newToken(ofKind, null); } } /* JavaCC - OriginalChecksum=6145f5d5b504ccb4f95e09f2ce3e748a (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/non-static/ParserConstants.java0000644000175000017500000000112711065705532027125 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ /** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ public interface ParserConstants { /** End of File. */ int EOF = 0; /** RegularExpression Id. */ int A = 1; /** RegularExpression Id. */ int B = 2; /** RegularExpression Id. */ int C = 3; /** RegularExpression Id. */ int D = 4; /** Lexical state. */ int DEFAULT = 0; /** Literal token values. */ String[] tokenImage = { "", "\"A\"", "\"B\"", "\"C\"", "\"D\"", }; } javacc-5.0.orig/test/javaFileGeneration/expected/non-static/SimpleCharStream.java0000644000175000017500000002662611227705227027213 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; /** Position in buffer. */ public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 8; protected void setTabSize(int i) { tabSize = i; } protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } @Deprecated /** * @deprecated * @see #getEndColumn */ public int getColumn() { return bufcolumn[bufpos]; } @Deprecated /** * @deprecated * @see #getEndLine */ public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } /* JavaCC - OriginalChecksum=b0bce35239226f00f9dd0fa14ab3ad17 (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/generated.txt0000644000175000017500000000036411067674047023563 0ustar mkochmkochHello, world But this should -->someString<-- True1 someString Should be here True2 This should say no: no This should say yes: yes This should say someString: someString This should say xxsomeStringxx: xxsomeStringxx The end. javacc-5.0.orig/test/javaFileGeneration/expected/static/0000755000175000017500000000000011247044055022336 5ustar mkochmkochjavacc-5.0.orig/test/javaFileGeneration/expected/static/TokenMgrError.java0000644000175000017500000001045711227705230025745 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ /** Token Manager Error. */ public class TokenMgrError extends Error { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their escaped (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ /** No arg constructor. */ public TokenMgrError() { } /** Constructor with message and reason. */ public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } /** Full Constructor. */ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } /* JavaCC - OriginalChecksum=3f827858bf5c87e5502cccca67d9b325 (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/static/Parser.java0000644000175000017500000001516111220171200024421 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Parser.java */ public class Parser implements ParserConstants { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } static final public void CompilationUnit() throws ParseException { label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case A: case B: ; break; default: jj_la1[0] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case A: jj_consume_token(A); break; case B: jj_consume_token(B); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(0); } static private boolean jj_initialized_once = false; /** Generated Token Manager. */ static public ParserTokenManager token_source; static SimpleCharStream jj_input_stream; /** Current token. */ static public Token token; /** Next token. */ static public Token jj_nt; static private int jj_ntk; static private int jj_gen; static final private int[] jj_la1 = new int[2]; static private int[] jj_la1_0; static { jj_la1_init_0(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x6,0x6,}; } /** Constructor with InputStream. */ public Parser(java.io.InputStream stream) { this(stream, null); } /** Constructor with InputStream and supplied encoding */ public Parser(java.io.InputStream stream, String encoding) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Constructor. */ public Parser(java.io.Reader stream) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ static public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public Parser(ParserTokenManager tm) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } static private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } /** Get the next Token. */ static final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ static final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } static private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } static private java.util.List jj_expentries = new java.util.ArrayList(); static private int[] jj_expentry; static private int jj_kind = -1; /** Generate ParseException. */ static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[5]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 2; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); } /** Constructor with message. */ public ParseException(String message) { super(message); } /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * It uses "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser) the correct error message * gets displayed. */ private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += " " + tokenImage[tok.kind]; retval += " \""; retval += add_escapes(tok.image); retval += " \""; tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected.toString(); return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ static String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } /* JavaCC - OriginalChecksum=c5a983a229aa877dc2b3b3b9933cdd6b (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/static/ParserTokenManager.java0000644000175000017500000001167511065705535026750 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */ /** Token Manager. */ public class ParserTokenManager implements ParserConstants { /** Debug output. */ public static java.io.PrintStream debugStream = System.out; /** Set debug output. */ public static void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } static private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } static private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 65: return jjStopAtPos(0, 1); case 66: return jjStopAtPos(0, 2); case 67: return jjStopAtPos(0, 3); case 68: return jjStopAtPos(0, 4); default : return 1; } } static final int[] jjnextStates = { }; /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", "\101", "\102", "\103", "\104", }; /** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", }; static protected SimpleCharStream input_stream; static private final int[] jjrounds = new int[0]; static private final int[] jjstateSet = new int[0]; static protected char curChar; /** Constructor. */ public ParserTokenManager(SimpleCharStream stream){ if (input_stream != null) throw new TokenMgrError("ERROR: Second call to constructor of static lexer. You must use ReInit() to initialize the static variables.", TokenMgrError.STATIC_LEXER_ERROR); input_stream = stream; } /** Constructor. */ public ParserTokenManager(SimpleCharStream stream, int lexState){ this(stream); SwitchTo(lexState); } /** Reinitialise parser. */ static public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } static private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 0; i-- > 0;) jjrounds[i] = 0x80000000; } /** Reinitialise parser. */ static public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } /** Switch to specified lex state. */ static public void SwitchTo(int lexState) { if (lexState >= 1 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } static protected Token jjFillToken() { final Token t; final String curTokenImage; final int beginLine; final int endLine; final int beginColumn; final int endColumn; String im = jjstrLiteralImages[jjmatchedKind]; curTokenImage = (im == null) ? input_stream.GetImage() : im; beginLine = input_stream.getBeginLine(); beginColumn = input_stream.getBeginColumn(); endLine = input_stream.getEndLine(); endColumn = input_stream.getEndColumn(); t = Token.newToken(jjmatchedKind, curTokenImage); t.beginLine = beginLine; t.endLine = endLine; t.beginColumn = beginColumn; t.endColumn = endColumn; return t; } static int curLexState = 0; static int defaultLexState = 0; static int jjnewStateCnt; static int jjround; static int jjmatchedPos; static int jjmatchedKind; /** Get the next Token. */ public static Token getNextToken() { Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); matchedToken = jjFillToken(); return matchedToken; } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } static private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } static private void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } static private void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } } javacc-5.0.orig/test/javaFileGeneration/expected/static/Token.java0000644000175000017500000000772711227705230024273 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ /** * Describes the input token stream. */ public class Token implements java.io.Serializable { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument constructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); } } public static Token newToken(int ofKind) { return newToken(ofKind, null); } } /* JavaCC - OriginalChecksum=6145f5d5b504ccb4f95e09f2ce3e748a (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/static/ParserConstants.java0000644000175000017500000000112711065705535026340 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ /** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ public interface ParserConstants { /** End of File. */ int EOF = 0; /** RegularExpression Id. */ int A = 1; /** RegularExpression Id. */ int B = 2; /** RegularExpression Id. */ int C = 3; /** RegularExpression Id. */ int D = 4; /** Lexical state. */ int DEFAULT = 0; /** Literal token values. */ String[] tokenImage = { "", "\"A\"", "\"B\"", "\"C\"", "\"D\"", }; } javacc-5.0.orig/test/javaFileGeneration/expected/static/SimpleCharStream.java0000644000175000017500000002761411227705230026413 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = true; static int bufsize; static int available; static int tokenBegin; /** Position in buffer. */ static public int bufpos = -1; static protected int bufline[]; static protected int bufcolumn[]; static protected int column = 0; static protected int line = 1; static protected boolean prevCharIsCR = false; static protected boolean prevCharIsLF = false; static protected java.io.Reader inputStream; static protected char[] buffer; static protected int maxNextCharInd = 0; static protected int inBuf = 0; static protected int tabSize = 8; static protected void setTabSize(int i) { tabSize = i; } static protected int getTabSize(int i) { return tabSize; } static protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ static public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } static protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } /** Read a character. */ static public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; } @Deprecated /** * @deprecated * @see #getEndColumn */ static public int getColumn() { return bufcolumn[bufpos]; } @Deprecated /** * @deprecated * @see #getEndLine */ static public int getLine() { return bufline[bufpos]; } /** Get token end column number. */ static public int getEndColumn() { return bufcolumn[bufpos]; } /** Get token end line number. */ static public int getEndLine() { return bufline[bufpos]; } /** Get token beginning column number. */ static public int getBeginColumn() { return bufcolumn[tokenBegin]; } /** Get token beginning line number. */ static public int getBeginLine() { return bufline[tokenBegin]; } /** Backup a number of characters. */ static public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { if (inputStream != null) throw new Error("\n ERROR: Second call to the constructor of a static SimpleCharStream.\n" + " You must either use ReInit() or set the JavaCC option STATIC to false\n" + " during the generation of this class."); inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ static public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ static public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ static public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ static public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } /* JavaCC - OriginalChecksum=382b1af94ddaf8942012341b3b13600e (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/no-keep-line/0000755000175000017500000000000011247044054023331 5ustar mkochmkochjavacc-5.0.orig/test/javaFileGeneration/expected/no-keep-line/TokenMgrError.java0000644000175000017500000001045711227705227026747 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ /** Token Manager Error. */ public class TokenMgrError extends Error { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their escaped (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ /** No arg constructor. */ public TokenMgrError() { } /** Constructor with message and reason. */ public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } /** Full Constructor. */ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } /* JavaCC - OriginalChecksum=3f827858bf5c87e5502cccca67d9b325 (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/no-keep-line/Parser.java0000644000175000017500000001516111220171177025432 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Parser.java */ public class Parser implements ParserConstants { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } static final public void CompilationUnit() throws ParseException { label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case A: case B: ; break; default: jj_la1[0] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case A: jj_consume_token(A); break; case B: jj_consume_token(B); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(0); } static private boolean jj_initialized_once = false; /** Generated Token Manager. */ static public ParserTokenManager token_source; static SimpleCharStream jj_input_stream; /** Current token. */ static public Token token; /** Next token. */ static public Token jj_nt; static private int jj_ntk; static private int jj_gen; static final private int[] jj_la1 = new int[2]; static private int[] jj_la1_0; static { jj_la1_init_0(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x6,0x6,}; } /** Constructor with InputStream. */ public Parser(java.io.InputStream stream) { this(stream, null); } /** Constructor with InputStream and supplied encoding */ public Parser(java.io.InputStream stream, String encoding) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** Reinitialise. */ static public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Constructor. */ public Parser(java.io.Reader stream) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ static public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Constructor with generated Token Manager. */ public Parser(ParserTokenManager tm) { if (jj_initialized_once) { System.out.println("ERROR: Second call to constructor of static parser. "); System.out.println(" You must either use ReInit() or set the JavaCC option STATIC to false"); System.out.println(" during parser generation."); throw new Error(); } jj_initialized_once = true; token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } /** Reinitialise. */ public void ReInit(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 2; i++) jj_la1[i] = -1; } static private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } /** Get the next Token. */ static final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ static final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } static private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } static private java.util.List jj_expentries = new java.util.ArrayList(); static private int[] jj_expentry; static private int jj_kind = -1; /** Generate ParseException. */ static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[5]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 2; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); } /** Constructor with message. */ public ParseException(String message) { super(message); } /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * It uses "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser) the correct error message * gets displayed. */ private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += " " + tokenImage[tok.kind]; retval += " \""; retval += add_escapes(tok.image); retval += " \""; tok = tok.next; } retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected.toString(); return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ static String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } /* JavaCC - OriginalChecksum=f62826d6c4fe7be640b2ae0f9c3da802 (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/no-keep-line/ParserTokenManager.java0000644000175000017500000001107411065706400027725 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */ /** Token Manager. */ public class ParserTokenManager implements ParserConstants { /** Debug output. */ public static java.io.PrintStream debugStream = System.out; /** Set debug output. */ public static void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } static private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } static private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 65: return jjStopAtPos(0, 1); case 66: return jjStopAtPos(0, 2); case 67: return jjStopAtPos(0, 3); case 68: return jjStopAtPos(0, 4); default : return 1; } } static final int[] jjnextStates = { }; /** Token literal values. */ public static final String[] jjstrLiteralImages = { "", "\101", "\102", "\103", "\104", }; /** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", }; static protected SimpleCharStream input_stream; static private final int[] jjrounds = new int[0]; static private final int[] jjstateSet = new int[0]; static protected char curChar; /** Constructor. */ public ParserTokenManager(SimpleCharStream stream){ if (input_stream != null) throw new TokenMgrError("ERROR: Second call to constructor of static lexer. You must use ReInit() to initialize the static variables.", TokenMgrError.STATIC_LEXER_ERROR); input_stream = stream; } /** Constructor. */ public ParserTokenManager(SimpleCharStream stream, int lexState){ this(stream); SwitchTo(lexState); } /** Reinitialise parser. */ static public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds(); } static private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 0; i-- > 0;) jjrounds[i] = 0x80000000; } /** Reinitialise parser. */ static public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } /** Switch to specified lex state. */ static public void SwitchTo(int lexState) { if (lexState >= 1 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState; } static protected Token jjFillToken() { final Token t; final String curTokenImage; String im = jjstrLiteralImages[jjmatchedKind]; curTokenImage = (im == null) ? input_stream.GetImage() : im; t = Token.newToken(jjmatchedKind, curTokenImage); return t; } static int curLexState = 0; static int defaultLexState = 0; static int jjnewStateCnt; static int jjround; static int jjmatchedPos; static int jjmatchedKind; /** Get the next Token. */ public static Token getNextToken() { Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); return matchedToken; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); matchedToken = jjFillToken(); return matchedToken; } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } static private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } } static private void jjAddStates(int start, int end) { do { jjstateSet[jjnewStateCnt++] = jjnextStates[start]; } while (start++ != end); } static private void jjCheckNAddTwoStates(int state1, int state2) { jjCheckNAdd(state1); jjCheckNAdd(state2); } } javacc-5.0.orig/test/javaFileGeneration/expected/no-keep-line/Token.java0000644000175000017500000000717011227705227025265 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ /** * Describes the input token stream. */ public class Token implements java.io.Serializable { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument constructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); } } public static Token newToken(int ofKind) { return newToken(ofKind, null); } } /* JavaCC - OriginalChecksum=b68cbb4925e9712f2a198108314c1d2f (do not edit this line) */ javacc-5.0.orig/test/javaFileGeneration/expected/no-keep-line/ParserConstants.java0000644000175000017500000000112711065706400027324 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ /** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ public interface ParserConstants { /** End of File. */ int EOF = 0; /** RegularExpression Id. */ int A = 1; /** RegularExpression Id. */ int B = 2; /** RegularExpression Id. */ int C = 3; /** RegularExpression Id. */ int D = 4; /** Lexical state. */ int DEFAULT = 0; /** Literal token values. */ String[] tokenImage = { "", "\"A\"", "\"B\"", "\"C\"", "\"D\"", }; } javacc-5.0.orig/test/javaFileGeneration/expected/no-keep-line/SimpleCharStream.java0000644000175000017500000002145411227705227027411 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ /* JavaCCOptions:STATIC=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = true; static int bufsize; static int available; static int tokenBegin; /** Position in buffer. */ static public int bufpos = -1; static protected java.io.Reader inputStream; static protected char[] buffer; static protected int maxNextCharInd = 0; static protected int inBuf = 0; static protected int tabSize = 8; static protected void setTabSize(int i) { tabSize = i; } static protected int getTabSize(int i) { return tabSize; } static protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ static public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } /** Read a character. */ static public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; return c; } @Deprecated /** * @deprecated * @see #getEndColumn */ static public int getColumn() { return -1; } @Deprecated /** * @deprecated * @see #getEndLine */ static public int getLine() { return -1; } /** Get token end column number. */ static public int getEndColumn() { return -1; } /** Get token end line number. */ static public int getEndLine() { return -1; } /** Get token beginning column number. */ static public int getBeginColumn() { return -1; } /** Get token beginning line number. */ static public int getBeginLine() { return -1; } /** Backup a number of characters. */ static public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { if (inputStream != null) throw new Error("\n ERROR: Second call to the constructor of a static SimpleCharStream.\n" + " You must either use ReInit() or set the JavaCC option STATIC to false\n" + " during the generation of this class."); inputStream = dstream; available = bufsize = buffersize; buffer = new char[buffersize]; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; } tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ static public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ static public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ static public void Done() { buffer = null; } } /* JavaCC - OriginalChecksum=2be772234ef663705e3245220a5a5c6e (do not edit this line) */ javacc-5.0.orig/test/exceptions/0000755000175000017500000000000011247044054015671 5ustar mkochmkochjavacc-5.0.orig/test/exceptions/Parser.jj0000644000175000017500000000403511066271211017450 0ustar mkochmkoch/* ** Copyright (c) 2007, Paul Cager ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: ** ** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in the ** documentation and/or other materials provided with the distribution. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGE. */ options { STATIC=false; OUTPUT_DIRECTORY="out-dir"; } PARSER_BEGIN(Parser) import java.util.Map; import java.util.HashMap; public class Parser { public static void main(String args[]) throws Exception { Parser t = new Parser(System.in); t.CompilationUnit(); System.out.println("Parser ran sucessfully"); } } PARSER_END(Parser) TOKEN_MGR_DECLS : { Map map = new HashMap(); } TOKEN : { < A: "A"> | < B: "B"> | < C: "C"> | < D: "D"> | < E: "E"> } Map CompilationUnit() : { Map map; } { "A" { map = new HashMap(); } "B" [ "E" { throw new ParseException("help"); } ] "C" { return map; } } javacc-5.0.orig/test/exceptions/build.xml0000644000175000017500000001024111165261216017510 0ustar mkochmkoch Test 1 Output: ${test1.out} Output: ${test1a.out} Test 2 Output: ${test2.out} javacc-5.0.orig/test/build.xml0000644000175000017500000000517611066271211015336 0ustar mkochmkoch javacc-5.0.orig/test/lineNumbers/0000755000175000017500000000000011247044055015774 5ustar mkochmkochjavacc-5.0.orig/test/lineNumbers/JJTree.jjt0000644000175000017500000014337410717567567017667 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { MULTI = true; NODE_DEFAULT_VOID = true; NODE_SCOPE_HOOK=true; JAVA_UNICODE_ESCAPE = true; STATIC = false; NODE_CLASS = "JJTreeNode"; OUTPUT_DIRECTORY = "out-dir"; } PARSER_BEGIN(JJTreeParser) package org.javacc.jjtree; public class JJTreeParser { void jjtreeOpenNodeScope(Node n) { ((JJTreeNode)n).setFirstToken(getToken(1)); } void jjtreeCloseNodeScope(Node n) { ((JJTreeNode)n).setLastToken(getToken(0)); } /** * Returns true if the next token is not in the FOLLOW list of "expansion". * It is used to decide when the end of an "expansion" has been reached. */ private boolean notTailOfExpansionUnit() { Token t; t = getToken(1); if (t.kind == BIT_OR || t.kind == COMMA || t.kind == RPAREN || t.kind == RBRACE || t.kind == RBRACKET) return false; return true; } } PARSER_END(JJTreeParser) /********************************************** * THE JAVACC TOKEN SPECIFICATION STARTS HERE * **********************************************/ /* JAVACC RESERVED WORDS: These are the only tokens in JavaCC but not in Java */ TOKEN : { // Options is no longer a reserved word (Issue 126) // < _OPTIONS: "options" > < _LOOKAHEAD: "LOOKAHEAD" > | < _IGNORE_CASE: "IGNORE_CASE" > | < _PARSER_BEGIN: "PARSER_BEGIN" > | < _PARSER_END: "PARSER_END" > | < _JAVACODE: "JAVACODE" > | < _TOKEN: "TOKEN" > | < _SPECIAL_TOKEN: "SPECIAL_TOKEN" > | < _MORE: "MORE" > | < _SKIP: "SKIP" > | < _TOKEN_MGR_DECLS: "TOKEN_MGR_DECLS" > | < _EOF: "EOF" > } /* * The remainder of the tokens are exactly (except for the removal of tokens * containing ">>" and "<<") as in the Java grammar and must be diff equivalent * (again with the exceptions above) to it. */ /* WHITE SPACE */ SPECIAL_TOKEN : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* JAVA RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* JAVA LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: | > | < #DECIMAL_FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < #HEXADECIMAL_FLOATING_POINT_LITERAL: "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? (["f","F","d","D"])? | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ (["f","F","d","D"])? > | < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > //| < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > // | < LSHIFT: "<<" > // | < RSIGNEDSHIFT: ">>" > // | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > // | < LSHIFTASSIGN: "<<=" > // | < RSIGNEDSHIFTASSIGN: ">>=" > // | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /* >'s need special attention due to generics syntax. */ TOKEN : { < RUNSIGNEDSHIFT: ">>>" > { matchedToken.kind = GT; ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; input_stream.backup(2); matchedToken.image = ">"; } | < RSIGNEDSHIFT: ">>" > { matchedToken.kind = GT; ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT; input_stream.backup(1); matchedToken.image = ">"; } | < GT: ">" > } /************************************************ * THE JAVACC GRAMMAR SPECIFICATION STARTS HERE * ************************************************/ void javacc_input() #Grammar : { Token t; } { javacc_options() ( "PARSER_BEGIN" "(" t=identifier() ")" { JJTreeGlobals.parserName = t.image; } CompilationUnit() "PARSER_END" LOOKAHEAD(1) "(" identifier() ")" { if (JJTreeOptions.getNodePackage().equals("")) { JJTreeGlobals.nodePackageName = JJTreeGlobals.packageName; } else { JJTreeGlobals.nodePackageName = JJTreeOptions.getNodePackage(); } } ) #CompilationUnit(true) ( ( production() )+ ) #Productions } void javacc_options() : { } { [ LOOKAHEAD( { getToken(1).image.equals("options") }) ( "{" ( option_binding() )* "}" ) #Options ] } void option_binding() #OptionBinding : { Token o, v; } { ( o= | o="LOOKAHEAD" | o="IGNORE_CASE" | o="static" ) "=" ( v=IntegerLiteral() { JJTreeOptions.setInputFileOption(o, v, o.image, new Integer(v.image)); jjtThis.initialize(o.image, v.image); } | v=BooleanLiteral() { JJTreeOptions.setInputFileOption(o, v, o.image, Boolean.valueOf(v.image)); jjtThis.initialize(o.image, v.image); } | v=StringLiteral() { String vs = TokenUtils.remove_escapes_and_quotes(v, v.image); JJTreeOptions.setInputFileOption(o, v, o.image, (Object)vs); jjtThis.initialize(o.image, vs); } ) ";" } void production() : { } { LOOKAHEAD(1) /* * Since JAVACODE is both a JavaCC reserved word and a Java identifier, * we need to give preference to "javacode_production" over * "bnf_production". */ javacode_production() | LOOKAHEAD(1) /* * Since SKIP, TOKEN, etc. are both JavaCC reserved words and Java * identifiers, we need to give preference to "regular_expression_production" * over "bnf_production". */ regular_expr_production() | LOOKAHEAD(1) /* * Since TOKEN_MGR_DECLS is both a JavaCC reserved word and a Java identifier, * we need to give preference to "token_manager_decls" over * "bnf_production". */ token_manager_decls() | bnf_production() } void javacode_production() #Javacode : { Token t1, t2; ASTJavacode prod; ASTNodeDescriptor nd = null; String n; } { { prod = jjtThis; } "JAVACODE" AccessModifier() ResultType() t1=identifier() FormalParameters() [ "throws" n=Name() { prod.throws_list.addElement(n); } ( "," n=Name() { prod.throws_list.addElement(n); } )* ] [ nd=node_descriptor() ] // This is really a Block() t2="{" { prod.name = t1.image; prod.stmBeginLoc = t2; } ( ( BlockStatement() )* { jjtThis.node_scope = new NodeScope(prod, nd); } ) #JavacodeBody "}" { JJTreeGlobals.productions.put(prod.name, prod); } } void bnf_production() #BNF : { Token t1, t2; ASTBNF prod; ASTNodeDescriptor nd = null; NodeScope ns; JJTreeNode eu; String n; } { { prod = jjtThis; } AccessModifier() ResultType() t1=identifier() FormalParameters() [ "throws" n=Name() { prod.throws_list.addElement(n); } ( "," n=Name() { prod.throws_list.addElement(n); } )* ] [ nd=node_descriptor() ] ":" // This is really a Block() t2="{" { prod.name = t1.image; prod.declBeginLoc = t2; ns = new NodeScope(prod, nd); } ( ( BlockStatement() )* { jjtThis.node_scope = ns; } ) #BNFDeclaration "}" "{" ( eu=expansion_choices(prod) { jjtThis.node_scope = ns; jjtThis.expansion_unit = eu; } ) #BNFNodeScope "}" { JJTreeGlobals.productions.put(prod.name, prod); } } void AccessModifier() : {} { ( "public" | "protected" | "private" )? } void regular_expr_production() #RE : { } { [ LOOKAHEAD(2) "<" "*" ">" | "<" ( "," )* ">" ] regexpr_kind() [ "[" "IGNORE_CASE" "]" ] ":" "{" regexpr_spec() ( "|" regexpr_spec() )* "}" } void token_manager_decls() #TokenDecls : { } { "TOKEN_MGR_DECLS" ":" ClassOrInterfaceBody() } void regexpr_kind() : { } { "TOKEN" | "SPECIAL_TOKEN" | "SKIP" | "MORE" } void regexpr_spec() #RESpec : {} { regular_expression() [ Block() ] [ ":" ] } JJTreeNode expansion_choices(ASTProduction p) #BNFChoice(>1) : { } { expansion(p) ( "|" expansion(p) )* { return (JJTreeNode)jjtree.peekNode(); } } void expansion(ASTProduction p) #BNFSequence(>1) : { JJTreeNode eu; ASTNodeDescriptor nd = null; } { ( LOOKAHEAD(1) ( "LOOKAHEAD" "(" local_lookahead(p) ")" ) #BNFLookahead )? ( LOOKAHEAD(0, { notTailOfExpansionUnit() } ) ( eu=expansion_unit(p) [ nd=node_descriptor() ] { if (jjtree.nodeCreated()) { jjtThis.node_scope = new NodeScope(p, nd); jjtThis.expansion_unit = eu; } } ) #ExpansionNodeScope(>1) )+ } void local_lookahead(ASTProduction p) : { boolean commaAtEnd = false, emptyLA = true; } { [ /* * The lookahead of 1 is to turn off the warning message that lets * us know that an expansion choice can also start with an integer * literal because a primary expression can do the same. But we * know that this is what we want. */ LOOKAHEAD(1) IntegerLiteral() { emptyLA = false; } ] [ LOOKAHEAD(0, { !emptyLA && (getToken(1).kind != RPAREN) } ) "," { commaAtEnd = true; } ] [ LOOKAHEAD(0, { getToken(1).kind != RPAREN && getToken(1).kind != LBRACE } ) expansion_choices(p) { emptyLA = false; commaAtEnd = false; } ] [ LOOKAHEAD(0, { !emptyLA && !commaAtEnd && (getToken(1).kind != RPAREN) } ) "," { commaAtEnd = true; } ] [ LOOKAHEAD(0, { emptyLA || commaAtEnd } ) "{" Expression() "}" ] } JJTreeNode expansion_unit(ASTProduction p) : { Token t; } { ( LOOKAHEAD(1) /* * We give this priority over primary expressions which use LOOKAHEAD as the * name of its identifier. */ ( "LOOKAHEAD" "(" local_lookahead(p) ")" ) #BNFLookahead | Block() #BNFAction | ( "[" expansion_choices(p) "]" ) #BNFZeroOrOne | ( "try" "{" expansion_choices(p) "}" ( "catch" "(" Name() ")" Block() )* [ "finally" Block() ] ) #BNFTryBlock | LOOKAHEAD( identifier() | StringLiteral() | "<" | PrimaryExpression() "=" ) ( [ LOOKAHEAD(PrimaryExpression() "=") PrimaryExpression() "=" ] ( regular_expression() [ "." t= ] | ( identifier() Arguments() ) #BNFNonTerminal ) ) #BNFAssignment(>1) | t="(" expansion_choices(p) ")" ( "+" #BNFOneOrMore(1) | "*" #BNFZeroOrMore(1) | "?" #BNFZeroOrOne(1) | {} #BNFParenthesized(1) ) { ((JJTreeNode)jjtree.peekNode()).setFirstToken(t); } ) { return (JJTreeNode)jjtree.peekNode(); } } void regular_expression() : { } { StringLiteral() #REStringLiteral | LOOKAHEAD(3) ( "<" [ [ "#" ] identifier() ":" ] complex_regular_expression_choices() ">" ) #RENamed | LOOKAHEAD(2) ( "<" identifier() ">" ) #REReference | ( "<" "EOF" ">" ) #REEOF } void complex_regular_expression_choices() #REChoice(>1) : {} { complex_regular_expression() ( "|" complex_regular_expression() )* } void complex_regular_expression() #RESequence(>1) : {} { ( complex_regular_expression_unit() )+ } void complex_regular_expression_unit() : { Token t; } { StringLiteral() #REStringLiteral | ( "<" identifier() ">" ) #REReference | character_list() | t="(" complex_regular_expression_choices() ")" ( "+" #REOneOrMore(1) | "*" #REZeroOrMore(1) | "?" #REZeroOrOne(1) | "{" IntegerLiteral() [ "," [ IntegerLiteral() ] ] "}" #RRepetitionRange(1) | {} #REParenthesized(1) ) { ((JJTreeNode)jjtree.peekNode()).setFirstToken(t); } } void character_list() #RECharList : {} { [ "~" ] "[" [ character_descriptor() ( "," character_descriptor() )* ] "]" } void character_descriptor() #CharDescriptor : {} { StringLiteral() [ "-" StringLiteral() ] } Token identifier() : { Token t; } { t= { return t; } } /********************************************** * THE JJTREE PRODUCTIONS START HERE * **********************************************/ ASTNodeDescriptor node_descriptor() #NodeDescriptor : { Token t = null; String s = null; } { "#" ( s=Name() { jjtThis.name = s; } | t= { jjtThis.name = t.image; } ) [ LOOKAHEAD(1) "(" [ ">" { jjtThis.isGT = true; } ] node_descriptor_expression() { jjtThis.expression = (ASTNodeDescriptorExpression)jjtree.peekNode(); } ")" ] { jjtThis.setNodeIdValue(); return jjtThis; } } JAVACODE void node_descriptor_expression() #NodeDescriptorExpression { Token tok; int nesting = 1; while (true) { tok = getToken(1); if (tok.kind == 0) { throw new ParseException(); } if (tok.kind == LPAREN) nesting++; if (tok.kind == RPAREN) { nesting--; if (nesting == 0) break; } tok = getNextToken(); } } /********************************************** * THE JAVA GRAMMAR SPECIFICATION STARTS HERE * **********************************************/ /* * The Java grammar is modified to use sequences of tokens * for the missing tokens - those that include "<<" and ">>". */ /* * The following production defines Java identifiers - it * includes the reserved words of JavaCC also. */ String JavaIdentifier() : {} { ( | "LOOKAHEAD" | "IGNORE_CASE" | "PARSER_BEGIN" | "PARSER_END" | "JAVACODE" | "TOKEN" | "SPECIAL_TOKEN" | "MORE" | "SKIP" | "TOKEN_MGR_DECLS" | "EOF" ) { return token.image; } } /* * Program structuring syntax follows. */ void CompilationUnit() : {} { [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ] { JJTreeGlobals.parserImports = getToken(1); } ( ImportDeclaration() )* ( TypeDeclaration() )* } void PackageDeclaration() : { String s; } { Modifiers() "package" s=Name() ";" { JJTreeGlobals.packageName = s; } } void ImportDeclaration() : {} { "import" [ "static" ] Name() [ "." "*" ] ";" } /* * Modifiers. We match all modifiers in a single rule to reduce the chances of * syntax errors for simple modifier mistakes. It will also enable us to give * better error messages. */ void Modifiers(): {} { ( LOOKAHEAD(2) ( "public" | "static" | "protected" | "private" | "final" | "abstract" | "synchronized" | "native" | "transient" | "volatile" | "strictfp" | Annotation() ) )* } /* * Declaration syntax follows. */ void TypeDeclaration(): { ; } { ";" | Modifiers() ( ClassOrInterfaceDeclaration() | EnumDeclaration() | AnnotationTypeDeclaration() ) } void ClassOrInterfaceDeclaration(): { Token t = null; String s; } { ( "class" | "interface" ) s=JavaIdentifier() [ TypeParameters() ] [ ExtendsList() ] [ { t = getToken(1); } ImplementsList() ] { if (s.equals(JJTreeGlobals.parserName)) { if (t != null) { JJTreeGlobals.parserImplements = t; } else { JJTreeGlobals.parserImplements = getToken(1); } JJTreeGlobals.parserClassBodyStart = getToken(1); } } ClassOrInterfaceBody() } void ExtendsList(): {} { "extends" ClassOrInterfaceType() ( "," ClassOrInterfaceType() )* } void ImplementsList(): {} { "implements" ClassOrInterfaceType() ( "," ClassOrInterfaceType() )* } void EnumDeclaration(): {} { "enum" JavaIdentifier() [ ImplementsList() ] EnumBody() } void EnumBody(): {} { "{" [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ] [ "," ] [ ";" ( ClassOrInterfaceBodyDeclaration() )* ] "}" } void EnumConstant(): {} { Modifiers() JavaIdentifier() [ Arguments() ] [ ClassOrInterfaceBody() ] } void TypeParameters(): {} { "<" TypeParameter() ( "," TypeParameter() )* ">" } void TypeParameter(): {} { JavaIdentifier() [ TypeBound() ] } void TypeBound(): {} { "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )* } void ClassOrInterfaceBody(): /* * Parsing this fills "tokens" with all tokens of the block * excluding the braces at each end. */ {} { "{" ( ClassOrInterfaceBodyDeclaration() )* "}" } void ClassOrInterfaceBodyDeclaration(): {} { LOOKAHEAD(2) Initializer() | Modifiers() // Just get all the modifiers out of the way. If you want to do // more checks, pass the modifiers down to the member ( ClassOrInterfaceDeclaration() | EnumDeclaration() | LOOKAHEAD( [ TypeParameters() ] JavaIdentifier() "(" ) ConstructorDeclaration() | LOOKAHEAD( Type() JavaIdentifier() ( "[" "]" )* ( "," | "=" | ";" ) ) FieldDeclaration() | MethodDeclaration() ) | ";" } void FieldDeclaration(): {} { // Modifiers are already matched in the caller Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator(): {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId(): {} { JavaIdentifier() ( "[" "]" )* } void VariableInitializer(): {} { ArrayInitializer() | Expression() } void ArrayInitializer(): {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration(): {} { // Modifiers already matched in the caller! [ TypeParameters() ] ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator(): {} { JavaIdentifier() FormalParameters() ( "[" "]" )* } void FormalParameters() : /* * Parsing this fills "tokens" with all tokens of the formal * parameters excluding the parentheses at each end. */ {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter(): {} { Modifiers() Type() [ "..." ] VariableDeclaratorId() } void ConstructorDeclaration(): {} { [ TypeParameters() ] // Modifiers matched in the caller JavaIdentifier() LOOKAHEAD(1) FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation(): {} { LOOKAHEAD("this" Arguments() ";") "this" Arguments() ";" | [ LOOKAHEAD(2) PrimaryExpression() "." ] "super" Arguments() ";" } void Initializer(): {} { [ "static" ] Block() } /* * Type, name and expression syntax follows. */ void Type(): {} { LOOKAHEAD(2) ReferenceType() | PrimitiveType() } void ReferenceType(): {} { PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+ | ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )* } void ClassOrInterfaceType(): {} { JavaIdentifier() [ LOOKAHEAD(2) TypeArguments() ] ( LOOKAHEAD(2) "." JavaIdentifier() [ LOOKAHEAD(2) TypeArguments() ] )* } void TypeArguments(): {} { "<" TypeArgument() ( "," TypeArgument() )* ">" } void TypeArgument(): {} { ReferenceType() | "?" [ WildcardBounds() ] } void WildcardBounds(): {} { "extends" ReferenceType() | "super" ReferenceType() } void PrimitiveType(): {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { ( "void" | Type() ) } String Name() : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ { String s, ss; } { s=JavaIdentifier() ( LOOKAHEAD(2) "." ss=JavaIdentifier() { s += "." + ss; } )* { return s; } } void NameList(): {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ {} { ConditionalExpression() [ LOOKAHEAD(2) AssignmentOperator() Expression() ] } void AssignmentOperator(): {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression(): {} { ConditionalOrExpression() [ "?" Expression() ":" Expression() ] } void ConditionalOrExpression(): {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression(): {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression(): {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression(): {} { AndExpression() ( "^" AndExpression() )* } void AndExpression(): {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression(): {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression(): {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression(): {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression(): {} { AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )* } void AdditiveExpression(): {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression(): {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression(): {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression(): {} { "++" PrimaryExpression() } void PreDecrementExpression(): {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus(): {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead(): {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Type() "[") "(" Type() "[" "]" | "(" Type() ")" ( "~" | "!" | "(" | JavaIdentifier() | "this" | "super" | "new" | Literal() ) } void PostfixExpression(): {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression(): {} { LOOKAHEAD("(" PrimitiveType()) "(" Type() ")" UnaryExpression() | "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() #PrimaryExpression: {} { PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* } void MemberSelector(): {} { "." TypeArguments() JavaIdentifier() } void PrimaryPrefix(): {} { Literal() | "this" | "super" "." JavaIdentifier() | "(" Expression() ")" | AllocationExpression() | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class" | Name() } void PrimarySuffix(): {} { LOOKAHEAD(2) "." "this" | LOOKAHEAD(2) "." AllocationExpression() | LOOKAHEAD(3) MemberSelector() | "[" Expression() "]" | "." JavaIdentifier() | Arguments() } void Literal(): {} { | | | | BooleanLiteral() | NullLiteral() } Token IntegerLiteral() : { Token t; } { t= { return t; } } Token BooleanLiteral() : { Token t; } { t="true" { return t; } | t="false" { return t; } } Token StringLiteral() : { Token t; } { t= { return t; } } void NullLiteral() : {} { "null" } void Arguments() : /* * Parsing this fills "tokens" with all tokens of the arguments * excluding the parentheses at each end. */ {} { "(" [ ArgumentList() ] ")" } void ArgumentList(): {} { Expression() ( "," Expression() )* } void AllocationExpression(): {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimsAndInits() | "new" ClassOrInterfaceType() [ TypeArguments() ] ( ArrayDimsAndInits() | Arguments() [ ClassOrInterfaceBody() ] ) } /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimsAndInits(): {} { LOOKAHEAD(2) ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* | ( "[" "]" )+ ArrayInitializer() } /* * Statement syntax follows. */ void Statement(): {} { LOOKAHEAD(2) LabeledStatement() | AssertStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void AssertStatement(): {} { "assert" Expression() [ ":" Expression() ] ";" } void LabeledStatement(): {} { JavaIdentifier() ":" Statement() } void Block() : /* * Parsing this fills "tokens" with all tokens of the block * excluding the braces at each end. */ {} { "{" ( BlockStatement() )* "}" } void BlockStatement(): {} { LOOKAHEAD( Modifiers() Type() JavaIdentifier() ) LocalVariableDeclaration() ";" | Statement() | ClassOrInterfaceDeclaration( ) } void LocalVariableDeclaration(): {} { Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement(): {} { ";" } void StatementExpression(): /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ {} { PreIncrementExpression() | PreDecrementExpression() | PrimaryExpression() [ "++" | "--" | AssignmentOperator() Expression() ] } void SwitchStatement(): {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel(): {} { "case" Expression() ":" | "default" ":" } void IfStatement(): /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement(): {} { "while" "(" Expression() ")" Statement() } void DoStatement(): {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement(): {} { "for" "(" ( LOOKAHEAD(Modifiers() Type() JavaIdentifier() ":") Modifiers() Type() JavaIdentifier() ":" Expression() | [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ) ")" Statement() } void ForInit(): {} { LOOKAHEAD( Modifiers() Type() JavaIdentifier() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList(): {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate(): {} { StatementExpressionList() } void BreakStatement(): {} { "break" [ JavaIdentifier() ] ";" } void ContinueStatement(): {} { "continue" [ JavaIdentifier() ] ";" } void ReturnStatement() : {} { "return" [ Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement(): {} { "synchronized" "(" Expression() ")" Block() } void TryStatement(): /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } /* We use productions to match >>>, >> and > so that we can keep the * type declaration syntax with generics clean */ void RUNSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) ">" ">" ">" ) } void RSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} ) ">" ">" ) } /* Annotation syntax follows. */ void Annotation(): {} { LOOKAHEAD( "@" Name() "(" ( JavaIdentifier() "=" | ")" )) NormalAnnotation() | LOOKAHEAD( "@" Name() "(" ) SingleMemberAnnotation() | MarkerAnnotation() } void NormalAnnotation(): {} { "@" Name() "(" [ MemberValuePairs() ] ")" } void MarkerAnnotation(): {} { "@" Name() } void SingleMemberAnnotation(): {} { "@" Name() "(" MemberValue() ")" } void MemberValuePairs(): {} { MemberValuePair() ( "," MemberValuePair() )* } void MemberValuePair(): {} { JavaIdentifier() "=" MemberValue() } void MemberValue(): {} { Annotation() | MemberValueArrayInitializer() | ConditionalExpression() } void MemberValueArrayInitializer(): {} { "{" MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] "}" } /* Annotation Types. */ void AnnotationTypeDeclaration(): {} { "@" "interface" LOOKAHEAD(1) JavaIdentifier() AnnotationTypeBody() } void AnnotationTypeBody(): {} { "{" ( AnnotationTypeMemberDeclaration() )* "}" } void AnnotationTypeMemberDeclaration(): {} { Modifiers() ( LOOKAHEAD(Type() JavaIdentifier() "(") Type() JavaIdentifier() "(" ")" [ DefaultValue() ] ";" | ClassOrInterfaceDeclaration() | EnumDeclaration() | AnnotationTypeDeclaration() | FieldDeclaration() ) | ( ";" ) } void DefaultValue(): {} { "default" MemberValue() } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: ()* > | < #LETTER: [ // all chars for which Character.isIdentifierStart is true "$", "A"-"Z", "_", "a"-"z", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u064a", "\u0671"-"\u06d3", "\u06d5", "\u06e5"-"\u06e6", "\u06fa"-"\u06fc", "\u0710", "\u0712"-"\u072c", "\u0780"-"\u07a5", "\u0905"-"\u0939", "\u093d", "\u0950", "\u0958"-"\u0961", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09dc"-"\u09dd", "\u09df"-"\u09e1", "\u09f0"-"\u09f3", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a72"-"\u0a74", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abd", "\u0ad0", "\u0ae0", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3d", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c60"-"\u0c61", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cde", "\u0ce0"-"\u0ce1", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d60"-"\u0d61", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0e01"-"\u0e30", "\u0e32"-"\u0e33", "\u0e3f"-"\u0e46", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb0", "\u0eb2"-"\u0eb3", "\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0edc"-"\u0edd", "\u0f00", "\u0f40"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f88"-"\u0f8b", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u1050"-"\u1055", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17b3", "\u17db", "\u1820"-"\u1877", "\u1880"-"\u18a8", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u203f"-"\u2040", "\u207f", "\u20a0"-"\u20af", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u3029", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d", "\ufb1f"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\uff04", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6" ] > | < #PART_LETTER: [ // all chars for which Character.isIdentifierPart is true "\u0000"-"\u0008", "\u000e"-"\u001b", "$", "0"-"9", "A"-"Z", "_", "a"-"z", "\u007f"-"\u009f", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u0300"-"\u034e", "\u0360"-"\u0362", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u0483"-"\u0486", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u0591"-"\u05a1", "\u05a3"-"\u05b9", "\u05bb"-"\u05bd", "\u05bf", "\u05c1"-"\u05c2", "\u05c4", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u0655", "\u0660"-"\u0669", "\u0670"-"\u06d3", "\u06d5"-"\u06dc", "\u06df"-"\u06e8", "\u06ea"-"\u06ed", "\u06f0"-"\u06fc", "\u070f"-"\u072c", "\u0730"-"\u074a", "\u0780"-"\u07b0", "\u0901"-"\u0903", "\u0905"-"\u0939", "\u093c"-"\u094d", "\u0950"-"\u0954", "\u0958"-"\u0963", "\u0966"-"\u096f", "\u0981"-"\u0983", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09bc", "\u09be"-"\u09c4", "\u09c7"-"\u09c8", "\u09cb"-"\u09cd", "\u09d7", "\u09dc"-"\u09dd", "\u09df"-"\u09e3", "\u09e6"-"\u09f3", "\u0a02", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a3c", "\u0a3e"-"\u0a42", "\u0a47"-"\u0a48", "\u0a4b"-"\u0a4d", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a66"-"\u0a74", "\u0a81"-"\u0a83", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abc"-"\u0ac5", "\u0ac7"-"\u0ac9", "\u0acb"-"\u0acd", "\u0ad0", "\u0ae0", "\u0ae6"-"\u0aef", "\u0b01"-"\u0b03", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3c"-"\u0b43", "\u0b47"-"\u0b48", "\u0b4b"-"\u0b4d", "\u0b56"-"\u0b57", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b66"-"\u0b6f", "\u0b82"-"\u0b83", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0bbe"-"\u0bc2", "\u0bc6"-"\u0bc8", "\u0bca"-"\u0bcd", "\u0bd7", "\u0be7"-"\u0bef", "\u0c01"-"\u0c03", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c3e"-"\u0c44", "\u0c46"-"\u0c48", "\u0c4a"-"\u0c4d", "\u0c55"-"\u0c56", "\u0c60"-"\u0c61", "\u0c66"-"\u0c6f", "\u0c82"-"\u0c83", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cbe"-"\u0cc4", "\u0cc6"-"\u0cc8", "\u0cca"-"\u0ccd", "\u0cd5"-"\u0cd6", "\u0cde", "\u0ce0"-"\u0ce1", "\u0ce6"-"\u0cef", "\u0d02"-"\u0d03", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d3e"-"\u0d43", "\u0d46"-"\u0d48", "\u0d4a"-"\u0d4d", "\u0d57", "\u0d60"-"\u0d61", "\u0d66"-"\u0d6f", "\u0d82"-"\u0d83", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0dca", "\u0dcf"-"\u0dd4", "\u0dd6", "\u0dd8"-"\u0ddf", "\u0df2"-"\u0df3", "\u0e01"-"\u0e3a", "\u0e3f"-"\u0e4e", "\u0e50"-"\u0e59", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb9", "\u0ebb"-"\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0ec8"-"\u0ecd", "\u0ed0"-"\u0ed9", "\u0edc"-"\u0edd", "\u0f00", "\u0f18"-"\u0f19", "\u0f20"-"\u0f29", "\u0f35", "\u0f37", "\u0f39", "\u0f3e"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f71"-"\u0f84", "\u0f86"-"\u0f8b", "\u0f90"-"\u0f97", "\u0f99"-"\u0fbc", "\u0fc6", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u102c"-"\u1032", "\u1036"-"\u1039", "\u1040"-"\u1049", "\u1050"-"\u1059", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u1369"-"\u1371", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17d3", "\u17db", "\u17e0"-"\u17e9", "\u180b"-"\u180e", "\u1810"-"\u1819", "\u1820"-"\u1877", "\u1880"-"\u18a9", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u200c"-"\u200f", "\u202a"-"\u202e", "\u203f"-"\u2040", "\u206a"-"\u206f", "\u207f", "\u20a0"-"\u20af", "\u20d0"-"\u20dc", "\u20e1", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u302f", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u3099"-"\u309a", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe20"-"\ufe23", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\ufeff", "\uff04", "\uff10"-"\uff19", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6", "\ufff9"-"\ufffb" ] > } javacc-5.0.orig/test/lineNumbers/build.xml0000644000175000017500000000515310722653637017632 0ustar mkochmkoch ${test.out} javacc-5.0.orig/templates/0000755000175000017500000000000011247044054014527 5ustar mkochmkochjavacc-5.0.orig/templates/MultiNode.template0000644000175000017500000000154311215166250020165 0ustar mkochmkoch#if SUPPORT_CLASS_VISIBILITY_PUBLIC public #fi class ${NODE_TYPE} extends ${NODE_CLASS:-SimpleNode} { public ${NODE_TYPE}(int id) { super(id); } public ${NODE_TYPE}(${PARSER_NAME} p, int id) { super(p, id); } #if NODE_FACTORY public static Node jjtCreate(int id) { return new ${NODE_TYPE}(id); } public static Node jjtCreate(${PARSER_NAME} p, int id) { return new ${NODE_TYPE}(p, id); } #fi #if VISITOR /** Accept the visitor. **/ #if VISITOR_EXCEPTION public ${VISITOR_RETURN_TYPE} jjtAccept(${PARSER_NAME}Visitor visitor, ${VISITOR_DATA_TYPE:-Object} data) throws ${VISITOR_EXCEPTION} { #else public ${VISITOR_RETURN_TYPE} jjtAccept(${PARSER_NAME}Visitor visitor, ${VISITOR_DATA_TYPE:-Object} data) { #fi #if VISITOR_RETURN_TYPE_VOID visitor.visit(this, data); #else return visitor.visit(this, data); #fi } #fi } javacc-5.0.orig/templates/SimpleCharStream.template0000644000175000017500000003064711067674047021514 0ustar mkochmkoch/** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class SimpleCharStream { /** Whether parser is static. */ public static final boolean staticFlag = ${STATIC}; ${PREFIX}int bufsize; ${PREFIX}int available; ${PREFIX}int tokenBegin; /** Position in buffer. */ ${PREFIX}public int bufpos = -1; #if KEEP_LINE_COLUMN ${PREFIX}protected int bufline[]; ${PREFIX}protected int bufcolumn[]; ${PREFIX}protected int column = 0; ${PREFIX}protected int line = 1; ${PREFIX}protected boolean prevCharIsCR = false; ${PREFIX}protected boolean prevCharIsLF = false; #fi ${PREFIX}protected java.io.Reader inputStream; ${PREFIX}protected char[] buffer; ${PREFIX}protected int maxNextCharInd = 0; ${PREFIX}protected int inBuf = 0; ${PREFIX}protected int tabSize = 8; ${PREFIX}protected void setTabSize(int i) { tabSize = i; } ${PREFIX}protected int getTabSize(int i) { return tabSize; } ${PREFIX}protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; #if KEEP_LINE_COLUMN int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; #fi try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; #if KEEP_LINE_COLUMN System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; #fi maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; #if KEEP_LINE_COLUMN System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; #fi maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } ${PREFIX}protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } /** Start. */ ${PREFIX}public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } #if KEEP_LINE_COLUMN ${PREFIX}protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } #fi /** Read a character. */ ${PREFIX}public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; #if KEEP_LINE_COLUMN UpdateLineColumn(c); #fi return c; } #if GENERATE_ANNOTATIONS @Deprecated #fi /** * @deprecated * @see #getEndColumn */ ${PREFIX}public int getColumn() { #if KEEP_LINE_COLUMN return bufcolumn[bufpos]; #else return -1; #fi } #if GENERATE_ANNOTATIONS @Deprecated #fi /** * @deprecated * @see #getEndLine */ ${PREFIX}public int getLine() { #if KEEP_LINE_COLUMN return bufline[bufpos]; #else return -1; #fi } /** Get token end column number. */ ${PREFIX}public int getEndColumn() { #if KEEP_LINE_COLUMN return bufcolumn[bufpos]; #else return -1; #fi } /** Get token end line number. */ ${PREFIX}public int getEndLine() { #if KEEP_LINE_COLUMN return bufline[bufpos]; #else return -1; #fi } /** Get token beginning column number. */ ${PREFIX}public int getBeginColumn() { #if KEEP_LINE_COLUMN return bufcolumn[tokenBegin]; #else return -1; #fi } /** Get token beginning line number. */ ${PREFIX}public int getBeginLine() { #if KEEP_LINE_COLUMN return bufline[tokenBegin]; #else return -1; #fi } /** Backup a number of characters. */ ${PREFIX}public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { #if STATIC if (inputStream != null) throw new Error("\n ERROR: Second call to the constructor of a static SimpleCharStream.\n" + " You must either use ReInit() or set the JavaCC option STATIC to false\n" + " during the generation of this class."); #fi inputStream = dstream; #if KEEP_LINE_COLUMN line = startline; column = startcolumn - 1; #fi available = bufsize = buffersize; buffer = new char[buffersize]; #if KEEP_LINE_COLUMN bufline = new int[buffersize]; bufcolumn = new int[buffersize]; #fi } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; #if KEEP_LINE_COLUMN line = startline; column = startcolumn - 1; #fi if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; #if KEEP_LINE_COLUMN bufline = new int[buffersize]; bufcolumn = new int[buffersize]; #fi } #if KEEP_LINE_COLUMN prevCharIsLF = prevCharIsCR = false; #fi tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Get token literal value. */ ${PREFIX}public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** Get the suffix. */ ${PREFIX}public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Reset buffer when finished. */ ${PREFIX}public void Done() { buffer = null; #if KEEP_LINE_COLUMN bufline = null; bufcolumn = null; #fi } #if KEEP_LINE_COLUMN /** * Method to adjust line and column numbers for the start of a token. */ ${PREFIX}public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } #fi } javacc-5.0.orig/templates/Token.template0000644000175000017500000000764511067674047017373 0ustar mkochmkoch/** * Describes the input token stream. */ #if TOKEN_EXTENDS ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class Token extends ${TOKEN_EXTENDS} implements java.io.Serializable { #else ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class Token implements java.io.Serializable { #fi /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; #if KEEP_LINE_COLUMN /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; #fi /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument constructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. */ public static Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); } } public static Token newToken(int ofKind) { return newToken(ofKind, null); } } javacc-5.0.orig/templates/Node.template0000644000175000017500000000244511215166250017154 0ustar mkochmkoch/* All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child relationships between nodes. */ #if SUPPORT_CLASS_VISIBILITY_PUBLIC public #fi interface Node { /** This method is called after the node has been made the current node. It indicates that child nodes can now be added to it. */ public void jjtOpen(); /** This method is called after all the child nodes have been added. */ public void jjtClose(); /** This pair of methods are used to inform the node of its parent. */ public void jjtSetParent(Node n); public Node jjtGetParent(); /** This method tells the node to add its argument to the node's list of children. */ public void jjtAddChild(Node n, int i); /** This method returns a child node. The children are numbered from zero, left to right. */ public Node jjtGetChild(int i); /** Return the number of children the node has. */ public int jjtGetNumChildren(); #if VISITOR /** Accept the visitor. **/ #if VISITOR_EXCEPTION public ${VISITOR_RETURN_TYPE} jjtAccept(${PARSER_NAME}Visitor visitor, ${VISITOR_DATA_TYPE:-Object} data) throws ${VISITOR_EXCEPTION}; #else public ${VISITOR_RETURN_TYPE} jjtAccept(${PARSER_NAME}Visitor visitor, ${VISITOR_DATA_TYPE:-Object} data); #fi #fi } javacc-5.0.orig/templates/SimpleNode.template0000644000175000017500000000623311215166250020325 0ustar mkochmkoch#if SUPPORT_CLASS_VISIBILITY_PUBLIC public #fi #if NODE_EXTENDS class SimpleNode extends ${NODE_EXTENDS} implements Node { #else class SimpleNode implements Node { #fi protected Node parent; protected Node[] children; protected int id; protected Object value; protected ${PARSER_NAME} parser; #if TRACK_TOKENS protected Token firstToken; protected Token lastToken; #fi public SimpleNode(int i) { id = i; } public SimpleNode(${PARSER_NAME} p, int i) { this(i); parser = p; } #if NODE_FACTORY public static Node jjtCreate(int id) { return new SimpleNode(id); } public static Node jjtCreate(${PARSER_NAME} p, int id) { return new SimpleNode(p, id); } #fi public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } public void jjtSetValue(Object value) { this.value = value; } public Object jjtGetValue() { return value; } #if TRACK_TOKENS public Token jjtGetFirstToken() { return firstToken; } public void jjtSetFirstToken(Token token) { this.firstToken = token; } public Token jjtGetLastToken() { return lastToken; } public void jjtSetLastToken(Token token) { this.lastToken = token; } #fi #if VISITOR /** Accept the visitor. **/ public ${VISITOR_RETURN_TYPE} jjtAccept(${PARSER_NAME}Visitor visitor, ${VISITOR_DATA_TYPE:-Object} data) #if VISITOR_EXCEPTION throws ${VISITOR_EXCEPTION} #fi { #if VISITOR_RETURN_TYPE_VOID visitor.visit(this, data); #else return visitor.visit(this, data); #fi } /** Accept the visitor. **/ public Object childrenAccept(${PARSER_NAME}Visitor visitor, ${VISITOR_DATA_TYPE:-Object} data) #if VISITOR_EXCEPTION throws ${VISITOR_EXCEPTION} #fi { if (children != null) { for (int i = 0; i < children.length; ++i) { children[i].jjtAccept(visitor, data); } } return data; } #fi /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return ${PARSER_NAME}TreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode)children[i]; if (n != null) { n.dump(prefix + " "); } } } } } javacc-5.0.orig/templates/JavaCharStream.template0000644000175000017500000003716611067674047021147 0ustar mkochmkoch/** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (with java-like unicode escape processing). */ #if SUPPORT_CLASS_VISIBILITY_PUBLIC public #fi class JavaCharStream { /** Whether parser is static. */ public static final boolean staticFlag = ${STATIC}; static final int hexval(char c) throws java.io.IOException { switch(c) { case '0' : return 0; case '1' : return 1; case '2' : return 2; case '3' : return 3; case '4' : return 4; case '5' : return 5; case '6' : return 6; case '7' : return 7; case '8' : return 8; case '9' : return 9; case 'a' : case 'A' : return 10; case 'b' : case 'B' : return 11; case 'c' : case 'C' : return 12; case 'd' : case 'D' : return 13; case 'e' : case 'E' : return 14; case 'f' : case 'F' : return 15; } throw new java.io.IOException(); // Should never come here } /** Position in buffer. */ ${PREFIX}public int bufpos = -1; ${PREFIX}int bufsize; ${PREFIX}int available; ${PREFIX}int tokenBegin; #if KEEP_LINE_COLUMN ${PREFIX}protected int bufline[]; ${PREFIX}protected int bufcolumn[]; ${PREFIX}protected int column = 0; ${PREFIX}protected int line = 1; ${PREFIX}protected boolean prevCharIsCR = false; ${PREFIX}protected boolean prevCharIsLF = false; #fi ${PREFIX}protected java.io.Reader inputStream; ${PREFIX}protected char[] nextCharBuf; ${PREFIX}protected char[] buffer; ${PREFIX}protected int maxNextCharInd = 0; ${PREFIX}protected int nextCharInd = -1; ${PREFIX}protected int inBuf = 0; ${PREFIX}protected int tabSize = 8; ${PREFIX}protected void setTabSize(int i) { tabSize = i; } ${PREFIX}protected int getTabSize(int i) { return tabSize; } ${PREFIX}protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; #if KEEP_LINE_COLUMN int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; #fi try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; #if KEEP_LINE_COLUMN System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; #fi bufpos += (bufsize - tokenBegin); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; #if KEEP_LINE_COLUMN System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; #fi bufpos -= tokenBegin; } } catch (Throwable t) { throw new Error(t.getMessage()); } available = (bufsize += 2048); tokenBegin = 0; } ${PREFIX}protected void FillBuff() throws java.io.IOException { int i; if (maxNextCharInd == 4096) maxNextCharInd = nextCharInd = 0; try { if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { if (bufpos != 0) { --bufpos; backup(0); } #if KEEP_LINE_COLUMN else { bufline[bufpos] = line; bufcolumn[bufpos] = column; } #fi throw e; } } ${PREFIX}protected char ReadByte() throws java.io.IOException { if (++nextCharInd >= maxNextCharInd) FillBuff(); return nextCharBuf[nextCharInd]; } /** @return starting character for token. */ ${PREFIX}public char BeginToken() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; tokenBegin = bufpos; return buffer[bufpos]; } tokenBegin = 0; bufpos = -1; return readChar(); } ${PREFIX}protected void AdjustBuffSize() { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = 0; available = tokenBegin; } else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } #if KEEP_LINE_COLUMN ${PREFIX}protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } #fi /** Read a character. */ ${PREFIX}public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } char c; if (++bufpos == available) AdjustBuffSize(); if ((buffer[bufpos] = c = ReadByte()) == '\\') { #if KEEP_LINE_COLUMN UpdateLineColumn(c); #fi int backSlashCnt = 1; for (;;) // Read all the backslashes { if (++bufpos == available) AdjustBuffSize(); try { if ((buffer[bufpos] = c = ReadByte()) != '\\') { UpdateLineColumn(c); // found a non-backslash char. if ((c == 'u') && ((backSlashCnt & 1) == 1)) { if (--bufpos < 0) bufpos = bufsize - 1; break; } backup(backSlashCnt); return '\\'; } } catch(java.io.IOException e) { // We are returning one backslash so we should only backup (count-1) if (backSlashCnt > 1) backup(backSlashCnt-1); return '\\'; } #if KEEP_LINE_COLUMN UpdateLineColumn(c); #fi backSlashCnt++; } // Here, we have seen an odd number of backslash's followed by a 'u' try { while ((c = ReadByte()) == 'u') #if KEEP_LINE_COLUMN ++column; #else ; #fi buffer[bufpos] = c = (char)(hexval(c) << 12 | hexval(ReadByte()) << 8 | hexval(ReadByte()) << 4 | hexval(ReadByte())); #if KEEP_LINE_COLUMN column += 4; #fi } catch(java.io.IOException e) { #if KEEP_LINE_COLUMN throw new Error("Invalid escape character at line " + line + " column " + column + "."); #else throw new Error(\"Invalid escape character in input\"); #fi } if (backSlashCnt == 1) return c; else { backup(backSlashCnt - 1); return '\\'; } } else { #if KEEP_LINE_COLUMN UpdateLineColumn(c); #fi return c; } } #if GENERATE_ANNOTATIONS @Deprecated #fi /** * @deprecated * @see #getEndColumn */ ${PREFIX}public int getColumn() { #if KEEP_LINE_COLUMN return bufcolumn[bufpos]; #else return -1; #fi } #if GENERATE_ANNOTATIONS @Deprecated #fi /** * @deprecated * @see #getEndLine */ ${PREFIX}public int getLine() { #if KEEP_LINE_COLUMN return bufline[bufpos]; #else return -1; #fi } /** Get end column. */ ${PREFIX}public int getEndColumn() { #if KEEP_LINE_COLUMN return bufcolumn[bufpos]; #else return -1; #fi } /** Get end line. */ ${PREFIX}public int getEndLine() { #if KEEP_LINE_COLUMN return bufline[bufpos]; #else return -1; #fi } /** @return column of token start */ ${PREFIX}public int getBeginColumn() { #if KEEP_LINE_COLUMN return bufcolumn[tokenBegin]; #else return -1; #fi } /** @return line number of token start */ ${PREFIX}public int getBeginLine() { #if KEEP_LINE_COLUMN return bufline[tokenBegin]; #else return -1; #fi } /** Retreat. */ ${PREFIX}public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } /** Constructor. */ public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { #if STATIC if (inputStream != null) throw new Error("\n ERROR: Second call to the constructor of a static JavaCharStream.\n" + " You must either use ReInit() or set the JavaCC option STATIC to false\n" + " during the generation of this class."); #fi inputStream = dstream; #if KEEP_LINE_COLUMN line = startline; column = startcolumn - 1; #fi available = bufsize = buffersize; buffer = new char[buffersize]; #if KEEP_LINE_COLUMN bufline = new int[buffersize]; bufcolumn = new int[buffersize]; #fi nextCharBuf = new char[4096]; } /** Constructor. */ public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public JavaCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; #if KEEP_LINE_COLUMN line = startline; column = startcolumn - 1; #fi if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; #if KEEP_LINE_COLUMN bufline = new int[buffersize]; bufcolumn = new int[buffersize]; #fi nextCharBuf = new char[4096]; } #if KEEP_LINE_COLUMN prevCharIsLF = prevCharIsCR = false; #fi tokenBegin = inBuf = maxNextCharInd = 0; nextCharInd = bufpos = -1; } /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } /** Constructor. */ public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Constructor. */ public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } /** Constructor. */ public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } /** Constructor. */ public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } /** Constructor. */ public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } /** Constructor. */ public JavaCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } /** @return token image as String */ ${PREFIX}public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } /** @return suffix */ ${PREFIX}public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } /** Set buffers back to null when finished. */ ${PREFIX}public void Done() { nextCharBuf = null; buffer = null; #if KEEP_LINE_COLUMN bufline = null; bufcolumn = null; #fi } #if KEEP_LINE_COLUMN /** * Method to adjust line and column numbers for the start of a token. */ ${PREFIX}public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } #fi } javacc-5.0.orig/templates/TokenMgrError.template0000644000175000017500000001022411067674047021036 0ustar mkochmkoch/** Token Manager Error. */ ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}class TokenMgrError extends Error { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their escaped (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexical error * curLexState : lexical state in which this error occurred * errorLine : line number when the error occurred * errorColumn : column number when the error occurred * errorAfter : prefix that was seen before this error occurred * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ /** No arg constructor. */ public TokenMgrError() { } /** Constructor with message and reason. */ public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } /** Full Constructor. */ public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } javacc-5.0.orig/templates/ParseException.template0000644000175000017500000001351211066514023021214 0ustar mkochmkoch/** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by * calling the method generateParseException in the generated * parser. * * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ public class ParseException extends Exception { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); } /** Constructor with message. */ public ParseException(String message) { super(message); } /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * It uses "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser) the correct error message * gets displayed. */ private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += " " + tokenImage[tok.kind]; retval += " \""; retval += add_escapes(tok.image); retval += " \""; tok = tok.next; } #if KEEP_LINE_COLUMN retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; #fi retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected.toString(); return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ static String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } javacc-5.0.orig/templates/CharStream.template0000644000175000017500000000715511067674047020340 0ustar mkochmkoch/** * This interface describes a character stream that maintains line and * column number positions of the characters. It also has the capability * to backup the stream to some extent. An implementation of this * interface is used in the TokenManager implementation generated by * JavaCCParser. * * All the methods except backup can be implemented in any fashion. backup * needs to be implemented correctly for the correct operation of the lexer. * Rest of the methods are all used to get information like line number, * column number and the String that constitutes a token and are not used * by the lexer. Hence their implementation won't affect the generated lexer's * operation. */ #if SUPPORT_CLASS_VISIBILITY_PUBLIC public #fi interface CharStream { /** * Returns the next character from the selected input. The method * of selecting the input is the responsibility of the class * implementing this interface. Can throw any java.io.IOException. */ char readChar() throws java.io.IOException; #if GENERATE_ANNOTATIONS @Deprecated #fi /** * Returns the column position of the character last read. * @deprecated * @see #getEndColumn */ int getColumn(); #if GENERATE_ANNOTATIONS @Deprecated #fi /** * Returns the line number of the character last read. * @deprecated * @see #getEndLine */ int getLine(); /** * Returns the column number of the last character for current token (being * matched after the last call to BeginTOken). */ int getEndColumn(); /** * Returns the line number of the last character for current token (being * matched after the last call to BeginTOken). */ int getEndLine(); /** * Returns the column number of the first character for current token (being * matched after the last call to BeginTOken). */ int getBeginColumn(); /** * Returns the line number of the first character for current token (being * matched after the last call to BeginTOken). */ int getBeginLine(); /** * Backs up the input stream by amount steps. Lexer calls this method if it * had already read some characters, but could not use them to match a * (longer) token. So, they will be used again as the prefix of the next * token and it is the implemetation's responsibility to do this right. */ void backup(int amount); /** * Returns the next character that marks the beginning of the next token. * All characters must remain in the buffer between two successive calls * to this method to implement backup correctly. */ char BeginToken() throws java.io.IOException; /** * Returns a string made up of characters from the marked token beginning * to the current buffer position. Implementations have the choice of returning * anything that they want to. For example, for efficiency, one might decide * to just return null, which is a valid implementation. */ String GetImage(); /** * Returns an array of characters that make up the suffix of length 'len' for * the currently matched token. This is used to build up the matched string * for use in actions in the case of MORE. A simple and inefficient * implementation of this is as follows : * * { * String t = GetImage(); * return t.substring(t.length() - len, t.length()).toCharArray(); * } */ char[] GetSuffix(int len); /** * The lexer calls this function to indicate that it is done with the stream * and hence implementations can free any resources held by this class. * Again, the body of this function can be just empty and it will not * affect the lexer's operation. */ void Done(); } javacc-5.0.orig/templates/TokenManager.template0000644000175000017500000000056011067674047020653 0ustar mkochmkoch/** * An implementation for this interface is generated by * JavaCCParser. The user is free to use any implementation * of their choice. */ ${SUPPORT_CLASS_VISIBILITY_PUBLIC?public :}interface TokenManager { /** This gets the next token from the input stream. * A token of kind 0 () should be returned on EOF. */ public Token getNextToken(); } javacc-5.0.orig/bin/0000755000175000017500000000000011247044050013275 5ustar mkochmkochjavacc-5.0.orig/bin/jjdoc0000755000175000017500000000023511220177401014312 0ustar mkochmkoch#!/bin/sh JAR="`dirname $0`/lib/javacc.jar" case "`uname`" in CYGWIN*) JAR="`cygpath --windows -- "$JAR"`" ;; esac java -classpath "$JAR" jjdoc "$@" javacc-5.0.orig/bin/jjdoc.bat0000644000175000017500000000015211220177401015052 0ustar mkochmkoch @echo off java -classpath "%~dp0lib\javacc.jar;%~f0\..\lib\javacc.jar" jjdoc %1 %2 %3 %4 %5 %6 %7 %8 %9 javacc-5.0.orig/bin/javacc0000755000175000017500000000023611220177401014451 0ustar mkochmkoch#!/bin/sh JAR="`dirname $0`/lib/javacc.jar" case "`uname`" in CYGWIN*) JAR="`cygpath --windows -- "$JAR"`" ;; esac java -classpath "$JAR" javacc "$@" javacc-5.0.orig/bin/jjtree0000755000175000017500000000023611220177401014505 0ustar mkochmkoch#!/bin/sh JAR="`dirname $0`/lib/javacc.jar" case "`uname`" in CYGWIN*) JAR="`cygpath --windows -- "$JAR"`" ;; esac java -classpath "$JAR" jjtree "$@" javacc-5.0.orig/bin/jjrun0000755000175000017500000001056211220177401014355 0ustar mkochmkoch#!/bin/sh #################################################################### # # Copyright (C) 2006 Andrew Tomazos # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # #################################################################### # # jjrun 1.0d1 # # - Build and execute a JavaCC .jj file in one command # # - Requires javacc, java, make and sh # # - TODO: If you use something other than SimpleCharStream you # will need to modify the OBJECTS variable below # # - TODO: Only tested on GNU/Linux # #################################################################### # $PROGFILE: This programs file path PROGFILE=$0 # $VERSION: This programs version VERSION=1.0d1 # $PROGNAME: This programs name PROGNAME=`basename $0` # If project not specified output usage and exit if [ ! $1 ] then echo "USAGE: $PROGNAME " exit 1 fi # $PROJECT: The jj file to run PROJECT=`basename $1 .jj` # $MAKEFILE: An automatically generated makefile MAKEFILE=$PROJECT.mk # $FORCE: forces the regeneration of the makefile FORCE=$2 # If the specified project does not exist than exit if [ ! -f $PROJECT.jj ] then echo ERROR: $PROGNAME: File not found $PROJECT.jj exit 1 fi # If forcing makefile regeneration than delete the makefile if [ $FORCE ] then rm $MAKEFILE fi # If the makefile does not exist than generate it if [ ! -f $MAKEFILE ] then echo $PROGNAME: Generating $MAKEFILE... #### START jjrun_makefile_header_here_doc cat > $MAKEFILE < # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # ${PROJECT}: Name of the project PROJECT=$PROJECT # ${MAKEFILE}: Filename of this makefile MAKEFILE=$MAKEFILE # ${PROGFILE}: Filepath of $PROGNAME PROGFILE=$PROGFILE jjrun_makefile_header_here_doc #### END jjrun_makefile_header_here_doc #### START jjrun_makefile_main_here_doc cat >> $MAKEFILE <<'jjrun_makefile_main_here_doc' # ${JJ}: The original .jj file JJ=${PROJECT}.jj # ${AUTOGENS}: The automatically generated classed of javacc AUTOGENS= \ ${PROJECT} \ ${PROJECT}Constants \ ${PROJECT}TokenManager # ${BOILERS}: The boilerplate classes generated by javacc BOILERS= \ SimpleCharStream \ ParseException \ Token \ TokenMgrError # ${OBJECTS}: The names of the classes output by javacc OBJECTS=${AUTOGENS} ${BOILERS} # ${BOILERSOURCES}: The boilerplater sources files output by javacc BOILERSOURCES=$(addsuffix .java, ${BOILERS}) # ${SOURCES}: The source files output by javacc SOURCES=$(addsuffix .java, ${OBJECTS}) # ${CLASSES}: The class files compiled with javac from the output of javacc CLASSES=$(addsuffix .class, ${OBJECTS}) # ${MANIFEST}: filename of the manifest for the final jar file MANIFEST=${PROJECT}.mf # ${JAR}: filename of the final jar file JAR=${PROJECT}.jar # make build rule to make JAR build: ${JAR} # make ${JAR}: build the jar file ${JAR}: ${SOURCES} ${MANIFEST} @echo ${MAKEFILE}: Building ${JAR}... javac ${SOURCES} jar cvfm ${JAR} ${MANIFEST} ${CLASSES} rm ${CLASSES} # make clean: remove all generated jar files clean: @echo ${MAKEFILE}: Cleaning ${PROJECT}... @-rm ${JAR} ${SOURCES} ${MANIFEST} # make ${SOURCES}: compile the jj file into java sources ${SOURCES}: ${JJ} @echo ${MAKEFILE}: Compiling ${JJ}... @javacc ${JJ} touch -c ${BOILERSOURCES} # make ${MANIFEST}: rule to make ${MANIFEST}: @echo ${MAKEFILE}: Creating manifest... @echo Manifest-Version: 1.0 > ${MANIFEST} @echo Main-Class: ${PROJECT} >> ${MANIFEST} ${MAKEFILE}: ${PROGFILE} @echo ${MAKEFILE}: Regenerating ${MAKEFILE} @${PROGFILE} ${PROJECT} FORCE jjrun_makefile_main_here_doc # END jjrun_makefile_main_here_doc fi # If this was a forced regeneration than stop here if [ $FORCE ] then exit 0 fi # Execute the makefile to rebuild the jar file if necessary echo $PROGNAME: Executing $MAKEFILE... make -f $MAKEFILE # Execute the jar file echo $PROGNAME: Executing $PROJECT.jar... java -jar $PROJECT.jar javacc-5.0.orig/bin/jjtree.bat0000644000175000017500000000015311220177401015245 0ustar mkochmkoch @echo off java -classpath "%~dp0lib\javacc.jar;%~f0\..\lib\javacc.jar" jjtree %1 %2 %3 %4 %5 %6 %7 %8 %9 javacc-5.0.orig/www/0000755000175000017500000000000011247044055013356 5ustar mkochmkochjavacc-5.0.orig/www/index.html0000644000175000017500000001141010604211576015350 0ustar mkochmkoch JavaCC Home

Java Compiler Compiler [tm] (JavaCC [tm]) - The Java Parser Generator

Java Compiler Compiler [tm] (JavaCC [tm]) is the most popular parser generator for use with Java [tm] applications. A parser generator is a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.

We've had hundreds of thousands of downloads and estimate serious users in the many thousands (and maybe even tens of thousands). Our newsgroup comp.compilers.tools.javacc and our mailing list together have a few thousand participants.

JavaCC works with any Java VM version 1.2 or greater. It has been certified to be 100% Pure Java. JavaCC has been tested on countless different platforms without any special porting requirements. Given that we have seen JavaCC run on only around 5 or 6 platforms, we think this is a great testimonial to the "Write Once Run Anywhere" aspect of the Java programming language. We say this as engineers who have personally experienced the benefits of writing Java applications.


Getting the Software

Download the latest release of JavaCC.

Note: You need to enable cookies for the download link to work.

Third party contributions

An excellent FAQ is maintained by Theo Norvell at Memorial University of Newfoundland.

A repository of JavaCC grammars is being maintained on the JavaCC home page. We urge you to contribute your grammars to this repository or to the JavaCC authors for the benefit of others.


Feature Highlights: A short description of the features of JavaCC.

Installation and Getting Started: This page contains a bunch of tips that should aid you through the installation process.

Documentation: The complete documentation for JavaCC.

Lexer writing tips: Tips for writing good JavaCC lexical analyzer specs. This can also help you if you are getting 'code size too big' error message from javac when you compile the generated token manager.

Getting Support and Keeping In Touch: Here's how you can contact us and keep in touch with what's happening.

javacc-5.0.orig/www/doc/0000755000175000017500000000000011247044056014124 5ustar mkochmkochjavacc-5.0.orig/www/doc/features.html0000644000175000017500000001555110604211574016634 0ustar mkochmkoch JavaCC Features

JavaCC [tm]: Features

JavaCC [tm] is a Java parser generator written in the Java programming language. It produces pure Java code. Both JavaCC and the parsers generated by JavaCC have been run on a variety of Java platforms. JavaCC comes with a bunch of grammars including Java 1.0.2, Java 1.1, and Java 2 as well as a couple of HTML grammars.

Specific features of JavaCC are listed below:

  • TOP-DOWN: JavaCC generates top-down (recursive descent) parsers as opposed to bottom-up parsers generated by YACC-like tools. This allows the use of more general grammars (although left-recursion is disallowed). Top-down parsers have a bunch of other advantages (besides more general grammars) such as being easier to debug, having the ability to parse to any non-terminal in the grammar, and also having the ability to pass values (attributes) both up and down the parse tree during parsing.
  • LARGE USER COMMUNITY: JavaCC is by far the most popular parser generator used with Java applications. We've had over hundreds of thousands of downloads and estimate serious users in the many thousands (maybe even tens of thousands). Our mailing list and newsgroups together have a few thousand participants.
  • LEXICAL AND GRAMMAR SPECIFICATIONS IN ONE FILE: The lexical specifications such as regular expressions, strings, etc. and the grammar specifications (the BNF) are both written together in the same file. It makes grammars easier to read (since it is possible to use regular expressions inline in the grammar specification) and also easier to maintain.
  • TREE BUILDING PREPROCESSOR: JavaCC comes with JJTree, an extremely powerful tree building preprocessor.
  • EXTREMELY CUSTOMIZABLE: JavaCC offers many different options to customize its behavior and the behavior of the generated parsers. Examples of such options are the kinds of Unicode processing to perform on the input stream, the number of tokens of ambiguity checking to perform, etc. etc.
  • CERTIFIED TO BE 100% PURE JAVA: JavaCC runs on all Java compliant platforms Version 1.1 or later. It has been used on countless different machines with no special porting effort - a testimonial to the "Write Once, Run Everywhere" aspect of the Java [tm] programming language.
  • DOCUMENT GENERATION: JavaCC includes a tool called JJDoc that converts grammar files to documentation files (optionally in html).
  • MANY MANY EXAMPLES: The JavaCC release includes a wide range of examples including Java and HTML grammars. The examples, along with their documentation, are a great way to get acquainted with JavaCC.
  • INTERNATIONALIZED: The lexical analyzer of JavaCC can handle full Unicode input, and lexical specifications may also include any Unicode character. This facilitates descriptions of language elements such as Java identifiers that allow certain Unicode characters (that are not ASCII), but not others.
  • SYNTACTIC AND SEMANTIC LOOKAHEAD SPECIFICATIONS: By default, JavaCC generates an LL(1) parser. However, there may be portions of the grammar that are not LL(1). JavaCC offers the capabilities of syntactic and semantic lookahead to resolve shift-shift ambiguities locally at these points. For example, the parser is LL(k) only at such points, but remains LL(1) everywhere else for better performance. Shift-reduce and reduce-reduce conflicts are not an issue for top-down parsers.
  • PERMITS EXTENDED BNF SPECIFICATIONS: JavaCC allows extended BNF specifications - such as (A)*, (A)+, etc. - within the lexical and the grammar specifications. Extended BNF relieves the need for left-recursion to some extent. In fact, extended BNF is often easier to read as in A ::= y(x)* versus A ::= Ax|y.
  • LEXICAL STATES AND LEXICAL ACTIONS: JavaCC offers lex-like lexical state and lexical action capabilities. Specific aspects in JavaCC that are superior to other tools are the first class status it offers concepts such as TOKEN, MORE, SKIP, state changes, etc. This allows cleaner specifications as well as better error and warning messages from JavaCC.
  • CASE-INSENSITIVE LEXICAL ANALYSIS: Lexical specifications can define tokens not to be case sensitive either at the global level for the entire lexical specification, or on an individual lexical specification basis.
  • EXTENSIVE DEBUGGING CAPABILITIES: Using options DEBUG_PARSER, DEBUG_LOOKAHEAD, and DEBUG_TOKEN_MANAGER, one can get in-depth analysis of the parsing and the token processing steps.
  • SPECIAL TOKENS: Tokens that are defined as special tokens in the lexical specification are ignored during parsing, but these tokens are available for processing by the tools. A useful application of this is in the processing of comments.
  • VERY GOOD ERROR REPORTING: JavaCC error reporting is among the best in parser generators. JavaCC generated parsers are able to clearly point out the location of parse errors with complete diagnostic information.
javacc-5.0.orig/www/doc/JJTree.html0000644000175000017500000005706511072754252016154 0ustar mkochmkoch JavaCC: JJTree Reference

JavaCC [tm]: JJTree Reference Documentation

Introduction

JJTree is a preprocessor for JavaCC [tm] that inserts parse tree building actions at various places in the JavaCC source. The output of JJTree is run through JavaCC to create the parser. This document describes how to use JJTree, and how you can interface your parser to it.

By default JJTree generates code to construct parse tree nodes for each nonterminal in the language. This behavior can be modified so that some nonterminals do not have nodes generated, or so that a node is generated for a part of a production's expansion.

JJTree defines a Java interface Node that all parse tree nodes must implement. The interface provides methods for operations such as setting the parent of the node, and for adding children and retrieving them.

JJTree operates in one of two modes, simple and multi (for want of better terms). In simple mode each parse tree node is of concrete type SimpleNode; in multi mode the type of the parse tree node is derived from the name of the node. If you don't provide implementations for the node classes JJTree will generate sample implementations based on SimpleNode for you. You can then modify the implementations to suit.

Although JavaCC is a top-down parser, JJTree constructs the parse tree from the bottom up. To do this it uses a stack where it pushes nodes after they have been created. When it finds a parent for them, it pops the children from the stack and adds them to the parent, and finally pushes the new parent node itself. The stack is open, which means that you have access to it from within grammar actions: you can push, pop and otherwise manipulate its contents however you feel appropriate. See Node Scopes and User Actions below for more important information.

JJTree provides decorations for two basic varieties of nodes, and some syntactic shorthand to make their use convenient.

  1. A definite node is constructed with a specific number of children. That many nodes are popped from the stack and made the children of the new node, which is then pushed on the stack itself. You notate a definite node like this:

    #ADefiniteNode(INTEGER EXPRESSION)

    A definite node descriptor expression can be any integer expression, although literal integer constants are by far the most common expressions.

  2. A conditional node is constructed with all of the children that were pushed on the stack within its node scope if and only if its condition evaluates to true. If it evaluates to false, the node is not constructed, and all of the children remain on the node stack. You notate a conditional node like this:

    #ConditionalNode(BOOLEAN EXPRESSION)

    A conditional node descriptor expression can be any boolean expression. There are two common shorthands for conditional nodes:

    1. Indefinite nodes

      #IndefiniteNode is short for #IndefiniteNode(true)

    2. Greater-than nodes

      #GTNode(>1) is short for #GTNode(jjtree.arity() > 1)

    The indefinite node shorthand (1) can lead to ambiguities in the JJTree source when it is followed by a parenthesized expansion. In those cases the shorthand must be replaced by the full expression. For example:

    	  ( ... ) #N ( a() ) 

    is ambiguous; you have to use the explicit condition:

     ( ... ) #N(true) ( a()
    	  ) 

WARNING: node descriptor expressions should not have side-effects. JJTree doesn't specify how many times the expression will be evaluated.

By default JJTree treats each nonterminal as an indefinite node and derives the name of the node from the name of its production. You can give it a different name with the following syntax:

    void P1() #MyNode : { ... } { ... }
	  

When the parser recognizes a P1 nonterminal it begins an indefinite node. It marks the stack, so that any parse tree nodes created and pushed on the stack by nonterminals in the expansion for P1 will be popped off and made children of the node MyNode.

If you want to suppress the creation of a node for a production you can use the following syntax:

    void P2() #void : { ... } { ... }
	  

Now any parse tree nodes pushed by nonterminals in the expansion of P2 will remain on the stack, to be popped and made children of a production further up the tree. You can make this the default behavior for non-decorated nodes by using the NODE_DEFAULT_VOID option.

    void P3() : {}
    {
        P4() ( P5() )+ P6()
    }
    

In this example, an indefinite node P3 is begun, marking the stack, and then a P4 node, one or more P5 nodes and a P6 node are parsed. Any nodes that they push are popped and made the children of P3. You can further customize the generated tree:

    void P3() : {}
    {
        P4() ( P5() )+ #ListOfP5s P6()
    }
    

Now the P3 node will have a P4 node, a ListOfP5s node and a P6 node as children. The #Name construct acts as a postfix operator, and its scope is the immediately preceding expansion unit.

Node Scopes and User Actions

Each node is associated with a node scope. User actions within this scope can access the node under construction by using the special identifier jjtThis to refer to the node. This identifier is implicitly declared to be of the correct type for the node, so any fields and methods that the node has can be easily accessed.

A scope is the expansion unit immediately preceding the node decoration. This can be a parenthesized expression. When the production signature is decorated (perhaps implicitly with the default node), the scope is the entire right hand side of the production including its declaration block.

You can also use an expression involving jjtThis on the left hand side of an expansion reference. For example:

    ... ( jjtThis.my_foo = foo() ) #Baz ...
	  

Here jjtThis refers to a Baz node, which has a field called my_foo. The result of parsing the production foo() is assigned to that my_foo.

The final user action in a node scope is different from all the others. When the code within it executes, the node's children have already been popped from the stack and added to the node, which has itself been pushed onto the stack. The children can now be accessed via the node's methods such as jjtGetChild().

User actions other than the final one can only access the children on the stack. They have not yet been added to the node, so they aren't available via the node's methods.

A conditional node that has a node descriptor expression that evaluates to false will not get added to the stack, nor have children added to it. The final user action within a conditional node scope can determine whether the node was created or not by calling the nodeCreated() method. This returns true if the node's condition was satisfied and the node was created and pushed on the node stack, and false otherwise.

Exception handling

An exception thrown by an expansion within a node scope that is not caught within the node scope is caught by JJTree itself. When this occurs, any nodes that have been pushed on to the node stack within the node scope are popped and thrown away. Then the exception is rethrown.

The intention is to make it possible for parsers to implement error recovery and continue with the node stack in a known state.

WARNING: JJTree currently cannot detect whether exceptions are thrown from user actions within a node scope. Such an exception will probably be handled incorrectly.

Node Scope Hooks

If the NODE_SCOPE_HOOK option is set to true, JJTree generates calls to two user-defined parser methods on the entry and exit of every node scope. The methods must have the following signatures:

    void jjtreeOpenNodeScope(Node n)
    void jjtreeCloseNodeScope(Node n)
    

If the parser is STATIC then these methods will have to be declared as static as well. They are both called with the current node as a parameter.

One use might be to store the parser object itself in the node so that state that should be shared by all nodes produced by that parser can be provided. For example, the parser might maintain a symbol table.

    void jjtreeOpenNodeScope(Node n)
    {
      ((SimpleNode)n).jjtSetValue(getSymbolTable());
    }

    void jjtreeCloseNodeScope(Node n)
    {
    }
    

Where getSymbolTable() is a user-defined method to return a symbol table structure for the node.

Tracking Tokens

It is often useful to keep track of each node's first and last token so that input can be easily reproduced again. By setting the TRACK_TOKENS option the generated SimpleNode class will contain 4 extra methods:

      public Token jjtGetFirstToken()
      public void jjtSetFirstToken(Token token)
      public Token jjtGetLastToken()
      public void jjtSetLastToken(Token token)
      

The first and last token for each node will be set up automatically when the parser is run.

The Life Cycle of a Node

A node goes through a well determined sequence of steps as it is built. This is that sequence viewed from the perspective of the node itself:

  1. the node's constructor is called with a unique integer parameter. This parameter identifies the kind of node and is especially useful in simple mode. JJTree automatically generates a file called parserTreeConstants.java that declares valid constants. The names of constants are derived by prepending JJT to the uppercase names of nodes, with dot symbols (".") replaced by underscore symbols ("_"). For convenience, an array of Strings called jjtNodeName[] that maps the constants to the unmodified names of nodes is maintained in the same file.
  2. the node's jjtOpen() method is called.
  3. if the option NODE_SCOPE_HOOK is set, the user-defined parser method openNodeScope() is called and passed the node as its parameter. This method can initialize fields in the node or call its methods. For example, it might store the node's first token in the node.
  4. if an unhandled exception is thrown while the node is being parsed then the node is abandoned. JJTree will never refer to it again. It will not be closed, and the user-defined node scope hook closeNodeHook() will not be called with it as a parameter.
  5. otherwise, if the node is conditional and its conditional expression evaluates to false then the node is abandoned. It will not be closed, although the user-defined node scope hook closeNodeHook() might be called with it as a parameter.
  6. otherwise, all of the children of the node as specified by the integer expression of a definite node, or all the nodes that were pushed on the stack within a conditional node scope are added to the node. The order they are added is not specified.
  7. the node's jjtClose() method is called.
  8. the node is pushed on the stack.
  9. if the option NODE_SCOPE_HOOK is set, the user-defined parser method closeNodeScope() is called and passed the node as its parameter.
  10. if the node is not the root node, it is added as a child of another node and its jjtSetParent() method is called.

Visitor Support

JJTree provides some basic support for the visitor design pattern. If the VISITOR option is set to true JJTree will insert an jjtAccept() method into all of the node classes it generates, and also generate a visitor interface that can be implemented and passed to the nodes to accept.

The name of the visitor interface is constructed by appending Visitor to the name of the parser. The interface is regenerated every time that JJTree is run, so that it accurately represents the set of nodes used by the parser. This will cause compile time errors if the implementation class has not been updated for the new nodes. This is a feature.

Options

JJTree supports the following options on the command line and in the JavaCC options statement:

BUILD_NODE_FILES (default: true)
Generate sample implementations for SimpleNode and any other nodes used in the grammar.
MULTI (default: false)
Generate a multi mode parse tree. The default for this is false, generating a simple mode parse tree.
NODE_DEFAULT_VOID (default: false)
Instead of making each non-decorated production an indefinite node, make it void instead.
NODE_CLASS (default: "")
If set defines the name of a user-supplied class that will extend SimpleNode. Any tree nodes created will then be subclasses of NODE_CLASS.
NODE_FACTORY (default: "")
Specify a class containing a factory method with following signature to construct nodes:
public static Node jjtCreate(int id)
For backwards compatibility, the value false may also be specified, meaning that SimpleNode will be used as the factory class.
NODE_PACKAGE (default: "")
The package to generate the node classes into. The default for this is the parser package.
NODE_EXTENDS (default: "") Deprecated
The superclass for the SimpleNode class. By providing a custom superclass you may be able to avoid the need to edit the generated SimpleNode.java. See the examples/Interpreter for an example usage.
NODE_PREFIX (default: "AST")
The prefix used to construct node class names from node identifiers in multi mode. The default for this is AST.
NODE_SCOPE_HOOK (default: false)
Insert calls to user-defined parser methods on entry and exit of every node scope. See Node Scope Hooks above.
NODE_USES_PARSER (default: false)
JJTree will use an alternate form of the node construction routines where it passes the parser object in. For example,
 public static Node MyNode.jjtCreate(MyParser p, int id);
	  MyNode(MyParser p, int id); 
TRACK_TOKENS (default: false
Insert jjtGetFirstToken(), jjtSetFirstToken(), getLastToken(), and jjtSetLastToken() methods in SimpleNode. The FirstToken is automatically set up on entry to a node scope; the LastToken is automatically set up on exit from a node scope.
STATIC (default: true)
Generate code for a static parser. The default for this is true. This must be used consistently with the equivalent JavaCC options. The value of this option is emitted in the JavaCC source.
VISITOR (default: false)
Insert a jjtAccept() method in the node classes, and generate a visitor implementation with an entry for every node type used in the grammar.
VISITOR_DATA_TYPE (default: "Object")
If this option is set, it is used in the signature of the generated jjtAccept() methods and the visit() methods as the type of the data argument.
VISITOR_RETURN_TYPE (default: "Object")
If this option is set, it is used in the signature of the generated jjtAccept() methods and the visit() methods as the return type of the method.
VISITOR_EXCEPTION (default: "")
If this option is set, it is used in the signature of the generated jjtAccept() methods and the visit() methods.
JJTREE_OUTPUT_DIRECTORY (default: use value of OUTPUT_DIRECTORY)
By default, JJTree generates its output in the directory specified in the global OUTPUT_DIRECTORY setting. Explicitly setting this option allows the user to separate the parser from the tree files.

JJTree state

JJTree keeps its state in a parser class field called jjtree. You can use methods in this member to manipulate the node stack.

    final class JJTreeState {
      /* Call this to reinitialize the node stack.  */
      void reset();

      /* Return the root node of the AST. */
      Node rootNode();

      /* Determine whether the current node was actually closed and
	 pushed */
      boolean nodeCreated();

      /* Return the number of nodes currently pushed on the node
         stack in the current node scope. */
      int arity();

      /* Push a node on to the stack. */
      void pushNode(Node n);

      /* Return the node on the top of the stack, and remove it from the
	 stack.  */
      Node popNode();

      /* Return the node currently on the top of the stack. */
      Node peekNode();
    }
    

Node Objects

    /* All AST nodes must implement this interface.  It provides basic
       machinery for constructing the parent and child relationships
       between nodes. */

    public interface Node {
      /** This method is called after the node has been made the current
	node.  It indicates that child nodes can now be added to it. */
      public void jjtOpen();

      /** This method is called after all the child nodes have been
	added. */
      public void jjtClose();

      /** This pair of methods are used to inform the node of its
	parent. */
      public void jjtSetParent(Node n);
      public Node jjtGetParent();

      /** This method tells the node to add its argument to the node's
	list of children.  */
      public void jjtAddChild(Node n, int i);

      /** This method returns a child node.  The children are numbered
	 from zero, left to right. */
      public Node jjtGetChild(int i);

      /** Return the number of children the node has. */
      int jjtGetNumChildren();
    }
    

The class SimpleNode implements the Node interface, and is automatically generated by JJTree if it doesn't already exist. You can use this class as a template or superclass for your node implementations, or you can modify it to suit. SimpleNode additionally provides a rudimentary mechanism for recursively dumping the node and its children. You might use this is in action like this:

    {
        ((SimpleNode)jjtree.rootNode()).dump(">");
    }

    

The String parameter to dump() is used as padding to indicate the tree hierarchy.

Another utility method is generated if the VISITOR options is set:

    {
        public void childrenAccept(MyParserVisitor visitor);
    }
    

This walks over the node's children in turn, asking them to accept the visitor. This can be useful when implementing preorder and postorder traversals.

Examples

JJTree is distributed with some simple examples containing a grammar that parses arithmetic expressions. See the file examples/JJTreeExamples/README for further details.

There is also an interpreter for a simple language that uses JJTree to build the program representation. See the file examples/Interpreter/README for more information.

Information about an example using the visitor support is in examples/VTransformer/README.

javacc-5.0.orig/www/doc/docindex.html0000644000175000017500000001114010604211574016601 0ustar mkochmkoch JavaCC Documentation Index

JavaCC [tm]: Documentation Index

By following the links from this page you should be able to obtain all necessary documentation on JavaCC [tm].

If you have further questions, please do not hesitate to contact us. We recommend the following step-by-step process to learning JavaCC:

  • Go through the simple examples that are available as part of the Java Compiler Compiler [tm] release. This is located under the examples directory in a directory called SimpleExamples. Read the file README in this directory for complete instructions.
  • Go through the tree building examples (that use JJTree) that are also available as part of the JavaCC release. This is located under the examples directory in a directory called JJTreeExamples. Read the file README in this directory for complete instructions.
  • Study the description of the JavaCC grammar file. This provides the complete syntax of the grammar file along with a detailed description of these constructs. There are also many examples in the grammar repository.
  • Click here to see the document that describes the command line input syntax.
  • The JavaCC API routines are a bunch of classes, methods, and variables which may be accessed from user code (typically from actions - the java_block in the syntax).
  • Click here to get to the JJTree documentation.
  • Click here to get to the JJDoc documentation.
  • Detailed JavaCC documentation is organized as a set of minitutorials, each on a separate topic. The following minitutorials are currently available:
javacc-5.0.orig/www/doc/jjtreereleasenotes.html0000644000175000017500000004266411111633417020716 0ustar mkochmkoch JavaCC: JJTree Release Notes

JavaCC [tm]: JJTree Release Notes


======================================
Changes in 4.2
======================================
Release 4.2 is a maintenance release, incorporating a number of bug
fixes and enhancements. For a complete list, please see the
issue tracker:

https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.2

======================================
Changes in 4.1
======================================
Release 4.1 is a maintenance release, incorporating a number of bug
fixes and enhancements. For a complete list, please see the
issue tracker:

https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.1

======================================
Changes in 4.0
======================================
New option NODE_EXTENDS to specify a classname that
SimpleNode extends so that boiler plate code can be  put
in that class. See the examples/Interpreter for an example
usage.

======================================
Changes from JJTree 0.3pre5 to 0.3pre6
======================================

----------------------------------------------------------------

Fixed bug where Writers were not being closed correctly.

----------------------------------------------------------------

======================================
Changes from JJTree 0.3pre4 to 0.3pre5
======================================

----------------------------------------------------------------

Fixed a bug where a node annotation #P() caused a null pointer error.

----------------------------------------------------------------

Only generate the jjtCreate() methods if the NODE_FACTORY option is
set.

----------------------------------------------------------------

Fixed a bug where the name of the JJTree state file was being used in
the declaration of the field.

----------------------------------------------------------------

======================================
Changes from JJTree 0.3pre3 to 0.3pre4
======================================

----------------------------------------------------------------

Made the constructors of nodes public.  Also made the node identifier
constants and the associated strings public.

----------------------------------------------------------------

Fixed a misleading error message that was produced when the output
file couldn't be generated for some reason.

----------------------------------------------------------------

Brought the HTML documentation up to date.

----------------------------------------------------------------

Fixed a bug where the file containing the JJTree state class was
ignoring the OUTPUT_DIRECTORY option.

----------------------------------------------------------------

Fixed a bug where a construction like this:

	a=foo() #Foo

was being incorrectly handled and generating bad Java code.

----------------------------------------------------------------

Changed the visitor support from a void function to one which takes a
parameter and returns a result.  This is a non-compatible change, so
you will have to update your code if it uses the visitor support.


[Also, if the string option VISITOR_EXCEPTION is set, its value is
also used in the signatures of the various methods in the pattern.

Please note: this exception support is very provisional and will be
replaced in a following version by a more general solution.  It's only
here because I needed it for one of my own projects and thought it
might be useful to someone else too.  Don't use it unless you're
prepared to change your code again later.  Rob.]

----------------------------------------------------------------

======================================
Changes from JJTree 0.3pre2 to 0.3pre3
======================================

----------------------------------------------------------------

JJTree now uses the same grammar as JavaCC.  This means that Java code
in parser actions is parsed.

----------------------------------------------------------------

Added support for the Visitor design pattern.  If the VISITOR option
is true, JJTree adds an accept method to the node classes that it
generates, and also generates a visitor interface.  This interface is
regenerated every time that JJTree is run, so that new nodes will
cause compilation errors in concrete visitors that have not been
updated for them.

----------------------------------------------------------------

Added a couple of examples to illustrate the Visitor support.
JJTreeExamples/eg4.jjt is yet another version of the expression tree
builder which uses a visitor to dump the expression tree; and
VTransformer is a variation of the Java source code transformer.

VTransformer is also possibly directly useful as a tool that inserts
visitor accept methods into class files that were generated with
earlier versions of JJTree.

----------------------------------------------------------------

Added the BUILD_NODE_FILES option, with a default value of true.  If
set to false, it prevents JJTree from generating SimpleNode.java and
nodes that are usually built in MULTI mode.  Node.java is still
generated, as are the various tree constants, etc.

----------------------------------------------------------------

Code that is inserted into the grammar is now enclosed in the standard
@bgen/@egen pair.

----------------------------------------------------------------

The JJTree state object is now generated into its own file if it
doesn't already exist.  This is to make it easier to modify.

----------------------------------------------------------------

Fixed a couple of bugs in the HTML example grammar where the closing
tags didn't match the opening tags.

----------------------------------------------------------------

Fixed a bug where JJTree was trying to clear the node scope while
handling an exception, even when the node had been closed successfully.

----------------------------------------------------------------

NODE_FACTORY no longer implies NODE_USES_PARSER.

If you have been using NODE_FACTORY, then now you'll also need
NODE_USES_PARSER.  Unless, of course, you were never using the parser
in your node factories.

----------------------------------------------------------------

Removed not very useful debugging stuff from the JJTree state object.
It was causing problems with parsers running in security environments
where access to arbitrary properties is disallowed.

----------------------------------------------------------------

======================================
Changes from JJTree 0.3pre1 to 0.3pre2
======================================

----------------------------------------------------------------

The state that JJTree inserts into the parser class is now guarded by
the formal comments.

----------------------------------------------------------------

The JJTree syntax has been changed so that the node descriptor now
comes after the throws clause, rather than before it.

----------------------------------------------------------------

Fixed a bug where string-valued options did not have their quotes
stripped.

----------------------------------------------------------------

Fixed a bug where nodes were being closed early for actions within
ZeroOrMore etc., expansion units.

----------------------------------------------------------------

The special identifier `jjtThis' was not being translated in parameter
lists or in the BNF declaration section.  Fixed it.

----------------------------------------------------------------

Added the OUTPUT_DIRECTORY option.  The default value is "".

----------------------------------------------------------------

Reinstated node factory methods.  They are enabled by setting the
NODE_FACTORY option to true.  Unlike the original node factory methods
they take two arguments: the node identifier constant and a reference
to the parser.  The reference is null for static parsers.

----------------------------------------------------------------

Added the NODE_USES_PARSER option with a default value of false.  When
set to true, JJTree will call the node constructor with a reference to
the parser object as an extra parameter.  This reference is null for
static parsers.

----------------------------------------------------------------

====================================
Changes from JJTree 0.2.6 to 0.3pre1
====================================

----------------------------------------------------------------

JJTree 0.3pre1 has been bootstrapped with JJTree 0.2.6.

Some aspects of JJTree 0.3pre1 are not backwards-compatible with
0.2.6.  Some users will need to modify their parsers in
straightforward ways in order to work with the new version.  See the
file JJTREE-FIX to find out if you need to change anything, and for
detailed instructions on what to change.

----------------------------------------------------------------

JJTree works with the JavaCC exception handling code.  Any unhandled
exceptions within a node scope are caught, the node stack is cleaned
up a bit, and then the exception is rethrown.

----------------------------------------------------------------

Indefinite and Greater-Than nodes have been generalized into
conditional nodes.

Definite nodes now take any integer expression to indicate now many
children they take.  Conditional nodes take any boolean expression to
indicate whether the node is closed and pushed on to the node stack.

----------------------------------------------------------------

The life cycle of a node is now defined.

----------------------------------------------------------------

User-defined parser methods can be called when a node scope is entered
and exited.

----------------------------------------------------------------

The NODE_STACK_SIZE and CHECK_DEFINITE_NODE options are now ignored.

The NODE_SCOPE_HOOK option has been added.  This boolean option
determines whether calls to certain user-defined parser methods are
generated at the beginning and end of each node scope.  The default
value for this option is false.

----------------------------------------------------------------

The special identifier jjtThis can now be used in the declarations
section of a production, as well as on the left hand side of call to a
nonterminal.

----------------------------------------------------------------

A new method arity() has been added to the JJTree state.  It returns
the number of nodes that have been pushed so far in the current node
scope.

----------------------------------------------------------------

The Node interface has changed.  The method jjtAddChild() now takes an
argument to indicate the index of the child it is adding.

----------------------------------------------------------------

The node factory methods are no longer used.  You can remove all your
jjtCreate() methods.

The node constructor now takes an int parameter instead of a String.
You will have to modify your node implementations to use the new
signature.  The protected field `identifier' no longer exists: you can
use the jjtNodeName[] array to map from the new parameter to the old
String.

----------------------------------------------------------------

The implementation of SimpleNode has changed significantly.  It now
uses an array to hold any child nodes instead of a Vector.  It no
longer implements a node factory, its constructor takes an int instead
of a String, and it uses the jjtNodeName[] mechanism for dumping.  The
setInfo() and getInfo() methods have been removed.

----------------------------------------------------------------

The implementation of the state that JJTree keeps in the parser has
changed.  It is now considerably more lightweight: the auxiliary
classes JJTreeNodeStack and JJTreeNodeStackEnum have been abolished.

----------------------------------------------------------------

The JJTree state method currentNode() has been removed.  Any calls to
the method in an action within a node scope are automatically replaced
by references to the special identifier jjtThis.

----------------------------------------------------------------

==================================
Changes from JJTree 0.2.5 to 0.2.6
==================================

----------------------------------------------------------------

Made appropriate internal modifications for the JavaCC 0.7 parse error
exceptions.

----------------------------------------------------------------

==================================
Changes from JJTree 0.2.4 to 0.2.5
==================================

----------------------------------------------------------------

Fixed a bug where the current node was not being updated in the right
place for final user actions.

----------------------------------------------------------------

==================================
Changes from JJTree 0.2.3 to 0.2.4
==================================

----------------------------------------------------------------

Fixed a bug where bad code was generated for void nodes in MULTI mode.

----------------------------------------------------------------

Fixed a bug where a node decoration directly on an action generated
bad code. For example,

	{} #MyNode

----------------------------------------------------------------

==================================
Changes from JJTree 0.2.2 to 0.2.3
==================================

----------------------------------------------------------------

Added toString() and toString(String) methods to SimpleNode and
modified the dumping code to use them.  Now you can easily customize
how a node appears in the tree dump, without having to reproduce the
tree walking machinery.  See SimpleNode.java for details.

----------------------------------------------------------------

Clarified the concept of node scope.  currentNode() now refers to the
node currently being built for the current scope.  It used to be
incorrectly implemented as referring to the most recently created
node, and was synonymous with peekNode().

This change may break some existing programs.  Those programs should
be changed to use peekNode() where they currently use currentNode().

Added jjtThis to every user action.  It refers to the same node that
currentNode() does, but is already cast to the appropriate node type.

The final user action in a node scope is different from all the
others.  When it is executed the node has been fully created, had its
children added, and has been pushed on the node stack.  By contrast,
other user actions within the scope are called when the children are
still on the stack, and the current node is not.

Added the nodeCreated() method so that final actions within greater
than nodes can tell whether the node was created or not.

----------------------------------------------------------------

Fixed several stupid bugs in the Macintosh main class.

----------------------------------------------------------------

Fixed names of internally used JJTree classes so that they use the JJT
prefix and the name of the parser.  This is to avoid naming conflicts
where there is more than one JJTree parser in the same package.

----------------------------------------------------------------

================================
Changes from JJTree 0.2 to 0.2.2
================================

The main change between Beanstalk 0.2 and JJTree 0.2.2 is the removal
of the factory classes.  Their function is now performed by a static
method in the node classes themselves.

The state maintained in the parser class has been changed from bs to
jjtree.  The prefix on the Node class methods has been changed from bs
to jjt.

A new node method jjtGetNumChildren() returns the number of children
the node has.  You can use this in conjunction with jjtGetChild() to
iterate over the children.

Two new options have been added: OUTPUT_FILE and NODE_DEFAULT_VOID.

----------------------------------------------------------------
javacc-5.0.orig/www/doc/javaccreleasenotes.html0000644000175000017500000007010211111633417020646 0ustar mkochmkoch JavaCC Release Notes

JavaCC [tm]: Release Notes

THIS FILE IS A COMPLETE LOG OF ALL CHANGES THAT HAVE TAKEN PLACE SINCE
THE RELEASE OF VERSION 0.5 IN OCTOBER, 1996.

AS NOTED HERE, DURING THE TRANSITION FROM 0.5 TO 4.0, THERE HAVE BEEN
THE FOLLOWING INTERMEDIATE VERSIONS:

	0.6.-10
	0.6.-9
	0.6.-8
	0.6(Beta1)
	0.6(Beta2)
	0.6
	0.6.1
	0.7pre1
	0.7pre2
	0.7pre3
	0.7pre4
	0.7pre5
	0.7pre6
	0.7pre7
	0.7
	0.7.1
	0.8pre1
	0.8pre2
	1.0
	1.2
	2.0
	2.1
	3.0
	3.1
	3.2
	4.0
	4.1
        4.2


-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 4.2
-------------------------------------------------------------------

Release 4.2 is a maintenance release, incorporating a number of bug
fixes and enhancements. For a complete list, please see the
issue tracker:

https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.2

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 4.1
-------------------------------------------------------------------

Release 4.1 is a maintenance release, incorporating a number of bug
fixes and enhancements. For a complete list, please see the
issue tracker:

https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.1

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 4.0
-------------------------------------------------------------------

See the bug list in issue tracker for all the bugs fixed in this release.
JJTree and JavaCC both now support 1.5 syntax.
We now support accessing token fields in the grammar like: s=<ID>.image
Convenient constructors for passing encoding directly to the grammar
Tabsetting is now customizable.
SimpleNode can now extend a class using the NODE_EXTENDS option.
JAVACODE and BNF productions take optional access modifiers.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 3.2
-------------------------------------------------------------------
New regular expression kind with range operator where the upperbound is
optional, meaning just minimum, no max - (<RE>){n,}
Fix for issue 41 where it takes exponential time to minimumSize

MODIFICATIONS IN VERSION 3.2
-------------------------------------------------------------------
Added the LICENSE file to the installation root directory.
Fixed issues #: 10, 11, 13, 2, 4, 5, 7
In particular, the generated code should now compile with JDK 1.5 (Tiger)

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 3.1
-------------------------------------------------------------------

Open source with BSD license.
Fixed the copyright text in the sourcefiles.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 3.0 (as compared to version 2.1)
-------------------------------------------------------------------

No GUI version anymore.

Fixed a bug in handling string literals when they intersect some
regular expression.

Split up initializations of jj_la1_* vars into smaller methods so
that there is no code size issue. This is a recently reported bug.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 2.1 (as compared to version 2.0)
-------------------------------------------------------------------

Added a new option - KEEP_LINE_COLUMN default true.

If you set this option to false, the generated CharStream will not
have any line/column tracking code. It will be your responsibility
to do it some other way. This is needed for systems which don't care
about giving error messages etc.

-------------------------------------------------------------------

API Changes: JavaCC no longer generates one of the 4 stream classes:

      ASCII_CharStream
      ASCII_UCodeESC_CharStream
      UCode_CharStream
      UCode_UCodeESC_CharStream

In stead, it now supports two kinds of streams:

      SimpleCharStream
      JavaCharStream

Both can be instantiated using a Reader object.

SimpleCharStream just reads the characters from the Reader using the
read(char[], int, int) method. So if you want to support a specific
encoding - like SJIS etc., you will first create the Reader object
with that encoding and instantiate the SimpleCharStream with that
Reader so your encoding is automatically used. This should solve a
whole bunch of issues with UCode* classes that were reported.

JavaCharStream is pretty much like SimpleCharStream, but it also does
\uxxxx processing as used by the Java programming language.

Porting old grammars:

Just replace Stream class names as follows -

    if you are using ASCII_CharStream or UCode_CharStream,
    change it to SimpleCharStream

    if you are using ASCII_UCodeESC_CharStream or UCode_UCodeESC_CharStream,
    change it to JavaCharStream

The APIs remain the same.

Also, the CharStream interface remains the same. So, if you have been using
USER_CHAR_STREAM option, then you don't need to change anything.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 2.0 (as compared to version 1.2)
-------------------------------------------------------------------

Added CPP grammar to examples directory (contributed by Malome Khomo).

-------------------------------------------------------------------

GUI is now available to run JavaCC.  You can control all aspects of
JJTree and JavaCC (except creating and editing the grammar file)
through this GUI.

-------------------------------------------------------------------

Desktop icons now available on a variety of platforms so you can
run JavaCC by double clicking the icon.

-------------------------------------------------------------------

Bash on NT support improved.

-------------------------------------------------------------------

Uninstaller included.

-------------------------------------------------------------------

Fixed some minor bugs.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 1.2 (as compared to version 1.0)
-------------------------------------------------------------------

Moved JavaCC to the Metamata installer and made it available for
download from Metamata's web site.

-------------------------------------------------------------------

Added Java 1.2 grammars to the examples directory.

-------------------------------------------------------------------

Added repetition range specifications for regular expressions.
You can specify exact number of times a particular re should
occur or a {man, max} range, e.g,

    TOKEN:
    {
         < TLA: (["A"-"Z"]){3} > // Three letter acronyms!

      |

         < DOS_FILENAME: (~[".", ":", ";", "\\"]) {1,8}
                         ( "." (~[".", ":", ";", "\\"]){1,3})? >
               // An incomplete spec for the DOS file name format
    }

The translation is right now expanding out these many number of times
so use it with caution.

-------------------------------------------------------------------

You can now specify actions/state changes for EOF. It is right now
very strict in that it has to look exactly like:

   <*> TOKEN:
   {
      < EOF > { action } : NEW_STATE
   }

which means that EOF is still EOF in every state except that now
you can specify what state changes  if any or what java code
if any to execute on seeing EOF.

This should help in writing grammars for processing C/C++ #include
files, without going through hoops as in the old versions.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 1.0 (as compared to version 0.8pre2)
-------------------------------------------------------------------

Fixed bugs related to usage of JavaCC with Java 2.

-------------------------------------------------------------------

Many other bug fixes.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.8pre2 (as compared to version 0.8pre1)
-------------------------------------------------------------------

Mainly bug fixes.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.8pre1 (as compared to version 0.7.1)
-------------------------------------------------------------------

Changed all references to Stream classes in the JavaCC code itself and
changed them to Reader/Writer.

-------------------------------------------------------------------

Changed all the generated *CharStream classes to use Reader instead of
InputStream. The names of the generated classes still say *CharStream.
For compatibility reasons, the old constructors are still supported.
All the constructors that take InputStream create InputStreamReader
objects for reading the input data. All users parsing non-ASCII inputs
should continue to use the InputStream constructors.

-------------------------------------------------------------------

Generate inner classes instead of top level classes where appropriate.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.7.1 (as compared to version 0.7)
-------------------------------------------------------------------

Fixed a bug in the handling of empty PARSER_BEGIN...PARSER_END
regions.

-------------------------------------------------------------------

Fixed a bug in Java1.1noLA.jj - the improved performance Java grammar.

-------------------------------------------------------------------

Fixed a spurious definition that was being generated into the parser
when USER_TOKEN_MANAGER was set to true.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.7 (as compared to version 0.7pre7)
-------------------------------------------------------------------

Fixed the error reporting routines to delete duplicate entries from
the "expected" list.

-------------------------------------------------------------------

Generated braces around the "if (true) ..." construct inserted
by JavaCC to prevent the dangling else problem.

-------------------------------------------------------------------

Added code to consume_token that performs garbage collections of
tokens no longer necessary for error reporting purposes.

-------------------------------------------------------------------

Fixed a bug with OPTIMIZE_TOKEN_MANAGER when there is a common prefix
for two or more (complex) regular expressions.

-------------------------------------------------------------------

Fixed a JJTree bug where a node annotation #P() caused a null pointer
error.

-------------------------------------------------------------------

Only generate the jjtCreate() methods if the NODE_FACTORY option is
set.

-------------------------------------------------------------------

Fixed a bug where the name of the JJTree state file was being used in
the declaration of the field.

-------------------------------------------------------------------

Updated the performance page to demonstrate how JavaCC performance
has improved since Version 0.5.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.7pre7 (as compared to version 0.7pre6)
-------------------------------------------------------------------

Added an option CACHE_TOKENS with a default value of false.  You
can generate slightly faster and (it so happens) more compact
parsers if you set CACHE_TOKENS to true.

-------------------------------------------------------------------

Improved time and space requirements as compared to earlier
versions - regardless of the setting of CACHE_TOKENS.

Performance has improved roughly 10% (maybe even a little more).
Space requirements have reduced approximately 30%.

It is now possible to generate a Java parser whose class file is
only 28K in size.  To do this, run JavaCC on Java1.1noLA.jj with
options ERROR_REPORTING=false and CACHE_TOKENS=true.

And over the next few months, there is still places where space
and time can be trimmed!

-------------------------------------------------------------------

The token_mask arrays are completely gone and replaced by bit
vectors.

-------------------------------------------------------------------

Nested switch statements have been flattened.

-------------------------------------------------------------------

Fixed a bug in the outputting of code to generate a method

    jjCheckNAddStates(int i)

calls to which are generated, but not the method.

-------------------------------------------------------------------

Generating the `static' keyword for the backup method of the
UCode*.java files when STATIC flag is set.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.7pre6 (as compared to version 0.7pre5)
-------------------------------------------------------------------

Extended the generated CharStream classes with a method to adjust the
line and column numbers for the beginning of a token.  Look at the C++
grammar in the distribution to see an example usage.

-------------------------------------------------------------------

Fixed the JavaCC front-end so that error messages are given with line
numbers relative to the original .jjt file if the .jj file is generated
by pre-processing using jjtree.

-------------------------------------------------------------------

Removed support for old deprecated features:

. IGNORE_IN_BNF can no longer be used.  Until this version, you
  would get a deprecated warning message if you did use it.

. The extra {} in TOKEN specifications can no longer be used.  Until
  this version, you would get a deprecated warning message if your
  did use it.

-------------------------------------------------------------------

ParseError is no longer supported.  It is now ParseException.  Please
delete the existing generated files for ParseError and ParseException.
The right ParseException will automatically get regenerated.

-------------------------------------------------------------------

Completed step 1 in getting rid of the token mask arrays.  This
occupies space and is also somewhat inefficient.  Essentially,
replaced all "if" statements that test a token mask entry with
faster "switch" statements.  The token mask array still exist for
error reporting - but they will be removed in the next step (in
the next release).  As a result, we have noticed improved parser
speeds (up to 10% for the Java grammar).

As a consequence of doing step 1, but not step 2, the size of the
generated parser has increased a small amount.  When step 2 is
completed, the size of the generated parser will go down to be even
smaller than what it was before.

-------------------------------------------------------------------

Cache tokens one step ahead during parsing for performance reasons.

-------------------------------------------------------------------

Made the static token mask fields "final".  Note that the token
mask arrays will go away in the next release.

-------------------------------------------------------------------

The Java 1.1 grammar was corrected to allow interfaces nested within
blocks.  The JavaCC grammar was corrected to fix a bug in its
handling of the ">>>=" operator.

-------------------------------------------------------------------

Fixed a bug in the optimizations of the lexical analyzer.

-------------------------------------------------------------------

Many changes have been made to JJTree.  See the JJTree release
notes for more information.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.7pre5 (as compared to version 0.7pre4)
-------------------------------------------------------------------

Fixed a bug with TOKEN_MGR_DECLS introduced in 0.7pre4.

-------------------------------------------------------------------

Enhanced JavaCC input grammar to allow JavaCC reserved words in
Java code (such as actions).  This too was disallowed in 0.7pre4
only and has been rectified.

-------------------------------------------------------------------

The JavaCC+JJTree grammar is now being offered to our users.  You
can find it in the examples directory.

-------------------------------------------------------------------

Fixed an array index out of bounds bug in the parser - that sometimes
can happen when a non-terminal can expand to more than 100 other
non-terminals.

-------------------------------------------------------------------

Fixed a bug in generating parsers with USER_CHAR_STREAM set to true.

-------------------------------------------------------------------

Created an alternate Java 1.1 grammar in which lookaheads have been
modified to minimize the space requirements of the generated
parser.  See the JavaGrammars directory under the examples directory.

-------------------------------------------------------------------

Provided instructions on how you can make your own grammars space
efficient (until JavaCC is improved to do this).  See the
JavaGrammars directory under the examples directory.

-------------------------------------------------------------------

Updated all examples to make them current.  Some examples had become
out of date due to newer versions of JavaCC.

-------------------------------------------------------------------

Updated the VHDL example - Chris Grimm made a fresh contribution.
This seems to be a real product quality example now.

-------------------------------------------------------------------

Fixed bugs in the Obfuscator example that has started being used
for real obfuscation by some users.

-------------------------------------------------------------------

The token manager class is non-final (this was a bug).

-------------------------------------------------------------------

Many changes have been made to JJTree.  See the JJTree release
notes for more information.

-------------------------------------------------------------------

Fixed all token manager optimization bugs that we know about.

-------------------------------------------------------------------

Fixed all UNICODE lexing bugs that we know about.

-------------------------------------------------------------------

Fixed an array index out of bounds bug in the token manager.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.7pre4 (as compared to version 0.7pre3)
-------------------------------------------------------------------

The only significant change for this version is that we incorporated
the Java grammar into the JavaCC grammar.  The JavaCC front end is
therefore able to parse the entire grammar file intelligently rather
than simple ignore the actions.

-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.7pre3 (as compared to version 0.7pre2)
-------------------------------------------------------------------

WE HAVE NOT ADDED ANY MAJOR FEATURES TO JAVACC FOR THIS PRERELEASE.
WE'VE FOCUSED MAINLY ON BUG FIXES.  BUT HERE IS WHAT HAS CHANGED:

-------------------------------------------------------------------

Fixed the JavaCC license agreement to allow redistributions of example
grammars.

-------------------------------------------------------------------

Fixed a couple of bugs in the JavaCC grammar.

-------------------------------------------------------------------

Fixed an obscure bug that caused spurious '\r's to be generated
on Windows machines.

-------------------------------------------------------------------

Changed the generated *CharStream classes to take advantage of the
STATIC flag setting.  With this (like the token manager and parser)
the *CharStream class also will have all the methods and variables to
be static with STATIC flag.

-------------------------------------------------------------------

A new option OPTIMIZE_TOKEN_MANAGER is introduced. It defaults to
true.  When this option is set, optimizations for the TokenManager, in
terms of size *and* time are performed.

This option is automatically set to false if DEBUG_TOKEN_MANAGER is
set to true.

The new option OPTIMIZE_TOKEN_MANAGER might do some unsafe
optimization that can cause your token manager not to compile or run
properly. While we don't expect this to happen that much, in case it
happens, just turn off the option so that those optimizations will not
happen and you can continue working. Also, if this happens, please
send us the grammar so we can analyze the problem and fix JavaCC.

-------------------------------------------------------------------

A String-valued option OUTPUT_DIRECTORY is implemented. This can be
used to instruct JavaCC to generate all the code files in a particular
directory.  By default, this is set to user.dir.

-------------------------------------------------------------------

Fixed a minor bug (in 0.7pre2) in that the specialToken field was not
being set before a lexical action for a TOKEN type reg. exp.

-------------------------------------------------------------------

Added a toString method to the Token class to return the image.


-------------------------------------------------------------------
*******************************************************************
-------------------------------------------------------------------

MODIFICATIONS IN VERSION 0.7pre2 (as compared to version 0.7pre1)

-------------------------------------------------------------------

AS USUAL, KEEP IN MIND THAT THIS IS A PRERELEASE THAT WE HAVE NOT
TESTED EXTENSIVELY.  THERE ARE A FEW KNOWN BUGS THAT ARE STILL PRESENT
IN THIS VERSION.  QUALITY CONTROL FOR PRERELEASES ARE SIGNIFICANTLY
LOWER THAN STABLE RELEASES - I.E., WE DON'T MIND THE PRESENCE OF BUGS
THAT WE WOULD FEEL EMBARRASSED ABOUT IN STABLE RELEASES.

-------------------------------------------------------------------

Main feature release for 0.7pre2 is a completely redone JJTree.  It
now bootstraps itself.  See the JJTree release notes for more
information.

-------------------------------------------------------------------

Error recovery constructs have been modified a bit from 0.7pre1.  The
parser methods now throw only ParseException by default.  You can now
specify a "throws" clause with your non-terminals to add other
exceptions to this list explicitly.  Please see the help web page at:

   http://www.suntest.com/JavaCCBeta/newerrorhandling.html

for complete information on error recovery.

-------------------------------------------------------------------

A new Java grammar improved for performance in the presence of very
complex expressions is now included.  This is NewJava1.1.jj.

-------------------------------------------------------------------

More optimizations for the size of the token manager's java and class
files.  The generated .java files are about 10-15% smaller that
0.7pre1 (and 40-45%) smaller compared to 0.6. The class files (with
-O) are about 20% smaller compared to 0.6.

-------------------------------------------------------------------

The parser size has been decreased.  The current optimizations affect
grammars that have small amounts of non-1 lookaheads.  For example the
generated code for the Java grammar has now reduced by 10%.

-------------------------------------------------------------------

Extended the Token class to introduce a new factory function that
takes the token kind and returns a new Token object. This is done to
facilitate creating Objects of subclasses of Token based on the kind.
Look at the generated file Token.java for more details.

-------------------------------------------------------------------

The restriction on the input size (to be < 2 gbytes) for the token
manager is gone.  Now the lexer can tokenize any size input (no
limit).

-------------------------------------------------------------------

Removed all the references to System.out.println in the *CharStream
classes.  Now all these are thrown as Error objects.

-------------------------------------------------------------------

Fixed a very old problem with giving input from System.in. Previously
for the EOF, you needed to give  or
javacc-5.0.orig/www/doc/errorrecovery.html0000644000175000017500000002452710604225143017726 0ustar mkochmkoch JavaCC: Error Reporting and Recovery

JavaCC [tm]: Error Reporting and Recovery

This document describes the error recovery features introduced in Version 0.7.1. This document also describes how features have changed since Version 0.6.

The first change (from 0.6) is that we have two new exceptions:

    . ParseException
    . TokenMgrError

Whenever the token manager detects a problem, it throws the exception TokenMgrError. Previously, it used to print the message:

  Lexical Error ...

following which it use to throw the exception ParseError.

Whenever the parser detects a problem, it throws the exception ParseException. Previously, it used to print the message:

  Encountered ... Was expecting one of ...

following which it use to throw the exception ParseError.

In Version 0.7.1, error messages are never printed explicitly, rather this information is stored inside the exception objects that are thrown. Please see the classes ParseException.java and TokenMgrError.java (that get generated by JavaCC [tm] during parser generation) for more details.

If the thrown exceptions are never caught, then a standard action is taken by the virtual machine which normally includes printing the stack trace and also the result of the "toString" method in the exception. So if you do not catch the JavaCC exceptions, a message quite similar to the ones in Version 0.6.

But if you catch the exception, you must print the message yourself.

Exceptions in the Java [tm] programming language are all subclasses of type Throwable. Furthermore, exceptions are divided into two broad categories - ERRORS and other exceptions.

Errors are exceptions that one is not expected to recover from - examples of these are ThreadDeath or OutOfMemoryError. Errors are indicated by subclassing the exception "Error". Exceptions subclassed from Error need not be specified in the "throws" clause of method declarations.

Exceptions other than errors are typically defined by subclassing the exception "Exception". These exceptions are typically handled by the user program and must be declared in throws clauses of method declarations (if it is possible for the method to throw that exception).

The exception TokenMgrError is a subclass of Error, while the exception ParseException is a subclass of Exception. The reasoning here is that the token manager is never expected to throw an exception - you must be careful in defining your token specifications such that you cover all cases. Hence the suffix "Error" in TokenMgrError. You do not have to worry about this exception - if you have designed your tokens well, it should never get thrown. Whereas it is typical to attempt recovery from Parser errors - hence the name "ParseException". (Although if you still want to recover from token manager errors, you can do it - it's just that you are not forced to catch them.)

In Version 0.7.1, we have added a syntax to specify additional exceptions that may be thrown by methods corresponding to non-terminals. This syntax is identical to the Java "throws ..." syntax. Here's an example of how you use this:


  void VariableDeclaration() throws SymbolTableException, IOException :
  {...}
  {
    ...
  }

Here, VariableDeclaration is defined to throw exceptions SymbolTableException and IOException in addition to ParseException.

Error Reporting

The scheme for error reporting is simpler in Version 0.7.1 (as compared to Version 0.6) - simply modify the file ParseException.java to do what you want it to do. Typically, you would modify the getMessage method to do your own customized error reporting. All information regarding these methods can be obtained from the comments in the generated files ParseException.java and TokenMgrError.java. It will also help to understand the functionality of the class Throwable (read a Java book for this).

There is a method in the generated parser called "generateParseException". You can call this method anytime you wish to generate an object of type ParseException. This object will contain all the choices that the parser has attempted since the last successfully consumed token.

Error Recovery

JavaCC offers two kinds of error recovery - shallow recovery and deep recovery. Shallow recovery recovers if none of the current choices have succeeded in being selected, while deep recovery is when a choice is selected, but then an error happens sometime during the parsing of this choice.

Shallow Error Recovery

We shall explain shallow error recovery using the following example:

void Stm() :
{}
{
  IfStm()
|
  WhileStm()
}

Let's assume that IfStm starts with the reserved word "if" and WhileStm starts with the reserved word "while". Suppose you want to recover by skipping all the way to the next semicolon when neither IfStm nor WhileStm can be matched by the next input token (assuming a lookahead of 1). That is the next token is neither "if" nor "while".

What you do is write the following:

void Stm() :
{}
{
  IfStm()
|
  WhileStm()
|
  error_skipto(SEMICOLON)
}

But you have to define "error_skipto" first. So far as JavaCC is concerned, "error_skipto" is just like any other non-terminal. The following is one way to define "error_skipto" (here we use the standard JAVACODE production):

JAVACODE
void error_skipto(int kind) {
  ParseException e = generateParseException();  // generate the exception object.
  System.out.println(e.toString());  // print the error message
  Token t;
  do {
    t = getNextToken();
  } while (t.kind != kind);
    // The above loop consumes tokens all the way up to a token of
    // "kind".  We use a do-while loop rather than a while because the
    // current token is the one immediately before the erroneous token
    // (in our case the token immediately before what should have been
    // "if"/"while".
}

That's it for shallow error recovery. In a future version of JavaCC we will have support for modular composition of grammars. When this happens, one can place all these error recovery routines into a separate module that can be "imported" into the main grammar module. We intend to supply a library of useful routines (for error recovery and otherwise) when we implement this capability.

Deep Error Recovery

Let's use the same example that we did for shallow recovery:

void Stm() :
{}
{
  IfStm()
|
  WhileStm()
}

In this case we wish to recover in the same way. However, we wish to recover even when there is an error deeper into the parse. For example, suppose the next token was "while" - therefore the choice "WhileStm" was taken. But suppose that during the parse of WhileStm some error is encountered - say one has "while (foo { stm; }" - i.e., the closing parentheses has been missed. Shallow recovery will not work for this situation. You need deep recovery to achieve this. For this, we offer a new syntactic entity in JavaCC - the try-catch-finally block.

First, let us rewrite the above example for deep error recovery and then explain the try-catch-finally block in more detail:

void Stm() :
{}
{
  try {
    (
      IfStm()
    |
      WhileStm()
    )
  catch (ParseException e) {
    error_skipto(SEMICOLON);
  }
}

That's all you need to do. If there is any unrecovered error during the parse of IfStm or WhileStm, then the catch block takes over. You can have any number of catch blocks and also optionally a finally block (just as with Java errors). What goes into the catch blocks is *Java code*, not JavaCC expansions. For example, the above example could have been rewritten as:

void Stm() :
{}
{
  try {
    (
      IfStm()
    |
      WhileStm()
    )
  catch (ParseException e) {
    System.out.println(e.toString());
    Token t;
    do {
      t = getNextToken();
    } while (t.kind != SEMICOLON);
  }
}

Our belief is that it's best to avoid placing too much Java code in the catch and finally blocks since it overwhelms the grammar reader. Its best to define methods that you can then call from the catch blocks.

Note that in the second writing of the example, we essentially copied the code out of the implementation of error_skipto. But we left out the first statement - the call to generateParseException. That's because in this case, the catch block already provides us with the exception. But even if you did call this method, you will get back an identical object.

javacc-5.0.orig/www/doc/jjdocreleasenotes.html0000644000175000017500000001202610604211575020514 0ustar mkochmkoch JavaCC: JJDoc Release Notes

JavaCC [tm]: JJDoc Release Notes

=================================
Changes from JJDoc 0.1.5 to 0.1.6
=================================

----------------------------------------------------------------

Refactored to make Generator a settable interface,
enabling Maven or other generators.
Existing Generator becomes TextGenerator.

----------------------------------------------------------------

=================================
Changes from JJDoc 0.1.4 to 0.1.5
=================================

----------------------------------------------------------------

Fixed bug where Writers were not being closed correctly.
Fixed bug where help message would not appear on command line.
Added the "CSS" option.

----------------------------------------------------------------

=================================
Changes from JJDoc 0.1.3 to 0.1.4
=================================

----------------------------------------------------------------

Now accepts JavaCC try/catch/finally blocks.

----------------------------------------------------------------

=================================
Changes from JJDoc 0.1.2 to 0.1.3
=================================

----------------------------------------------------------------

Made appropriate internal modifications for the JavaCC 0.7 parse error
exceptions.

----------------------------------------------------------------

=================================
Changes from JJDoc 0.1.1 to 0.1.2
=================================

----------------------------------------------------------------

Fixed bug where ()+ expansions were being reported as ()*.

----------------------------------------------------------------

===============================
Changes from JJDoc 0.1 to 0.1.1
===============================

----------------------------------------------------------------

Fixed several stupid bugs in the Macintosh main class.

----------------------------------------------------------------

Fixed bug where production comments were being generated multiple
times in text modes and one table HTML mode.

----------------------------------------------------------------

Moved production comments to the correct place: they were coming out
with the preceding production in one table HTML mode.

----------------------------------------------------------------

=========
JJDoc 0.1
=========

JJDoc takes a JavaCC parser specification and produces documentation
for the BNF grammar.  It can operate in three modes, determined by
command line options.

    TEXT                   (default false)

Setting TEXT to true causes JJDoc to generate a plain text format
description of the BNF.  Some formatting is done via tab characters,
but the intention is to leave it as plain as possible.

The default value of TEXT causes JJDoc to generate a hyperlinked HTML
document.

    ONE_TABLE              (default true)

The default value of ONE_TABLE is used to generate a single HTML table
for the BNF.  Setting it to false will produce one table for every
production in the grammar.

    OUTPUT_FILE

The default behavior is to put the JJDoc output into a file with
either .html or .txt added as a suffix to the input file's base name.
You can supply a different file name with this option.
javacc-5.0.orig/www/doc/commandline.html0000644000175000017500000001107511165261221017276 0ustar mkochmkoch JavaCC Command Line Syntax

JavaCC [tm]: Command Line Syntax

First, you can obtain a synopsis of the command line syntax by simply typing "javacc". This is what you get:

% javacc
<<<< Version and copyright info>>>

Usage:
    javacc option-settings inputfile

"option-settings" is a sequence of settings separated by spaces.
Each option setting must be of one of the following forms:

    -optionname=value (e.g., -STATIC=false)
    -optionname:value (e.g., -STATIC:false)
    -optionname       (equivalent to -optionname=true.  e.g., -STATIC)
    -NOoptionname     (equivalent to -optionname=false. e.g., -NOSTATIC)

Option settings are not case-sensitive, so one can say "-nOsTaTiC" instead
of "-NOSTATIC".  Option values must be appropriate for the corresponding
option, and must be either an integer, a boolean, or a string value.

The integer valued options are:

    LOOKAHEAD              (default 1)
    CHOICE_AMBIGUITY_CHECK (default 2)
    OTHER_AMBIGUITY_CHECK  (default 1)

The boolean valued options are:

    STATIC                 (default true)
    SUPPORT_CLASS_VISIBILITY_PUBLIC (default true)
    DEBUG_PARSER           (default false)
    DEBUG_LOOKAHEAD        (default false)
    DEBUG_TOKEN_MANAGER    (default false)
    ERROR_REPORTING        (default true)
    JAVA_UNICODE_ESCAPE    (default false)
    UNICODE_INPUT          (default false)
    IGNORE_CASE            (default false)
    COMMON_TOKEN_ACTION    (default false)
    USER_TOKEN_MANAGER     (default false)
    USER_CHAR_STREAM       (default false)
    BUILD_PARSER           (default true)
    BUILD_TOKEN_MANAGER    (default true)
    TOKEN_MANAGER_USES_PARSER (default false)
    SANITY_CHECK           (default true)
    FORCE_LA_CHECK         (default false)
    CACHE_TOKENS           (default false)
    KEEP_LINE_COLUMN       (default true)

The string valued options are:

    OUTPUT_DIRECTORY       (default Current Directory)
    TOKEN_EXTENDS          (java.lang.Object)
    TOKEN_FACTORY          (java.lang.Object)
    JDK_VERSION            (1.5)
    GRAMMAR_ENCODING       (default file.encoding)

EXAMPLE:
    javacc -STATIC=false -LOOKAHEAD:2 -debug_parser mygrammar.jj

ABOUT JavaCC:

    JavaCC is a parser generator for the Java [tm] programming
    language originally built by
    Sriram Sankar (http://www.cs.stanford.edu/~sankar) and
    Sreeni Viswanadha (http://www.cs.albany.edu/~sreeni).

%

Any option may be set either on the command line as shown in the help message above, or in the grammar file as described in JavaCC grammar syntax. The effect is exactly the same.

If the same option is set in both the command line and the grammar file, then the option setting in the command line takes precedence.

javacc-5.0.orig/www/doc/mailinglist.html0000644000175000017500000000476510604211576017341 0ustar mkochmkoch JavaCC Mailing Lists

JavaCC [tm]: Mailing Lists

You may communicate with the JavaCC [tm] developers and other JavaCC users by sending email to one of the JavaCC mailing lists:

Note that you may want to search the mailing list archives first to see if your question has already been answered.

javacc-5.0.orig/www/doc/installhelp.html0000644000175000017500000000625711231335533017337 0ustar mkochmkoch JavaCC Installation

JavaCC [tm]: Installation Notes

The download should have placed into your file system either a ZIP or GZIP file containing the JavaCC software.

Depending on which you downloaded, you should go to the directory where the file was installed and type something like:

unzip javacc-5.0.zip

or

gunzip javacc-5.0.tar.gz
tar xvf javacc-5.0.tar

That completes your installation.

Once you have completed installation, add the bin directory within the JavaCC installation to your path. The javacc, jjtree, and jjdoc invocation scripts/executables reside in this directory.

You can get started quickly by looking at the examples and the associated README files in the examples directory under the installation directory. For additional information consult the documentation index and the following release notes:

Additional help is available on the JavaCC mailing list.

javacc-5.0.orig/www/doc/lookahead.html0000644000175000017500000006761410604221276016754 0ustar mkochmkoch JavaCC: LOOKAHEAD MiniTutorial

JavaCC [tm]: LOOKAHEAD MiniTutorial

This tutorial refers to examples that are available in the Lookahead directory under the examples directory of the release. Currently, this page is a copy of the contents of the README file within that directory.

Lookahead tutorial

We assume that you have already taken a look at some of the simple examples provided in the release before you read this section.

WHAT IS LOOKAHEAD?

The job of a parser is to read an input stream and determine whether or not the input stream conforms to the grammar.

This determination in its most general form can be quite time consuming. Consider the following example (file Example1.jj):



	void Input() :
	{}
	{
	  "a" BC() "c"
	}

	void BC() :
	{}
	{
	  "b" [ "c" ]
	}

In this simple example, it is quite clear that there are exactly two strings that match the above grammar, namely:


	abc
	abcc

The general way to perform this match is to walk through the grammar based on the string as follows. Here, we use "abc" as the input string:

  • Step 1. There is only one choice here - the first input character must be 'a' - and since that is indeed the case, we are OK.
  • Step 2. We now proceed on to non-terminal BC. Here again, there is only one choice for the next input character - it must be 'b'. The input matches this one too, so we are still OK.
  • Step 3. We now come to a "choice point" in the grammar. We can either go inside the [...] and match it, or ignore it altogether. We decide to go inside. So the next input character must be a 'c'. We are again OK.
  • Step 4. Now we have completed with non-terminal BC and go back to non-terminal Input. Now the grammar says the next character must be yet another 'c'. But there are no more input characters. So we have a problem.
  • Step 5. When we have such a problem in the general case, we conclude that we may have made a bad choice somewhere. In this case, we made the bad choice in Step 3. So we retrace our steps back to step 3 and make another choice and try that. This process is called "backtracking".
  • Step 6. We have now backtracked and made the other choice we could have made at Step 3 - namely, ignore the [...]. Now we have completed with non-terminal BC and go back to non-terminal Input. Now the grammar says the next character must be yet another 'c'. The next input character is a 'c', so we are OK now.
  • Step 7. We realize we have reached the end of the grammar (end of non-terminal Input) successfully. This means we have successfully matched the string "abc" to the grammar.

As the above example indicates, the general problem of matching an input with a grammar may result in large amounts of backtracking and making new choices and this can consume a lot of time. The amount of time taken can also be a function of how the grammar is written. Note that many grammars can be written to cover the same set of inputs - or the same language (i.e., there can be multiple equivalent grammars for the same input language).


For example, the following grammar would speed up the parsing of the same language as compared to the previous grammar:


	void Input() :
	{}
	{
	  "a" "b" "c" [ "c" ]
	}

while the following grammar slows it down even more since the parser has to backtrack all the way to the beginning:


	void Input() :
	{}
	{
	  "a" "b" "c" "c"
	|
	  "a" "b" "c"
	}

One can even have a grammar that looks like the following:



	void Input() :
	{}
	{
	  "a" ( BC1() | BC2() )
	}

	void BC1() :
	{}
	{
	  "b" "c" "c"
	}

	void BC2() :
	{}
	{
	  "b" "c" [ "c" ]
	}

This grammar can match "abcc" in two ways, and is therefore considered "ambiguous".


The performance hit from such backtracking is unacceptable for most systems that include a parser. Hence most parsers do not backtrack in this general manner (or do not backtrack at all), rather they make decisions at choice points based on limited information and then commit to it.

Parsers generated by Java Compiler Compiler make decisions at choice points based on some exploration of tokens further ahead in the input stream, and once they make such a decision, they commit to it. i.e., No backtracking is performed once a decision is made.

The process of exploring tokens further in the input stream is termed "looking ahead" into the input stream - hence our use of the term "LOOKAHEAD".

Since some of these decisions may be made with less than perfect information (JavaCC [tm] will warn you in these situations, so you don't have to worry), you need to know something about LOOKAHEAD to make your grammar work correctly.

The two ways in which you make the choice decisions work properly are:

  • Modify the grammar to make it simpler.
  • Insert hints at the more complicated choice points to help the parser make the right choices.

CHOICE POINTS IN JAVACC GRAMMARS

There are 4 different kinds of choice points in JavaCC:

  1. An expansion of the form: ( exp1 | exp2 | ... ). In this case, the generated parser has to somehow determine which of exp1, exp2, etc. to select to continue parsing.
  2. An expansion of the form: ( exp )?. In this case, the generated parser must somehow determine whether to choose exp or to continue beyond the ( exp )? without choosing exp. Note: ( exp )? may also be written as [ exp ].
  3. An expansion of the form ( exp )*. In this case, the generated parser must do the same thing as in the previous case, and furthermore, after each time a successful match of exp (if exp was chosen) is completed, this choice determination must be made again.
  4. An expansion of the form ( exp )+. This is essentially similar to the previous case with a mandatory first match to exp.

Remember that token specifications that occur within angular brackets <...> also have choice points. But these choices are made in different ways and are the subject of a different tutorial.

THE DEFAULT CHOICE DETERMINATION ALGORITHM

The default choice determination algorithm looks ahead 1 token in the input stream and uses this to help make its choice at choice points.

The following examples will describe the default algorithm fully:

Consider the following grammar (file Example2.jj):


	void basic_expr() :
	{}
	{
	  <ID> "(" expr() ")"	// Choice 1
	|
	  "(" expr() ")"	// Choice 2
	|
	  "new" <ID>		// Choice 3
	}

The choice determination algorithm works as follows:



	if (next token is <ID>) {
	  choose Choice 1
	} else if (next token is "(") {
	  choose Choice 2
	} else if (next token is "new") {
	  choose Choice 3
	} else {
	  produce an error message
	}

In the above example, the grammar has been written such that the default choice determination algorithm does the right thing. Another thing to note is that the choice determination algorithm works in a top to bottom order - if Choice 1 was selected, the other choices are not even considered. While this is not an issue in this example (except for performance), it will become important later below when local ambiguities require the insertion of LOOKAHEAD hints.

Suppose the above grammar was modified to (file Example3.jj):


	void basic_expr() :
	{}
	{
	  <ID> "(" expr() ")"	// Choice 1
	|
	  "(" expr() ")"	// Choice 2
	|
	  "new" <ID>		// Choice 3
	|
	  <ID> "." <ID>		// Choice 4
	}

Then the default algorithm will always choose Choice 1 when the next input token is <ID> and never choose Choice 4 even if the token following <ID> is a ".". More on this later.

You can try running the parser generated from Example3.jj on the input "id1.id2". It will complain that it encountered a "." when it was expecting a "(". Note - when you built the parser, it would have given you the following warning message:


Warning: Choice conflict involving two expansions at
         line 25, column 3 and line 31, column 3 respectively.
         A common prefix is: <ID>
         Consider using a lookahead of 2 for earlier expansion.

Essentially, JavaCC is saying it has detected a situation in your grammar which may cause the default lookahead algorithm to do strange things. The generated parser will still work using the default lookahead algorithm - except that it may not do what you expect of it.


Now consider the following example (file Example 4.jj):



	void identifier_list() :
	{}
	{
	  <ID> ( "," <ID> )*
	}

Suppose the first <ID> has already been matched and that the parser has reached the choice point (the (...)* construct). Here's how the choice determination algorithm works:



	while (next token is ",") {
	  choose the nested expansion (i.e., go into the (...)* construct)
	  consume the "," token
	  if (next token is <ID>) consume it, otherwise report error
	}


In the above example, note that the choice determination algorithm does not look beyond the (...)* construct to make its decision. Suppose there was another production in that same grammar as follows (file Example5.jj):


	void funny_list() :
	{}
	{
	  identifier_list() "," <INT>
	}

When the default algorithm is making a choice at ( "," <ID> )*, it will always go into the (...)* construct if the next token is a ",". It will do this even when identifier_list was called from funny_list and the token after the "," is an <INT>. Intuitively, the right thing to do in this situation is to skip the (...)* construct and return to funny_list. More on this later.

As a concrete example, suppose your input was "id1, id2, 5", the parser will complain that it encountered a 5 when it was expecting an <ID>. Note - when you built the parser, it would have given you the following warning message:



Warning: Choice conflict in (...)* construct at line 25, column 8.
         Expansion nested within construct and expansion following construct
         have common prefixes, one of which is: ","
         Consider using a lookahead of 2 or more for nested expansion.

Essentially, JavaCC is saying it has detected a situation in your grammar which may cause the default lookahead algorithm to do strange things. The generated parser will still work using the default lookahead algorithm - except that it may not do what you expect of it.


We have shown you examples of two kinds of choice points in the examples above - "exp1 | exp2 | ...", and "(exp)*". The other two kinds of choice points - "(exp)+" and "(exp)?" - behave similarly to (exp)* and we will not be providing examples of their use here.

MULTIPLE TOKEN LOOKAHEAD SPECIFICATIONS

So far, we have described the default lookahead algorithm of the generated parsers. In the majority of situations, the default algorithm works just fine. In situations where it does not work well, Java Compiler Compiler provides you with warning messages like the ones shown above. If you have a grammar that goes through Java Compiler Compiler without producing any warnings, then the grammar is a LL(1) grammar. Essentially, LL(1) grammars are those that can be handled by top-down parsers (such as those generated by Java Compiler Compiler) using at most one token of LOOKAHEAD.

When you get these warning messages, you can do one of two things.

Option 1

You can modify your grammar so that the warning messages go away. That is, you can attempt to make your grammar LL(1) by making some changes to it.

The following (file Example6.jj) shows how you may change Example3.jj to make it LL(1):


	void basic_expr() :
	{}
	{
	  <ID> ( "(" expr() ")" | "." <ID> )
	|
	  "(" expr() ")"
	|
	  "new" <ID>
	}

What we have done here is to factor the fourth choice into the first choice. Note how we have placed their common first token <ID> outside the parentheses, and then within the parentheses, we have yet another choice which can now be performed by looking at only one token in the input stream and comparing it with "(" and ".". This process of modifying grammars to make them LL(1) is called "left factoring".

The following (file Example7.jj) shows how Example5.jj may be changed to make it LL(1):


	void funny_list() :
	{}
	{
	  <ID> "," ( <ID> "," )* <INT>
	}

Note that this change is somewhat more drastic.


Option 2

You can provide the generated parser with some hints to help it out in the non-LL(1) situations that the warning messages bring to your attention.

All such hints are specified using either setting the global LOOKAHEAD value to a larger value (see below) or by using the LOOKAHEAD(...) construct to provide a local hint.

A design decision must be made to determine if Option 1 or Option 2 is the right one to take. The only advantage of choosing Option 1 is that it makes your grammar perform better. JavaCC generated parsers can handle LL(1) constructs much faster than other constructs. However, the advantage of choosing Option 2 is that you have a simpler grammar - one that is easier to develop and maintain - one that focuses on human-friendliness and not machine-friendliness.

Sometimes Option 2 is the only choice - especially in the presence of user actions. Suppose Example3.jj contained actions as shown below:



	void basic_expr() :
	{}
	{
	  { initMethodTables(); } <ID> "(" expr() ")"
	|
	  "(" expr() ")"
	|
	  "new" <ID>
	|
	  { initObjectTables(); } <ID> "." <ID>
	}

Since the actions are different, left-factoring cannot be performed.

SETTING A GLOBAL LOOKAHEAD SPECIFICATION

You can set a global LOOKAHEAD specification by using the option "LOOKAHEAD" either from the command line, or at the beginning of the grammar file in the options section. The value of this option is an integer which is the number of tokens to look ahead when making choice decisions. As you may have guessed, the default value of this option is 1 - which derives the default LOOKAHEAD algorithm described above.

Suppose you set the value of this option to 2. Then the LOOKAHEAD algorithm derived from this looks at two tokens (instead of just one token) before making a choice decision. Hence, in Example3.jj, choice 1 will be taken only if the next two tokens are <ID> and "(", while choice 4 will be taken only if the next two tokens are <ID> and ".". Hence, the parser will now work properly for Example3.jj. Similarly, the problem with Example5.jj also goes away since the parser goes into the (...)* construct only when the next two tokens are "," and <ID>.

By setting the global LOOKAHEAD to 2, the parsing algorithm essentially becomes LL(2). Since you can set the global LOOKAHEAD to any value, parsers generated by Java Compiler Compiler are called LL(k) parsers.

SETTING A LOCAL LOOKAHEAD SPECIFICATION

You can also set a local LOOKAHEAD specification that affects only a specific choice point. This way, the majority of the grammar can remain LL(1) and hence perform better, while at the same time one gets the flexibility of LL(k) grammars. Here's how Example3.jj is modified with local LOOKAHEAD to fix the choice ambiguity problem (file Example8.jj):



	void basic_expr() :
	{}
	{
	  LOOKAHEAD(2)
	  <ID> "(" expr() ")"	// Choice 1
	|
	  "(" expr() ")"	// Choice 2
	|
	  "new" <ID>		// Choice 3
	|
	  <ID> "." <ID>		// Choice 4
	}

Only the first choice (the first condition in the translation below) is affected by the LOOKAHEAD specification. All others continue to use a single token of LOOKAHEAD:



	if (next 2 tokens are <ID> and "(" ) {
	  choose Choice 1
	} else if (next token is "(") {
	  choose Choice 2
	} else if (next token is "new") {
	  choose Choice 3
	} else if (next token is <ID>) {
	  choose Choice 4
	} else {
	  produce an error message
	}

Similarily, Example5.jj can be modified as shown below (file Example9.jj):



	void identifier_list() :
	{}
	{
	  <ID> ( LOOKAHEAD(2) "," <ID> )*
	}

Note, the LOOKAHEAD specification has to occur inside the (...)* which is the choice is being made. The translation for this construct is shown below (after the first <ID> has been consumed):



	while (next 2 tokens are "," and <ID>) {
	  choose the nested expansion (i.e., go into the (...)* construct)
	  consume the "," token
	  consume the <ID> token
	}

We strongly discourage you from modifying the global LOOKAHEAD default. Most grammars are predominantly LL(1), hence you will be unnecessarily degrading performance by converting the entire grammar to LL(k) to facilitate just some portions of the grammar that are not LL(1). If your grammar and input files being parsed are very small, then this is okay.

You should also keep in mind that the warning messages JavaCC prints when it detects ambiguities at choice points (such as the two messages shown earlier) simply tells you that the specified choice points are not LL(1). JavaCC does not verify the correctness of your local LOOKAHEAD specification - it assumes you know what you are doing, in fact, it really cannot verify the correctness of local LOOKAHEAD's as the following example of if statements illustrates (file Example10.jj):



	void IfStm() :
	{}
	{
	 "if" C() S() [ "else" S() ]
	}

	void S() :
	{}
	{
	  ...
	|
	  IfStm()
	}

This example is the famous "dangling else" problem. If you have a program that looks like:



	"if C1 if C2 S1 else S2"

The "else S2" can be bound to either of the two if statements. The standard interpretation is that it is bound to the inner if statement (the one closest to it). The default choice determination algorithm happens to do the right thing, but it still prints the following warning message:



Warning: Choice conflict in [...] construct at line 25, column 15.
         Expansion nested within construct and expansion following construct
         have common prefixes, one of which is: "else"
         Consider using a lookahead of 2 or more for nested expansion.

To suppress the warning message, you could simply tell JavaCC that you know what you are doing as follows:


	void IfStm() :
	{}
	{
	 "if" C() S() [ LOOKAHEAD(1) "else" S() ]
	}

To force lookahead ambiguity checking in such instances, set the option FORCE_LA_CHECK to true.

SYNTACTIC LOOKAHEAD

Consider the following production taken from the Java grammar:



	void TypeDeclaration() :
	{}
	{
	  ClassDeclaration()
	|
	  InterfaceDeclaration()
	}

At the syntactic level, ClassDeclaration can start with any number of "abstract"s, "final"s, and "public"s. While a subsequent semantic check will produce error messages for multiple uses of the same modifier, this does not happen until parsing is completely over. Similarly, InterfaceDeclaration can start with any number of "abstract"s and "public"s.

What if the next tokens in the input stream are a very large number of "abstract"s (say 100 of them) followed by "interface"? It is clear that a fixed amount of LOOKAHEAD (such as LOOKAHEAD(100) for example) will not suffice. One can argue that this is such a weird situation that it does not warrant any reasonable error message and that it is okay to make the wrong choice in some pathological situations. But suppose one wanted to be precise about this.

The solution here is to set the LOOKAHEAD to infinity - that is set no bounds on the number of tokens to look ahead. One way to do this is to use a very large integer value (such as the largest possible integer) as follows:


	void TypeDeclaration() :
	{}
	{
	  LOOKAHEAD(2147483647)
	  ClassDeclaration()
	|
	  InterfaceDeclaration()
	}

One can also achieve the same effect with "syntactic LOOKAHEAD". In syntactic LOOKAHEAD, you specify an expansion to try out and it that succeeds, then the following choice is taken. The above example is rewritten using syntactic LOOKAHEAD below:



	void TypeDeclaration() :
	{}
	{
	  LOOKAHEAD(ClassDeclaration())
	  ClassDeclaration()
	|
	  InterfaceDeclaration()
	}

Essentially, what this is saying is:



	if (the tokens from the input stream match ClassDeclaration) {
	  choose ClassDeclaration()
	} else if (next token matches InterfaceDeclaration) {
	  choose InterfaceDeclaration()
	} else {
	  produce an error message
	}

The problem with the above syntactic LOOKAHEAD specification is that the LOOKAHEAD calculation takes too much time and does a lot of unnecessary checking. In this case, the LOOKAHEAD calculation can stop as soon as the token "class" is encountered, but the specification forces the calculation to continue until the end of the class declaration has been reached - which is rather time consuming. This problem can be solved by placing a shorter expansion to try out in the syntactic LOOKAHEAD specification as in the following example:



	void TypeDeclaration() :
	{}
	{
	  LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" )
	  ClassDeclaration()
	|
	  InterfaceDeclaration()
	}

Essentially, what this is saying is:


	if (the nest set of tokens from the input stream are a sequence of
	    "abstract"s, "final"s, and "public"s followed by a "class") {
	  choose ClassDeclaration()
	} else if (next token matches InterfaceDeclaration) {
	  choose InterfaceDeclaration()
	} else {
	  produce an error message
	}

By doing this, you make the choice determination algorithm stop as soon as it sees "class" - i.e., make its decision at the earliest possible time.

You can place a bound on the number of tokens to consume during syntactic lookahead as follows:


	void TypeDeclaration() :
	{}
	{
	  LOOKAHEAD(10, ( "abstract" | "final" | "public" )* "class" )
	  ClassDeclaration()
	|
	  InterfaceDeclaration()
	}

In this case, the LOOKAHEAD determination is not permitted to go beyond 10 tokens. If it reaches this limit and is still successfully matching ( "abstract" | "final" | "public" )* "class", then ClassDeclaration is selected.

Actually, when such a limit is not specified, it defaults to the largest integer value (2147483647).

SEMANTIC LOOKAHEAD

Let us go back to Example1.jj:



	void Input() :
	{}
	{
	  "a" BC() "c"
	}

	void BC() :
	{}
	{
	  "b" [ "c" ]
	}

Let us suppose that there is a good reason for writing a grammar this way (maybe the way actions are embedded). As noted earlier, this grammar recognizes two string "abc" and "abcc". The problem here is that the default LL(1) algorithm will choose the [ "c" ] every time it sees a "c" and therefore "abc" will never be matched. We need to specify that this choice must be made only when the next token is a "c", and the token following that is not a "c". This is a negative statement - one that cannot be made using syntactic LOOKAHEAD.

We can use semantic LOOKAHEAD for this purpose. With semantic LOOKAHEAD, you can specify any arbitrary boolean expression whose evaluation determines which choice to take at a choice point. The above example can be instrumented with semantic LOOKAHEAD as follows:


	void BC() :
	{}
	{
	  "b"
	  [ LOOKAHEAD( { getToken(1).kind == C && getToken(2).kind != C } )
	    <C:"c">
	  ]
	}

First we give the token "c" a label C so that we can refer to it from the semantic LOOKAHEAD. The boolean expression essentially states the desired property. The choice determination decision is therefore:


	if (next token is "c" and following token is not "c") {
	  choose the nested expansion (i.e., go into the [...] construct)
	} else {
	  go beyond the [...] construct without entering it.
	}

This example can be rewritten to combine both syntactic and semantic LOOKAHEAD as follows (recognize the first "c" using syntactic LOOKAHEAD and the absence of the second using semantic LOOKAHEAD):


	void BC() :
	{}
	{
	  "b"
	  [ LOOKAHEAD( "c", { getToken(2).kind != C } )
	    <C:"c">
	  ]
	}

GENERAL STRUCTURE OF LOOKAHEAD

We've pretty much covered the various aspects of LOOKAHEAD in the previous sections. A couple of advanced topics follow. However, we shall now present a formal language reference for LOOKAHEAD in Java Compiler Compiler:

The general structure of a LOOKAHEAD specification is:



	LOOKAHEAD( amount,
	           expansion,
	           { boolean_expression }
	         )

"amount" specifies the number of tokens to LOOKAHEAD,"expansion" specifies the expansion to use to perform syntactic LOOKAHEAD, and "boolean_expression" is the expression to use for semantic LOOKAHEAD.

At least one of the three entries must be present. If more than one are present, they are separated by commas. The default values for each of these entities is defined below:



"amount":
 - if "expansion is present, this defaults to 2147483647.
 - otherwise ("boolean_expression" must be present then) this
   defaults to 0.

Note: When "amount" is 0, no syntactic LOOKAHEAD is performed.  Also,
"amount" does not affect the semantic LOOKAHEAD.

"expansion":
- defaults to the expansion being considered.

"boolean_expression":

- defaults to true.

NESTED EVALUATION OF SEMANTIC LOOKAHEAD

To be done.

JAVACODE PRODUCTIONS

To be done.

javacc-5.0.orig/www/doc/JavaCC.txt0000644000175000017500000006650510713453627015775 0ustar mkochmkoch DOCUMENT START TOKENS /********************************************** * THE JAVACC TOKEN SPECIFICATION STARTS HERE * **********************************************/ /* JAVACC RESERVED WORDS: These are the only tokens in JavaCC but not in Java */ TOKEN : { <_LOOKAHEAD: "LOOKAHEAD"> | <_IGNORE_CASE: "IGNORE_CASE"> | <_PARSER_BEGIN: "PARSER_BEGIN"> | <_PARSER_END: "PARSER_END"> | <_JAVACODE: "JAVACODE"> | <_TOKEN: "TOKEN"> | <_SPECIAL_TOKEN: "SPECIAL_TOKEN"> | <_MORE: "MORE"> | <_SKIP: "SKIP"> | <_TOKEN_MGR_DECLS: "TOKEN_MGR_DECLS"> | <_EOF: "EOF"> } /* * The remainder of the tokens are exactly (except for the removal of tokens * containing ">>" and "<<") as in the Java grammar and must be diff equivalent * (again with the exceptions above) to it. */ /* WHITE SPACE */ SKIP : { " " | "\t" | "\n" | "\r" | "\f" | "/*@egen*/" : AFTER_EGEN } SKIP : { <~[]> : DEFAULT } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT | "/*@bgen(jjtree" : IN_MULTI_LINE_COMMENT } SPECIAL : { : DEFAULT } SPECIAL : { : DEFAULT } SPECIAL : { : DEFAULT } MORE : { <~[]> } /* JAVA RESERVED WORDS AND LITERALS */ TOKEN : { | | | | | | | | | | | <_DEFAULT: "default"> | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | } /* JAVA LITERALS */ TOKEN : { (["l","L"])? | (["l","L"])? | (["l","L"])?> | <#DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])*> | <#HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+> | <#OCTAL_LITERAL: "0" (["0"-"7"])*> | | > | <#DECIMAL_FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"]> | <#DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+> | <#HEXADECIMAL_FLOATING_POINT_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? (["f","F","d","D"])? | "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ (["f","F","d","D"])?> | <#HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+> | | } /* SEPARATORS */ TOKEN : { | | | | | | | | } /* OPERATORS */ TOKEN : { | | | | | | ="> | | | | | | | | | | | | | | >>"> : { | >"> : { | "> } /* IDENTIFIERS */ TOKEN : { ()*> | <#LETTER: ["$","A"-"Z","_","a"-"z","\u00a2"-"\u00a5","\u00aa","\u00b5","\u00ba","\u00c0"-"\u00d6","\u00d8"-"\u00f6","\u00f8"-"\u021f","\u0222"-"\u0233","\u0250"-"\u02ad","\u02b0"-"\u02b8","\u02bb"-"\u02c1","\u02d0"-"\u02d1","\u02e0"-"\u02e4","\u02ee","\u037a","\u0386","\u0388"-"\u038a","\u038c","\u038e"-"\u03a1","\u03a3"-"\u03ce","\u03d0"-"\u03d7","\u03da"-"\u03f3","\u0400"-"\u0481","\u048c"-"\u04c4","\u04c7"-"\u04c8","\u04cb"-"\u04cc","\u04d0"-"\u04f5","\u04f8"-"\u04f9","\u0531"-"\u0556","\u0559","\u0561"-"\u0587","\u05d0"-"\u05ea","\u05f0"-"\u05f2","\u0621"-"\u063a","\u0640"-"\u064a","\u0671"-"\u06d3","\u06d5","\u06e5"-"\u06e6","\u06fa"-"\u06fc","\u0710","\u0712"-"\u072c","\u0780"-"\u07a5","\u0905"-"\u0939","\u093d","\u0950","\u0958"-"\u0961","\u0985"-"\u098c","\u098f"-"\u0990","\u0993"-"\u09a8","\u09aa"-"\u09b0","\u09b2","\u09b6"-"\u09b9","\u09dc"-"\u09dd","\u09df"-"\u09e1","\u09f0"-"\u09f3","\u0a05"-"\u0a0a","\u0a0f"-"\u0a10","\u0a13"-"\u0a28","\u0a2a"-"\u0a30","\u0a32"-"\u0a33","\u0a35"-"\u0a36","\u0a38"-"\u0a39","\u0a59"-"\u0a5c","\u0a5e","\u0a72"-"\u0a74","\u0a85"-"\u0a8b","\u0a8d","\u0a8f"-"\u0a91","\u0a93"-"\u0aa8","\u0aaa"-"\u0ab0","\u0ab2"-"\u0ab3","\u0ab5"-"\u0ab9","\u0abd","\u0ad0","\u0ae0","\u0b05"-"\u0b0c","\u0b0f"-"\u0b10","\u0b13"-"\u0b28","\u0b2a"-"\u0b30","\u0b32"-"\u0b33","\u0b36"-"\u0b39","\u0b3d","\u0b5c"-"\u0b5d","\u0b5f"-"\u0b61","\u0b85"-"\u0b8a","\u0b8e"-"\u0b90","\u0b92"-"\u0b95","\u0b99"-"\u0b9a","\u0b9c","\u0b9e"-"\u0b9f","\u0ba3"-"\u0ba4","\u0ba8"-"\u0baa","\u0bae"-"\u0bb5","\u0bb7"-"\u0bb9","\u0c05"-"\u0c0c","\u0c0e"-"\u0c10","\u0c12"-"\u0c28","\u0c2a"-"\u0c33","\u0c35"-"\u0c39","\u0c60"-"\u0c61","\u0c85"-"\u0c8c","\u0c8e"-"\u0c90","\u0c92"-"\u0ca8","\u0caa"-"\u0cb3","\u0cb5"-"\u0cb9","\u0cde","\u0ce0"-"\u0ce1","\u0d05"-"\u0d0c","\u0d0e"-"\u0d10","\u0d12"-"\u0d28","\u0d2a"-"\u0d39","\u0d60"-"\u0d61","\u0d85"-"\u0d96","\u0d9a"-"\u0db1","\u0db3"-"\u0dbb","\u0dbd","\u0dc0"-"\u0dc6","\u0e01"-"\u0e30","\u0e32"-"\u0e33","\u0e3f"-"\u0e46","\u0e81"-"\u0e82","\u0e84","\u0e87"-"\u0e88","\u0e8a","\u0e8d","\u0e94"-"\u0e97","\u0e99"-"\u0e9f","\u0ea1"-"\u0ea3","\u0ea5","\u0ea7","\u0eaa"-"\u0eab","\u0ead"-"\u0eb0","\u0eb2"-"\u0eb3","\u0ebd","\u0ec0"-"\u0ec4","\u0ec6","\u0edc"-"\u0edd","\u0f00","\u0f40"-"\u0f47","\u0f49"-"\u0f6a","\u0f88"-"\u0f8b","\u1000"-"\u1021","\u1023"-"\u1027","\u1029"-"\u102a","\u1050"-"\u1055","\u10a0"-"\u10c5","\u10d0"-"\u10f6","\u1100"-"\u1159","\u115f"-"\u11a2","\u11a8"-"\u11f9","\u1200"-"\u1206","\u1208"-"\u1246","\u1248","\u124a"-"\u124d","\u1250"-"\u1256","\u1258","\u125a"-"\u125d","\u1260"-"\u1286","\u1288","\u128a"-"\u128d","\u1290"-"\u12ae","\u12b0","\u12b2"-"\u12b5","\u12b8"-"\u12be","\u12c0","\u12c2"-"\u12c5","\u12c8"-"\u12ce","\u12d0"-"\u12d6","\u12d8"-"\u12ee","\u12f0"-"\u130e","\u1310","\u1312"-"\u1315","\u1318"-"\u131e","\u1320"-"\u1346","\u1348"-"\u135a","\u13a0"-"\u13f4","\u1401"-"\u166c","\u166f"-"\u1676","\u1681"-"\u169a","\u16a0"-"\u16ea","\u1780"-"\u17b3","\u17db","\u1820"-"\u1877","\u1880"-"\u18a8","\u1e00"-"\u1e9b","\u1ea0"-"\u1ef9","\u1f00"-"\u1f15","\u1f18"-"\u1f1d","\u1f20"-"\u1f45","\u1f48"-"\u1f4d","\u1f50"-"\u1f57","\u1f59","\u1f5b","\u1f5d","\u1f5f"-"\u1f7d","\u1f80"-"\u1fb4","\u1fb6"-"\u1fbc","\u1fbe","\u1fc2"-"\u1fc4","\u1fc6"-"\u1fcc","\u1fd0"-"\u1fd3","\u1fd6"-"\u1fdb","\u1fe0"-"\u1fec","\u1ff2"-"\u1ff4","\u1ff6"-"\u1ffc","\u203f"-"\u2040","\u207f","\u20a0"-"\u20af","\u2102","\u2107","\u210a"-"\u2113","\u2115","\u2119"-"\u211d","\u2124","\u2126","\u2128","\u212a"-"\u212d","\u212f"-"\u2131","\u2133"-"\u2139","\u2160"-"\u2183","\u3005"-"\u3007","\u3021"-"\u3029","\u3031"-"\u3035","\u3038"-"\u303a","\u3041"-"\u3094","\u309d"-"\u309e","\u30a1"-"\u30fe","\u3105"-"\u312c","\u3131"-"\u318e","\u31a0"-"\u31b7","\u3400"-"\u4db5","\u4e00"-"\u9fa5","\ua000"-"\ua48c","\uac00"-"\ud7a3","\uf900"-"\ufa2d","\ufb00"-"\ufb06","\ufb13"-"\ufb17","\ufb1d","\ufb1f"-"\ufb28","\ufb2a"-"\ufb36","\ufb38"-"\ufb3c","\ufb3e","\ufb40"-"\ufb41","\ufb43"-"\ufb44","\ufb46"-"\ufbb1","\ufbd3"-"\ufd3d","\ufd50"-"\ufd8f","\ufd92"-"\ufdc7","\ufdf0"-"\ufdfb","\ufe33"-"\ufe34","\ufe4d"-"\ufe4f","\ufe69","\ufe70"-"\ufe72","\ufe74","\ufe76"-"\ufefc","\uff04","\uff21"-"\uff3a","\uff3f","\uff41"-"\uff5a","\uff65"-"\uffbe","\uffc2"-"\uffc7","\uffca"-"\uffcf","\uffd2"-"\uffd7","\uffda"-"\uffdc","\uffe0"-"\uffe1","\uffe5"-"\uffe6"]> | <#PART_LETTER: ["\u0000"-"\b","\u000e"-"\u001b","$","0"-"9","A"-"Z","_","a"-"z","\u007f"-"\u009f","\u00a2"-"\u00a5","\u00aa","\u00b5","\u00ba","\u00c0"-"\u00d6","\u00d8"-"\u00f6","\u00f8"-"\u021f","\u0222"-"\u0233","\u0250"-"\u02ad","\u02b0"-"\u02b8","\u02bb"-"\u02c1","\u02d0"-"\u02d1","\u02e0"-"\u02e4","\u02ee","\u0300"-"\u034e","\u0360"-"\u0362","\u037a","\u0386","\u0388"-"\u038a","\u038c","\u038e"-"\u03a1","\u03a3"-"\u03ce","\u03d0"-"\u03d7","\u03da"-"\u03f3","\u0400"-"\u0481","\u0483"-"\u0486","\u048c"-"\u04c4","\u04c7"-"\u04c8","\u04cb"-"\u04cc","\u04d0"-"\u04f5","\u04f8"-"\u04f9","\u0531"-"\u0556","\u0559","\u0561"-"\u0587","\u0591"-"\u05a1","\u05a3"-"\u05b9","\u05bb"-"\u05bd","\u05bf","\u05c1"-"\u05c2","\u05c4","\u05d0"-"\u05ea","\u05f0"-"\u05f2","\u0621"-"\u063a","\u0640"-"\u0655","\u0660"-"\u0669","\u0670"-"\u06d3","\u06d5"-"\u06dc","\u06df"-"\u06e8","\u06ea"-"\u06ed","\u06f0"-"\u06fc","\u070f"-"\u072c","\u0730"-"\u074a","\u0780"-"\u07b0","\u0901"-"\u0903","\u0905"-"\u0939","\u093c"-"\u094d","\u0950"-"\u0954","\u0958"-"\u0963","\u0966"-"\u096f","\u0981"-"\u0983","\u0985"-"\u098c","\u098f"-"\u0990","\u0993"-"\u09a8","\u09aa"-"\u09b0","\u09b2","\u09b6"-"\u09b9","\u09bc","\u09be"-"\u09c4","\u09c7"-"\u09c8","\u09cb"-"\u09cd","\u09d7","\u09dc"-"\u09dd","\u09df"-"\u09e3","\u09e6"-"\u09f3","\u0a02","\u0a05"-"\u0a0a","\u0a0f"-"\u0a10","\u0a13"-"\u0a28","\u0a2a"-"\u0a30","\u0a32"-"\u0a33","\u0a35"-"\u0a36","\u0a38"-"\u0a39","\u0a3c","\u0a3e"-"\u0a42","\u0a47"-"\u0a48","\u0a4b"-"\u0a4d","\u0a59"-"\u0a5c","\u0a5e","\u0a66"-"\u0a74","\u0a81"-"\u0a83","\u0a85"-"\u0a8b","\u0a8d","\u0a8f"-"\u0a91","\u0a93"-"\u0aa8","\u0aaa"-"\u0ab0","\u0ab2"-"\u0ab3","\u0ab5"-"\u0ab9","\u0abc"-"\u0ac5","\u0ac7"-"\u0ac9","\u0acb"-"\u0acd","\u0ad0","\u0ae0","\u0ae6"-"\u0aef","\u0b01"-"\u0b03","\u0b05"-"\u0b0c","\u0b0f"-"\u0b10","\u0b13"-"\u0b28","\u0b2a"-"\u0b30","\u0b32"-"\u0b33","\u0b36"-"\u0b39","\u0b3c"-"\u0b43","\u0b47"-"\u0b48","\u0b4b"-"\u0b4d","\u0b56"-"\u0b57","\u0b5c"-"\u0b5d","\u0b5f"-"\u0b61","\u0b66"-"\u0b6f","\u0b82"-"\u0b83","\u0b85"-"\u0b8a","\u0b8e"-"\u0b90","\u0b92"-"\u0b95","\u0b99"-"\u0b9a","\u0b9c","\u0b9e"-"\u0b9f","\u0ba3"-"\u0ba4","\u0ba8"-"\u0baa","\u0bae"-"\u0bb5","\u0bb7"-"\u0bb9","\u0bbe"-"\u0bc2","\u0bc6"-"\u0bc8","\u0bca"-"\u0bcd","\u0bd7","\u0be7"-"\u0bef","\u0c01"-"\u0c03","\u0c05"-"\u0c0c","\u0c0e"-"\u0c10","\u0c12"-"\u0c28","\u0c2a"-"\u0c33","\u0c35"-"\u0c39","\u0c3e"-"\u0c44","\u0c46"-"\u0c48","\u0c4a"-"\u0c4d","\u0c55"-"\u0c56","\u0c60"-"\u0c61","\u0c66"-"\u0c6f","\u0c82"-"\u0c83","\u0c85"-"\u0c8c","\u0c8e"-"\u0c90","\u0c92"-"\u0ca8","\u0caa"-"\u0cb3","\u0cb5"-"\u0cb9","\u0cbe"-"\u0cc4","\u0cc6"-"\u0cc8","\u0cca"-"\u0ccd","\u0cd5"-"\u0cd6","\u0cde","\u0ce0"-"\u0ce1","\u0ce6"-"\u0cef","\u0d02"-"\u0d03","\u0d05"-"\u0d0c","\u0d0e"-"\u0d10","\u0d12"-"\u0d28","\u0d2a"-"\u0d39","\u0d3e"-"\u0d43","\u0d46"-"\u0d48","\u0d4a"-"\u0d4d","\u0d57","\u0d60"-"\u0d61","\u0d66"-"\u0d6f","\u0d82"-"\u0d83","\u0d85"-"\u0d96","\u0d9a"-"\u0db1","\u0db3"-"\u0dbb","\u0dbd","\u0dc0"-"\u0dc6","\u0dca","\u0dcf"-"\u0dd4","\u0dd6","\u0dd8"-"\u0ddf","\u0df2"-"\u0df3","\u0e01"-"\u0e3a","\u0e3f"-"\u0e4e","\u0e50"-"\u0e59","\u0e81"-"\u0e82","\u0e84","\u0e87"-"\u0e88","\u0e8a","\u0e8d","\u0e94"-"\u0e97","\u0e99"-"\u0e9f","\u0ea1"-"\u0ea3","\u0ea5","\u0ea7","\u0eaa"-"\u0eab","\u0ead"-"\u0eb9","\u0ebb"-"\u0ebd","\u0ec0"-"\u0ec4","\u0ec6","\u0ec8"-"\u0ecd","\u0ed0"-"\u0ed9","\u0edc"-"\u0edd","\u0f00","\u0f18"-"\u0f19","\u0f20"-"\u0f29","\u0f35","\u0f37","\u0f39","\u0f3e"-"\u0f47","\u0f49"-"\u0f6a","\u0f71"-"\u0f84","\u0f86"-"\u0f8b","\u0f90"-"\u0f97","\u0f99"-"\u0fbc","\u0fc6","\u1000"-"\u1021","\u1023"-"\u1027","\u1029"-"\u102a","\u102c"-"\u1032","\u1036"-"\u1039","\u1040"-"\u1049","\u1050"-"\u1059","\u10a0"-"\u10c5","\u10d0"-"\u10f6","\u1100"-"\u1159","\u115f"-"\u11a2","\u11a8"-"\u11f9","\u1200"-"\u1206","\u1208"-"\u1246","\u1248","\u124a"-"\u124d","\u1250"-"\u1256","\u1258","\u125a"-"\u125d","\u1260"-"\u1286","\u1288","\u128a"-"\u128d","\u1290"-"\u12ae","\u12b0","\u12b2"-"\u12b5","\u12b8"-"\u12be","\u12c0","\u12c2"-"\u12c5","\u12c8"-"\u12ce","\u12d0"-"\u12d6","\u12d8"-"\u12ee","\u12f0"-"\u130e","\u1310","\u1312"-"\u1315","\u1318"-"\u131e","\u1320"-"\u1346","\u1348"-"\u135a","\u1369"-"\u1371","\u13a0"-"\u13f4","\u1401"-"\u166c","\u166f"-"\u1676","\u1681"-"\u169a","\u16a0"-"\u16ea","\u1780"-"\u17d3","\u17db","\u17e0"-"\u17e9","\u180b"-"\u180e","\u1810"-"\u1819","\u1820"-"\u1877","\u1880"-"\u18a9","\u1e00"-"\u1e9b","\u1ea0"-"\u1ef9","\u1f00"-"\u1f15","\u1f18"-"\u1f1d","\u1f20"-"\u1f45","\u1f48"-"\u1f4d","\u1f50"-"\u1f57","\u1f59","\u1f5b","\u1f5d","\u1f5f"-"\u1f7d","\u1f80"-"\u1fb4","\u1fb6"-"\u1fbc","\u1fbe","\u1fc2"-"\u1fc4","\u1fc6"-"\u1fcc","\u1fd0"-"\u1fd3","\u1fd6"-"\u1fdb","\u1fe0"-"\u1fec","\u1ff2"-"\u1ff4","\u1ff6"-"\u1ffc","\u200c"-"\u200f","\u202a"-"\u202e","\u203f"-"\u2040","\u206a"-"\u206f","\u207f","\u20a0"-"\u20af","\u20d0"-"\u20dc","\u20e1","\u2102","\u2107","\u210a"-"\u2113","\u2115","\u2119"-"\u211d","\u2124","\u2126","\u2128","\u212a"-"\u212d","\u212f"-"\u2131","\u2133"-"\u2139","\u2160"-"\u2183","\u3005"-"\u3007","\u3021"-"\u302f","\u3031"-"\u3035","\u3038"-"\u303a","\u3041"-"\u3094","\u3099"-"\u309a","\u309d"-"\u309e","\u30a1"-"\u30fe","\u3105"-"\u312c","\u3131"-"\u318e","\u31a0"-"\u31b7","\u3400"-"\u4db5","\u4e00"-"\u9fa5","\ua000"-"\ua48c","\uac00"-"\ud7a3","\uf900"-"\ufa2d","\ufb00"-"\ufb06","\ufb13"-"\ufb17","\ufb1d"-"\ufb28","\ufb2a"-"\ufb36","\ufb38"-"\ufb3c","\ufb3e","\ufb40"-"\ufb41","\ufb43"-"\ufb44","\ufb46"-"\ufbb1","\ufbd3"-"\ufd3d","\ufd50"-"\ufd8f","\ufd92"-"\ufdc7","\ufdf0"-"\ufdfb","\ufe20"-"\ufe23","\ufe33"-"\ufe34","\ufe4d"-"\ufe4f","\ufe69","\ufe70"-"\ufe72","\ufe74","\ufe76"-"\ufefc","\ufeff","\uff04","\uff10"-"\uff19","\uff21"-"\uff3a","\uff3f","\uff41"-"\uff5a","\uff65"-"\uffbe","\uffc2"-"\uffc7","\uffca"-"\uffcf","\uffd2"-"\uffd7","\uffda"-"\uffdc","\uffe0"-"\uffe1","\uffe5"-"\uffe6","\ufff9"-"\ufffb"]> } NON-TERMINALS /************************************************ * THE JAVACC GRAMMAR SPECIFICATION STARTS HERE * ************************************************/ javacc_input := javacc_options "PARSER_BEGIN" "(" identifier ")" CompilationUnit "PARSER_END" "(" identifier ")" ( production )+ javacc_options := ( "{" ( option_binding )* "}" )? option_binding := ( | "LOOKAHEAD" | "IGNORE_CASE" | "static" ) "=" ( IntegerLiteral | BooleanLiteral | StringLiteral ) ";" production := javacode_production | regular_expr_production | token_manager_decls | bnf_production javacode_production := "JAVACODE" AccessModifier ResultType identifier FormalParameters ( "throws" Name ( "," Name )* )? Block bnf_production := AccessModifier ResultType identifier FormalParameters ( "throws" Name ( "," Name )* )? ":" Block "{" expansion_choices "}" AccessModifier := ( "public" | "protected" | "private" )? regular_expr_production := ( "<" "*" ">" | "<" ( "," )* ">" )? regexpr_kind ( "[" "IGNORE_CASE" "]" )? ":" "{" regexpr_spec ( "|" regexpr_spec )* "}" token_manager_decls := "TOKEN_MGR_DECLS" ":" ClassOrInterfaceBody regexpr_kind := "TOKEN" | "SPECIAL_TOKEN" | "SKIP" | "MORE" regexpr_spec := regular_expression ( Block )? ( ":" )? expansion_choices := expansion ( "|" expansion )* expansion := ( "LOOKAHEAD" "(" local_lookahead ")" )? ( expansion_unit )+ local_lookahead := ( IntegerLiteral )? ( "," )? ( expansion_choices )? ( "," )? ( "{" Expression "}" )? expansion_unit := "LOOKAHEAD" "(" local_lookahead ")" | Block | "[" expansion_choices "]" | "try" "{" expansion_choices "}" ( "catch" "(" Name ")" Block )* ( "finally" Block )? | ( PrimaryExpression "=" )? ( identifier Arguments | regular_expression ( "." )? ) | "(" expansion_choices ")" ( "+" | "*" | "?" )? regular_expression := StringLiteral | ( ( "#" )? identifier ":" )? complex_regular_expression_choices "> | "<" identifier ">" | "<" "EOF" ">" complex_regular_expression_choices := complex_regular_expression ( "|" complex_regular_expression )* complex_regular_expression := ( complex_regular_expression_unit )+ complex_regular_expression_unit := StringLiteral | "<" identifier ">" | character_list | "(" complex_regular_expression_choices ")" ( "+" | "*" | "?" | "{" IntegerLiteral ( "," ( IntegerLiteral )? )? "}" )? character_list := ( "~" )? "[" ( character_descriptor ( "," character_descriptor )* )? "]" character_descriptor := StringLiteral ( "-" StringLiteral )? identifier := /********************************************** * THE JAVA GRAMMAR SPECIFICATION STARTS HERE * **********************************************/ /* * The Java grammar is modified to use sequences of tokens * for the missing tokens - those that include "<<" and ">>". */ /* * The following production defines Java identifiers - it * includes the reserved words of JavaCC also. */ JavaIdentifier := ( | "LOOKAHEAD" | "IGNORE_CASE" | "PARSER_BEGIN" | "PARSER_END" | "JAVACODE" | "TOKEN" | "SPECIAL_TOKEN" | "MORE" | "SKIP" | "TOKEN_MGR_DECLS" | "EOF" ) /* * Program structuring syntax follows. */ CompilationUnit := ( PackageDeclaration )? ( ImportDeclaration )* ( TypeDeclaration )* PackageDeclaration := Modifiers "package" Name ";" ImportDeclaration := "import" ( "static" )? Name ( "." "*" )? ";" /* * Modifiers. We match all modifiers in a single rule to reduce the chances of * syntax errors for simple modifier mistakes. It will also enable us to give * better error messages. */ Modifiers := ( ( "public" | "static" | "protected" | "private" | "final" | "abstract" | "synchronized" | "native" | "transient" | "volatile" | "strictfp" | Annotation ) )* /* * Declaration syntax follows. */ TypeDeclaration := ";" | Modifiers ( ClassOrInterfaceDeclaration | EnumDeclaration | AnnotationTypeDeclaration ) ClassOrInterfaceDeclaration := ( "class" | "interface" ) ( TypeParameters )? ( ExtendsList )? ( ImplementsList )? ClassOrInterfaceBody ExtendsList := "extends" ClassOrInterfaceType ( "," ClassOrInterfaceType )* ImplementsList := "implements" ClassOrInterfaceType ( "," ClassOrInterfaceType )* EnumDeclaration := "enum" ( ImplementsList )? EnumBody EnumBody := "{" ( EnumConstant ( "," EnumConstant )* )? ( "," )? ( ";" ( ClassOrInterfaceBodyDeclaration )* )? "}" EnumConstant := Modifiers ( Arguments )? ( ClassOrInterfaceBody )? TypeParameters := "<" TypeParameter ( "," TypeParameter )* ">" TypeParameter := ( TypeBound )? TypeBound := "extends" ClassOrInterfaceType ( "&" ClassOrInterfaceType )* ClassOrInterfaceBody := "{" ( ClassOrInterfaceBodyDeclaration )* "}" ClassOrInterfaceBodyDeclaration := Initializer | Modifiers ( ClassOrInterfaceDeclaration | EnumDeclaration | ConstructorDeclaration | FieldDeclaration | MethodDeclaration ) | ";" FieldDeclaration := Type VariableDeclarator ( "," VariableDeclarator )* ";" VariableDeclarator := VariableDeclaratorId ( "=" VariableInitializer )? VariableDeclaratorId := ( "[" "]" )* VariableInitializer := ArrayInitializer | Expression ArrayInitializer := "{" ( VariableInitializer ( "," VariableInitializer )* )? ( "," )? "}" MethodDeclaration := ( TypeParameters )? ResultType MethodDeclarator ( "throws" NameList )? ( Block | ";" ) MethodDeclarator := FormalParameters ( "[" "]" )* FormalParameters := "(" ( FormalParameter ( "," FormalParameter )* )? ")" FormalParameter := Modifiers Type ( "..." )? VariableDeclaratorId ConstructorDeclaration := ( TypeParameters )? FormalParameters ( "throws" NameList )? "{" ( ExplicitConstructorInvocation )? ( BlockStatement )* "}" ExplicitConstructorInvocation := "this" Arguments ";" | ( PrimaryExpression "." )? "super" Arguments ";" Initializer := ( "static" )? Block /* * Type, name and expression syntax follows. */ Type := ReferenceType | PrimitiveType ReferenceType := PrimitiveType ( "[" "]" )+ | ( ClassOrInterfaceType ) ( "[" "]" )* ClassOrInterfaceType := ( TypeArguments )? ( "." ( TypeArguments )? )* TypeArguments := "<" TypeArgument ( "," TypeArgument )* ">" TypeArgument := ReferenceType | "?" ( WildcardBounds )? WildcardBounds := "extends" ReferenceType | "super" ReferenceType PrimitiveType := "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" ResultType := ( "void" | Type ) Name := JavaIdentifier ( "." JavaIdentifier )* NameList := Name ( "," Name )* /* * Expression syntax follows. */ Expression := ConditionalExpression ( AssignmentOperator Expression )? AssignmentOperator := "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" ConditionalExpression := ConditionalOrExpression ( "?" Expression ":" Expression )? ConditionalOrExpression := ConditionalAndExpression ( "||" ConditionalAndExpression )* ConditionalAndExpression := InclusiveOrExpression ( "&&" InclusiveOrExpression )* InclusiveOrExpression := ExclusiveOrExpression ( "|" ExclusiveOrExpression )* ExclusiveOrExpression := AndExpression ( "^" AndExpression )* AndExpression := EqualityExpression ( "&" EqualityExpression )* EqualityExpression := InstanceOfExpression ( ( "==" | "!=" ) InstanceOfExpression )* InstanceOfExpression := RelationalExpression ( "instanceof" Type )? RelationalExpression := ShiftExpression ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression )* ShiftExpression := AdditiveExpression ( ( "<<" | RSIGNEDSHIFT | RUNSIGNEDSHIFT ) AdditiveExpression )* AdditiveExpression := MultiplicativeExpression ( ( "+" | "-" ) MultiplicativeExpression )* MultiplicativeExpression := UnaryExpression ( ( "*" | "/" | "%" ) UnaryExpression )* UnaryExpression := ( "+" | "-" ) UnaryExpression | PreIncrementExpression | PreDecrementExpression | UnaryExpressionNotPlusMinus PreIncrementExpression := "++" PrimaryExpression PreDecrementExpression := "--" PrimaryExpression UnaryExpressionNotPlusMinus := ( "~" | "!" ) UnaryExpression | CastExpression | PostfixExpression // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. CastLookahead := "(" PrimitiveType | "(" Type "[" "]" | "(" Type ")" ( "~" | "!" | "(" | | "this" | "super" | "new" | Literal ) PostfixExpression := PrimaryExpression ( "++" | "--" )? CastExpression := "(" Type ")" UnaryExpression | "(" Type ")" UnaryExpressionNotPlusMinus PrimaryExpression := PrimaryPrefix ( PrimarySuffix )* MemberSelector := "." TypeArguments PrimaryPrefix := Literal | "this" | "super" "." | "(" Expression ")" | AllocationExpression | ResultType "." "class" | Name PrimarySuffix := "." "this" | "." AllocationExpression | MemberSelector | "[" Expression "]" | "." | Arguments Literal := | | | | BooleanLiteral | NullLiteral IntegerLiteral := BooleanLiteral := "true" | "false" StringLiteral := NullLiteral := "null" Arguments := "(" ( ArgumentList )? ")" ArgumentList := Expression ( "," Expression )* AllocationExpression := "new" PrimitiveType ArrayDimsAndInits | "new" ClassOrInterfaceType ( TypeArguments )? ( ArrayDimsAndInits | Arguments ( ClassOrInterfaceBody )? ) /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ ArrayDimsAndInits := ( "[" Expression "]" )+ ( "[" "]" )* | ( "[" "]" )+ ArrayInitializer /* * Statement syntax follows. */ Statement := LabeledStatement | AssertStatement | Block | EmptyStatement | StatementExpression ";" | SwitchStatement | IfStatement | WhileStatement | DoStatement | ForStatement | BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement | SynchronizedStatement | TryStatement AssertStatement := "assert" Expression ( ":" Expression )? ";" LabeledStatement := ":" Statement Block := "{" ( BlockStatement )* "}" BlockStatement := LocalVariableDeclaration ";" | Statement | ClassOrInterfaceDeclaration LocalVariableDeclaration := Modifiers Type VariableDeclarator ( "," VariableDeclarator )* EmptyStatement := ";" StatementExpression := PreIncrementExpression | PreDecrementExpression | PrimaryExpression ( "++" | "--" | AssignmentOperator Expression )? SwitchStatement := "switch" "(" Expression ")" "{" ( SwitchLabel ( BlockStatement )* )* "}" SwitchLabel := "case" Expression ":" | "default" ":" IfStatement := "if" "(" Expression ")" Statement ( "else" Statement )? WhileStatement := "while" "(" Expression ")" Statement DoStatement := "do" Statement "while" "(" Expression ")" ";" ForStatement := "for" "(" ( Modifiers Type ":" Expression | ( ForInit )? ";" ( Expression )? ";" ( ForUpdate )? ) ")" Statement ForInit := LocalVariableDeclaration | StatementExpressionList StatementExpressionList := StatementExpression ( "," StatementExpression )* ForUpdate := StatementExpressionList BreakStatement := "break" ( )? ";" ContinueStatement := "continue" ( )? ";" ReturnStatement := "return" ( Expression )? ";" ThrowStatement := "throw" Expression ";" SynchronizedStatement := "synchronized" "(" Expression ")" Block TryStatement := "try" Block ( "catch" "(" FormalParameter ")" Block )* ( "finally" Block )? /* We use productions to match >>>, >> and > so that we can keep the * type declaration syntax with generics clean */ RUNSIGNEDSHIFT := ( ">" ">" ">" ) RSIGNEDSHIFT := ( ">" ">" ) /* Annotation syntax follows. */ Annotation := NormalAnnotation | SingleMemberAnnotation | MarkerAnnotation NormalAnnotation := "@" Name "(" ( MemberValuePairs )? ")" MarkerAnnotation := "@" Name SingleMemberAnnotation := "@" Name "(" MemberValue ")" MemberValuePairs := MemberValuePair ( "," MemberValuePair )* MemberValuePair := "=" MemberValue MemberValue := Annotation | MemberValueArrayInitializer | ConditionalExpression MemberValueArrayInitializer := "{" MemberValue ( "," MemberValue )* ( "," )? "}" /* Annotation Types. */ AnnotationTypeDeclaration := "@" "interface" AnnotationTypeBody AnnotationTypeBody := "{" ( AnnotationTypeMemberDeclaration )* "}" AnnotationTypeMemberDeclaration := Modifiers ( Type "(" ")" ( DefaultValue )? ";" | ClassOrInterfaceDeclaration | EnumDeclaration | AnnotationTypeDeclaration | FieldDeclaration ) | ( ";" ) DefaultValue := "default" MemberValue DOCUMENT END javacc-5.0.orig/www/doc/tokenmanager.html0000644000175000017500000003170210604211576017467 0ustar mkochmkoch JavaCC: TokenManager MiniTutorial

JavaCC [tm]: TokenManager MiniTutorial

The JavaCC [tm] lexical specification is organized into a set of "lexical states". Each lexical state is named with an identifier. There is a standard lexical state called DEFAULT. The generated token manager is at any moment in one of these lexical states. When the token manager is initialized, it starts off in the DEFAULT state, by default. The starting lexical state can also be specified as a parameter while constructing a token manager object.

Each lexical state contains an ordered list of regular expressions; the order is derived from the order of occurrence in the input file. There are four kinds of regular expressions: SKIP, MORE, TOKEN, and SPECIAL_TOKEN.

All regular expressions that occur as expansion units in the grammar are considered to be in the DEFAULT lexical state and their order of occurrence is determined by their position in the grammar file.

A token is matched as follows: All regular expressions in the current lexical state are considered as potential match candidates. The token manager consumes the maximum number of characters from the input stream possible that match one of these regular expressions. That is, the token manager prefers the longest possible match. If there are multiple longest matches (of the same length), the regular expression that is matched is the one with the earliest order of occurrence in the grammar file.

As mentioned above, the token manager is in exactly one state at any moment. At this moment, the token manager only considers the regular expressions defined in this state for matching purposes. After a match, one can specify an action to be executed as well as a new lexical state to move to. If a new lexical state is not specified, the token manager remains in the current state.

The regular expression kind specifies what to do when a regular expression has been successfully matched:

SKIP
Simply throw away the matched string (after executing any lexical action).
MORE
Continue (to whatever the next state is) taking the matched string along. T his string will be a prefix of the new matched string.
TOKEN
Create a token using the matched string and send it to the parser (or any caller).
SPECIAL_TOKEN
Creates a special token that does not participate in parsing. Already described earlier.

(The mechanism of accessing special tokens is at the end of this page)

Whenever the end of file <EOF> is detected, it causes the creation of an <EOF> token (regardless of the current state of the lexical analyzer). However, if an <EOF> is detected in the middle of a match for a regular expression, or immediately after a MORE regular expression has been matched, an error is reported.

After the regular expression is matched, the lexical action is executed. All the variables (and methods) declared in the TOKEN_MGR_DECLS region (see below) are available here for use. In addition, the variables and methods listed below are also available for use.

Immediately after this, the token manager changes state to that specified (if any).

After that the action specified by the kind of the regular expression is taken (SKIP, MORE, ... ). If the kind is TOKEN, the matched token is returned. If the kind is SPECIAL_TOKEN, the matched token is saved to be returned along with the next TOKEN that is matched.


The following variables are available for use within lexical actions:

  1. StringBuffer image (READ/WRITE):

    "image" (different from the "image" field of the matched token) is a StringBuffer variable that contains all the characters that have been matched since the last SKIP, TOKEN, or SPECIAL_TOKEN. You are free to make whatever changes you wish to it so long as you do not assign it to null (since this variable is used by the generated token manager also). If you make changes to "image", this change is passed on to subsequent matches (if the current match is a MORE). The content of "image" *does not* automatically get assigned to the "image" field of the matched token. If you wish this to happen, you must explicitly assign it in a lexical action of a TOKEN or SPECIAL_TOKEN regular expression.

    Example:
    <DEFAULT> MORE : { "a" : S1 }
    
    <S1> MORE :
    {
      "b"
        { int l = image.length()-1; image.setCharAt(l, image.charAt(l).toUpperCase()); }
        ^1                                                                             ^2
        : S2
    }
    
    <S2> TOKEN :
    {
      "cd" { x = image; } : DEFAULT
           ^3
    }
    
    In the above example, the value of "image" at the 3 points marked by ^1, ^2, and ^3 are:
    At ^1: "ab"
    At ^2: "aB"
    At ^3: "aBcd"
    
  2. int lengthOfMatch (READ ONLY):

    This is the length of the current match (is not cumulative over MORE's). See example below. You should not modify this variable.

    Example:

    Using the same example as above, the values of "lengthOfMatch" are:
    At ^1: 1 (the size of "b")
    At ^2: 1 (does not change due to lexical actions)
    At ^3: 2 (the size of "cd")
    
  3. int curLexState (READ ONLY):

    This is the index of the current lexical state. You should not modify this variable. Integer constants whose names are those of the lexical state are generated into the ...Constants file, so you can refer to lexical states without worrying about their actual index value.
  4. inputStream (READ ONLY):

    This is an input stream of the appropriate type (one of ASCII_CharStream, ASCII_UCodeESC_CharStream, UCode_CharStream, or UCode_UCodeESC_CharStream depending on the values of options UNICODE_INPUT and JAVA_UNICODE_ESCAPE). The stream is currently at the last character consumed for this match. Methods of inputStream can be called. For example, getEndLine and getEndColumn can be called to get the line and column number information for the current match. inputStream may not be modified.
  5. Token matchedToken (READ/WRITE):

    This variable may be used only in actions associated with TOKEN and SPECIAL_TOKEN regular expressions. This is set to be the token that will get returned to the parser. You may change this variable and thereby cause the changed token to be returned to the parser instead of the original one. It is here that you can assign the value of variable "image" to "matchedToken.image". Typically that's how your changes to "image" has effect outside the lexical actions.

    Example:

    If we modify the last regular expression specification of the above example to:
    <S2> TOKEN :
    {
      "cd" { matchedToken.image = image.toString(); } : DEFAULT
    }
    
    Then the token returned to the parser will have its ".image" field set to "aBcd". If this assignment was not performed, then the ".image" field will remain as "abcd".
  6. void SwitchTo(int):

    Calling this method switches you to the specified lexical state. This method may be called from parser actions also (in addition to being called from lexical actions). However, care must be taken when using this method to switch states from the parser since the lexical analysis could be many tokens ahead of the parser in the presence of large lookaheads. When you use this method within a lexical action, you must ensure that it is the last statement executed in the action (otherwise, strange things could happen). If there is a state change specified using the ": state" syntax, it overrides all switchTo calls, hence there is no point having a switchTo call when there is an explicit state change specified. In general, calling this method should be resorted to only when you cannot do it any other way. Using this method of switching states also causes you to lose some of the semantic checking that JavaCC does when you use the standard syntax.

Lexical actions have access to a set of class level declarations. These declarations are introduced within the JavaCC file using the following syntax:

token_manager_decls ::=
  "TOKEN_MGR_DECLS" ":"
  "{" java_declarations_and_code "}"

These declarations are accessible from all lexical actions.

Examples

Example 1: Comments

SKIP :
{
  "/*" : WithinComment
}

<WithinComment> SKIP :
{
  "*/" : DEFAULT
}

<WithinComment> MORE :
{
  <~[]>
}

Example 2: String Literals with actions to print the length of the string

TOKEN_MGR_DECLS :
{
  int stringSize;
}

MORE :
{
  "\"" {stringSize = 0;} : WithinString
}

<WithinString> TOKEN :
{
  <STRLIT: "\""> {System.out.println("Size = " + stringSize);} : DEFAULT
}

<WithinString> MORE :
{
  <~["\n","\r"]> {stringSize++;}
}

How special tokens are sent to the parser

Special tokens are like tokens, except that they are permitted to appear anywhere in the input file (between any two tokens). Special tokens can be specified in the grammar input file using the reserved word "SPECIAL_TOKEN" instead of "TOKEN" as in:

SPECIAL_TOKEN :
{
  <SINGLE_LINE_COMMENT: "//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")>
}

Any regular expression defined to be a SPECIAL_TOKEN may be accessed in a special manner from user actions in the lexical and grammar specifications. This allows these tokens to be recovered during parsing while at the same time these tokens do not participate in the parsing.

JavaCC has been bootstrapped to use this feature to automatically copy relevant comments from the input grammar file into the generated files.

Details:

The class Token now has an additional field:

   Token specialToken;

This field points to the special token immediately prior to the current token (special or otherwise). If the token immediately prior to the current token is a regular token (and not a special token), then this field is set to null. The "next" fields of regular tokens continue to have the same meaning - i.e., they point to the next regular token except in the case of the EOF token where the "next" field is null. The "next" field of special tokens point to the special token immediately following the current token. If the token immediately following the current token is a regular token, the "next" field is set to null.

This is clarified by the following example. Suppose you wish to print all special tokens prior to the regular token "t" (but only those that are after the regular token before "t"):

  if (t.specialToken == null) return;
    // The above statement determines that there are no special tokens
    // and returns control to the caller.
  Token tmp_t = t.specialToken;
  while (tmp_t.specialToken != null) tmp_t = tmp_t.specialToken;
    // The above line walks back the special token chain until it
    // reaches the first special token after the previous regular
    // token.
  while (tmp_t != null) {
    System.out.println(tmp_t.image);
    tmp_t = tmp_t.next;
  }
    // The above loop now walks the special token chain in the forward
    // direction printing them in the process.
javacc-5.0.orig/www/doc/index.html0000644000175000017500000001131111231335640016111 0ustar mkochmkoch JavaCC Home

Java Compiler Compiler [tm] (JavaCC [tm]) - The Java Parser Generator

Java Compiler Compiler [tm] (JavaCC [tm]) is the most popular parser generator for use with Java [tm] applications. A parser generator is a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.

We've had hundreds of thousands of downloads and estimate serious users in the many thousands (and maybe even tens of thousands). Our newsgroup comp.compilers.tools.javacc and our mailing list together have a few thousand participants.

JavaCC works with any Java VM version 1.2 or greater. It has been certified to be 100% Pure Java. JavaCC has been tested on countless different platforms without any special porting requirements. Given that we have seen JavaCC run on only around 5 or 6 platforms, we think this is a great testimonial to the "Write Once Run Anywhere" aspect of the Java programming language. We say this as engineers who have personally experienced the benefits of writing Java applications.


Getting the Software

Download the latest release of JavaCC.

Note: You need to enable cookies for the download link to work.

Third party contributions

An excellent FAQ is maintained by Theo Norvell at Memorial University of Newfoundland.

A repository of JavaCC grammars is being maintained on the JavaCC home page. We urge you to contribute your grammars to this repository or to the JavaCC authors for the benefit of others.


Feature Highlights: A short description of the features of JavaCC.

Installation and Getting Started: This page contains a bunch of tips that should aid you through the installation process.

Documentation: The complete documentation for JavaCC.

Lexer writing tips: Tips for writing good JavaCC lexical analyzer specs. This can also help you if you are getting 'code size too big' error message from javac when you compile the generated token manager.

Getting Support and Keeping In Touch: Here's how you can contact us and keep in touch with what's happening.

javacc-5.0.orig/www/doc/jjtreeREADME.html0000644000175000017500000001526210604211575017157 0ustar mkochmkoch JavaCC: JJTree README

JavaCC [tm]: README for JJTreeExamples

JJTreeExamples

This directory contains some simple JJTree input files intended to
illustrate some of the basic ideas.  All of them are based on an
grammar to recognize arithmetic expressions built out of identifiers
and constants.

eg1.jjt

This example is just the JavaCC [tm] grammar, with a little extra code in
the parser's main method to call the dump method on the generated
tree.  It illustrates how the default behavior of JJTree will produce
a tree of non-terminals.

eg2.jjt

This example is the same grammar as eg1.jjt with modifications to
customize the generated tree.  It illustrates how unnecessary
intermediate nodes can be suppressed, and how actions in the grammar
can attach extra information to the nodes.

eg3.jjt

This example is a modification of eg2.jjt with the NODE_DEFAULT_VOID
option set.  This instructs JJTree to treat all undecorated
non-terminals as if they were decorated as #void. The default JJTree
behavior is to treat such non-terminals as if they were decorated
with the name of the non-terminal.

eg4.jjt

This is a modification of eg3.jjt with the VISITOR option set.  This
instructs JJTree to insert a jjtAccept() method into all nodes it
generates, and to produce a visitor class.  The visitor is used to
dump the tree.


Here are some instructions on how to run the examples and the output
you can expect to see.

eg1.jjt
-------

The only bit of JJTree-specific code is an action in the start
production that dumps the constructed parse tree when the parse is
complete.  It uses JJTree simple mode.

The input file is eg1.jjt.

trane% jjtree eg1.jjt
<<< Version and copyright info>>>
(type "jjtree" with no arguments for help)
Reading from file eg1.jjt . . .
Annotated grammar generated successfully in eg1.jj
trane%

JJTree has now generated the JavaCC parser source, as well as Java
source for the parse tree node building classes.  Running JavaCC in
the normal way generates the remaining Java code.

trane% javacc eg1.jj
<<< Version and copyright info>>>
(type "javacc" with no arguments for help)
Reading from file eg1.jj . . .
File "TokenMgrError.java" does not exist.  Will create one.
File "ParseException.java" does not exist.  Will create one.
File "Token.java" does not exist.  Will create one.
File "ASCII_CharStream.java" does not exist.  Will create one.
Parser generated successfully.
trane%

Compile and run the Java program as usual.  The expression is read from the
standard input (you type in "(a + b) * (c + 1);"):

trane% javac eg1.java
trane% java eg1
Reading from standard input...
(a + b) * (c + 1);
Start
 Expression
  AdditiveExpression
   MultiplicativeExpression
    UnaryExpression
     Expression
      AdditiveExpression
       MultiplicativeExpression
        UnaryExpression
         Identifier
       MultiplicativeExpression
        UnaryExpression
         Identifier
    UnaryExpression
     Expression
      AdditiveExpression
       MultiplicativeExpression
        UnaryExpression
         Identifier
       MultiplicativeExpression
        UnaryExpression
         Integer
Thank you.
trane%

eg2.jjt
-------

This is a modification of the first example to illustrate how the
parse tree can be customized:

trane% jjtree eg2.jjt
<<< Version and copyright info>>>
(type "jjtree" with no arguments for help)
Reading from file eg2.jjt . . .
File "Node.java" does not exist.  Will create one.
File "SimpleNode.java" does not exist.  Will create one.
File "ASTStart.java" does not exist.  Will create one.
File "ASTAdd.java" does not exist.  Will create one.
File "ASTMult.java" does not exist.  Will create one.
File "ASTInteger.java" does not exist.  Will create one.
Annotated grammar generated successfully in eg2.jj
trane%
trane% javacc eg2.jj
<<< Version and copyright info>>>
(type "javacc" with no arguments for help)
Reading from file eg2.jj . . .
File "TokenMgrError.java" does not exist.  Will create one.
File "ParseException.java" does not exist.  Will create one.
File "Token.java" does not exist.  Will create one.
File "ASCII_CharStream.java" does not exist.  Will create one.
Parser generated successfully.
trane%
trane% javac eg2.java
trane% java eg2
Reading from standard input...
(a + b) * (c + 1);
Start
 Mult
  Add
   Identifier: a
   Identifier: b
  Add
   Identifier: c
   Integer
Thank you.
trane%

Look at eg2.jjt to see how node annotations can be used to restructure
the parse tree, and at ASTMyID.java to see how you can write your own
node classes that maintain more information from the input stream.

eg3.jjt
-------

This example can be run in the same manner as you ran eg2.jjt.

eg4.jjt
-------

This example again can be run in the same manner as you ran eg2.jjt.
One thing to take care in this case is that you must run jjtree on
a clean directory (that does not contain previously generated files).
For example, the file SimpleNode.java is different when the option
VISITOR is set to true.
javacc-5.0.orig/www/doc/javaccgrm.html0000644000175000017500000015775711072444055016774 0ustar mkochmkoch JavaCC Grammar Files

JavaCC [tm]: Grammar Files

This page contains the complete syntax of Java Compiler Compiler [tm] grammar files with detailed explanations of each construct.

Tokens in the grammar files follow the same conventions as for the Java programming language. Hence identifiers, strings, characters, etc. used in the grammars are the same as Java identifiers, Java strings, Java characters, etc.

White space in the grammar files also follows the same conventions as for the Java programming language. This includes the syntax for comments. Most comments present in the grammar files are generated into the generated parser/lexical analyzer.

Grammar files are preprocessed for Unicode escapes just as Java files are (i.e., occurrences of strings such as \uxxxx - where xxxx is a hex value - are converted to the corresponding Unicode character before lexical analysis).

Exceptions to the above rules: The Java operators "<<", ">>", ">>>", "<<=", ">>=", and ">>>=" are left out of JavaCC's input token list in order to allow convenient nested use of token specifications. Finally, the following are the additional reserved words in the Java Compiler Compiler [tm] grammar files.

EOF IGNORE_CASE JAVACODE LOOKAHEAD
MORE PARSER_BEGIN PARSER_END SKIP
SPECIAL_TOKEN TOKEN TOKEN_MGR_DECLS

Any Java entities used in the grammar rules that follow appear italicized with the prefix java_ (e.g., java_compilation_unit).


javacc_input ::= javacc_options
"PARSER_BEGIN" "(" <IDENTIFIER> ")"
java_compilation_unit
"PARSER_END" "(" <IDENTIFIER> ")"
( production )*
<EOF>

The grammar file starts with a list of options (which is optional). This is then followed by a Java compilation unit enclosed between "PARSER_BEGIN(name)" and "PARSER_END(name)". After this is a list of grammar productions. Options and productions are described later.

The name that follows "PARSER_BEGIN" and "PARSER_END" must be the same and this identifies the name of the generated parser. For example, if name is "MyParser", then the following files are generated:

MyParser.java: The generate parser.
MyParserTokenManager.java: The generated token manager (or scanner/lexical analyzer).
MyParserConstants.java: A bunch of useful constants.

Other files such as "Token.java", "ParseException.java", etc. are also generated. However, these files contain boilerplate code and are the same for any grammar and may be reused across grammars (provided the grammars use compatible options).

Between the PARSER_BEGIN and PARSER_END constructs is a regular Java compilation unit (a compilation unit in Java lingo is the entire contents of a Java file). This may be any arbitrary Java compilation unit so long as it contains a class declaration whose name is the same as the name of the generated parser ("MyParser" in the above example). Hence, in general, this part of the grammar file looks like:

    PARSER_BEGIN(parser_name)
    . . .
    class parser_name . . . {
      . . .
    }
    . . .
    PARSER_END(parser_name)

JavaCC does not perform detailed checks on the compilation unit, so it is possible for a grammar file to pass through JavaCC and generate Java files that produce errors when they are compiled.

If the compilation unit includes a package declaration, this is included in all the generated files. If the compilation unit includes imports declarations, this is included in the generated parser and token manager files.

The generated parser file contains everything in the compilation unit and, in addition, contains the generated parser code that is included at the end of the parser class. For the above example, the generated parser will look like:

    . . .
    class parser_name . . . {
      . . .
      // generated parser is inserted here.
    }
    . . .

The generated parser includes a public method declaration corresponding to each non-terminal (see javacode_production and bnf_production) in the grammar file. Parsing with respect to a non-terminal is achieved by calling the method corresponding to that non-terminal. Unlike yacc, there is no single start symbol in JavaCC - one can parse with respect to any non-terminal in the grammar.

The generated token manager provides one public method:

    Token getNextToken() throws ParseError;

For more details on how this method may be used, please read the description of the Java Compiler Compiler API.


javacc_options ::= [ "options" "{" ( option_binding )* "}" ]

The options if present, starts with the reserved word "options" followed by a list of one or more option bindings within braces. Each option binding specifies the setting of one option. The same option may not be set multiple times.

Options may be specified either here in the grammar file, or from the command line. If the option is set from the command line, that takes precedence.

Option names are not case-sensitive.


option_binding ::= "LOOKAHEAD" "=" java_integer_literal ";"
| "CHOICE_AMBIGUITY_CHECK" "=" java_integer_literal ";"
| "OTHER_AMBIGUITY_CHECK" "=" java_integer_literal ";"
| "STATIC" "=" java_boolean_literal ";"
| "SUPPORT_CLASS_VISIBILITY_PUBLIC" "=" java_boolean_literal ";"
| "DEBUG_PARSER" "=" java_boolean_literal ";"
| "DEBUG_LOOKAHEAD" "=" java_boolean_literal ";"
| "DEBUG_TOKEN_MANAGER" "=" java_boolean_literal ";"
| "ERROR_REPORTING" "=" java_boolean_literal ";"
| "JAVA_UNICODE_ESCAPE" "=" java_boolean_literal ";"
| "UNICODE_INPUT" "=" java_boolean_literal ";"
| "IGNORE_CASE" "=" java_boolean_literal ";"
| "USER_TOKEN_MANAGER" "=" java_boolean_literal ";"
| "USER_CHAR_STREAM" "=" java_boolean_literal ";"
| "BUILD_PARSER" "=" java_boolean_literal ";"
| "BUILD_TOKEN_MANAGER" "=" java_boolean_literal ";"
| "TOKEN_EXTENDS" "=" java_string_literal ";"
| "TOKEN_FACTORY" "=" java_string_literal ";"
| "TOKEN_MANAGER_USES_PARSER" "=" java_boolean_literal ";"
| "SANITY_CHECK" "=" java_boolean_literal ";"
| "FORCE_LA_CHECK" "=" java_boolean_literal ";"
| "COMMON_TOKEN_ACTION" "=" java_boolean_literal ";"
| "CACHE_TOKENS" "=" java_boolean_literal ";"
| "OUTPUT_DIRECTORY" "=" java_string_literal ";"
  • LOOKAHEAD: The number of tokens to look ahead before making a decision at a choice point during parsing. The default value is 1. The smaller this number, the faster the parser. This number may be overridden for specific productions within the grammar as described later. See the description of the lookahead algorithm for complete details on how lookahead works.
  • CHOICE_AMBIGUITY_CHECK: This is an integer option whose default value is 2. This is the number of tokens considered in checking choices of the form "A | B | ..." for ambiguity. For example, if there is a common two token prefix for both A and B, but no common three token prefix, (assume this option is set to 3) then JavaCC can tell you to use a lookahead of 3 for disambiguation purposes. And if A and B have a common three token prefix, then JavaCC only tell you that you need to have a lookahead of 3 or more. Increasing this can give you more comprehensive ambiguity information at the cost of more processing time. For large grammars such as the Java grammar, increasing this number any further causes the checking to take too much time.
  • OTHER_AMBIGUITY_CHECK: This is an integer option whose default value is 1. This is the number of tokens considered in checking all other kinds of choices (i.e., of the forms "(A)*", "(A)+", and "(A)?") for ambiguity. This takes more time to do than the choice checking, and hence the default value is set to 1 rather than 2.
  • STATIC: This is a boolean option whose default value is true. If true, all methods and class variables are specified as static in the generated parser and token manager. This allows only one parser object to be present, but it improves the performance of the parser. To perform multiple parses during one run of your Java program, you will have to call the ReInit() method to reinitialize your parser if it is static. If the parser is non-static, you may use the "new" operator to construct as many parsers as you wish. These can all be used simultaneously from different threads.
  • DEBUG_PARSER: This is a boolean option whose default value is false. This option is used to obtain debugging information from the generated parser. Setting this option to true causes the parser to generate a trace of its actions. Tracing may be disabled by calling the method disable_tracing() in the generated parser class. Tracing may be subsequently enabled by calling the method enable_tracing() in the generated parser class.
  • DEBUG_LOOKAHEAD: This is a boolean option whose default value is false. Setting this option to true causes the parser to generate all the tracing information it does when the option DEBUG_PARSER is true, and in addition, also causes it to generated a trace of actions performed during lookahead operation.
  • DEBUG_TOKEN_MANAGER: This is a boolean option whose default value is false. This option is used to obtain debugging information from the generated token manager. Setting this option to true causes the token manager to generate a trace of its actions. This trace is rather large and should only be used when you have a lexical error that has been reported to you and you cannot understand why. Typically, in this situation, you can determine the problem by looking at the last few lines of this trace.
  • ERROR_REPORTING: This is a boolean option whose default value is true. Setting it to false causes errors due to parse errors to be reported in somewhat less detail. The only reason to set this option to false is to improve performance.
  • JAVA_UNICODE_ESCAPE: This is a boolean option whose default value is false. When set to true, the generated parser uses an input stream object that processes Java Unicode escapes (\u...) before sending characters to the token manager. By default, Java Unicode escapes are not processed.
    This option is ignored if either of options USER_TOKEN_MANAGER, USER_CHAR_STREAM is set to true.
  • UNICODE_INPUT: This is a boolean option whose default value is false. When set to true, the generated parser uses uses an input stream object that reads Unicode files. By default, ASCII files are assumed.
    This option is ignored if either of options USER_TOKEN_MANAGER, USER_CHAR_STREAM is set to true.
  • IGNORE_CASE: This is a boolean option whose default value is false. Setting this option to true causes the generated token manager to ignore case in the token specifications and the input files. This is useful for writing grammars for languages such as HTML. It is also possible to localize the effect of IGNORE_CASE by using an alternate mechanism described later.
  • USER_TOKEN_MANAGER: This is a boolean option whose default value is false. The default action is to generate a token manager that works on the specified grammar tokens. If this option is set to true, then the parser is generated to accept tokens from any token manager of type "TokenManager" - this interface is generated into the generated parser directory.
  • SUPPORT_CLASS_VISIBILITY_PUBLIC: This is a boolean option whose default value is true. The default action is to generate support classes (such as Token.java, ParseException.java etc) with Public visibility. If set to false, the classes will be generated with package-private visibility.
  • USER_CHAR_STREAM: This is a boolean option whose default value is false. The default action is to generate a character stream reader as specified by the options JAVA_UNICODE_ESCAPE and UNICODE_INPUT. The generated token manager receives characters from this stream reader. If this option is set to true, then the token manager is generated to read characters from any character stream reader of type "CharStream.java". This file is generated into the generated parser directory.
    This option is ignored if USER_TOKEN_MANAGER is set to true.
  • BUILD_PARSER: This is a boolean option whose default value is true. The default action is to generate the parser file ("MyParser.java" in the above example). When set to false, the parser file is not generated. Typically, this option is set to false when you wish to generate only the token manager and use it without the associated parser.
  • BUILD_TOKEN_MANAGER: This is a boolean option whose default value is true. The default action is to generate the token manager file ("MyParserTokenManager.java" in the above example). When set to false the token manager file is not generated. The only reason to set this option to false is to save some time during parser generation when you fix problems in the parser part of the grammar file and leave the lexical specifications untouched.
  • TOKEN_MANAGER_USES_PARSER: This is a boolean option whose default value is false. When set to true, the generated token manager will include a field called parser that references the instantiating parser instance (of type MyParser in the above example). The main reason for having a parser in a token manager is using some of its logic in lexical actions. This option has no effect if the STATIC option is set to true.
  • TOKEN_EXTENDS: This is a string option whose default value is "", meaning that the generated Token class will extend java.lang.Object. This option may be set to the name of a class that will be used as the base class for the generated Token class.
  • TOKEN_FACTORY: This is a string option whose default value is "", meaning that Tokens will be created by calling Token.newToken(). If set the option names a Token factory class containing a public static Token newToken(int ofKind, String image) method.
  • SANITY_CHECK: This is a boolean option whose default value is true. JavaCC performs many syntactic and semantic checks on the grammar file during parser generation. Some checks such as detection of left recursion, detection of ambiguity, and bad usage of empty expansions may be suppressed for faster parser generation by setting this option to false. Note that the presence of these errors (even if they are not detected and reported by setting this option to false) can cause unexpected behavior from the generated parser.
  • FORCE_LA_CHECK: This is a boolean option whose default value is false. This option setting controls lookahead ambiguity checking performed by JavaCC. By default (when this option is false), lookahead ambiguity checking is performed for all choice points where the default lookahead of 1 is used. Lookahead ambiguity checking is not performed at choice points where there is an explicit lookahead specification, or if the option LOOKAHEAD is set to something other than 1. Setting this option to true performs lookahead ambiguity checking at all choice points regardless of the lookahead specifications in the grammar file.
  • COMMON_TOKEN_ACTION: This is a boolean option whose default value is false. When set to true, every call to the token manager's method "getNextToken" (see the description of the Java Compiler Compiler API) will cause a call to a used defined method "CommonTokenAction" after the token has been scanned in by the token manager. The user must define this method within the TOKEN_MGR_DECLS section. The signature of this method is:
        void CommonTokenAction(Token t)
    
  • CACHE_TOKENS: This is a boolean option whose default value is false. Setting this option to true causes the generated parser to lookahead for extra tokens ahead of time. This facilitates some performance improvements. However, in this case (when the option is true), interactive applications may not work since the parser needs to work synchronously with the availability of tokens from the input stream. In such cases, it's best to leave this option at its default value.
  • OUTPUT_DIRECTORY: This is a string valued option whose default value is the current directory. This controls where output files are generated.

production ::= javacode_production
| regular_expr_production
| bnf_production
| token_manager_decls

There are four kinds of productions in JavaCC. javacode_production and bnf_production are used to define the grammar from which the parser is generated. regular_expr_production is used to define the grammar tokens - the token manager is generated from this information (as well as from inline token specifications in the parser grammar). token_manager_decls is used to introduce declarations that get inserted into the generated token manager.


javacode_production ::= "JAVACODE"
java_access_modifier java_return_type java_identifier "(" java_parameter_list ")"
java_block

The JAVACODE production is a way to write Java code for some productions instead of the usual EBNF expansion. This is useful when there is the need to recognize something that is not context-free or for whatever reason is very difficult to write a grammar for. An example of the use of JAVACODE is shown below. In this example, the non-terminal "skip_to_matching_brace" consumes tokens in the input stream all the way up to a matching closing brace (the opening brace is assumed to have been just scanned):

    JAVACODE
    void skip_to_matching_brace() {
      Token tok;
      int nesting = 1;
      while (true) {
        tok = getToken(1);
        if (tok.kind == LBRACE) nesting++;
        if (tok.kind == RBRACE) {
          nesting--;
          if (nesting == 0) break;
        }
        tok = getNextToken();
      }
    }

Care must be taken when using JAVACODE productions. While you can say pretty much what you want with these productions, JavaCC simply considers it a black box (that somehow performs its parsing task). This becomes a problem when JAVACODE productions appear at choice points. For example, if the above JAVACODE production was referred to from the following production:

  void NT() :
  {}
  {
    skip_to_matching_brace()
  |
    some_other_production()
  }

Then JavaCC would not know how to choose between the two choices. On the other hand, if the JAVACODE production is used at a non-choice point as in the following example, there is no problem:

  void NT() :
  {}
  {
    "{" skip_to_matching_brace()
  |
    "(" parameter_list() ")"
  }

JAVACODE productions at choice points may also be preceded by syntactic or semantic LOOKAHEAD, as in this example:

  void NT() :
  {}
  {
    LOOKAHEAD( {errorOccurred} ) skip_to_matching_brace()
  |
    "(" parameter_list() ")"
  }

The default access modifier for JAVACODE productions is package private.


bnf_production ::= java_access_modifier java_return_type java_identifier "(" java_parameter_list ")" ":"
java_block
"{" expansion_choices "}"

The BNF production is the standard production used in specifying JavaCC grammars. Each BNF production has a left hand side which is a non-terminal specification. The BNF production then defines this non-terminal in terms of BNF expansions on the right hand side. The non-terminal is written exactly like a declared Java method. Since each non-terminal is translated into a method in the generated parser, this style of writing the non-terminal makes this association obvious. The name of the non-terminal is the name of the method, and the parameters and return value declared are the means to pass values up and down the parse tree. As will be seen later, non-terminals on the right hand sides of productions are written as method calls, so the passing of values up and down the tree are done using exactly the same paradigm as method call and return. The default access modifier for BNF productions is public.

There are two parts on the right hand side of an BNF production. The first part is a set of arbitrary Java declarations and code (the Java block). This code is generated at the beginning of the method generated for the Java non-terminal. Hence, every time this non-terminal is used in the parsing process, these declarations and code are executed. The declarations in this part are visible to all Java code in actions in the BNF expansions. JavaCC does not do any processing of these declarations and code, except to skip to the matching ending brace, collecting all text encountered on the way. Hence, a Java compiler can detect errors in this code that has been processed by JavaCC.

The second part of the right hand side are the BNF expansions. This is described later.


regular_expr_production ::= [ lexical_state_list ]
regexpr_kind [ "[" "IGNORE_CASE" "]" ] ":"
"{" regexpr_spec ( "|" regexpr_spec )* "}"

A regular expression production is used to define lexical entities that get processed by the generated token manager. A detailed description of how the token manager works is provided in this minitutorial (click here). This page describes the syntactic aspects of specifying lexical entities, while the minitutorial describes how these syntactic constructs tie in with how the token manager actually works.

A regular expression production starts with a specification of the lexical states for which it applies (the lexical state list). There is a standard lexical state called "DEFAULT". If the lexical state list is omitted, the regular expression production applies to the lexical state "DEFAULT".

Following this is a description of what kind of regular expression production this is (see below for what this means).

After this is an optional "[IGNORE_CASE]". If this is present, the regular expression production is case insensitive - it has the same effect as the IGNORE_CASE option, except that in this case it applies locally to this regular expression production.

This is then followed by a list of regular expression specifications that describe in more detail the lexical entities of this regular expression production.


token_manager_decls ::= "TOKEN_MGR_DECLS" ":" java_block

The token manager declarations starts with the reserved word "TOKEN_MGR_DECLS" followed by a ":" and then a set of Java declarations and statements (the Java block). These declarations and statements are written into the generated token manager and are accessible from within lexical actions. See the minitutorial on the token manager for more details.

There can only be one token manager declaration in a JavaCC grammar file.


lexical_state_list ::= "<" "*" ">"
| "<" java_identifier ( "," java_identifier )* ">"

The lexical state list describes the set of lexical states for which the corresponding regular expression production applies. If this is written as "<*>", the regular expression production applies to all lexical states. Otherwise, it applies to all the lexical states in the identifier list within the angular brackets.


regexpr_kind ::= "TOKEN"
| "SPECIAL_TOKEN"
| "SKIP"
| "MORE"

This specifies the kind of regular expression production. There are four kinds:

  • TOKEN: The regular expressions in this regular expression production describe tokens in the grammar. The token manager creates a Token object for each match of such a regular expression and returns it to the parser.
  • SPECIAL_TOKEN: The regular expressions in this regular expression production describe special tokens. Special tokens are like tokens, except that they do not have significance during parsing - that is the BNF productions ignore them. Special tokens are, however, still passed on to the parser so that parser actions can access them. Special tokens are passed to the parser by linking them to neighboring real tokens using the field "specialToken" in the Token class. Special tokens are useful in the processing of lexical entities such as comments which have no significance to parsing, but still are an important part of the input file. See the minitutorial on the token manager for more details of special token handling.
  • SKIP: Matches to regular expressions in this regular expression production are simply skipped (ignored) by the token manager.
  • MORE: Sometimes it is useful to gradually build up a token to be passed on to the parser. Matches to this kind of regular expression are stored in a buffer until the next TOKEN or SPECIAL_TOKEN match. Then all the matches in the buffer and the final TOKEN/SPECIAL_TOKEN match are concatenated together to form one TOKEN/SPECIAL_TOKEN that is passed on to the parser. If a match to a SKIP regular expression follows a sequence of MORE matches, the contents of the buffer is discarded.

regexpr_spec ::= regular_expression [ java_block ] [ ":" java_identifier ]

The regular expression specification begins the actual description of the lexical entities that are part of this regular expression production. Each regular expression production may contain any number of regular expression specifications.

Each regular expression specification contains a regular expression followed by a Java block (the lexical action) which is optional. This is then followed by an identifier of a lexical state (which is also optional). Whenever this regular expression is matched, the lexical action (if any) gets executed, followed by any common token actions. Then the action depending on the regular expression production kind is taken. Finally, if a lexical state is specified, the token manager moves to that lexical state for further processing (the token manager starts initially in the state "DEFAULT").


expansion_choices ::= expansion ( "|" expansion )*

Expansion choices are written as a list of one or more expansions separated by "|"s. The set of legal parses allowed by an expansion choice is a legal parse of any one of the contained expansions.


expansion ::= ( expansion_unit )*

An expansion is written as a sequence of expansion units. A concatenation of legal parses of the expansion units is a legal parse of the expansion.

For example, the expansion "{" decls() "}" consists of three expansion units - "{", decls(), and "}". A match for the expansion is a concatenation of the matches for the individual expansion units - in this case, that would be any string that begins with a "{", ends with a "}", and contains a match for decls() in between.


expansion_unit ::= local_lookahead
| java_block
| "(" expansion_choices ")" [ "+" | "*" | "?" ]
| "[" expansion_choices "]"
| [ java_assignment_lhs "=" ] regular_expression
| [ java_assignment_lhs "=" ] java_identifier "(" java_expression_list ")"

An expansion unit can be a local LOOKAHEAD specification. This instructs the generated parser on how to make choices at choice points. For details on how LOOKAHEAD specifications work and how to write LOOKAHEAD specifications, click here to visit the minitutorial on LOOKAHEAD.

An expansion unit can be a set of Java declarations and code enclosed within braces (the Java block). These are also called parser actions. This is generated into the method parsing the non-terminal at the appropriate location. This block is executed whenever the parsing process crosses this point successfully. When JavaCC processes the Java block, it does not perform any detailed syntax or semantic checking. Hence it is possible that the Java compiler will find errors in your actions that have been processed by JavaCC. Actions are not executed during lookahead evaluation.

An expansion unit can be a parenthesized set of one or more expansion choices. In which case, a legal parse of the expansion unit is any legal parse of the nested expansion choices. The parenthesized set of expansion choices can be suffixed (optionally) by:

  • "+": Then any legal parse of the expansion unit is one or more repetitions of a legal parse of the parenthesized set of expansion choices.
  • "*": Then any legal parse of the expansion unit is zero or more repetitions of a legal parse of the parenthesized set of expansion choices.
  • "?": Then a legal parse of the expansion unit is either the empty token sequence or any legal parse of the nested expansion choices. An alternate syntax for this construct is to enclose the expansion choices within brackets "[...]".

An expansion unit can be a regular expression. Then a legal parse of the expansion unit is any token that matches this regular expression. When a regular expression is matched, it creates an object of type Token. This object can be accessed by assigning it to a variable by prefixing the regular expression with "variable =". In general, you may have any valid Java assignment left-hand side to the left of the "=". This assignment is not performed during lookahead evaluation.

An expansion unit can be a non-terminal (the last choice in the syntax above). In which case, it takes the form of a method call with the non-terminal name used as the name of the method. A successful parse of the non-terminal causes the parameters placed in the method call to be operated on and a value returned (in case the non-terminal was not declared to be of type "void"). The return value can be assigned (optionally) to a variable by prefixing the regular expression with "variable =". In general, you may have any valid Java assignment left-hand side to the left of the "=". This assignment is not performed during lookahead evaluation. Non-terminals may not be used in an expansion in a manner that introduces left-recursion. JavaCC checks this for you.


local_lookahead ::= "LOOKAHEAD" "(" [ java_integer_literal ] [ "," ] [ expansion_choices ] [ "," ] [ "{" java_expression "}" ] ")"

A local lookahead specification is used to influence the way the generated parser makes choices at the various choice points in the grammar. A local lookahead specification starts with the reserved word "LOOKAHEAD" followed by a set of lookahead constraints within parentheses. There are three different kinds of lookahead constraints - a lookahead limit (the integer literal), a syntactic lookahead (the expansion choices), and a semantic lookahead (the expression within braces). At least one lookahead constraint must be present. If more than one lookahead constraint is present, they must be separated by commas.

For a detailed description of how lookahead works, please click here to visit the minitutorial on LOOKAHEAD. A brief description of each kind of lookahead constraint is given below:

  • Lookahead Limit: This is the maximum number of tokens of lookahead that may be used for choice determination purposes. This overrides the default value which is specified by the LOOKAHEAD option. This lookahead limit applies only to the choice point at the location of the local lookahead specification. If the local lookahead specification is not at a choice point, the lookahead limit (if any) is ignored.
  • Syntactic Lookahead: This is an expansion (or expansion choices) that is used for the purpose of determining whether or not the particular choice that this local lookahead specification applies to is to be taken. If this was not provided, the parser uses the expansion to be selected during lookahead determination. If the local lookahead specification is not at a choice point, the syntactic lookahead (if any) is ignored.
  • Semantic Lookahead: This is a boolean expression that is evaluated whenever the parser crosses this point during parsing. If the expression evaluates to true, the parsing continues normally. If the expression evaluates to false and the local lookahead specification is at a choice point, the current choice is not taken and the next choice is considered. If the expression evaluates to false and the local lookahead specification is not at a choice point, then parsing aborts with a parse error. Unlike the other two lookahead constraints that are ignored at non-choice points, semantic lookahead is always evaluated. In fact, semantic lookahead is even evaluated if it is encountered during the evaluation of some other syntactic lookahead check (for more details click here to visit the minitutorial on LOOKAHEAD).

Default values for lookahead constraints: If a local lookahead specification has been provided, but not all lookahead constraints have been included, then the missing ones are assigned default values as follows:

  • If the lookahead limit is not provided and if the syntactic lookahead is provided, then the lookahead limit defaults to the largest integer value (2147483647). This essentially implements "infinite lookahead" - namely, look ahead as many tokens as necessary to match the syntactic lookahead that has been provided.
  • If neither the lookahead limit nor the syntactic lookahead has been provided (which means the semantic lookahead is provided), the lookahead limit defaults to 0. This means that syntactic lookahead is not performed (it passes trivially), and only semantic lookahead is performed.
  • If the syntactic lookahead is not provided, it defaults to the choice to which the local lookahead specification applies. If the local lookahead specification is not at a choice point, then the syntactic lookahead is ignored - hence a default value is not relevant.
  • If the semantic lookahead is not provided, it defaults to the boolean expression "true". That is, it trivially passes.

regular_expression ::= java_string_literal
| "<" [ [ "#" ] java_identifier ":" ] complex_regular_expression_choices ">"
| "<" java_identifier ">"
| "<" "EOF" ">"

There are two places in a grammar files where regular expressions may be written:

  • Within a regular expression specification (part of a regular expression production),
  • As an expansion unit with an expansion. When a regular expression is used in this manner, it is as if the regular expression were defined in the following manner at this location and then referred to by its label from the expansion unit:
        <DEFAULT> TOKEN :
        {
          regular expression
        }
    
    That is, this usage of regular expression can be rewritten using the other kind of usage.

The complete details of regular expression matching by the token manager is available in the minitutorial on the token manager. The description of the syntactic constructs follows.

The first kind of regular expression is a string literal. The input being parsed matches this regular expression if the token manager is in a lexical state for which this regular expression applies and the next set of characters in the input stream is the same (possibly with case ignored) as this string literal.

A regular expression may also be a more complex regular expression using which more involved regular expression (than string literals can be defined). Such a regular expression is placed within angular brackets "<...>", and may be labeled optionally with an identifier. This label may be used to refer to this regular expression from expansion units or from within other regular expressions. If the label is preceded by a "#", then this regular expression may not be referred to from expansion units, but only from within other regular expressions. When the "#" is present, the regular expression is referred to as a "private regular expression".

A regular expression may be a reference to some other labeled regular expression in which case it is written as the label enclosed in angular brackets "<...>".

Finally, a regular expression may be a reference to the predefined regular expression "<EOF>" which is matched by the end of file.

Private regular expressions are not matched as tokens by the token manager. Their purpose is solely to facilitate the definition of other more complex regular expressions.

Consider the following example defining Java floating point literals:

TOKEN :
{
  < FLOATING_POINT_LITERAL:
        (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
      | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
      | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
      | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
  >
|
  < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
}

In this example, the token FLOATING_POINT_LITERAL is defined using the definition of another token, namely, EXPONENT. The "#" before the label EXPONENT indicates that this exists solely for the purpose of defining other tokens (FLOATING_POINT_LITERAL in this case). The definition of FLOATING_POINT_LITERAL is not affected by the presence or absence of the "#". However, the token manager's behavior is. If the "#" is omitted, the token manager will erroneously recognize a string like E123 as a legal token of kind EXPONENT (instead of IDENTIFIER in the Java grammar).


complex_regular_expression_choices ::= complex_regular_expression ( "|" complex_regular_expression )*

Complex regular expression choices is made up of a list of one or more complex regular expressions separated by "|"s. A match for a complex regular expression choice is a match of any of its constituent complex regular expressions.


complex_regular_expression ::= ( complex_regular_expression_unit )*

A complex regular expression is a sequence of complex regular expression units. A match for a complex regular expression is a concatenation of matches to the complex regular expression units.


complex_regular_expression_unit ::= java_string_literal
| "<" java_identifier ">"
| character_list
| "(" complex_regular_expression_choices ")" [ "+" | "*" | "?" ]

A complex regular expression unit can be a string literal, in which case there is exactly one match for this unit, namely, the string literal itself.

A complex regular expression unit can be a reference to another regular expression. The other regular expression has to be labeled so that it can be referenced. The matches of this unit are all the matches of this other regular expression. Such references in regular expressions cannot introduce loops in the dependency between tokens.

A complex regular expression unit can be a character list. A character list is a way of defining a set of characters. A match for this kind of complex regular expression unit is any character that is allowed by the character list.

A complex regular expression unit can be a parenthesized set of complex regular expression choices. In this case, a legal match of the unit is any legal match of the nested choices. The parenthesized set of choices can be suffixed (optionally) by:

  • "+": Then any legal match of the unit is one or more repetitions of a legal match of the parenthesized set of choices.
  • "*": Then any legal match of the unit is zero or more repetitions of a legal match of the parenthesized set of choices.
  • "?": Then a legal match of the unit is either the empty string or any legal match of the nested choices.

Note that unlike the BNF expansions, the regular expression "[...]" is not equivalent to the regular expression "(...)?". This is because the [...] construct is used to describe character lists in regular expressions.


character_list ::= [ "~" ] "[" [ character_descriptor ( "," character_descriptor )* ] "]"

A character list describes a set of characters. A legal match for a character list is any character in this set. A character list is a list of character descriptors separated by commas within square brackets. Each character descriptor describes a single character or a range of characters (see character descriptor below), and this is added to the set of characters of the character list. If the character list is prefixed by the "~" symbol, the set of characters it represents is any UNICODE character not in the specified set.


character_descriptor ::= java_string_literal [ "-" java_string_literal ]

A character descriptor can be a single character string literal, in which case it describes a singleton set containing that character; or it is two single character string literals separated by a "-", in which case, it describes the set of all characters in the range between and including these two characters.

javacc-5.0.orig/www/doc/support.html0000644000175000017500000000401010604211576016520 0ustar mkochmkoch JavaCC Support

JavaCC [tm]: Customer Support

Java Compiler Compiler [tm] is being supported on an informal basis by its developers through electronic mailing lists.

javacc-5.0.orig/www/doc/apiroutines.html0000644000175000017500000005037010742750553017366 0ustar mkochmkoch JavaCC API Documentation

JavaCC [tm]: API Routines

This web page is a comprehensive list of all classes, methods, and variables available for use by a JavaCC [tm] user. These classes, methods, and variables are typically used from the actions that are embedded in a JavaCC grammar. In the sample code used below, it is assumed that the name of the generated parser is "TheParser".

Non-Terminals in the Input Grammar

For each non-terminal NT in the input grammar file, the following method is generated into the parser class:

  • returntype NT(parameters) throws ParseException;

Here, returntype and parameters are what were specified in the JavaCC input file in the definition of NT (where NT occurred on the left-hand side).

When this method is called, the input stream is parsed to match this non-terminal. On a successful parse, this method returns normally. On detection of a parse error, an error message is displayed and the method returns by throwing an exception of the type ParseException.

Note that all non-terminals in a JavaCC input grammar have equal status; it is possible to parse to any non-terminal by calling the non-terminal's method.

API for Parser Actions

  • Token token;
    This variable holds the last token consumed by the parser and can be used in parser actions. This is exactly the same as the token returned by getToken(0).

In addition, the two methods - getToken(int i) and getNextToken() can also be used in actions to traverse the token list.

The Token Manager Interface

Typically, the token manager interface is not to be used. Instead all access must be made through the parser interface. However, in certain situations - such as if you are not building a parser and building only the token manager - the token manager interface is useful. The token manager provides the following routine:

  • Token getNextToken() throws ParseError;

Each call to this method returns the next token in the input stream. This method throws a ParseError exception when there is a lexical error, i.e., it could not find a match for any of the specified tokens from the input stream. The type Token is described later.

Constructors and Other Initialization Routines

  • TheParser.TheParser(java.io.InputStream stream)
    This creates a new parser object, which in turn creates a new token manager object that reads its tokens from "stream". This constructor is available only when both the options USER_TOKEN_MANAGER and USER_CHAR_STREAM are false. If the option STATIC is true, this constructor (along with other constructors) can be called exactly once to create a single parser object.
  • TheParser.TheParser(CharStream stream)
    Similar to the previous constructor, except that this one is available only when the option USER_TOKEN_MANAGER is false and USER_CHAR_STREAM is true.
  • void TheParser.ReInit(java.io.InputStream stream)
    This reinitializes an existing parser object. In addition, it also reinitializes the existing token manager object that corresponds to this parser object. The result is a parser object with the exact same functionality as one that was created with the constructor above. The only difference is that new objects are not created. This method is available only when both the options USER_TOKEN_MANAGER and USER_CHAR_STREAM are false. If the option STATIC is true, this (along with the other ReInit methods) is the only way to restart a parse operation for there is only one parser and all one can do is reinitialize it.
  • void TheParser.ReInit(CharStream stream)
    Similar to the previous method, except that this one is available only when the option USER_TOKEN_MANAGER is false and USER_CHAR_STREAM is true.
  • TheParser(TheParserTokenManager tm) This creates a new parser object which uses an already created token manager object "tm" as its token manager. This constructor is only available if option USER_TOKEN_MANAGER is false. If the option STATIC is true, this constructor (along with other constructors) can be called exactly once to create a single parser object.
  • TheParser(TokenManager tm)
    Similar to the previous constructor, except that this one is available only when the option USER_TOKEN_MANAGER is true.
  • void TheParser.ReInit(TheParserTokenManager tm)
    This reinitializes an existing parser object with the token manager object "tm" as its new token manager. This method is only available if option USER_TOKEN_MANAGER is false. If the option STATIC is true, this (along with the other ReInit methods) is the only way to restart a parse operation for there is only one parser and all one can do is reinitialize it.
  • void TheParser.ReInit(TokenManager tm)
    Similar to the previous method, except that this one is available only when the option USER_TOKEN_MANAGER is true.
  • TheParserTokenManager.TheParserTokenManager(CharStream stream)
    Creates a new token manager object initialized to read input from "stream". When the option STATIC is true, this constructor may be called only once. This is available only when USER_TOKEN_MANAGER is false and USER_CHAR_STREAM is true. When USER_TOKEN_MANAGER is false and USER_CHAR_STREAM is false (the default situation), a constructor similar to the one above is available with the type CharStream replaced as follows:
    • When JAVA_UNICODE_ESCAPE is false and UNICODE_INPUT is false, CharStream is replaced by ASCII_CharStream.
    • When JAVA_UNICODE_ESCAPE is false and UNICODE_INPUT is true, CharStream is replaced by UCode_CharStream.
    • When JAVA_UNICODE_ESCAPE is true and UNICODE_INPUT is false, CharStream is replaced by ASCII_UCodeESC_CharStream.
    • When JAVA_UNICODE_ESCAPE is true and UNICODE_INPUT is true, CharStream is replaced by UCode_UCodeESC_CharStream.
  • void TheParserTokenManager.ReInit(CharStream stream)
    Reinitializes the current token manager object to read input from "stream". When the option STATIC is true, this is the only way to restart a token manager operation. This is available only when USER_TOKEN_MANAGER is false and USER_CHAR_STREAM is true. When USER_TOKEN_MANAGER is false and USER_CHAR_STREAM is false (the default situation), a constructor similar to the one above is available with the type CharStream replaced as follows:
    • When JAVA_UNICODE_ESCAPE is false and UNICODE_INPUT is false, CharStream is replaced by ASCII_CharStream.
    • When JAVA_UNICODE_ESCAPE is false and UNICODE_INPUT is true, CharStream is replaced by UCode_CharStream.
    • When JAVA_UNICODE_ESCAPE is true and UNICODE_INPUT is false, CharStream is replaced by ASCII_UCodeESC_CharStream.
    • When JAVA_UNICODE_ESCAPE is true and UNICODE_INPUT is true, CharStream is replaced by UCode_UCodeESC_CharStream.

The Token Class

The Token class is the type of token objects that are created by the token manager after a successful scanning of the token stream. These token objects are then passed to the parser and are accessible to the actions in a JavaCC grammar usually by grabbing the return value of a token. The methods getToken and getNextToken described below also give access to objects of this type.

Each Token object has the following fields and methods:

  • int kind;
    This is the index for this kind of token in the internal representation scheme of JavaCC. When tokens in the JavaCC input file are given labels, these labels are used to generate "int" constants that can be used in actions. The value 0 is always used to represent the predefined token <EOF>. A constant "EOF" is generated for convenience in the ...Constants file.
  • int beginLine, beginColumn, endLine, endColumn;
    These indicate the beginning and ending positions of the token as it appeared in the input stream.
  • String image;
    This represents the image of the token as it appeared in the input stream.
  • Token next;
    A reference to the next regular (non-special) token from the input stream. If this is the last token from the input stream, or if the token manager has not read tokens beyond this one, this field is set to null.

    The description in the above paragraph holds only if this token is also a regular token. Otherwise, see below for a description of the contents of this field.

    Note: There are two kinds of tokens - regular and special. Regular tokens are the normal tokens that are fed to the parser. Special tokens are other useful tokens (like comments) that are not discarded (like white space). For more information on the different kinds of tokens please see the minitutorial on the token manager.
  • Token specialToken;
    This field is used to access special tokens that occur prior to this token, but after the immediately preceding regular (non-special) token. If there are no such special tokens, this field is set to null. When there are more than one such special token, this field refers to the last of these special tokens, which in turn refers to the next previous special token through its specialToken field, and so on until the first special token (whose specialToken field is null). The next fields of special tokens refer to other special tokens that immediately follow it (without an intervening regular token). If there is no such token, this field is null.
  • public Object getValue();
    An optional attribute value of the Token.
    Tokens which are not used as syntactic sugar will often contain meaningful values that will be used later on by the compiler or interpreter. This attribute value is often different from the image. Any subclass of Token that actually wants to return a non-null value can override this method as appropriate.
  • static final Token newToken(int ofKind);
    static final Token newToken(int ofKind, String image);
    Returns a new token object as its default behavior. If you wish to perform special actions when a token is constructed or create subclasses of class Token and instantiate them instead, you can redefine this method appropriately. The only constraint is that this method returns a new object of type Token (or a subclass of Token).

Reading Tokens from the Input Stream

There are two methods available for this purpose:

  • Token TheParser.getNextToken() throws ParseError
    This method returns the next available token in the input stream and moves the token pointer one step in the input stream (i.e., this changes the state of the input stream). If there are no more tokens available in the input stream, the exception ParseError is thrown. Care must be taken when calling this method since it can interfere with the parser's knowledge of the state of the input stream, current token, etc.
  • Token TheParser.getToken(int index) throws ParseError
    This method returns the index-th token from the current token ahead in the token stream. If index is 0, it returns the current token (the last token returned by getNextToken or consumed by the parser); if index is 1, it returns the next token (the next token that will be returned by getNextToken of consumed by the parser) and so on. The index parameter cannot be negative. This method does not change the input stream pointer (i.e., it does not change the state of the input stream). If an attempt is made to access a token beyond the last available token, the exception ParseError is thrown. If this method is called from a semantic lookahead specification, which in turn is called during a lookahead determination process, the current token is temporarily adjusted to be the token currently being inspected by the lookahead process. For more details, please see the minitutorial on using lookahead.

Working with Debugger Tracing

When you generate parsers with the options DEBUG_PARSER or DEBUG_LOOKAHEAD, these parsers produce a trace of their activity which is printed to the user console. You can insert calls to the following methods to control this tracing activity:

  • void TheParser.enable_tracing()
  • void TheParser.disable_tracing()

For convenience, these methods are available even when you build parsers without the debug options. In this case, these methods are no-ops. Hence you can permanently leave these methods in your code and they automatically kick in when you use the debug options.

Customizing Error Messages

To help the user in customizing error messages generated by the parser and lexer, the user is offered the facilities described in this section. In the case of the parser, these facilities are only available if the option ERROR_REPORTING is true, while in the case of the lexer, these facilities are always available.

The parser contains the following method definition:

  • protected void token_error() { ... }
To customize error reporting by the parser, the parser class must be subclassed and this method redefined in the subclass. To help with creating your error reporting scheme, the following variables are available:
  • protected int error_line, error_column;
    The line and column where the error was detected.
  • protected String error_string;
    The image of the offending token or set of tokens. When a lookahead of more than 1 is used, more than one token may be present here.
  • protected String[] expected_tokens;
    An array of images of legitimate token sequences. Here again, each legitimate token sequence may be more than just one token when a lookahead of more than 1 is used.

The lexer contains the following method definition:

  • protected void LexicalError() { ... }

To customize error reporting by the lexer, the lexer class must be subclassed and this method redefined in the subclass. To help with creating your error reporting scheme, the following variables are available:

  • protected int error_line, error_column;
    The line and column where the error was detected.
  • protected String error_after;
    The partial string that has been read since the last successful token match was performed.
  • protected char curChar;
    The offending character.

JavaCC [tm]: JJTree

JJTree has two APIs: it adds some parser methods; and it requires all node objects to implement the Node interface.

JJTree parser methods

JJTree maintains some state in the parser object itself. It encapsulates all this state with an object that can be referred to via the jjtree field.

The parser state implements an open stack where nodes are held until they can be added to their parent node. The jjtree state object provides methods for you to manipulate the contents of the stack in your actions if the basic JJTree mechanisms are not sufficient.

void reset()
Call this to reinitialize the node stack. All nodes currently on the stack are thrown away. Don't call this from within a node scope, or terrible things will surely happen.
Node rootNode();
Returns the root node of the AST. Since JJTree operates bottom-up, the root node is only defined after the parse has finished.
boolean nodeCreated();
Determines whether the current node was actually closed and pushed. Call this in the final action within a conditional node scope.
int arity();
Returns the number of nodes currently pushed on the node stack in the current node scope.
void pushNode(Node n);
Pushes a node on to the stack.
Node popNode();
Returns the node on the top of the stack, and removes it from the stack.
Node peekNode();
Returns the node currently on the top of the stack.

The Node interface

All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child relationships between nodes.

public void jjtOpen();
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.
public void jjtClose();
This method is called after all the child nodes have been added.
public void jjtSetParent(Node n);
public Node jjtGetParent();
This pair of methods is used to inform the node of its parent.
public void jjtAddChild(Node n, int i);
This method tells the node to add its argument to the node's list of children.
public Node jjtGetChild(int i);
This method returns a child node. The children are numbered from zero, left to right.
int jjtGetNumChildren();
Return the number of children the node has.
javacc-5.0.orig/www/doc/lexertips.html0000644000175000017500000001236710604211575017040 0ustar mkochmkoch Tips for writing a good JavaCC lexical specification

Tips for writing a good JavaCC lexical specification

There are many ways to write the lexical specification for a grammar. But the performance of the generated token manager varies significantly depending on how you do this. Here are a few tips:

  • Try to specify as many String literals as possible. These are recognized by a Deterministic Finite Automata (DFA), which is much faster than the Nondeterministic Finite Automata (NFA) needed to recognize other kinds of complex regular expressions. For example, to skip blanks/tabs/newlines,
        SKIP : { " " | "\t" | "\n" }
    
    is more efficient than doing
        SKIP : { < ([" ", "\t", "\n"])+ > }
    
    because in the first case you only have string literals, it will generate a DFA whereas for the second case it will generate an NFA.
  • Try to use the pattern ~[] just by itself as much as possible. For example, doing a
        MORE : { < ~[] > }
    
    is better than doing
          TOKEN : { < (~[])+ > }
    
    of course, if your grammar dictates that one of these cannot be used, then you don't have a choice, but try to use < ~[] > as much as possible.
  • Specify all the String literals in the order of increasing length, i.e., all shorter string literals before longer ones. This will help optimizing the bit vectors needed for string literals.
  • Try to minimize the use of lexical states. When using these, try to move all your complex regular expressions into a single lexical state, leaving others to just recognize simple string literals.
  • Try to use IGNORE_CASE judiciously. Best thing to do is to set this option at the grammar level. If that is not possible, then try to have it set for *all* regular expressions in a lexical state. There is heavy performance penalty for setting IGNORE_CASE for some regular expressions and not for others in the same lexical state.
  • Try to SKIP as much possible, if you don't care about certain patterns. Here, you have to be a bit careful about EOF. seeing an EOF after SKIP is fine whereas, seeing an EOF after a MORE is a lexical error.
  • Try to avoid specifying lexical actions with MORE specifications. Generally every MORE should end up in a TOKEN (or SPECIAL_TOKEN) finally so you can do the action there at the TOKEN level, if it is possible.
  • Also try to avoid lexical actions and lexical state changes with SKIP specifications (especially for single character SKIP's like " ", "\t", "\n" etc.). For such cases, a simple loop is generated to eat up the SKIP'ed single characters. So obviously, if there is a lexical action or state change associated with this, it is not possible to it this way.
  • Try to avoid having a choice of String literals for the same token, e.g.
          < NONE : "\"none\"" | "\'none\'" >
    
    Instead, have two different token kinds for this and use a nonterminal which is a choice between those choices. The above example can be written as :
            < NONE1 : "\"none\"" >
          |
            < NONE2 : "\'none'\" >
    
    and define a nonterminal called None() as :
          void None() : {} { <NONE1> | <NONE2> }
    
    This will make recognition much faster. Note however, that if the choice is between two complex regular expressions, it is OK to have the choice.
javacc-5.0.orig/www/doc/JavaCC.html0000644000175000017500000020756510713453627016125 0ustar mkochmkoch BNF for JavaCC.jj

BNF for JavaCC.jj

TOKENS

/**********************************************
 * THE JAVACC TOKEN SPECIFICATION STARTS HERE *
 **********************************************/

/* JAVACC RESERVED WORDS: These are the only tokens in JavaCC but not in Java */
<DEFAULT> TOKEN : {
<_LOOKAHEAD: "LOOKAHEAD">
| <_IGNORE_CASE: "IGNORE_CASE">
| <_PARSER_BEGIN: "PARSER_BEGIN">
| <_PARSER_END: "PARSER_END">
| <_JAVACODE: "JAVACODE">
| <_TOKEN: "TOKEN">
| <_SPECIAL_TOKEN: "SPECIAL_TOKEN">
| <_MORE: "MORE">
| <_SKIP: "SKIP">
| <_TOKEN_MGR_DECLS: "TOKEN_MGR_DECLS">
| <_EOF: "EOF">
}

   
/*
 * The remainder of the tokens are exactly (except for the removal of tokens
 * containing ">>" and "<<") as in the Java grammar and must be diff equivalent
 * (again with the exceptions above) to it.
 */

/* WHITE SPACE */
<DEFAULT> SKIP : {
" "
| "\t"
| "\n"
| "\r"
| "\f"
| "/*@egen*/" : AFTER_EGEN
}

   
<AFTER_EGEN> SKIP : {
<~[]> : DEFAULT
}

   
/* COMMENTS */
<DEFAULT> MORE : {
"//" : IN_SINGLE_LINE_COMMENT
| <"/**" ~["/"]> : IN_FORMAL_COMMENT
| "/*" : IN_MULTI_LINE_COMMENT
| "/*@bgen(jjtree" : IN_MULTI_LINE_COMMENT
}

   
<IN_SINGLE_LINE_COMMENT> SPECIAL : {
<SINGLE_LINE_COMMENT: "\n" | "\r" | "\r\n"> : DEFAULT
}

   
<IN_FORMAL_COMMENT> SPECIAL : {
<FORMAL_COMMENT: "*/"> : DEFAULT
}

   
<IN_MULTI_LINE_COMMENT> SPECIAL : {
<MULTI_LINE_COMMENT: "*/"> : DEFAULT
}

   
<IN_SINGLE_LINE_COMMENT,IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT> MORE : {
<~[]>
}

   
/* JAVA RESERVED WORDS AND LITERALS */
<DEFAULT> TOKEN : {
<ABSTRACT: "abstract">
| <ASSERT: "assert">
| <BOOLEAN: "boolean">
| <BREAK: "break">
| <BYTE: "byte">
| <CASE: "case">
| <CATCH: "catch">
| <CHAR: "char">
| <CLASS: "class">
| <CONST: "const">
| <CONTINUE: "continue">
| <_DEFAULT: "default">
| <DO: "do">
| <DOUBLE: "double">
| <ELSE: "else">
| <ENUM: "enum">
| <EXTENDS: "extends">
| <FALSE: "false">
| <FINAL: "final">
| <FINALLY: "finally">
| <FLOAT: "float">
| <FOR: "for">
| <GOTO: "goto">
| <IF: "if">
| <IMPLEMENTS: "implements">
| <IMPORT: "import">
| <INSTANCEOF: "instanceof">
| <INT: "int">
| <INTERFACE: "interface">
| <LONG: "long">
| <NATIVE: "native">
| <NEW: "new">
| <NULL: "null">
| <PACKAGE: "package">
| <PRIVATE: "private">
| <PROTECTED: "protected">
| <PUBLIC: "public">
| <RETURN: "return">
| <SHORT: "short">
| <STATIC: "static">
| <STRICTFP: "strictfp">
| <SUPER: "super">
| <SWITCH: "switch">
| <SYNCHRONIZED: "synchronized">
| <THIS: "this">
| <THROW: "throw">
| <THROWS: "throws">
| <TRANSIENT: "transient">
| <TRUE: "true">
| <TRY: "try">
| <VOID: "void">
| <VOLATILE: "volatile">
| <WHILE: "while">
}

   
/* JAVA LITERALS */
<DEFAULT> TOKEN : {
<INTEGER_LITERAL: <DECIMAL_LITERAL> (["l","L"])? | <HEX_LITERAL> (["l","L"])? | <OCTAL_LITERAL> (["l","L"])?>
| <#DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])*>
| <#HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+>
| <#OCTAL_LITERAL: "0" (["0"-"7"])*>
| <FLOATING_POINT_LITERAL: <DECIMAL_FLOATING_POINT_LITERAL> | <HEXADECIMAL_FLOATING_POINT_LITERAL>>
| <#DECIMAL_FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])? | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"]>
| <#DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+>
| <#HEXADECIMAL_FLOATING_POINT_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])? | "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])?>
| <#HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+>
| <CHARACTER_LITERAL: "\'" (~["\'","\\","\n","\r"] | "\\" (["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])? | ["0"-"3"] ["0"-"7"] ["0"-"7"])) "\'">
| <STRING_LITERAL: "\"" (~["\"","\\","\n","\r"] | "\\" (["n","t","b","r","f","\\","\'","\""] | ["0"-"7"] (["0"-"7"])? | ["0"-"3"] ["0"-"7"] ["0"-"7"]))* "\"">
}

   
/* SEPARATORS */
<DEFAULT> TOKEN : {
<LPAREN: "(">
| <RPAREN: ")">
| <LBRACE: "{">
| <RBRACE: "}">
| <LBRACKET: "[">
| <RBRACKET: "]">
| <SEMICOLON: ";">
| <COMMA: ",">
| <DOT: ".">
}

   
/* OPERATORS */
<DEFAULT> TOKEN : {
<ASSIGN: "=">
| <LT: "<">
| <BANG: "!">
| <TILDE: "~">
| <HOOK: "?">
| <COLON: ":">
| <EQ: "==">
| <LE: "<=">
| <GE: ">=">
| <NE: "!=">
| <SC_OR: "||">
| <SC_AND: "&&">
| <INCR: "++">
| <DECR: "--">
| <PLUS: "+">
| <MINUS: "-">
| <STAR: "*">
| <SLASH: "/">
| <BIT_AND: "&">
| <BIT_OR: "|">
| <XOR: "^">
| <REM: "%">
| <PLUSASSIGN: "+=">
| <MINUSASSIGN: "-=">
| <STARASSIGN: "*=">
| <SLASHASSIGN: "/=">
| <ANDASSIGN: "&=">
| <ORASSIGN: "|=">
| <XORASSIGN: "^=">
| <REMASSIGN: "%=">
}

   
/* >'s need special attention due to generics syntax. */
<DEFAULT> TOKEN : {
<RUNSIGNEDSHIFT: ">>>"> : {
| <RSIGNEDSHIFT: ">>"> : {
| <GT: ">">
}

   
/* IDENTIFIERS */
<DEFAULT> TOKEN : {
<IDENTIFIER: <LETTER> (<PART_LETTER>)*>
| <#LETTER: ["$","A"-"Z","_","a"-"z","\u00a2"-"\u00a5","\u00aa","\u00b5","\u00ba","\u00c0"-"\u00d6","\u00d8"-"\u00f6","\u00f8"-"\u021f","\u0222"-"\u0233","\u0250"-"\u02ad","\u02b0"-"\u02b8","\u02bb"-"\u02c1","\u02d0"-"\u02d1","\u02e0"-"\u02e4","\u02ee","\u037a","\u0386","\u0388"-"\u038a","\u038c","\u038e"-"\u03a1","\u03a3"-"\u03ce","\u03d0"-"\u03d7","\u03da"-"\u03f3","\u0400"-"\u0481","\u048c"-"\u04c4","\u04c7"-"\u04c8","\u04cb"-"\u04cc","\u04d0"-"\u04f5","\u04f8"-"\u04f9","\u0531"-"\u0556","\u0559","\u0561"-"\u0587","\u05d0"-"\u05ea","\u05f0"-"\u05f2","\u0621"-"\u063a","\u0640"-"\u064a","\u0671"-"\u06d3","\u06d5","\u06e5"-"\u06e6","\u06fa"-"\u06fc","\u0710","\u0712"-"\u072c","\u0780"-"\u07a5","\u0905"-"\u0939","\u093d","\u0950","\u0958"-"\u0961","\u0985"-"\u098c","\u098f"-"\u0990","\u0993"-"\u09a8","\u09aa"-"\u09b0","\u09b2","\u09b6"-"\u09b9","\u09dc"-"\u09dd","\u09df"-"\u09e1","\u09f0"-"\u09f3","\u0a05"-"\u0a0a","\u0a0f"-"\u0a10","\u0a13"-"\u0a28","\u0a2a"-"\u0a30","\u0a32"-"\u0a33","\u0a35"-"\u0a36","\u0a38"-"\u0a39","\u0a59"-"\u0a5c","\u0a5e","\u0a72"-"\u0a74","\u0a85"-"\u0a8b","\u0a8d","\u0a8f"-"\u0a91","\u0a93"-"\u0aa8","\u0aaa"-"\u0ab0","\u0ab2"-"\u0ab3","\u0ab5"-"\u0ab9","\u0abd","\u0ad0","\u0ae0","\u0b05"-"\u0b0c","\u0b0f"-"\u0b10","\u0b13"-"\u0b28","\u0b2a"-"\u0b30","\u0b32"-"\u0b33","\u0b36"-"\u0b39","\u0b3d","\u0b5c"-"\u0b5d","\u0b5f"-"\u0b61","\u0b85"-"\u0b8a","\u0b8e"-"\u0b90","\u0b92"-"\u0b95","\u0b99"-"\u0b9a","\u0b9c","\u0b9e"-"\u0b9f","\u0ba3"-"\u0ba4","\u0ba8"-"\u0baa","\u0bae"-"\u0bb5","\u0bb7"-"\u0bb9","\u0c05"-"\u0c0c","\u0c0e"-"\u0c10","\u0c12"-"\u0c28","\u0c2a"-"\u0c33","\u0c35"-"\u0c39","\u0c60"-"\u0c61","\u0c85"-"\u0c8c","\u0c8e"-"\u0c90","\u0c92"-"\u0ca8","\u0caa"-"\u0cb3","\u0cb5"-"\u0cb9","\u0cde","\u0ce0"-"\u0ce1","\u0d05"-"\u0d0c","\u0d0e"-"\u0d10","\u0d12"-"\u0d28","\u0d2a"-"\u0d39","\u0d60"-"\u0d61","\u0d85"-"\u0d96","\u0d9a"-"\u0db1","\u0db3"-"\u0dbb","\u0dbd","\u0dc0"-"\u0dc6","\u0e01"-"\u0e30","\u0e32"-"\u0e33","\u0e3f"-"\u0e46","\u0e81"-"\u0e82","\u0e84","\u0e87"-"\u0e88","\u0e8a","\u0e8d","\u0e94"-"\u0e97","\u0e99"-"\u0e9f","\u0ea1"-"\u0ea3","\u0ea5","\u0ea7","\u0eaa"-"\u0eab","\u0ead"-"\u0eb0","\u0eb2"-"\u0eb3","\u0ebd","\u0ec0"-"\u0ec4","\u0ec6","\u0edc"-"\u0edd","\u0f00","\u0f40"-"\u0f47","\u0f49"-"\u0f6a","\u0f88"-"\u0f8b","\u1000"-"\u1021","\u1023"-"\u1027","\u1029"-"\u102a","\u1050"-"\u1055","\u10a0"-"\u10c5","\u10d0"-"\u10f6","\u1100"-"\u1159","\u115f"-"\u11a2","\u11a8"-"\u11f9","\u1200"-"\u1206","\u1208"-"\u1246","\u1248","\u124a"-"\u124d","\u1250"-"\u1256","\u1258","\u125a"-"\u125d","\u1260"-"\u1286","\u1288","\u128a"-"\u128d","\u1290"-"\u12ae","\u12b0","\u12b2"-"\u12b5","\u12b8"-"\u12be","\u12c0","\u12c2"-"\u12c5","\u12c8"-"\u12ce","\u12d0"-"\u12d6","\u12d8"-"\u12ee","\u12f0"-"\u130e","\u1310","\u1312"-"\u1315","\u1318"-"\u131e","\u1320"-"\u1346","\u1348"-"\u135a","\u13a0"-"\u13f4","\u1401"-"\u166c","\u166f"-"\u1676","\u1681"-"\u169a","\u16a0"-"\u16ea","\u1780"-"\u17b3","\u17db","\u1820"-"\u1877","\u1880"-"\u18a8","\u1e00"-"\u1e9b","\u1ea0"-"\u1ef9","\u1f00"-"\u1f15","\u1f18"-"\u1f1d","\u1f20"-"\u1f45","\u1f48"-"\u1f4d","\u1f50"-"\u1f57","\u1f59","\u1f5b","\u1f5d","\u1f5f"-"\u1f7d","\u1f80"-"\u1fb4","\u1fb6"-"\u1fbc","\u1fbe","\u1fc2"-"\u1fc4","\u1fc6"-"\u1fcc","\u1fd0"-"\u1fd3","\u1fd6"-"\u1fdb","\u1fe0"-"\u1fec","\u1ff2"-"\u1ff4","\u1ff6"-"\u1ffc","\u203f"-"\u2040","\u207f","\u20a0"-"\u20af","\u2102","\u2107","\u210a"-"\u2113","\u2115","\u2119"-"\u211d","\u2124","\u2126","\u2128","\u212a"-"\u212d","\u212f"-"\u2131","\u2133"-"\u2139","\u2160"-"\u2183","\u3005"-"\u3007","\u3021"-"\u3029","\u3031"-"\u3035","\u3038"-"\u303a","\u3041"-"\u3094","\u309d"-"\u309e","\u30a1"-"\u30fe","\u3105"-"\u312c","\u3131"-"\u318e","\u31a0"-"\u31b7","\u3400"-"\u4db5","\u4e00"-"\u9fa5","\ua000"-"\ua48c","\uac00"-"\ud7a3","\uf900"-"\ufa2d","\ufb00"-"\ufb06","\ufb13"-"\ufb17","\ufb1d","\ufb1f"-"\ufb28","\ufb2a"-"\ufb36","\ufb38"-"\ufb3c","\ufb3e","\ufb40"-"\ufb41","\ufb43"-"\ufb44","\ufb46"-"\ufbb1","\ufbd3"-"\ufd3d","\ufd50"-"\ufd8f","\ufd92"-"\ufdc7","\ufdf0"-"\ufdfb","\ufe33"-"\ufe34","\ufe4d"-"\ufe4f","\ufe69","\ufe70"-"\ufe72","\ufe74","\ufe76"-"\ufefc","\uff04","\uff21"-"\uff3a","\uff3f","\uff41"-"\uff5a","\uff65"-"\uffbe","\uffc2"-"\uffc7","\uffca"-"\uffcf","\uffd2"-"\uffd7","\uffda"-"\uffdc","\uffe0"-"\uffe1","\uffe5"-"\uffe6"]>
| <#PART_LETTER: ["\u0000"-"\b","\u000e"-"\u001b","$","0"-"9","A"-"Z","_","a"-"z","\u007f"-"\u009f","\u00a2"-"\u00a5","\u00aa","\u00b5","\u00ba","\u00c0"-"\u00d6","\u00d8"-"\u00f6","\u00f8"-"\u021f","\u0222"-"\u0233","\u0250"-"\u02ad","\u02b0"-"\u02b8","\u02bb"-"\u02c1","\u02d0"-"\u02d1","\u02e0"-"\u02e4","\u02ee","\u0300"-"\u034e","\u0360"-"\u0362","\u037a","\u0386","\u0388"-"\u038a","\u038c","\u038e"-"\u03a1","\u03a3"-"\u03ce","\u03d0"-"\u03d7","\u03da"-"\u03f3","\u0400"-"\u0481","\u0483"-"\u0486","\u048c"-"\u04c4","\u04c7"-"\u04c8","\u04cb"-"\u04cc","\u04d0"-"\u04f5","\u04f8"-"\u04f9","\u0531"-"\u0556","\u0559","\u0561"-"\u0587","\u0591"-"\u05a1","\u05a3"-"\u05b9","\u05bb"-"\u05bd","\u05bf","\u05c1"-"\u05c2","\u05c4","\u05d0"-"\u05ea","\u05f0"-"\u05f2","\u0621"-"\u063a","\u0640"-"\u0655","\u0660"-"\u0669","\u0670"-"\u06d3","\u06d5"-"\u06dc","\u06df"-"\u06e8","\u06ea"-"\u06ed","\u06f0"-"\u06fc","\u070f"-"\u072c","\u0730"-"\u074a","\u0780"-"\u07b0","\u0901"-"\u0903","\u0905"-"\u0939","\u093c"-"\u094d","\u0950"-"\u0954","\u0958"-"\u0963","\u0966"-"\u096f","\u0981"-"\u0983","\u0985"-"\u098c","\u098f"-"\u0990","\u0993"-"\u09a8","\u09aa"-"\u09b0","\u09b2","\u09b6"-"\u09b9","\u09bc","\u09be"-"\u09c4","\u09c7"-"\u09c8","\u09cb"-"\u09cd","\u09d7","\u09dc"-"\u09dd","\u09df"-"\u09e3","\u09e6"-"\u09f3","\u0a02","\u0a05"-"\u0a0a","\u0a0f"-"\u0a10","\u0a13"-"\u0a28","\u0a2a"-"\u0a30","\u0a32"-"\u0a33","\u0a35"-"\u0a36","\u0a38"-"\u0a39","\u0a3c","\u0a3e"-"\u0a42","\u0a47"-"\u0a48","\u0a4b"-"\u0a4d","\u0a59"-"\u0a5c","\u0a5e","\u0a66"-"\u0a74","\u0a81"-"\u0a83","\u0a85"-"\u0a8b","\u0a8d","\u0a8f"-"\u0a91","\u0a93"-"\u0aa8","\u0aaa"-"\u0ab0","\u0ab2"-"\u0ab3","\u0ab5"-"\u0ab9","\u0abc"-"\u0ac5","\u0ac7"-"\u0ac9","\u0acb"-"\u0acd","\u0ad0","\u0ae0","\u0ae6"-"\u0aef","\u0b01"-"\u0b03","\u0b05"-"\u0b0c","\u0b0f"-"\u0b10","\u0b13"-"\u0b28","\u0b2a"-"\u0b30","\u0b32"-"\u0b33","\u0b36"-"\u0b39","\u0b3c"-"\u0b43","\u0b47"-"\u0b48","\u0b4b"-"\u0b4d","\u0b56"-"\u0b57","\u0b5c"-"\u0b5d","\u0b5f"-"\u0b61","\u0b66"-"\u0b6f","\u0b82"-"\u0b83","\u0b85"-"\u0b8a","\u0b8e"-"\u0b90","\u0b92"-"\u0b95","\u0b99"-"\u0b9a","\u0b9c","\u0b9e"-"\u0b9f","\u0ba3"-"\u0ba4","\u0ba8"-"\u0baa","\u0bae"-"\u0bb5","\u0bb7"-"\u0bb9","\u0bbe"-"\u0bc2","\u0bc6"-"\u0bc8","\u0bca"-"\u0bcd","\u0bd7","\u0be7"-"\u0bef","\u0c01"-"\u0c03","\u0c05"-"\u0c0c","\u0c0e"-"\u0c10","\u0c12"-"\u0c28","\u0c2a"-"\u0c33","\u0c35"-"\u0c39","\u0c3e"-"\u0c44","\u0c46"-"\u0c48","\u0c4a"-"\u0c4d","\u0c55"-"\u0c56","\u0c60"-"\u0c61","\u0c66"-"\u0c6f","\u0c82"-"\u0c83","\u0c85"-"\u0c8c","\u0c8e"-"\u0c90","\u0c92"-"\u0ca8","\u0caa"-"\u0cb3","\u0cb5"-"\u0cb9","\u0cbe"-"\u0cc4","\u0cc6"-"\u0cc8","\u0cca"-"\u0ccd","\u0cd5"-"\u0cd6","\u0cde","\u0ce0"-"\u0ce1","\u0ce6"-"\u0cef","\u0d02"-"\u0d03","\u0d05"-"\u0d0c","\u0d0e"-"\u0d10","\u0d12"-"\u0d28","\u0d2a"-"\u0d39","\u0d3e"-"\u0d43","\u0d46"-"\u0d48","\u0d4a"-"\u0d4d","\u0d57","\u0d60"-"\u0d61","\u0d66"-"\u0d6f","\u0d82"-"\u0d83","\u0d85"-"\u0d96","\u0d9a"-"\u0db1","\u0db3"-"\u0dbb","\u0dbd","\u0dc0"-"\u0dc6","\u0dca","\u0dcf"-"\u0dd4","\u0dd6","\u0dd8"-"\u0ddf","\u0df2"-"\u0df3","\u0e01"-"\u0e3a","\u0e3f"-"\u0e4e","\u0e50"-"\u0e59","\u0e81"-"\u0e82","\u0e84","\u0e87"-"\u0e88","\u0e8a","\u0e8d","\u0e94"-"\u0e97","\u0e99"-"\u0e9f","\u0ea1"-"\u0ea3","\u0ea5","\u0ea7","\u0eaa"-"\u0eab","\u0ead"-"\u0eb9","\u0ebb"-"\u0ebd","\u0ec0"-"\u0ec4","\u0ec6","\u0ec8"-"\u0ecd","\u0ed0"-"\u0ed9","\u0edc"-"\u0edd","\u0f00","\u0f18"-"\u0f19","\u0f20"-"\u0f29","\u0f35","\u0f37","\u0f39","\u0f3e"-"\u0f47","\u0f49"-"\u0f6a","\u0f71"-"\u0f84","\u0f86"-"\u0f8b","\u0f90"-"\u0f97","\u0f99"-"\u0fbc","\u0fc6","\u1000"-"\u1021","\u1023"-"\u1027","\u1029"-"\u102a","\u102c"-"\u1032","\u1036"-"\u1039","\u1040"-"\u1049","\u1050"-"\u1059","\u10a0"-"\u10c5","\u10d0"-"\u10f6","\u1100"-"\u1159","\u115f"-"\u11a2","\u11a8"-"\u11f9","\u1200"-"\u1206","\u1208"-"\u1246","\u1248","\u124a"-"\u124d","\u1250"-"\u1256","\u1258","\u125a"-"\u125d","\u1260"-"\u1286","\u1288","\u128a"-"\u128d","\u1290"-"\u12ae","\u12b0","\u12b2"-"\u12b5","\u12b8"-"\u12be","\u12c0","\u12c2"-"\u12c5","\u12c8"-"\u12ce","\u12d0"-"\u12d6","\u12d8"-"\u12ee","\u12f0"-"\u130e","\u1310","\u1312"-"\u1315","\u1318"-"\u131e","\u1320"-"\u1346","\u1348"-"\u135a","\u1369"-"\u1371","\u13a0"-"\u13f4","\u1401"-"\u166c","\u166f"-"\u1676","\u1681"-"\u169a","\u16a0"-"\u16ea","\u1780"-"\u17d3","\u17db","\u17e0"-"\u17e9","\u180b"-"\u180e","\u1810"-"\u1819","\u1820"-"\u1877","\u1880"-"\u18a9","\u1e00"-"\u1e9b","\u1ea0"-"\u1ef9","\u1f00"-"\u1f15","\u1f18"-"\u1f1d","\u1f20"-"\u1f45","\u1f48"-"\u1f4d","\u1f50"-"\u1f57","\u1f59","\u1f5b","\u1f5d","\u1f5f"-"\u1f7d","\u1f80"-"\u1fb4","\u1fb6"-"\u1fbc","\u1fbe","\u1fc2"-"\u1fc4","\u1fc6"-"\u1fcc","\u1fd0"-"\u1fd3","\u1fd6"-"\u1fdb","\u1fe0"-"\u1fec","\u1ff2"-"\u1ff4","\u1ff6"-"\u1ffc","\u200c"-"\u200f","\u202a"-"\u202e","\u203f"-"\u2040","\u206a"-"\u206f","\u207f","\u20a0"-"\u20af","\u20d0"-"\u20dc","\u20e1","\u2102","\u2107","\u210a"-"\u2113","\u2115","\u2119"-"\u211d","\u2124","\u2126","\u2128","\u212a"-"\u212d","\u212f"-"\u2131","\u2133"-"\u2139","\u2160"-"\u2183","\u3005"-"\u3007","\u3021"-"\u302f","\u3031"-"\u3035","\u3038"-"\u303a","\u3041"-"\u3094","\u3099"-"\u309a","\u309d"-"\u309e","\u30a1"-"\u30fe","\u3105"-"\u312c","\u3131"-"\u318e","\u31a0"-"\u31b7","\u3400"-"\u4db5","\u4e00"-"\u9fa5","\ua000"-"\ua48c","\uac00"-"\ud7a3","\uf900"-"\ufa2d","\ufb00"-"\ufb06","\ufb13"-"\ufb17","\ufb1d"-"\ufb28","\ufb2a"-"\ufb36","\ufb38"-"\ufb3c","\ufb3e","\ufb40"-"\ufb41","\ufb43"-"\ufb44","\ufb46"-"\ufbb1","\ufbd3"-"\ufd3d","\ufd50"-"\ufd8f","\ufd92"-"\ufdc7","\ufdf0"-"\ufdfb","\ufe20"-"\ufe23","\ufe33"-"\ufe34","\ufe4d"-"\ufe4f","\ufe69","\ufe70"-"\ufe72","\ufe74","\ufe76"-"\ufefc","\ufeff","\uff04","\uff10"-"\uff19","\uff21"-"\uff3a","\uff3f","\uff41"-"\uff5a","\uff65"-"\uffbe","\uffc2"-"\uffc7","\uffca"-"\uffcf","\uffd2"-"\uffd7","\uffda"-"\uffdc","\uffe0"-"\uffe1","\uffe5"-"\uffe6","\ufff9"-"\ufffb"]>
}

   

NON-TERMINALS

/************************************************
 * THE JAVACC GRAMMAR SPECIFICATION STARTS HERE *
 ************************************************/
javacc_input ::= javacc_options "PARSER_BEGIN" "(" identifier ")" CompilationUnit "PARSER_END" "(" identifier ")" ( production )+ <EOF>
javacc_options ::= ( <IDENTIFIER> "{" ( option_binding )* "}" )?
option_binding ::= ( <IDENTIFIER> | "LOOKAHEAD" | "IGNORE_CASE" | "static" ) "=" ( IntegerLiteral | BooleanLiteral | StringLiteral ) ";"
production ::= javacode_production
| regular_expr_production
| token_manager_decls
| bnf_production
javacode_production ::= "JAVACODE" AccessModifier ResultType identifier FormalParameters ( "throws" Name ( "," Name )* )? Block
bnf_production ::= AccessModifier ResultType identifier FormalParameters ( "throws" Name ( "," Name )* )? ":" Block "{" expansion_choices "}"
AccessModifier ::= ( "public" | "protected" | "private" )?
regular_expr_production ::= ( "<" "*" ">" | "<" <IDENTIFIER> ( "," <IDENTIFIER> )* ">" )? regexpr_kind ( "[" "IGNORE_CASE" "]" )? ":" "{" regexpr_spec ( "|" regexpr_spec )* "}"
token_manager_decls ::= "TOKEN_MGR_DECLS" ":" ClassOrInterfaceBody
regexpr_kind ::= "TOKEN"
| "SPECIAL_TOKEN"
| "SKIP"
| "MORE"
regexpr_spec ::= regular_expression ( Block )? ( ":" <IDENTIFIER> )?
expansion_choices ::= expansion ( "|" expansion )*
expansion ::= ( "LOOKAHEAD" "(" local_lookahead ")" )? ( expansion_unit )+
local_lookahead ::= ( IntegerLiteral )? ( "," )? ( expansion_choices )? ( "," )? ( "{" Expression "}" )?
expansion_unit ::= "LOOKAHEAD" "(" local_lookahead ")"
| Block
| "[" expansion_choices "]"
| "try" "{" expansion_choices "}" ( "catch" "(" Name <IDENTIFIER> ")" Block )* ( "finally" Block )?
| ( PrimaryExpression "=" )? ( identifier Arguments | regular_expression ( "." <IDENTIFIER> )? )
| "(" expansion_choices ")" ( "+" | "*" | "?" )?
regular_expression ::= StringLiteral
| <LANGLE: "<"> ( ( "#" )? identifier ":" )? complex_regular_expression_choices <RANGLE: ">">
| "<" identifier ">"
| "<" "EOF" ">"
complex_regular_expression_choices ::= complex_regular_expression ( "|" complex_regular_expression )*
complex_regular_expression ::= ( complex_regular_expression_unit )+
complex_regular_expression_unit ::= StringLiteral
| "<" identifier ">"
| character_list
| "(" complex_regular_expression_choices ")" ( "+" | "*" | "?" | "{" IntegerLiteral ( "," ( IntegerLiteral )? )? "}" )?
character_list ::= ( "~" )? "[" ( character_descriptor ( "," character_descriptor )* )? "]"
character_descriptor ::= StringLiteral ( "-" StringLiteral )?
identifier ::= <IDENTIFIER>
/**********************************************
 * THE JAVA GRAMMAR SPECIFICATION STARTS HERE *
 **********************************************/

/*
 * The Java grammar is modified to use sequences of tokens
 * for the missing tokens - those that include "<<" and ">>".
 */

/*
 * The following production defines Java identifiers - it
 * includes the reserved words of JavaCC also.
 */
JavaIdentifier ::= ( <IDENTIFIER> | "LOOKAHEAD" | "IGNORE_CASE" | "PARSER_BEGIN" | "PARSER_END" | "JAVACODE" | "TOKEN" | "SPECIAL_TOKEN" | "MORE" | "SKIP" | "TOKEN_MGR_DECLS" | "EOF" )
/*
 * Program structuring syntax follows.
 */
CompilationUnit ::= ( PackageDeclaration )? ( ImportDeclaration )* ( TypeDeclaration )*
PackageDeclaration ::= Modifiers "package" Name ";"
ImportDeclaration ::= "import" ( "static" )? Name ( "." "*" )? ";"
/*
 * Modifiers. We match all modifiers in a single rule to reduce the chances of
 * syntax errors for simple modifier mistakes. It will also enable us to give
 * better error messages.
 */
Modifiers ::= ( ( "public" | "static" | "protected" | "private" | "final" | "abstract" | "synchronized" | "native" | "transient" | "volatile" | "strictfp" | Annotation ) )*
/*
 * Declaration syntax follows.
 */
TypeDeclaration ::= ";"
| Modifiers ( ClassOrInterfaceDeclaration | EnumDeclaration | AnnotationTypeDeclaration )
ClassOrInterfaceDeclaration ::= ( "class" | "interface" ) <IDENTIFIER> ( TypeParameters )? ( ExtendsList )? ( ImplementsList )? ClassOrInterfaceBody
ExtendsList ::= "extends" ClassOrInterfaceType ( "," ClassOrInterfaceType )*
ImplementsList ::= "implements" ClassOrInterfaceType ( "," ClassOrInterfaceType )*
EnumDeclaration ::= "enum" <IDENTIFIER> ( ImplementsList )? EnumBody
EnumBody ::= "{" ( EnumConstant ( "," EnumConstant )* )? ( "," )? ( ";" ( ClassOrInterfaceBodyDeclaration )* )? "}"
EnumConstant ::= Modifiers <IDENTIFIER> ( Arguments )? ( ClassOrInterfaceBody )?
TypeParameters ::= "<" TypeParameter ( "," TypeParameter )* ">"
TypeParameter ::= <IDENTIFIER> ( TypeBound )?
TypeBound ::= "extends" ClassOrInterfaceType ( "&" ClassOrInterfaceType )*
ClassOrInterfaceBody ::= "{" ( ClassOrInterfaceBodyDeclaration )* "}"
ClassOrInterfaceBodyDeclaration ::= Initializer
| Modifiers ( ClassOrInterfaceDeclaration | EnumDeclaration | ConstructorDeclaration | FieldDeclaration | MethodDeclaration )
| ";"
FieldDeclaration ::= Type VariableDeclarator ( "," VariableDeclarator )* ";"
VariableDeclarator ::= VariableDeclaratorId ( "=" VariableInitializer )?
VariableDeclaratorId ::= <IDENTIFIER> ( "[" "]" )*
VariableInitializer ::= ArrayInitializer
| Expression
ArrayInitializer ::= "{" ( VariableInitializer ( "," VariableInitializer )* )? ( "," )? "}"
MethodDeclaration ::= ( TypeParameters )? ResultType MethodDeclarator ( "throws" NameList )? ( Block | ";" )
MethodDeclarator ::= <IDENTIFIER> FormalParameters ( "[" "]" )*
FormalParameters ::= "(" ( FormalParameter ( "," FormalParameter )* )? ")"
FormalParameter ::= Modifiers Type ( "..." )? VariableDeclaratorId
ConstructorDeclaration ::= ( TypeParameters )? <IDENTIFIER> FormalParameters ( "throws" NameList )? "{" ( ExplicitConstructorInvocation )? ( BlockStatement )* "}"
ExplicitConstructorInvocation ::= "this" Arguments ";"
| ( PrimaryExpression "." )? "super" Arguments ";"
Initializer ::= ( "static" )? Block
/*
 * Type, name and expression syntax follows.
 */
Type ::= ReferenceType
| PrimitiveType
ReferenceType ::= PrimitiveType ( "[" "]" )+
| ( ClassOrInterfaceType ) ( "[" "]" )*
ClassOrInterfaceType ::= <IDENTIFIER> ( TypeArguments )? ( "." <IDENTIFIER> ( TypeArguments )? )*
TypeArguments ::= "<" TypeArgument ( "," TypeArgument )* ">"
TypeArgument ::= ReferenceType
| "?" ( WildcardBounds )?
WildcardBounds ::= "extends" ReferenceType
| "super" ReferenceType
PrimitiveType ::= "boolean"
| "char"
| "byte"
| "short"
| "int"
| "long"
| "float"
| "double"
ResultType ::= ( "void" | Type )
Name ::= JavaIdentifier ( "." JavaIdentifier )*
NameList ::= Name ( "," Name )*
/*
 * Expression syntax follows.
 */
Expression ::= ConditionalExpression ( AssignmentOperator Expression )?
AssignmentOperator ::= "="
| "*="
| "/="
| "%="
| "+="
| "-="
| "<<="
| ">>="
| ">>>="
| "&="
| "^="
| "|="
ConditionalExpression ::= ConditionalOrExpression ( "?" Expression ":" Expression )?
ConditionalOrExpression ::= ConditionalAndExpression ( "||" ConditionalAndExpression )*
ConditionalAndExpression ::= InclusiveOrExpression ( "&&" InclusiveOrExpression )*
InclusiveOrExpression ::= ExclusiveOrExpression ( "|" ExclusiveOrExpression )*
ExclusiveOrExpression ::= AndExpression ( "^" AndExpression )*
AndExpression ::= EqualityExpression ( "&" EqualityExpression )*
EqualityExpression ::= InstanceOfExpression ( ( "==" | "!=" ) InstanceOfExpression )*
InstanceOfExpression ::= RelationalExpression ( "instanceof" Type )?
RelationalExpression ::= ShiftExpression ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression )*
ShiftExpression ::= AdditiveExpression ( ( "<<" | RSIGNEDSHIFT | RUNSIGNEDSHIFT ) AdditiveExpression )*
AdditiveExpression ::= MultiplicativeExpression ( ( "+" | "-" ) MultiplicativeExpression )*
MultiplicativeExpression ::= UnaryExpression ( ( "*" | "/" | "%" ) UnaryExpression )*
UnaryExpression ::= ( "+" | "-" ) UnaryExpression
| PreIncrementExpression
| PreDecrementExpression
| UnaryExpressionNotPlusMinus
PreIncrementExpression ::= "++" PrimaryExpression
PreDecrementExpression ::= "--" PrimaryExpression
UnaryExpressionNotPlusMinus ::= ( "~" | "!" ) UnaryExpression
| CastExpression
| PostfixExpression
// This production is to determine lookahead only.  The LOOKAHEAD specifications
// below are not used, but they are there just to indicate that we know about
// this.
CastLookahead ::= "(" PrimitiveType
| "(" Type "[" "]"
| "(" Type ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal )
PostfixExpression ::= PrimaryExpression ( "++" | "--" )?
CastExpression ::= "(" Type ")" UnaryExpression
| "(" Type ")" UnaryExpressionNotPlusMinus
PrimaryExpression ::= PrimaryPrefix ( PrimarySuffix )*
MemberSelector ::= "." TypeArguments <IDENTIFIER>
PrimaryPrefix ::= Literal
| "this"
| "super" "." <IDENTIFIER>
| "(" Expression ")"
| AllocationExpression
| ResultType "." "class"
| Name
PrimarySuffix ::= "." "this"
| "." AllocationExpression
| MemberSelector
| "[" Expression "]"
| "." <IDENTIFIER>
| Arguments
Literal ::= <INTEGER_LITERAL>
| <FLOATING_POINT_LITERAL>
| <CHARACTER_LITERAL>
| <STRING_LITERAL>
| BooleanLiteral
| NullLiteral
IntegerLiteral ::= <INTEGER_LITERAL>
BooleanLiteral ::= "true"
| "false"
StringLiteral ::= <STRING_LITERAL>
NullLiteral ::= "null"
Arguments ::= "(" ( ArgumentList )? ")"
ArgumentList ::= Expression ( "," Expression )*
AllocationExpression ::= "new" PrimitiveType ArrayDimsAndInits
| "new" ClassOrInterfaceType ( TypeArguments )? ( ArrayDimsAndInits | Arguments ( ClassOrInterfaceBody )? )
/*
 * The third LOOKAHEAD specification below is to parse to PrimarySuffix
 * if there is an expression between the "[...]".
 */
ArrayDimsAndInits ::= ( "[" Expression "]" )+ ( "[" "]" )*
| ( "[" "]" )+ ArrayInitializer
/*
 * Statement syntax follows.
 */
Statement ::= LabeledStatement
| AssertStatement
| Block
| EmptyStatement
| StatementExpression ";"
| SwitchStatement
| IfStatement
| WhileStatement
| DoStatement
| ForStatement
| BreakStatement
| ContinueStatement
| ReturnStatement
| ThrowStatement
| SynchronizedStatement
| TryStatement
AssertStatement ::= "assert" Expression ( ":" Expression )? ";"
LabeledStatement ::= <IDENTIFIER> ":" Statement
Block ::= "{" ( BlockStatement )* "}"
BlockStatement ::= LocalVariableDeclaration ";"
| Statement
| ClassOrInterfaceDeclaration
LocalVariableDeclaration ::= Modifiers Type VariableDeclarator ( "," VariableDeclarator )*
EmptyStatement ::= ";"
StatementExpression ::= PreIncrementExpression
| PreDecrementExpression
| PrimaryExpression ( "++" | "--" | AssignmentOperator Expression )?
SwitchStatement ::= "switch" "(" Expression ")" "{" ( SwitchLabel ( BlockStatement )* )* "}"
SwitchLabel ::= "case" Expression ":"
| "default" ":"
IfStatement ::= "if" "(" Expression ")" Statement ( "else" Statement )?
WhileStatement ::= "while" "(" Expression ")" Statement
DoStatement ::= "do" Statement "while" "(" Expression ")" ";"
ForStatement ::= "for" "(" ( Modifiers Type <IDENTIFIER> ":" Expression | ( ForInit )? ";" ( Expression )? ";" ( ForUpdate )? ) ")" Statement
ForInit ::= LocalVariableDeclaration
| StatementExpressionList
StatementExpressionList ::= StatementExpression ( "," StatementExpression )*
ForUpdate ::= StatementExpressionList
BreakStatement ::= "break" ( <IDENTIFIER> )? ";"
ContinueStatement ::= "continue" ( <IDENTIFIER> )? ";"
ReturnStatement ::= "return" ( Expression )? ";"
ThrowStatement ::= "throw" Expression ";"
SynchronizedStatement ::= "synchronized" "(" Expression ")" Block
TryStatement ::= "try" Block ( "catch" "(" FormalParameter ")" Block )* ( "finally" Block )?
/* We use productions to match >>>, >> and > so that we can keep the
 * type declaration syntax with generics clean
 */
RUNSIGNEDSHIFT ::= ( ">" ">" ">" )
RSIGNEDSHIFT ::= ( ">" ">" )
/* Annotation syntax follows. */
Annotation ::= NormalAnnotation
| SingleMemberAnnotation
| MarkerAnnotation
NormalAnnotation ::= "@" Name "(" ( MemberValuePairs )? ")"
MarkerAnnotation ::= "@" Name
SingleMemberAnnotation ::= "@" Name "(" MemberValue ")"
MemberValuePairs ::= MemberValuePair ( "," MemberValuePair )*
MemberValuePair ::= <IDENTIFIER> "=" MemberValue
MemberValue ::= Annotation
| MemberValueArrayInitializer
| ConditionalExpression
MemberValueArrayInitializer ::= "{" MemberValue ( "," MemberValue )* ( "," )? "}"
/* Annotation Types. */
AnnotationTypeDeclaration ::= "@" "interface" <IDENTIFIER> AnnotationTypeBody
AnnotationTypeBody ::= "{" ( AnnotationTypeMemberDeclaration )* "}"
AnnotationTypeMemberDeclaration ::= Modifiers ( Type <IDENTIFIER> "(" ")" ( DefaultValue )? ";" | ClassOrInterfaceDeclaration | EnumDeclaration | AnnotationTypeDeclaration | FieldDeclaration )
| ( ";" )
DefaultValue ::= "default" MemberValue
javacc-5.0.orig/www/doc/jjtreeintro.html0000644000175000017500000004730511072754253017365 0ustar mkochmkoch JavaCC: JJTree Introduction

JavaCC [tm]: JJTree Introduction

JJTree is a preprocessor for JavaCC [tm] that inserts parse tree building actions
at various places in the JavaCC source. The output of JJTree is run through
JavaCC to create the parser. This document describes how to use JJTree, and
how you can interface your parser to it.

By default, JJTree generates code to construct parse tree nodes for each
nonterminal in the language. This behavior can be modified so that some
nonterminals do not have nodes generated, or so that a node is generated for a
part of a production's expansion.

JJTree defines a Java interface Node that all parse tree nodes must
implement. The interface provides methods for operations such as setting the
parent of the node, and for adding children and retrieving them.

JJTree operates in one of two modes, simple and multi (for want of better
terms). In simple mode, each parse tree node is of concrete type SimpleNode; in
multi mode, the type of the parse tree node is derived from the name of the
node. If you don't provide implementations for the node classes JJTree will
generate sample implementations based on SimpleNode for you. You can then
modify the implementations to suit.

Although JavaCC is a top-down parser, JJTree constructs the parse tree from
the bottom up. To do this it uses a stack where it pushes nodes after they
have been created. When it finds a parent for them, it pops the children from
the stack and adds them to the parent, and finally pushes the new parent node
itself. The stack is open, which means that you have access to it from within
grammar actions: you can push, pop and otherwise manipulate its contents
however you feel appropriate. See Node Scopes and User Actions below for more
important information.

JJTree provides decorations for two basic varieties of nodes, and some
syntactic shorthand to make their use convenient.
     1.

        A definite node is constructed with a specific number of
        children. That many nodes are popped from the stack and made the
        children of the new node, which is then pushed on the stack
        itself. You notate a definite node like this:

        #ADefiniteNode(INTEGER EXPRESSION)

        A definite node descriptor expression can be any integer expression,
        although literal integer constants are by far the most common
        expressions.
     2.

        A conditional node is constructed with all of the children that were
        pushed on the stack within its node scope if and only if its condition
        evaluates to true. If it evaluates to false, the node is not
        constructed, and all of the children remain on the node stack. You
        notate a conditional node like this:

        #ConditionalNode(BOOLEAN EXPRESSION)

        A conditional node descriptor expression can be any boolean
        expression. There are two common shorthands for conditional nodes:
         1)

            Indefinite nodes

            #IndefiniteNode is short for #IndefiniteNode(true)
         2)

            Greater-than nodes

            #GTNode(>1) is short for #GTNode(jjtree.arity() > 1)

        The indefinite node shorthand (1) can lead to ambiguities in the
        JJTree source when it is followed by a parenthesized expansion. In
        those cases the shorthand must be replaced by the full expression. For
        example:


        	  ( ... ) #N ( a() )

        is ambiguous; you have to use the explicit condition:

                  ( ... ) #N(true) ( a() )

WARNING: node descriptor expression should not have side-effects. JJTree
doesn't specify how many times the expression will be evaluated.

By default JJTree treats each nonterminal as an indefinite node and derives
the name of the node from the name of its production. You can give it a
different name with the following syntax:


    void P1() #MyNode : { ... } { ... }

When the parser recognizes a P1 nonterminal it begins an indefinite node. It
marks the stack, so that any parse tree nodes created and pushed on the stack
by nonterminals in the expansion for P1 will be popped off and made children
of the node MyNode.

If you want to suppress the creation of a node for a production, you can use
the following syntax:


    void P2() #void : { ... } { ... }

Now any parse tree nodes pushed by nonterminals in the expansion of P2 will
remain on the stack, to be popped and made children of a production further up
the tree. You can make this the default behavior for non-decorated nodes by
using the NODE_DEFAULT_VOID option.


    void P3() : {}
    {
        P4() ( P5() )+ P6()
    }

In this example, an indefinite node P3 is begun, marking the stack, and then a
P4 node, one or more P5 nodes and a P6 node are parsed. Any nodes that they
push are popped and made the children of P3. You can further customize the
generated tree:


    void P3() : {}
    {
        P4() ( P5() )+ #ListOfP5s P6()
    }

Now the P3 node will have a P4 node, a ListOfP5s node and a P6 node as
children. The #Name construct acts as a postfix operator, and its scope is the
immediately preceding expansion unit.

Node Scopes and User Actions

Each node is associated with a node scope. User actions within this scope can
access the node under construction by using the special identifier jjtThis to
refer to the node. This identifier is implicitly declared to be of the correct
type for the node, so any fields and methods that the node has can be easily
accessed.

A scope is the expansion unit immediately preceding the node decoration. This
can be a parenthesized expression. When the production signature is decorated
(perhaps implicitly with the default node), the scope is the entire right hand
side of the production including its declaration block.

You can also use an expression involving jjtThis on the left hand side of an
expansion reference. For example:


    ... ( jjtThis.my_foo = foo() ) #Baz ...

Here jjtThis refers to a Baz node, which has a field called my_foo. The result
of parsing the production foo() is assigned to that my_foo.

The final user action in a node scope is different from all the others. When
the code within it executes, the node's children have already been popped from
the stack and added to the node, which has itself been pushed onto the
stack. The children can now be accessed via the node's methods such as
jjtGetChild().

User actions other than the final one can only access the children on the
stack. They have not yet been added to the node, so they aren't available via
the node's methods.

A conditional node that has a node descriptor expression that evaluates to
false will not get added to the stack, nor have children added to it. The
final user action within a conditional node scope can determine whether the
node was created or not by calling the nodeCreated() method. This returns true
if the node's condition was satisfied and the node was created and pushed on
the node stack, and false otherwise.

Exception handling

An exception thrown by an expansion within a node scope that is not caught
within the node scope is caught by JJTree itself. When this occurs, any nodes
that have been pushed on to the node stack within the node scope are popped
and thrown away. Then the exception is rethrown.

The intention is to make it possible for parsers to implement error recovery
and continue with the node stack in a known state.

WARNING: JJTree currently cannot detect whether exceptions are thrown from
user actions within a node scope. Such an exception will probably be handled
incorrectly.

Node Scope Hooks

If the NODE_SCOPE_HOOK option is set to true, JJTree generates calls to two
user-defined parser methods on the entry and exit of every node scope. The
methods must have the following signatures:


    void jjtreeOpenNodeScope(Node n)
    void jjtreeCloseNodeScope(Node n)

If the parser is STATIC then these methods will have to be declared as static
as well. They are both called with the current node as a parameter.

One use for these functions is to store the node's first and last tokens so
that the input can be easily reproduced again. For example:


    void jjtreeOpenNodeScope(Node n)
    {
      ((MySimpleNode)n).first_token = getToken(1);
    }

    void jjtreeCloseNodeScope(Node n)
    {
      ((MySimpleNode)n).last_token = getToken(0);
    }

where MySimpleNode is based on SimpleNode and has the following additional
fields:


    Token first_token, last_token;

Another use might be to store the parser object itself in the node so that
state that should be shared by all nodes produced by that parser can be
provided. For example, the parser might maintain a symbol table.

The Life Cycle of a Node

A node goes through a well determined sequence of steps as it is built. The
following
is that sequence viewed from the perspective of the node itself:
     1. the node's constructor is called with a unique integer parameter. This
        parameter identifies the kind of node and is especially useful in
        simple mode. JJTree automatically generates a file called
        parserTreeConstants.java and declares Java constants for the node
        identifiers. It also declares an array of Strings called jjtNodeName[]
        which maps the identifier integers to the names of the nodes.
     2. the node's jjtOpen() method is called.
     3. if the option NODE_SCOPE_HOOK is set, the user-defined parser method
        openNodeScope() is called and passed the node as its parameter. This
        method can initialize fields in the node or call its methods. For
        example, it might store the node's first token in the node.
     4. if an unhandled exception is thrown while the node is being parsed
        then the node is abandoned. JJTree will never refer to it again. It
        will not be closed, and the user-defined node scope hook
        closeNodeHook() will not be called with it as a parameter.
     5. otherwise, if the node is conditional and its conditional expression
        evaluates to false then the node is abandoned. It will not be closed,
        although the user-defined node scope hook closeNodeHook() might be
        called with it as a parameter.
     6. otherwise, all of the children of the node as specified by the integer
        expression of a definite node, or all the nodes that were pushed on
        the stack within a conditional node scope are added to the node. The
        order they are added is not specified.
     7. the node's jjtClose() method is called.
     8. the node is pushed on the stack.
     9. if the option NODE_SCOPE_HOOK is set, the user-defined parser method
        closenNodeScope() is called and passed the node as its parameter.
    10. if the node is not the root node, it is added as a child of another
        node and its jjtSetParent() method is called.

Visitor Support

JJTree provides some basic support for the visitor design pattern. If the
VISITOR option is set to true, JJTree will insert an jjtAccept() method into
all of the node classes it generates, and also generate a visitor interface
that can be implemented and passed to the nodes to accept.

The name of the visitor interface is constructed by appending Visitor to the
name of the parser. The interface is regenerated every time that JJTree is
run, so that it accurately represents the set of nodes used by the
parser. This will cause compile time errors if the implementation class has
not been updated for the new nodes. This is a feature.

Options

JJTree 0.3pre4 supports the following options on the command line and in the
JavaCC options statement:

    BUILD_NODE_FILES (default: true)
      Generate sample implementations for SimpleNode and any other nodes used
      in the grammar.

    MULTI (default: false)
      Generate a multi mode parse tree. The default for this is false,
      generating a simple mode parse tree.

    NODE_DEFAULT_VOID (default: false)
      Instead of making each non-decorated production an indefinite node, make
      it void instead.

    NODE_CLASS (default: "")
      If set defines the name of a user-supplied class that will extend
      SimpleNode. Any tree nodes created will then be subclasses of NODE_CLASS.

    NODE_FACTORY (default: "")
      Specify a class containing a factory method with following signature
      to construct nodes:
        public static Node jjtCreate(int id)
      For backwards compatibility, the value "false" may also be specified,
      meaning that SimpleNode will be used as the factory class.

    NODE_PACKAGE (default: "")
      The package to generate the node classes into. The default for this is
      the parser package.

    NODE_EXTENDS (default: "") (DEPRECATED)
      The superclass for the SimpleNode class.  By providing a custom
      superclass you may be able to avoid the need to edit the generated
      SimpleNode.java.  See the examples/Interpreter for an example usage.

    NODE_PREFIX (default: "AST")
      The prefix used to construct node class names from node identifiers in
      multi mode. The default for this is AST.

    NODE_SCOPE_HOOK (default: false)
      Insert calls to user-defined parser methods on entry and exit of every
      node scope. See Node Scope Hooks above.

    NODE_USES_PARSER (default: false)
      JJTree will use an alternate form of the node construction routines
      where it passes the parser object in. For example,

      public static Node MyNode.jjtCreate(MyParser p, int id);
      MyNode(MyParser p, int id);

    TRACK_TOKENS (default: false)
      Insert jjtGetFirstToken(), jjtSetFirstToken(), jjtGetLastToken() and
      jjtSetLastToken() methods in SimpleNode. The firstToken is automatically
      set up on entry to a node scope; the endToken is automatically set
      up on exit from a node scope.

    STATIC (default: true)
      Generate code for a static parser. The default for this is true. This
      must be used consistently with the equivalent JavaCC options. The value
      of this option is emitted in the JavaCC source.

    VISITOR (default: false)
      Insert a jjtAccept() method in the node classes, and generate a visitor
      implementation with an entry for every node type used in the grammar.

    VISITOR_DATA_TYPE (default: "Object")
      If this option is set, it is used in the signature of the
      generated jjtAccept() methods and the visit() methods as the type of the
      "data" argument.

    VISITOR_RETURN_TYPE (default: "Object")
      If this option is set, it is used in the signature of the generated
      jjtAccept() methods and the visit() methods as the return type of the
      method.

    VISITOR_EXCEPTION (default: "")
      If this option is set, it is used in the signature of the generated
      jjtAccept() methods and the visit() methods.

JJTree state

JJTree keeps its state in a parser class field called jjtree. You can use
methods in this member to manipulate the node stack.


    final class JJTreeState {
      /* Call this to reinitialize the node stack.  */
      void reset();

      /* Return the root node of the AST. */
      Node rootNode();

      /* Determine whether the current node was actually closed and
	 pushed */
      boolean nodeCreated();

      /* Return the number of nodes currently pushed on the node
         stack in the current node scope. */
      int arity();

      /* Push a node on to the stack. */
      void pushNode(Node n);

      /* Return the node on the top of the stack, and remove it from the
	 stack.  */
      Node popNode();

      /* Return the node currently on the top of the stack. */
      Node peekNode();
    }

Node Objects


    /* All AST nodes must implement this interface.  It provides basic
       machinery for constructing the parent and child relationships
       between nodes. */

    public interface Node {
      /** This method is called after the node has been made the current
	node.  It indicates that child nodes can now be added to it. */
      public void jjtOpen();

      /** This method is called after all the child nodes have been
	added. */
      public void jjtClose();

      /** This pair of methods are used to inform the node of its
	parent. */
      public void jjtSetParent(Node n);
      public Node jjtGetParent();

      /** This method tells the node to add its argument to the node's
	list of children.  */
      public void jjtAddChild(Node n, int i);

      /** This method returns a child node.  The children are numbered
	 from zero, left to right. */
      public Node jjtGetChild(int i);

      /** Return the number of children the node has. */
      int jjtGetNumChildren();
    }

The class SimpleNode implements the Node interface, and is automatically
generated by JJTree if it doesn't already exist. You can use this class as a
template or superclass for your node implementations, or you can modify it to
suit. SimpleNode additionally provides a rudimentary mechanism for recursively
dumping the node and its children. You might use this is in action like this:


    {
        ((SimpleNode)jjtree.rootNode()).dump(">");
    }

The String parameter to dump() is used as padding to indicate the tree
hierarchy.

Another utility method is generated if the VISITOR options is set:


    {
        public void childrenAccept(MyParserVisitor visitor);
    }

This walks over the node's children in turn, asking them to accept the
visitor. This can be useful when implementing preorder and postorder
traversals.

More Documentation

Jocelyn Paine has contributed a very nice introduction to JJTree where he
describes how he has used it to develop an extension to HTML for interactive
web pages: http://users.ox.ac.uk/~popx/jjtree.html

Examples

JJTree 0.3pre3 is distributed with some simple examples containing a grammar
that parses arithmetic expressions. See the file
examples/JJTreeExamples/README for further details.

There is also an interpreter for a simple language that uses JJTree to build
the program representation. See the file examples/Interpreter/README for more
information.

A grammar for HTML 3.2 is also included in the distribution. See
examples/HTMLGrammars/RobsHTML/README to find out more.

Information about an example using the visitor support is in
examples/VTransformer/README.
javacc-5.0.orig/www/doc/simpleREADME.html0000644000175000017500000004105510604215626017165 0ustar mkochmkoch JavaCC README for SimpleExamples

JavaCC [tm]: README for SimpleExamples

This directory contains five examples to get you started using JavaCC. Each example is contained in a single grammar file and are listed below:

	Simple1.jj
	Simple2.jj
	Simple3.jj
	Simple4.jj
	NL_Xlator.jj
	IdList.jj

Once you have tried out and understood each of these examples, you should take a look at more complex examples in other sub-directories under the examples directory. But even with just these examples, you should be able to get started on reasonable complex grammars.

Summary Instructions

If you are a parser and lexical analyzer expert and can understand the examples by just reading them, the following instructions show you how to get started with JavaCC. The instructions below are with respect to Simple1.jj, but you can build any parser using the same set of commands.

  1. Run javacc on the grammar input file to generate a bunch of Java files that implement the parser and lexical analyzer (or token manager):
    	javacc Simple1.jj
    
  2. Now compile the resulting Java programs:
    	javac *.java
    
  3. The parser is now ready to use. To run the parser, type:
    	java Simple1
    

The Simple1 parser and others in this directory are designed to take input from standard input. Simple1 recognizes matching braces followed by zero or more line terminators and then an end of file.

Examples of legal strings in this grammar are:

  "{}", "{{{{{}}}}}", etc.
Examples of illegal strings are:
  "{{{{", "{}{}", "{}}", "{{}{}}", "{ }", "{x}", etc.

Try typing various different inputs to Simple1. Remember <control-d> may be used to indicate the end of file (this is on the UNIX platform). Here are some sample runs:

	% java Simple1
	{{}}<return>
	<control-d>
	%

	% java Simple1
	{x<return>
	Lexical error at line 1, column 2.  Encountered: "x"
	TokenMgrError: Lexical error at line 1, column 2.  Encountered: "x" (120), after : ""
	        at Simple1TokenManager.getNextToken(Simple1TokenManager.java:146)
	        at Simple1.getToken(Simple1.java:140)
	        at Simple1.MatchedBraces(Simple1.java:51)
	        at Simple1.Input(Simple1.java:10)
	        at Simple1.main(Simple1.java:6)
	%

	% java Simple1
	{}}<return>
	ParseException: Encountered "}" at line 1, column 3.
	Was expecting one of:
	    <EOF>
	    "\n" ...
	    "\r" ...

	        at Simple1.generateParseException(Simple1.java:184)
	        at Simple1.jj_consume_token(Simple1.java:126)
	        at Simple1.Input(Simple1.java:32)
	        at Simple1.main(Simple1.java:6)
	%

DETAILED DESCRIPTION OF Simple1.jj

This is a simple JavaCC grammar that recognizes a set of left braces followed by the same number of right braces and finally followed by zero or more line terminators and finally an end of file. Examples of legal strings in this grammar are:

  "{}", "{{{{{}}}}}", etc.
Examples of illegal strings are:
  "{{{{", "{}{}", "{}}", "{{}{}}", etc.

This grammar file starts with settings for all the options offered by JavaCC. In this case the option settings are their default values. Hence these option settings were really not necessary. One could as well have completely omitted the options section, or omitted one or more of the individual option settings. The details of the individual options is described in the JavaCC documentation in the web pages.

Following this is a Java compilation unit enclosed between "PARSER_BEGIN(name)" and "PARSER_END(name)". This compilation unit can be of arbitrary complexity. The only constraint on this compilation unit is that it must define a class called "name" - the same as the arguments to PARSER_BEGIN and PARSER_END. This is the name that is used as the prefix for the Java files generated by the parser generator. The parser code that is generated is inserted immediately before the closing brace of the class called "name".

In the above example, the class in which the parser is generated contains a main program. This main program creates an instance of the parser object (an object of type Simple1) by using a constructor that takes one argument of type java.io.InputStream ("System.in" in this case).

The main program then makes a call to the non-terminal in the grammar that it would like to parse - "Input" in this case. All non-terminals have equal status in a JavaCC generated parser, and hence one may parse with respect to any grammar non-terminal.

Following this is a list of productions. In this example, there are two productions that define the non-terminals "Input" and "MatchedBraces" respectively. In JavaCC grammars, non-terminals are written and implemented (by JavaCC) as Java methods. When the non-terminal is used on the left-hand side of a production, it is considered to be declared and its syntax follows the Java syntax. On the right-hand side, its use is similar to a method call in Java.

Each production defines its left-hand side non-terminal followed by a colon. This is followed by a bunch of declarations and statements within braces (in both cases in the above example, there are no declarations and hence this appears as "{}") which are generated as common declarations and statements into the generated method. This is then followed by a set of expansions also enclosed within braces.

Lexical tokens (regular expressions) in a JavaCC input grammar are either simple strings ("{", "}", "\n", and "\r" in the above example), or a more complex regular expression. In our example above, there is one such regular expression "<EOF>" which is matched by the end of file. All complex regular expressions are enclosed within angular brackets.

The first production above says that the non-terminal "Input" expands to the non-terminal "MethodBraces" followed by zero or more line terminators ("\n" or "\r") and then the end of file.

The second production above says that the non-terminal "MatchedBraces" expands to the token "{" followed by an optional nested expansion of "MatchedBraces" followed by the token "}". Square brackets [...] in a JavaCC input file indicate that the ... is optional.

[...] may also be written as (...)?. These two forms are equivalent. Other structures that may appear in expansions are:

   e1 | e2 | e3 | ... : A choice of e1, e2, e3, etc.
   ( e )+             : One or more occurrences of e
   ( e )*             : Zero or more occurrences of e

Note that these may be nested within each other, so we can have something like:

   (( e1 | e2 )* [ e3 ] ) | e4

To build this parser, simply run JavaCC on this file and compile the resulting Java files:

	javacc Simple1.jj
	javac *.java

Now you should be able to run the generated parser. Make sure that the current directory is in your CLASSPATH and type:

	java Simple1

Now type a sequence of matching braces followed by a return and an end of file (CTRL-D on UNIX machines). If this is a problem on your machine, you can create a file and pipe it as input to the generated parser in this manner (piping also does not work on all machines - if this is a problem, just replace "System.in" in the grammar file with 'new FileInputStream("testfile")' and place your input inside this file):

	java Simple1 < myfile

Also try entering illegal sequences such as mismatched braces, spaces, and carriage returns between braces as well as other characters and take a look at the error messages produced by the parser.

DETAILED DESCRIPTION OF Simple2.jj

Simple2.jj is a minor modification to Simple1.jj to allow white space characters to be interspersed among the braces. So then input such as:

	"{{  }\n}\n\n"

will now be legal.

Take a look at Simple2.jj. The first thing you will note is that we have omitted the options section. This does not change anything since the options in Simple1.jj were all assigned their default values.

The other difference between this file and Simple1.jj is that this file contains a lexical specification - the region that starts with "SKIP". Within this region are 4 regular expressions - space, tab, newline, and return. This says that matches of these regular expressions are to be ignored (and not considered for parsing). Hence whenever any of these 4 characters are encountered, they are just thrown away.

In addition to SKIP, JavaCC has three other lexical specification regions. These are:

. TOKEN:         This is used to specify lexical tokens (see next example)
. SPECIAL_TOKEN: This is used to specify lexical tokens that are to be
                 ignored during parsing.  In this sense, SPECIAL_TOKEN is
                 the same as SKIP.  However, these tokens can be recovered
                 within parser actions to be handled appropriately.
. MORE:          This specifies a partial token.  A complete token is
                 made up of a sequence of MORE's followed by a TOKEN
                 or SPECIAL_TOKEN.

Please take a look at some of the more complex grammars such as the Java grammars for examples of usage of these lexical specification regions.

You may build Simple2 and invoke the generated parser with input from the keyboard as standard input.

You can also try generating the parser with the various debug options turned on and see what the output looks like. To do this type:

	javacc -debug_parser Simple2.jj
	javac Simple2*.java
	java Simple2

Then type:

	javacc -debug_token_manager Simple2.jj
	javac Simple2*.java
	java Simple2

Note that token manager debugging produces a lot of diagnostic information and it is typically used to look at debug traces a single token at a time.

DETAILED DESCRIPTION OF Simple3.jj

Simple3.jj is the third and final version of our matching brace detector. This example illustrates the use of the TOKEN region for specifying lexical tokens. In this case, "{" and "}" are defined as tokens and given names LBRACE and RBRACE respectively. These labels can then be used within angular brackets (as in the example) to refer to this token. Typically such token specifications are used for complex tokens such as identifiers and literals. Tokens that are simple strings are left as is (in the previous examples).

This example also illustrates the use of actions in the grammar productions. The actions inserted in this example count the number of matching braces. Note the use of the declaration region to declare variables "count" and "nested_count". Also note how the non-terminal "MatchedBraces" returns its value as a function return value.

DETAILED DESCRIPTION OF NL_Xlator.jj

This example goes into the details of writing regular expressions in JavaCC grammar files. It also illustrates a slightly more complex set of actions that translate the expressions described by the grammar into English.

The new concept in the above example is the use of more complex regular expressions. The regular expression:

  < ID: ["a"-"z","A"-"Z","_"] ( ["a"-"z","A"-"Z","_","0"-"9"] )* >

creates a new regular expression whose name is ID. This can be referred anywhere else in the grammar simply as <ID>. What follows in square brackets are a set of allowable characters - in this case it is any of the lower or upper case letters or the underscore. This is followed by 0 or more occurrences of any of the lower or upper case letters, digits, or the underscore.

Other constructs that may appear in regular expressions are:

  ( ... )+	: One or more occurrences of ...
  ( ... )?	: An optional occurrence of ... (Note that in the case
                  of lexical tokens, (...)? and [...] are not equivalent)
  ( r1 | r2 | ... ) : Any one of r1, r2, ...

A construct of the form [...] is a pattern that is matched by the characters specified in ... . These characters can be individual characters or character ranges. A "~" before this construct is a pattern that matches any character not specified in ... . Therefore:

  ["a"-"z"] matches all lower case letters
  ~[] matches any character
  ~["\n","\r"] matches any character except the new line characters

When a regular expression is used in an expansion, it takes a value of type "Token". This is generated into the generated parser directory as "Token.java". In the above example, we have defined a variable of type "Token" and assigned the value of the regular expression to it.

DETAILED DESCRIPTION OF IdList.jj

This example illustrates an important attribute of the SKIP specification. The main point to note is that the regular expressions in the SKIP specification are only ignored *between tokens* and not *within tokens*. This grammar accepts any sequence of identifiers with white space in between.

A legal input for this grammar is:

"abc xyz123 A B C \t\n aaa"

This is because any number of the SKIP regular expressions are allowed in between consecutive <Id>'s. However, the following is not a legal input:

"xyz 123"

This is because the space character after "xyz" is in the SKIP category and therefore causes one token to end and another to begin. This requires "123" to be a separate token and hence does not match the grammar.

If spaces were OK within <Id>'s, then all one has to do is to replace the definition of Id to:

TOKEN :
{
  < Id: ["a"-"z","A"-"Z"] ( (" ")* ["a"-"z","A"-"Z","0"-"9"] )* >
}

Note that having a space character within a TOKEN specification does not mean that the space character cannot be used in the SKIP specification. All this means is that any space character that appears in the context where it can be placed within an identifier will participate in the match for <Id>, whereas all other space characters will be ignored. The details of the matching algorithm are described in the JavaCC documentation.

As a corollary, one must define as tokens anything within which characters such as white space characters must not be present. In the above example, if <Id> was defined as a grammar production rather than a lexical token as shown below this paragraph, then "xyz 123" would have been recognized as a legitimate <Id> (wrongly).

void Id() :
{}
{
  <["a"-"z","A"-"Z"]> ( <["a"-"z","A"-"Z","0"-"9"]> )*
}

Note that in the above definition of non-terminal Id, it is made up of a sequence of single character tokens (note the location of <...>s), and hence white space is allowed between these characters.

javacc-5.0.orig/www/doc/CharStream.html0000644000175000017500000002433310604423264017046 0ustar mkochmkoch JavaCC: CharStream Classes MiniTutorial

JavaCC [tm]: CharStream Classes MiniTutorial

This document describes in some detail the methods of the CharStream classes. Note that some of the details may not be relevant for the CharStream interface (to be used with USER_CHAR_STREAM).

There are 4 different kinds of char stream classes that are generated based on combinations of various options.

  • ASCII_CharStream

    Generated when neither of the two options - UNICODE_INPUT or JAVA_UNICODE_ESCAPE is set.

    This class treats the input as a stream of 1-byte (ISO-LATIN1) characters. Note that this class can also be used to parse binary files. It just reads a byte and returns it as a 16 bit quantity to the lexical analyzer. So any character returned by this class will be in the range '\u0000'-'\u00ff'.

  • ASCII_UCodeESC_CharStream

    Generated when the option JAVA_UNICODE_ESCAPE is set and the UNICODE_INPUT option is not set.

    This class treats the input as a stream of 1-byte characters. However, the special escape sequence

    ("\\\\")* "\\" ("u")+ - (odd number of backslahes followed by one or more 'u's.)

    is treated as a tag indicating that the next 4 bytes following the tag will be hexadecimal digits forming a 4-digit hex number whose value will be treated as the value of the character at the position indicated by the first backslash. Note that this value can be anything in the range 0x0-0xffff.

  • UCode_CharStream

    Generated when the option UNICODE_INPUT is set and the option JAVA_UNICODE_ESCAPE is not set.

    This class treats the input as a stream of 2-byte characters. So it reads 2 bytes b1 and b2 and returns them as a single character using the expression b1 << 8 | b2 assuming bigendian order. So in particular all the characters in the range 0x00-0xff are assumed to be stored as 2 bytes with the first (higher-order) byte being 0.

  • UCode_UCodeESC_CharStream

    Generated when both the options UNICODE_INPUT and JAVA_UNICODE_ESCAPE are set.

    This class input is a stream of 2-byte characters (just like the UCode_CharStream class) and the special escape sequence

    ("\\\\")* "\\" ("u")+ - (odd number of backslahes followed by one or more 'u's.)

    is treated as a tag indicating that the next 4 2-byte characters following the tag will be hexadecimal digits forming a 4-digit hex number whose value will be treated as the value of the character at the position indicated by the first backslash. Note that this value can be any value in the range 0x0-0xffff. Also note that the backslash(es) and u(s) are all assumed to be given as 2-byte characters (with the higher order byte value being 0).

Note : None of the above classes can be used to read characters in a mixed mode, i.e., some characters given as 1-byte characters and others as 2-byte characters. To do this, you need to set USER_CHAR_STREAM option to true and define your own char stream.


(Throughout the following, we use the notation XXXCharStream that stands for any of the above described 4 classes.)

Constructors

  • public XXXCharStream(java.io.InputStream dstream, int startline, int startcolumn)

    Takes an input stream, starting line and column numbers and constructs a CharStream object. It also creates buffers of initial size 4K for buffering the characters and also for line and column numbers for each of those characters.

  • public XXXCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize)

    Takes an input stream, starting line and column numbers and constructs a CharStream object. It also creates buffers of initial size buffsize for buffering the characters and also for line and column numbers for each of those characters.

    So when you have an estimate on the maximum size of any token that can occur, you can use that size to optimize the buffer sizes. Note, however, that these sizes are only initial sizes and they will be expanded as and when needed (in 2K steps).

Methods

All the following methods will be static or nonstatic depending on whether the STATIC option is true or false at the generation time. Also only those methods that users can use in their lexical actions (using the input_stream variable of the lexical analyzer) are documented here. Rest of the (public) methods are very tightly coupled with the implementation of the lexical analyzer and thus should not be used in lexical actions. In the future when we adopt version 1.1 of the Java [tm] programming language, we will streamline this by making that part of the interface an innerclass to the lexical analyzer.

  • public final char readChar() throws java.io.IOException

    This method returns the next "character" in the input according to the rules of the CharStream class as described above. It will throw java.io.IOException if it reaches EOF during the process of "constructing" the character. It also updates the line and column number and buffers the character for any possible backtracking that may be required later. It also stores the line and column numbers for the same purpose.

  • public final int getBeginLine()

    This method returns the line number for the beginning of the current match.

  • public final int getBeginColumn()

    This method returns the column number for the beginning of the current match.

  • public final int getEndLine()

    This method returns the line number for the ending of the current match.

  • public final int getEndColumn()

    This method returns the column number for the ending of the current match.

  • public final void backup(int amount)

    This method puts back amount number of characters into the stream. Note that the amount indicates the number of characters as constructed by readChar. Since the buffers used are circular buffers, it cannot check for illegal amount values, it just wraps around. So it is the user's responsibility to make sure that those many characters are really produced before a call to this method.

  • public final String GetImage()

    Returns the image of the current match. As far as the XXXCharStream is concerned, all characters after the last call to the private method BeginToken are considered a part of the current match.

  • public void ReInit(java.io.InputStream dstream, int startline, int startcolumn)

    This method reinitializes the XXXCharStream classes with a (possibly new) input stream and starting line and column numbers.

  • public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize)

    This method reinitializes the XXXCharStream classes with a (possibly new) input stream and starting line and column numbers and adjusts the size of the buffers to buffersize, by extending them. Note that if the value of buffersize is less than the current buffer sizes, they remain unchanged.

  • public void adjustBeginLineColumn(int newLine, int newCol)

    This method adjusts the line and column number of the beginning of the current match to newLine and newCol and also adjusts the line and column numbers for all the characters in the lookahead buffer.

javacc-5.0.orig/www/doc/JJDoc.html0000644000175000017500000000725711220416762015754 0ustar mkochmkoch JavaCC: JJDoc Documentation

JavaCC [tm]: JJDoc Documentation

JJDoc takes a JavaCC [tm] parser specification and produces documentation for the BNF grammar. It can operate in several modes, determined by command line options.

TEXT
(default false)

Setting TEXT to true causes JJDoc to generate a plain text format description of the BNF. Some formatting is done via tab characters, but the intention is to leave it as plain as possible.

The default value of TEXT causes JJDoc to generate a hyperlinked HTML document.

BNF
(default false)

Setting BNF to true causes JJDoc to generate a pure BNF document.

ONE_TABLE
(default true)

The default value of ONE_TABLE is used to generate a single HTML table for the BNF. Setting it to false will produce one table for every production in the grammar.

OUTPUT_FILE

The default behavior is to put the JJDoc output into a file with either .html or .txt added as a suffix to the input file's base name. You can supply a different file name with this option.

CSS

This option allows you to specify a CSS file name. If you supply a file name in this option it will appear in a LINK element in the HEAD section of the file. This option only applies to HTML output.

Comments in the JavaCC source that immediately precede a production are passed through to the generated documentation.

The results for JavaCC are given as text or HTML.


javacc-5.0.orig/lib/0000755000175000017500000000000011247044052013275 5ustar mkochmkochjavacc-5.0.orig/lib/junit3.8.1/0000755000175000017500000000000011247044052015016 5ustar mkochmkochjavacc-5.0.orig/bootstrap/0000755000175000017500000000000011247044051014543 5ustar mkochmkochjavacc-5.0.orig/bootstrap/javacc.jar0000644000175000017500000106421510745446350016513 0ustar mkochmkochPK Lg08 META-INF/þÊPK Kg089)¼^\jMETA-INF/MANIFEST.MFóMÌËLK-.Ñ K-*ÎÌϳR0Ô3àårÌCq,HLÎHUŠ%ÍAÒÎE©‰%©)ºN• õ¦zºEɺIfÆ Á¥y ¾™ÉEùÅ•Å%©¹Å žyÉzš¼\¼\PK Kg08org/PK Kg08 org/javacc/PK Kg08org/javacc/jjdoc/PK Kg08org/javacc/jjdoc/test/PK Lg08org/javacc/jjtree/PK Lg08org/javacc/parser/PK Lg08org/javacc/parser/test/PK Kg08׃ø Â javacc.classUNÁÁ@}CY­¢4ñ ¸,gâ"nÄAââ´ªiVØJ5â·œˆƒðQbJBÌdò23ïÍ›ÇóvÐ…ïÀ‚ë ‚ª@MÀ#ÚètHÈ·Ú ‚5Š×!ÃNiCh¶–“:*¹U&’ó4Ñ&êg4g| Â}ªcs¨»( (ÐpQ‚Í'3I¼Ÿv¶Ú„AJð£ï ö‰“H~Tr¯’C˜È)?€òüp9N6ApWg$ÆBç:¿ væÍ¤ÿõ¹ÏÚá²xX^PK Kg08“<8Ï jjdoc.classUNÁNÂ@}SÚ®Ô ­$ø‚âeñ¬á¢\ .œêÒ4Û让 á·8A8ø~”aZg2y™yïÍÌ÷Ïé À£.ÂW "‚ÿ ®g„^2YÜG»ÉÞ3m7Éú¹Ì¶™|ËL!—u¥MqßÈ‚ùNåµ¶æS áÁ¸q>Á+ËU„¨³.^Ë\Õ„Q7úÛ@Ûª £”l½2MŸ¬záp‡ÿÜ„ÃÉw@ÜÅŒÄèÝ@ûVÐoγè?}„óK\./3PK Kg08!¿¬Þ jjtree.class;õo×>...nv^v>F6›Ì¼Ì;Ff Í0Fçü”T •›˜™ÇÈ ¦í“•X–¨Ÿ“˜—®\R”™—n­ÆÃÀÊÀÆÎÀÏÃÀÁÀ 4"+«¤(¨K¡Ö?)+5¹hB~Qº>H89Y¢Lßh4ƒ!3Ð) À„@ãØ{PüY6¥zdkäž k~k— ²/Ý2§q2Þ,Aï«‹ÃGè˜ x“Ó%:k¾^Ëûm܉œ·îüÝ_ˆPK Kg08ýY®|org/javacc/Version.class;õo×>.vvvFö²Ô¢âÌüwÞ’ {æ‰UV±áŒ6Ú"uc­’L|š£9 _Ÿü‹¸Råi&DŽ‹Æ_ºèÌ•ÿmÐL±˜©¯ uUòO[jy…~¤JgC«"«ó~ÓéSn2=±GË=ùAž,.»Å Úx—ƈŽ*„¢oéï0ê%ŠÜ2„YÖQ™ÅåŸ{‘;˜X¿‡wEÚe‘È«#vŽ; ÿ5’²y±5<­›çvÂÆ ÿ–KàXN@…YNJ~ jÌia]ê aSØÎÀ,sæ™ ÂEXb. W`•¹&\‡ æ¦pKæo w„»9~PK Kg08ˆì© §$org/javacc/jjdoc/HTMLGenerator.classVi`GþÖ¶¢±¼Î±Nšæp³VÇÞØÙ%^ d[±•ز±Õ„„Bº–×¶RYRVë’B -Pî£\M–r˜›¶$Jh ”«…rß÷}ß×àÍìj½¶”¦ûcfvæ{ßûÞ›ÙyûøzÀnü'‚4΄qsu8Óˆ ¼ˆ7/毷„qk/‰€á ÃKyonçÍË8âå ¯ˆü†WFÆ«xój†×0¼–áu÷zN÷†Þˆ;8òM wòþÍ oaxkoÃÛ¹Ñ] gînÄ;ðN†w1ÜÃp/ûîcxÃ{ÞÇð~γÀð†2|ˆáà aø(ÃÇ>Îp?à rÖO0œc8ÏPæî.0\äý'b¸ÔˆOáÓ 3|†á¾ðY†Ï1|žá _dx”á1†/1|™áq†¯4â«øÃ×ÃøFß ã[Vd§ŽÏ™E ë†O˜7™ú¼“ÍéCfiÖ1'sV„ºì”)IH#›Ï:1 õ‡%4ô¦,š±œãÒÞáäÌüŒ>áØÙüLOgõ”„p‘N.O.k™pjÇ:åH  „æ©Bf~ÎÊ;ŽiÓ{Så=‘'¿Í¥¢•Éš¹táF+_’qøÀƒ’¨‚=£s/™Œ^4í’eë9f¦æ3N¶.™°„kò…¼cÙsÙ¼™+y<«‚sÕ$ *ëî›Xa›HNg-÷éçn™‚UEÿÝ#ÝQË:U°çÌÜ2ÛæE[!a¥uªhæK‹Tmµ¨PÏ1N"ûF‚c5…œöBöX¢µù0¡eeÀN…m˳ï¨e?nÍÌçL›ÄØV©T‰(d[d,ãž+¡¥ÆÉ”qGd<Ge|ß!½Ë’„«–OõÍOO[60ž/ßÅ÷xó}?Àeü?¦“‘1‰$@ÆOðS?ÃÏÉ =çôðn†w¡vs®ØÃM!ã—øU¿–ñüV£m`´?}t,¡¥G†Õ±ëú†“ýj´[×ìë×õô€»°o×^]O¤¢1ǹ·ŸŽ‰A"> ãw2~ÏUý”Ðm 'S‡ÔñÄpo´äœÎY¥YËr¢ªsºhõFùç¢gJ¥¨:k[Ó½QúD£:QüIÆŸñ:ZF:™NÄúRÔé‚­Ò5twJÂvo1®òåÛœ›3muò´zðà@!³ˆ ºPÆ%ö¥ÁchN¦zû©tb<à!Dð=®™‡æš¤]ü‡Œò]l1toÎÐ+(:’n®:)SÙxrp(­v_úâ ::‰˜WSñ‘DoTÆóð|ºÖ£¥`c °XO¥oYݬŃ…—òÌ!ïZ½@ÖðlõjJÌKÜ3+PúÏð ·Ð¡%Rv»4epü¬àNÇù9>‡>¾ÕýþVkÊ@”à_´‹:Àƒ£¡€QR´ßÀI_Œ¿BÌ*7àæC >R`8|ÌB?çÑ/¸ù¥ ¿’á~-Ão˜ð[n~ÇÍïeøƒ äáŸ$ø³%ðþ+þ&ç¬ô3þ.Ã?dø'ëüœ›qóonþÃÍ%8­@|,AÍh‚(aŽSÐ!¡“‰.Æ\IÜÈ*Ü»¹ñH(x¹7}%ìÇ} pï•p ÷ƒ$Ìã~°„C¸*¡ûažÇ}¾„ù?_Æ ¸/qƒT Gñh´Œc˜‡(ãXž_ÈM¡ °HF¿ŒÅ ,Â3G©K¹§@–I8^‹$¼˜g—ps©Œ—ÉX.áå ¬Å+d¼RÆ Np¢Œ“Ø€“%œB!ë؞©NS`3VÊ8û*gÈ8S«ØŠg)cM³eœ£À6¬–q®„5 ì`ûjˆÃgnœÇ@×(°‹×ë$œ¯Àn.q¡Œ‹$¼VÂŹC‘Pr2‚£°h‚³2Ú "¸É@<‰0´QM΋«Aµ!iœSƒ¡@xAtµA¸´°:o,[XËbxB—ikŠº]Að©Í¡ä‚h¬Z]£†­ˆ „+º‡´.¬ZÕ –ÍT#j<ŒÆ'°ÝƒtXb6´“¡(#^TØ“`5ÓËZ’¡pÙ"5hBå1TM4Þga `zÕºX ’ ‚¸J~šhgq†§W«fANÕ4!\iª/ž#beS4T»AÔ{Eœ…X®4©†nöžYïwhn yT7‡"0Âd;d Ç9Ú\Qkãs£ñîâ•Yï÷ü,Ü:µ±%ˆÓ<®&Zè¦ÛáwáëUO^–žùê-j„ã8ÁÞ\>GÔñõÓÂÑàênPÍå^Q‡d¡.UãQÓÙ“ìp;Î1Šº Ū›(fÖ{ÅÍeܺªnŽE×héu"ˆ4–ÍOÆ©Nð$츗 \†×Ix½ÀåLY7HÃs~ö Œ´«Ù5á‚®LÓjfXwÿî¸ ¦zÔ]…øoé¼ ½Àݘð|A`+ðQ܉0º«Älšñ k5á1|\à¼'ô²/àExIÀËðŠ­™¢+àUØoë}KõpÚâd ¡€6x aÔYœ‡à0°îë’€v8bËaÖGáB~OÕBÀëð†­Õ™ƒ/à8¼I»¯Æ #«#ѵ‘Õ RAr}L'ðIláŒÛ@·÷ ܇Û>…{)ï 9ï ŠŠ>Ï|–›4i!§ Hàsœ*Äâ×Ú)Ÿç¤µ±ªnvK"YhVm÷UWi¨]9#¦å›eýøW‡’T¶èè¿€”X/ò±ÃQdHE½TeS ’Lu(‘ø’&@e— |™·aS擞°š‘$æ‘_ÁWúŸY¨èá~ð ­ú F‰Ð©icÇÈRÂ{‡~=.-F\‚&{A˜¬-PÃj³IêA"+¨¢øl·¨Ñ8ªjgØ{ÖrÛc¡ÀCx7y¬¨Ø>HW+IxؾpYï´޼ZËõ”S4alvÆõsÃÙhœÌNéÛ{p—köìéÑ`¶9–…™áh} Lߤ‚¾Ï3—}Ÿõtù󫱓9¿gÖaݯ"ô¡y Çk¾þNPâ¼1$‚·ëg5]õ‘•1ë×´ÇD “@Ý\T´ÃDÖ«Ã×ÃÓB©WC‘êÇgÑ kcF¯Œ†[š Á Fé37‹©¬º¤°ëõÞõÆ×obÞHŒ¦úK£6^PÚÓ;¨ 2‚œŒêcz´Úr8#êº$¦ÜØ¢9Ïjamý*òé„¢¥„Döó)Ïn'ô½ãIj F¨úŸ2É8|„á3MÒª"" 9¾íB¿¦@‚OGU…Þ’dŸ‡÷aÏܬ± ÷ÊP<‘4¢ë%èf ‡‚!@‚PÂê:²;©èÀevÎRV‡" ³šh'¥1BæTD“踑›HÞÉ9Š0款ù({" ²ŠúîµÓîÖ\kxvl·™ÐyÝkq&µËš°–ÿŠ"m< $»Ú Z¿Î³cP.´#eiÚ”Ì Hõ¤Çç*y+¨ÕWòVߌ”¡pDÏOÝ¥¬Jd„´ôé´Z›Ëš°ö†";´®_GÚúY¢¹Ôxœ·¤ó³Æ0sdooG-íbîk×p)Y ˜Â³|˜‹2_3ª%Ò’_K3W8P¯†9²±J6Ÿ>ê,òƒœHf ¥ü =_EDm¤Yà ½ºzÔD0ŠÑÁ%]9Á&:(•¤®pY¥vÖ +ˆ#ã Ž=«ÚÆ%'¬®LòVBMIÍ\Ð)ͺ‰Rå*ñŠC0¤ÜÅ%G`hNÆBzêºr\¤IÀÏýGÀ‡P|†Í%ÞóRø ò‘ÞBÃkJÛà|¿À+*œ4.Há^êF¼ù†>'©öŽÔõW8Ó°)ka”¹à(wå¹Xôø>˜aeaZžëb“Ï`r6ì_Òh“ã¦;e­1׬Ô0– .Ì Ó¤0uh‘ ×oaÇT¸|.Ý5°GšoJ*r­B¾Ü6(m‡q¦(ÏËNÁè,àñcY\d«9clFa¶½—düÜÍZ¸4#è4Bïó—ËrÀïsrêizy¤OçSįèLÚçÍ”€(%dêß!†+³SŽ™)QÁ)1S¢ô$LLÁ}Œ;)ˆ:ù$LIÁBg9ûmò ˜Â~kƒ«Øƒ¹¾\ébiPSé·Bòû¤<²pš|ÁVóép”Ó6ßNÃ?ãé<<Ò¸ ±±U´1DÍHAé ˜qf­cíåêÎÍÒkØØì)ã„õŸ„Y):Z'`Vq;ÌNà ~mL™B”9iØM”jRM”¹iØB”RC”Ú4$‰2O§Ì#Ê5i¨'JN©#Êü4Ì#ʲ€( Ó´—“°H§,"ʵi(!Êb²˜(KÒ0Œ(KuÊR¢,Kƒì½®®7÷DÏpcO}è÷„æ=Î¥é´à¤þ ¿L`‹J,Ѩ)%•æ’§Ø»\KtÇ»&"½å»SF/xciŒá[_1yE“Ò4$&:˽軈xëõtmƒ SìmÐæ¦½ì ‘ñFµMù0n®Yñ†² •4•d®ì”¦W¿!½…¤s©¿É9‰T5’KjJ}‡JM—ðq¢Ð·v|Â=¥Inºã½üVöL“Ïä)4çž"+QýÓ+æ½zƒ‡÷aBÉ1)ݱӴé(³\<¼£"²hOÊ·À0ò-8&ÄëðF~\­û1œ%rÞìA¤Y‰d‰œ€“ºˆ (—5ŸzE5qG ßëÛŸDùãľ±ÜIm¼ÜE,‰S¦sr‡·ÂàŸ1/æåL…Ûç> RpUp£!è|ݵÄásŸ€ mpË …çlZâó†[Ûá6Õ&BÒ¬`s Z{T°¹ n?'w˜{ó˜òw.üÌ“½[¨4™~Éöéh“ëôÛVò]&9g;…ek ),[õ°Üåf˜m¸™**ýV¸-0>wæò­¶W¿ÜÔÓq 3’ó3ì ÷d á¼¥`«­ZȦ{M6|ŸØ¶¥ †Ø¶e±y·wu‹Þ×i£•ûþ ⽄¸#iBÜ¡{àlÜs†åNòZ®³Ü“ç9cÏvvXÕ…ÿÁ=Ø”ñ`< òÙNÁx25ž½ùÆnj‡ÙÙñ"ÉìÒ¶ë¬ö°½ÃÉ .%ÄÝ:âî³BLÙ#¶Z2øQÊ`.CY{Ì`(Ö?ÛáPK Kg08¨Xk'È#org/javacc/jjdoc/JJDocGlobals.class}RËNÛP=7;7-Ð’HB!@ðpŶU»H¥TQª.Š*Ñ 2ÉÅrùF7âWòÝòXð’*u…ÄG¡Ž­„€¬°™ñÌ9gf|tïî¯ÿøÛDEK&ÞaYÇŠ‰Š:J&4MBV3XÃzÞ‡ÁÒQÖQa0=¿Ûö½Ž`˜m´#Çî8¾kÿ ”ç»2²Œ)†+|¡œ@*†|C*×%ͦÝn·dÓ®PjŸ<ß >3$­ò/†TU¶h6ž±d=7$Ôq÷‰ h•Ÿ_›n‰ƒ¾Ë0gÅÿ&ºÃó%Ñ„RRq¼ÂkŽÌêØàØÄmˆßÇONˆ¾í~o<8Þb^Ç6Ç9òa(`‘¡ÓÕë_e³Ö‘N§G^<»Žê eשªV&üèžô ×É«ðØÈóß “Â2½Š,½Ÿ$ ¼ÀKú20=Ìäe ,´‡âU3”åtå숈9¼‰ÁçHŒ`2b $¢ÞÞ·(]"9Àô R{H“à¾Ü@£BŠŸ'î?h”sQ75@v¬ ÖÉp%y>\™£•áEæ%¦*W0•ŸÄ1ÇœÂ$NfÄÁPK Kg08V“[†± org/javacc/jjdoc/JJDocMain.classW‰TGÿ¾°°“åY`)‡ítme“ Ô6@iH6Ì% ¨5}ÙM^Ü}oûÞÛ@<êUïûj%ÞxàGAI,ŠWµµ^õ¬V­GëmÕ¿@ýýæí.»I .fÞüæû;æwÍä¡ÿÜwÀfü;†Û0.`Çð|L¼P /Pp\¢Àž€/”&Ž ˜x‘À‹^"ðR;^&ðrW¼RàUw±ÈWÇð¼6†×áõ1¼ox“À›yç-<¼UàmL{ïˆ!É–¼“çw ¼›ç»tÀ{N0nZà½1¼ïø@ŒâC$ÿÃ1lÃɶâ¤ÀGéDøÏ8%ð‰(>ÃÍøŸ8-ðþü¬Àçxþ|÷ư÷·âLg¾Åyu.†ÌÆð%ÜÇÃy/ |…M» ðU¯ |=ŠoÄpwGñÍŽò|ß2°d§íØÁM%›ˆtºYeÀWùâHAù¾5FËHÁ²«“·öNX“V[ÞrÆÚ†ÏvÆv0W,}<£Ší:~ß6°”ñƒž;æY…K±õ˜xF ÀÄxÐÀ’~Y7#]-ªÕWA@P_¶ÊdàJOYY™óÜ‚ôËÉZ^VÚN±4h8pY—³ójŽ K2‘,¾e_ú@Ú@ËHÌaOHÛ'¨¯î()'£¤›“Uɾ*Zž¨¬’~ÑÊ(?e =meÆËVT°²Pò9ªÙ]GOÁ¸’97Ÿwñ~Îõ ~»&¶¡5dv¬‚Ú5iåKd¹J¥Zdëpúð𮜕÷Ùî¹ØöùØö ¶kV†¿$Ë&6å’œS«8ðJ*%e0Ó­ÅôÌt1Ú€TELÿ@Yо:ÿ‹=%7ËWä|Ç·{RµHßÕËX„µ¦d¢ÕÒLJ),ŽP,É&rf¢,9A—%kgøUÇ[Å¢ç=›ÂÅÎÖîϸž§ü¢ëdÉ»C³[$%X•OÙ„ôˆD 5¦¼9êºyE’âë|uQè¯&©µ´l9ôù(¼ËØ[‡t÷ôRÒE™Ò94dàjf®È^[| ?=2ܱ§7-ë~ɬÊY¥<ùŸâFnf"»DÎÿU±•ìhLîèìM‘’M+©µª+ £,LqQ,/51a`] Rivì¡sÊýû»ÜL{9ÿôBŽ)GqÕør?õ¦„RrÇÒÓÅÉ[²,QW*×ÖnÓMŽ/¸”/¶Ãec…Aó•ÒAu¼M ꪗlR,a<Š~{[7¦L&•U“)þL9*h#–6Íœ y9ŒEñá»Q|ÏÄ÷1ÅLüûך®:{ã¹5•Í©-©L<Œ™°Û” ¦ŠJ&´Çò%e<…vLKðuZrëm2ñcü„Zçܾ¹§”Ë)’½¬×¢ä¬0Ê„‰Ÿâg6ê^ÅE¶6]ž$3ÑÊeaâçxÄÄ/¸ÝÆ:ª¼”´‰‹EâÌé[šï—Ìb´Fñ¨‰_á×®9@…§»Öü†,Sü¤ºÞXÙ¿mÔ%}åµ…1Ô r>í¶uYÕìtHeLüñõð[WÔË6ñ;üžŽ_¥º¥@“ÿÀäxUºáÓ W±Ç¬¨ë¦ ÿ ‰Çñª;D.՞˹%'›2ñGÞJ…½?k{*CAJÉA*Nªƒý·¸Fíl¨ˆ]M\Â#dG­&¶Iy¬ïÏÖ×TeJžLUïNÉ MNÚn>L¨cã,=ð¦ø\ÔYÝ¢rÈÖµ*úÝ ›­®Š2ñÎÑ¿šøÏ7ñý‚Ù¸ðæÞ¼;JÝÍÀÊ‹á©á.c`Urá×ÏòêÝHô䉨ã6ušH²‡«8œ6§ÑS=ôúêÈç/iZx•ùÚµòz/58jÔ X´°ÂöʧYðG©Nè~Tݦ- æ‘ÂN´ƒDnH1per>Ž‹u¨ÉQÔR: Y¶½bÌò¹p²ƒ^:u†ŒNPêhCØu«z+PÓ8H×Úä‚ú•ª;ÈW+•èB†. »I²„‚è¾~“Ú¥¶ßUiti© ŸJžræ¢Æ°Ôµ23 åˆÖYŸ5Ñ%ßP'ó‚Ë4Ë´.jy¤pD;r$Cµh³z ¬`z¹È*;ë)ï.0l¡¿Vnÿ"hà78 ÜN«4Ós‹›g`Ü«‚¯­òöÃz¸?Þ0‹Eñ‹yXƒ¦EyÕecõ+ÆÃRLžVݸ‚‡e<,¯ÒVT¿â<¬¬.¯¬~­âauu©‡5<¬åáéUÚ:ÖW—xØHCxºFŒ"C.àÓ­¦Ó5ÐkžÅU;‰åê“Õn2 MÏ€Ýð(¢XD󳳸&žˆ?c׽ͦAç¿.r:þLRÓÜ|!’½~›NàºóH™AS¼ùžÒé#ÞBÃ9´Î"9½hצŸÄöæ Ì4D…©™6hŽÍ5·å®ãÔeÆ óìØ¿ÔŸÇÖ#ç±íÈlŸÁsfpco¼ý,vÄwžÅ®Sx¬"ü¦:‹vWäûÍGBú :úÈÒ=ÓÑYÇÔUcÓ' ËÀ‹˜îzÌ^²$4p_UKÏ ö÷žBW_EKo­– sßSÛ@ý³˜Åà4:gñ¼i\Ua:@°3ØU=婪©ñ!"ø†ã«û‹NW¶éíAÞ¾edJk‹’ÀÙH'GäöËð FO±¸qÏ5VÛô¼ÝâYÓôi:ÏLçùãñ†µ8l<ѰFϼޣzMs]ÆãPK Kg08ÑöESßP#org/javacc/jjdoc/JJDocOptions.classmRÛnÓ@=K.¶ã iÝ(P ŠS..÷Š"¤^‰Ê`Dœ‚x©œt9²ì(qÅä…ÀÀG!f]· rü0»gΜ3»þó÷×o›Ø*¡‚Ë2\Ñ(\U±¢á®ë¸UkÜTqKÅmë%œÇLU Å—~èǯrfõ!¿ Zd’AïˆØ …뵑T|"åö †E³jw½ÏžxaÇjÄ}?ìl3(Ļ⠩ËR=Œ{øî‚có 2ÜÅ=Íy[;rwvíš‚û`)ØäxˆGÔß­}t9Ã"NÓ}×tê¯íȵçx‚§Ïðœa%êw,é¤Ý¶ºÝã¨mìGm§ûQ8`Xžâ{^ úÖÇ£dwèCA°r2Ñ0öë×£qæ'#îFQ ¼Pº{ß$+ v†#Aù¿È-ÍϰeN;­®hÇÛÙL5›b(Ôwìµã­“‰W†%3{ûò}ôA²O«ÖgUeSX¥¢ù‘—/E÷l’+]: ?À¾'š|Ô®#—ä^Œqn„œ‘¡ðÅ>H¤Œ Nf”&@?§g.b)=ÓH’#?ÿšòp1Ãëc”¿¥ü¥zeJ¿ÈèÂv|TÂc&Øùq *#MJH³5#Ac딈iÍ—p”­Y?fpLBŽf%è y—`ʰ`ûQÀ 'Ẻ8åÇxRF7N³Kž’ð4Ÿ‘ð ?ËÀϱÝóìó‚ˆeôâ%/KxE«̂טŽ×e¼7E¼%âmï¨5,ÛПQO¨‘¬9`fuû°™µ5sP@ý¶¬žµwð…zz·‘Ñh±µ9›„BŽTNÕ§#£6 N2T]žéИ1Ò…YM·GmÕ¤sƒwŽêâZy-Us)㘦[d›m\èúPÜ0§#L}:É«¦¥™Ž<`™BÚÎ:¿KâR\a«nèdõlVWs–«§¹œÆQ \ÀãûçHü6î`o¥ë‡éÄü_dAs¾tv•n¨$0ÌY5·H¶qA–›Ð¤ÍåUÝZPÕSIUÔ Ž3%JIˆëh!—S®Ë®–µ• *Á¸-Mer\‘hj®|¨’üˆ6]È©&cj–åyTgj\xEÚÔT[›0 v¾`OP‘i꬀•¡Þ*•V—Ñ& ÓT[Y}Ê å¤jêDÕLÓ0܃­ 1 à.Ü­ …ƒä¨<”Ü}p4‘ ަvޤdòaM É ÞÅV¢&’‰M©èÈþXbg|”¨÷a€ÜK%÷Eìø bT ̬ K¿‚aFèX\Û» SSõŠàWðÞñ‚q–lõl'ÚGø˜˜dEì÷Ÿö‹8§à<£AÄ' >ÅŸ)øœ‰4Y¶ªgT3Ìêm¢" Ó£&yGy¦ˆ‹ ¾À%›/Ùç+º¸ÿ¨=›Sð5¾!«úí9[Áe|«à;œUð=®°ÏžÚ=Ùœæ¨cÊ̈%£si-Ï*“ò?<ƒ•ä¢7Á)>ò`U(^©,yû·-ðÜÎfT‘|Jñ'ƒž²¯!§ZvLÏhsÉ)*ÔP¬—ú­ÁŽU~«0i¹þ¶ R(;B±Ê MÅ-5êN ‘?N9=ô&n€;éWËÆ ½ñ´§QCß{éÔJ+u/êÂó~ûØìpÙÔÐ?Pî+¢Æã–øí.ß¾Aj=È¶Ò Ý`7Âá"ê~ƒAõeØí%l—‹må‘0lS„äAw,óýxÀ…4ÒAJ~í¬ÎÚU²¡ÍµA üEÈ`w ÐÈÏe²C•dÊd£Õe÷`o™ï5ÜwòF IÛ6yPá.4‡®c¾ßD󨮵:rÍÇG¡El?I›°cU/Yµ~Ô}=Ô—±5öº‘„ˆÉò¹ÉËgx‰3nG]¥X\ÁŸø }È`u…ÝdBFZeèȨùDÊØÑôÌZÒTõ<ìkÕ03¾­äÛd*åÛÚÊ›ªê‹›óÔ€»Ž—rØvLGkEÇî ”0‡yçUÎBb}1¶|™KB&j—Þí$õœfè—tE,HXDHÂ,IÆ †‘zyê›]UO© (ëæûŬ‘z-a+žb¥Á¹7UÓˆ›qŽ6æD SmˆBT9ƒW9‘È:~k aDD<“°Š¨„âÖ‘ðN #p2 ×˱ʓv ¡+j¾Zü~WƒúÚu²/s\k†¡†]ÂÐ[ÛÍ0Ð`C5ä’žÊ9jÉðº]Y·!«´Ü†¡¥,.÷&]‚ÄÍ´¦'³e(ÌÐYÑ ¶»z¥eÓ¤a´Y¯H2¶·Ëâxêôõ*G|Ù¤žñ%ò4™Ÿ°îZ\±<$Y½œœhítž°ž¦ÉJE¦jeù[tºï•t$›¦çT3"Ýʬjy»¸’ê÷€“Þ ð…~4 jÒª Môeàìk™ÑÄgè¦|ǼRBSÔû3Þ3X èðžÂr«g²÷€0[³B ÌFØ D†hñü;(‡e¼;/Âa…Hö“rŒfö£·„–=|°ïì~«â·É¶Zý‚,œAÚC+·mÈn—…\£7Zú3Æ-Á"¦¹·cn;/Ø]4sgŸ,ÈÖ}E´ÉÂ)~[ñüËPývŒnO =^Bì-¡ÏsŒëŠçrE üPK Lg08ÖÁW®õ(org/javacc/jjtree/ASTBNFAssignment.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÂTîâäçæX\œ™ž—›šWÂÈ ƒËL? ¥ Š Ì@—#Èh Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg089L# ©ñ$org/javacc/jjtree/ASTBNFChoice.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dÃTîâäçæœ‘Ÿ™ 4Q—y~@ ˜®&F±@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08†M?c)org/javacc/jjtree/ASTBNFDeclaration.class}SÛRÓP]‡–¦ •HA,U/iS,Þ/E H+…jgôʼnáPSÛ¤“Çð'ôÑžaJGgü?ÂOQ÷Iq´Å‡œ}öÞk_ÏÊ·Ÿ¿X@EEéÆqNÅyÌÄ1«âæT²\Là.+¸¢"]™8²Rqä$|^®ªÈcAª×¤z]f¼¡à¦‚[ ªãå¶CzÓõêù†ùÆ´¬|£xBä·È¿#݆آíØÁCT/ej$Šädn{¶0LéâKÛ…Lã ¦8&0©à6ÇÜe€‚{÷QàXÄKñˆaBÆç›¦SÏ¾²¿·'<™b™cE6ñŠ5†¡º­cã16”8Êô›˜æHaša®¿«åêÊÖúª°š¦g¶ë0L÷£Êå*‰­pÈÔVC›±ýškï2DôÌó¹ªîká< ì¦Ïxeú¡N÷ÙAKûS¸ ÓÖE°n{~Q/zf@Pè¤Wš<ÆÅ0òRÔm§è6÷[¤±RØ.½cÌl·…CÝçôÍ·_Èô™zB•âÛ³0Œëý8B$©s9ƪð-Ïn®Wo‰*c´5§7eÑmµ„¤q }´D=Â2(!›4žf;¾ð‚m*$;èQU³š®/þ*ŒYú)’ô³%%Cé¢K–³tÓH—–X6uö ±Ä¬ß~DIZÙC uù€š­d»~ùèR:ÛAìÊG¤¿ þì‰\ª6BG¼ò.Â~~?@L­½ 'º8itpJjÇŒ.´¬q„Ó½âøPK Lg08U”ÅÈ­ô'org/javacc/jjtree/ASTBNFLookahead.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÄTîâäçæ“ŸŸ˜‘š˜ÂÈ ƒËH?  Š Ì@‡#Èd Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08¾§æÜ»'org/javacc/jjtree/ASTBNFNodeScope.classSÛNÛ@=›„˜¸îÐB€’ˆ/€)ÚŠª·JAòÀ ²’Uä(¬#ÇTí§ô3ªPñÐèGUÌ:´¢Â¥X²×sÎÌxæÌøç¯ëVñFGO3àx¦cSÊÌ)sZ§ÇŒÂfu<Çœ2ó:^  °y té×ÅY§æ·ÃÌ¡4œ¦ûÉ­Õœf3 „pŽˆ/+z‹a@|n»²ãùòìBz!ÃlLÀÁA…Féw9¾gH%³JÇ.á }íÀ“?iÄ$(o™UŽŒr `PC‘ÀÉ1Ž Ž! sX°9–°¬a…ÃÁ*ÇK¬iXçx… ŽM¼fÈßϼ]®ì}øÓÃôCå3äƒzó:Uß«3$ ó”Äiˆ°$ëB†nH 1¬Å5wGóPQNË• §’ l˜²(vOtj×ý€¡h˜1™¨™¿)ºð7†,}ã®=fÄ—B]Ê^½»þù¹P³ÿ1°ûñjÚcq¾ Z4ý–Œ”#·¡0ø²ÿ{³N¢Å*=ú;ÿѸŠ<-~–þ•Ý´NP-Ñ-B[*4zKDHÚÊ]]F~LíÜ-¿’t¾µ¾!ÑEò+2–}…Ô¥E@_évѺèÿŽŒÝ…®{©Ç?é¥Ä PK Lg08~ÙÕ¯ö)org/javacc/jjtree/ASTBNFNonTerminal.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÆTîâäçæ—Ÿ’Z”›™—˜ÃÈ ƒËP? ­ Š Ì@§#Èl Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08tv®Z¬ô'org/javacc/jjtree/ASTBNFOneOrMore.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÄTîâäçæŸ—ê_ä›_4T—‘~@;˜&FÉ@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08ÎÙÇî°ø+org/javacc/jjtree/ASTBNFParenthesized.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÅTîâäçTžšW’‘ZœY•šÂÈ ƒËX? ½ Š Ì@Ç#Èt Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08ÙÊÅ«ó&org/javacc/jjtree/ASTBNFSequence.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÀTîâäçœZXšš— 4S—‰~@+˜î&FÁ@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08¬”ˆ“¬ó&org/javacc/jjtree/ASTBNFTryBlock.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÀTîâäçRT锓ŸœÍÈ ƒËD? • Š Ì@w#È` Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08í¸ZÑ­õ(org/javacc/jjtree/ASTBNFZeroOrMore.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÂTîâäç•Z”ï_ä›_4U—™~@K˜.&FÑ@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08>ÊzS¬ô'org/javacc/jjtree/ASTBNFZeroOrOne.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÄTîâäç•Z”ï_äŸ4T—‘~@;˜&FÉ@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08©baïö)org/javacc/jjtree/ASTCharDescriptor.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÆTî✑Xä’Zœ\”YP’_ÄÈ ƒËP? ­ Š Ì@§#Èl Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08yçÒ>'*org/javacc/jjtree/ASTCompilationUnit.class}TëRÓ@þ„°*DTÐÞ¤ŠW¬Wª ÈÕ⼦e©)iÒÅÑGÑ€ß2NetÆðY|©gS†¶6ÓÝÍÙçÛïäÇï¯ßœÃŠ^œ6Ѓ3M#¢†¨Ž˜8Ϊ— œ3pƒ.0pQÇ%5_ÖqEÍWl¨ ×Ôq]…º¡†›:n¸;:†•{Jï긧à#Fq_YƔ㸆&¯[Ž%o24„Ç"iJ¹‹‚aŸç[Ždè O¸~.‘7ßšÙl"Ÿ—¾‰±édä1Ç œä˜Ä”†iŽÌrån«b¦‹g;{òoXI³>¬ÆFÓó„³È¯«0•ÅEYuéþ«´=\‰SœlÓ¼¥*¢ÑÔ V¨`¬Ö å˨Õ9 ­.•P¾dÒ–ÊÅ«ÑiÕ¹èªÄ*íX¶P‚Q"H¹NQšA¡¬íÅž„íårS¶Y,»‹ïÓÒôÉ|¬–i_RÁm–C^r&pž…Œð)§kŸ0·ßàˆw’º‡¾uêWGú\€á­Bô®,Ñ®/`Ÿõú·ö¡žàg´„ºÉøê×pw ¡}%4~Ä-7 ë³±teoR‹o0æ¿ 9ÄKØO Ch(á (N˼øg´†Bäü—£qòj‹±M´ïv?D>›èPî‡ÿ¹‰m¢sW*ÀG·Á;¸rÜu4•”¹k -e×Mt+Hœj;¶††Otžã“ëºðPK Lg08¯«·ó-org/javacc/jjtree/ASTExpansionNodeScope.classS[OA=Ó–®,C¡Z/X@•½ ‹õn )Æ´Ay(òJ6ÛIݦÌ6ÛÑèÏ21«ñÁøì2~³‹ÓÝdg&gÎw;ß7?}û`MsX˜FWMZêú´hb Ë&8®i캉ÜÐØª^njì–Ûš°fÀ2`3˜2ꉃqÃÒN÷½ÿÞo0P±Þkºïêë&CE|ùrFòà ÃrŽA§³G›6#‹òóˆ› %«mïÓÖ"œaj‡’ì¬íݦ½ÏQÃEŽó¸ÀáÀå˜GÕÀ:ÇÜåð°Áq ÷9à!Ç#48ã ÇSiY³rS¨R(™åÙŠ…î”{J§&íu›ky\#mû¤)Z)-”c«] §sÝ 2ÝæUüñXÿ7é µÿ;ü?$§¨3¿ªõ6öHoÌSƾIï§BÏ (ÐOýÑH!4¡`¸”b…);õ/`ŸRÓãutßA EÚ7ç3 Н\:”L%(…á&8§w=ÁtvȈ¦C¤™àĘÍüâ7PK Lg08E6$Ï"org/javacc/jjtree/ASTGrammar.classRÛnÓ@œMÒØq ¤&)”šrµ‚ —d@”HT‰¢ö¡U$Ýdk9rlËÙð_ðà"ø> q6.5Ab%ïÙñÍíŸ_¿xŒ—ªXUpMC×U¬Éz£‚ulh¸‰[6ÑP±%áÛ¹£â®¬÷4\Á}˜ åWAˆ7 %³cõ©´ã!gP}ñÔt\3{qê;#ï£78£‘H9w:‡®Õ×±ƒaURNèE¾s$Ò òßMOOy*Y‹¡êØoOHÍÌ;­†MÛ:â‘G§0-Ot<Å3†bÃ&è9Z:v°ËP¡~Ný}]¹Õ6æ-íï§Þxì¥ én÷˜ÊÁ,]Ñ”QË^’ðhȰmö.Fp­9(Oå2lþK|?ŒO¼pBÓqö‚‰`0r©B§Ï"– µEeXñ¹8œŠd*Þ!?ðÆdµfÎ;¹à!ñÒ O.ÝÚí?–I¬3ÌvÌ¿|HgîÿDvgQ~k( UF õE£‰.ÍþÀ=°*ä*ÐGo WédÐ]"e{ý ìòUCýœÒŒo5¿¡ðá E£”aé3ÊÍ Ê¨t1*´eÐ2,7 =Ã%›¸ËçR¿PK Lg08Õ猷œÓ#org/javacc/jjtree/ASTJavacode.class;õo×>.fNv.vnFîâ’\§ÔôÌ<ŸüdFIŸü¢tý¬Ä²Äädý¬¬’¢ÔTýüìÔ (?¥4¹$3?A‘ è*F fa`…²€fi K(ÏÑ’ÞÎÀ¸‘ PK Lg08ù[Þ°S1'org/javacc/jjtree/ASTJavacodeBody.classSÝnQþN ,lOµEh­-þî•úתÔÖB­B^@H41á”,Â.]cï} o½ñºIFÀ§ðIÔ9¬ñBÀ˜ÍÎ93óÍ93ßÌùöãóWkÈ©a9€3ˆª8 R]QIùq1€K¸¬àŠ ?®JqÍM®ºÄÆ%6¡"‰U©^—Q)¹[SpCÁMÕ´êâe·fuC´`ÙT³ú¦Z«¥šMÇ"U$IºÓ ¾MÃ4œ-–Ó+´dÉÉàíØ†é0,icâsûi½Â±ˆ³a,(¸Åqw8Î!Â±Ž (¸Ëq÷dpªU5©’C§62½ƒaËø4Ç&0°Ž-ls<”bYŽ]é„ Ç68ã Cl4›R9/ ”wƪ1,bòù2-Åai‘B|ÝŠeÔ¦5ý9ÃlC8{†ÝuÊÖkaR°¦!dè$2'¸f^‰†af­V¯MË Ï'º}ÕNG˜t]R+üÍSZ1¹ÔÑM~Çr- !mGˆ0e.ëÚÝšmtË.‹·ÔÑy*ÓtùÈZí¶]NLèò˜”(çÐ8,ƒ2™•4Ì®°}ºHfàN§| Õ?DÎ9öÑp[‡=aÖñ⿳˜Ø‚‰½‚=”½>N9µ$§è§!&Ë키K‹/€C,ôoÿ!¼ô"~‚©>¦ß#O à9Ž÷á}ô•uOØ“<òÑ/ð? °Ú‡œ!Ñ/¾ó°?¿'ÜðÙO8•èã´Ô›s7I:l¾ {=~PK Lg08Û/§ÀŽèorg/javacc/jjtree/ASTLHS.class}RÛJÃ@=«I£q½Õk¬·zmª¡QDQ©õ¡5ﱆ˜ZIƒøCâ³ µøàøþ‡:E„DÙIÎ9{fgf_ߟ_¬#¯BÅ€ŠA¤UtcH,ÃÝÁhÆ<®BÄ‚Œ‚I†Ô–ë¹á6ƒ”;ÒM {þ…Í _®2h¹’8Fݺ±j5£^Û6ŽN‹ºÉÑ®`Šc3³ÈrÌ!«`žc‹ ©«—n“c Ë r}ÐÆã~»•jé°Â0§Ž«ÊÑ™2qZ•šMìˆc‡û^­á7]Ïù…o&U ø¢þm,2ô’ã4êe{”?—´#"IÍI]²~Äc(©Ãž}+:ûW?y‰“˜VàZç ªb˜r ­Ñ°<Ǩ„4§˜Ø±Èã,tM3©ö¯$Écçˆ#º‰,Ý)âé —î¨[ô•¦¤ò™'°‡HÁhìýßü$¤(näÛè8É·ÐY¦E*HkY“5éò4M^I§V[PÚèÒd òýÇÛ—>PK Lg08z"…euF )org/javacc/jjtree/ASTNodeDescriptor.class•UéWWÿMX2 #ƨ¸€jÅlk­U¡VDT4-ˆÕ.vL “0™(´µû¾·vÃî­•n\ƒ§œÓ¯=§ûµ½wæM{lÎÉ»÷½{ïïþÞ}ï¾ùóïß~° ¿(ØŠÇêP…ÇýxB!éLN°ö$k'yšb-­` t†lƈ§4À1Êò´‚ Æx0yš•‘ãɸ ‹Ñ<Ï(¶Œ‚Œ3¬ž•1!c’<%ãiÏàÏÊxNÆó2^Pð"^ªÃËx…µWe¼&ãuž¿!ãMoÉx[Æ; ð®ï1+Ã÷™"É$Ô k§õ´é¸¿™Më½é¼„`bT;£Å ¶‘‰é);kuH¨csRÓÉAf}@×M ËË|÷kùS¶v2£“{µI®%¨ŒfŽÄlË0GØfä÷ JPô‰œ¥çóF–p≬5gçT*>:j[ºïLR¢=z>e9¢ÑS ”ÚNÃ4ìê ‘è&_B5Ì´>Ì&šl-̾“L„¯ŒèvÒ+ɲP¸RQTá#êÒ÷B†´LòW…˜Y] © h~IjüPÖH;t²uMQð/ õlp2§ÏÍ’NµålN7“NÚ+î¼BæÅs§pÂÖ'l¢›Êdóº Ó`[š™Ïh¶Þ;¦Ð†P…ò fOëfex¹3•qÎIE7ö¨xÛ$¬½ƒP±©8ˆ„ŠíØ¡¢ƒ‡>$UtâA⼊ð±ŠOð©„Æ[sï. ëgMPUTñ¦ü¸ âsù_ª8Œ$]œ3Ty_á<Ñ 9n•àÛѪ¢ »©;ÖÒ?¤bs—èÆAÅQŽ”Â~|­âRñ-/(ÆX.#j·ÜÝÚFïPR¤…8ÜáÇw*¾ÇE?~Pq‰÷9‹ÄĶøÖH”øGüÄ›rJâAȱVv Sc­Â‹›²Ë2ìÉP¸•Húbó3è6n½¹–VèZ Í Ï… GÂÝP}*kÚšaæê“´½òÖr”;øîVå t‰¶U°Vð_¸DEÔÒ鞌>¦›öm²POÕj9*+5LìŽ.º{:¼Z”Yh[vöYÝZž6é·ô\FK‘Öêî®Ü¬úxAËP¿·Ü®^ý9›ú‰_JêϾBÆ6ÜFæ:²èyš Nú_ž¿×°ò¶ÓmšB•^2·%¬¸‰Þ|Ãíd~»Z ®ÚtšÕ`ÊgOÑ«Ú_°ÑF_”­ô‘ôÃÇMšÌMêÈ!©KÁ?jcGîrüÀ-Ec€þô @Bi+ÇG²>Ò4)Ru¾+޳Œ½Ø'œÚ));­žEÕ±ÀúT'¢‘¨‰Q­¦èe³½"&@’ÕWá÷¬*Ye× ~p„u«È‰Q—¸ …Õ_ÀÖHURTä:jŠXDè´²èŠÀ WJ`l@µ“£m Çf°8(b‰ l œ(b)-±ÌKßC"´‘’s¨ÂîÁåE4þêxHüj Ÿý§“||S\7ËŠR[,Gf°’V‚«æ[Eæ‡K¨‡j9­þÃݤ‡lš 6»úš)ÈÁ»¦‰e /Ì •móáÊjâ·ÝÄÝShÀ7±v>­à=^è`)t I­q( ó ó:qVyd×V”É´—“ññë-BÆiVERç½±þ:B̼q +Ý•0¯4;+µÁÈå`KBxö‰$>1òtÓ$b"öj§QO†Xßô?E=Æ”ŸŒÇÝR7{Ä7xÄ7 ân™C ìñ²Š·Ï?î9§Mœ•c8.¨•ÚÅÜë5Ë£¥vˆ:V e› þ¾kð—4y[H»ÿÑÿPK Lg08y=tuÙ$3org/javacc/jjtree/ASTNodeDescriptorExpression.classeOMkÂ@}«1Ñ4ZðZ/ÞbKYïJ¡XŠØCBïKº¤›Ú]Ùl?~–^,ôÐà’Nê1Ûy37s<ýüã2„‡0D¢]ª´rw ^¼=Ì̳dè9+t¹N.ÞDNÄm¼26ç…øYÆ‹ÂY)yj^¥žŒVË7Bç–±ˆ%Ë&š Vt2…^y}vÀWâØc¨î ÅáúB ÜnJ5Xg(nH%ãï²wZ?Él}ÂZ:*…/ÿÒϪ­ÌFt5—Qw‚ܰ[D_yž§3Še 4ÕWâP¨È±·s,ijfïáÀÕŽÜá0=Ïí¿=µÞÊòqL£ÂQ†Å1nb…ã>s|AÝÄWŽUp†•lÇÝ^2ɦT}êİíîöÈìÅXz-½í‡ÂHZ™.—Ä;Ê?c¨½ ›Ö£túKÆ^ç$f¨¿²/CAjMФÛ-Ñåçè¥MÇ-K¶@ †òêc0å4îÀã¹+$ϼMAM‚dkNû†s ãùs”œü¼Šw)\—1ÍDÈÜEš~Z𮦔E§1QþFIò‹i¾ªËÏQvÚ·(\¶¯Q¼L OPK Lg08ärÊý{"org/javacc/jjtree/ASTOptions.class;õo×>..fvvvNF6›Ì¼Ì;F OÍ0 土’ÊÃÀÂÀÊÈ “_”®Ÿ•X–˜œ¬Ÿ•UR”šªïâ_P’™ŸWŒUÚË+Hù`Pd`ÚŒ@ 4H³YB@q& ͦ%½q#XPK Lg08ìƒ/ž²ù,org/javacc/jjtree/ASTPrimaryExpression.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÃTîP”™›XTéZQP”Z\œ™ŸÇÈ ƒË\? Å Š Ì@×#Èx Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Kg08ß¿;Æö%org/javacc/jjtree/ASTProduction.classR]OÓP~Î6Ö­Tùr¢|ȆŠ]7,re2Bb¼±¦ÉÈȸÁ®œ”.¥]ÚSàGqC,‘„xgâ2¾§3Hž¤ïWŸ÷=ÏûäüüõíÀÞ©˜À¢‚*2X*â1Ê **Ɔɲ4/eúJÁk*e²"£7 tU†\`s†éíž}b›¾¸fKD^à6ÆÅQžÆ¾‹;H"<ßlsG„Aò±öyÌPº÷÷“ »ësÌüL4ÃCÞ’ÀfrÜ峨uà <±It«Ú&÷‘PtËGñe};Œ\S^á8f¯'"ÎÍ;T£jix†ç “ÿR”uCÃ4fˆÊ 5^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÀTîP”ŸRš\’™ŸWÌÈ ƒËD? • Š Ì@w#È` Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08„uu§£êorg/javacc/jjtree/ASTRE.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dÇTîäÊÈ ƒË ? M Š Ì@ç€#È< Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08;úR«ò%org/javacc/jjtree/ASTRECharList.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dÇTîä꜑Xä“Y\ÂÈ ƒË@?  Š Ì@g#È\ Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08ƒ~oÕ¨ð#org/javacc/jjtree/ASTREChoice.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dÅTîä꜑Ÿ™ 4P—q~@û˜Ž&F©@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08È$5`¦í org/javacc/jjtree/ASTREEOF.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dÂTîäêêïÆÈ ƒË,? e Š Ì@#ÈH Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08”cu§ï"org/javacc/jjtree/ASTRENamed.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dÁTîäê—˜›š‚UbšÐ:Ef ›@€‰d(dò„€|& ͦ%½q#XHž*/ ÔÇ ¤Ùµ´e¶30A0PK Lg08÷¨!«ó&org/javacc/jjtree/ASTREOneOrMore.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÀTîäꟗê_ä›_4S—‰~@+˜î&FÁ@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08r’(®÷*org/javacc/jjtree/ASTREParenthesized.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆàjÀTîä TšW’‘ZœY•šÂÈ ƒËT? µ Š Ì@·#Èp Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg083›d«ó&org/javacc/jjtree/ASTREReference.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÀTî䔚–Z”š— 4S—‰~@+˜î&FÁ@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08%š`;ªò%org/javacc/jjtree/ASTRESequence.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dÇTîäœZXšš— 4R—~@˜Î&F¹@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08Kଧî!org/javacc/jjtree/ASTRESpec.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dÆTîä\šÌÈ ƒË0? m Š Ì@'#ÈL Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08¹Û±i¯÷*org/javacc/jjtree/ASTREStringLiteral.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆàjÀTîä\R”™—î“Y’Z”˜ÃÈ ƒËT? µ Š Ì@·#Èp Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08môk¬ô'org/javacc/jjtree/ASTREZeroOrMore.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÄTîä•Z”ï_ä›_4T—‘~@;˜&FÉ@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08½²|(«ó&org/javacc/jjtree/ASTREZeroOrOne.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÀTîä•Z”ï_äŸ4S—‰~@+˜î&FÁ@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08i8$°ø+org/javacc/jjtree/ASTRRepetitionRange.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dPÅTî”ZZ’Y’™Ÿ”˜—4X—±~@{˜Ž&Fé@’Èò™€4›–ôvÆ` y¨¼0P3f×Ò–ÙÎÀQÀPK Lg08Ù³«ò%org/javacc/jjtree/ASTTokenDecls.class;õo×>^.NÁÅÎÀÍÎÀÃÈÀf“™—YbÇÈÀ¢á©¤œóSRT4|ò‹Òõ³Ë““õ³²JŠRSõ½¼B€T@bQqj‘5P5+ˆà`dÇTî’Ÿšç’šœSÌÈ ƒË@?  Š Ì@g#È\ Éä ùL@šMKz;ãF° <T^¨H³kiËlg`‚(`PK Lg08’CVœ7 org/javacc/jjtree/IO.classVûWuÿÌÂ2Ë0&" ¨È$©Ë.±•¦¦¤) -ñJMÃJØÙepÙÁYdͲ÷Ë,{ššeOz'& Æ9õ[?ô'ôôWtºwfXNí9{ï̽÷{¿ŸûÜýóŸ_pnKxÇè+E3N”BE?? ðSŒŸl¢1‰3IHØŽA&:“!&'%$1,!#€ §.Å:˜üd1Ɉ•PãLN0Æ<Ëš3"ž–Èö,“gD<À¹ž“P爞à…^”ð^à½*â5 8+âu adE¼ÀyoЏ QHYFòy["ÄùÐ;LÈò]ïIØ÷÷|(â’ˆéñ”€ŠŽ!uT$ÕT"rÈJë©Ä.R¬òéDʽnDjjLKÛÚŒ% jVÑC§¬£iÝr´Ãfb‘–C¤cÚˆ¥)S@©é†,ãaD Xs&Å)ÖÕ¤~F‹):Ú-c7öˆ¸,£­20ic²ûd<„=¬Ø/ã1‘qÔ!QWqUÆÇÌ¯Éø âS×ñ™ŒÏñ…Œ/ñ•Œ¯1. z!ð}™x\KËøßRÅ›††d|‡¶þ^€ì¦š‹ÅèéÖð£€z#ˆ°r` 24D%Ð"í퇉E»gC§Jð1E@™’2,%ndR±&?±ƒ&E7U‰éimÀ2ÒÙ&¥'©©¦¦dè«*£”š˜ÂUP¸ MT^Ç¿ˆŸeÜÀ„€-ÊiÕTZJKSábJVq4)J‹šâÓ™T^¦¨ UOÑå79=Þ°œÖ°~.3]™d²Ç &ÑÒžhÖzR§ d¨5³mЕ)£º‘TY¨œä¬t–ò¬X†bŒh)JG­÷ú.ÃjåÄx\­tõždÊø·dL"'£ǸSKÏ´,ϲ}ŽÉ´€ÊÎfKq^qÞI5ôâºF»iøçBïÍÊš–6Lå¶Çi!*g@IOfÌAuKµN·;0ËæíˆùWÙ=KݠʨIsÁ;Øv5#¦6¢Rcé–A•r"´P&U“&4¦uÇi¯£ QžÎL¿™÷ZE¢B“]¢ŽPåbÿ×.pFŠ7‚e¸€«ƒÑ%|kcºi™ö¶%Üeº¹ß‰ù¹¢pL-i§·––¶¤ÑoÇ¿L7ÛÜØG'6@X3Ý$R–{T‹*²šžò%°³îPîY·\ ¼ÜiœYSÚéÁù6¼dëÈ ¯â•sVùUßp„~1›é?P¯Dzòñú³9íB›Ó&´9mI›·ÙüúÒ†…€vzÚHrZ…¨ MAUø&Qº‰âIø‰•LBœ€óyù#+ˆóèŠnäÕè* ¸êî‚§K]u- –\õA* ö»êÃÕ¢«¦ß‚¼ºŠ‚õ/eçáÊÜàŽ.i"Ï™¸)«Ì_`“–¹ÏZlÏ[„ÙâHŽáŒÙyóç°œ!:o"½9N|¼¶òN.¡˜ª œŸFygcÅŠ*.ã\ø&VæP¹»ö*ʵÅ'rô?%\ÞD¢mÅUžëX3ƒêÞ)¬"ì«+jˆä°¦s­áªb²Ýé¯ñ³”\-aX늋øÀZ¯²ÑÍè”.ƒ* dIþžÁºÞðj;sXõ3¨ëÍ{ªPè¼}ËŽ£)løÌê/c½Ç̶¸k΢bcx› Ølž³ ‘› ·ì z¹§šD`Ç:ùiÙ¬Ó‹¦)&ï¢ó¿ºžîå— Š¸€‹ô–ù5ÜmóÛˆØü/LàIúSëˆ?E]aç 'ía¥NšÆ}ÓØÂ£§{ëîïÑÝÛ&©÷f°0íàŒ>0…“Ʊ¡Ã‹tä šÃ9a·ÜVj¾þPK Lg08ä› ‡Ö,org/javacc/jjtree/JJTJJTreeParserState.class…S]Se~ÞdÆd ¥µXhÐ~Ð6YÄÐZ«ö#бÚЭ ˜Ô¯5û „$³Y:S¯üþozá8Ãu†ÂÄÎ8^û/œñôXŸ³ÙZ„2Ìsλç9ç9ï9oþú÷÷?LáëFqÙÄ; Dp¹#xWà=+W®%q9÷M| vZàC¼‰Ä‰‹÷IIÜ(ÌÜ’hQàS³&æbõ†«[ ‡‹+Î}'»îWkÙbµå_ehÍñVŠ´š ª@gmUÁ’„o*žv|íò{Y¡ïZµ^õs ÑtfQÁÈ“¡b¾ËcˆÌ˜§[ÚWˆ{†?ÐFÓ™bÃ[Ί|¥’]Yñ=­³c ñæzë^‡w"½M4Íf£ÙáÅ›Z¯vÜ~é`Ú«ú}Þ` RÓŽ'ÑùJ£IÊ!b}×™„FKïúÚW¶ ºû‡Ë™E g0®ptg²Óžç<ñZ8”…1×𺅓§pÚÄm w0ná3Ì+ ÿu øÜÂ"¦,, o(Ш9õål¡îëeíYøB¢“°¥’…²½‹7,|‰K¾’ㄳ˜R8·Whffÿôn;^K{ó>7ɇ²£4÷ÝŠ®p›Ï?®93‡¾,Ë>–.dŠ/fq¹QÇu%º7&OÅhU¿§\Ÿ§×÷e¯Õº¿èÔÖéé`ö&ûœãúø&éÍkŸ}ê:“†±ãÆlBŸ€ùäƒÅù0}ˆVÒcö&⿆át¯z†ªcØh£_N¬ã쩚¦†i’m#ÁŸH> y\pÈ;Íæ#´Ã›hÊ`É.m¢Ïø–Å»u'{u`uovHnYZØ„ù3NÙÒX§¹CÜ†ÛÆ€ˆná0[”ú+ìö:z³§0ŽóøžŒçïÀ÷f ‡wM4ãvÇx¡wÏû–{^ìr~AÒÞÂÐÒÆ³§7ÞÁÅ^­©°Ö¸ä<Á`IêmãH8=Q`‡yT¡›ý.…Ùef´³˦J†{ý!F¥ÉÙI{%‚‰ÉTÇ¢Øxö? óLláUÛxŒøŽÎÛ¡ÎT‰Ñþú wYåxî`Á1 æòQðŠ1b„’#ÆX¨ù÷‹š8÷’G{á?PK Lg08†ž½² ùorg/javacc/jjtree/JJTree.classX xÅþGV¬±XšÄ!! ,‚ãC §C²-'JlËØrH Å]Kk{ƒ¤»+‡ÐBèMï–zQz¤Gz@ÀqI(½éMOZzÐÒû¾[h¡ïÍJ²dÉ|8_Þì¾ýß›wÍ›=øä½Çlç†áà†&\ƒ„q!^Æ‹ðb‰ÃĹIâ%/•x™ÄË%^!ñJ‰WIÜ,ñj‰×H¼Vâu¯—xƒÄ%Þ$ñf‰[$Þ"ñV‰[%n“x›ÄÛ%Þ!ñN‰wIÜ.ñn‰;$Þ#ñ^‰÷I¼_âÄ$>(ñ!‰‡p8ŒÛô|”ÉÇBøx›}ÎaÜ…#w‡qfC8ÊVßÀÖÎ1ù¿Þ+q,ŒOâS!ãÜ q÷K|šÇ$>#ñY†|ŽÉçYè !|QâKaìƒ_fÖW$¾ÊÓ|­ _Ç7$¾Év=·øã·ÃHâ;L¾ÛDä{a|‡ð‰†ñ~$ñã0®ÀOûS‰Gùågüòó0Ã/Âø%~Åä×aü¿•øû}øcáOadð“?³™ “ áo!ü] `Ù«lgªk¿1c¤R]û÷{ŽivÅ[/¶r–·] ¡uã`¯6D^`eëã»2FnªkÔs¬ÜÔV†hÓf&?ž5]ט"h0kX9š õÊ:ð¸ÀrÖoë:3‘÷,;çj(`Fƒ OÃ?ðÏþ¥áß8H¶Œ±Ên ×òÛ™:ýù¦ê¶’ìtMÏ#½®nåòoÒÊÐü¸´eÁ÷ÝruCwÍk f.Eâ“zYÔ5ó†cxfZŸ8¨»y#eºš.NSÂêÙ‚ëéJÜΩÁ›6õI;“±ð÷IÛɺÝíli§/œ3²æ¶#S0õV32éÐ;G“Ñd¼wÛ¤‘q͵èîzèîºZ÷ÿZÉ5‹Íœ§{vÕäžS0#º^¥ŽíTІ T="eB¤¤h(QVµ+Q' µcê9ÛÓS†kRr.e|ÆìÐ][.eÖ8¨·tænÒHZ½” œë™Fšì¢°¶”µ·åEí*,n9 F>ïØyÇ¢ÔqàU*R¶ã˜nÞ봃 }ã;t#—.Ë™!bÑ”ž9E$Lµ¡*ÔŸ„òZ’ÔMØvÆ4Š3§‹Õ ¼+%Ù7R¯ýkM›“F!C1¤èSˆ:˜986Œ×Ï£KYVð¡D_l¼/Ö%±ñ=‰xß3€ö&†cã;‰ÝÏHûØhlt|8:2Y®<í‹ô+¡þø@lôé=MŽD{w'»cCóÈÅmÙ'#zÍ_ üTÎKe®¦EéÛÕ·{|Old4žZD_Ë9‘óZªB1<ëï] M2|ã<œŒîˆ-¯ÆÆö&cC}‹b¶?ÚK‘Ø÷4XµpcÉᱤJÅ"&;fÖž1ýΨskÔÝÂä¤u-­†tZìß_š¶¨ª/>«žºzÚ*°»’#±Øx­Hë7/ZÃ5?O¥Y‹)ï‹&£ãÉ}ñú³Vac{{cÃÉŠ¤VcÉ:Þ¨Tlö53ï¹ú.Úƒz{KEÒ¡˜¶¨±[7Óñxë 6ÇÍcÊÌ™þFÀÑ¢ÐÛ¦Z§²ÚÀÓ7Ÿª®gN9F6k8ROàÄhy®û¦`o1l,¨6¡¼cRã¢]Æ¥¾Ã«h¡7mÌe¤üšVÆç+->°8w牂•Ië´‘lš[î„*íäC”û‰™µæòeøMÑ%‹jç25å¢i;UÈRóW LØÄ:¦=/ïvw ‘´9áÇHÎôºH¦ËL{Ù ‰,S[Á³2]{Ì”g;!üGÃãxBÃñ„ÀŠùï; wÚ3&2¦†ÿáÉžÒhŸ¡c…2§‡=4šˆ“ê[4\Ï'ˆëˆˆ ·µzó¦Þâ#ZôÔôiG¢1¥¼óÅ—!±D"DG–…ç•Z0¦#°tÀ ½£$«·hBŠ&rB+xŸ3TÉð&©‰°8A -ƒÖµÌoZ¹gŠˆ&4Ôĉlú³ø˜sF­ƒ~lã‰Øµ\Ó$M‡±˜ã¥“‰Jw·®‰¥<{óí¤ê@âØYíkbiÔ#üOËEsH¬ÐÄIœFM¬«¨Å.fÀ0×™£‰“Åj:²‰5šXËVŸ"Ö…ÄzMœ*N#_k…©uîðKVàŸ×™.dó!AVÎ燎œ»UÕ®Ù¯èÛ™â,Mlg‡D«&6b&$Ú4ÑÎ&tðK§&",ßÍQNÔB.-•ù¥íR¼ô& ™ÌAŠiíâ¸èµf+ok#΋­"â¥RVUSFkb“8G›Ù¶-lÓêÅbZZ*J>1±Ÿ åcÊô]:ÀœÜºÑ?D[v×0U¤GuiÙ­¥Y«Ù¡<¿eru«ˆò0D‡ù>ÓM9VžÖ$ásĈ§]*™…+–&iâÏCTÕü{ˆ'L”áäÏð\v.k™ÅèåÇÜçÇŽbÏ©¾¼ónìžûqEw°ùÊ9<ûV„×›Ÿ3‹«|äø!tv/)Ïõ\R¾fIµM%›¯)ÚgøÃÄ,RsHÏÁœÃdYÇTÙÞé²–C¸jÞïý¾ßW×÷»—-ã:‹Kr¹*‘†ù¬u‡ŠkB÷a)Æ£x »DF¸b†Æíâñ,q»xXô"ÃïÀ×|(3lr[áC•j2¶2â¶ ]Á¥ÌÙaØ- Žû ƒ¡Éð C‹Ád°Ú † { û  ß2|Çð½‚`ó?*Æá±eteô$Ì IäºÆ0ñ –0[8?;¥G‰ç—L7¹'%aè×½8‘°pf±ãv“0¢ueèD±5œcwÌð _2“È úÄ( î‘Ów3ÊlöÜæÙ™¹,‚~<ôÝc7H(åzõKé9¾÷ ?“gòììX\ªÀLñŠ/žtå€ÔZïúiDŸãí¼b*>ÄG*>Æš¨(aMÅ'¸©ân㦄ŗ¤ªâS|&aþÿKT!+X•p…’kišm´­fÛ²«zK«XFk_mý } S÷ÛuK']FU³›-­¦ïIP3¯\Ù-oi§®¶giªI:¤n¥^6É™MÓ"®mêÄžOgªZ­L¡íŽ¡W)|žAM¯c±²­(zC·4›oGªMÍÞ6Œ]ú®Õâa-cWk˜§iÔÊéHÄÔm›šI™¶L­ES›m½^µ3}Š6ÉÝÔiå•#»Z¶Ê¶µßÔdÓᑬ)org/javacc/jjtree/JJTreeIOException.class;õo×>..fvvvNF6›Ì¼Ì;FQ Ÿ¬Ä²DýœÄ¼týà’¢Ì¼tkÍ0Fçü”TVFåü¢t}ªädý¬¬’¢ÔT}/¯ åéïZ‘œZP’™ŸÇÈ 6'3_I”A h-01Ð4 Íd Å™€4›–övÆ` PK Kg08Ã÷IjôE "org/javacc/jjtree/JJTreeNode.classUëSUÿ-lÈ&,RR¤@¥µØ$M–V¨Ø6Ò–JC•G¥jí’,ai²¡ÉÒ‡õ-Zßïªõ…âƒ/~(3:2ã8ãLñðp:~ó³xÎn.ÕÌäž{Ïùç=çîoÿø€øÖ‹ð@ÄI/-n<ÊœA>œböc¼<ÎËÌ;íAžäÝ7T/†øã%΋ÆË0£nŒx¡cÔ‹ ðî,ï’¼¤`04íÅÎy‘AÖ ãÎ3ô.J¸$á) —%<-á ϲò„ç˜>/á /Jx‰ MHx™­¾âÆžÔ¥žL\7Ô¤¡K€kXÏdMuÝéL"<ªžWc±ð訙Ѵp_ú¬f´ “*C¼FtS7=ãtN (Û¯ºÙA€æ®–"‘t\°¹ÙÁÖ±c}DN¨™¬–i·Ð’D2šj’J=pPŠ’=ò_NǃñxdDOÆ48™·–YoB3‹–6·PŽÞìVÉsÎVvìÚÉs!õŠìr´£sÌÎe2Þ­ÑrvÙÑ5–Ñ ®µ“‘®ËÂ3£Ù$U¥+¥&¨4¡;xìfn8©‰p¯I¶±Ä·¤Yw´kuÕÕ¨Ni†}[‘t*¥qÀU¾Ý?[ðŒ鬶ÂĪL—§½jêic•àl%ë2“ÛýJ]Z2îC›Œ½ØG×w'mà€Œ£wa·Œ{±GF+/GÑ)ãUÞ=ˆNµ«”•]½&ãu’ñ:dC/Éxo X·2¸CãÃÃZÆ·e¼ÃJïâ=ïã⪌Øc7Ž»ñ±ŒOpÍOÙÜgn|.ã |)ÀMîûFô¬ŒI|%ãk\¥±´C¢ÝN³Ïd¨êQk4…fú·Ð¿I@UX90”ÐŒfÞÒÄž§hfš”0µÁ )ó<ÄÓˆ§„eô¢_d|ƒÝŽeíÕScIÍö*ÚEÓFî/ÑÌèxÊšç F¹Í˸K·;ßçÔU+y”oR3æmb#jæ i¿G:«cÔËqžñÈíaמ'ÆLLÕ4;¶œÓbºš,<«\¿©'³”¡÷zŒrïÌÆÔ1x[›fÅÉUÓ  ð;éS5ëŸÂÞM1iÑÐu<Ž„_Âß»êºÚ+l)RxeÚ¹q•“\PÏШ3Û[è›PI.Ya@ÍèêP’œÿWêÅÛ(ÒºI'ÇS6Ò÷k'}E”ðHÒ®„§Ò¢­yJƒMÔçœÖv:Õ¿„h¹R?A)CÉ øÇ ýy ¥DË”†y”ÚrîGG^î'©À¼ˆƒë r=o‚ž‰<¤ž l¢R Wàgˆ 9”|Ä¡<°š(Ûr)³pÿGŠñúòñ–)õspÔé­qP— aÆ‘ÛÔs êGÕ=õ.guOAž­¼ü åXFô²’ƒw–Ššƒü=ĦÇP185ÑPp奭.¿‹Ø•ShSü®ª¨"mbˆ”¢¡:ÑÒ+›†¬„9TO/þQ'ÒÆÇotÂ%L/þb'ß¡ÚÒ)àþ´ƒ?†Krâ ]Y¬½žG‹âQŠÙEôôj’ƒ뎗v4æOS8À»Æj[E¿Xå™Ä&"ÞIÔ©˜D yÁª¦î:9 oÐ/òn¢”]æPgûù·ý ;íZ [Èöúhè&JdýM”3‰N/þE¬Ú Ê¡þ¨W­<§o)7°¡M¬EUP Å3£ïîš®Q$\¨Eî&‹;@ûr>ÞcØG‹³Ùâì)r,æ‹Ù´”iñ·Z|IiX¨OJ®áä/þ¢ï o­ÓØøW«ÚfZƒ6 VË\i ­ë½5³,9«|NàáüµµRùøV•ÀMlRøîæÑìkɵ/TvË¿Gñ—Øx¤Ø®kÉw»[ñ…ŠÐ«¯°¸•@iÛ¯ýyÀ~sóìð…£ ânò,ÏbÇóA…8žmv<Ñ ‘rû=”·ôPK Lg08¬Ê %org/javacc/jjtree/JJTreeOptions.class•UK{ÛD=jž8j“*é#ZC¡$)Ôm)HiêØrëĉ%»IyÅV\%Âr%9My”7ÿlÙ°€.J€ïãðKø¬ù¸#Ëñ$Ö†,F>çÜ{gæÎ½7ýûûŸ.ãÛ8fæKf„•!Ëpk·‘cXÁ2ò + « †"'Þf(1h :C™¡Âp‡aaá.Ã; ï2¼Çð~Ó¨òåƒ8 l0Ôâ¨ÃäÌ&CƒïñÅâòÿµƒÇ|C3GÂðu«iù7$ LÏT$ ¦ºINJ`;†mÕ Ÿ˜£ Ó_ªoWL׳œ¦„Éé™ü–±c$m£ÙHj¾k5óäAf+mÛ·‚€w%(D¬RÌŒ¹i_q¬º„ñÔjN˼í8ÛŽ…TÖ¨ùŽûPÂñ({¦W4\Ït;ÜbÛ²ë¥e›ž„8q˳ȫEwÚ¶îl›M¯sln\tÍMk··ºë›Í:È!‘¶ ÏëéEŠa4Â{Ú~«íóý$Lô¶Swkf˲¡ôØŒáúÙžæ)[Ò]ÓìÈX®^n¼›=ËIò¸ó2fqQÆË|iᾄѥÌrµ¢–´\a•ryåÒµ\èY†VÊy=C[ÆPZV µšQ³)â«•B.#a,à´t¡¨Vo Ë´gÀ”5U«S%M-µXÎå3Õ@Èæòª&c—ŒUrZN/…¬—Réåª^XVW5:U`Z,©ÙÜ*¥édÒáÈ,uK•€.£®éêj†œâLçSšÖÕ²©4…_§€…²^,ëÁît‘pßj&¥§ªúzQäÔµ´ZÔƒtœ¢´–Tµ:gr%5ˆ'cWeÜÄåÊøKXè‹™p‚WK<°l;±a&¬FÓqÍz³š53š',/±iØžÃ'2>Å# ¸,„Û?Îÿ 'ã3|.ã |)ã+|-ã,RVÄbàµðHÂ9Çm$9_«%·¶|*£dXMÁ~T¬S‚E+h‘ä¾&wNU1ì6ï’±N¹µ}ËN®-êÔ£zLªP sÓBW6¶¨`çû™™~ŠªÇ-:ŽmÔCÙT^£GœÈ÷‰ä1¨—Ê$Žž#4•l³ÙðïC$'álÿE—¥Óªë:.]/öÀp›ç‰éþ±ÄÛ¨üò!áB”UÔ<“7:§ ý"£Ó”6ï·éut³ŽÁCS šÇ3à“äýO­ó¡ãô¥>ÂÐì¯~ Fødå0pïáÈc (ƒÊÐoÀbÁzhäŠ@£üG{èØmìWŽ÷€¢LôÀ¤Nˆà¤N‰à´¦Dp¦ º¸´Ÿdàüžúçöðô<ó˜rv£Dˆž%ÔuNÒ?⎳:+ƒ{xîçP¿‚«}zlç õW"ôA¿¡ÇýÕˆýO û¿á?*ø¿¡Ë‚>¡ô7"ô1A3â|ãÂùæ#ôIA¿¡Ÿô·"tEÐoDè§}!BŸô›úiAOaq¿xp„r†ôe)¯LÌ>Áóßžë…üÿÀ…uê¼ó;ÎøPK Kg08Á<äწ&org/javacc/jjtree/JJTreeParser$1.class;õo×>.vVvFÎàʼ’ŒÔ’ÌdvNF…ü¢tý¬Ä²Äädý¬¬’¢ÔT}/¯ XTœZ¤bÈÈÀÀÈÀã™——Z䜓X\œZÌÈ Ò Ÿ“˜—®ïŸ”•š\ÂÈ ‡ß )L ÀÄÀ ¦Ù˜ (ÎÈÀdqPK Kg08Âìæl,org/javacc/jjtree/JJTreeParser$JJCalls.class?KÄ@ÅßÜ]n5F=ÿ6V"§Mì›T-û5Ž!1l`7ˆ_ËJ°ðø¡Ä—p¥ˆ 3¿Ý7a¾¾?>\à Æ3ƒ]ƒ=Á¸T'… zª|èG7­/ÓھآHëºóªé²}VwIµõ¥`âô•B“ç™mš HΩÏ‚²œÿâçKâÎú þdÕHÃéUåªîšÎó³{:gí£&ØÄ–Á¾àô>‚Y/JëÊôö¡Ö‚ÓÿÝËEŒ¸`2D„þLa®­êu$ÌÂàDä6o;dÿ¿CÞ™`ƒ9&GüŽqøPK Kg08ÁÌzÇï†5org/javacc/jjtree/JJTreeParser$LookaheadSuccess.class…PMK1}³ÛmêºýÔ“ñ P½Äž-½–„Š÷†v×’@² þ,Oþ”t¶µ'ÁÎÀÌ$oæeò¾>¿Üâ4EŒfŠšm.¡>Ìm^Žqÿú™P»¹è@Ȭ5~¼R!˜@¸êO_ÈB½)­eQ”Þ9™9¸«8Žfï¶\š2×ÔNòÀäÔ¹µ4j>{ÕÚ~­ó÷ª]È•² yï½ó„‹C ÎÿoaUbÖ£²ˆ÷å >u9³ HnÖˆ>°³ÇÜ´‡£_˜vp¶„”cÁZ\5˜¿…Î6PK Lg08/_ÛRFht€$org/javacc/jjtree/JJTreeParser.classìý|Åù?ŽÏÝÞÞžNgé$ÙÆrïåÜÔ,Û² î½áŠ0Ø–eÙ–-K¶$›jz Õ4ÑûQL1`‹ À@ % BBè†ôNè7ïÙgwgïfOwŸ|óÿ¿â—ï=;»ÏÌ3óÌ3ï™]½ôÍO3ÆŠBë ýİÖE_f>} `m–ÿ ½ÊÐ×…YP¯Îâ×Ö‡ý¿Ðk µ°ÑÐ7…YD¯F¤°I¶déuúVDë!߀£ma}»ÞÒº‡õ&½;; ý$Èìì6ô“ ýC?ÕÐO ³¾f¾§Cñ8Úƒ£3g…ô³ ýœ0jÊœkèç…Ùpa½õóqæC¿0ÌFëAïŸöœ¾$¬_ª_†£ËÃúú•8Ú ¸ p5àC¿6Ì&˜_h\¸!‹_¸1¬ß¤ßŒè-ˆÞ ¸ÍÐo³™f¢; ýÎ0›£ß•ÅÏÜjÆÃú=ú½†~_˜-ä–äp#àVÀý†¾/Ì–âôRýnC ÌV˜ù<˜Åî`èìڌ´7ôï†ÙFó̰pàIC*ÌêôjC:Ìê͡ ý™0ÛnFž…ØsYù;ýð4ùqôàO€?þø+ào€¿þøðOÀ¿_!ƒ¯ß ÃÀð4@ ‚d€l@Ð ÈDy€|@ 3   +à(@7@! ;  '  7  /  ?`` `fæÝ’ý98$Šp®ÄÃ##££E€b@  P(ŒŒŒT&&&Ž˜ ˜˜ ˜˜˜˜ ˜eg‡}]E£çæææŽ,,,,¬¬¨X8 ®¬¬TÖD1Ö@¹APnp#`|Ü Ø¨€tƒõnp`»lÌòM 6#²°p``7àdÀ)€S§N€yƒ{gÎâ®<pà\œ;p¾¼á…€‹ÀºÁK—@½ÁËWÀ¿Aðoüÿ¯\ ùA¾AoðÀ€›`àà-€[·nܸpàn@pà^À}€ûû€ê‚À²A°lðQÀc€€ƒðkðqÀwOÚOž< 8xð,à9˜4ø<àû€?üð"Ä|ð àG€W¯~ xðàMÀO ÉàOoÞü ð.àçPcð=À/ï>|øð1àÀ§€Ã°_ðsÀ¯¿üð[¨/ê þê ‚ú‚ ¾ ¨/ê ‚ú‚ ¾ ¨/ê ‚ú‚ ¾ ¨/øàk¨/ê3@}¨Ïõ >Ôg€ú PŸê3@}¨Ïõ >Ôg€ú PŸê3@}¨Ïõ >Ôg€ú PŸê3@}¨Ïõ >Ôg€ú PŸê3@}¨Ïõ >Ôg    €ù 0Ÿæ3À|˜Ïó`>Ìg€ù 0Ÿæ3À|˜Ïó`>Ìg€ù 0Ÿæ3À|˜Ïó`>Ìg€ù 0Ÿæ3À|˜Ïó³³ =c.ïÛÆ<hÏí =´g€ö ОÚ3@{hÏí =´g€ö ОÚ3@{hÏí =´g€ö ОÚ3@{hÏí =´g€ö ОÚ3@{hÏí =´g€öŒí€F@ìg€ý °Ÿö3À~ØÏû`?ìg€ý °Ÿö3À~ØÏ8 p6àØÏû˜sà?üg€ÿ ðŸþ3ÀøÏÿà?üg€ÿ ðŸþ3ÀøÏÿà?üg€ÿ ðŸþ3ÀøÏÿà?üg€ÿ ðŸþ3ÀøÏÿà?üg€ÿ ðŸþ3ÀøÏÿà?üg€ÿ ðŸþ3ÀøÏÿà?üg€ÿ ðŸþ3ÀøÏÿà?üg€ÿ ðŸþ3ÀøÏø6—å~£½èËoG´3>Àóˆ_x00çâèU@Ñ—ø<ö‡ÚQá@Tk?}äõš ŒíaÚÎ>Q,ÀÏí­Gµ(äo\®íΣ“›¬1®S›¼–íÑØd/ŒöÎæ×kïÔs8édýr-šˆBÑ‹(‰új¡Çgý]ó m{Pf^"Í¿ùáè¬"!æËÓ.Øã»‚ñèŒM)Ÿ~»B26Žqè¯õ‡^Ömz_Í£Ðã3?ãf<ª…8@ùKãê´Ü?¢¸Œ­ÕXèD# W_`è0øÐÑU?ß0^Å„›‡¯áʯÞûVoâè'†ñVØÿ‰~>"?¼ xÇ0~öÿÊx‘ŸÆ/¬—ñžaü2ìÿ½ñ>N~`†ù]ßùaÿ/Ž—ñ| O¸VãSD>ãw‡ÆçüŸ1ûiü ðk†C‰ñ;dù{ÀÌ6¾0þ”müÙø ெVŒ3` 1þ£/ÿ„ü¿ø  ñ²Äb` 10†„0†„0†„üFH3B#¤¡ 2xƒûXdN}}Mã´ºª¦¦š&3æÎVUWÇ¢ó¶Tmª©Z¿tGuuM?ܼ¹¹±¦ÆÇ†ÎohÜ8zsÕΪêêÑæÉÑsç.ãÿùÑâªÆ¦šÆ¥ÍUÍ5xþÍ [jê×45ìh¬æ)G¨SÚÉ–AzAU}ÕÆšFž:wóæ5µõÛv4¯iâ¢U[}¬¿*›¶©Šë„ O¦ ¥>V¨ ó®o•âáóÍñ±04UWÕokh2#Ü.Í"¢‹¯O7KmýÆ)° Ot¼…¨fëü)ff¡9(Ä‹}Ì¿jŽ)ÁckŠœÃbç°Ä9,uË|,‹–¬il®çú‡­êÀr©å&˜ékP³Ü«©ü<Ÿâ޲Ilvž_'ž¶f×¶šúæÆÚáH?zGsmÝèùµMÍ\$ÛÙͽˆÇ¸‘Ö›IaCÑ MfÑjê× “˜êñT Ö×,­nØÆ=¤‡Ê¹p}°>˜Æ|¬³y~Z]CS”¶k}Có²ªÚºEfìÚVUßTÛP¿¼¾–7²6to¨ˆ™©éQâ$Ï1J:¿¨Q¾ÒMº2¥~½|©ËœúêºM¼tî$]8ç«ÎwJHŸ?cûnÇæÝòÉÎs„ïV׈QÆ9½¤Æì‡îrç.ÝT»¡Ù]íõë…Å\•XÀ­V‹f­J¼”»¼¾ªÑU‚®‹¹'V7Š>—x»Jò… y,lh^Ì ° ¶~q¡ç;œ·¸¡©yCí.9‡ÈÈ'òÐò ËYP³uŸûÕÔÕT‹ÖìDB¼\ifîJ™^³¡ŠéŠû~:óZ3^b”ZeÖÁë Ü:kŒ³Æ›Óvžo‘}Tl•ØG¥öQ™}4Æ>*·ÆÚGãì#[G‰­£ÄÖQbë(±u”Ø:Jl%¶Ž[G‰­£ÄÖQjë(µu”Ú:Jm¥¶ŽR[G©­£ÔÖQjë(µu”Ù:Êle¶Ž2[G™­£ÌÖQfë(#¥¢¸E*] ]lŸ-3o ùÙñãì“%öÉqNúRûdy¹”U‘s ÙÇãqIs‰“_±#P& •®‘R•ÉcœÛ²ÎõÒ'ßñE¶²"GY±#[äÔ¾¼T:-Û¦’jWZTbi.qJVlG2•|Ý)ù¸1v®¶ÕÓ”8ö-?^:'•Žò–”:¦(7F’)³s—ΖJ)Ç9r²D‰t옱d¬t.µy±LŠŽ£IÜZ±ºŽZ¨gª§z}‰¾( …²"¡0 [ªL2eé²YU[·V5FôÙ¡HDë­õ‰„:iÓ#Ú4À|m.¯›2]Â#©ˆ¾«ÔÖiÕ‘PN(×E#¡¼PnD«ÕæFBù¡‚ˆ6S›n„:GB]´MF¨k$tT¨[$TÈeBÝC¹ô”Õô ±ž³DB=x1B=C½|¬»s}ÉŽúæÚ­²ýûvd|ÖN?m«LäzÖÙÑòÒkC´¡ô¥­H+Žh£aLÃ~v¬6ë¢m”ذ ™©æ3gÞÐu¯†G½NQi½ÍÓ;êê õ õh÷iÕFh@$404(¢ÝÈàHhHˆt²YX X ý½”úçÒcíˆv,$¿Ø¸DÛ ÅŒÐðHhDhdD[¯ñ¶…¶­ ò±~)óÃzgD;Å=ÔùŃ|Ô©(*•DB¥¡2#4&*qZë¦Ì}ꙑÐ8hàuݵšª.#—r  ­ÐVF´U!NÃG)¥—̈h?ÕÞŽhË`–å¨Q¥  ¨ç-~’GÅE~K·ÕTG´ÝcëíUÊiâyxD;N«Œ„*¸ó…& ¨}–Ë/­Ù¾ÏýRTÜ~öÑŽ×*}lˆRÐÞS!Ùi·Sh¢6;¢Í\–²äSª;h€ãk5.ª¯IQe»Å³–ˆö3ím¯eöÃňöZêN”ÍÓC6Ô/«iÜZ[_UÑ€¨g)yù5.hh¬}MJQ³:ô±A^Bœx7Õ4ᑈ§r÷~E´wQw5Á,™ç­¼)O„/ý‚jc.™a?æ$ê!2cÑL/–X2ÃrÅÕÞþÏKNþÑÖ @k!ëU Û´^æ_2C6ªW6’©í¾dIͶšfñÐx 'Óo»'4W%±ý Í"Z•·›Ahº´YD-åÞ) ­qšÝ€\G¦!ï<Å‹„Ž MŽ„¦p£ëÇòÑW¨ñáè ›1ôNEt šd+ ð®¾„£zÀvÀ€œøµf5¶!ƒi<ƒÐtär>Î5š¿D.»p´°ð!΃£÷qtŽ>ÀÑn8p2àÀ©€ÓAî ] 8ð1ΣOqô à0à<œ»ð¢Ÿ~¸ç~£ß.Dô"ÀoÑEº&NS§îØÀ;G$4#Ä;€oT$4 &¸ ~‡ô—ãèJÀ^ÀU€«×®\h\¸ð{¤ýàEDÿˆ£âèFÀM€›·n|‘;pt;àOˆþp¢Aá{ÌWÐG´»‘ä¯HÇÑC€¿!úwÀ?_îÂ…}€ÿŇqô5Žþø ð àQ\xÐ xð]@àIÀS€§Ï¾xð}À €öÚ‘éA=Á!À=„賈ú}ƃpÄh;pÖ2š¸t Íæ3µ€I_F&Ž~„<_¼ ø1à5Àë @äMD‚¨Žè[ˆǤoÜ>Æ!°‚{ú*}9¿iÉpge$0ˆ§ ttEVaCôG€÷ÚçvN4¶6ÖÖ6NX  è(  ¢@Óûr½qõÀ/ïnÜ 8Ðè áÉ€Å܈z ç À*œ› 80 ç²p$JZ‰£"-d Rï¨@G.€|@€òry€N€ZÀ‰€B@# ¹ŒÆ¦/~€>€€£pu,ކú:†D=`ŒÅ™Ž Z‡S%€rÀ€¨Âx€PCÊ3¥€9a—€é€£ó 0l``Ó°À ÀlÀ\ÀbÀ|ÀÀ±€å€ãõ€u€jÀZ@` °°°PX Ø[¡¾:/p àdÀ.Àwg᪎£W{gN‡ˆGwn\8 p>àlÀ½€‹.윸pàRÀ9€Ëw®ܸpàJÀ^À5€-€k·※w®\¸pméQ÷àÜ>À™€÷ÏüÐ x ð(àÀC€€ïž<xð$à%À3€ý€Ÿ¾< xðàYÀ÷¯~ øà§€7/ÂìÂï?üð6 ð>à€>¼ø!à0àSÀ'€Ï¿üðkÀ»€?¾üð{À_üð5à_€þøå¤ü‡nÒy ð=À/^¼øð+Àoü iÁp:XE…n¯ƒ†up„.@2øEGß×ÁŽ:˜Fµè L£ƒdt0ˆ*ÕÁ:¸]©ê`”¡ƒ[Ÿ«œ¨ÞÏðLz© ¢ÕÆE´ñðò >þñô9m‚6ÑZPæ,x’vtD›Œ‘rŠV¬œ¨»_Ú@Ž|lí¯ àSqkApy}ÓŽmظ\³~F}uCìe$˜çc±ô— ‘b~Dë«õSÞÔ›}žÎ§ËóBæGB 0{žZˆèÂHh¦¼‹yµBÇâhQhID_¡¯ŒèËôåm0&SQéc´b#ÄïÌ—…–¡‘x’K Ubmëxä ­Âýû ¡#¡Õ¡5д6ª‚§Ad:``&`–Çݵ\c¬„Ú3ÙEë6×T7ûØð¬„W)hGv“òî_––$UÍ*{Vš›jšgÖ66Yk©=U+»æ’,ÖQ#\|~•-0_xÀ>7~±SƒûUÏoqï–¯Ú¯˜še›U×°® oU„·‰Rš›”sªÞ%QT¼q<Êâ™ý"ûÕ¬'syÚïj³”>¬Ác.ÜeèüÄf›€­}ÙÛÌÔf!Åû‹å3¼Ø5UR±m ÛŠwdº+WžéÝ—>i]>ŸÛ_¬ÞϬ­£ªøØícšx;k\ZN7,ù'¼6å¡w‡/:¡fSk›wûXh[Mͳeãô4>:5cåÇ›7j›fag²üÏètlëÜžã1P“ÉsÖÓVßN&G™ïïàÕ;;NoÜøXgó”xŸ ì|doÄ{UÛ8[ò‚è kÈ˼¡æ‹B¼îuóêèÜÀbá$#Ò}h>6ë&—Í~¸#rRktM„œÎ­W#õ çA¢©"P_³ /û‰×2õ Š<_`U½L™ãø¨¹/>$Ö`EÇìj½•%.Ï¡óð¬0é,g«MUM EaÜosÙ~«ñ~ÎË((¼I0$/¸¨Ýe’°x8Ç V©8§Ä›µV­š£H«iUY?­‹Ö•ùµ£´n¬ à ċ)ÃûÛ|¶&âµA",B?‹‰pÅcç}¸YñQŽçóñ‡aÌmEXJa…c(,a>æ¤"ýxʧ‚òáóRç“P#äý˜Šp ŧ"îÏá5™¦MçåšÁÏ2ñ~9ë4üæ‹2ÿA¦ígâT*Å4!0ÅüxBbÓ¸ÄÆŠœæŒéÑí·°!âà„[Xoq°âÖEw ‹ˆƒãoeº¶/°Od˜§ÍÑæòly†Új®7›‡á6¬ÔZ™1?0)ö ?Ȳb±ƒ,»E*­¬SE P®ãja—áX°•嬌E—‹à Ë]‹®ÀñÈÇXôQ–ÇOåÇŒ™•$cæÅ³)ÐxÆÈ¯óã¬K~׃ì¨y„u{”ÆY?Ǻè-l›“³+‚¸’o•«Ï*β=Èz®, >Ëzµ°¬Âà3¬×!ÄzS¬÷!`ŸCÒ$æ\hjc}+õVÖ¯"(7Äõ ¨wдK~j€ÿV~ÜÊÆ$ÜÏíûÑžxž±×Ñ€j(Ô) RhP¢0‹Â0…ÙR؃ÂÞ¤0Fa1…¥Ž£p<…N¤p…k(¼a¼½¯× ÃàEq†ïhP+M[©B¸’oY‰·‚!·BˆZ!$Z!D­­­…ô‰9fŠip•ž-l“pLqm¸Pº²"ÀOGÉ_{h“dÒ¤1 4„Æ0Oœçγ0|h?·û8v;{‚uá?¹ž`_!ôù‡ú'³î"ÜÃv²ÿ,„¬›ÿVÿ.ðOüüÿ_ò&Ÿ'Ú›Ïx¯›oõ:_wî hý¿‰nÌ;JþáòŸ·±¡•¼³ Kê…yìB³­¤~£r<6’¼ËG^à§p…hÑX\XlP€Zž‹·?‹Gv^—hçczšy¤°rh$Œ]ô>]øFPáAáÝ|;}£7ñð‡¼é.ö½„0Á7Ú½i›ñz´Àï$>>L>p˜øø0µÍá>~‡øøâãwˆß!>~Ÿøø0å}˜øø0ññaâãÃÔó&>>L||˜øø0ññaâãÃÄLJ‰ß!_=ÌÛtlœñ`\œ{îA6>΢ƒ¬‚ÑP4âþ$ã-²ŒøŠW»Ÿic*£|0Ÿ˜Ø³|Ááz,Dƒ÷$þ;Úè²c<~7|ÿÄ¢Ó(õä £PŒM)4²©^‰»PÚø/Ÿè*Dt54=A•W¼ý1ˆEɉ½ŠÅzQÞgð_gžÉ´Š`œåˆ¤d:A±¼ÛèèØôB½0p€Íhc3+£œ›gU„åYbœ ‰Ù@HÍ>÷ uþ±¤7ž¿,ƒßØ ^éåx™âœJ&QÞK‡*]ºuK·î*[¨òê(M¦v<Òô©òí°íâ‚E-gÇØ<;þõ¦·™ódÓã:†ÚØœJËÎ=Àæuɲæe!sö¢yYWò-åó²,™§ÃÄÓaÁÓaâé°àé°àél¤/H̹0ûMl ×& „ÍG¯œŽ‘eÇÀò8:ž(FG„s\Ð7I;¤½Í§g< Åïm>òñõ ¬lá Â{8×m ܇0[œ¨¿ÇÏåñðÂ6¶°2ʉo‘'¦É†»$.Ì“¹0 –Z\˜•>šþ‘¥"C)³xû£B.œš {J\XàæÂlâÂjgÖéPâ±&%.‘<°ÂhcK+£Y­lYE8P.Ú³0,ø1ü?~<‚ºýSðcDÅa“³…Çñ;¹Bã[Þ%ۢŰI^a¢Å®ä[nÊi1[f¡±PD°P„X("X("X¨Ò$æ\ØÉ¦EóN­­¨Œ†[9çEå„xDôŠz8ò¸ŠyÚ,~'q‰3Š_ɃÐv|—NV-"¦®Õ"Wò­ly-:ɵȡZäˆZäP-rD-rD-r‘¾ 1çÂÜÈýØTäö&÷ŽG›¨‚Ü£¸'÷ÍÑžÓÞåäÎÃ@wNÝïz" ¬ \¸•uá<~kà#„¬§ÞG/éóp;'ó2½ aék‘>¿wì®:•fì4ã?Ù±’,îÉÙhLgbÑñæQq,:Î<"üº“ê rÄ…äyüû¹Â\Rðwmc«*£Ù­ì„4ïù¿7ˆƒ×ˆ91¿ñ=±…ßLDט~\o§›Ýç‘M£”Gž•ÖZµÈdlË¥¾ÝÅÛ(“x{›]ÓZQ/k噲ÕÞuNº+E£•B•nVõxS‹9æ'„o×xdÝ™ò…«åYu* :qÃl·ÒÇÛŸùÏ.¹úñý€w„ßðBþÀÏ&xÔR»CжQÑ3G g9¾BÇù<Ê‚»p ÃÇ Nr;ÛÂà¡xðö6¶»2šßÊN®Ðå½q“%nÂ0Ònè´XH7¹B'2p%ßJÁË”ËdP™ Q&ƒÊdˆ2¢L!¤/H̹0ÄKic§TF ZÙ©F Ü¼4D© 1Áª´¬vœ5/í²Ji˜yTÊ,\É·rॠɥ̢Rf‰RfQ)³D)³¨ó‡¬RJ9óÞ×7´±Ó*£[ÙéYò°É¥Ì¥œ)Ï©°ÖýcÊ™/yæßƒFà±h/÷†ÉέmÀl§ýNONî'ù+Ÿâ ³ÓP_ì)Tu [¦Ì2+œE¦ÌÆ•|«šÜ”aÙ”ÙdÊlaÊl2e¶0e¶¹D‰ô‰9FÅâ!M´¯90äŸÑÊö´øþÑÆÎ¬ŒvmegUdÊ#"]¶0o6Ì ©³[xɲsR?kôa:‰ÇZx¤ØŸîÆâÑÑæ³Éd¯Í»·¥)á‚8û¾(s/jžÖ6vne´K+;¯¢S SÑ,í§ðPGòa>)YÁع>Ïð\ö‚¿ò1_7~áq¼Ñ»ùŽᕾ»}OóIBÜÜ?mÞÜûÇù¿Ð²XwÎáþ‘¥ÍC˜XØÀº‹ðn߸¡vmàºÆº‹pcº¦Ïá—AìÆo’»»‹pI°2ÈoŸ‚ÛƒM"¼?øHð%¾|¡‘kô7*xXaLD˜0ù8ÁÞ†;s~×­u÷è WSgXfÞ\\VíÞÊ.WÜ'ùO,£ÄýÍ¢ýšíleW´øz·±++£=ZÙÞä¹­ƒ©ëVÅ~ºq($’öÚÃ`M,Ï0 ú ù^½Œ–»r­¥ëÊëÊU´töŸsùfbEíêvk»¦2Ú³•]ëi"³ôÿ‡…4T…48!Üæ5‹—4óÛØu•˜–´xÖ‹®9rF$Ö¡Ÿ * ²G®A ^ØÏ²Ù$6•O·»‹ðR1õ¾\„où6øNåç¶ñžÊonþßíïÇÙáZîdýüëDø„ÿ5ÿ§<üÔÿ™?yåD{e*‹ŸÃTâÓ6v}e´w+»AÑãnôœ}±£¤–ÎÖônp,iôÆxûS¼£íY«†K³¯ýwzqß”™Û+PÕì|±^RÍðG|Ïçw{O'hµm Ñ¦|Ùmì¦ÊhŸVv³Â@·( d>õdóˆÒ@³é7Oú%ÆÏÏŽ·ß&Œ:„Œªý—˜ñBö€0ã…ì^ÌØaºÍ¸ÆÞ|ôO“ÇÃjK†If‚ÙO1ÏY?_³;nýØkÖu{ÄHZ Ĉыž_8«+ÿýº>ZÝUíßÊîVne ©g¶•qØL¦Œ#îÃt÷~¾YÎÂÌ(Ï[ãeLz(f=óíΜå¦|‘«5’ %^0çÃh¶¯Œhe÷(ŸE›7ìxlV+b>BÕÊq?)¦+…9öŒ:F:î­Œle÷UäÊs…xŽÐ‘cͨsÌu®8Õ¹K®¥/ÇÌ5‡ôEq¥ ñ ¿ËsæÉÃ¥õpåÈå#ÐN†½¤±‡ôbö’Û}ù¾?p37bÌW'Â/ýÌÏç·þnþî"\â¯ôóQÌ¿Ýß$ÂûýøùüÖÿ’ÿ„ÚYÚ…Úm<¼M»C„‡µ/`´¼@Âæ[k Uæ³ߤ6vetP+Û—þãÚÞÔê`Åαh•<ãaÚÖÔY'Ï©¹×<à!×YòDûQæHr¬žÎÖ£ð(×F‘òãÿ“O5ÙÏØïÅó3lýÞ7D„nÃWÙÓC·çÚØƒ•ÑÁ­ì!åÍ„§õû“Q¶2±²´•l0Ænѱÿ蓳լIÔ~µØfÞÄö‰Ð]ûuZ5Õ¾+½?d½P0øÃIÒëµÚSЋkÀ¦{δWF‡´²ýIûàú*t;âí°¸‰ëDvãC¶(BÂ…:…A CfQ¦0›Bl”>›™7PÍb/\`8ž›<‚}üÑYؾ?ÜܹöˆÅE ¾ð¬Àæ¬ÈX«’ÂÖÊãé&}‹±|8/Ë£–[÷d ·©ìÀvFZK¬$f=:’÷ßð_ëp±ï>Ñô‡ÿ/¶ãó&êí»Üww1„ñºÝåû¡Ëi¾'F.v;Oƒ<¯¨Œme': n ðüb!oýz¼^fÚÑèò[Yðœ€O¯¸•åœh︞‰÷ƒì» ãí/ð’Oì[ÝÕFáÄÏ;G¥˜‰Ô³m"t»ûFmqr/z Ï£mßã¿H‚ŸFn|¹ñeäÆ×‘ßFn|?¹ñrãCäÆ/’¿Iî[ë<ˆ?×|rg§šûRâ¬)F»6Çh3BUŒv gïTXhïT˜nïO¨°÷,Ñž ±{![Þ½PªîOð~“̵ö@Ö…Œ–%–©ÛZ¸¹²'Eû>Êžêøq4“nËbξ¾§ãíÏ{$ÿÿá/w#£õ¡p(…%–Q8ŽÂñVP8‰ÂÉN§p6…«(ÜCá™^€Ð*ó©Ì‡âíŠMZ›í¾1”è·'—}&k=Þ˜O¯Ù ”uKN¿ÅN#íc¹<Š„¬GÒ“Lš$K¹Å?“½{ sXÌ µ•ÍXëW©/ÖÙÒ—Dl,{¶Å—ã¡õ}ê]hÔ¨1¯ F|ˆñ|jÄÓ¨k©ŽMÔˆwQ#~—ñ{Ôx?¢F{Çڃ׾òJûk7^{•µ¯Wv¨y´ †ÅmM‹E'›GãcÑ2óht,:Ý<‹Î6zð¼Ç<Œr+?oϧœ¡&Úm«m·‰d·"µ½|šÔ öR'ØKvÛK`/Ùo/Ùo/Ùo/Ùo/Ùo/Ùo/Ùo/ÙooB'ØK`/Ùs/µœ}Gx´—?Mf&;¢ŒÃ©lÃ)¯Êk<Ïá{q6ÏÇÙD|?ÎÆÓWSÓ hEZ6­·m:“ÛTÃ"ß|ϲ‚üTÖT>Þº}lÖ,‘Ys‚ªhÙ <ó·îÙÖ0s»È¬5ÑñS§Lé~h¥›”:]_J7J¤¯óÔ/Z©©G<ÂòĨ½‡¿Àœ†^Âxk’øK¾Œ ~ÉÖm°Ùéb§Å1Ì«³½âU,åÖÏcbö ¡uoñJ¼]Ñ¢ÛT:G‘ÎÉéêÜnë\I:çñž~&¥y!Åô·‡ÔeÛO±¨øGÉêíG$0Õiwðòï'DPõ91BÂ…:…A CfQ¦0›Ân¥°ŒÂqާ°‚ÂIN¦p:…³)ÜCá‚d^âÆxÅk-òæ«ñöß ‹MMíëö­ñ ÂÔfzËÚÓR§õ[oé¬2Ó®ò°5n¯üc˜óÖJI¿1þät%çåUñTºS•1ñ|¢Œ—¾Te̤î™Äÿ_ü:ª£¸nQÍô˜µ³ý ûqüë»ÅÉ4òئÕd³ÎùÄ:§ˆ‘6=ÆYNŒs¾Õf¦7Ƭdæ³ÎJ7+¦~ÿ Ù.^5o¥³–ýzFD<;™ˆ_çDL·Ðɪwتç‘êcÒ´Ê`²ÊVíæxÔnç¿5´m“k7שݶ”ÃÌIö»Lþ:oÞÿ¥Éÿã¢.š'ݵ .ò" ]ö<䚇¼ƒñùÍ‘ô'qíe¿Ôn<2¿DºL~r:9½W~‰çTi½t¨òL<Ÿ(ã¥/Uøweêºþ¿øuTGózŠÛÇÑ4‡Å VWK(ÄÍãPqÓè›%n}“…kÏÙ{+ß2½ô§qß ÛŒ¿÷uñ&°h`½!‚wüj(Ô) RhP¢0‹Â0…ÙR؃ÂÞ¤0Fa1…¥N¤p…k(ļùI^«ŸÅŠ胢 T÷¤ÖºyÛº0­çÝöø·†Æ¿¥\Ï»ü÷só)-JÙ.Þ~óX;:ÙV»ÔNåI~ᡲ©\ÍÄΨդá=kp_ì1¸ŸbkYEZu0°–,Å+ƒV厥ÊÙïÒÛƒíO$«Ýæö‰ÛßöÐc-˜™¯­K«±Ë­µ9|ÝåÏRZ{>sõ¡•ÍŠ*9’&¸ãîÉÌŧæ›*ƒÆì•iõé3”cö +S~¬K=´—ÁжǦ’GˆJîö~P.¨Äú@X¦T²;ßœ®$á¼—¼*žJw‰BW¢~//}•óÿ_~ÕϺ=ø(“)ge,i—ÒGÖ.¥ã‰;V¨¹ãL»-¥4‹VÜÞõ(AO*ÁY‚CòØY2S­²xäɪβï­Ôiþ‘)M`eŸº‡÷•h*_AS'ÆœOß­·J›Oò?ñè¾ì_núß—›ŽàËM«¥u'ñå&¯!ülÅ€¿ü´…u‹E§Ÿo‘þ‹¼Õ¿JòÓÒ ~«ŽàWš&«dÓ•W埪¬é”%™ÄsÿŽþ[¥˜¯¶ßµ¥/G'zÍÈÖ¤5#;ÇPæÒ€ÒÑ×&™K®m;k-¢ß¬á\[C i¸õøÌ\íú<.Þ QŽ Ç2s½ª™›È{PØ›ÂÆ(,¦°”B¬IÍå:~e™¤*-“œgïÈèI»\¢%üXá_ ¹2BÂ…:…A CfQ¦0›BTü^ªø½Tñ{©â÷RÅ壘ßK¿—*~¯I*ìÀ=G†ùÝÂ&ÆÛ-ñèoZØÈĉô¯…ÍÖ¥e³óíFžÂ­{Œ1‡}ž÷oÍÁúw8þ} ëmy®uý-íŸáz¼ýƒäŒ/Hõ ï=ëN^éûcªgxÚ~0ü`´ZŸÏ/©ÜO~°Ÿü`?ùÁ~òƒýäûÉö“ì'?ØO~°Ÿü`?ùÁ~òƒýäûÉö“ì'?ØO~°Ÿü!Þ|yœüa¿Ùé6Л"žw]ý©ƒI/þ¸Džö‹8‹ s®·g±ˆÕ¤å&Ù­YO­¹Î£c$õ…¤~ˆó|ós”¦¾Ï­RlH«Û¥xƒJñ‚G)Z˜Ã@sÈ'R,¥¸Œà\j€íÔ§PlŒá%npåºÞV¤ ±=ì ±í ±Åö†ØR{ClÌÞÚ5Pf÷iÕô;vMÿE5ýƒGMŸ“\¸lßF.ÜF.ÜF.ÜF.ÜF.ÜFVj#n#n#n# ¶‘ÛÈ‚mdÁ6²`Y°,ØFD8‹\.Üfn›_i.+¾k™dSZ&¹ÄÚQͦòJ¢zå`¢ù`¢?µÀ«lvZÐÆþÌsùËðƒì¯ùã0‚ÿ²¿Ï·ÿDñjÂ¥¶±+ÉØ Rodµ6Ä"’ESµ1ûS_öçs9?™\•Ël…ýˆt±yã¨É—-bGú?±ìšœðr×›>`¶åê ªÛ©V“s?`Æ¿í{‹™ûk[ùïY~޻ޝ7öäòøË¤ýÿý…ÿÚéÙJœO.¢;Í£³cѓ̣ݱè)æQC,ÚlÕÄ¢;Ì£Uü®ølóp1?<Ç<œÁϵûã.»?žl÷ÇÝrÜœ–ó]¡t‘yxHŒÜôgñµøl’õIÃ]Öl‹Çs¤+m…ËHálžì«V+61iµ¢Î67‘Ú¯âíÏ$ëÚ«Ôõuºje][]µ¤ëk¥®«”º¾é@—ë³—õŽ.ëïo”º®Vêjï@W£¬«ÁÑÕHºÚ•º®Qéò±tm“umstÑfSêºÖÖµŸtÝÅe})Ö‘0(¬'2߈ÐÒ¹tnðæº")}OJÏ;Ñz»;m”»S£¢;¡pñöêäŠ\§z$ëó{”Åz$[döª"jw­®ÔäÑ•Zl-Ÿ’–Ÿq-š‡–Ì3±&†—k(Ü@!ÞÀf™¯™Ì§Z& ó-“òAùM¦üæR~å43ŒuºÍX5¶‰7È&Þ¡6±o\ùëíÊŸG•?™ËbV½ žjíñãì7k¸'5ØUl’«x²ºŠÙñö9ÉU¼É^:{Ÿ–ÎÞTÏ=üw3giì– ~wÁï–„0ñX%›®¼*ÿTeM§,™È$žËÔNéÊã3•×1sëBñ¶Ã‘þT_3w[O0å¾>À³¯žâåȬ˜Üsôu·¾+Ñ©iÍün¶{v7š«GbÑÍ4öœ“,‹J~‹·ü­öÓšBÚ ÙÉÃ$»É$kÉ$xQßëÃN#%Ù¶¬õR?7ßZÙ|§y™Ï¶¸~zÌÚûæË59>÷oòX÷—º&`ÇÁ¯$!L#¢xˆÂzkü ›0vÙ„QO¶ˆ³õb8ÎN çfq¶„öâüÞ':Æ<:š7pgüDÞÀyâ‰ê•Ëf­–K_âì×N›ï²?ññOÛ#Î^5›ý\gÐî‰§ÛØsf=z¤×޽¿t,¾Da}•¢ŽúFñXñXñXñXñXñXñXñXÙ­Žø¥Î\!µüô¼´ü4n·í Ôž€+roêlWøè\èÝ"5>ÌsI,Øêëcznß8;ÝÓ ©ºh¬bW2s.…çã¬DØÿx›%ä6h¾"Gµ;?­ÚÝc׎ö'°»=Ê·‹Œ '¬%çÛNÎVKÎ6…j1œm99ÛšXt®Yä¹±èBóhr,ºÔ<*E—™G#x JÍšøúÙ5¹ ­šÜk¨ }ž"ËÔªú8Ð}¶ðzú‹åÇyT{8ù"ªÝŸªË'¶3ÌŒcøœ8%½PQÒ$Ý÷« ºÌ£ ûìöéLÌŠEËÕ!°o˜›è†yc›ÿ7sþï˜9§+ÿm´Ã¿3sîg¹¦§_K¹ûðAÛm—­ÌÌ•ÖÞÇ|SÅÅÎò´õxk—ò]Ó‡ìt, ¤ÃAÄÄŸcMÐyñÆ}žìk}¯ƒk“ÎóýXkÒuÖ|±+Á²Íwb©6K¯%B7ö#–ï. ÇvŠÍ9è[IúÖá/c }—¡hÎ{©çTñ²´ˆôa»íÞ¡¶ÃÆß 6>y•Áø*í‡q8¤…ݦÚ¢6ùZæl×.HØy╦«œ&ÞþŠY³ËÉšù W¤Ußý6mþ†hó}Te¨9b‹ûßð¢ÏÛ%úœ•Áïö#ø!Ý®„ôòñnN!ƒãít|‚"ÿÄPUÖód¸û¯¢ãKò»A’­Vä§Ê?ÑNã®O>Bû¥ªÓÿå¯ÄÒÍ})çsNñRÄ<6·¹}#ìÝx›yldœUó`îÅúFÇÙra÷ÇA_q{¸}%˜;ô•Æñ­!_Yœ™ÇÄÙp”›s§±v¸2­.ðˆÝåWS—_ã3H»¯§~>†?À–çzÔLD¸7–òãZ*îšÄV/++߸äDÙ½u7õÖ­ÿeHL/ÇKçT2‰ò^:TéÒ­[ºuWÙB•×·õ!#µ:ùvØvöì㪘k‡÷]ž;¼Øy9ä¹âx<îú*ì­ÝªgŸÂA'¡ƒN>‚Ÿ*½5“œ,WÉ$æ‘x^ÎË+¯<¼ê–xN•_ªüS•3]›¥*ûêg׬hÞêÏ&ù«Ó"ùƒ6ÝžH$¬ýFPÚ¯ÂSï¸&ynþsåܼUuÿê1ϯ~”ï0ÓÃì4–ïñXðú¡]Ådˆéâ áž~+ë*"Ïø¦<æ›=õVüqÂÄ÷hÍ—ƒÝA²žm=sHÏ$O=§u¬'YÁK¶‚Fj b.5ÍœKMÇwRŸaÆgâ…µ5»‘-ñ×zðx~–=vÞ›ÖØù²]’V*Éý±)£°˜Âº^Jñ‰žÉÌwÁ19—¦³š;WÄÄßÓÅ—c¿ŸÕz'Φ˜yX¹4»ÊµIaZÃë[ªoiô÷š&úµŸjo3Ÿf¾fœëqÀwl ¾|âø¾%|Kc­¾e×3#gmRLëÑê[Þsß‚ÀÑæa¯}ó¨0pˆg’Ï­7Ä·B„°Ón½a³2òVÔÞISíJGmÀQ°Õ2Sû³4Õç¨Õµº­VÏLí»iª­tÔµA[m03µ?OSíñŽZÃQkØjÌÔþ"Mµ«µ!GmÈVÊLí{¶Ú:R;Y©öGmT²rÔ1s4ÁÎCI3þÎîP6\„e¬\„ÐüË45Ÿ(i– u,52Óü~ššWKš%[GcGC™iþ MÍk$ÍY’æ,GsVfš?LSóZIsXÒv4‡3ÓüQšš«$ÍÙ’ælGsvfš?NSó:IsDÒq4G2ÓüIšš«%Í$ÍÍ2Óüišš×Kšs$Í9ŽæœÌ4NSs¤9WÒœëhÎÍLógijÞ iŽJš£Žæhfš?OSóFIsž¤9ÏÑœ—™æ_¥©y“¤9_ÒœïhÎÏLó¯ÓÔ\+i.48š 2Óü›45o–4w–4wv4wÎLóoÓÔ¼EÒÜEÒÜÅÑÜ%3Í¿KSs¤¹«¤¹«£¹kfšŸ¦æ­’æ£$ÍG9šÊLóÒÔ\/iî&iîæhî–™æ?¦©¹AÒ\(i.t4f¦ù‹45o“4w—4ww4wÏLóŸÒÔ¼]ÒÜCÒÜÃÑÜ#3ÍNSs£¤¹§¤¹§£¹gfšÿ’¦æ&Is/Is/Gs¯Ì4ÿ5MÍÍ’æÞ’æÞŽæÞ™iþ[ššwHšûHšû8šûd¦ùïijÞ)iî+iîëh椩ù$Is?Is?Gs¿Ì4™¦æ]’æþ’æþŽæþ™iþgššwKšHš8šd¦ù_ij>YÒÖ¡4ÛNzéœo©ÚÙ¦U˜[ØëxW f_ÜÂzYÇßÁ“o:¾Ä­%bkHìæ*×”¤ruRÚâR—-.SÙ"GÙ2—»sÏ=rƒE•ù'´dž-4†J?Ì,tô ‘aȲÓ¤§:IO¾¢ˆÑå’ó\IIW$%-Pq¯[¨³Â9[}WQ¦«“2í¢*ÏÑŽ¥d¿¾Ú´«ª¬‘ä¯pË¥,B¦Ý”B׸… m¡ ÔÇ[Îsm [d¶yŸíë×I¾Þ"ùúõ’¯ß ùúnÝmG“鶤þ&É n&žždôv^#(¯¾äG›…lÕ`KRÊž®þãýÇÕF·x4V/UcÉ~w«[¾·²£Þæªl³ª£ö±–“¢˜[Ñí‰ÎÏÝáVÞWéwº…ú‰¢»Üyô·óJµìiUînÉâîT:êÖæÊ¤ö¨PhwOÒ|åCvªAvêÁ¶ü ¤å²ŽLcº_•ˆW“û­±å3Óϲlro ›àêh#)f’GŠ1Û’÷¹ :Ä.èT*h¹e…û[Øp+Õ>'¿5îüpç7Té8 <4Ì’Þ6OÙ|øxb¢cv.eTô¡VÑ·KŒò T؇Ü9 ϰKŽPVîa·ÐH¥Ð~·Ð(¥Ð#n¡ÑJ¡GÝBEž#b•‹ÉÖz÷ÁboC>&ò€dȃîJT†Ü"i¼Ê-_êYè:W¡·JY´º³(³³˜FYŒ¥,êE¢~”Eƒ+Ã&o+ŒQZûq·P¹ª¢›½+:V™iÙŽ³…&SUÊ̪àÏE!k» ê¥&h°T~×Ûx¥Ê'ÜBJ¡6·Ð„#h¥£NôªZ«ïIið”Tǧ¥:rç6ÉÎíXÊmÈ$¥ÑT Ó]Pã*쩰ϸ³?ZÕ¸EI´dË£¡ïr %ϪFèÉž†]ï*ëFI÷snÝS”º[]º¿§Ò=U™ð»®„[U §©¬³M*áóîNW*zÆ¥èû*E3TжKŠ^p+š©ÑàRôä}–JK£¤åE·–Ù*ùZIþ%·üeõŸs•êeUõçªm’½âV4O©èy—¢©ÍWMßÖ)n„ª“ÎÙy,P*Ñ¥üU•ò…Ê„/¸¾¦J¸H™ð%W«.V&|Å•ðuUÂc•þõ†+á›IþµÄNÕF©¢>nÎo§>¾SÄ®¢ØI"vÅN±]k±ÍÛ!b'˜1üõVDXÑsDôh+z®‹w¹èñdåìNšf-µ+Ò—†ŠÎ¼Â?ñpˆeJc½å2V]’±–«|þÉí–V¨–=œ[AšÈ)V*[ÿrW¹~ªjýã:ZkJ¸Í«T*ºÚ¥h‹JÑñÊ!9aÈYe Å(÷ÞäU³ÜÓò·ÝéNPf~‹[èD[heÞL™ŠÌ7’ô±JŠõ±y›(b“(Vìò»R—ßÅ\~70©ÅVwäï¸åר|"å ÄZ•†£% ?sËW)ø®[h÷ íÏ¥öù…;Uµª(ƒ½‹²>ö¬Q8‹DðTª÷’zãeæ %Øè]Ï_Jõ|ßjSÆTk§˜BzƸ׸ÞqÕæ©k©~6ÛÙ•RvCTÝÙÊns’q¶ØL¤ Š’Rm²× èD­ªÃ×)™âCWNU ·*î׬{U~°Á•ÃUõÞ÷‘Ôx»m× rÒi’í>qËoSúQÂ=õötœ­Ñ»¼5Ry?u§jR,ÕÙk v›97üvÂfÕòÒ©¢‡)骤¤;< z’{ú3wºJ3|î:)å*Ô‰I…Ù¥X1%³UÛEq1žwÅvgÜsO>r+žâÝÞ¿’Úû×îT§v4büÆ-ZGò¿uËŸ®l£ß¹…ÎH§!÷(…~ï:Ó:Œ°Ý2Â$GºÚ*í]ýþ §W&RþŸùéÏ.Ö<.©=β‹2‰ŠRÌSýÅ}_l­Yœåvô¿º³:ÛÎje5[.¡ÕHVÉΖKfv¤äü…='Cš:·#7ø›[þ¼Žäÿî–?_Éó¿uUó*–¾@±L -ORÒ/[$?±ºPého¹….R ýÓ-t±Rè_n¡ïx¯$~%-ñ|-õáoÜ9\¢äl‹ªW{wæK•ƒ¢GçhW™û2e xúrecþ]ÎÝÏT¹_‘N—¿R%ä÷¹…ö*G$ÙòWÙò«©ÈV¿÷û¥~Ji[ýš«2®ðëΤ=™¸¯Všço.ãW©ÌsMÆÃ˵ªn¸Ú»Û^×A·õÝò-®'#/ï'Þ”ºŸ{)ºâõ×ð;Ål2æÄd2÷îêo´s@å8JY/;ÁMJÏM¸ï¿ÙE¹öïÈZvÚ[”^r Ýê9%ðg9tâ»SÝf§šK©Žî°)×ìT¼zû‘çqúOr¾wt¼zàï¤ê?w*m˜ãÎý.¥P®[ènå Î_]Eˆ&ÝÅ•Yç¹³¾ÇÊ!!¿}í^ϡßï þ©­;»s¿ÏÎa-å°L1ݧ<»xÍ+¬å‰Õ®å‰d¦»?>ßg CE*•ŠDŒc©«k–¬ñÅ­+%=*y>¨èg¦0ÿCÊöëæÎàa[h=}¤ã¸Xà€¿0&騄"™»Èø»Ç4ˆ>æïŽoµú{P9Ow(0ùv}G>tË?¢¬FO·Ð£J¡^n¡Ç”B½ÝB”B}ÜBm¡²ZuV;ÕÛj}SXMeÀVe û¹…WYy˜då„IÐwmùåä‰sœÛrÉþÎfÿçQŸ Ô™Iy°[Å®ei >3f×Ts›8æ&—¸Mi†!n¡']DP­˜5gYkïhõME OÙyÌ¢<&àk‰³¬4,‰†Zý±$r}ZYúán͇”„tØ-ôŒ2§n¡g;š)tË?gË£:PÌSFupù=U‹OV·xÒ½ä>YË÷•B +ú/(ܵ6ëZ²óV Ï?P­…LUÔ(Ù£~¨l²"·Ð‹5Y±[þ%å ï"K’üðeÕ é„Ć.u&Nɵy%‹ÿ¨£Ú”¹å_í`˜Ö*à˜Öˆ_SU³_b5ËSUóÇéô³×Uzº'ê›JÏ®›sû–´0ãnÐq‰·rã“ZøM—ŸúM?]•X¤ •‹ÿDYå îò¾•N¯ü©jLmnò‰ª"¼m'¬¤„ D41Õ ÉLJuõŽ­fU¢—b5,É«¦¬V±«lG«ªõ®ª; ’Üû·¢Ÿ+[b²[èé4×{Šu¿ÑÑIòø#IiNVDþëtúìoTS¤´µ&Uì·J ÝB¿Kç>÷÷é<ùƒ-´Ú©†¸ë^»Ä“^%ÒôâÄÇJ”pöG•›ŒÌÔx–¢%I½è Õú^'ÿdBû“jRØSQŒä¤ö¦¹¥’w/s§úK†K UŽXË]†X¡ê’³®£„+ð ÓíICöÊîþnëKgÒ?÷+òËÖNws³mÌãܹ|™Î‘*çÙ®· ü•I®ô/eÖ [x¿ò^0;^ºÇ^%Õàw_+Õ$lþæÈ&;튙ƒ"Y˜jV§3;«VÊê~j® Ñ@7Ss™Ø/§Øx;‹bãD¬™bCElꉨq3ï8çR¬LÄ&Rlºˆ¢Ølëkí±Ûãö–Õ.{è>W×ó‹®GSÙT•ö§±n£kJ!7ËëU§÷ÂuÝÛ¯ÖH~µVªk•;‡ B£5QSŒ}ºúO÷衇Òènz–¢g'³ÉºÔl¢»ßú4o‚(iµ+騤¤Ù.ÆL||Y4œØ 9•âÃ]?åËž Óg½_ÆLÐßE£4½­Lf4EÒŠ1¨Õ¿ÇÅ€{d*N|\¬Tði«ïd9KZ|÷¢Œ·?“¶£*™õLw+RÙ›Þ¨g%Îýô!Š㺃N®•/\úÏv 9/\. ¢L±^ UÝfŸ“x[u®TK÷·ô˜·mvK©ØyóRz‹Z.µ›5±&#\ ­äî±ñU*_Ëô_èÎÝy-3ÅŽ+ÿE)vèÎK›…T³N±è²$1çµMùï“\˜$W¬,öÅn¡•Î!Iy•z6•_úÄ„ßý‰ ½L•ùŒ¤ÌÕ¯Oºß××'-ò˪–Y+M~©s-™-Ô/Yº¿X SUc{R^Ê·'ý—¹…œ·'Û[³sE†s¨¨ EÌzI{©ˆY/i/“o5[ý—;#myR¡&¨8A¾‡¾Ù-?QY ÷KØú$¥ÕÜÏ uå+‘Þ_˜ÐQÉ{¿-£;oBN&KZï‡ú¯”²½Ò@v•äª ¹MIÇ 3–Âú4m®™40\|bžúä±Gž WjþkU¢ÁE•: ¨-ª4Ĺ?Š"5¡ÿµ<ÈÂq ˆ˜g;á8 ˆòù€@ç<ítÁqWÀQ€n:‡Buô(ð_ǃž8îè èè É~8ê  ˆ†FFFFŠòr¿áA1ŽK¥æ‰2)ð·ð Çcã ü×ó`|ÿT˜—'˜±‰˜8p `2` `jÿFLÃñôÿM<˜ã™€Y€Ù€9€¹€y¦Ð|3ó¢-¢ Í“‹ °p,`‰yq©,é倀•€ã•€ã ü7ó`ŽOœXm¶ß3‡µ8UUà¿…ëÌSÕ8µPcžØ€ã¦Ì&óT-NmlÔ¶ê €m€í€F@ °°p``7àdÀ)€SM-§áøtÀâDÛ#Z,©Ïx¶Àsž+ð<’:_Ä.x¡À‹(Ÿ‹Eì;/x©ÀË^.ð WøoE¸WÄ®ÆËcWøoCx8{­À붆ë ü·#¼RÜHñ›„ÔÍ¢iòØ-$}+…·ÑùÛ)~‡¾“ês…wÓÕ¸è;yì!u¯ÀûHæ~ÛG’ˆØƒÂ¥òØC"öpÿ„ûqöQÿû‰8¦ÛÄ1‘ˆ£È&Ž»8q¥ºÀ oAw©Èãn%yàl§ôaÞ¢)èCsÓ gžŸ)èCû–éCs“ ¬ÀI÷‚“>î7éã^“>î·é#:ü‘7™¹Ä<1ÕLnqÈ>/™X$²Ï$‘ûMyÀ$‘}JyÐ$‘Ó!‘‡”$r·I"Èa­Yï*Sç:30i¤Àÿ°I$8µÁŒm4c›ÌਤÀ¿?32y0‘LdRà$%™Ðõó4‰L ü :ž/åÁ”„RàLA)\”r7QÊAOJ:®7ˆP„ü"vS´/ñI+ñɃÄ'Ÿ´Ÿ<(ñ‰À»4âq%.b÷ˆžds‰æb’]L²O0‰ALò81É>Î$ßµ˜d†Í$“œj3ÉœIxV:ÿ üm‚Eø¹ Éh0’ˆäI‰y!,.X\‚ ÒDĉšÃhžäøŸróIÿi/FÉ 0›S½LÇî]à?d³J“š~¢]ef)ð? n1µšìRàübæ:Ì,]ÌT?ܼfòŒye”™MUà^Ä6¦*“o4“m¾·Èšª˜%—çËûÿj»ส2|î9÷æAúØuwW+ÂÌî&8­ã0-­UF‰¦›MMHº©ÒHb-¯R(h±R¨3Œ0Ž3 ègšn ë`UZv³y@Ë Ú@ê´µôE•‹â-müþ󟻹›I­ÍäœoÏÿùÏãÛÿÜÍæÛ(æÊ^@¯¯àîx\Öµ˜Ý®{%‹@6?#² ÈŸݰӵ\¤Èq¡ÂK3N?3Îb.ÚƒÄ:< àç˜wš¸ÈÕÜÅf=±-ù<Ñ—Or‰Vî S—þ².} ¯°ÐPÂue(º–¢v®ÌŽ EìÆP´ŠG÷:.q=÷ñìîÆí “òÏÐhþ2ü³Wóáˆ"2²o™2†ƒò†…~©Yˆwÿ·Mƒ÷ãÝ-‘ž6PQ@þÊãÝèÁýºˆŽž2t¤¥›6¿§G ”d0etnR†”t­¨"çÃIC†“† 'ýÆp’No5F±Ò‡•ÔN2u¶ë¥V2éŸèµ_ðp”a¥gÁJ/º¬ô¹+Í6¬t¡a%åá$¢WÃs]æŸF»Ùã×°|Ë'9äoE~^Dz˜‰ˆ›ó87šˆ(bׯß`'Šœ®0›Áãàp£—Ò!Êãâpõ(Icyœÿ,²€ÝÞGGJTrTpTâýNF±OCÑħ"~‡¯Sr¡¨ž¢Ñ®Œ_kld˜Ä•Q‰±Ž OÛ 5¨}”ÓEì¶äKD”£ß¢–nb_t5þÍì­a{nÁæ#ap‰äe&’— Dâÿ8µ°ŽáŽ€üÑ ÃzÞÉæÞUB”BÑÝz¥w•xÜmèÄ`ÑùHy›Ó‘nö¬NG¦õiƒ °/ÄqBœunÏRtÞg)ZÀ<á·T1Sø-‹¸ÂoIb Ξ _ø•U` ¿zΠ¨Ž -!f‹sêY4†7tf#Ã$¼Á½X^:Š9ôÜ­à<ÜÁ{°Àë~h3ˆïòÄÿþEŸþ&vf°ˆ(4…Ó3ÎsÉB YèåT  ¿’š0Hú¤ÜÏ”a9µÎçÍsÛ€PúQqi$jååF NE©f•ç#yy 2 _IæåÁœ(ãïRi¢É‰9ßeOËC9y˜ÄG(:°š“hóÕœ<†zD½?åäk™“Ç#¾T“' =Ùv^þ9'OfÄôúNVçå_v#ï¯ÉHVžÌË7sò-$ßFˉ~4!fC‡¸D- £iá£û;Ã2±QY™á7!E½Ã»ÒôwAòpx@BÍwuîñÂM¢]¬”ohSëÆ‹ùww,ê cqŸpôXÜFÝ¢n÷È÷9‹Ž"¯GþsL³¢¬Gþ뜺M—ªÎ0Ý®u–˜^ Š}YëÀù›!š w1ASš“…¡ãB0Njㆼƅ ÆI6Îjר[1ÐdÔJ=Ô4ÒÿžêàžƒþZ'nôÿÔèßz^5z~/^ø$;ß<¾¢ÿË`I§ÞI˜{p{ÌíÓµÉxVþgðë;ðj3h‡R4ƒ=òTkNKÝÎôg…ì_‰$³â» ½Â+yÔnC¹£¾Žmâ3z`G¶Ç\½=æÎ·«ì=â£UvV¾G÷¦Ey•måäi’œ™og†_Õ[g/éx"#•Aš…9¼›LðÞÒë4îrè3»üÇôéBãcâ³è‘µÔî » „Uƒâ#‘(Ød.|ȈqVÖ#šáJô_È#)U ©cõÕ{ćª)óQ1\2õ™á7 .Cy%tE Ñfó!îÒM"0Òµ2´vl·ùXÍï,UíÆŒ:mšŸ2ó0õ)™8Óð1ÛÜð°¶h|¡n}“6K@WJ÷Ç1IÁ´˜Óú*âá‹y´Äõœ¼ãv¥ºÔi,|jÉþ„ÛÍÖœ²Ept?1­èævÈ•å&Ìšlr®6­Ç,ÒÕB¾Ž-ÂÞ­¤ÝFßÎb&‘j…‘JÑK™)±ƒš”Ø¢JéÕ¦dZT­¼á&ê×YþZŸ²-Ak°O9–H‰zUb‰gT)~ç;UÎ.ªº«[̳©O–T–èdZ„«œÊ’J6‹2µ(#Ê7– åÃá”(Éàwx{x¦ Z¨XŸ*“¢%”Ò’‘ÆEÚÁ„»ñ›6ÚšÏKתá–[þÏSö$?"fF í&ÍEîÎß w~ m n±fûf¥ÅÊr[¨Æ¯ëL‰ÒhØnÚ)ûÜôQ߬p‰^ôˆ³hŸGÔÆ¢ý®¨" ׎dz7i2éÔÝx -¢ÑÐ<úßÖ£OV«P¢xt…—ÀJFòꂈRzs¡–xZ•Æ™"8¡˜N…ûÔ4if…ßKÒÝÞ´¨b;Õô¼šá.ñeîAJL|ºµÃd%'Ê’N«›…Å¢iW~‡¾’~D]ô]––DVÁ¹ñ˜a©m2‰eÕL}M „§ E×Í-üSƒ°WðMçŽ!œDxá´CU@"ÌFˆ"ÌCX€p%èÍjDXŽÐŽpÂZ„õ÷"Üð Â#[~„ð$³ÐoA¿ýô[ÐoA¿uŠö-ôKè—Ð/¡_B¿„~¹ ’·šZ2Ö` pp° ˜.¶€Ëµô‡ÛÀÅô]DàåÀk€ôÏWéËmmÀYôo€¯Ò¿½l–;€øÕ–Œx¸øðkÀÀUÀ#Àë€û€×_Þ|x#ðàM-Äyk5ð àÍÀ×»·¿¼ø]àZà}ÀÛ€]ÀÛë€_’ýß’ýë€dÿ@²ÿ›@²} ]TŸ·î’ýwÉþN Ù7ìï’ý€dÿ=@²ÿ^ Ù¿±kéL<6x:•v|£eeNߣ½r§ËN¹ÁjÖëuy"[ ‘×ó­¯v—¨¸/Ï Š@µyç힩ψ ãÍi5 µÑ›QGN¾GÉ~¼ñV‡rj&ï‹2çK…-2kÚ׫ðëïUèU^õAÃ_ ëG\,lU¥*©¦<¤*UH\d5ÃâÃÖ§åÛ%kEùPK Lg08éΦæ .-org/javacc/jjtree/JJTreeParserConstants.class…˜w@[ÇÇßïágãÅÏÛq,ï‰G†c ÙB<à!aI`ð’… [–ˆx;{§i“ŽŒî‘ÑÝ4MÚ¦™ÝM÷Þ{ïf¶I¿w‡Ãq[ÿñ¹ûüîÞݽ{7é‡-ËZkÏ«¤×0ÝÈôZ¦×1ÝÄt3Óë™ÞÀôF¦71ÝÂt+ÓmL·3½™é-LoezÓÛ™ÞÁôN¦w1½›é=Lw0ÝÉtÓÝLïezÓû™>ÀôA¦1}˜é#L÷0}”é^¦1ÝÇt?ÓÇ™>ÁôI¦˜>Åô ÓCL3=Âô(ÓcLŸfú Óg™>Çôy¦/0}‘éKL3}™é+L_eúÓ×™¾ÁôM¦o1}›é;LßeúÓ÷™~ÀôC¦1ý˜é'L?eúÓÏ™~ÁôK¦_1ýšé7L¿eúÓï™þÀôG¦?1ý™é/LeúÓß™þÁôÓ“LO1=Íô Ó³LÏ1=ÏôÓ‹LÿdúÓ¿™^bz™m‹mbÛf»Œír¶Ç±]Áv%ÛÌöx¶'°]ÅöD¶'±=™í)lOe»šma{ÛÓÙžÁöL¶g±={¼u£=§Òž[iŸEV™m$‹\²&… ùÁR*_êHå†2eøžY’áh´%ØìT„Èš˜t›"ј“ ㎊Ùx4ÙŒÅX²Þir#*XFVÕ© ÑÏ–“5>¹-Ø EôƒãȪH&¢-Ž~¢‚¬ÉÉx›rƒáÑh%Yã’­èN +‰·¸mJÆ“5Õ«—lmŠ%œP8®âÈ*Oâ¥T¾Š¬iq7Òv’a7‚!G[[HBMGwÑX+:3¢3È’ÖöpÂ}Uý™dq°>žˆCÚg“UY† ç ­>æ[”ÌÅê»z̘âòS35•BÁD¨YÉÙª 9Sùùª Œë8GI4×ÝÔ [H´ë&Àñ®A R¹,»!ªr 1› Ñöú°®·­;a¯ÛŪәÀgÐí/AûÁ‘²¥JÜH0¬d*j w)]®ÊÂÑ îh– æKeW¢í¦hB÷º ý»z®Wc±¸­maG͘îh F„H4¦¨Uåx«`$4òuÖ¢I×›ÝuXÈ:±Æ`Hk=úG#M*¿íD‚ ·C—œ‹§"Ε=•"ía=öó1ö¶`¨%ؤk] 4æv½¯°í·Å¢ '”pôb¼m¶a²Ü²M°˜“héo¹ïo¶Et«X§ŠÚÛ=U´Ãùž[°5â]‘Ps,qwz½lÅÍ®ž M P¼jÑE!Œ +wG[ƒz.æ}qé‚ZÞuuÓMXÑ0æ}ðf4¿£yD°›§¨élÂî »˜VïûnCûÄU‹Þ·`¯6;f(Œ= %ÆÖk%k¦^ØQɶ(:0K#dÍ?Õø¯Å®=UËél‹FFÞ¸,Æüÿ-l'kºYÓl%FVµÚSØ£cß<ŽÝ޽«4¢ |…0)ï¨iW‹àëPeõ±‘å¸C•½b˜{]Öâèn»à1Ãwâ{ÆV7ÅV]zK·¶•ìÆmˆêŠ{Ð,v=Te{±—¼]THÐ[ýûÔºqÃÞ‘™BA3d•ïÖŽôƳÎv•ëQ­èÊä¼ÝЋ\DçúÔ%½Ü¯p(ôÎç,Úv#!]²yL°Î@¾-Ü®Wj·â,ÒrغR^µ‹Lo…‚:ÝÄ©†ÐR¯Ó‹ðú^¶ˆlÌiUÙAœª“ÑÙ(aUê®FCC¨¤: £’îv4t“ŽG‡ñu¢Æ3GP¡Ó Eà Ãj‰µG”: ñf·Q”ãØà±Ób'ÔëÜIu¼5`º®w<\«V“HxvFŠÅ…¥üJèzLÓÈQŽåF’g¸ª° Q0ö¢"kb¯¾¦0‚Rá@&ïLõáÛOÛÞŸNÕæRù¾Úx©˜Í÷ádc:—ÍgK8¼Ê–-ïP—P¡µ§ž^Ôƒõª|¯ü €ëf’ϸÿá“}æÝÀDßè½à;uçC*}úÆFnŠoÌ]H…OÝó:£îxdª}§ÝïˆóaPHË|5`¹owÉKò^Rô’^ÔÖ"¿ž”šBoÍl¾§fÝÆ€.[²þ3L¹.^q¦G×o¨÷Iu–Š©´êx¼¯»PÈeRyýnÝÅLê€~î#¥ŒÎ¤Sƒ]–N•Òý^¨?UôB¹Ôà —Syé¹B®”ÍetÛ=™ÞÔPÎ{ÁžF2ÔóšÎä½j™Ã¥L¾Çk©7•é°7›Oåt¹ÎåŽxÑ\!UÒÓØ[(êfú ¥‚î!Û«?^öà@.s0“/ ê¡…bÉ+Ѧ3…^Ý@6¯ÂU*Í{SioT¹B¾O?˜O•²Ã]3Ÿ9¤ËòC9oD©ô¬Q/_̧ôlU!_(eÒ¥Lna¯šMël1S*z“<Øï‡}MI—#84)zÁCYo¢'ûäÓýÅB>{T7Xá+õg½Y*!|HW×¹AÝ9¾i~0›Ño…ºÅ!oð¥â.d{ô'.äÐoΛåCý^®ÚÚ}P±Ó.[Ä&ù›>Å?æšEd¶ÿÌwŠjüÿûz ¨%{ú½ˆà"ÿÿ¿ZQm¦ÿL÷* ¦ù_u©":Õ?öFU'Šo™ÞšË5ižÐÜ¥¹Gs³æ*Í5šuš~Íš'5·hnÒ˳®N'~/ xÉ/9~\'K–èdåJ¬^­Ÿ^©éåWhÖj.Ñ<®¹Ws±÷´×äj/Yá%µ^²d¤;/Ùë%‹ëô: ÞȺ1 õŠÁq‘M—z¼m›:¨X³fNýþS Ôé ÀÈËùýz‰âÈè_æÛªö¡ôš ¨óÜ»PôÚ2.˜ÀDº†p--ûjÕÙžN×îß_*f2µÛ¶%´¥Šh÷Ôo¾Á17@´{?¶!~‘Ýh½VÝmÖëuÖMø9x³ú½g½þÃß“á·Ào5ü6øí†¿þÃß ›áo‡¿ÃðwÂßeø»áï1üø†ß¿Ûð÷Âßgøûá0üƒðþaøG ¿þQÃï…Ìðûà÷þqø' ÿ$üÃ?Ðð‡àþüQÃÚðÏÀ?køçàŸ7ü ð/þ%øã†þÿ ÿšá_‡Ãðo¿eø·áß1ü»ðïþ}ø ÿ!üG†ÿþà ÿ™á?‡ÿÂð_Âeø¯á¿1ü·ðßþ{ø ÿ#üO†ÿþÃÿ ÿ›á‡ÿÃð'àOþüiß?køsðç þ¢áÿ„ÿËðÃ_2üeõß £N· /ƒ—>^ax%œ Ÿ`x|¢á“à“ ŸŸjx5\ ŸŸnø øLÃgÁg>>×ð³àó ?>ßðsà5†/€û __døbøח¾¾Âð•ðU†¯†¯1¼¾Öðuðõ†o€Ÿkøyðó ¿¾Ñð á› ß ÷^¾¾Õð ¼Þð¼ÁpÞhx¼Ùp¾ÍðxØðVxÄð(¼Íðíð˜áqxÂðvx‡á;à†wÁw¾ ¾Ûð=ð½†'áû OÁ» OÃ{ ÏÀ{ ïƒ÷ž…ï7ü‡ø¶ï&J±äx‚|Ö¦YÃVÍLgNšÊˆò0÷ðbÅ móLö 2p°ï·˜Ê‰˜’a¶©Ð¹™{éTÖdF¹BêØœKÌL›™!­)Sqܦ”éJ)æfø”™È.CM19XšÅUÙ §Ä#§¬Xrˆ¦ÈL†*3m¦È˜Uk¦cƘáÄ0`Š†ËŒ=?f§Is\-÷‹¹búc ‹ÌÄË ;%3i¦Î2™Ih“MV÷”Õ4Ø$3>³§œmÁÏ6s6L<0u ¡cŒÛlŽC-ÙªÅ.ç²–°(GA3ÛÈj¶ê13fFëäÐh™é¡u5iŽ"5ÃhšË)0jÛµ<ña¦%£ÍÈ5ÇÅnB•ÔC«ë(ŽÖ›øäb©ÜætL52Ôê÷„Ÿ™ƒ×Cô稩mZ4œÞîî¡g.·6é^ó$Ð[N?A’‘(8rð¸ÒŠ3¥sAѧX]Є ENR!j³­šã¶]ŒÒ­TD¥0VÁ©t&JV .cµ›ýQ•6{¹Ê!7†Íl&ØŠk(³ÇœÑb)’ÁˆUÏ2{Ÿ†l» Ù[q>÷È¥…¥³9q” T",DX„°·…s–°VØ“1·Ë8‹ØU«–#TsvÚæ×ÀÝ*6sð"Óð;"Xo‰-}§Ñ“ˆÙÛbé|/t -!òh„û"‘ÓC’Á«YÛ‹Ø(æ`OÏD[¡âÉbb/6kQbÊ6"¢X²ÐÍZ„+,6ø«ê䨳‘aÈVãP¬A¨GX‹Ð€ÐˆÐ„p.B3Â:„„õÎC؈° a3Âù[¶"lChEhCÐâ1¸áB„‹.F¸áR„Ë.G¸áJ„«~Žp5Â/®Aø%µ×!\ð+„nD¸ á×7#üÂ-»Ú~ƒp+Âm»nG¸¡#ÀîP~ëW~§Ü‰Å»ö ü‡ón„{EC¼×§ÜëSöèÓÊoUå>¤û¨ÊA¤‡ô˜rMܰ# <ˆðÂÃåå¨àQ„ÇGx¥Ob+OañZyáÈ{áÏ"ü •ŸCéóX|sFxá%4ð2 ^AxUU^CÇ^GÙXóMtö-Ô:îSþâ§_('Uå¯X~uþfwp™ÊL„GN‰•摜À‰œJÀP‚~ Ç• eœ-­FLAüD~0ª(¿L0ï8ö&CëµbTíVSùãLèöÜÅ#§í8<í–Èø|†e HCG_„§áƒ6G(§G"?Á&LòþF'Åã9Bñ9òä‘È·»Nb̳½h‡­EÎÅÀCKÓÿà|ÏIc—ÄZýÿdÖ"f­GŽõxuü±“œ}¢O"sïdÅB'"E9ÐóZ 7Ä(ò¶nrä3º}|÷éS¯"x†.ÅÇJ̾' Aï÷r0±gÆøDŒ¶Ä.G&Îr |B™Ysjü´ŠÌøÖñ­’È»dkëx!B.7Æ”q,F[wÙv|ÆVè“¢SÇl ÌVN03`68ÎÈåKOHåôãé‘„çÓ›Op Õe¿Ø÷Í)Êùa§9b ÜW$6ø“bm,çx«ÕÁÓér–Ű`/&XþàOºÈ$HŽ\™K[Œ´CZÍñy‹æ±oÀ ®1„5Î"æ‚ìa®Õ×ð)w’ðtSùbc‰jXë¤1RöÃ?ˆØ:ðPõ W:§Îç`€œ¶—z ˆà1„C—Ùõ™pi3ŸÏ°øåxGøýÇðùHú„ÉXêŸâ4=¿·mÌ.þ’±ÔßÅÉ=º„Œ¹˜a,uQëQBÇ>¿ø“Y‹Dß{tÌÏùãÆRÿ9m¤mü1þ¸±æ ²lü “#t/œˆƒµž7£8Aà-ÝÙŠ…?ÆUˆáž06⇼Ȅ¥ü±va¸6"§e\¤ ’p‚³c_ÙqZ5b¬^(« râXd#¡ÜF¶€ú)<7þ`®:âI{KQÄ^c+Òå"9‰‹¦[ø.ç,ã1ÇËÉõ)ïªÊßUå=Uy_U>P•Uå#Uù‡ª|¬*Ÿ¨Ê§ªò™ªœR•ªÊçªò…ª|©*ÿR•¯TåkUùFU¾U•ïTå{UùAU~T•Óª+œÊ©Ê=*g*WTÎUîU¹OåªÊý*¨@åU>HåƒUž©ò!*«LåÙ*ÏQùp•Py®ÊóTž¯ò‘*/Pù(•Vù•ª|¬ÊÇ©|¼Ê‹T>AåÅ*Ÿ¨òI*/Qùd•OQùT•OSùt•—ª|†Êgª¼Lå³T>[åå*Ÿ£òŸ©|®Ê+T>Oåg©|¾ÊÏVùxdñJó†nÆè4âçž’1q!¨¸ÐÇùøb?‡’¸šÚåëWV´4×V­¥$¹luÕ†ªœºÆœ9Íu -{,%þÕ«—׵̯­çÛE3Œ\G>Ï‘ÏwäG:òŽü(G~´#?†’€™1ÜYá,ä: yÎB¾³0ÒY(pF9 £§¹Nrä:=Èuzëô ×éA®Óƒ\§¹Nrä9=Èszçô ÏéAžÓƒ<§yNòœä9=Èszïô ßéA¾Óƒ|§ùNòä;=Èwzïô ßéÁH§#Œtz0ÒéÁH§#Œtz0ÒéÁH§#8=(‚«W7Ôn„ ©j©]‡qQJIÒêÕëZšËêZj›«êK×V­D‰¾È«úª†•9Su +!¦ºÕ×nugW­E­nhî¼2ÉáÐÒ8¯qMm%*æ+ÖÔ5AÀŠlSmu]U½Ìjlý`]CÓú–¥ëd(÷+kl^™ƒíVWç€VsmmÎ (•¬ªj¶âª77®o¨Y'º¶®¨m¡„סë”ôˆr|Òú+j›Ç }¡T†þÑRÑŸ†•-«ÊW̪j©^E‰¯z}36ÒpJvßjjWT­¯o±9FïE¡¤<ðIÏÄ0¯E‹µ5sa’Å™u(Ž_WÛ2Ù¹‡õÈŒ¹‰ ™O‰RÒXƒ½Z½º¢¥±É蜫É+ª–Âû2Kg̘1¤T4 Þ4·Ì6qF‰- žYZŠJ)¶ÒÙu-«Œ¥€ê^P=W¯žÕ¸¡¶s[ÃQ‰ežAc„aFzÓ…R.*ùQéÌzy¨×…,ÿ ²‘gœA6ê ²Ñg1æÀìM¯.†FŒ^WÂgæžI(F‰gž¹í|¹P(×F—sœw†Ù™’y¦9¾t„«¡gÐÌ=CC¹ÂJIUŠÑ]×&tr¡K0ÂU‚JÞqu u-E” Ìü÷[ F× Ÿ WŠŠÞ¹µ¥`bÌÈÌ•[ÄHÕŠóê ¾ç5â }ðkj]}½Ü S3‡ÄhGa[ ®¬m™ »²TNÂMv™ºêªú‰Õ-u ÐNZ,G Ø\î§ëèBÞ™‹#¶ª¶zÍì‰55¢Ô|ˆ=Ì…:óÎk4ʼn¶ÉSÇU׋A²ß²ßû6¨P¯â *}•@}ξðñ%A¾”/ ²ïÙàš¹Ý•–OÙX]Û„¾?(+ ŠTâ”`PIT’‚ŠŠVtÌ…’Rº#ô@è©ô *©i½ú(éA¸›¥áñmý‹}Tz5BÉ *ÅJQP§ä•ñ˜›€¥„ƒÊ„¡ý•Ae:” 9¶‡Ýdw"ÜpÂ^„{ö!܇°áÂA„C‡îG8‚ðƒ!<ŒðÂQ„GCxá „'žB8†ð4žAø#³Bxáy„þŒð{„^Bxá„W^Cxá „7ÞB8Žð„·N œDø+Â;Cxáïï!¼  Sr}¼*ȗâ`_Âð³q"Nã S²ƒJÿp%›’ô.Vö¬•ÍSš››ñ™ó‘NI¦P(Ì(]ÙЈüŒº† Uõu5õƪÏ烌Œ ¯æ5ð,MÊΫ7c}Cõ*°Y[“ä+øJpŒ¯ ²Ø?‚¼Š|µäkêÖ*ñ>Þä¼)ÈÏ…Žðf„u-ëa}+#•‚ ßÀÏ ²¯Ø×Aö v¸TW" Fè‡Ö6BÿÙ§8Tc•1Aö Ñg8|§ø&0 ŒR¨ÀÆFзÍAö6s>ß‚=ÙäÛØ·]߀ióäŽâ³rÁÒ††Úæ’úªuëj×y+Ö§º_ñ¶ û€}H‰Öy¨áa]V^>sâô)'Ã~Q:mvùÜ)KK&VLss&έ˜2wé¤)ÓJgÃùJ§ÌMuÆÄùKÊ'ƒŸW>s È»UÌ™RR:±l©,+³ÀŠ™¥sà€%¸KgM›»tò”’² Ø\§”OCUËá€XU'¬åõµUоöæ5Pwù&<Š)ÕUë€ðjã§T‹C¯ÆŽ"…ª«@[êÖƒ¦Ožæà \»¶·¦qýòz4T[†|°׊ ž¯¨¾¢®O¯>Aë7!§¾± °¸D••-`ÈS·Æ¡nmS}íÚÚ†0à…Bcs rÁ‰ª†êÚFPauxbôÖ6¯¨ªÆ–ëq°½ U-u Ìàl ܆õõØjSUõq¼õ55×m0ÛMÍ-µÕ-µ°{›ÀýºjÈ4×¶¬oÆZ·J´êÅ@ _·¾ CÆ»N<«`òÖm‚õßÜØP·M(-«ê°¿-À‚†½‚Ãcß°®®ýUZšqðXK3ô_ÙÐXõÔ õÐ?o• 4ÒHçCÚ i$¸¸SxØÑ¡ èéxHã õ…´ ÒH…0€ãAà‡P„ÐaË€Aƒ²²† ]ÈP¤aH9@JA.45±â0„0B a a Â@VTT„mÐþÐXjuÕ-+šp)4¬‡³9ËÎwÙ¸q†2 R$ˆg¸ïÅHÂq¦Å07“§LxVÙ<ذJg/­(=­lÊÒ²ÒÙ.å³fM™ ‚DL-Ÿ; ‚Àâ%oT+uéÙǰ±²»( Ç8¤Ì˜dNU34oì–U °@š]\¾|u-ÆÍà3×/i+WkÆ¿;Á©1nIpú)qo›ÖµÔâ 5®ÇµWÕÔT‹ž¡™Ñ·É!]ßÓRá ÕµT…»¤Ü™B™Ñz ‘£9q®Q§Õ¶”×D-é$}FÒ?Jú¬¤’ô9IŸ—ôIÿ,é‹’¾$éË’¾"é«’¾&éë’¾!é›’¾%éqIÿ"éÛ’žô¤¤•ôIÿ&é»’þ]Ò÷$}_R8k퉇-A?–ôÁï#A?“ô”¤ÿTÁ+Ð$œ†vSÁ,¨šzqJPê…­é`[/ KsáA²èYÜAü… Ö ÷6‚ãI&=È9ÂÜ7 CÊBâÃ<(³¡öb±-¥ÀOÄç—èN<úñù.ÌÿßHÕøàšÈgHš i´ÌO‡4ÒH« mÄgBºRûÐÎ>HGäú2¤w!}ét´.óu*'BJ•ùr²1Ž<¦Y]ûÀΖt)¤•þy.€t%¤_Aú ¤ßC:$å:tÿ(é+’žžlø´c?J]ìCb'°ý!åAfZ·CdÉ ñ’j’&HT[†«Ë"Ký‡Hò[ þ:É_nðµ&Y®1õÎ’væú R¾Bê×Ëò*S±¡·VòWK½sDªQnÄ2<õB¤Þ¬Y-[ZdXX*-4„H“Qg‰ä4K›Ûd¹%D6HË ‰ä‘ ‘~C¶r›­\ØÊMµr[¬Ü6+׿7¬”N.4œl–.ì05wBa´Ì_dÕ¿ÄÊ]få®Í°Ì_eq¯¶r×X¹k­ÜõVî+·ÜÊ݈¾Ùoæn±rífÎ6|?Wú~«É_ ûV%¨—96¶E“ûÌ-pÊxW.smS‰…¾0Kï›ÂaK<[ÙãØƒ– ‚´öz£l&ŠûÒ/dÎLô¤ÇÝ:?%Qˆ#ú¸ù¢Íó|[—ñNe½S¹¯ÜþC¢Úó›é(WÊýóçCºÜ!»R$è?{ÒÁÿϵÇñN‘ür!;Ú›Ý7DvãƒÌóIXÑêpúÒå©Ïópt˜Ê;ö€R‡`= ¬Õ¨œß ÎAଳžîïëOá"LïB#{„üz'¢EÆÉ N™gD«ZV³ÍB'ªÕȆ,N­äÜmqVHÎR‹³RröZœÉÙgqÖKÎ ‹³Arê-Îy’³ßâl”œƒg“äì°8›%g9rèÀ9_r ø°¶ÕÙõ9‚߀à=ˆƒá7Kª«Ôî*=ì*v•ŽºJ;]¥Ç¬žN}nÓ2p¦Qã)ðêiGg\õŸu•žs•^0¦2,­¿hv¹¿ÝåyÌßâ¨ô*”_·Êr5Œ6¥‡±0Koºš;î*Ýí*½Ý7 K`þ¤5?«ŒÊØoÞÙ#>˜Gâå™(QI’÷´°WÅ㳸ozëâI)¾Þºx”o{J\Š2qÛÅ™ì¤ð?rmiI…ÝÂJ_¨‡{wìil¶¸1²‰ˆ?Áò“è…r’Ô(阔8y¶÷xÃ<‘ì[JœqŒ¿‘‘wÉ÷ ú6òv žÂÌ\‹[Ì{eÖ‹Ïú´Û†u2Z0üX„ÒFaæWa®ÅÉàf»­‚Å6wQuÃîâ»îâfwñ=t³ÌÁØá–×»‹¸‹¹‹£±OŒSȘê`|žâ 8Š_ºëå‰ßÉw\Ë2GÂö¾I‰ ˜5¾“ƒ9ZÖùÁðö€‡Èiw3Íhe3V ËjÆ&Ýši4…}¬ö§ÊöÍð!<˜ä’‘2„u+„÷ʾùŒ!¬tÂÜ a¯3„KàM6@úÆ(›‰%M•4ì–[z³:•!TèG¹5v½—èUvAºÒC^4øž|I§K WÏ Hp”ðÀVáÙkÛðÀ‘ȃýJƒ”©P„ˆ½Ò°7‘\(¶PÇú¥ÄtÔÁw>H)ì4Ò"WäôsGE?÷®Ÿ;û¹ƒÐ(Îwi»h]1»…U­ÐZ7‡-Þx{ã>è6z·ËJ³Uc€eŸ(¼|{µt[©wY9.j†œë•vx?ÄÝ™,—å–cí&‡9kXaÞO¬oã”?*”XOi¿e$Gn*qæ;úø°šH.¶Çd¿¹i_WbÂU26Ÿ1|±A‡@P­@ÐGG¾Ìšl\þÈû¾2x±þ u-ÿOí/i®¤%éò.êÜ i¤;ÉþémÈ{:ÕKt­ñwä¸49î%/Št¸»8Ð]̵‹Ö›|Hi£¬µ¼ßf޶WV–½/çì1¯}«`n´h–æ ÑBϨgNŽýòi>j ²þÈn¸_ŒX4:PàêÀn»ÊYEíjmv7×&}ØX›ôÎ3®M5öÚ ÁÚÔ샑fœŒð·åøBÄÉz9¤IÎ…„¿‚’L›¥ø%õ>HK!= ©Ò j!€Ô`œ›ð»-ðöƒ›>àZ£Åи‹ª]ìkŸ«5ŸãòPæ®1ß]í*ÚKíÑs¨}Z_û2ÕæN·Ë·!±v&I¬QgÔI$mÖìï´-õ–´.¸=¬¹ÜJüb.ëÎ0— `©ëFÃÝÌ/æRµç2Ôi.'ó"æp$| 7E2ÒMpîï€T#ççò¤:HÇ!5BzO>À?7gë‹]7.»ÂšªØSU åæ´™ùùŽühÛ†ñBuØÐÆXÛû@¹å3׈²>'ë‹Ø6Ç_Õ&»ÂÞhÍ%1™$È©è©ô’SѦŽÿ4Á=F4i¸ÕÇš?´hM€ßšøy‚_K‚C_&Ãf¤rHõ* m”a„_L—qr5¤un‡´Ò‘¾fÏÎ k~_çá-r cÑ{ZŠC]„#9NØ6´áÖðf fdf»‡꛽Ö‡ !C倥šF^1Œ<sÀÔ®Ìo XÀ9`ø6…ËË—kµR©\Ÿ3åâÚ¬·;8×qúÍ kÞy&8i‚ÕEÈ™~Du1Íêâ!ÙÅÛbvÑßuVãœ]\€od×È0.Ãn2º9O¸YŒ]2v¬¾a-ÎknXs‘ÇiÅæ&袽­N\ Ë;ѳ˜HÂNÄõõ}Z}…¶å3¡§ì@?1‡èDôÚ<}iAÍ\®ÒN”‡}”téa#xèºHxˆŽÁ¾—îåÓ¦_Ýc‹ß¾De¨éÒ£I{LeÑxˆ¤“~²ñ «ñóeã+»l¼›Ùx¼£ñLÙ8Æ´Þ×ü`ŒB¼0G¡[lGúšŸú†‰?LaEamâZ¢(áýt2K-×é”®ÜO§*Ë S¡ÜN|áCtú ßêëÀܦQ^¬±S‰$+Ùwâ7ë㈾.ß!àó&(^ˆf:xÎ{.ùã=‚ÈÃó܃*ðeÖœ!¾EÄ—ûø"6-¶[Ê@‚³{_~A—6€ÍOg‰r%¤[ ]å0¤g!½#ËøÍ AãÛº8\®ø*ƒÏ¯€Ôé Y†ç7`ä½Ù`¿ðΗeØX½m2>yÈ<´ã=¢ÓSÌ÷ Ló¢3:È1€ÚIÏdžH.ÝMàÚp)Œ5ÌÙAÎâ~íÆ“Ý/ª”Þ`Á hq‡hYì<ÈËn‡YÔTQ³·àä´“ÎÎ]ÉBeÌ*/ÑYÒÉ\›±›ø´ФŠ.•wpñ!mx;Ÿâ”B@iØ<7š ·óA +P7)Dç¶¹j'íæDK*àÊ·²–rªS-VÞ¡7=º‰x;”çb8¥ÜožP¹+–Êõr ”+å(;]•6@¥ÙXi6v'QÓ±;ʲkx¬œÆÑ„ze®zE®zqZP´–)gAI·fA …èýÞ¹ è'®5İF_³¬ÑgÃZXËÜGEݧ\õRµÞè/Ýå²ý‹˜:ç[>Ѧ°–#|ZéªW骗#}2¶šá¢õQ±vÚ×eEwéäI~4§uÈg.<©ó†½9>Öúhéb[{ÜÜÖŽ„µQb[»×Ö»xÚhQû×VÿÈÕa­Ph^ìôŒlrõ¯Ðè©¶­ÁúÏÐú‰ v–Ù*Ì‘°5Ö¶ó_,xƒ]ö{ºìKû,YéÝþÍgÊv4 ÷µ[Ù\ñ Ô&lëü¬ÄU‹‡x!FßÁˆ[c~”#?Ç‘_!i«¤¿4Þ™˜rg¢ð\¥†ô÷Ør¡ó½÷¤»ež‘±ëxfv*WAZ/ó7BºG柄ô–Cùoö15D—ÙqÜ7flj‡ŠG k¹\ÖŸ‹UEÿ«ªƒ¾¢5RðFXë¯ ÀÕDŸ Ñ’û¸˜.ú NVˆ®’‚;åK#¦iq;½~°0peˆ®–z;L½Mv]{c¥ÕfmØX2µ°¨]nמlkŽ Ñz;€²bõš&ÛÝ ÀÆ  Á±¸ä˰6LËÜmîÛÈÃ÷¥mܧ!0ņK“½€ïº¿¶ëA`Ô ÷B³æd³Ím´¹5am¶-W†h³äÎÆpÏÜÛîè°6Nø“c×`cO»~¼l«LÖuPã1¬n.ð&{5ïæ_(—jD\drvÐÅÙA'/Eïû›)Ï‘$¼ÿÅ‹Ã9!Ý!ÁùO|ýâÉÞd_r EM‰;L[ÄÀµÇ<¸]æT\ã$.Y'.©ï$]Üùi˜ã9­“Ò(¹h ûC¢ æà 1N‘„d'ö]p/IæøÛ™´$Yéwz(´\RY hýád_RSYÔNxšëâñ¥ZèMƒ{CP &“佡Ÿùám’ #FÅ=̾hš·!|ÿ ‡èy‡è¦=ŠùÌþÊYw.QÄ—¹.:ÞÙŠãr3PÚÊÁËM:Ø’GhEKÁÏpø×éCT-ßté›/ÌØ!ºÙt`yé¡·ÃÔwÃOrÂ¥ÇûŸÝyÈ®˜wBÌ/tÅ‹j/H³ð†¢ç›Ë–B#-öÑT·v23ú,MŒW dc…’aÖ风1ßÍÄzàpÌ-~ºžˆ u9ÿû@ ZöÞÿ÷ ÎÛõz;}…±Þh+½Œ^)çtð´Þ¶¢­özËü_­·­ÖzK޹Þzá÷1Hû%`¿MxT/ÃÖ b~)0ØÚGÛÒrR¸0çS:ˆÂöì£ÛSsú Wö0Ãá^ø-òË †A…ÙçÒA´›g¬1üK-Ü´h%PÅø¤²ø2b8à›z ßúGo7æœÂÅW¼iü£è„øE Î~cA|ó.þò 7¾ 8¨FðâŽ_?›´Zñà‹3üEÑ¥@ñ7•7›&>ôñë ñ/~:ï p ð|`l¦8hüÄ2n´péÆO/<ä1Ãðå.  Âeš­úÐ6 ß…ƒ~p‚á‹c¸ì³û‰ø .ƒË6~Ç.;±îˆð ¢Y;£YF³.Šf]ͺ$šui4ë²hÖåѬ+¢YWF³®Šfý<šuu4ëѬk¢Y¿Œ±f£Y×F³®‹f]ÍúU4ë†hÖѬ›¢Y¿ŽfÝÍúŸhÖ-Ѭ]ѬöhÖo¢Y·F³n‹fíŽfÝͺ#Öæ0ôÿoÿw6‡ŽŸ´9ü6šõ»hÖѬ»¢Y{¢Y¿fÝͺ'šµ7šuo4k_4ë¾hÖþÿvs8ðßn£Y‡þÛÍáðOÚîÿas8ò“6‡¢Yþ¤Íâ—É£ÈhùwàCáÈúPx}ø¡amâƒô‘p"Ù™Éav€ExÿZ|á½–•i¥»üSиpÖ!úX8í }ÜTn5•)ÿw‚´p˜á¡Îø;Pú(ÚF³xh6jyð›­d­,0ŒµÒÃ:}ØÚÄq©•J͸[HT~$U§O–wD>³›‹áÓAú”˧<%_*IŸrS}·_êÍdÐôXåôéÊCô:}æ ýcêAú¬Nÿ¹ƒô9~ˆ>ÿH8\6l)øIÒÖZ°„¿J­ÚG_€s¢–[èëé;GBÁ¤Êr^€&*Q«‡ÓB/+ðI5üÅÐBF¥ƒªJ¯·rñëô“˲Ðk\ w‘ ye îT(ÃK¤w'§É¾› ö¤™XÕ1`’}¸’’•dÞS˜ƒ[ô§ÀjRàáŸDΡ'é?è§äêéáI×!‚_&§·ü_;±»Î[¢c¿6Lª6ãÿ¨XŽ7ÚacÀ0¶L¬f«:þ6žg ñ«­·‘ø° k\üû1Á–FÒSé?Ï–ñ`3Ûk¹y܉ns´s‹q~ßڷ˭ΉÝì Ú–\ØFÎÎÒ¶ Ÿg¥_h[Ð/±Qféô_èWdr×¶v6°UPœ˜¹Ž³6º‘ò~"6ÍlÀ©»HŸNïRË……妉ñJ‘4¸At®µ~š]žº“Ò´öÈ{f½ V={#N=Dg†ñ6¦R±¥Ôÿœ°°0:Òà熮ªL4AÂpãë´øŒ«d!úÍœJ%D¿›SÉzï£Û…Ô2'I›¬÷ƒ¨w¥‚R¤w¸ëy!ñ‚d‡QÏ£b=O@HƒBÒ ¬z!²CÈ4!KÙNÙâw¶§ž¦€ôBi·‡°ÛKHÓ„´H/’Ò !íg÷Å3¤Ké ËßLùAr‰”„E½¡B–-ê é¥Rš+¤ùBZ ¤£Az™” é8!-’v/—²b!›$dÅ¢æd^!¥SÒéB:¤WJi™ÎÒÙB:¤W i@Èæ Ù<ÙæÏe½ùB¶@ÈŠz‹Azµst=K„t™.é/dÝ!]!¤«„t5H¯‘Òz!mpXné/]–›…´EH7€ôÚN+e#JÈÛ ¹NZ](êmÒ-²/×ÇX Û,o%k¶‰šÆ:Ú)¤ôCJŽ é%Bz™´{£¬y…-²«¤ì&)»Z´ù]#¬^ Ò_Kéõn5oŽáíMRö?1dæê»%†ìf)ÛCv‹”µK_Úå¨ú%ÿ7’«èÝnQçу߂ôV)½Ó™{„ônÞ&¥{…tŸ#‚öƒt·”ÒâîµBz¤·wšã­Ý Ãµ6îñ¿ÑÇ£VÄÿ.FÄ?&¤O€ôNWÄ?åð÷iÞ%¥Ïé³¢îsr”öHÙ Bö¢½,j¾ ÒßKéëBú¦R\³wKéI!}GHßÒ÷@z”~ ¤ éÇBú)H÷Jé)!ý\H¿Ò¯@z¯”Š}ÚcŒÅBz¤û )#(e”2±çÜýî“R¯ª"¿3zY Sôˆõ`A”VãíødšÃCR–$l†¬ 1œ¹ÃRÚÃŽ$ÖËŠ¤û¥4-æ*="¥}:¯C–Ò¤´_çuÈpŸPõ` ’iýÊ+­y%ׂå•^mPy¥O\^©jáòJÍ«eú´î€ªÖЯõ hñ€qšÔFvÓòã5/`‚–¨ic50IóêØ~V0YXKÑÒ» ›=Э'ú¢õš©ÚPÀ4m`oÁé£L× 3´q€}µñ€ý´"ÀþZp€8PK¤%ÖB€™ZOÀ!Z*`Xë ˜¥ ª ¦efkCs´lÀáZàm`®60O˜¯ŽÔ&hÅå÷ѯɱA• ²•ŠÎWTreVTzu6¤¢Ò§³pE¥ª³¬ R ¼a@€™ į³  §³@‚ BökˆfÜ=°1Bâ¼|Tî‰XÒDÑ@ˆC"tCˆGH@ÐÜ9nƒ¸G†n‚)ÝQ¥BO„^©i½ú ¤#d ôEè‡ÐaÂ@„Aƒ2† „²†" CÈFÈAŽ0!!!a$BÂ(„Ñc Æ"ŒCP„0¡a"Â$„„ÉS¦"LC˜ŽPŠ0a&BÂ,„Ùås~†0¡aÂYóÎFX€P‰°aÂb„s– ,EX†P…°¡¡¡aÂJ„Uu«Ö Ô#¬Eh@hDhB8¡aB Âz„ ç!lDØ„°á|„-[¶!´ÀÒ¸]àÜ)ðB ¼Xà%/x™ÀË=ð\zßkn[ð@ð°òwÉ·Ä÷Ñbð>”¼[mÛm¾òÄ?y J¿PQÞ&þÿPK Lg08{!øh« 1org/javacc/jjtree/JJTreeParserTreeConstants.classe–w[GÆçLÑÒÅ6÷ vÒ›''é Ò|'ˆ…ÓÎâ B'Ÿ„cœÞ{ï½÷ê8íÉó$ *É»wH^Ùð¢ßììÌÎìì#ýóïŸÑôGŒžaô,£ç=ÏèF/2z‰ÑËŒ^aô*£×½Îè Fo2z‹ÑÛŒÞaô.£÷½ÏèF2úˆÑÇŒ>aô)£Ï}Îè F_2úŠÑ׌¾aô-£ï}ÏèF?2ú‰Ñ9F?3:Ïè—6:@¿Æè·ý®PûädnÜR3ÕRHÑêJú¥JÕ)UgœâŠÛ„3“B^I3“ÕÓjN7iCωE¡n¬d-35 ¶°®S(댩§6EIÌlÝ¡Y¡xݒДnŒ {‹B°Oª3jÒLiÂÔªPdJ˜©¼0Çj…9aÄê(¥%ÓªžQ,´E»±``³4³aÐv…Z`¶Bè@É€œ9¥b{xÂN…ÚB;«%…¡K¡Î(RrÂÔ“áÎî¨zØlíè´fDÖžzδiN©šv!®ÐÌÚ±¬jØ8^ÃzëÑÕdíì¼gV³LÓ2е¯ž4gåi39%¬ýõ¦‘Ó¬Œn¨i±0µZD¶m}ÜÈhFxsëëÑ×´2fÔŒ u÷(iÍ>¨P_dϪBLh¶>«…… EÓVå,ÜcZGú(÷Æèâá¯f"ßáèð–fiGð·Ö±M ±Ðª™áunŽÆÀÒ.´zKtIH"uzk-ZC Û¢Ê,­±‚í5ç†nîˆê²,-«åtÑzK5ÆÃ¥µº.©xWí0É ÕJëvØÐÝÑ “¸XKÏæLK,ì‰Ä}7.ìUhø’ÌŠ´×f`D¡þð}éxžùƵQtiq±jøs®á,»(äxzÑ9íŒÒü˜] ¼ÒüAtöP¡è•¼êa…šFFgjNb®ùb_<ÚñÀY^v40é/—½¢SõüÒ46#U6ðçV ÂPAŒÓ¾7‡ fyÍÐ}Jx¥¹0›DôB˜¨³ö1áÏ­â˜!\…x«n¡èax‰Ñ…“]ðËØ´ÎÒ0<9É- 7dhEée·€w)Þà‚ïàÖ!Þž{jÅ- 1Ò¾¿ä,¸Nǵ3e§TAx)°Ø­.äœuß ÌÒZ°\°š(ú…¥è„†_ʹÁ²WrŠ(Qì¬T¼ùÒ²[ªF»±Ï 2~àFËQ°ˆãâ­8\ÜŠwÖÅzPBØê´Wu3†ÉÂÝa­oÂ=éQ%-á[@1ck¥¶cs½RxK©;1ÔR掆UÅ-Ë-»UO”lá¶Ýð¬]äq‚´WAaÝâcÊ­¯\õ1 Ý¢²a°Ñ€>n¥ö´7x¡Õ ¶NzœžPh¿̉™+Æ0¶ëŽa²ñG©¸øTûâ©4L§ybÑ-Tñ=p€.ÇØï§!ÃרBWНº |µÄ×€¯•ø:ðõß¾Qâ›À%>¾YâÃà[$¾¬Jœ'%N5‰€Ç%žëO‚§$Nƒ3`Sâ,ø¨ÄØ–8ž–x|›ÄÇÀy‰gÁÇ%¾|‡Äw‚ï’øn°#ñ pAâ9°+ñIð¼Ä `OâEð’ÄEð²Ä%°/q|Jâ\‘¸ ^‘ø4ø‰Ï€W%> ¾WâûÀ÷KüøA‰?,ñ#àG%~ Œ51z’žÂÿ§Ô,~JÑñ}‘’oâëì|3o²ó-¼Ùηò;ã­vžñ˜·rñ6(ãíÐ6ÞmçÐÞíäÝÐ.Þíæqhï…Æ9‡öò>(çýÐ>>íçë¡|t=„nàCÐA¾:ć¡ù&è0ß ÝÄ·@7ó­Ð-|t+ßÝÆw@·óÐ|t'ß ÝÅ÷@wó½Ð=|º—BGø>è(ßoŸ§ËÎ…M ÿPK Lg08}E˜®U p#org/javacc/jjtree/JJTreeState.class¥XxÇ~ƒ@÷t ŽÞÌ œ„¤qIlb!À#‚)du7'-ºÛ=ïîeBœÄŽSÛé‰8=!=ÆI„b;½8½÷Þ{ï‰7ovïöŠß—û¾{w;óÊÿʼ™Ùºï~èÝq¸îˆÃóá/DxQ^ /‰ÁKãÐ w ¼Lý¾<7Áw!¼B=¿R1Ýðªx5¼áµ1xRñz„7Ä! oŒÁ›â°N)òæ8¼Þª4¼M=¾=ïˆÁ;ã°Z©YïB¸átî…»•Žw#¼'ï…I„3SïC¸á,Âû>€p?ÂDø‡>‚ðQ„!|áŸDøƒŸFø Âg>‡ðy„/ |áK_Fø ÂW¾†ðu„o |á[ßFøÂw¾‡ð}„ üáG?Fø ÂO~†ðs„_ üáW¿Fø Âo~‡ð{„? üáOFø Â_þ†ðw„ üá_ÿFøÂBx (f¡hB1ÅÍ(b(E Š8й((桘bŠV Q$Q,ЉÅ1±D@óV˶ü^M©¶ƒf÷;Y)`‘e{Òõ÷™.ýì‘…ézV¤w4}Ô‹8x ³£vÆÈ#íå<öY™S½;¨;Õ§ÛóÝŸâxñRs+ÊŒ•³h œkÛ9vaÊy›2ýºÃ„éòº.†Ê*eÁ;ݽͬÞ6*¤K½ ›vý„€u¬†Àë=³q+L×– m¸µ1ïÐÕW*pð—Eê†Æ:;©tºyf…®ÊP”£%´\ÏeT¸‡¥:áSÙ붺ZOq&ú²Ù~ån*ÓÁ{ÂN¬&û8ÖÖX¿]6Ý” eL–{uŸJbÖR:4J,5VË÷*lj^© ÷©n{°ÃÉ ¾Êí˜I-}DR ‚0{–‰ì÷ê<£ Yc\É'¡0¹µ‰­Åסœcce¡Šºt5j”`ÎÌ{44b;¾€‹u6"Ϋ ŠØ&¸8ó2çWõ+],—ŸW±„ǧ2Žê­«zx¥N¾*0S7+-®'(µr±™‘R[e3ÛÊpv†rkPp¦šŽéÉ“A­+½dЫŠ/0ظü¸íœ4¤JDz /牘^SÛ¥»`xy¥ê¯ÜȆFŽÒÕ’:ât"C|‹£Kt í\Ã|s嫿aÊH£K5 ¨n¿yºù5›Ô¢TCêHÕß«ë¯ÚúÊK> ïèÚdIœïUyg„B! ®Ï½{ézOAot¯_NNòw‡åR,w‚"¾ .ÊĽ>U=Ò×Â.56ŸìDÞPYF´G_PnëÝRE¢T‘K­á‹ˆ}®“wFKäØ^C‘«w•¡yÊÃìøAéz|o­ÅL9’ו8^U‘ÖeÑÓvºá&¸ÔgÌR/2@À³èi!ý 5Ú~Äif@x6<'˜¾šˆ`ç̺Z’Mƒ§ 99{°}’$ÎBó¡3Kâ$´l¦ïĉ&çVþ&ˆL¼I˜¯´ú¸zï¨ßÄÊV…ªÀ½ÐªdjÙ{LÏ+C>B.4ÑïÕg!yh ²ÉÅZì ,¡ù¥‡È­eƒnùžŽ)XAß•ô°ê´ž…5‡èÿg`í§IµWÀ6XÍoƒÛµ±ÙsÉŧéá²·FŽ C÷ÖMÁúäE“°á.H´'7ÒÀ)hiOnªI…3mô§=9›i;ÓÍL;*㡽Ί½®ÆöÒ¡ÖîÚ™-áÌ#XïÅL/aziÁeLÉôQL/gzEgÓ­L·1íeúèõ_É´éöZŒý!Æur;™îbzÓÇÔñ 0ÝÍôj¦ƒµö„öòüPíü¾pþš:íû™×J%['qéµLÇôP¦‡™>žé#{bhçIÓè8R+ñäPÂäù¦™i¤³L%ÓÓQ¦cçÀa1=Êtœi¾Œ¿=Y`j3u¦±\dzS—©ÇÔgZbzŒéñsdóz¦Lo`z‚éS˜ždúT¦72}Ú9ô==â‰Æý ¢ºuÁÿPK Lg08wEŸW P&org/javacc/jjtree/JavaCharStream.class­ýs×qÏwÒIÇÙ>¶e»†|`!'Äq(&0&Qbì°SÚú,Œ,©ú †¤ ¡¤ßŸé'm ¡U“ª)´±Lb MÓ†N§3ýúk¦Óét:éLKwß{'ٲ䙎æí¾ÛÝ·oß~½§?þ÷ípüA…4ଂÏ8GàEŸÓàóðš}‘À—|Y…¯¨ðU ÖÀ×4ÐáëDüox‰À·|[ƒïÀw |OÃÏïí<Ðçiö2Í~Dàú¼@`Ž>/¸DàU—Uø±wÁYü„pŽÀO=ðš^§éÏ4ØgI2Oàç*¼¡A~Aà Q®ø%_xS…y „‚ *\“@Kg¬L4| fMI IPÛ—ˆ#-ž±bY[FO¡‹ÜÙÉd"! TüHGOÛx­“V4fMÄp®e'ìø>{*ç"±hÉ5Gq…?ÉXvYng¢p=™²Oö·R¡tß¡eŸ$X'³™Ã™”mÍH` LãŽ]ÑD×!ÛŠØ©^ˆÛ³’ß—¤Ýú¸±“vJ‚ºkvP°CñÈaöåŠÆÙ"5cMfçq·gOZ1´­³o Ú­ô%"t´þÙ°ÌDÑ1ä0;sÄY t†¶Œ mªŒb‹’V<‚;LmŒä<¢±§ÈŒ@çØw*c3Ú®1!W¢ý{#ÓÙt†pÕÆp2beìt\ŸãE´”¡ƒ"t2t6ãpQ)™²ßF¯†q%žZEö÷<ÎúãGV㟜W‡Ì‡«;ÎwOXáÙ$NvEãÑÌn Öw–'bÎñU`}í :Q݇ì*”`[‰*å@/'ƬøTR¢ñ)¾ oI௼Dظs…$ÞRM1Í;ÕEÂM•…Yر3¡k =º®sËÊåM”8Œ Å„ÅÌ¢Wö'(>‹§‡'T(Æ\Üu¨˜À:Äá:< »uøƒ0 Ã^Ø­ÂÛ:,Âu&ò>èÓa?ô9Z˜QGާOój¯/QûS©DJ‡_Ã3¤ü†{HÁ !!xL‡Ça@…›:üÞÑá·d <¥Ãè'pŒhOÐ,ŸÒa Žêð(ìÔáq?IŒ ëpc•{kŸ(û¡8q4Òa§ÃVÒîcYXáŒê°2Ôt:tx~Gà÷‚Þ:°¹ux#¡C 4WˆÏV’:E`–@š@–¥ d±VËÍ#‰[t$RS]Ä ‡»¦§Q¡Ýõ~QíÛ\iéÐÄ´Æj¸Û±c8žÎ&“‰Ör<œˆ âbp—oz*±g¨G§RÖ©p"yª”¶KT÷†*ŠMí N³ìôuVÎíºå%Œ¹I»LçѾ냮p,‘¦Ža%“6µÝ@%U+H<˜½TÔ¡U¸žL‚SŠ[ŽÀF¼çvàµÕÍðQ؉×W/~ÕÀ.œarÓF¹Ïð÷2¬PÞ3¼_à~A? 0f#à ŒÉÍ0æ7ÃòC?!ð“ o†&Êa´éÞ®&b q{Ëëì¶õ±× À$Ž÷qüÇßpüÇ?püÇ¿püÇèvækª¼Ã%7/G=ŽÆXóÿ÷—óJÞ•wçÕ¼'o¸ó†š7pâÍZÞX“7ô¼Q›7êòF}~¤Ñ¨¹Éâ4̼ˆ¥ŠpžB|„EºnÓ?òU&©ÀÇaTðße¾ r^°±Åp¶7cÈV<0~Ýu°8ÕKÓŠÿ<¼ß¤È‰C³È5P‰*Š¢æ™°—ˆÛÊxåm+l›g›•òšÜ¬¬XҬ̣ü(~YãóàÉA¸Š©«µÚöËöqGØ;]‹ 6» P»u7Mâ3wÍÊ×›ò<¸¯¢§7I÷KÝøv&ßc·çÉodÐ#óTi40µ¦)ãÚ†y0Öˆc­àŠ`Ý讚9Æh,€ÏIÚ×ð㹫<Ïyð1S²Ó” °>mâÐdÿ†!qLúh ÜD×a5?Î jižá½#Œ  ©Äí Í ±ŒºˆÎ)@³0µ¡;_–«Œu !”lyzHU ÙÂÍ%¥,Žsd6ÍÉFô¡ˆ¥§;Ï\jÖ¯þòͺ-Eâ'xka‰PÏ•ÞC±Ãø\F[õnŒSö—Zs°C»/CqÆÝDâDpñ%Xc*Lx³Þ©:¼ ÅæÆÐRÕ½KkR04M(ÛvOŠ·uƒ©àq›µ!T<íçÑ@ä¶û mŽ6AAL²2Y?k”#8°§@-Ží8LA£±‰V¶ç KhØÌmˆ 4£F` œ¤jiÊ1B•ìà‡“èm"šö«x8ñó<ŒÁc)|ËêçXò|Äáã¼ct×ÑaãØœÔnú °QyøNW\ÀØÑ ¿‘Å@·*Ïáîí¢ hñËT\h“Âkw‹ÙŠeaËç`í`«rܪD8‰é9W#ån¿Èõ“J£ÉÜí÷ýý×`“¡Ï’Í<³gÄT-Îμ4ºk˜-V¹¯¤®±waíÞÝxOî%§`sc'Ÿ7Ñ| Î `R_iÅ£¸üù21ùe8 oÁ- Îu|Ðþ‹Ô-=TVÅØxŸò \/ŠBsBä%4%‚|¼¢¤·‚d%¥UuJ0]QÆ»LæDU=î¢L¬ªž’ÌLñFÜŽ~¡Ú»—å%µEž—~‘Fñº ›ÂIo|÷ŠõÏ¢ß\ˆ“èü­¼ÕÈT;XMX}ò–©I×P”iû”lnÇ‚m%Á6^p¦Oq.ŸrÝE—bnŽ5»;1Ö–,I K6ðBÃ^°µµ Å Púô¡.¤(Ë…RÅ3=‡Bt¦ÔJ 1“߃Z]u®°k|“ùuÕNîàSG uh³†œÞ)ÙRíTØVªvª%BøCäh…ܬãnAÝ"G·.@Wt6 ,À}m>Åç*zÄ©‰ Ó’[µ ß4šŽ†•Î>)vlÆýH¶ÖÜ@ÝLìþJÊŸ®Âí%­³Bkj¥‡€ŽZ•U”žªòí%~Hç»t«TÑ9mÂ9 KœãS–…¬ºo ð@%ÝÕ|S€î’Öª¾©¢´šo–(= Ï¡PY±Ä-ç¾í‹ðà¨óftÈe|z®ˆ^]&Á‡ÈÇNí°èõ°E¼}_[? Ÿ[OŠóŒùùK¥ýy² · Èx­¨ü1BDÅOœˆ‰ GL‹¯n‡ÀU!9àìù\ñ)´QtMŸ)QÑJTÒÕ3ÍñÎópFü'ØŒnÕ“j÷î’‹šŠn¡‹\ïQrØù–>É‘Èx=ŠÜã’{Ür*÷xä¯ÏåS.Áµmz‰*ÉÑw¾ÎÉ’CPƒsÐM4ŸÛ?äcOqŸgØŒôxø¬Õçòyz¼ç\xE¿Æ5ëÎIÒÐR1 ¿w•ƒØSÖYž»ý'LjÜíwL>RÇ–`×äNƒÿPK Lg08ÁcÁîJorg/javacc/jjtree/Main.classuAkÂ@…ß&Ñ­ilµZëAè5±‡mÏm½xR””€ô”Æ%l¨ÒEôgyÑÒ‚? ?ª8QAJqöc™7oßüü~mÜ£nƒ£ÈqaÃ@1».m”Pæ¸â¨0äŸT¢t‹Át=ŸÁjOÇ’0 TÂPs_{q0 Ä{Db S•Džïà †ú4DÖCÇ:•Rt»C‚ƒsT9®ÔpC.ÿuý}éèýòËPŸú±óG;X|h9¡r®hÄr;žäiÑìT” 6½ÊDFÌ5×`Ë @ñœCû–Ä&±ò c´†Ù»k®`=7>‘Û‹±PK Kg08·—Èiorg/javacc/jjtree/Node.class}½‚0…Ïõ¯*ø;8¨€SÝŒƒ!1hbâŽÐ¨Á úp>€el ‰‹Øåëm¿s’ûz?ž¦è3tzéú""BÙšìu9/Âø*¦¼nEºq¥„‘µŠ“Ü»ëy\þ%Bp'öÅL唼üÊCkRd 9Î}q<…>a\Øk«b#+Îå‘eÿ)îe®s;k=Éײ ƒßBW=òÐ|½„—Ö„ÔaG¬æ¬iÖÑÐlÂÐ4ÑÒl££¢PK Lg08Å‘"á-&!org/javacc/jjtree/NodeFiles.class•Y |ÕÕ?‡<ö²,¯AÔ’ì&DÔÔFò lD#R:Ù$ƒ›uv–)­míþkŸØj[«¥ö)hÃ*¾úòÙVÛZ©ýÚªí÷ì÷õ{¿ý>ûsïÌìlv~ñÇÙ™{Ï=çÏëž¹>ûÆÃÀZümžßEàÏ£ðð—ø«(ÔÂï˜üµ€¿áßßGaü­€¿‹Âøƒ€¿ÂÓðÌþ<óO3éõŸùé_fÁ¿Â¿Eàßü‡€ÿð_þ[ÀëþGÀÿFà ŒÂ2È¿3ˆkfÒS-‰Ä:&õL"<+"83‚Ñ(¬fkpÖLŒálsÎ8/ŠóQc²€ÇϸPà"~\,p i`!K™,‹âr<—Éy˜2s®4â|Ÿ½Ÿx¼+Êvœ3œ¼é´ Ü\ÁÝfeL‰<È ‹}!Ik<— ‹ZäÏô]Ó;Øš¸è,:ª[WlJe¤³bð<¼@{÷ Ëk"øÍ~ ï'­Óo)ŒŒ˜N áq„ºVžŽápŠÄàƒärÃoãm¬´‡ü~ÃXŒáCDàGðã> §"x2†0÷¼éšH¼Ü*MõlíÞwM²;¹ogç®d÷.„ÈîždÏà=ÅwuvíØ78°£»?I-ywîêÞÖsMÊ·îë»û·&ý×m]´raù™ìFA¼¡uoëQ ᫯怉ácøx ŸÀ©~¿ƒ_Á¯cð “Wáµ~-¹À·dÏ@(:æ–¶×í8¶Ã‚à÷cøxÈ#9#u£1jêØÁ'cø+{ ^ˆáÓÌ!sÚŽKó5­Í1|†g—r ^R®x6†Ïá#ø£þŸá DàEø9…i®0œ±R:¥éŒ)©ïPß"ùèE$¦Ùº^bc…úf}þ…t0¥Ü´g¯N™ÌNî7ÆMâ;DŽÓéo%ÂŒ• ]?L™‡‡Ùk*kbxŠƒàeÆúgpŠì;0¼ßL¹1ü¿­ T¨a]æec)œtNöáª×Ó†k4Åðe,’¦¶•Žá/YÆ¢ê2ƒ·8†R³ÐÝ1Ǟȓ°-mÍzg&£w&%O^/ä]]j7É/Ù­U×{\=çØ,æ6òV áJÚù¸‘³(Y'õÛÑSì§rÉX$ÂÔ)ÔXš‘MëÄ—I뎙1dþY9®;$bØt'L3«p´êÍmT*'MAæÞªëmÍÍú Ã7Ý1;­ÓSÊÈdÌ´nŒ»Ô˲ô1ƒ ²äqƒÞx8UpB{™ÔάlÚJQ½É—ázP•]R#› Aº‘N“×Ö-WÁ\ž½Á±13³MWœ'=+P!mcÆSb–q©+•JYC…²®Œ7¥¶Í!m9Ãrt{ÄÓš×Éz!ïÏ’—ÆK"6‹O9¬KùJ)» Bz;%C£ŠJV{nÀ%Ljk{ÀÅó[*àš™L¾€0Ñá-¨Ð³ƒù5y¹o]ÏX„VÚŠä“ÛfSÌÎtº‹y<” ™ÔÖiÀ8¦[p²¤:ä’<è;…Ióe ãæÃ}À £8ö¸~³éØ =cŽHÄŽ5:æÙnE5«(P˜ Ì. @mWêï±,§‹fIJra¼Ë[Ñè9…Ew¦¸KÞQO"XÆÒéÕ‚­&™©bD}f®8~¦¸GÐC'þŠ«õ¯¹¦ÌÔ̓®™MsQÑJõ#$,çˆc»¤ˆBPª8#¤Ë§OQ}õ7OÓ ÂÓÒré•Á¨_ï¸k£¹XxŽë:éèüø ×ÌsÃÓƒödâËÉ»òq:5O;/›öNƒÀžGy£³82(7ëVŸ"úaYÞ*—0Μ˜¼2Æ+¹à6ÊØ˜ë%#!'a9Bÿ ø*þ ¡1H‡  ±.Ǥú¥à¤¥ÔóXŒŠp=kN”N³žóÏ"‹KS‰\qz‘Ì(¥V–)UyýÒÓ•0žœ¡“ËÖŸ½îè‡üSe³ží`+·© »‡Ø‹;^Ñü§Ö ¶L:vDo s3i.d2%›è¥¤Ý,-#£ÙÒãúº½d“ÕÌqX73yS ²ôË7—JYÆÌŽºcaaCв¡š°Å“œÌ»æx«á8ÆdÊÎMèúÚ„žRtš •TÓà¦:¼&FÅkin%ÐôʳU4ƾ8!eËOSµxù†Ðò*–¾B_«·Oß:g+F~Å5†‹‡gX«|£m©’Q=¥z¸Ý— ŸÒŠKƒªH¨Û‚R^*0¼ôªjpC+•@—i¹$‚p»¨UQôU@”ª/ÜV Ci]5€23Øo†üæ4ªÿä• Õ´–UÏ̾/ƒ³§2ÏV„òl \î2UДµô³©"*ôx\…d‹®—‡;Åcké¸ Ž:cDqÓÖæ…vųÒlÔ4ÙÙÚLDZT[IYíNØAÃeeõ|aXšÔÑÑjæ][¶° ‰úm{ܺY5¦Ædé¸7r9“Ê¿>1æ5|yÀícº0žãvPïAØ$ÅLÚjä—wyÔÚØ‹dˆY“ú&"Ä£çÇìu8>l¹>ulõeÓ¨~šºM ‹öäñÊVÞgkbtHÙIî`½¼—:²¦ê2Ó¶êVVMû| ‹ b“JRkè£j•Þ+ƒkûi{ï9DZ†ë» 2YR#%uKÇ ”jÉG$ð Cµ%ŸŒQÇøƒÍî7¢lkÙ®–:Ñ*ý2¯¨À)ÛÕ p“œÖ_ìd²`—c‘xÃí¡Â¦ò«©¼)O 7Û*¡¦Y©¯l¢†â5nÝf—µw ƒV.¤ø·xþÞ¨? wò«!_È™Ž×Q eñüÒ`ÐÌWyêèÈñÖˆ[éŽí*#?FU‰ŠBå-ãâ[‹|ÙEŠª*Tg*¨ ÿÞiɨézC2o¶Z­´I’çߤy—C|ÏÇÙ˜¥Ö?ÑXåv©bHÝñ¾|§Rp4– ­~KUoÞT02„oaX‘ÚVGÓõòÒÍÝR ¿‡ PÓÈ3õæAú>¢×±p‘sËî+ }š»†ÅûßxV8{ª#œ•7é°3JÃÂjö ®ú ãKW*ƒ¶¼µ¤À u)îõÎà í*+l€¹œu;Õ ‘ÒÜ3…®Bi·^þ¶\˜;ªšgõ2Únâ2S™¤Å!¿‡o[Éw•h;“ƒì­f>åX9 ÒÈv§±žtø:VZ·Œ-þ8ñxVº!„Ú<•éÓÊ:S}IuºlꞦʘ ä(Ÿ Ê»„¢QzÙJçÙàdŽ4 ì+d\‹âÅC·SV ²x‰?t³W'-® ÈÜݪ`¨A‡œ »„|‰c›á¥V½:œKv7ϰž†g`,gá9@ø¡|[‚/Né9FoÏà 4óz›O¿H¿uÍ'ÿ ¾pUÓ¸êè?€×OÂŒ¡"Ôœ„Ú¡PŸ‚z-Bd Ä ˜Ù×¢S0ëÔ…eq-&ŸcÍZ´³ÂÌf-FŠç Á9w@í±ÄÌ= ŽÃÔâo0¶h›ˆÖl¬_XÏVÜ|7lj¨]H“—? Ú#Áª+hE«Ò®$ !»ÜZGÿø½·ÉÚ–@f”¹¾¡®ŠÌ®@æÖrI϶hÝÛ6¦S°|ÛǾM¾¥¯)xÞð|úòÙ¬{U¹uXwY7J¿ë‹ÐÃ!W„«ÿŸF¾¬½ö¬ö-ÂŽö:­·½¾}^¤ zl¯Võ³-êYÕ?Õ•Ç]v‰š‘…ÏKûÉKÏ¢¢Ahoòóx‡'±»XP2Úgš’<<“åžQç­òÄígöA®ÀUÒQ¾Ô÷|ÐF>༺ ×ìÐâÍr¿‹}ý»KöÙѬåÿ©B‹Ø!«()kèw ñ\ÒKÙÝ×®%qí:I‡$Kz}èy¤7Hº74þfI÷Iú–и!é°¤)IÓ¡YSÒIGCãc’Z’îß(iFºªç$µÞ¾’«#ôØçsŽ3õm‘%;Pıám" ß/åΈK7„íª ü†þÕ’‘W“í^ñmWsY®–~‡l—›‚›ŠàxP–ªóRãk¸)®¹ROAÒ’NHz0ŒxR:™S7‡ÂóИ×Þ*ù‡ìò6Iß.é-¥q_Ú;JÒÞÚë»$½uÚª"¼{ Þsìˆkï;ØÛJbßûéüÚ+F>ù°¤‘ô£!žIz»¤—ô’~RÒOIúiI?#é‘ -wHúÙŠñÏIzgÅø]’~>d 2øŠ¸ö9òEIï–ôK! ħ(’ú´Þþò`ì?s¶øa(ãñžï­@V&ç˪œ£’~EÒû$ýjÈ^_«ÐòuI¿!é7%ý–¤÷Wúþ˜Äp1k<Òø@HÚƒ’~;42%é‰ lEI’ôáª0Ú[Jé)¥U&è«ðšWÜîS Šwr‚ö%(A‹pRuKÂßÀ#„Zöi*COòã¦`'GáüJÎGƒé`î1îñÒœö„¤ ˜<ÒVÉûjy“о[¶ÌOC;!Ó0ò=_Ê÷CK+tUMÍJ?˜&Có¾Ê@NH“'d&ÎÎ^U½'$ûÞJéÂD• +à·AÛ½Øk/f„'I×SÀ<ÅÿPK Kg08·Y aá {!org/javacc/jjtree/NodeScope.classÍWy|›uÿ>mŽ7é˶fíFv° Ø–&íÚqŽvÖÒm]7hW×HÓ·m¶4 ÉØSĉ(—7u*ˆõ@Øu‡ ÞŠž "x_x+åyÞ÷Mš¤oºòŸù|òþ~ïó{îë÷¼O¾üÐ#šèj/²8äŽxŽøîVpƽþˆ—Á£²û¨‚yyý¸¼|BÁ}²~RÁ§dý´–Çýn<àÅ|RðYÇäqDã ŽzÑ… y<(¬‚‡Eægåñ9/ÁçSð¨_Àø%_Vð˜lWð„‚¯ÈöI_6_SðußPðMaõ-ßÂï(ø®ðJÁ÷|_Ž~ T?Tð´¬?RðcþDÁOüLÁÏ<£àY¿²çªðK<¯àW ^Pð¢‚_+ø‚ß*ø‚ßËáÜø£‚?)ø³‚¿(ø«‚—¼Äß<ø;þ¡àŸ^ü ÿÈDÿŠkÿçÅ˘dö…ÈM|L•L@9ÉåÅnr»I‘Õ#g^yT¹IšäeŽ›æò1ÉcÒMó<¦ê*òÑ|7Õx¢j7Õz–u›¼©t²?ÕcÉayg2=ظ;rm$mܽ[OkZã†îžíy”ÂÜD²_ÛÕ¯e¢éXJO¦ +쩺ï‚<Sz¢ñdFëï0¯Sðã‘Ä`c·žŽ%AÕöFµ”È1pÜ"ÉØUe¢É”Ö•îÓø:®u±DL?—Ð<®Î³R¯®—àhcóŽez“±~Be°î2Bõ ¦#Vëfití4êm/‡¸†9ظ`®…ÎfÇ"}qÖ¦:šLdô4Û2[œNkËn^6£eÚÄí]9_úc‰Œ–Ö·¥´„©W4IGÌø‡íœÙ±­ÅF»ËWÌÉtÞ|˜—iBëgÍø2á\SÌyƒ•žµ%¼sðj Ñ£C­ñdtO†Ð:£Ä¬‹7¶'²Ãšiz çéé}=É=Z¢[»&«%¢lÉ•³¶ÄÏàUþ@Dzb‰þž¡tò:6ì¬`º›#™!]âoÇ`Ë–^Ä)yÅÛ÷¦"‰ ·ƒ+¥L¡ÌVñö’Ôí )gÆh·Ô'ál;&U™ƒ°EÅ t¢ŠkqJ~ìwÓ"•ã Wäµ\ˆnZ¢ÒR:IÅ^ìSiT¼¯ãFPñÜ¢âöó[TÅkŒ¦âzìWñTi9n&,(5²5;0 ½¤²©©I¥“éyœªÒ Á®dUZI«T RŠ;p»J!ܬRXõ8覕Vãv`üÀú€›Uj¢5*f(žÈÆã¼èC±ŒJ§ ¨¢žQ¡Ò"‚B*Igñ&Èÿ:nq«Yh[Z‹èZP¥³§¢®E¥µ´F¸iױѷ ¥/™Œk‘3SX.wöÃn f9¯1½›«ÃÁ̱EΖ‰nMßKgt#ç‚Is³¦NÄ­Ã-ܨ™ï@$žÑ¤™ìò5gò#œd±êŒLãÔÄœØ(ŽDE€µ¤*ÞŠ·¹i½JçŠó¢Rª ‘ç’ÒâĺS¸Ø@€ù/ ðÏ”½:Êö¦ …;äk%8ÐXO¡¬- H%S‚=*I¥óè|®ŠÒ,à+'À½Cpi'˜c•0ÑE+Ѥ!çßÛÓédš#åäÚ ìWiµº©M¥ ¨ï*–ÜñvÓFIƒM*m–¤YËiÍ×Õ7]¨R'mUñN¼‹Åp™Gâñ}¢ù)¶7Ikׯ®d¢GK ¦J]´M¥íR©t1u«ÔC;8¤Ç¹ýTê¥KTºT’y'ñu¶d¦êVñŒˆ­&›Ö3ƒ²‰J—ÓnºR¥«hOåíËwŽU¶8ùV€¹x†FRâm}»µ¨nÜâr·'"Ú­»Lë·s_¾ü…=ÉÆus°·ºt*ðrëÖd0aIçØÞѳr:tŽ=rÍÕì¡u<Àt… ¹")nýÆý;‹ÁlŠ,q°c†SEOæÊÇ׃úád–ïÉdû2ÖÑ‚`‡ &¯²ŒëÙ'S­·¶x$ÃÞWøu+»=V6Ðcq]Z"“M3ƒ»[«4Åâ8úµv–s>xXP·Îéšðvð°´=’Έ·çX°‘(»rŸ¼&Ë=±„£™d-2'z,Šö·Ûç+\IZ˜s³0ª›“É=¦”žt$ºÇ蜙܌lâ×ÚŽ*Ü’†"™­É´Ö׆µ„ÎTU ž)­×ÒÑÒÒ“Ê`mf{[rØÄõ—™ ÄE ËÌ)Æ}$3¬¿ì$cÛfŒ£lkÜk'·ìxd?¦ØÆµZü]bd•ÑÁ3»â±Œžÿô0üÚ«EÍŠ›W ãÈiyÿús67š57uŸJíØUyÎ-ÎØpdp¦>´)žì3Ò¬jêÃL’Îväºcé%ß¹”´ËÊT–Ñ×Ú Ï’A5+»‰Ó8;Ü6‹÷§Åâ*f¬ÞQf äi|=fÌf½tƆÆ-Äþ˜›†)‘kÕˆï"[—±œ?׳\¨ù’w2F+O‹Æz½µ°V.y­æÿ x=7òNC%¼î åá-|„ǹDZ,4†Š1TvMÀ1—ÏÙj˜€ëÜ£PBõ¼†#4å<¡Ï{UG òîc7‡wsݼûaþxhµDÖðÊ#sƒ{Õ÷YoÄMFµ…áŒÃÖñ›p³=_ãÍyŒBªy\!#µu¼™M®äuÝØ¿ó(j|µãXÀ¨žq,lj[s`?ƒÃü¯¯Ç"W¿<DZ˜Œ”zkÞ®9–Ð G΢Ûp»u6Ÿå‰Dw(Ì\–äœrGžg•ܼ>mÚ´”]‹;„ê ,» UüÚì…«¡ÙæX–ŽÌmßÁßrÓUö'›:Žã” œ:Å·bNßÊfçV`‘Eëw nÐÄ„ºf×B>6¹~r"| y«ó»FÙ¹L‘¬o“ÀÖ䤞6Šë™‘¡k6Æùñùœ‘'?=OÞ0# ³=c+ ä;ÓDž#û³ò˜…(ÂÊôÞÙùó ¬-etN“× 6`y ;§%“ 92X9q‡\JïN{=Ö•X´bé]Ód­ŸIás_¥ÂçMSøíù$î¶ÊfS‘„ó§ô,‚oÈÁ—[§ xG^@%`ó«P9޶%TÈljUf#ÌßÉëmõâÂÝ”#•¤òµ›ž˜'û%þ¿¿sSA¦0‹P6Ûº¾¥Ã6ŒE([ìÁÚƒ;ó`Ë@ÜÈ›­„cèâÎacaë¶|m•±e{QíæÈ.:ž£“û‹N.¶%Î%»q§•/q"¸x}±(°ÝSâ&ÐÓÐìô;ýŽ1ì¸~¿3ìëgOà¿“aÍÎÑÉçÂ4K¹›í4ï³ËÆqy³3ö;ëâŠ"ÖW–»·èÔ>ØÅÙØaÂ¥ÙØ9ÍG%I*¶˜ðÊWªåU<0~W ­Ø5†«·>€Ó÷C´«á1¬n°¬røV¼ËÎ ¸3Äâ&ßÉè䳕ë—0ín, /ÇÀ1 ·úÐÁ |!ƒ»ð^Kƒg¬<5S ˜c,ï凱›ñöˆ2ÂXò%þÿìoïÃû-kwñZ!=.ô(†GP:†á1$‡D’Ð~ Íaó$lðkÊ|MáyM›¯é1d‡MºÑÉ'Èš^PK Lg08º”/ þ€ &org/javacc/jjtree/ParseException.classUmsU~¶Ù$›t a!Å ÅmÑ’%ň T¡¢T VÞ*´ŠÛä6¤MwÃøRT_ÐOà8£ŒN?øfÚ”Ñ~€ÿÀßà@ÏÙ 6”À™{î¹ç<çåžsîæ¯;ܰß+x9Ž^Qp@ÁP¯âµžÆ0“ƒL1yÉß`r8Š#q´ñ¡ G™Sp\Á¨‚7c8“ ÆX:··¼Íû©8ùxGɇ Vçø L*(*8G SL¦”Ì(°Ø * Î(p¸ ¼8ª8«à]ÆÍFq.Š÷$hnEäKfyж\Ï©æ=Û‘ ” æ«Ž#,ï¨=-, öSì2Ïšù|ïÔ”çÑë«vIh³äÄ_pDœ© +/\ ¡±±! qÅC3fQHX;6ÌNz˦Uì=â9%«HBÂ.S.ÍT‘Ý%«ä HÈ¥˜…iâvëq ò ] ¨¡’©æ xQx…ëú ®Kmm–F«Y(œnÞ¬ðÅzšyjf{°WªrÉYWTLÇ Jâ}༊]Ø­âìPñ,úT<‡*žG?›¾¨b©Ä+}ï«NN GҸÀä#ºc6›¥ ëô“жßÊÛUËŽ(èÝQ|¬âôQX]ŧT1‡‹ZônŸqô—°ŸêЭ›žÎ™ês\dÇ_HˆzÞ.Wg,’^b3‰â¬5]=è;eÓOŽG ÛäÄžìâK_ᲊ¯ñ Ÿ`â1±˜L2q˜t3ÙÂdœn±~Q|ËÉ~DzªŠ+Ìé÷Àˆé¸bÿl^T¼’MN×.—ªAšh(à9×3ÔRjûˆcW„ã“°³IK±É³RVA‚ñHc´Žì6¤¢]ÿ€i§êXb–J¨xv`B’éÇ—èµ…KÁC‹Mˆbɦfr ¡‡jõ‘ƒ~‹ï-TÝ{¤,¬¢wÚF!’?m:{)™ÜÒl®Y¶¢‰+ êg{j¨IH s«®@}×rô5 Cæé'Nâàïôüží2?)Ñ› úr‘èIkÒZÒZH“o!¼ˆHZ^D4Y„’6Ko[Dü&à{¤7U·ï"{z¡H¦—ÐÚh"ëeøÞ:¼›à-´·§3+¢5âéµø–Õ”\„öPzÑk”ÊÔ¢íÄV ‡ö„:I»}g62Ó™#¶µÎí õÉIùqW†ØxpLÊÙ\ «z ‰Ñ9Yšÿ÷ï@QGË…ìUÄ3Ú²]„MãÓ\ˆÐ—µµ‡Hª,`]¿ê 'ïãF2|ëëÉmcƒ$‘ÚuÈ X ›tœK(W×ÏÃ[iÆzßì.¦ðØý²4ƒ;jxü!p†P¾saºÁH#`C¯³€5tj›%Od¥O=Dê®ý.È?£§ÓµŒñk\us#¤» ¤AŸ¡s]ºí†?2eƒávÐ,ÓpH©ºÅA¿ád³ùº¤e’r OþÎ6¿ÑŠ!ø¦¥Ð:V—¢§UÿÍ.­6Zçýa}Á-´®Ð§õãÇð¥_ð@b¸s"¤ž-3Ü0xǸÖ#v` ǨÆÎ»m6תd~ƒÊÊÚQ¨–i»ç½‰µMÿ-—¤6R .³ šµ¼Ù(UçV¶•ˆ¡ÄZ«+è+¶*õU×qøiÛ1¤"†8ïv¨Ø†A›°YE?úÜ۠ຊ ×é™§çiïÊîóÖZT[¯ ”jé)òšÄz…¼Q3½auÖÊUb”þ­È?|..Nfnvv~FŽ¢ÔÄï̼FFOF6›Ì¼Ì;F1 OŸ¬Ä²DýœÄ¼týà’¢Ì¼tkÍ0Fçü”TvV6Fùü¢t}Òädý¬¬’¢ÔTýüìÔ<÷0ÍÈÀgñxæå¥9ç$§32ˆãÐÊ t" ÐÉŒ@ ´ÌbÙ $9£,–Iô®¥2yźR|,^>J"Å÷ûÑpXŒ„ˆô \âOE?33˜“ˆâ0ÎÎXq%hÿ¥ùöh(ú…Òìäf­ýT¦ÅkB9hr6è*X º÷çP„Sä“Õ]Ý›Y)>˜!^þSå?‡Xçî3iMøÊmxððÀCË„µå„ÍL˼ž‡-lïÞ ¶ù¡]þ$jÄaÞà‚ÁEƒKy+x¨qU£Íѱoðjž‘Ktè*>á– W ¯@_oèuC/£Œ’ }ºBé¶`ÃøL—ÔþпD9|q‰Ê´ð16ï5ú†ÊdކºCí5¿hÎgûÄö™mgjר¾oîò×°tdß*=1JuÖQ¬&}‡3=ñû£ÅwÌÿÛPK Lg08· üÛî%org/javacc/jjtree/TokenMgrError.classTßSUþnÈMºHØ6´” [ª°d±¡þ¬Ð¢4líjhZˆP*–.ÉBÓ n6Çqúä8>:¾éø¢Ó‘_êƒÑÿÿÿƒŽçì&À´qÆ9çžs¾ïž{î¹÷îßÏþø À4ü®& 0—À{xŸÕ¼Ä5Žä$$L‰ëHܰ$>”ø(<™qS¢À3n±s[b‰Çe‰¢ÄÇ+«ŒÞIàU¬IÜ•øDb=q|ÊjŽÕ½8̸ÏÊŽa3†’@_Þ¼cåæóæÒRaI@XËÕ݆o»þŠ]k:*Ÿ–S—‹óE+·A|s)d3"RÖÍ•ù¼µ°ÑIÅL“Áœ¿P¸µ±`Í\Ñ\à`D îx^ÝËÕËŽ@Â.—ÍFÉÞuãz~Ç~dgk¶[É.û^Õ­ÌN¾ˆ†“•¼óyµd×LÎ'`èw-Ëz‘Ÿëš#QqüE§Ñ°+”é´Þ•Ó{¥êVý9ˆ>¹"0Ø¥>‹áÿZ9@Ÿ_knm9ž‚w1CYƒ-l œXßTPÅ[>+—Õ+Õ« VëÔ…iúbx  †‡¬.3ÐTà²[E–nwH Z®Ù¾V«ºŽÆè.Ä”Vª×š]M yQÓL·Toº¾ã9åwo®Ï‘!Æ|*øu¼AKh:5drŠ€¸½ElmF#Â;¸Ì;j(¸]Á[x›]jâhÝ«d¹¥RvgÇ÷'[¬?pÜÅŠ×>¸þ£µ#Éç[FÕÔ·âogA·´·´m{óÔ£¨nMæÈ·ww·,0õ¿.QxTÝÀbÑÖ+­.ýzgÕAݲº^x£¹Ùh“†õ.Wìp…a½K†C4öˆ_YŽ8Õ-Ë,Ç»lhçéÓƒêÁYL@§7:Éoòcþù¯ó/’Ÿ=æO“¦#Ý‹4Ÿ0!oÒËÎRæ/ü ±¶ùÈÜH¦…ÈÏ¢?3ÒBôWšñ„$Žð»M"IŠíØ=’É6‰Bâ‘ô‘|I2Fò5ÉÉ·$ë$?ìá©¡ö´Ð»º‡_ 5Z?ª ­ï 5Zßj"´êÉÐò U ­Cí ­ûA¡kW“ÚOˆ§“ŸàF{3êKÄH'“è'£…äLÔè@ŠEi¯±r0´ †¬0mÜH·pjõ«ˆØ{öAá§A‚;6_ BíÜNÒÓ¼^ )uŒ6Îqî{Hõì.uhCLõàÜ†É |5yÎÈaêËA•Çh‡u~Ší:h|I2ûíÀôÛék¿³mø ]þgŸÌû8ŸIÿޱ#Ò•6i±àÜOe†Ó#©èPOª÷R±}¼’ñ/PK Lg08{ACL "org/javacc/jjtree/TokenUtils.class•UÍoUÿm¼¶×ΦٸqŠS§Ý´Ð¸vR‡~7iÒ4¡i 4ýÄl¼k{Sgízס Qq@œ¤^H?–PEBnqê#ÿ7®ü´ÌÛÝ4®»©Š#½y3ó›ßÌ{3/ûÇ“Ÿ0ŒOÃØƒC!ƶ £ÇÂ8ŽL c'™íTcL#„·Øn‚í 8Íädg0ÅvÓÞfî³LÉ„1ƒwØ2+àã9Ï– ÞðC¼/àbs¸$ಀ+A\ â‡ÀIÝЭ1¾ÄþËøÉ²ªqðWªºaq¸œ˜-W é%eEÉåÒKKVUÓÒsåš1êáÈ\e–tI1 é‹q<,,ÏÁÿKÌ‚ºU½dè9*qÊÌ)Íä°/á‘àE‡PQ1íÔï•}ffŽÄy"ÝC¬ª-—W´yÍÉ4¯êüÍZÙbIÇ_Rý«U,j·rE¥J7ž˜dédXQJŽž±¯q]ÄÈŠø‰Ødó"öaA„‚l‹"rP™e€COk–Óµ|^«ŠÐgtEèÄ?L?K¸DIÄ2 ¶”9´ek"*L]ÂÍ (Ò„%¢šˆHƒ¢ÞÄA»§Œ\¹fXZUSe£l Qé2;Œ’#›LµlK®”MÝÒˆÌW8œ”ËyÙ´k“‡d·‘²s¿òrʹ䢲¢É‡eƧêÝ2e%Ï(uë@‹¸…O8ôfJ%­ ”6"MífM3rš<åо™ã‡ø]ºdé%j£´ye—´tÇD³¢åt¥äª±-'€^¾¬èE¼:ßí5Þ¢^s̤¡Ý²ž+ÕqÒÄйvŒçBƒØ(iFÁ*ÚO;Ã+ìS–£O’®T*š¡r|¥—äL£kÓ“¡Y(h4Ë‚UÞ¨®'‘ÉxN~wÂûyšµEÓÝIO`ëÄMÝ|ºÔ§‚fÍ*¦åöi'¥ÛºSžÖ«Mh¢ŸeÞÕDTQª¦VMÏ699U­–«Ô‰vÛ:¯1•ÀG_¼šL¯ªŸ¾ ì' ½|pxƒ´.’ôöàO>÷£  ÇîºUH^Mþ„¶>Æ?ÆpŒ§ýctØr„¯?ý‡™c)¦ûÖÁ7àgÛsýMq¾ÿàctÆüƒ ï 04âOÅüp3cÂÍØ žr’-™â¸uú×ä"îÃOÀ7¿ t-Ù@øÚg}c}l{·“} ˆ§â’|¡¸tû;,Ä¥Ð*®Ç¥ð*æâRÇ*ÎÇ%qgYü#tD¶5З¤uH´i k„Om¸"d‰Ñ±‰:¨Ú¢íŠÖ+u„Rñº¯|áãêO?O‘ù¡[o ƒn½»è<ìŠ#T`”î…DÏ÷ðûÖø5;„¶íø$ùmdÇ9~¬üz¿í«;””]…ìVFwÙi);e=gð'­¶ñ(å¥Å»èkBKB3´N«j|I£nhÈ·ž«æ ª-€ŽfÀ^ìiìi´` 0Ðxò²-€l3àw ßÃg$Ž=À ÓÔ£g×äú™{š¹Ç£I(Fý ­ ^:ôý¶×ÁnoÅ6• |íÖP2NÁµ»¨7wf¯ÝÁ2“±¦4Ž9b–жwÁÃ}äåîžVwýß_“ÓÜËŠ£!îŽì¤ÅÅ#}Î0¯c×àÃg¸Ý/âä&Ü 3ãaö½vgü¸;ヽìŽÚ{¥àç×z¥ [›v5ÅÖò¶æ[sYèƒï²œpY†l–m6‹@{Õ!겉ˆ`B• ŒÎ–6 þPK Kg08W™E&ˆxorg/javacc/parser/Action.classu‘]OÓ`ÇÏ6©Œg8džèxõÛ²¥Üš!^,!pAR·²¡mºŽ> ŸAÝ$~?”ñ´zy’çüÏûùŸóë÷ÕO`•FMÕ V$Guœ ¦S˳ fxžÚ^©3›¢¹Í,,*Jn'ñÃà ¿xA_QÙ8rO]gøÇÎŽ×I¸¥{ï~òA‘7­Ea=ìz"ºƒ“Ha›í9Û^Ò²þêÇnÐs¶“ØzkƒÃC/nižPV”ÿo¡)1©©0e°¤yÉ+ÍkÞ,kÞbj,ì­(f¸ç¤ù޹qß‹Eý®ëÓYäýÌ[º5£Pq»]Eͼ1ëÖç#§eí ·¾îe|ÛŠéûéÈ^Ü(ò)S7×$-UziÚٶî6S4îá¡b,Éiµœ\É“¥ Ê ’µÊÿT´Yò‚ lPö5¹½ù¾A–%;þùN" "›v½1âÑfþd,Ç®ýÂã‚Z³¼8äqªç‡Œ)î6¿feøPK Lg08вçÁÜ %org/javacc/parser/BNFProduction.classeAKÃ@…¿IjbÓXc½ ¢'í%Þ ž¤ôTЋ,› ©i¶l7þ/RPðø£ÄM/‚ÎaæÍÌãñÞ×÷û'pÆ~BÄ0f7!`Øg‹,f/f$ŒŠR×Ê*W™æÁ™ç²Yùãí\½¨¼uUÏJíŒ=óv±œ*§ŸÊB{!º¨šÊ] áÉéLè]›¢L Ù_”˜máÐØÇ¼ûi/•]•6¿šÜL­)ZÝYŽÿ3&Æ.TýKâÈ'ˆ|²éd=ú$›)ßwüv@èdã52þ ¸[¾Ñ{eS?PK Lg08ÿˉÐÝ&org/javacc/parser/CharacterRange.class}RÛnÓ@=›«ÜÒ¦i¡8”Å\꘶æ‚xÀ*RP%$"ñ„¶ö&qå®ÃÚéñ<4E ñ|b6.ÄZ;—33»gÖóýÇ—o#ha ;MÜj¡‚ ŽÑ]#n[صpǘ¼…»pW°Š{FÜoâAji¢$04¢,)ƒÉQAXÈP×ÉxBvãY¢’â9CÕë )#Ìbªª{aØÚØÂ6Ãö©8A*Ô8x[èD_ÌF#©6ê\¤IÌ5Å$Ê]{ðŒèÑ.?à.ñ{È_&:/x4ZD…Ô<Ÿd³˜ŸHžÊ<çÅD(ži.?ÌDÊ‹ŒÉse*æ™’£å;¸æw/`_ùPK Kg08¡öV]uœorg/javacc/parser/Choice.class}S]SÓ@=[Ò†¶A±òU‹ZT ­AÄ/ЍTT´‚380ú¢!]J°$4uø+þ_ÑvÐÇg€?G½¢VJ}9{öî9»7÷Þ|ûñé €I<‹!´Œ‘BHG1€ Q\Ä%ÁFl¤€ïJ’âP™%eˆÖô¥6±‡ð>"b•÷Ñý×y6pNNõg4pÆÈ©íAšh þûšëà†W”u„Ö-•mBYÊjè á¹]ÁO„°&Ü œœ‘’ÒzŽ vŠá+3áÜGœn /NI¯³ ( ô¯½ÿù=·ë?†_PK Lg08±Ô2p’´!org/javacc/parser/Container.class;õo×>.fNv.vnF¶ÜÔܤÔ"F!Ÿ¬Ä²DýœÄ¼t}ÿ¤¬Ôäk ¬Mf^f‰#³†f#‹s~J*;#ƒt~Qº>HKr²~AbQqj‘¾s~^IbfÈ4tØ€ö200! +”4 Hry‚`>«ÖvÆ `PK Kg08ßr˜$¥!org/javacc/parser/Expansion.classSÝRÓPþ-4 Q *EQ,±PQÄD¨ò§U1¶Ó&4uÀ+/|o¼ñB)ŒÎø¾/ î¦EÇÌdÏžýùÎîùö|ýþé €³XTqý ¢hÅUƒ,®±¸Îâ‹›,†"¸¥Båèa^o³Q0ª ¥âî2Ô˜ŠqL(˜dç‹{ î«”žVð@ÁCŽœf¸™E0+ÎY¶)šŒ“+åm}–íI×6s ¶™'§>¶b¾0“9Ó^J¦=ײ—úÔ²Y”=YÇOŸ£ô‚éJÛÛ>ù|Ef< 8nÖ"HF[®z#Ò–®éY޲³r•îhùµßv¿Œq˶ò¥|ÚzI‡„¤Cé5dóiú‡œ,ù*f¹¢’›qeŠâÈã9•ššâ{v’-å S®\´¨ŽX<µ;èfiqQºæP#žªÄ”<+—LK¯ÿ9Ê@&ç—¬¡Ih8v 'qJìC›†ã,:a4ïGõXÃ|q‰v úÛ"x¢aO5,àY¦†çè%Ǽ† èås3Um„}‘“ö3çÝEI„™žÃ˜ª†,¤†.´Ó8îR’Ïd’R”nrxµ`ÚEŸ•ú¿É¥»6 igñÝ÷û›ù*½VôdžLV–fÈòÖF·ù<ß=O̰²$½¡œY,ÒHí Ö7|Ý_&š(JI[ùBNNøƒ&²i†jÉ<å:ézk}{4ñ?mõ{­ôAÏL'ø;¬D¹¿ë$:pÚßÇ}”I÷íg‚5áÇaFh…†‡äYÚu DÐblBzÕBFha#ºjÖj>øØçp>ÈiF•Ÿ£¡_yöΉ¢g·bø«V×ýA¸'ˆ¡ÏPg7Q«keìc¸2öëu]a½žõ-4lëeèe4’¦7‘(ãÀ{<Ìã€wQOa¾/oÀ«M4‡[coPŸÐRÖÌëxûã[â}PW.©ÕÅ©GX‡ö>x¢«’§àÊv»± Ý:nW?¬·l!¶Ž#•ÆñPK Lg08úq[ðzÅ+org/javacc/parser/ExpansionTreeWalker.class•TËRA=MÀaÈDŒDÄ8`Ñø~áñ F#¢âs mˆÆ™ØI,Üú ®²µÊrgiÕ>–.Üø)~+õvš`ªhƒ¤R¹“ÓçÞsoŸîùþëÓg;mà ¶±Iù³ÃÀNÍØÕ†ÝØÄ^ì“?û hÃ8d"ˆ‡M„pÄÀQí23–ñ¸‰œé' ŒšèÂ)c&"Øeà´‰™|ÆD/Î8g¢OÆó&úe¼`"гRiÜÀ„‹ «çÜ\é(C 64ÅÐ<êÍp« xJÌpqÍÉ?b8÷D6ùÐyêd2É‚#Š\$Çæ Ž[ÌyîˆfqRp.s¹HFdáPÁ+–KZØŠ˜”…K¸l!+ ‘¥UFg½\†[˜ÄUS®áº¦qÓÂ-ÜfØÐ / q 3ô,¥\áOÊÜ••ïશHÊ¥ù'6,Þ$v¯ìõ±Q #°O}>6)0N`¿û}lV`'Ñ Võ±E‚5ïzïVdš½"Óì˜fëL³u¦Ù+7ÍÖ™fÿ¿iöŠL³ÿaš­3ÍÖ™fëL³n•òPK Lg08nŠ5%–b$org/javacc/parser/JavaCCErrors.class•ÝrÓVÇÿÇv"ÉQ¾L ¦¦˜ÆIë’––Zƒ )¡Pú•(ʱQjKYú(ÃÇ(ê°°¤ãGOrT»ÜÇ ¼qx¸äUòÊe¿LK`jpžú¶Ö~oy²IÓA7I³Œ”åWy€©ÿÒh.ÓÍ;;ÒÞXŒº¡­àƈKÐPk²ùÊ;’FMÿúhl<'Ñ×—(u_„< ÿk£ÞlʺeWýWŽùv¹SYñ36Nѧœ~œâHrSÉJr_ýµà¯ôKDC È›¦UÐ:Rx±ø‰t/AX¸T(Fk­ð/bp¦ðbÕLj¿@âî3Œ¤FÛPžBmCK%{Œmì6ÆÛ˜øC,;°“ìTˆ`ñ’ØTÀ¦"Ø}!vf}Jl:`Óìþ{`}Hl&`3ìÁûÁ ["6û§‰ÍF°‡Bì‡ýlÐþ³œê\OžºOýÇ!ª“:L)…¿p„ì…6fc.±ñso¨¥5O _j¦KÑZˆ >ÅgbÊÏ”òg'zú=Uä¸fn¯Gý¿Š~âó(¹®Š/¢UT1Ï5ç÷zT¤Š£aýÄ™(ó]_ö¢3¾@¥N‘ÌnÆÙÞ'u°ÃÇ©Õô—‹÷^£bù}ÒðPK Kg08´×àËõ ±%org/javacc/parser/JavaCCGlobals.class½ xåõýÙÝÌìf€ÍÂB‚X‚@² F ‡B¸‚› ‡4lv'ËÀîì:;Ëa[­ŠZzV[P¹¤­Thˆ`ñh+ÖÖVkk­Ö¶¶ZíÝZÛÚËô½™&›M¢|ýü ß¾÷ÿïúßûßñOžûàøI˜ÁTlƒãn8 ð58à¸' ?AàI<O‹ðuøá"|S„gˆtJ€g=0Žø–¶Âs"|»¾Ïø®ßá^$½ï‹ð’?ðÀx2þC’~™ÀHùy¯Ø ¼Jà5?àuLŸøQ~NJoÐöüR€7xË¿‚·Ex‡œýµ¿ñÀoáwDü½ Íió'þ,»´ü‹ïyà¯ð7þNFßá"üS„‰ðoþ#Â"ô‰ DÆ<¬€9DæDãÌåf…L ºa+sÓÊC«"“à”ÈF~šÈ# Œ"à%PŒn3­FÓjŒÈü„Ç’ò8%J Œ'p2LXÐ1ÊÔV6‰@9ÉÎ$0…ÀTÓT¨$"PE šÀt5j ÌØLÍÂhõT*ÑIÊ |áÍ‘­‘ÚDD׶ꚢÆç0ÑR3zDÕ×DYYdg¡J§’M)¥)ñ%övÔæÍº&ËKeUÖ"ºcÀÖ1p[Gdì3²º’¨]#Gõ”†gÑl»j‡+=Õ®¨YÓ•”ÚžN)ªÞ>sXFPŠœN-•Š7²CíLk©X6Jt<ßÛ¿k×# <ÓŸãÒ²Hf“AF¯¤„¼#×åöÖY¹ÛÆY­ªžÚ"«íɸÖ“£ 4íÖäíi-¡dtƒÛʪ¸a¨í£øbí9c<&¥Åd ɹL4MÛL{ª³ŸB¦PFg”d:!çt'#™-Š“·c–6ože-‰Œù#'#Q}IJ[œêd0>œÒâµ|4Z›Žhx{µ Œ«™CNÈÛõVŠ×wEŠŠ‡8£ÑT‚Aá\EUôù •kÚŠ!ÓÓQ1ùaCrZÅàŠL!í¢¸¬7ÆLƒsOOo¨r­«ÈÉfsqºŠ#”Œ]¶ wœ¶ïXÞ¾dd‹¼Š—¸YÓ ¦¡^9TíKùªþþÕdt¡%«§³ú"-sKJª–͸.7¢mIcu©2ž¢H,Ö.g¢‘4™ýwª£ÚjU‰b2[Ê£ÒÈD'±ÒZe=›f¨¢t ý‘ý -j/sæðòvp+Hg­¦è²fñôÁ MXŽÄÐ͆T2)«:zæ7e´ˆ’@Ÿþ!þ u¡&7b1c§Ì¥"Dz–à^¸O`³%v6«c06_ia¶³S¦1½ù¥"± Ø öÃýX«v¥î¨ØB‰5°E[Ì–Xš9®¢Õ©øÃc—²Ex•TmAcÄq0)5^C£ÛV[¬iTÂ%ÁE© šÒƒrLуú&%¤P”àaxH‚ KbËØ çÛr‰]ÈšhÛŒ]‘[´aâd ï”Í•X [A«•|‰,\÷á8Ë9}{TNÓbP–k£9…ƒ+«Ærø£-~c‹MX«ÄV±ÕèÙDÁ˜¢7¸#XNiÀÒª,ÆR¾Üv5Áj;¼,ŒSîרØZ‰]L^·‘É) 8ÝPÉlRC6•H}PÂG5Ö“+g0)¨˜gE‚[# %6H§FbH¸–›ßF]€ÉÉ=`ˆsÊv‰Ä.%MÁxt;ÛÈ `C€J “€F œÀ4phÏÀ‹`e²0ѲtC‹J,Æd‰uÂ-ìFÀâ´ºnØ&Œ RˆºvHl ­Ä? ÝK¢"< ÇPÌC¤c|ÅàS®€+%ø4\%ÁÕ´½†V; \Kà:¸ÊÊêÀçX‚ëá3Ü@àF7‘øÍ>KßJ´Ûh{;­î p'Ï÷.w÷óð vޤ‰ƒµrCÃÒDªÃx*s©¥c3Þ:Î Sd`“íÈèrŸAÌý1aÍ3ì@9’¤ I§e?ˆªOk›ãeŽñyfuñè!,ã«lŒ@Î^  ^t N€£í8}®( ᯄ«|îðì†@ŽDr«l dø¤aY߸õ‰hÛxô ‰Š£šªÑ®·ºªŠÛÂ÷sáÝ(êD|‹Ï×ì˜=£1‰±âÇN'¿Á˜xü¸ñ5}hÞYÀºú^VlCNI1<{F“Ë¥èò *g<‘£ê Pp½Pf*Y~„/r?gr?§ Ð„&Çü²ê˜xÆ…ªQ%ˆwµ \ÎC;èÒÛŽC†º‡¾\¸úë¨,"~‘ßI8äõôÀ¤y‚} ;Þ™òŽÀýü2¾Ÿ(;B  œeuN¿)ûÀªwurø=P^ï*uyëQ5\U‡K­­scLÄtð½¡è¨+tÔ ~¡s^r*‘7Õ9=³­®°`/”V•ºü‚ï¡óæ/tn¬ºú^²åG|<¹UÖM=`…ÊàÂÐz‹<î ³&GóLiÃRœÚT]åwVô;c=0­m>æó;Ë6¶Õ!q_ß[]à8þ¶*ŒðTôBe½«úðªC]àª/,u6(›”•táz—ß¹&ç)æ* ¥…‡q?ÉÜ'5½˜+á.Ÿà©9 EÐMØ$U¸Z «¡ÖC;tð}¦ãŒ¸û¾ {÷nìG“Ni^ k Ç©Bø Þ˃È߃­·‡ßÔ—á+¼(îÄF¡.½û£f7̵­Ölž™f5öÂ,ÜžµÆ[³¹„Á<û.ëvÃD‹{Ž¥®¥oˆœ—#Ro‰œÓ/buòƒpˆ;Xb¸‡C¦æìÂ&™{Øç¶þUxˆ'<ƒµíB÷¹ÃØ!*¶>„}1o^À+î³Ý¦áá›oîb³^wó|›éx=yÌ ,&¼ðJyÌ6óµ€wDs¡Í<ð–ç1læþ€wZs‘ÍÜðnÈc.¶™ñ€7¸Üïa™uÇKðz{a©)WïÌU^† ÔYŠ­\"Ä dô786GGS#Qi¸|p¿Ýq[ ÀÇH\™“ÈX øÿ8ÖwwL‚Ãp„;V˜Þ™`(\õ,Š…»úÞC|a7µ©špMüÀk>€ã–Þ{B8„² Äx’Zœ(Ž4çFÔîê{ó(4#»éŒ©ò­è•¸'VsWß;H¿È»n/LZ´íƒâ*\µ3~eºB;\"ZÕmœ²ÚP%²É*¡1EWèÙKWˆU5Ê:Ú™ãõ#¶×søËW‹úË›p¾L®6Ã&Ô„a#Éx× a-Þ ÑÆ2ô¨mènˆœ[~ œGLƒaŒ‚ß ù•í¿yeCùÜcUÆsTŒ:kùQk{áâµýI9ÆEßäIyëÌÎËÔÜÚiãu20K/ÛY*Ï^Á…ûsöê œMÌQ°³ÇK±4Çÿs>í~ÄŽ8Âó°#¶r:{p&åxRÝ ë¸'î*~\–wŠïaRÿgšµ0Ý®…ÉC¥iÈè{lw&ð¯HŸY…8üyqX3¨×þâ|Þ("€§X7¬ÇßG7\‚øRüµó—µ6Ú«ˆ½ê°WÑÃ•Ü ö*n¯6¡%Å–ÝŒö·Ø¼„MOÚ4Õ^¥ìUµ.ßfËgpÆ_3Z×ñ—5Ë^„ÇìÐöóÐîúxÂèáãpßtþ PK Lg08¼Ž¹¬&org/javacc/parser/JavaCCParser$1.class;õo×>.vVvFÎàʼ’ŒÔ’ÌdvNF…ü¢tý¬Ä²Äädý‚Ä¢âÔ"}/ ÏÙ9ÌQ1dd``dàñÌËK-rÎI,.N-fdiÐÏIÌK×÷OÊJM.adÃoƒÐ&`b`Óì@Ìgd`²8PK Lg08Ï¿&›äl,org/javacc/parser/JavaCCParser$JJCalls.classP±JA}“ä²ñ0ÊóÇ\]WGÓ[.LYè êÇyàæÄ¹•Z5›nµ6_ëþ=êTr­ì\Þyï<áüÐ@„³ÿ[Ø•˜ý¨"âÅóòÇ£WvÉø Ñ+ö‘ ÉM¿tôCÓžÎv™rî3Ù@›w Öo£‹ÓoPK Lg08XTÐW×0org/javacc/parser/JavaCCParser$ModifierSet.class}”ËnÓ@†Ï8§¹á”[“@ P —P`‰PS“ˆ©‚Å&Ý9δLeìÊžF‚EUñ<6¬Xð<âLšV[Ø’Gßø›ÿx.ò¯ß?~Àcx–‡·ªK«T×´˜¶‘¤åbÚ$­Óîžkµ¥V®Wà$æÝKò4ˆyͤ²[1­•Gâqí$Où×ËÁ}x°ôVñHJ/[«+ŸŽÏr6ñ™ÇVGø3«þPK Lg08°PF‹Ögòn$org/javacc/parser/JavaCCParser.classì}xÇÖöH+i×F€lÓL ¦„"›fƒéÅÔ˜bzJâ[€ÁØD¶)é…ôÒœJªRHÇ@BBzroʽ¹-É-éý¦·›ÿóÎÌîÎJ³²”pŸïÿÿç{`Ï”=3çÌ™3ïÌÎìÊÏþòà~BÈð¬NÙÚþ²´ñþÛòÈà ûAÉ¢äQÇ|ä '‘÷bO#ö ÈïPÕï ÿ³Ùd±ÿ9Ü{>Ûÿ‚ÿºÿÙ¤‹ÿEäüI÷ÿ9›äûÿ‚;EÎßtÿKÙ¤—ÿe$^ù;È?@þ ò/Ýÿj6éï1‹’×tÿëÙd O¼o"öbo#öм‹Ø{ˆ½Ø "ùoPÁÇÈûÉOû ±ÏuÿÙdœÿEÝÿe6™!ãü¯¼òÈ;héWˆ½òȇ _£†oû „²LðÿG÷‹ìï²üßûÐý?f“ ÔZZ+Pa…ÿÝÿ“áÿÑ_ÀÛJµ M¼¸ñ µV@3¾ì€? 9ݸ…ÛP> Ò$¨Úg“(mF C6Yà è¨BYdM '‹¬ äf‘h ÏtB¢³è‚z»âv7#°;HHê‰Ò½²È1ƒ²Èœ@o=PM}ô@ßlr„ôË&' UÇ¡AÇQ Ñä[ ï@íþ48dÈ@T7ˆ10Ø„) 9E¨{bCÁ•‡Ø0=0<›\Dõ§òFPabÜë 2„¶B¢E^yÇ!v\`ˆ(1#!e”(Õ£³Éõ1¨t¬vbkk+bã@ƃL Þ˜ˆØ$=09›ÜŽÖÜŽêoGõ·¦€”a*bÓ`¶)HNGl†˜™MZcôÀ¬l²á!Ùä@98fZá=0WÌË& òG…(YA Ĭcn˜ŸMöʳh“ß¡¢/â6YEž¤f“çQüy0<Ï -¢µ!ùO.ÖK²É_KõÀ¡Ùä%„‡e“WPê°½‚j_ ®–e“W‘ý*²_Eö«å +@V‚P®#²É»àz\ï‚ëÝÀ‘T‰ØQˆ±ö­ÒUÙäS°~ ÖOÁúi $ªVg“¯qïkÜû÷¾¬A¹µ 5 ë@ÖƒÔ‚l©©Ùr4H ¤}ÛˆXÈ&Í [@¶c(äŽ5Ç!}<È '‚œr2È) §‚l3§!<ä 3AÎ9äsAÎ9ä A.¹d;È% —‚\r9È Í W‚\r5È5 ׂ\²äz@n¹ äf[@â ·‚Ür;È ;Aî¹ än{@î¹ä~] - »Aö€ìyÓAÓAÓAÓAÓAàGA000žÁtxäßüäYLçA^@ßýÎ?êŠÊö¬â õg¿€`jü ä%LLLLL¼ òÈë o€¼ òÈÛ ll¼ ‚i!ð>È ˜˜| ‚i!ð)CÖÏA¾0_¯ŒÀ×zà›,Ï{à;ïA~ùä'ŸA€ç`N@€çºDñø©-ôˆL׳@²u`®AÚƒtéÉÉXê˜ÌõÎ ]@º‚tÉéÒp®÷9¤7HH¾ ý@úƒ 2°­ pëE )}(È0á #@ŠAJ@F‚Œ) @ÖÇ‚‹u`±>X¬O™ ¨Õ¿úTi ÓAf€Ì™rPWŸ 2d.È< ù @‚,Y ²d)È¡ ‡² d9È • G€õJ  ÔWTTƒDAVƒët`¬Óu:°NÖéÀ:X§ët`¬Óuz°NÖéÀ:X§ëô­ Ç€ ¼Ów:ðNÞéÀ;x§ïtྠˆ§ñt žÄÓx:Oâé@<ˆ§ñt žÄÓx:Oâé@<ˆ§ñt žÄÓx:Oâé@<ˆ§ñt žÄÓx:Oâé@<ˆ§ñt žÄÓx:Oâé@<ˆ§ñt žÄÓx:Oâé@<ˆ§ñt žÄÓx:Oâé@<ˆ§ñt žÄÓx:Oâé@<ˆ§ñt žÄÓx:Oâé@<ý?€üX§ÿ €§ðtžÀÓx:Oàé<€§ðtžÀÓx:Oàé<€§ðtžÀÓß°¼ÀÓx:Oàé<€§ðtžÀÓ¿ùä+,oõo@þôÓ~:ÐOúé@?è§ýt Ÿô3€~ÐÏú@?ègøA :ÐÏúXÌÀ?øgÿ àŸü3€ðÏþÀ?øgÿ àŸü3€ðÏþÀ?øgÿ àŸü3€ðÏþÀ?øgÿ àŸü3€ðÏþÀ?øgÿ àŸü3€ðÏþÀ?øgÿ àŸü3€ðÏþÀ?øgÿ àŸü3€ðÏþÀ?øgÿ àŸü3€ðÏþÀ?øgÿ àŸü3€ðÏþÀ?øgÿŒCµDC3è3¢v+ÈN:þ¢}ò9È­”P—2ÓÞœr²O{,$DÉ['õ7´·HMžä3(!”к´·½9¨yÀÜ~ÊE>íí)×û´Ïžºw§Fy‰¤…©HJ|¨ªýŒ‹nÒÚ?uÑNí³)÷ú4Ï£§!ípÍç1ˆvX ˜HS;—çUWhCs]LÉÏ­ZÄ:äjgân ‡–šóÀW4¯ö5Ô· úÑZ:y(™‚XGò¨F¯ö!!ÐÛš‡ RâŽÍÕ~¢EËA0/t^8’> G çHJ£²=WÄVé†ÐE0MTƒDAVëеHÔèÆ:Ý óB©Q«tVcÔ!¿^7èœ0‹¤l¥d2104 ÖÒ„ä¦,m ±d f³ƒq,*:äxÚ''µ3N6N9U×NDÎ6L Æé4 Hžþ3ézÚ8 Ubn007˜ Ì æãݸP7.Ò‹uc;µš‡Ëëꢱiµ‘††hƒ‡è³gO‹ÔÖÒXhn}ýúÈÚh¤zqSUU´¡A7.ñvóê«kV×Dc‹£’³1kˆÆ*«P¼².²!ê!¹s×E6E†ÕFêÖ [Ü«©[3ÞCÚoŒÕ£šª¬jòÏrš'JEi6Í+÷¬šº¹õU‘Ú¹ebÔÔ•U5ÖÔ×Q©ëš6l\i¬Z­¦*7Ö¯ÖU6Ô7Ū¨À¢¹õ±5à ´ªjWhØlšš6mK,÷¼H]dM4FUé¸n]eMÝÆ¦ÆÊ†ÆX4²ÁCúºU°6[Ìxh1?ê!ù f&<´ê:j– ×{H64TEê6Ö7ðmq#KøY‚¶¥–Z™6¿ †¦mFè4•¬Äcá!Þ圃¦*‡ÛÑv´ØŽ–ØÑ‘Ô°4Z\k¬£²¯hÃbý…ŒçåbQ´ë¼¦JèNëÑV5‰G e£[6Fë¨gD™—1oij¬©6·¦¡q<:ÛbÙJ’¦¨ªyQØuDW-ZWÍÌÙ¥®¾qI¤¦vþê[6Fê¨×,­«¡]¡ L]Í7­¾šzJëÊ»ŸÝ;”vËŒ-UÑð3ZOÁQoeðXå*ªóÒlêÉÕMÂ/ó;­»RÎí°ªnµ3£Œ5ß:2pÂtõ± ‘ÚV¹ñЮk,º¦©6ƒEbŽJóø(ØÀ»²:Z…> R~ÆÊm6@%ˆ¹k‚«\ÃÆ(í✨iÆÊªµõ5UèªU]Óêë#5AX-YV1:Îj1+kMðÞƒ+j°œ„v}[lë¾\¹ùÀÔÜ·ª~ÃÆÚè–Êä›¶¶ÝÝ™¨&)jà‚;TÑÁ©j¤–­¥né!ìŒj:b5ëiOf×TSGÝÚ‰6P~0(Ê%¾JC˜(ÒqU®¦6Òh9qî‚HÕzÚËÓiS%xÿç”oØXktäe™.ÖÀ¼›ÂEÇ%[7:Ëõ`X??V^GÛ²:Rå¼ÛeP¹4"VÑV²®m7cK#m s™5|ƒ–#³C9̸¶LäwœQ×´ÁQ¡oP98 ܘZ_MGtQê7 €ehHƒNLñöŽ Ú(¤§Ö7ÁŸ;%*Ï«ì2h¹ZëÞ*~‡~¡™5ÑÚjGVî¡‘XMdU­ett§äÌrªPž™]N{ª&R[s T•Åb‘­Ž¬œyÑÆµõNA!gÄ„frìÑyºmX©˜UcM`qêEQ±¶¦ª¦Qb(¯ÛD¨˜_ªú`pÚ‹¢«£±h]U”§“l/Ø”ÅÖ417 Ý+§i÷VS[]‰U³D÷.ˆÕl Ò6‰òÙ‹¢ Mµ<á«`k÷( Ïö¸Í-£‘5u¨yþƨ0YgÚ¨ê4$R+3w•òçÇä;ݤ;euÕò­ÎåuUµM T;g‘Ît–På·O(Ÿ;ãè&jÇÆ­rf§ræìUQ6=ÙÙ‹¢|”;õî¸xmÍêFg³««™Å˜G­Vƒn$Þ긴.shÐeAŒzhUŒÕÄÔU’oôH¨£¢¾q5À¼šº&tâ4:ϵ¡=gA}Cãêš-r À#gä çë0/ºaV“µÌ±…{P&ª­ÏN/nZÍÒúÜê~‘Z€uD:õÙSëëk£‘:+£=‡`+Ý®¢©¶ÖJeÉNkƹÓu*«­ƒÃÑ6¬§×lh ½Ž!ƒUÈâÆHc”ûzGêžÑX£”šYE›V-eù§Òª×C[„Ònlå›3ÜJ36llÜ*ñæYq§çl®¡kd‰¯ÏaZ`˜¯–îu8lmMmTfž^/¥‚^¤¤>Ù¨«B67[åYº±šÞEóèÂYn^– Ô{d‰E›bu²RKÖÆê7Ko­«¢yu›d3—ÄdƒtX´´bqù¬ŠÓR>s ½¿È‘Ì.«£KDwùRË‘5/[ÉY]Sß©ruò²¬C#µMtžªFwLȃ’CG“”JžòíÚ“¦ë\ç=>ßõvfòÊłӣ«# „ü[þàÓñr3]lFJÌÈH32ÊŒ”š‘ÑfdŒËWç´ÞáVl„+¶b%Vl¤eÅJ­Øh+6ÆŠY2Š-Å–ŒbKF±%£Ø’QlÉ(¶d[2Š-Å–ŒKF‰%£Ä’QbÉ(±d”X2J,%–ŒKF‰%c¤%c¤%c¤%c¤%c¤%c¤%c¤%c¤%cäþ$T²ˆš¨Xаâ#Æ–HùÃ¥ü±v|´Ð°„éeæŽ)µKš=UÂÚer”–Hõ‰ÇO=ÆŽŽ¶j–dnTb>¾‚³ÔŽŽ²£#%}$fIð˜áv¶¤ƒÄ,I.±³KÇÚQ[á±c¬†Ž¶ï6õ•?R2àp©ÚR“w´}„-@²êˆáR|¬l)Œ­æIbé(;>j¤-]ªe”TK±T´XjD±Õ?%v²b%¶]ìÛR—ÈZ"‰œ¤x„$®ÄW,åJŠ–HínÇKJì^–=WRËî‚Q6CÉ©Ž#¥¸$¬$sL±Uáp‰[ò·bÙ¬¶§Ži,¶FS±åLÅ£¥Ê¤Š‡Kª#ÅmU‹GÚê-•x¬~’U*+•”ºªTê¹Á¥V—Ër$ù‚Œ%9u©„c%ô#Å%7-–º¥¸Tª”Ä?JÒrÔ©%£¥¸ÔZ ¯ŠK$=%[KNZ,óK®Q,»ãX™G²àh©íc$§-»¬*²‘¥jFɾdÆ?Ç Ë¥‹íq-éT"!ýˆáH4+Ú5ÆòÀ‘¶/–˜Œ²Á,¿—L=¢ÄRJRTº?JjãXãäyA† OJåñ/7H6¸%]8i‚^b5Iî>Û$²Ÿ•g«àÉ'GI~"ARñHi•A”·ÌW,Ab±¤¬äÍ#J‡[òíþ±ç?Ù¹FÙ öp—ª’†x±<+J!5`ÄHÉRÅRþYm)>Bš~ä M®ÆB¾¶é¥ÉZZŒµ /5×δk’`Û¡¦„£r§ËÕÉÃZÊÒ0--ÛÌ#Éä¥òð“ã4ÅK¦*cw¶äH£‹¥†H“@±¬\£”/Mà%Ò¬[*ùA±´Ä/–×¼€ ~æ7¢²¦®¦GžŽôˆ„tqB:±<G›ä!ÝĦzMý°rœŠs^쫇շ’OvÀXå»byv©EÑHµ8¦:3s=œF‰Õ¸ª¾®¡iC´R9÷Tžê¼mÄ­É\m¬ˆni\“MŠh.åŒTWWFc±ú˜ÉîTÎNhº¬‰ÖaK=ʳE=¤¿ò´ÊÉÅÎîê°oYÙ‹T±“ÒŽÕ5 9ëÌÃdS8<µ!² [þªjYßýwûwKµÚ q™viP»œÿ4O»[»'h\n\Ôj´uAm¶6¨ÝOïÍÆ•A­Ì›i1Jöµ´ƒÚñ¨å*m-•$ŽtƒÆÕÆ5Aí íRݸ6h\§]ê!m5/è¿•¯íñÛÄ4î>4v×µ´‹,bK,µi´+QÕµ ×\ ú»xI}uÔ>¨ 7hMð„Ó  q£qSиm½$r+,qµvMиÞÕþ¥½4n§3î@ò4©½Š¼ÆAã.šçó!y·Ö4îÑ®ñÞÉ:M­˜¹@:‚î‘â<8¨ÕÓ>2î…°5ªÞ}ÆýÊÖ}ÐØe´èÆî ±֧̓kÓÒ˜¤ý<}ÆÌ²¥s—½ÆAßßÀ ñ õcŸA;`‡v}Ðx}T¿ˆýØG¿5 «¢´–ŒøÆhuA¤¡ fuAMcÁæh,Z)X2ÎŒŠ‚†šºªh÷§‚¥‹g,ªdù•óÊ*ÊfÍXT°6‚z¢u ÑÆ‚ÆzZ[St¨nìÇ´u²¼|M]=4.è[>«bþ¢•ÓÊÏè[€ã÷šÕ5üìá×I j7 •S¢=¥=4ž0ž¤€—lNóíš^É·¨q°¹¿˜jÔnÓnò~J&XÐ>OTÞ3Æï‚Æï Z¨Æje„É*¨©+ˆ%Ûý@4ÚxfÈÛÔP¡ýUWßX°1ÛPÓˆ¾¤•mŒÕl¢ýZ0¨ß`… ´’çÐAÏÃý*æF·Pj pÈPPµ–:YTUoduc4–FÕ/ÄèzcâfŒ‰?aÜþCÑ=ÓØ« 9Œ¿xH÷äû‹£G7átV9ª¬³¹ ñWxÿß //W·hñ ¶A«õãæ×Õn¥¦Ü©k¬©*°^×pvJCÁæšÆµ´÷ê×ÒÖºrфɫ†ÎÑê¡‹·R8¨rVLyjà”!hü¶¸¶øðê"íâ öºö"ôþ6£®zþê™5µÌ(ÿù—‡¬žQWUß„3iÚsçÏŸSvÈŒ²éƒ†:¸ ÒHm]}ÝþZHy¨G5sköæšÚZê^R3 h‹£C=dί´dmMƒU«Õp­îZÊÝÕ4®‹Y“J+{|y4V??6¿ŽçÕ ñšñzЦðçD‰ö5æÉ7¨ûùû*Ç|E}Ýxu]„ºÊ›ðÌ·Ð9?cVxÇ;Æ»Aã=LA ñTðüØ<ªž²ë¸rü¶b¶]ä8¨EÞú ¡öíÀ…¸E³›ù˪»æØPÍ}E¨êT•¯`MÛIÝP»\*ç³õ>T£¦ÜLUvÿ6žö¾ žEÑÑFörÂ"@NÐøC÷cOà3*óM3ßMÂ9lÐøCü. ªÏП_€|©,kÒ¾2¾ß_+'`~"j ÿ÷·t,ú†ÀÄ»° iÙ wûŽÞÐvSøñ …vÇ´ƒÚ~º^òõ¥D[Qÿ8nìÃéaJŒï‚ÚËX ++`/‰Ð%#P7ÊÞA*Ø@ \ÐH™‚zT@ãC×\á!CË0Óˆ·T̲5æ«J¢€ÅÐÔ…Qâ†f<Už@Þ“È+FÞ_¡ÏÁªŠ×ÒõkA}žÛô G‰?£ìÄ~‡–¾ò7Tú{gAžy|%àû’¯ü y#‘÷Äü ¥°á(Ѹñøþ‰c7dn¼‚¼ñHN@òïàûȽÚ}AßDä½ –Iˆ½o¼ òÈ» ï¼òȇ ÿùe'£ú) ùH–!Ö w?ùäSÏ@>ËTHû É/‘œ†Ó‘÷’3ûb3û|­HÎß! å ³q÷Üý ¤ÓéÆOt±j¯+špÎ^Žj”c:Ú3ðü4~6~ j¿@ÊÔM«@l.È<ù nxAt$ ¤H¤=H\7´Éi~ÕÐàÞ¥¦çŒhÓþýŸÚùø=Ùöƒ†‡dEª««šøgwæW‰:>u‰àtŠë·@г ueþš Ô<$Å[î Rç¯Z­j÷KÙóÍOª²êØÛ·¬¹ ÑFvÈ‚]ùÂsç(*M™“¬³© ¾ïZ]k0O@Ú±årƒø¦'7ùà ªÞªèššº¹5uø¡–íXÖ´úÚ¦ ø¯JDrù¢¼²qëFqVƒÏnj×Â.ͯ2˜(ën6í±µæ«Í*ãáSöE™õ™¾yê·§ÅåoÀr«íw~­ ìu`ç—˜¢z:zíò8 ’>Ø*Sù‡cǼ‚ÁÚ¾gª+64?kƒÛšŸÃ¡uÑ-ì5nªxÞ Õ×S¾îëQn¶2f¸òÁª¶å­‰6.M@®ß=â›×Í‘X;<˜Úó¤‘Í÷â¦E¢¼WÅ÷sÔÀ8aS~›7´­˜ø…/F«ôƒÅ’öÞá¹qüÝBMÔ/ïþàOU× ŠmìJ.¸+È 1niͬ¯¨—Ó‚tŠQ)3ëö×5PÔºTÁÑ*ØÙú8/DÂP~Sèt)gJ_š"° ‹/g#•’÷öJY:¬ÁüŠêÖÄ?ÞÐëcÕØïÄ«kß@‰±)º.Õ'™—Mhü†Èúè’ØVñÍȵUe›™úf’ïýºæ±uÌû²(.>Õ1">­±¼Ì'>Ç@©©ÄVZ£gª…ÉÎÎ>)Œ !iŒ¬¤‰¬–£Äy¢¶ØXÏvF9¤æPnç:Bݕ㟈²¬ò¤™ÑT®œ.+bÑ õ›("5TE6F*#uÕ•G7Õ³ÙcrFÆRÍ4]i×ÎaˬƒÛzo£ÿÖ÷Eé¾+Âß±è&·‹}é„$XMîí_!_ç¤÷LxÕû­?[ìÐa”þþìÌ¿â2Ø) û¯‹ùA3»].òÇãM’¤\:¨ËW°ñïüÚšŸ5:⩎UµÑHŒiŒï;™#•óue±{®XQ®X°–S€!}´#´#‰G«d?U²F[Kð“ 5Ú:®×jY¸A„u"¿ž…<×°4}¾béF­‰…›XèÅ[%,Ü"Ò[Ex Ë÷`Ó¥áñ,?ï Ð0™,š¼ƒér½:ÑËO/äD¨‹Ða–³EØK„½EØW„ƒD8L„¥"#‰"œ$ÂÉ",á<FEˆ.º#Þ:‰jÜQ£$4?N ¥¡]÷2/»Œ¡£‹šõrÓ¬älþS9äÖO»HNnîn’×L6„sȹÜbG°ÀÅ.CX­„Õ†7ˆpª¡V8NBPË'Ôʦ†îo½;:Uï%“5¼ÂêøéÔÔÔØž1LÃq~7MJšŒšLšÌ251[‡còÈаŸG‡¦òXhëgÚ†½ÈÚGº,ÛCº>’ï§šU§0I“Уˆ^Óé5G„ è5˜^ËéUI-Ðmb¾Ÿ»à>’¿¬çÒ}/é'sé­ž“ì[½–õÚCb·FÐ[½ÇùÌ{ù>–Ë” (” ‡"êÞo¶zÿgÑû_¸´å)ÉéoNpú{„Óß#œþáô{„ÓïN¿_8ý~áôû…ÓïN¿_8ý~áôûE¿íN¿_8ý~áôû…Óß#út?µJAœ §AŸ8Lƒ¾qÒ—ý„mt…m’r¥åp¨QhzŒ}¤?e>xn!ó¼å-dÀ<Ú!iÞ 2¸°h ·B„E-dHØ`NQ¸›z…²a»ÉðBàL í7š.ÞMJ\Á…œ*·‡Ê¹®LTExÈn2’Ö0˜†£\ªè$ʯ¢WŽn†nC¬ŠB«˜Šr}ñÖ{ÀD³Kw“Ñ…ÌÃZÈŠ©c“mu•e«¹ÔVÔ9$o ùÔµ–ÒDgj«Ã%‹oóyâ­ï˜}të›öb\ï&Ëh Ë›IÞ^²¢™´g,¨;«’í:k‚*ÆN_Ñ‹tîΆO›Êi´Îª"ZKur-;´ëE-ã‡ÿhxºËˆZ&¦Æ,1õaêŸM/:–Ø*µÂÜò8)‡Ø"´0À’ã¡,ÓŽ4Y±¤ÐÏ’=™ BiÍ]7˜šzò©¦X,µ7qx‰Òpu…gœoYC£ké ŠºTM¾ŸƒÐº²Ëšõtµ\ëÚAÓEÁ[ˆùÂÔw7P´c.ïË­£>ÀªÚEê›I7š³q/9ÚôŠÞµ„)¢þŽç5ÒÁ‚'ßÇp%欽Aª=—Õžï§NÑþÒDý}S¾Ÿ®dƒÝ¨Ý$ºöq>‘ÝÚDO…0mu‹Í™ykžðÖÕ¦·bšØÜ³™DÍ´ ˜MUa!…}ªæÖxëßÄ}ä Läí!ÇVÚ·Ý‹ÕÐZ ¸ÿìä–Ýl¶ÌS \¡Ó>rmÕñóDëh+O á‰´•|A]«RÔ=‰E(ìžœïY§ðÍ;«Ím-ä´|ÑÓó}Ô¥ÏpµÐ,a!wô¢ß~ô:“êJ±„>«™ y§¡Oý¹gK8Ò‰Ï+»È9|§ë•s‘Â2„Û¤ˆÛŠEéMŠ–¾êrÕéüfˆ·>‡ÚO†dåû(ëé…EJ»Ý¢Å…ÝŠ„Ý „æb|žÁl5O¬ùNk¾S1¡œnÚ•¢µ¯Ô^FÛä;ª…œåbÞÂ.xÈÁr§µªVê7[Ý™µº³ÿJÒ]<“±çäöbæð•úäìVâˆëè,NM4‹ÖEU)6¡ ¢®Þ}î‚Áèìk&ý,´ÞE.ØM.Ohýp8Úã§ñÖQûžUxO’ o5}Ï¿ž>!äѰÒZz*má½ØÏlx6šK£«Ì|ÂçÏxî?ÙÌçü|}¹ˆ ¸˜uÃ1Ëò)ÜngÀãóùl/—•¯çgµKóuªÿeÇù)FX_^Îc´7¯ÈÏ‚«1h-Óœï§]e¾‘˜…ì¬|£…\•ŸE«º:_gNÛ!µÕatRÍä^Ãü7›Æ®¥±BðÏŽû–Yrù˜ ¨ÄcÓâº0ÆPKãëøø@m;Xm~V[;>S“²&Ÿ÷‘ëi£-,¹¬Ú&¤e›ëÙvf$hFÚ{Æu0ãṨ:d:B~¶µ†uÝ ¤«èÃ>ôêd"bˆ‘p¨¼÷’ß‘.¤Mp˜=ÙÙ£òƒùØêp›t4 ’ßž±Y÷ã­Ü´.tÊÖ/¬žÐPKQ]ÇqÌq×•Ï ¡ÂülªLJê°—Ü÷^Ãîöä³WîM{ÈÍÍž¹,rK3ÃYæP¯Œ³%Õ¸\±;Ÿ3.0„5†zbî-‰à»È­ã(&}ÈÊßÖLfï#·Ó–Üa‚q€.wŒÈ†?–§^¬ .ŠzOôœI¯3xžy‘i+…yÈ1!Ç"ÞÉÒH™ç)àaÅÛ®÷—¸7Ï\!°¡œ ä=Oˆ…ã½ÖŠ0&B÷`—²ë¥²WвU egÚ ÿ×e¦7ì!c`XfcþKÒÍ—ÙÍþò÷‘W¨cýÀÃ7µþÁ"tÜþ3_/4½ÿU˜¯3oüÄ\pÑçRŸë0\NìÍ¥¨<Í<¨<Î<¨làgßq²ŽjciðÈábÇ1N*ÄfcœL‹öŽ#NËØ>(  sQ-G5v†OUj!^ŃÿýÖyP/~ èÉa®µ—|Ït~h&p²Û~€I¤È¡aû¼ø§xë“.Åa¯ágg~ž0,Â!"-±"œ(ÂI"œ,©"œ&™"œ- FDxBSça’Î?Ç[ç ;ü’ì¡»¬MêBq Û›–i¥ Á lX‰g\<+»ä¶XUìU\L…Sæ|0•£ÝTy=œ÷¼$W]I_¢xä3¢YÕJ.zïÖöY)ÆÚmõniöÌrSÝÓMŒ;ôóý¢_oýù'ÑŸ—‰þj/§íb2­uÉڃº›h¶×i“ÂËvyü¾£Z"Ê›V™˜º¬×|Y!ÂËF\l‚çqÏß…=¨Îž—x:)4ãrúïmð&æ©Ê½äRob¾ŠOU¦-]Ó½RÕÝV»þ'/ÖnsOø TNüË,?'©Ç¬µÞU,>cðåb#Ø^¯ñt Oï1}vJþÞO”?‚•×l@6+(c$«ü¸¥rµXžníyr3B¾©ÉÈ—K‘ÏÜPJ–ý„%{Ž=¹ K™“$&;L’yfó¦¹4ïIKÄJ!bAsŒÙ¼Mró¦ÛÍÛ${²Ì§´§ÅîÞ"~Líi"+ÛþpÁ*òŸš¼ÂÓI¡—Óÿlƒ71OUî—zóU|ª2méšî•ªî¶Úõ?y±v›¾3CøN;¬gsâ?·òsHŸ@¬µnr3)ÂÞôà‡Û>qéÇy¤?Þúa²§=c.[´rš‡?m:sf§f [»={4kÃøš£ Ö.~çýÆ9‡!šq9-ç«xóTåäËíž*­ª;]õõ‘»¬ÿ›.ÞnÌ9îûƒd<áû`˜3úþ †µ#ªé)?‡}îÉžÃ>`^<3lž¯{º6c÷ÄÓ-N^`éüfêÛ”·{œ<ä&®`ÿ¬—˜8z‹°¯‰p˜KE8F„e"œ'¨±^\á=âd2St–êùË|Xåh‡¤õÈø;kQ^)å‹i«{Ò«—K+^òæÃ¿æþ\ÌæÏÃ%W”Áuø¸&%„‰q¯*JŸD©ôw«ÓMv:<‰y“\ʧÒ?¾Ù?)失^ëãØãèmîqÌû {©T_°æµ/żö^¦Û’óN"†Ó›}Û~À•?ž¢%ú™Õ-h£±8t‚žxÀÅ 6g¤A>š’9fø…i ÷?X“à1 ®°&A«v×ÂÌEöý…9!.r›JÿGíE±']-ÎÊ7_°`/3»äG!+÷]bUµK¬v ƒï«*„CD8L„¥"#±"œ(ÂI"œ,Â2Ná4ÎálVˆðbu¶‹ötÿLL‹ÃækÖ°èî-áýª±GiþÊúˆTt3é]4ÎWÈ^CÏ÷ OOx²ç‹·þ;Ùö²ºþ0Ñõsøn Vx®v7W[§3GÎ!§ËÃn©¹ázP²¸?[®=ņk(Ó1w(¯>}ÿl{Ü&€‚ÏpXÊÌ‚=\·)¼Ó¤ oJ×´ßp¥ªONOQä¹ñ%–I%+±\&mN×&*©êj«L¦6ý-ý’‘,sx¶à=ã?_á:OýE±ƒj&½Ã¡YÎQp9x¯u÷Ýzòë|·þ\SÂĸŠW•N¥O¢ŒTú»Õé&;žÄ¼i¿ÿÉk jƒ›)jâ+ó…Šé.(– ËÒZ‚üÕš‡Šyh† ž›g½˜ƒsÞ Yž°,èo– f!è<´*Ì÷r ãä$·y¿Û€W¢°ÈÀDß[„}E8H„ÃDX*Â1"Äâa6•QdZfEZ–yÉRøI¡ð^ ±Ú0¿ì\(\(\(\(\(\(\(DˆÕJu®Ý`¦!Íd]G°sšÚL†$.ðþÍÚ¶2­¶½lµm]Ø¢mã­‰V?ŒÏÂÃÁ>––?æ`,ÅÍ­ï€%Þújrõ¯¤:×is=ë8×9"y÷ª$å¹Îß-Ùo Ù/»(g‹n[&ºm™è¶e¢Û–‰n[&ºm™è¶e¢Ûâõà£D÷-ã¾¼Z¼ãëº4‚ þ5‚^³ü¦JøÍam¿j¨*1xº™ a×oÝ›,úu« DGN·Ú8Mƒ&îöŒ•6ö~Mß°^±›ÞÕ¦Å%[êxÝífž>Ðù½^¡×Ýôz€æádzèÓ{½ï —2oþÝíwb«?N.‡Ž3ßCÏcÇRx>™G7†CÇðÅÄcyl%½}.¤Ñ3yt&žÅ£ãáxlÍ<É£'Êc´:­1ú¦b‹e·Û›lœy¤ç˜.õ¹øÝy{—/€¢.ÇoYâ—ñ‡PñãÛØŽ¨#ÒvÄj{¬cl|¼õÑdYo+e¹½iʪ—e­±eÕ Y”²ÞQÊr;÷3em–e­µem²&*e½«”5© Y[dY5¶¬-BÖ$¥¬÷”²&·!k“,k-Ë|Uc²RÖû–¬{…¬›)ïYØwÄ”ƒLLÙš2ׇÍß–pÝ‹.•ï)ÊÓ!µÎ\äÁU«š=¨rñÖªä†| <1,sÑÅÜÃÅÇØ(a£žæPÚà2”>´¤¼'¤üƒ›ê"¥ˆð÷~1[â›­õ"¬á6„¦ùê„ùÎq7ßR©¾"Q_™¨oލ¯T,rãl5½ÍZd¬·l\+Û¸^mã©ñÖ¡É­ÿ·ÕúÓE롼Ó¾=žéÍeݼgþÍìÙæò7rù´†ü!lfœ 9‹'yµ›o=?Y»”®\Þ†+Ç„+7È®|tú®u5pWŽYfnÍS›¹\éÊ[ yN4¼³]tÁ x™}9Nø/û!ÄÇ}Ì5ˆmqoÐT©žþ¢ž¡¢ž1Ö—Ô“š¬&n•›Ø¨nâìxkyr?±¶µ>ÛZ¯«!Þûˆ½]uG×}àº#!LŒ«xUéTú$ÊH¥¿[n²ÓáIÌËÔ~éò_C¯›?ZŸx€ú'¥^.ž>D1îû¹ŽÛ&7§ÆÏ\zæàu·g.ê™gÚ”Ö¢ðSk”wÛÁph#ŸˆH<™ÿ3ÿÑîüŸ[§-‹Ó–|“l&Y-L‚LÝx‡H¼ý,^þA*3ßjÙ|›ÝÌç½€Ýß¶Þ§ªàx??îmtÙ»öΠ “× f€kRB˜WñªÒ©ôI”‘J·:Ýd§Ã“˜w í÷?yá5ƒ¦KnMkp~a=$Ÿ'’OÆ#øÂf¬Å/–8Òl ò­Ö ¯:ÇIÔþx¹8–ŠãEóéæcuhM í[l~ÎvŒ pãØ´:éK ¯ë¤KÙÙ„Úl1\ÊÊɼý:³Ÿ=šÇøÏZçÖŒã]ž"¾²?C(~,ó£%ì5˜$7`óÍ Wo(’¼(OYÜš™NHË®_[ꈙ¦­d)À¡¥‹·~\îE9kKn¸é!Éåþc ¶›Å`kvi,œºhrD8~\8~D8~L8þZáøáøáøáøáøaºs˜gz L÷õt1wŸqò³idySf%¿÷&­åð8}*„¹O´§·e€éU!óüL|Ay»ûºübÈ_+ü¡&BŸý" ˆP¡!Â,boýÖ ;ÖŠÁ]+oN¼ÙÛ1‡…µí,ßZþ²ðåçà(Ë›íÎ7ñ`n¬h¶?Çf¦º6ØãYÉýêlå¹Y¢R4µP¤±ÁÞ“MÌ•»„Ã/™˜Ô…Žï‹DsON«¹ßYͽO4÷…·ˆ>€¯Ö=ZødðÉ2á“s„O.%æ/¯‡pUg‡CKxlJ8´ŒÇè#þr+ÂϰӰ?µÝ‘VKNI«%ß›Ÿ·“aâ·'z©á]žÊ]$g¯ç¨s÷yV-Ûã©z„ÒIÉõDªùA»8é˜MmBá¼0H_Ñhºtœ‘¾áP"ÚNÞ†SmHjÂÖÏgôMqÓÌ-,d ¨NþˆŸ¬ì$@ʇƫégsKÞ{/ß’÷ÞÜÖ»iâ%‹Yä×½d1ë\SÂĸŠW•N¥O¢ŒTú»Õé&;žÄ¼Lí—.ÿ£RÊ£9'ù Ø>@/úý¢8 —2½c­\®Ôia·s­ ã­{’e·Z³û,þI¨g<æÕͤ³X²· v{ÖÄ=ý\Áÿ+¡ fü<»œëŒæÒ[¥¹ìÓ¨§‡S½g‹€“ vÑ0ÉtgÊÑ‚Òk.©ÎÔÍÏP󜟡ÎäòÏöÍ“gº,sØOó¶ ãøËì¢kß]ûW˜wm3& —9 5ìg‡_Gt]3¹Aõ"‡Ë‚$BìW~Þðu-ÔE*“o}ž·ðla ² ¦¯sÒj·ÇÚAüEì ~‰¶¬ç ‰Ú¸÷]·m„bcóò ®–ßxMõœ“PŸ¿X„Ç+d&–Ù&âõ.|r¨Ò¿YQ']4{ã"¾#áÞ]ÿ¦6ôkImÞ›‘pño°çê—´åQ¿Ú'ç9Þ¹?‘fÖa_}·§Þz÷mMmÄNîö“æÝžXœ,¥AÞÙíiŒ“Y4h¢n·gSœŒ¥Áæ8)¦Á,Ow{¶òEÝ1Ö¨87­QáµÐ`ƒ@ƒH8Ô3ÜFé 12j8È&Ÿ3 =/œê‡“|šâ9Ðú;M5¹M.ç³–[{Ärëù³ñË­ÿ};³6§k•Tuý?ü>¶XÕœv¼}¹¹è:òW/º|~k†º™/|¼Íl+à¸föMÃñÖËÚÛÜf*<þš ï%¿ñr«ÏÜ ^"å«d&–™¤È—ëKU—*?U›óÚÒ/U¹¶ÊdjÏßÚ/i˾bw@“?eÉiM$ Ã#b"Yjäþñ7Iúq*1¾. «>Oþ̧«žÏ]&ÃäõÍæJúT/äСä I#iNúÊýÖˬG®Ï­îÄütʨd¤Òß­N7Ùéð$æHû9êÆÉñô_¯»]Ù)¯çCvÊëyËåx­B<×ûuÉ8O§{±Mì4ʘ|nWê2.š?'éý€H§{ÝLø«›mñ=ÐÆ•²Œuð²Ê:x9<áEXëéú"×Çé‹ Üž fYsø‡â)óÕph_ɺœ´ñrxë „ÿnÝ„L^•ôâ×ßNpó4ïT Í&gpMý WªúäôdEž_b™T²ËeÒætm¢²‘ª®¶ÊdjÓßÒ/ɲüìRîg?¯lãûC_¶5Ÿ$Öª×3àÙ3%ÇÎŽ=**P¿¾Œ¿h =Zó²´f;K¯z¡WU8Tœz`ÒE‘‹îæë x)“®P›ìÖïåê“\_ÐRc„Pãàph~›j$WÔÞªh²¨¨$h©ÝVn+¤fµÙ¯6ë§ph¸\žHNlf‘V¬îÕ%ÍÚíúžu:ùUà(÷k/³|b˜W•‘Óªò©d%êŸ*˜ç&×M•NmÙï·Øõ@ôKf²Ô.å5ÿ–#üibW&?•”xMt ãª2rZU>•¬DýS¥óÜäºé Òé@ÙÏ­ÿz]eQ ;ÉÂí+äJ×õÔ<òëÖSóÀ59!LŒ«xUéTú$ÊH¥¿[n²ÓáIÌËÔ~éòÿ7ú'¥<Õæxs:.÷¿o¤S§›ìtxÜNñø‰ý©^WyßNÆÞs¶+µW©ž~S-;;ZÏ·ç‹çÛSØŠð~Œz¼ëÛØÿ#ó³Û<éüÜV·µ@:2RÕŸŽÞÿ?ÏÏLu«S-‡½:­‡½õp´T<•³óÖÔDb:Çzâ½&yº^õãÕ¾KXÍAE~¨œÌ˜k1Ú¿ž:¨­½1f¨ZÖëˆbâ¸6õ©jžJÜÁ¿^Üu©Åu²áVÂ~ Ï{u84ïÖÑr×5“Ž…yžm-Ôœ¾¢úþñWVÿ»²:À+«’Ç /̦^xõÂdÿíl —YÜñAÿ!Nÿ=Ýò_yG%­ê»XÕ£±Hüõ$÷Mš¿LäëjÕ÷´¨ïAþG®åbm¾^…7Öò,È»>lý}>ÇŸ¶ÆO&©o½ÉýLÏüÓ»ø´“ùªå×`DÝà²MÖMp¯pñGÞsȶ¤+K=ê9c—çÌrÊœ­'~ö+>fN “…å[Âæ ae)„šŽ°d!Ý-!1Ñ_«ÙÂé,¾p:GHŸÃÓçÆ‰ÛW@æožCøožgMŽ7¦59ö°4‘¿óg4ûÞ­‹Í?¡ƒ¹"jq¾Õ§7‰Q·RmˆžÒË>šõ²O¢øär½¬rŢ܀jïö\àªÁAÊÕÛ[NêÕÁÍÉ«ƒ •«ƒÞ©Þm2xü‚ärÖtz®Xh«~j,ñw¿38ª> ¿='!LŒ«xUéTú$ÊH¥¿[n²ÓáIÌ“åOOÓFéØû¿Ñ?nð8ªöð—/â/޶䖴¤ÓÌ¿÷KÇŸçâfy„\À§9£g §úuf__ë×™‰;zZàÀÿÔœ5èv{¶'—ïg6ñ§>½9©ÂüÿË?cu ÿÔÔ¬ë¿y1YÐ~«ôfß%ø3VnN×ßtm6a{Rsy›H IÎò7žN ͸œ–óU¼‰yªròåvO•VÕÝVú7]X×ñâ6â½ëµK›É‘ÎSP¾IùE¶¹„ –p—Y8w›ü'Ÿ¹ÃåUôjOøC;€¯·ûûï›6þ޶ùwNO%üWú.%öß;ß‘.á9âÂo»óo.kt¡ø[£å»ÇIoÃíÊMňãÐþŽ´&˜ƒ­ Fú ‹n‹&¯o€o ñ0þš‡\'†{´x.‡ñ‰âòÏ-žæðÏ•WêíÓ&†µ{H’|-ù Ì$ÏLSò>IroIro[rïÌ$ÏJSòC’äIr-¹ 3ɇ¤)ùaIrIr[rŸÌ$—§)y¿$¹¯$¹¯-¹of’g§)ùIr?Ir?[r¿Ì$ÏISò£’äþ’äþ¶äþ™Iž›¦äÇ$ÉK’¶%œ™äyiJ~\’<@’<À–< 3ÉiJ~B’ñ×›I/3þÎÃEüMgû*­öõÙ ¿•%ú¿—•Ø•GY%†ˆ}ä{~×ÉTm1å µÚ‡CÓ’´Zl“…6%XD8´yLÖFä=.åY•­¶*³_üOH½õžS…5ªÞŠÚ½Õ˜¤ôZUÛ*’ØjTl³“ØÖ©ØÆ&±­W4nç}‡¥>h&k¥UªVUṳ̀Ê7(»ôC'Sª®Iuի؆$±mT±MLb;Úb›'š]†Ÿ´Ýûß |dZÀÌøXêøOœUÇTLJÒ AÅ65‰­ÑÝù•tøÔYªÉ*U(*ïílÞgf$¡36©´šœ¤Õf‹m‡ÐêS«Ï%àüBÎ/%àüJί%àüFÎÿHÀù­œßIÀù½œ?HÖøÑ©í‡5¼Ìö µRü­ô2ü7ªøIÂŽu€2*ícVú³ I¡ If?NYÿ/N¦ã-¦Q¢þÁxåÀì{!ªÕòèÐÊ$9'¨¼`yÛ‰*¶¢$¶“\]ØKìNózœ¥NVU>'©òS,¶]¢ò[yåxÛÌWòú},qOøYâ$ž°DOè,±š' –Þâ|sDŠ3N)Î9L¤²XªHe³TžHµKjÁ©ªNõzLÛ”Lš“é4‹©»0YË 2ßéß*a³C¹ÍB o¹Ðu K©e,5D¤¸7ô6;Ïg·p|’¼3”nû¾“éL‹é`¡|>~eÛt[U;ÎúõË›³•öô;™ÎQ­l•öxNþsúìñêB »`¨_’>çYE]2שK@¸_ÂGl ô6z³¤1•í”r¾jM"é5+I¯ ”vjçdºð×·û"eý v½XÉt2mW9à …3$ÃÝ%ÊúÛ;™.µ˜†‹úûã×ü­¶¥vÕËÒ¿—[L«…,7²C3™/Æï$Ó%¼m—ð†$—È‘\"Wr‰<§Ì+,™EBfÀ‚Ü::©IÍVɡ }£C<Ã)Íq¥ÒœLW©†ŸÜ£Ÿ9ù¯VMóÞÎŽioŸjÚ¾Æ*X*…‚¼]]‡æuu ¿ö×ÔÑÍYÇuîe¾ÔƒÝ¥v¨&Ê5I&¿Þb›)*gVÞÃ^ Øè)îõ´ï%£è mŒ9«Ñ•IEoT=wx{9d”ôÜq“UêZQêⶬÌy<¯‡V³Ôá"ÅËÏæ)Ó[Ç;F›9ëM—g=± ¶ú¥·³…7[ºŽÆ)jÃ8*ߢx®¾¼Wá’}œ5Ä3F·*Çf_'ÓmJ¦~N¦Û•LýLw(™v2íT¬iåŽÍst¬rpÝéjHïÉ%CrÖp—ÊGK{9ùïvU:æPºAªb°³Š{¬*¦‰*F‹*kÌ&G…[Ý­p¯ÒÚa'Ó}mxŒ·ÐÉ¿Š£»av)•(r2µ(™Pw·JrT’<ÄÉ¿ÇâŸ"ì9Ò|Z8›•²'[¤ÇÉÝfmCµíUª8ÌÉô€’i¸“éA7½öxGHsz±ä¨%’£ŽtÖ¶/õÒC¿Â;œéaw­GIZ—JZ–´ã¬m¿UÛ"QÛL¡ïÐá&@os¸þz‡¶µ’¶cõ?¢ò•QIxlñ?ª\NtsÌPãTˉÇ\-»Î¡ëIöx§ìÇ•²;dOPÉ~BYp¨c ´KUðI•u6INtjø”RÐX‡†“T‚žV:çdgíϨ´Ù,i3ÅÉÿ;¥6emÊTÚü^¹ ™ê(8-iò¬J½-’zÓê=§â¯—øg8ùŸW6g¼C«™ªæ¼ T' šåô¥ ‰A‡¨ýQµÜ]«xÚªq?2xQ)|ºCx¹JøŸ”§8 ÎVü³j©¼9iÍõeýsõÏUÕÿWeÁŽ‚óTÿ¦,8ËQ°BUð%¥ÿÎw\ä¿/[¥¥îUÍŒq“@¨ãXê2‘:ž¥Î4aød–Ü*nÃRëEêX–:Âd=ƒ%+Ìä™,9ÙLž%Ã{è–êkÞ<É™'&õÕ+®þnñøéD™º¸è?”æ]ä€Óû“ÌûÏ6ÎÎ÷Oþ¥Ü·;-©­¯Z|%B›f/¶ÓÌKCϪà5ű˜d,Qש®Bó~[Re¯+}¶£ª¥*Ÿ}C±q`= I»ÒšÓ*ûf[[r‡:ùßRðÛJ®ÿme£utø}ªF½ÓVŸæô®rLX‚¼§Ô^<$‹±*ó¿oñ‡…ö‰q=Ïù¨z¸³ÜV¹%¢Ü!ø¸9QyÓÏ&œŠ–š;G&iöa[æYæäÿw†-ÿHiÎEN¦•LËLŸ¤³xþ4ƒžÏÜŸ8WHKâ•R¿á¬ás¥.G:™¾°˜¦ 1¥¦˜ÊfRhV}”½ou:CÄYß—J¡ 0ú•b·Þ1t“»èk¥Í^ôøF êz“‡Ô¬²' C4 ïìÅ ­Íïë8Öéí8Ö)së”:ŽuÆ8ž;†9&¦AIÍý¶-_åäÿN‰<ËpZ¥BžïU›ú)÷”~P©6]R­ÚÉÿ£Ò#¢N¦ŸÜ7/WKζÆYêg•*…îªüâpvsvüŒCâÜêܯð¥ØúoU ¦´Ž X›8ÅûIÎì÷¸›¤F2É:g)¯ÒÚN;ø5‹©Ÿ°CW¥¬¾L½ÄïWÅ”¦¶Ê˜äX•­rØw½<¡(Ö~ݪo¶¨oR›Ý.ê®MqÐí7~}½ìÁŸ\o–ãñõ†]NˆÌ9õÞ$ËVúASP;Õø)—ô¯wò+@…6w'¾ïryüí•ntJì d:ÚÉÔÑbê ˜¼Ö½û4“¦ÑiD5:kÏQAkÂ>w©˜«-½;s§£†;U5ä¹C@“¤ð&§Â”èâܧ÷wNa³.é`HWWÝ<;%Ý6;Ku³J­?é³2ìkñn ;~­[â/¢ñ7_[¼[Øwy·âgÌöxIzÀP@¾%µQH]Û¦ÔSÜ¥›RªRƒîª³®YöH3ß™K~£ÖßÃuY>U^6'¾?ëï©ìÅãœL½R®”«’”9H…C¥v$(ÑÛâŸ$”/6½ävZ§§eˆ«®2!{~H0ùy¶àøÄ9;Yµ>¿¾KúºË$ß?ÑYªŸUj–(5?©˜¨ YÓIÉo˜zONÂùþÊ^>Å)ùàt\a@Æsü@eµ§:™©zm¦²×’_²HîµÁnËô=Þm–CÉsÒïi³žn»Ý‰³ò —÷LÇ+uI¦þp[Ëôãü…ÿD¡ýÊt–ÉÝEÒ&‡œîÞÞ³U©Ü÷…1“Ýwˆòaáx‡)ÎQÍGC3\/ kË<ç:ù‡+Î>’×Nç¥Z“PúäùN¦bå éܽó—XL£…2…)ë•ÅF*%%øô(U³§$6ûB»ÙÉ]ZÚ†¥Åÿèt†î‹éH¡×"S™‹$ÇÔM{\ìÐw{â`ºÄ^ó&7`¬Ò'Ïu¬‘nUYxœªåÕî>6¾-Ÿ¼ÔÉ?Áâ#+ÂÏ\;:Çt ÷þ™˜1¸N²J"äNP ÖeN#·µ“柜±STí?(Óö—©¬>X²úåNþ©éŒÐiJ&ç‡!þéîsõÒ\Ýì,5C9>®t2ÍLGÉYS‘hyò¯¹ùq ñRÑ c@Æ‚Œ2sND|Rž÷ß4˜Œø2© Ó@¦ƒÌàL3Ÿ•çýˆ‡ð¬rdÍ™27Ïû1 æñ YóA€,Y²d ¯a)⇂rxž÷,ã5,GÖ .q%Ž@Ö‘ •<ã(Ä#<¾ŠUȪ‰‚¬Y²¤dÈzZ u õ Aމ4€4‚4lâÊmF| ÈVžq âÇ‚r<È 'R’CNb=™CNf©S=•Ñm¬|9¥Ngô FÏdô,FÏfôFÏÍó~Šð<–:Ÿ-‡\ r/d¹1z1£Û…„KXêRÁK]ÎèyÞÏ6 Î+Ex•È¿Z¤¯aÜ×2z£;ÄëYêFodô&FofôÁg©[YççÛXêvÖm9ääÞïýü^1ð¯7¾/—|_Àø_ÐO ûéÈ 6ð¿pøyÞ/1ôyà>ø5ÅÐ׬¡ÁÝ5g qüÚcðƒ Íó~Åÿ׉ƒÿ þ<ïøðÇíQyÞo-È1 í˜<ïwNàxy¾wƒ^‹ `›ÉER(øCÁ÷J(ø‘CÁé@ÁOJ(ø™CÁüÀ¡à ¸z•<ë(žŠðÔ*ü 8Èóþ’ ü˜È8&ÏÛê ìM‚„<0P`þÌ`áÇ”°§y’Aó:€ág šæ LÆ%¡2 ¬Àe|?ÿ~-`âà >ôø'ð!§€ZÁ§S| W O£TgyX³Bð¸ûâ O3œ‘§e)0"OËžŸ¼@`=$£DžÖ8Ág` )8£„yZhÁ«åxÁäÁ Î ¡¯B a9Óç5t 5x_2ðx:KÎ)°BkoaoH×)iÙÀù²Y?tHNu…+¸yçæiZ°@B Þ; yý‹83ÇŒœéNÌଇçijh! Ú½нÒo!Fw*‘>ŠE#ˆ®â þ×—L-)XÆ1yZ‚›S žq"»m¡Ež–+ð"ã…!ðu%à³E QF,%˜!)fˆ¢F'5`B†ÜPƒK2—œß¹œÐ:sÄàœWŠð*‘µH«ƒßik9O±ð‚9ƒµœà`¼ûµ.&XÜhEWíX„ ¤µ½tdð¾@,ñ yAð…Ú3Ê—yZ×ùŽ…÷É<ž/-&l˜ø?½]]l\Åž¹ç^¯Ó(ÉZ«€íÝ%¿4ÉÝ]ã8)Pƒ”’?'ë jlˆìZÑ6T¥$å5- ©M¨Í*Î5I€Øìzí†üô/†òÐ>´j«¶¢ê ­Z ^úó‚ÜïÌ™»¾ŽZÀòÌwçÌÜ9sæçÛ3w÷ÞçÝ`êhLP=…Àå Sx¹Ô¹V½Š˜°D½°ÃjÉ^ƒ©Ã<ÁÄ» ¼ķ0-j¡*IxUŠ0Š#ÁյƪÁQ'ÛãË™ øÄˆ3«’C‚˜L)aSóV#ØÆå:Ì´Ž5 50trnÁO‚•ˆ'Á9»¨Ê ¦Œu$(É”ÀÇâFptG»ù$ÙMÔi*ÙMp´‡£û9¿?A)&)±W|À”fZaøb‚®cj˪[ÉE¾$ QWÏíÙ' $‘ %L_Kç<"ðu>*Fï¯S¼-= ð >ù19×"A˘0¢;¡‹¸Yãs7\/˜"f˜‚»êÊ;îDP„u ¾gÓ‡,>cªú~‚–š°ø¬iS„(’— Še–(-Q,³D‘´DaÒÏÇ.AïK1K¦T`R£^„&L|ÂI¬Iâh•$´½ÔðÏУ`ŸÌ5±gbÃæè½Ø0K]¼ß˜¥Ž.¿Û0ó|IájºÆ—Žl8D°N`½ÀU9õ\Rœ9¾Âõ)dÓ¢­"ºx“!™y+l2¤†»Ù¥Œî2DÜ-UDèA‘Ë "ˆ„Äc¨£o>¨Ï`8nŸ‰®s¹®Ëû ¢+â7ˆà1÷»è {‰K\t°9ࢃ=Ãz ¦ã@Vj½Ó ‹ÏÚ\Köœ9`e¶ä Åç¬üˆM[OÁ¦†,[œCÖ:jó¬Ç`ë =IY*°©Œ¯ÒJ¡íxÇìåÉ„"sñ7ægt…®Ÿ-ØW1ÿõ+ôIŸÊª‘öøè» qt›Üb(¥¬ùñæ3´ªL«!¦5ùþi}¤2eÊú§)×]¡¦2Ýà;ejöãý8ÖBÞÒɺn…Ö•i} tž¦»sºéònîöK´¾BŸ.S+’· Š[˺U¨܈8µ§Ñ‚¢Šó;VÓNá é`æHqÞê³E~¼-­NŸ¦U8³í.“ûö˜Òjúªz„>e ½dÏLP{Ø3£ÕžyBy¦g¾ÌÍâfOІ¹m.¡¡È› j{•š¯ÚöŽx/ÚæüFÕ ÅJ½ñq Óg0NW54m©YSS0Õ1¦¶¥¢¦¦ª¦:bjØã¡‰¡¿ÙÄ^ÓãÜá·]±ÿÅ#Þq«øŒU<ö1ômæ£éÃД{­)…B‘ãðNÚWOØ×E÷Kº·;_R£Tyi¡/@=œâœ Ïö”TZa 9Éaõy¿»¤ânZ…#òݾôc¼ÿ¨émògK‹Y,-­nƒ{A-ipKt;¿c¹¨æ5¸ºL›X²¹Õ fþbÒ›¬ã”Ÿe•Iîþ ÚrÎ8F‘*{/U_~1eûKüÕÂÀ1µ -Ò‡Ý~~„°jZ]g^‹ñƒˆMö Z&Y¥ˆha(1_™Ñš•¡6nXg&Ç™#j!:8‡2ÁÌ? žç'SÚ*':É!û…ÜáA•˜mZ-jËž³_4Õy/Ó¸5c»1M© v®~HfÇ;ÎVü F[*îÀ¤âþi÷Kξ ±ÄßǸpƒ”,ªë³Fß|†| âÙˆ–¼“?f¥^‡öS¥úËY×þrÖ6ã¿mZ%/n'ú°à$ä´-LØ9yʳµ½QŒÿŠ÷¿ Ü1žÑnß°ºky†uôÀHêH5É™XóŒ¼6·Ëlë(ªÅ€í|¼6Ý$´ý7‚åtÃíЊçàåµP;ù¨S«óTÀ«×àåSÏ«un;ÝX³¸Æ$‹*Ýà-®iâ`HÕR{ æ¬AÍo¥TM€ÿ™“éA ´p±)Ú騮Ԁ‘¬õSè—·?YWü¸÷ª­[eêê&iàZÁ¹yÍÝdósjQ†ÑÝeH(\ùO˜•ßÄ hX}fÇ—ÕÞqçÝT“›>ðø€ŠeÒî®qª ÓŸÈÄ—¦ûXtMD´QD+"¢>­ Eó3ðåXfzqÐÉ㦇Š*“I­ãŸµ¹¦÷ÙjlXçv€9á×Ìàæ;}"³8ØÐ»´:C…¼ š¤‹*•5©ôírì¨È'ëŸø5ì<©²ãtw…>NñR¸s2o›ç©¨ÇlVùrYŽ7f9/ ß:ƒ¾‹º5o.:O1Y%[òYËRG|w™÷êà`“¥ˆäqSÝ%üîú_²/†ð–™ÎJ½ƒðo„hÇÔÖ‹®EX‚° çè›6 lA( t!ô"<ˆ°a?Â7žD8„pa!@x¡‚rÔÓЯ¡_C¿†~ ýú5ô;Ðï@¿ýô;Ðï@¿ýô;[üŠì ôàóÀ‡?~8ìï¾Ü ,·ò+ €ù7ZÀ›#Àfà1 ß·—òMXÀzà‹@þ¹Ðq`-ðPñÍß]úßÐ|—oþ• ü3? ø;~dðWü<$àëü ,ày~¾`3CE—§øñ™ÀQ`8ÌÏ­òϦ€Ïü?›ø-àk@¶ÿ í? dûÏÙþó@¶ÿÇ@¶ÿ'@¶ÿ§@¶ÿg@¶ÿç@¶ÿퟲý¯Ùþ7€lÿ/€lÿ›]˜W›óÙé÷ž”›?¨uðÞ£Æ5a—ró”ó´>bæn¥J—=–Ô;eºvæÂ骖ãpó´Jä¬öÙܨù,ÆÕïs\,ÕÇLýeº?Êzñ!œK•©KÖH­7Y]>);¿ã“tÏ$uORÏ$Ý;I÷Y.£=Šo.÷¨vó™´ŠvÓýª^ö«Fz¸W5è'é–š©yÿPK Lg08õ41ψ +-org/javacc/parser/JavaCCParserConstants.class…˜w@[G¶Æï¹`8àÇ=nX¶± ¶“8Ž-d qk„„%ÁMB€l!!°qKïm³o{ï½e³5»Éö–í½÷Þ{ß;oæâ08~oùã›ó;sîÌÜ™33W<þÄ#Y–µÝÞ\IÏezÓó™^ÀôB¦1½˜é%L/ezÓË™^ÁôJ¦W1½šé5L¯ezÓë™ÞÀôF¦71½™é-L1½•éa¦·1½éLïdzÓ»™azÓ{™ezŒé}LïgúÓ™>Äôa¦0}”écLgúÓãLŸdúÓ§™>ÃôY¦Ï1}žé L_dúÓ—™¾ÂôU¦¯1}éLßdúÓ·™¾Ãô]¦ï1}ŸéL?dúÓ™~ÂôS¦Ÿ1ýœéL¿dúÓ¯™~Ãô[¦ß1ýžéLdúÓŸ™þÂôW¦¿1ýéLÿdúÓ¿™ž`úÛÛĶÍvÛålÏb»‚íJ¶™í*¶«ÙžÍö¶ç²=íùl×°]˶°½€í…l/b{1ÛKØ^Êö2¶¯`{9Û+Ø^Éö*¶W³]Çö¶}l¯e{ÛëÙ®g{C•õ ½±ÒÞTi7UæD[É"—¬¹¡B~¬”Ê—zR¹ñLÖ"«:ŽF;‚íN°Eyˆ¬9I·-9ÉP0î(ŸG“]ÁX܉%›67¢œed;èt"úÙr²ª’‚=ÁP´E?8‹¬Šd"Úáè'*Èš—Œw9!7žöV’5+ىx‡Û¥ Š¬/.ÙÙK¶8¡p\ù«É*O⥔=›¬q7Òv’a7‚!G;;HBU-Aw­ÑX':3¼KÉ’ÎîpÂ}Jü2²8ØOÄ‚!ÍË1ø`¯§iY•ÍÑhØ êQ¯Ä@›cN°CÁ* ¨¹/¡ß`5ì‹óV‡ P0jW°FU´cÊö©Š0W°VA4×ݬà 7Ò­›XÆ›·1dÅõdÙ-QemÀðZ¢ÝÍa·­;a¯ÛMÊŽtw*ë_éô&°@º¯Íè«58·E †lE †pŸÂmª. êN‘D˜IenGÛmÑ„ÁŒÅÕ«°iävv…5—º£+1:x¢Þä]¥êñ†ÁHhjÝ®F“®7ï»50Xk0¤Çu úG#mÊÞv"Á„Û£k®ÅSç2÷ (ÒÖcß‹±wCÁ6åWs{‚ÞŠ4¡ý®X4ᄎNÓÚìÂĹ!Eû@1'ÑÓëºïoŸvUt lÆR ;ÜP¢U§gH…vw9z^ZTè!wj­l¢x_$Ô‹FÜÃ^¯Øƒå‰vWÏNM R¿I;Õ «°M«‚‘¸;•–Ôs1/:ðþ‰˜^ 0Ü=QW7݉‘õDè— 4¨} ¢dÍWÓÛ†}v1ÍÞzwÁåªía¸bW·;½¦+†Ý %fÆÅÉZ¬ó{/ÙEfm‚¬Uÿ¿£º±¿/F9½]ÑÈÔ÷åÂÿ½…Cd-4#ÍVzɪUû »yæ›÷á\Pëˆ ïa¬BÇ™w(QIñ$Uuͱ©ô<¦êž¤ã˜{]×áèn“à˜Á×a=ãN§Š"¥•#¥·{ggPA?´%ªÓÞqƒ£WÑö–·ã3êp z»aPåö×!T´ãèVö°ntª‡,žu*ë„jEŸ„å펬ˆ¶FT‡’ÞÆÎ«%ƒÞI^@Ûn$¤kFac‚µ}=ì®p·ÎÔ"ïÄ9¥a Ø*:¨¤ÚÅ馷¸:7ÝÄņ'ÐB¯ÓSxý^Ï< 3æè3k§…êdz6Î +uWÓ®³RN{Î!Hw;í:ÉGÇÓŽ X¨ñÌ è57ÂaL;nB¶Äº# –x»ÛªåflðØ%¾[ÔkëV•/Au)©T™2ªÝd¦Ûêzƽ*ÆI$<ºcGº!¹Ÿt݉›:øñp°Ue161ööb7’¼Ì‡|GÅ̬Eð=õ¾C‹¥ÂÉLÞI !Á ŸHM¤s©üPc¼TÌæ‡p¦²?Ëæ³%œ—e7õ¨û«0€èšKc±Þ~œëˆ›í{òcwÜ\Ÿñ!žç3?"à˜ã›þ€Vû.~<*}úê‡5ß7㣞 Ÿú`ІúX€Që»äCA]±> e™¯Zî;ZòмW½bЧ†Ýذ?3”É74‚į禮0Xw2›¨Û±; "/W·s»W×€ºÕJ?ZÙxâD©˜ÉÀµÈ™…ÒO\¶§»jRýc¥b*­†Ë¾ÔØX¦¨Ì*_¡Ë¤òzrú‹™ÔI=ý“¥Œ6Ò©±Œ®K§JéaÏ5œ*z®Úñ,õ ¨'V)›Ïè¶2ƒ©ñœ7CÝó@a¼?ç5ÉMùñŸ9]Êä¼&S¹©ž³ùTN×k+7éys…TI/È`¡¨›*” º«ì NƒìÈh.3’É—ÆtÏÀ‚~gÔè/Öt¦0¨ÈæKz½PfŠƒ©´7ª\!?¤̧JÙ‰ŒŽÌgNéºüxÎÑh*}ÙîÙÅìDJOÛlØ…R&]Ê èFñÎÙ´6‹™ÒxÑ›í±ao<ìÃhJº¾f1›. Žz㣙¢q*ëMÿ<ߨd>=\,ä³gtë¾ÒpÖ›²ܧt¸¶ÆôH°èù±lF¿"b‹ãÞ›”Š“Ú1QÈèŽ' 9 "çMù©aϪõ_rË”ï’+¾¹~ã~Ï÷ϸÜáYê¿ü‹ª:ÿÿ)TN_zùÎÿß/t„-ö_î6GÅÿS®rxkü3ïquPù6ê¿IëY­çµÑzLë^­[´nÓÚ¤Õ¯uÖ Z÷iÝ£sµ©I~¯xů8wNõõºØ¼Y[·ê§7kõì­Z뵞Óz\ëzïi¯É­^Ñà^Q?ÕW÷ŠõM:O€7²€nÌÓµºjÛ¶mºôû/†6é” ¦^Ãï½ú~µçüÓ7U@ÝÞ¤SǸ£sèôL²6ŠCêFH§GSEV@¡P—†‹?9ÇfÜÑþØrøAø õtuaZˬÿ±ž_£ÏT?7­gŸmðsÀÏ5øyàçüð ~øÅ¿üRƒ_~¹Á¯¿ÒàW_mðkÀ¯5øuà×üð ~øÍ¿üÁo?lðÛÀo7øàwü.ð» ~üƒß ~ÔàÇÀï3øýàüAð‡ þ0ø#ü1ƒ?þ„Áƒ?ið§ÀŸ6ø3àÏü9ðç þø‹ üeƒ¿þªÁ_Ýào€¿ið·Àß6ø;àïü=ð÷ þø‡ÿücƒþ©Á?ÿÜà_€ið¯À¿6ø7àßü;ðï þøÿ ügƒÿþ«ÁÿÝà€ÿið¿Àÿ6ø ð¦™Ô?7È`\fp9x–ÁàJƒ\ep5x¶ÁsÀs žžop ¸Ö`/0x!x‘Á‹ÁK ^ ^fðà寯4xxµÁuà5ûÀk ^^op=xƒÁÁ› no6x x«ÁÛÀoï0x'øJƒ¯_mð.ð5ï_kðð^ƒýà&ƒà}ï n‡ n;·‚Û n»wwG î48ŽœwÜ>dp/¸ÏàÃà#3ø88iðuà”Áýà´ÁàŒÁƒà!ƒ‡ÁYƒO€Oœœ _op*Â4¼Ó‡á.B¡æ¨î†{|p/ Òôc"|œúOPóIjމð)ê?íƒëà>ÜÐtÈÇá„Z`X„âyR„S"|†y£Ô<$ÂÃ"<"ÀgxÔèDò˜Ÿ£þó|ÁKiq)<îƒ'à´_ôÃòìÊ—¨y’š/ú+"|•”û5_']¾áÇ#¾IÍS"|K„oÓâwDø®ßáû"ü@„Šð´?áǤéODø©?óÃÕtĽðŒG?§Ñ/hôKü ~-À³4ù iü[=GÍï¨ù=5 Íþ(ÀŸø3ƒj%Æ2QÇÜ­ÑÕR»w){”–Œ£é-ר1Ç´V1˜”Ð,ÛÉCÔu›V²…±XKZ±lÕjÙB[jNÍ4Ò¦f8KlÕaÀ®/ÙhåCÝçtZªÚ­îësE`] ªVk†æ¬aài^p o»Ç?-jŠ®ÝˆJËJ ǵÍY±uÅH¶ô9–f$W3S(".oWäRÒò̪QàsU`Ð0>Û.¢™r.jY¦e3˜9>§Â“¢®®VŸˆ§-3ž‰CMå¸ôšVJÑ7åaœá´1²(2Q÷¥Ãæ<ÚÊñX×ÛYÀ   #Ç€s÷#KKM"W‹ÁüqU+–‰¢/z)ÅP’ª«1­³èå|UÄ*H¬4C× 5𤹗Íj2£+Êo©v^a@ÝPÈÛܾCµ ö(zvŽáXg©)sU혒Ví¨bÄ£7dLGEi×þ/‘µ t‰Á :[‰9ÜvÌÒÒ¨XTAù’ÆXãþíÿ¨# )¥ìV·Xû×éfl7ƒ;Îñt£Ý4]a½Ìf‰+_Ù 9°ÊR»ðº0WÇtž9$Ø è¿ê1õºðúaÑÆ_$ø+<~_ßÑÙ¶µ{‹ƒ¿Kðx^‚ÒFÍØ)W(ö€£ôëªÿ‚Kðø/ƒ©ÅV[—I$TŒŸÊ^ÌG²/À‹ Ë©ŒíÈýªì ¨²M;ŠcÅ‘3¶—±ßÔ¶¹¯cst]dž®^¹sß ÎÀY]À« bÄA˜Gb^V)°*‰ €Ò$ É࢞Œîhi]•éî`Ñõ’Í„œ5·Œk¶½Hb"²a>â5@d› ¶å”Ê0IPÕ@> tO'Î^šŸ#!Æ}n¡£w=òõß LØD‰Mb“%€˜Àª%d5›ÂjlïJ&IÖÕ}ZLÑe›½l§Õ˜–À’Ù–m͈©²™æl¥#¶l¼ª£7ÚÓÖÛ¶¡c3—’KˆÉQvLÙ±2*J0•U0˜ž7ƒ‹e,Kå¬r#n5ÊšQt²®Ù’NcÓ%Ð`—Äê Æ`ÁxL\96lŽ®ïhïîk\Ä`g^§»ÛtR ú•)†oD™ìÕaÄ7&:5´9/›e%VO¾ǪÄfÀ.|ºÊfGÊŒ}è‰Íd ›%±ÙLF+–‚ÛÜCæ°F‰ÍÅ«ÁæaX²‹È”½óY“Äš)ž_`! Þo’àx3ƒÙFÌÌÐ[ˆQf˜ÆB̵r>ÊMXn4ÑÕH›¶ÆMF &/l® ´d¡¼ÕÐbXÈÙ¤œ½kÊU^*˸–Ô[VÄUsТõ]º®&1 \ [½!ÃÜ´ãö]ž59tL4 9¥ì—cÙ$&›†¾u ƒ¤³6kÉGVñª Ç1j = ’z뚸ËY7÷âºiÅ5…Â÷&C™B1xºÐÕÄù˜T4aGŽVaž–û)QgMM¨« .p'6€GÉ :Kw È&eÂÈÍû[Hwc5-Ô,†]["±V&á£užª@bS*XJD—P†XFÍ¥Ô,§fÅHS)ƒ+qÖÞžÍM”®-”_ØÙã!7èf?Gx›yµ%á5ç7<Ú׊¯vmw™4Žï­'Á§bya͸±¾&«JW”.žÓÕÚ‡¯…­¥0md‹;Ê¡Ú3ÍV§Ár~—½¶Œ¼QÒiô?ƒH¹â¶d)û!cÑ1³+XG6—­7fgÏ·<ÀW£¼Zåeæù UP!ŠçlmØ¡«)•ªå²ªR)8N.CÇÒçxÍÓQ^MG[±2Äe¦ÊíMê7c…/êUEß$H°œWË„Ù9…0~rÎ ç-‹kQJ)…,…nL»2Õ$Ug+®p…{²…0ÿìÁðéîGá¶—s¥°W± îkO’>§æ—³p9e'»•w2_uû5å×µÕQÞÝ…ž—”À*ã‚*is/†Z9iª¹cç^ÀÇê†ÉSUl[â£@q? + y qðH|ÊÈñºj$nWúº¤„Úædó–»3°ÊÿBÍ@Ðø»^;û5Ú¯&5£K'\Òy7/µ›z&eЙî LâÌÅK©©~Üò‚û: RÎþ4ÅG‹cëã ½_ßMŽss:ÎÆ½)K¼sðË_€JðSQ‰#?Õ•¼ÇR’÷n5öS€Qm gÕØ3¢öÐF~{%xùö¢Q¨Øæ9 ž«†À¬ @ÕµC „‚•Ù‘¬ß¶“à§yŽ é’cŽÃ„Üö `åñà/ €tšC£0¹M N@ÿƒÕØ„iÄfjNÁ”—ÏV¨À_€®!¨‚©#0 Û0ý8LÅAèÞ³ÏÍð†ÙCPw¤P°™ B½÷8Ô ÁŒãP;‡`&p©Eš;"{Ü#Vá¤I 1¼¦—ž4xöY~€o/œU ëÞ<£B“äÏÙûÝí)î9âÌFsOË!n„׸ˆi®²¡aCáa˜“½nrAÏbdx±z‰Í)˜{šB'`ÞPOÝ#hjxZÉ™—ø¢S0ŸÖNƒ÷Ïe39îô¬i˜yVÓtf+µ ­HqæåÝÕ„ÎÉn“«šó®ºÅÃÏ>ޱ“Û\pÖSL Ah›wçqÀðótç÷Ãn|…spcÙIAœÝR\ã9¥_7»JG\ËÈC~‚Ꭾ ‡07ª¸UÌQ¾ÞàRêh. Ä¡Ç`Ñ!Ø> -xØâî°g–„½Cë6O°²oæÑÊÅ£°·/鉠–ENÀ2tÂ¥‘QXŽ«+†ae„ Ã*jV‡OÀe%áobýìž¼Üõw¤>°ø.˜PXq*½Çêm|ÖéÎ>Kð™ç˜Ë p—Ë —ËBÎeç"â8žeTÍ!ƒ¶xÀ¿“ØñÞes+¼%˦â>4‚€ýÑàšïš”x­7~¤âöpÃ\Øq'È®ÃéjòÅhCO÷p??…-_\æ­õúCC: Bà|…€[`ü…‰"€TX«0±0E€ÆB@šŠM€3Ï `G`G!àQ ?nÂîÒ£°‡fñeUy3UÖVÒv'v¸½¶¶* ÔVî,y…9Yl}[SŒ-¡¶ê6W†Á3k‘8sŽzæ¬;)êÛ ŽÉmlAξ»³Ìö%çßžZ¼=øâCù$±ž„ó¢lÁ!]gp¥‹+òé"rÜU ¾²¹ß Þ·ÂÛÜ;0×½ýÓxØÞI÷ÿ*ÄäcaÊx,Oðv—`»ûúl,!ˆ§ºåEêÎ=E=¹Ç©wL"~Ä9½Þét3Ê%bo×a¦Ýx&×U(¸‰ˆQ¸¹o^)Ô ˜è0ÅlჭÃpM€¹åÚGá:ü†mu j0éó&¢ë넅ð½N¨óÃì*‡áUØU ëÄtŸd¼+ÿ´Ïå‰(%EñÅcø yð!Äÿ|ýBYÞ'˜íÔd JÁðPK Lg08µÓô·q3‡}0org/javacc/parser/JavaCCParserTokenManager.classí}w\UGÚÿœ3gî=.rð\° ¬xQPš]A,AAŒX‚ᢠ¬1BÔÄôºÙM—$&¤˜¢Ib²i›5½g“l²ÑdÓ«éÉF½¿ç™3§\îÅÍîûûãýãÅÏ|Ÿ™çyæ™gÊ3gæ6Ÿ=ñП !#Ù>}RY…°¡:J©QÖ`®am”R§Ôc®ü«!„%'ó,AŽjfð/áï{Bp‚A¬z†QZ ŠÁßN´ ÙŒ(R+¯ÿÛ¸ °Ýfµo‚Lyœpë‚£öÝ¿nÞHSçP óÈ.ÖJ¨©“Ú :žcù³àL] ™£}óˆ’'8Û{²†ÛO]‘JKçT¶M“ «ò`–w;IVQg$95{‹øSn:†AÐ!É‚“§2’ÊE׳¼VélZV.:D39ç™c§˜œV“£š™Ö(­&„fœŽu8xëÝÊ3¢›Ì*2Ë#†L,¦H"£Ê"“lŠÄ„½üA¾á~„„ <ˆðÂA„‡Aø3£!<Žð“Ax ᯇžFxáY„çžGxáE„—^FxáU„×¢è_”×=pÆx‹Cxá-ηþN!$>Ä︕wÝÊ?¢¤#ÊëªòÒÃGTå}¤DI‡•¢‰ñáøÂÇŸ |ŠðY”ò¹ò…àK„¯¾Fø¥G±•o±øZùáü(6’\îÇO?#ü‚ð+¿P÷7ÌÃÜq~´ ‚9†Õ˜„ «Œ‚›Lc`›¹ÀuæF™ŠàAý(7‹öÈ롲X,k¨Çt—¯ÈYð(_ö²àNðh,†Ì2¸rR0x\xë6Ž ‡aÀ}êx0øë®#¸ÐûÐ]‹œÀCË3ð+àüvïc’°ÖÀÌZĬõè¡Þ›xè£ß€èøaCdnŒ4ë…(z~¬Åpƒ"k#Ÿóå='Žþ#Á#l9Ã>Äì{,tý&“ð£3FÛâ»™Ì9ÛŸ¹2µæÔøkᙉ-[$ž5vÏ––‰\„\fŒ)(ãX¶ì²í¸-Ò-D±¦ŽÙ ˜­kf&Ãl0œ‘;!Ë–ÊIï&c_Jz×<õH õ¼_ô·GæLÊ8¶Ã±XæžÄ7þ#|m¬çX‹ÕÁIb–ù°`/&[þà_ÏÄ ŽX™Ë[ŽÛ~!-æø¼ÃuŽØ/àÆä1„5ÎbƒbAßÄ]üaI¦ÎNcej¨|D ©èwìØ12\ŽVnî¡Qçè™ì ÆÅ {…'€žJ8bIÁ‰Á]ßðÖ±‘Vók^ s}oЯqè^ &M²×Œþ5ÎÎK÷µŽÝÅ^3Vø‡8§-#cw²ïÎk=N¤ñ²ï_0k‘à“÷=6öRö¤±Â¿DN+ixˆ=i,uC‡¬˜xØäp'ó8'èà@­—ÌÅ8à—ïhÁÂ?ãºEq+tDAVpòröD R\Á"’8‰=Ì衟ìp-ÈÀÒ0-”ÕX1_4¸‘pWn%[@ý(¤Ž™‹ÈI|K™´—VU’XGpmÀ‹ŸØ.ç,㩯 |rݬ§Êt•ùT¯²•õRYo•õQY_•%ª¬ŸÊú«ì•%©,Ye)* ²*¤²Á*¢²¡*KUÙ0•ùU–¦²á*¡²t•e¨l¤ÊF©,SeY*ËVYŽÊrU6ZecT6VeãT6^eT6Qe“T6Y…Ó"ËWÙ•¨lªÊ¦©lºÊf¨ìT•ªl¦Êf©¬HeÅ*›­²•ÍQÙi*›«²R•ÍSÙ|•-PÙB•®²2•-RÙb•-QÙR•-SÙr•­PY¹ÊVª¬Be•* ¨¬Je«T¶ZeÕ*«QÙ•Õªl­ÊêTV¯²•¡²F•5©¬YeëT¶^eT¶Qe›T¶Yegªl‹ÊÎRÙV•µ¨ptfg«l›Ê¶«l‡ÊÎQÙ¹*Û‰«óÌû¿1·'âÌùßyÔ |ªóŒ²‘¬q¾›]àfºÙEñ¬ ¬ª®+ª® HD^\(•3 êkáŠYhh^ û<°•¦êÍ ]X¹nUisc |­Dâ‹jÊ×—gT×gÌi¬®k6ØãÁhMÍÊêæŠ‘ht¦ƒ‘éÈg9òÙŽ|Ž#ŸëÈväÇ8òc%eæGtF9 ™ÎB–³í,ä8 ¹ÎÂhgaŒ³àô ÓéA¦ÓƒL§™N2d:=Ètzéô ÓéA¦Óƒ,§YN²œd9=Èrzåô ËéA–Óƒ,§YN²d;=Èvzíô ÛéA¶Óƒl§ÙN²d;=Èqzãô ÇéAŽÓƒ§9Nrœä8=Èqzãô ×éA.xà­©© l„ )o4I¤gMMSscQus ±¼¶pmù*dꋈª-¯[•áT]· Â)¦6°‘W›]¾µbÐÒ†"Áä‘Ð\?¯~M Âó¥kª Vy¶!PQ]^+Åõ ï­®kX×¼¼IDñ€¢úÆUØnEEFCycS 1c&” V—7Z! Õë×ÕU6ñ^5aÃ¥fØ#ªÑu‰ôs|ʺªª@ãx®Ï•ŠÐ?èKݪæÕ%UÅåͰ·¸+Ö5bC°Ë€ËP²û[¨*_WÛlsŒžóBA´î^ñÑ]‹•sê!ÅYÕ(ÖšÊצ˜[±»¥[;[A}%˜ÖMÍ0<¡J4Uz4š§:7¾Þ©w>Ôí]SSÚ\ß`Œ˜Þ©UåËa9¸S gΜ9¬{ hlžm¢:ùÍÜwî(%ØJ «›W Õ] À5úÔÔׯtmk$*çÝkŒ2ÌoºQÊD%*\/ õº‘eŸD–cŒÉ¿±ž{ £O"sÙX”õífhFžL8êdÂÌ“ ù(±T£¯Ý)e‹Õ€B±6ºãì“Ì.ȔԓêÈå™! ežDsÔIdY'q"‹·PP^‡b슊ë`Qˆ`TH qM¨®«nž$‘Á©ÿ~gÂò;ôx¨»æ Á4ÄŸ‘™+v4µtC5lóêqظ&x4½º¶Vlª‰©Ã"´À…°¿yWšgÃÎ.”{âî [VuEym~Esu}´Ð/’‹†l®'nÌ]ëè\Þ•‹cµ:P±fv~e%/5Ÿ)>‡lÞ†z“ç`›ë¥Ï!ü•r³‹½ìv©—>My•x%ÁÍ.ó²Ë•!^ú<}Á« Ee Âpe„W™¡Œô²+Ø•^¥¿r øln‹…%Ó6VÀñœö*9J®WÉMe´2Æ«ŒR2½J:Ö‹Åqã• ^e"Â$„ÉyùS ¦*Ó¼Êt„ô¡7:9s§+üJÜTV*‹¼Jæ*æ*§y•9¥…ÊL¯R„¾”@޾L_òÒ^Ex áu„7þ†ð&Â[o#üá„wþðÂa„#ï#|€ðO„>Bøá„O>Cøá „/¾Bøá„£ß"|‡ð=Â?"¼‚ðÂÏ¿ üŠð/„ߎ!G8P‚„ #P!¸Ü*‚! !aŒ3û®„^8öI8öÉó”ù^¥ Ç~¡2_"Iݬ÷âUÓëñùñÄ ‘T®0.¹pU]=ò“«ëÖ—×VW&×±ÌÉã’½ì*öG„?A¥'óµ¼®®b5Ø T¦{ÙÕìpŒ]ëUb”^vÙõJ¶—Ý€p#Â.%ÛÍÚ¼ì&v3À³^v Ân„[nÃŽXYâeíìv¯ÒGéëUQpö5 l(ųf#œŠ‡ƒU®,÷*ŽSO,êìN´² +”a!èà]^¥šÜÃîÆîÜãURq9†õËî¥Ïv?šƒfÌÛŽÛÊy ëêµåMM&/»ëK“Às¶×«xé!8 uyxΕ”ÌÊ?uZþTØT gÌ.™;myA~é407'n鴹˧L›Q8Ns¢8m6hª3óä”L56¯dÖ4ǔΙVP˜_´\”•b0¤tVá8Òqîòâs—OVPT ç”i%ÓÁPùJ8Ž–WÀÞìB¿ñp·²¾¾6P=b+a_FVnÂS RQÞ„UGH¥‚ŸYö)ì“P]Ú\]·4Ýâ ·ÑJØã]•õëVÖ¢¡@m'uëàPç†=<ÀŸ¬ªœ XUužÝœÖnBNm}9Ø¡U¸‚•UõÍ`O®®‚q©^ÛPX¨k.(Ôc¢ªÁ—òºŠ@=¨Ðj<³zUåØrm=¾«®¼¹z=”)œn[·®[m(¯XÃ×î†ÆêõÆQ¿¡±¾9PÑ€½ßÕ½¨®€Lc y]#ŽSÓjÞª %* juEsUÊÖ5`p¹šø³æµiDJc}\ìÁšÒ¼º»Þ ,ðÁÅ)0<0-uMÕt]inÄá¤Í0Êúúj¨§®¯¯…Æp8Ù†ÕœJ©`iKgB: ÒbHK!ÁÃR)ÒDH ¥@Ú i2¤q0–A O@˜„‚°e À!ii#F€.d$¤~H@*š´ Ò`ÔÄŠ#üC¸1„eƒè¤I“°-i ÓÓÁ9:a‚!T&q"O@gó`.¦N›ž?¿hÌmþôy3p™'Î^^Z8{FÑ´åE…³!vJŠ‹§Í­8L/™[ añâW 6 Ct½J,lRо$7š‚9¼`ì¤åu°:C¹deMƒhèÉëÔóe‰KÕ¹ljj@ xÊË7UÔ7À,ûS‹ºZ_ÅOMÉÿî]/¯¬Y×Ôì¼e­[‹÷VWA¸¹ÀUÖ¯ã›ACC/pÃSÃoÆÃº¿s&Â1®{© ÷b±ïùRÃõ@#!Bs¼‹êŒ@s¡qåÅsßûÕ³fÑìR0¦ÕUR¯Q0e½ºÙÏ¡ØD6=µ0R§»?‰ºfsÑ+žxvËQÜGóQÑd¼< Š}NbÛµv£u ¸;Á>‰#¼NóáþðaòÀ0•ÂpWoä÷Ùa‹ 𠼸à$“¢¬á7u\µÆ¥½g¸u’BŸ¤!}Š,$¬üΧ…£,§Ïq*á‰ho<àqú² ¯úª ¯ úº oú7Aßô-Aßô#軂þCÐ÷=,èAßôAÿ)臂~$èÇ‚~"è§‚~&èç‚~!è—‚~%èׂ~#èQA¿ô;A¿ôAô'AôAô_‚þ&è1A zBРAñàÉ©$¨,(T” êÔ-¨*¨GÐ(A£õòuÐO{œÆ ªq~o<”qÚSP]P§ ^w€öÄ£-§½u…‡>Nõ…‡5®w^NüdAS è@Aq: rp´#’2Jë ã/Ï×øï‡§ÙýDn#þ2 êŠxxAæá¨Ù§¥Ô?bQЀ ‹QxÌÁãÙÄ”b®_ Ú”°)í5Þ,Ã3¦ða$QøÇ+J•Ü—i&Ý´’~€¸Ú’âWÒDížDæÜpùÓ:ˆjÈ{âõÐÓóÁº ô¬Ä;ytn6Ú'1f@ºÒa09R¤; }Bˆœi¤k ASðæ@Z–ì#žÏ®%=‰†ì5„±=Xˆ|—Är¾KS÷€~œ­¯s~Œ?Ž\ÔAâµä=2*$V(æ{wUî ï«ì"±¢’_é }¡&è&ŠV„™þvÕ$»*sTeVÕ[w`¨•Á¶d(—ô4k»¬ÚÃl´ÐÚ#lI†íƒÛáƒÛ²2ÊÖÍ µ’cKF‡ú ZµÇÚ:ãCkOìZ[7kkv&‡ÖÉ·ët©c;<ÍVšZ½Ð–Äv©n{<ËV*­^Ò}uUý´Ð:¥Ý׉²êÌ­³°‹b´¥XÖÕšU§¸K¯UgñÉc Eþ‰°L7Ã’œB<ül=ýþÄä%ÁÕI–&*+:É2CWÆ—l„n_pü G?´›fAÕÔ¥d ½ñâs·Cm=?î$Èò²¢xÆ)XÏßßl$$žô&åÜܦŞñ´yÔY#-¤<¸Kv šÿŸûÖN‰¡Vy¡r˜ôðkñæ‘ÇÜÛS< füÎ=Pé.T‘Ÿ‡J X 8—qÎCÀ9ƒ¯‚$êóx½ÞÍåׂ\G9ŠŒ‡N.°Õ‹†š¹N4T« 5Zœ5‚³ÞâÔ ÎJ‹³Vpîµ8›g¯Å9Spj,ÎÁi°8g Î~‹³Up:,N‹Ñ±(Îðú•8Òjvµ yÒõÈ;Ûä•YÝßÖýNì>ŽúƒÖ¨ci~Hé`Hé‘ÒâÒ£!¥ÇCJO¦D‰žâ>ýÉÔ’;É!®ñ4ôòYGçCê¿Rz9¤ôªU‚Âëæ²ê\Vã7:ª¼å¿;Êï: z@öžCvÊ„H·8¤!®|ÒX{lÍZ±y{Ч{ø}(šô'“ÑÊq29ûÜ*éþ”¤–%SÜ ¬eÉh÷Ù Ñ ÈDŸÍÏp`'%xÐPÈ6×s\Œ_IJѸÏ1Ç>GW¤C‚—òŒò“¤y¶ˆüÍä{ïYå×ý§ƒ÷tY²Ë²jCNúýþÈÐ'N òlQÆST­C~¦#‘ °·É÷@zT”_†ô=äá–I‡ýÑ‚ÎJˆçe¹·ŸÅ‘sy\E›Gc/òvš¼­<þŽ"ï<“7ߊ¿mæýÌKÆíAáÁNòÙ?,”Û9ÃcÛE(mæf¯ñ3-Z„ 0†Ö(-Î-V…?-n -~™àö‘¯ŒŽPyMhñhhñ»ÐbûÁÁø ¿8ÿBF¬ƒq UÆËÈøÀ»Ä›i#Íñð Ê »ŽDœ#(Éæ¦kÏORÜQŽ*.´±ÙnÆØÌ@3ãŒfP>Ðj»H´mê¡$“䈠kõ>Ô7ž4¨•YAírõ,€‰_ä!ä£l&É+h¢ þP¹¥WÜ¥¼ÒG¹%r½—¤K ÁÕD‚@“ðå\Ag ºR ¤K!ÝiŸmC~2è)2 Mà1Ãq–ßGÎ盪cKjHø@1ED%L™KSíð)­QZœb€·(½ <¶Ö’ÇZÖ‚*±V90 /ñ=EÚF‹ £`óCËÓ$“'ÅY¼d‹§[¼aöÊÜl1gY^JñVè]ùoµ(±•z¡R™£û5!Ýßko×éƒuÚl%ãÕJþ˜,¶U.³ìŒ²í$âXô·•ž¶”„Ø©²‡Nl½¨3Ã6”:Þ)hw ÅðˆPlp(³îâwœ¿£‰‡ÇïÀ“Æ/‹¿q¿.hÃáë6ÃW~•_(Üé3QþÑ ’dP3I1¡eÎëÓ¥<.\ç÷&iº s]&è•"†åŒ—Èò`·Å˰¡Êbæ‡úÅôê;Çèörx¸ÕìÏ©vx̓\[¬ð° ¯L0‚H~‚oÁBƒc$‰šÃBÇãw›¡£ÚO>¹^ÞÞe3‘/ùŸCeÎ$QG>¶{½në' :TP¸™K«!áÿvH÷'aé G|½ð+ñz¡ÓÜ åAÆÚÁíXëÙ{ì@ÊvR¶#Œ|±—rDÞº=ÆøUm²½æ[Ì)öcm¿ÃX£e@mé¦ZO¡^o¬]ÿv‡c¶jDÞÂ+¶CÅiÎ5(7+Nt™lUŒ²Ú˳c$ßR5ãÓhƒ?³I(Zñ®e ŸÕ‰D‹—mw‚Z˸Y·c]÷'©$M¬ë‰Öº®ëzA¤u편®{ºVÍu­ÙG:ÜDÉTÂoiäcH߉5B"'`Eu/ÿO’” èAÓ…‡ŠÔØM­‚^é®.²NHÏk=„ÿ«½v kºÀñ(p¬cž—¦:òcùé"o½¦‚ m‚5Ý 6s¢½`&‹m³À\2eŽü/†=éT»jÿ®k»À±Ö ì—Šæ ršÕøw¶…!]£Ëp¦íþǶrºPV»Yw“Ìue¾î¤»"­;5âºÓaÝiÖYD3#0wÚÆ÷Kñ«üg@‚Ë9Kì±çþ£ä*Hn‚4 ÒÝÄx?±ÒÛ* })é[Hu`m6Í5ök©;_Ä;?›D‰ëÁÈ—9òóE>ÅÜ=büšÛqœÿÀ¡[ìÈ/v´3Ö²!Í4Ü­ ¶7Ä_lîl{Áœæ0ÁO–øÊáúQ¿ÀšøÇm#‰Âˆæêf2'[“y›˜Ì+Â'—E÷³i=5ÕœMø“fˆ ÍIœÈbs¹RL`;¤ÙöC‚“S™é9H•Þù%¤jãTŠ¿„§QRoœ@ù„Æ9ä½~ÞW¬8óRfÌY)Šqê¸ÄŠ=geBnÏ_©cþJóWj¿&ZML²¶ï±œ9™£»Ô¸±ÒŒü<‘ç[€9Oª63dw0´5çÆ F†‹9˳æl¬˜³Áç,òÎÏçÌÞú=Ž9#‡äs4O(H‰˜ÃRbüž ÛEªˆñᆌM„„€x1Åhy7»DanÓhÖØ¡ã•t8ðºÍ_äÊÿÞ‚ô£8'Æãó³ Î$òv‘‡Ç–|Päñܻ2¡0¬ ±NñŠË íò‡ ½ éHÇ!ZtHpoS`«Uà§\ éfCWyœa•D— i$¤éV|û kƒôQ†s»+ÊÈ»àí‚}ȵ@”k!µŠ<øäzHä¡×Ÿ´"Á%7TsuJ+ÛÉz>€ƒÚHŸxG.ÚMT@k˜5©¢,äâmÆyÃëpÞP΋Ң;¥Êvp䥷áÒSyÍþœ“ÑF|8#8w‹)+`VY‰O ?zÇ3mÎnâÖæ@“*º´ªÍæ5G¶±iN)†Í3£)ÒŰRÒÎzú¤Õ†mæ†Ú¾ÝŒh¾\Ö®ü*j)G»Ô¢%íÊ»¦G×W»òb§”ÍÁã*wERù£åb1ÊŽJë¡Ò<¬4»§éØe…Oª1©ÎP¥ï Uú†Oj¼gýšŽÜUíôQ›{¿©y—Oj¼¶.ã©Å—´Ó í:­~ì(ÔÙ –­³–­ðIÍBït›[lû6ÅæŽ6ë§CGí¦CµEØ‘d»©x¿æÓzqå(‹+-ò–Ûòg]Ý>¥¤]~Ý®õŒ_ë‡n˲ fB¾?RŒÈ7ú¤õÖlÉ—EÔÙlÅž\oÆž°™‹üZo­/ç–X Bžê×óêãmÍ‘À3–€<ØæÂ³tˆ6”scíúŠ_†õ¥ßœ Jú*dA 3¬IoZÖ$8fûµ4Î}ÜXÔØ}©#¤^¢Öý•v…ؾ<¢Î™–ORƒ_Ëà>­ ©WR/Cødl5#yë£#íRJˆ=D'ÓLrÜœVÔ!ß„èd ·íÍñE¿vŠ–Ä·µ'Ímí!¿6šok{m½Û€§áµ¯³úG.ókã¸æN§gdSHÿÆý#¶5XÿÉÚ¾Á›­ÂüOâ¶ÆÛöaþó8ohˆý>!öó„}¯ôoûå›vål4GZo¦sùƒR›¼µë³’ŽñI@†eü-¤×øQd9×ùÍÎówê29'ryV—2œ-äu"Ÿ¿¾W䟂ôŽCï[ f}ÒF;ŽS"Æq4¨È ¨H°°6‹eý_UÒ¸ªÚ¥}Ò!xÛ¯ Ôáj’^ôI[÷I>]ÒÃ8]X>©Uî[¬tŸ¦%mÒÕðC¹‹}Ò6¡·ÍÔÛd×µ7V©Â¬ KªæçµKìÚSmͱ>i‡@i‘z-ÅÛ݉‚A΃#hqÉ~m„–ιŸÙÜ÷0Grîk>é\Á}“/`x°œg/à½C÷:»VŽ–Ë¹ç˜5¯!›mn½Í­ôk£°h¹Ì'] ¸³1ܳ9·À¶;ƯMàþdØõÙÁØÇ®ßC´U)ëØí’ñV7çºâ]šks®; (—jD\p+r£ì ‹¶ƒN\«>$ÄúýÑ¥â.’MŒ_º=R/Hpþã?Zy0ÞïŽJP¢.â×ñàvSñb'¾pI_¸¤¶‹tI×§alI;™ÑEi´X4ÐýáNÑ%æÁ >NÁØx'ö]D÷Ç3|s§_éËô;d Z^\–«hùþþp²_\Y6©°~!Ôq®~poð*ÞXoOqo8Õü¬5I‡ñสöã‰÷8Ÿß']Ú)]¾G1?ÍY¨ÌuçÂ…ï“B.:®ÙŠãr3XØÂ—ºô$°%ŽÐŠÖ¯X þuù´Õ,Ë7]øæöSÚ)]a:Pd^z¤[aêáÒ#]—×vç!»"Þy9[\zð¦ˆ_ü)Æ;ºOºÒ\ưza¤õÊeÜTL™~–&Æ+ª¤†b…v’lÖ顎1ßíÄzàÄ-¾Ex…ÏÛÉœÿy y-{Ÿüûçê~½¸ÈXoR‹tt±˜ÓbkN{¿ k'¬»Ø(|>É _ð+d¾Ä{f¾ÊÅïÑÇ@úº(­‡ôMZ¼Ò!MƒƒµômZ<ÜY¾K»Otc©Ù4íû5~_õ¨TDÅyVúžŸgÆ)8ÁñþÒÅÃÓ:¤‡ßç—:¤Ÿp:†| î0’ùÐ(ÆNKÖãó!ø‚ÏÐ= ý¯É·dŸô«qâK.ÎÙ^ðíD§´Ï‚éZŠíRœæNé·Iíäö.¼c8 }¯%—aµž»ÉN¿ÖäídkÍãB³ŠköÝM–úµ¾\s^ÍBs‚©™ejú»h…fOSÓchbo3RÿÿŠþ7s¾ÃÒ·R©„‘Ø'^ɵ9#Šgà‚ÄÇb¸=ÌþádiŸŒ?ÉŸ.ã·éÍ,žá÷í“idË÷ÉJdÉ`n<íQ‡µ“XÞJÚðE2+ÂÆ\0ò~ ¨ÝèñŸ¶ÿÔ@vwç,1@ŽûÐñ#ã”°ʤq.šëjøž•KQi'ãÆ©J®»¿r ñè²ÚN¢ÄÒç2î¶»ˆ×¼Ízw(Åû­k“âÝ×B| 3‘ªcPÆ»qµÆ+ñ¬7G;eÏ£üKðUŠyd9‡”ËSåy.ÐZy‹ÜÂoe@MiN:ðeØmqcÄgHÆY…¿}öÓ!ÒÃ/öŒ”û1áï[@Àk=jÅ9ú€ì]cc5.c…µƒuã?1¹/ï!xZn\fÓðˆÄ/±øã"§ÜÓ#–M¦ü•Ä~$¶£rGÊ­Që›ðww w· w·CZ¹eØáQ’ [èÂ4üþ´›ö˜¬á7¨ä8l™ÛiºÜ³CÖÛá!Õ½íá6¶ ŠÓ5Ÿ#+­>GüßUÃøS#pÙ.rJ—×TðP@ŠÂÓD…õÛ+~0O”®µöɾÄô’Ä’Ô¯-ø±Y¯Òªg?‰;¥ ?¾Ñe*,¥Sð÷ÀEèçæ@GüÎÐU•*sEÅ.2~¡=v¶ûáè2ê“ãç”)>¹×œ2ÆÑ…¸_º†K= ót‘\-êõáõ¹´?—&ôÏ]ê¥pÉ@\+ê æõ†ré0.MéuV=¹—ËFpYÈ®5{9<Å¥Y ½AHs¸t4—ŽåÒñ ½QH'rédG_òAºKH ,§Ì’6!™ÁërÙ,^¯¤7 i —žÆ¥¥\:¤7 éB.-ãÒÅÂî-B¶”Ë–sÙR^³¤»…´Â! pé*Þ*¤Õ\ºŠK×péZÞÆ¥Q\VÏegˆ6ÛE½&.[Çex½M ½=dtÏäÒ³¸´¤wéÙ\ºKÏáÒ ½SHÏçÒ –/é]!–/åÒ˹ôJîé²R®B y$w‹zx½?qé5¢/÷DX ×YÞÞ+¤7pé..½‰Koé}†”tpé­\Ú.ìî5ïಠ\v—í²»¹,žËîåV÷‚t¿îwxÔ!jÞÁÛN!ëˆ 3Wß²…¬3‚ì = dˆQõþƒ‚ÿ(¯ó8¯ó$ïÁS }HH9"ó.}¤Ũ½Ì¥/8"è%>,ê¾Â¥¯qé^.}¤t™ã7­ÝàÑ^¼Ý%â‹ÐÇw¬ˆ }VH¹´?—&ñHŠésBšÂ¥»DþóÎ襃»Dï ‘žt(H^V‡ÙñIÓľ$d#¸Í +Æ|tH_Ò,;’hŽI¯é舫ôU!ÛuRÜç_Ò‰]×! Ò×µÑG•Qm@I™¢ ,)cš·¤Ì¥ ))skCKÊTÍ_R†ŸØtk½U­7 Gë ¥õŒÖ4@¯6 0FË졹cµl@M§©€=5 ŽMàg\ã¹µ­`/n³7º¢õA_´¾\3QØOØŸsNÑr“´\Àdm`Š6p€6 p 8H‹¬ÅÑzÕ|€©ZÀaZ" _똦 ® ¡¥¦kÃ3´tÀ‘Zà(m4`¦60K ˜­ÌÑ&æjy%ûe_¹ôš_Fá”]Z¦ètJiÓiAi™K§SKËÜ:VZ¦êtz) ©NgÞ©@€YÄ£Ó™@¢t: H´N‹€x%€„±BBOÁ‡€Ð ¡7B„¾‰:-ÒO§³ô×i St:H’NO’¬Ó¹@RtZ d€Nç¨Óù@étÁ:]dˆNO2T§e@RuºÈ0.â×é i:] d¸N—¡Óå@ÒuºH†NËŒÔéJ £tZ$S§•@²t’­Ó* 9:]$W§«ŒÖi51:­2V§k€ŒÓi-ñ:] d‚Në€LÔi=I:m2Y§gÉÓi#|6™¢Óf :]dªN×™¦Ó @¦ët#:ÝäTnR¨Ó3ÌÔé ³tz"nR¬Ó ³uÚ ¤D§g™ƒã~Â\„R„yó ,D8¡ aÂbn²D§Û,Õé Ëtzå:=È îR®Óó€¬Ôéù@*tzJ^$ Ó‹€Téôb «tz Õ:½HµN/R£ÓˬÑé@juz%µ:ý:^¤^§Ò Ó?9C§WiÔé5@štz-f^dN¯²^§7Ù ÓlÔé. ›tÚd³Nor¦No²E§·9K§»lÕé­@Ztz[iYiÕi;Ò³uz;Òm:½évÞ‰t\Kž£Ó»ž«Ó=Hwêôn¤çéô¤çëô^¤èô>¤êt/Ò‹$Ä‹9^"•î—>Uð¥ûxøîçá{?ß¾J÷ÓNˆrÜ1eØ0!1H.HnHªŒ{%–4^ô D!D#xbz Ä"hq î·G†»#n ñnÜz¡ 7B„¾X#¡B„S’’R D„0aÂP„T„a~„4„á#Ò2F"ŒBÈDÈBÈFÈAÈE0a,Â8„ñ&"LB˜Œ‡0¡a*Â4„é3NE(D˜‰0 ¡¡a6B Â„Óæ"”"ÌC˜°a!Âée‹#,AXа a9 „r„••„*„U«ªjÖ Ô"¬E¨C¨Gh@8¡¡ ¡aÂz„ 6!lF8a ÂY[Z 08žÍqÇíwp<‡ã¹wr<ãù/àx!Ç‹8^Ìñž`²Ë8*<À(‰Ãõ~™þÃÖáy¿LïÏž"xÙ<ú„xu˜á÷¡¢ˆ$kÊçÌK<ÿPK Lg08]¸3W P&org/javacc/parser/JavaCharStream.class­ýs×qÏwÒIÇÙ>¶e»†|`!'Äq(&0&Qbì°SÚú,@–T}›¤ ¡¤ßŸé'm ¡U“ª)´±Lb MÓ†N§3ýúk¦Óét:éLKwß{'ٲ䙎æí¾ÛÝ·oß~½§?þ÷ípüA…4ଂÏ8GàEŸÓàóðš}‘À—|Y…¯¨ðU ÖÀ×4ÐáëDüox‰À·|[ƒïÀw |OÃÏïí<Ðçiö2Í~Dàú¼@`Ž>/¸DàU—Uø±wÁYü„pŽÀO=ðš^§éÏ4ØgI2Oàç*¼¡A~Aà Q®ø%_xS…y „‚ *\“@Kg¬L4| fMI IPÛ—ˆ#-ž±bY[FO¡‹ÜÙÉd"! TüHGOÛx­SV4fMÄp®e'íø>{*ç"±hÉ5Gq…?ÉXvYng¢p=™²Oõ·R¡tß¡eŸ$X'³™Ã™”mMK` œÀ»¢‰®C¶±S½(·g2$¿/;I»õqc'í”uÓÖÌ `‡â‘%Âì˳EjÆš8ÌÎã>nÏœ²bh[gß´[éKDèhý3a;™‰¢cÈav戳@é mAÚT-Ä%­xw˜$ÚÉyDc1N‘;αo6c3Ú®1!W¢ý{#'²é -àªádÄÊØè¸>Ç‹h))BEèdèl4Æá¢R2e¿^ ãJ<µŠìîyœõÇ#ެÆ?9¯?˜)Wwœïž°Â'³IœìŠÆ£™Ý¬ï,N(Äœã«À úÚt¢ºÙ!T(Á¶;TÊ^NŒYñ©.¤DãS|Þ’À_y‰°#pç I¼¥š2bšwª‹„›* ³°=bgBÓÖzt]ç–•Ë1š(q :ƒ ‹™E ®ìOP |O'*N¨PŒ;¸¸ëP1uˆÃ'txvëð1a@‡½°[…·uX„ë:¥ÃÕáQØ©Ã#,â~’ÖáÆ„+÷Ö>QöCq,âh¤ÃN‡­¤ÝƲ°Â;Õae:¨étèð.üŽÀï1¼!u`s êð?FB‡$$h®9ž­$5K`†@š@–¥ d±VËÍ#‰[t$RS]Ä ‡»’V*m§ºÃ/ªÝb›+-š8a‡±îvìާ³Éd"…µÜ'"¨¸Üå›Î¦3ö4õèTÊš '’³¥´]¢º7TTljítše§¯³rn×-/aÌMjDØe:ö…Xt…c‰4u +™´©í*©ZAâÁ쥢­ÂõdœRÜr6â=·¯­Fh†ÂN¼¾zñ«vá “›n4Ê}†÷¼—a…òžáý÷ ú1~T`Ln†1¿>(ð ø Ÿdx34Q£MGðv5KˆÛ[^g·­½N&q¼ã¯8þ†ãï8þãŸ8þ…ãß8þC·3_Suà.¹qxqè8êq4~Àšÿ稸¿œWò®¼;¯æ=yÃ7Ô¼oÞÐòÆš¼¡çÚ¼Q—7êó‹ .@ÍM§aæE,U„#ðâ#,Ò5øp›þy¯2I>£‚߀˜ø.óMó‚-†³¥8¸ C¶Òàñ뮃ũ6XšîTüçá ü&Eî€LšE®JT9P¤ ð50Ï„½DÜV¾À+o[±`Û<ֈج”¯ÐäfeÅ’feåGñ«ÈŸOÂUL]Ũն_¶;¶hÜéZ}´ÙU€Ú¨»iŸ¹klP¾Þ”çÁ}=½Iº_êÆ·3ù»=O~|#»€™/ J£Á€9¨5M×6̃´FkP¤ëFwÕÌ1Fc|Nzо†Ïm\¥ày΃™ª¦\€õ9h‡&û7 ‰cÒGÓPà&š¸«ùqVPKó ïalM%ninPèˆ dÔEtNš…© Ýù²\•`¼¨cXè¡dË+ÐCªZÈÈn.)eqœ#³iN6¢E,=ÝyæR³†xð—o¦Ðm)?Á[ K„z®ôŠÆç2Úê¨wcœr°‡¼ÔšƒBØ}ꈫ0î&¢'‚‹/ÁSaÂkœõNÕá-6ÿ3†–ªî]:X“‚¡iBÙ¶óxRܸ¨LÛ„¬ 9 âi?"·Ýohs´ b’•ÉúY£Á=jqlÇa M´²=]BÃfnC„l 5Sà$UKSŽªd?œDoÑ´_ÅÃ)ˆŸça ~pKá[&P?Ç’ç#磻ŽÇæ¤vÓ_€ÊÃwºâÆŽVø,ºUywoU@‹_¦âB›^»[ÌV, ãX>k[•ËxàV%ÂILϹ)wûE®ŸT¥Hæn¿ïìï¿› }†Ähæ™9#¦jqvæ¥Ñ]Ãl±Ê}ýÀ uE¸ k÷îÆ{ p/9½›;ù¼‰æ[p^“úJ+ÅåÏ—ˆÉ/Ãix nap®ãƒŽð_¤n顲*–ÀÆû”WàzQšâ /¡)äã%½$£()­ªS‚e¼ËdNVÕã.ÊĪê)ÉLoÄí誽{Y^R[äyéy`¯ º)œôÆw¯Xÿ,úÍ…8‰ÎßÊ[LµƒÕ´Õ'/a™št uA™v0°OÉæÖy,ØVlãgúç2ð)×]tù Öè¦áX3±»cmÉ’¤°d/4ì[[ÛPl%¡O/ªáBв\(U<Ós(DgJ­´3ù=¨õÑUçºq»Æ‡0™_Wíä>5p´P‡6kÈÙè’-ÕNU€m%¡j§Z"„ÿ8DŽQÈÍ:^àÔ-Bptëtå@gÓÀÜ׿S|®¢GœšÈ0-Y±U»ðM£éhXéìSbÇfÜdkÍ­ÔÍÄüéª!Ü^Ò:#´6¡Vzè¨UYEélÕo/yðC:§èØ¥[¥ŠÎiÎiX⟲,dÕ}S€*鮿›t—´VõM¥Õ|³DéixFMƒÊÚˆ%n9÷Eh_„G7£CŽ(ã ÐsEôê2 þ8D>vj‡E÷¨‡-âíûŠØúYøŒØzRœgÌÏ_Ú(í¿ÈË](¸e@ÆkEå"*~âD”H9bZ|u;® ÉgÏçŠO¡¢kúL‰ŠV¢’–¨žhŽwž‡3â?Áft«†˜T»w—\ÔTt ]üãÊx’ÃηôIŽDÆëQä—Üã–{T¹Ç#÷x}.Ÿr F¨mÓKTIŽö¸ƒôuN–‚œƒn¢ùÜþ!{ŠûÔà8Ãî`¤ÇÃg­>ïøÏÓã=çÂ+ú5®ù¨XwN’†–йPˆø½«ì¼Àž²ÎòÜí?9Fän¿còy:¦°»&wüPK Kg08ˉŠÇ*org/javacc/parser/JavaCodeProduction.classeOKQÅ×±§]»1Z”›×¾hã.$\ ®dx1jóâùì{µ¡ Ð‡Š®!u/\Îážsÿ|~½}WtSb²„ã”Y›#NNr¡cÝ¢œ·*ëÐ/‹çÂlCµ6ÓÒ篅ø¦ª«p+D—S¡9RGF›TÈÿÊ3Z¹ófß³Ö<~Szs§lïœx·ØÚP¹Z8û/»wþ±XÿŠèµ±~!š:û€t»Ö޲>‘"ȇ;døNc¶#z¥ùÂO|PK Lg08–ZüŠ@íÍ!org/javacc/parser/JavaFiles.classí} xűðìN÷¨ld0Æ6¶a‡´’,–mð!ƒÀ±Á`ÇYI#kñjWì®l+àœä¾ïáHHBnÎ’“ܹïûz¹ïûø»ªºgzvf%™äýÿŸ÷=}v÷nOwuwuUuUuõìÇþñÎ÷8޳ÄûÈt÷,÷’éN›» “ÍMî–éŽp/w+æ—bòL¶»ÜÓÝeîeàîlr/Ÿî^áîÂïWNwŽu¯Âd7¸{À},¸{Øã¦»y·¿Éhr›Ü`ºs’;4Ý™çîÃdk0¹“ý˜ñÁH“[·Ü䎂{M“[·:Ý9íMSÉ~:0Mõypº{ÈÇäñMîµÓœÅîu˜ÆgOÀOOÄOOÂá=yºû÷©8ÚëÁ}¸O÷à>ÜgûlpŸîsÁ}¸ÏÇi¾Ü‚û"p_ îKÀ})¸/÷åà¾ÜW‚{¸7‚{¸¯÷fpo÷Vpo÷Õà¾ÜÛÁ}-¸¯÷õàÞîÀ}#¸o÷Íà¾Ü·‚û6pï÷.pï÷pï÷>pßîpï÷pßî;Á}ÜwûnpßîCà¾Ü÷Msßï~Ü‚û!p÷Ãà~Ü‚û1p?î'Àý$¸Ÿ÷Óà~ÜGÀý,¸Ÿ÷óà~Ü/‚û%p¿ îWÀý*¸_÷ëà~Üo‚û-p¿ îwÀý.¸ß÷ûàþÜ‚û#p îûp îÏÀý9¸¿÷—àþ Ü_ƒûp îïÀý=¸÷àþ Ü?ƒûpÿ îßÀý;¸ÿ÷Ÿ Y.B‚ð@4Ó@Lq ˆf3@ â83Abˆ'€˜ âDs@Ì1ÄI æƒXb!ˆ“AœÂq*ˆV§8Ä ÎÑ¢DDˆN] è±ÄKA,qˆå αÄ9 Îqˆ• z@¬±Ä烸ÄZë@¬±D/ˆ .qˆ>ƒ¸Ä&›Al±Ä¥ bˆí v€¸ ÄN—ƒ¸Ä.W‚¸ Än{@<Ä^‘ÑbÄ ˆÄˆ} †A@\ b?ˆ"ˆ%e£ ®QQQ1∃ ñxׂ¸ÄaOñDOñdOñT׃xˆ§ƒxˆg‚xˆgƒxˆç‚xˆçƒxˆ‚xˆƒx ˆ—‚xˆ—ƒxˆW‚¸Ä nñ*7ƒ¸Ä­ nñj¯q;ˆ×‚xˆ×ƒ¸Ä@¼Ä›@¼Ä[@¼ÄÛ@Ü â.wƒ¸Ľ îñvG@ÜâïñN‚xˆwƒxˆ‡@¼Äû@¼Ä@|ć@< âà >⣠>âã >â“ >âÓ >âŸñ9Ÿñ_ñ%_ñ_ñ5_ñ ßñ-ßñßñ=.#ÓÄ÷Å@üP ñ£éâÇ®BÛM??m?›ž¹Y‰Fñs¿ñK¿ñk¿ñ[¿ñ{ñGñgñWñwÿñOÈ È,H¤)Az ›@Èi §ƒ<d3È yÈ™ 9 d È@Îy"È9 炜ò$óA.¹äÉ Oéƒ<d+ÈÓ@žŽboä ÏÙ²ddÈN] ì¹äKA.yÈå Ϲä9 ÏyÈ• {@®¹ä烼äZë@®¹d/È /yÈ>ƒ¼ä&›An¹ä¥ rÈí w€¼ äN—ƒ¼ä.W‚¼ än{@>ä^™Ùrä ÈäÈ} ‡A@^ r?È"H5µÈ2ÈQ×€¬€¬‚¬yäA‡@Žƒ|<ÈkA^ò0È'€|"È'|2ȧ€|*ÈëA> äÓA>ä3A> ä³A>äsA>äóA¾ä A¾ä‹A¾äKA¾ äËA¾ä+AÞòF7|È›AÞòV·|5È×€¼äkA¾äëAÞò ßòM ß ò- ß òm ïyÈ»AÞò^÷|;È# ïùÈw€|'ÈA¾ ä»A¾äC ß ò} ßò ?òC ùaùQùqŸùIŸùiŸùÈÏ‚üÈσüÈ/‚üÈ/ƒü ȯ‚üȯƒüÈo‚üÈoƒüÈï‚üÈïƒüÈ‚üȃü/?ùS?ùs¿ùKµ¯Ê_üµÚ¿åo@þäï@þä@þäŸ@þä_@þäß@þä?@þ<¼ xYð\ðx<¼&ð¼iàMïðšÁ›Þ±àÞLðŽox-àÞlðNoxsÁ›ÞIàÍox Á;¼SÀóÁ;¼VðNïtðÎïLðÚÀk/^xàu©¡{‹Ô¸½nðƒ·¼¥à-ï,ð–ƒw6x+À;¼sÁ;¼•àõ€· ¼Õà­ï|ð.o-xëÀ[ÞðzÁÛÞ…à]^xƒw x›ÀÛ Þð¶‚w)xoxÛÁÛÞeàíïrð®oxW‚wx»ÁÛÞcÁÛ ÞãÀ˃×Þxƒàà ·¼að à] Þ~ðŠà€W¯ Þ(x×€W¯ ^ ¼1ð€w¼Càƒ÷xð®ï:ðƒ÷„&ï‰MÞ“š¼'gœã†ó•íµJÙTª…r)ãÌÚtuþ@~q1_Ú·X=*”öõdœëË¥j-_ªíÌÇ‚ŒÓR+ïJ›ó¥ü¾ 6m¦ÒðëìÑ|¥ôFkª ,?ï«ôV*娵·ªP*ÔÖd·=·3ãˆõåAÕÓÌJ0ZÌëòû«Å|u8ãœÙžb.mÔÓ÷µh4i­6¨ùî J{/VOÖ‡¸PCÄÂí…‘Ñb`‹Åv5¾46M…U,ÜaÏ1ãL ËÔ”¢çŒ@5÷JЧ&ßì®rW7{OñžÚì]ï=-ãœX?äucCCØ »{w³÷tï˜<³Ù{–÷l…·Å¾EsYßì=Ç{®ê××POš X¡¼xc¡4yÏköžï½ Ù=ß½@õë½°Ù{‘÷âŒ#—w/\ªwÕc—,:¯{OgwGÆqš½—xÏmò^Úì½Ì]—qN‰Æµel¤?¨l,WFò5 'šÎxÄÁà¶ ?ˆ#Ÿe‚ ±û—còŠfï•Þ³›½¼›½›¼W5{7{·à§[›½ÛÜÕŠîLã¾­V_-ñåëÆJgA¹²o1~XL”XY¼u¬6:VÃŽ¶Ô<ÕZÔ#X!pû޵;úÖãx^Ýì½Æ»½Ù{­÷ºfïõÞMÞš½7âê¼É{sÆ™“ì–µÙ{‹÷Öfïm˜Ü‰É]˜ÜÉ=Þ½MÞ}ÍÞÛ½#ÍÞýˆïi¾¯8«VP+”õ}ZF…ñM~‡¿¶ä Ž%¬¡±<äJµ 2¤8ÂfÜåV8ökÆ%~¡êç«Õ±‘`Я•Ü@Y)( ¥â¸¿vûú¾>ù?? Výöƒ…Ú°³YT,ìü±Ra@q Tò£?Z)ÕªÂP®[ÑïXœqæŽõÕÀ_VýzÊ\›q|5ÿòá@ ¬â3Špd<ánÒéûŒFÃP¡”/úýår1È—táÆb~Ÿ¿ÚGj@AV¼½Æ×Whñ‡ƒCòÅvœ”?Sب”ViJÝ…r·E2¾Ú _ýUÕ¤†ÛrŠîñ»*?Þç¿|5ðÛ–´ù+ùá_%¨UJþ’žúšKÔ\š¨¹¬AÍe‰šg5¨yV¢æò5—'jžÝ æÙ‰š+Ô\‘¨yNƒšç$jžÛ æ¹‰šç5¨y^¢fžjÆËÖRÙ ÉÕH.\Jóuš'Ws ¥ùúFÍ“K<˜Ò|C£æÉuRš÷6jž$†¡”æ5G !.9Lìç3ƒù¥à`µçzüÅ‹ýíÃå±â ªt@±þ@y$ðQR¡A0'¡|¸´\-W*ÙÔO»K†9Z. k«òÑrU‰€E¸ͺ¨Zx| ¾‹_Õ Å| ŽÃÒ2Öû ¥ž&ïÍÞ;½Û3Î\%Çj’xƒl±P ®Ú£”x4P.Ž”èá¼øC~¢†ƒä4'þ ª'8ζ艑g£•àJɾêúmªÖP¾X &«¹i£U󌨦Á:sµ¹±ôUõFõP ^µG­Á¡T;rO ú9ã^=:5>¡‘ü¡-ºi_iPOú”xR¬-Rª %Õ¯n\‡êZ¾»ZIõÅÀÒèáraЯµ\¡àäük­…¤£³â÷¥4ÑT¬[R«Eu=õÍ—Qai7‹p°’][)•sD³jƒXʼbpzѦ†‚Œ@Åš2ýNÙ’åç"ù,¡6Œ¨ƒ!Ñé6ª8¥É²º&†'lÔ¨VWj }Tãcø¸0¤6y{>ÓÌUkGÄïþöñj-éÎW*ùñòèx;O±Ëb©®hæ]þ’.ÃŒþ"«N®Ç k°KlhçÿhþÒzîÒòGpr¼n¸T!µïœdˆ¸ViSçò æ¾mJ€—ÄáM6º©kaAPU®œ¤_¦¤´)™'Lj2lY â0'›Øéñ‰…Ö†¢ªuÅ«á¦Ð¹Úoo4ÜÄ»7›Ï’¤ L"¤E«í]Ãðj:—> 䕲è·ïÀmw¿¦˜¨ÝÀˆvC²ùÚkÝJ mV:³2ñÚs8˜Ó¨^¸QùÖ¸Õ‡±ï¼Ñ8´Ì\^'¬”S$Q5‘¢›qŽ!h$CêAAP/ÔWûË—œ·BÍ'gæ“û¥Ä&0‡ZG ²Æ4Dðí”Íцԭ’Ávkꪃ¯øþbÿ(þp´jµã@r9œÈ¢¥j§Xuíq ËUµ=dx„“i2qxu˜é\M¸=Î<æ&\o¢šö4+$È!ÞæÚxÓ„xªÂo.¦„ù‹ñ3w¶UÜŸØ?6Ú¾ÇØj—ëM†ᮡ¥Ã™ñJz[‰ª…œ63Žœ Nƒdd¡â±n¼LBƒ¹pz6­Y]¿~–ÂÑ7*=bm=æ* î]¨O^ ë)û°RSkdåúCå sk˜g'CÌFöû$ÓQ›ìµ43Zœ«7khÙBÌ-ZDŶØf,uvµ‹ªÕ‰ñ…au¹lA¸¶L©!Üàô´yc3+ªüq zŽÝy‘H¨V³;¬gwJÈY;xõXµ†‹BªUÎôs²¤š=©ppXÇÿwqšµ%cL/´*YJ©Äy X¯Ë{;°0i÷ÙÝq0öxEMrþ*3øy)ƒªUÆ‚hçá­æ”´~c3l«Cõe£ƒùZ°I±ìzâGãÔPÆb.íìì1tƒ¶-†œ…µ–Døœ”ÜEÃMw)Î`~¶å’=fÑ„äŒm*Úv—Úê$sÝÈwu:Nƒ±±°e÷Oþ›Pp°»»Bflzg4PÝÙñV~Å û{’°Jq_„.­ÕÊzU-BQ™(¦YÃeQ8¡3ŒIB*B8šÁ`(?V¬aLµ ºo7åsQ,¢°öó‘0d¸Ô‘ ˜P²"Ånõ‚-â‹Oê%ˆj}Vغ=.¹pê´Ç䘈v·Ùœœd”œMÚdÉ«-r;¬W_Ø0µHÜÚ{zrèª`‹äFí7ç AÕÈÒyÚÔ–>Ûc­Çd¦5[JX‡05´œ¢å¸xókãCŸc‹õF†ÐPT4S*—…¡…ïÎ8«-h´Ìêcm9ÿÌ3qð6òÏTÌ‹—æÔXg%Ú§WÃ5꾸Åv¥Õó­].2p½OJ­«¹=9Ãq5IWgMËžP®noâ?½«â’ô$–äp|ÉÕ×6ëëDº¢Ñ'ch‰¡w¿Ô6H&ù"’¢uh‰Ü&ætš9©®œ¶¥M扢£‹‚Š2mþpþ@àWƒ äçK~ypÐ/Ñéžk„ôÕVUtW,–¢/l\QŸ"&cÇøšk:¬žÔ~J„—cÈsüØ_gg(Ù¾Sεg’Æn´ÿæÚÍ ƒÒVùK—ù×eœ èNÿÓMí*çþë –#ˆžG "×ÇP´Y-·­ò‰)óB @½ÜÚWR]*FŸ$EÚx^;K[ýN½Ïgœ Sœˆ¯Zé¡bs3j¿µ»gtÁ£P¡Ä¶bkÌq”à3’`ñ_³Î@½##Éy(‘êqg¼ãS€Jß§cA|¦,œÁ@)3jI‹0$U¦ØÊ?m_Pë- 2“²·7ù¹–']ÕÐÔõaë1¨)¢vraPóµÙpÿݱóE 0œC=Án† ¹Ñ¼D£h §Ûæ¡&%zHgs‘@,Œƒ Ýî¹5g‘B³ÊÙ}uG²®¾Ãù)F£öÓÐïì8VðÐÅQc4˜CU²&4Ò1ɈÚÓkŒ@"n²[·ó#÷⡽b¦o¾F‹üo‘ Õ‚#¡h‘ÊØ@­¬µÌÅá!oü”¸½îcO¯»Òd"ŽžPÆŽÒð«q0êC›!Œw Ûs™ˆåÿA]©4V,ªÇÄÃî’*íݶmë¶•þö` ŒTIja™4Ãhr¸–ys]„°»ÔŠòlW(­øoWyÌQZ¡èP|L™Û(øC-¶‚XU½p‡_fË! 82¯4ìu°Ç0‚šï JA%Œ¨ ª|JÏÒñ$Æg„•Õ󯻤ýÊ!¾¢Za굎Eª[ŠaÍŸô²/Uꡉ®³Çªù·Í‰‡Uét]Éö§T;«YN#»Wt#b{›ðob*Ì™Äx»¡f»AŒdÉåÚsÔìZñ^–Ò?ó SUP»]U‹Ç.?&4é5dƇ̂1ûø×]g-*2•>¸-¥}µá\¨ÕNN…É„U›&Î «MBZ™ž„.H™®óR4pxIsÑ™#ÏÔÔ“íÞ¹8î¢cÃX/ДIéhÖ7§y#ÑIœ’vLF}–$ ap8•ÚœʃêCWçdœ-þ¤2¼Þ qY©:6:Z®(½§WõܯŠxÂôÒëùqç~4`ƈ™zÎ_9µŠ]áÄr×Äš‰BãúG…Æz¬µN޵Œsi„‰©M{rº²Ï‡Ó¢–€G·f=)r,"™É•4u *ã\óï ⣜\nÂÉÅ™lù£ŸšÖc&d÷Gǘ·Ø2áÿGNºàè']?Ç+ì9þ«<ÝcþØduª˜ž:£¤ºÕR¸¤ô/“ÓQN¬s’‰Å™déÑ/G m‰±éUÉï ü|ÕŒÞ6’u‘²,ûFèèÞ>æÒ[ôšÕñƒ¥P} (j8©±3ư²Õ…Nv ô5¤dÜÚ4ü—vI8®ÎÐC;NUõ ‡bÆ¥‚R¨ÚNÉÂT* Âw£+(¶r¥jì =§¶¥‰#nD8…†C!UlÜ…=ÑL‚êbãT@h¶#EÌ¥¹œåÍ<ú¿XÛܘ(&Š:¯o]¿H3mbQY›áºmB­€h=’?8¬`)à: ²U0Ëf« åQý\M)1YÈ"•KO0¥FCçâMq¤‘óÄB‡¿9¨ —1JÝÏÓy ÛžùФý&U>¼§wô›éÍgùg¥=~:Q´çFGÒm Í6õE= Ï’BaX4;#|¬Ö"<%Ö »º/k· Æç&$XVÕŒ–Õ4X£wÐlèò¯æl¿6"rásZ¦rqCahˆ«0òÌ÷p´·¼à¯¢áœyf]¼ñ/]ml|ÿ 3â=úhŸžã:;ëkØçÂ!$²¸‰Ýç›çñ[Ãí´|jû÷0õë¯Wï±wìrîCÁ ÁËXÿøCˆÕyu"S £‹&ú|Ø7®Xò!1ÂìC¾´ Rûð¸Ó »³3lm9é ¥1¾OðŠëºm½á€ì3(ŽH8mò–¡ZssT'Œ ºn…2‡›¼›½wyïÎ8þƼBñ÷º'ƒ:—.u¼§É{HéÀë9V¼¬¸{”dT±¾6Ýí!Ip°RÀàžî&ï½ÍÞû¼#j–Ñ]}ëjvý.}5hÍÔnÔÇjá5˜øý—…±›/É‹bç[¸MXÿán×(n1:ŸB,^1g|w¡„ÑA…!E¦G½œÒb2&Ð>Üi‚pŸS­Q7Šø±Ïî|ëÄ6ÕKRGá ãglz#V¬ÞÙq–JÔž€Ò0šÈ> MGíÒ°ÉcФЄg£7=ÊÒ¨‰Ë)99£™L]QYQ‰á1º’bÄ×#-L3=¼mé2(ûXU™¬Kî2&qJQe±˜¶yÀ爌Äù],Ì#-Pqa¼¿DÔ÷™~p~khxxÅöHP¯íð\OK«g%…7èâµúqŽ%Š|LÂÌ5®€|Ö\GˉQ áùU$(Ã5I=ö¹ ´×êEd#sÂP qü›Ni;‚>K©“Jö_ªÿèæÅáéùž£ñÈ'ðCúÜq¼sòÑ=:ÇPï£\g§^у{2îzÙ9õE<:7Eõ߃ңìuÅ£êUÑÚДñð/ºÜW>úŽHYˆK¢bA‰”|Ñ?€/`æ˜kÕAÓÜ üètÃPÕÐÐM3m[úg=2•ž¿"MóLUcº§Ò9ºåF¥[îÀóÖè¢ö`P¨úƒª~i.j׆óxÅ®@Úh54~3N)©–üöGõEÉ*Ÿé19ì÷Õ|¥Ä”ýá|•æGóý…ÓñŒ³NÁRàÙ¾&® «x)SmmAIí°éwΑU14§Ãš”šáX•îÛ<û}õôa4Ås¡ÄêЧÛôâ %ÌúhuøkuôåùªjXHjfÜyÜ­"èÜ{¾4îå«Ãª§n]“ï»—‚@ÀiÇÛ ”+•` ¦Ô~ãQÐ%¸öö¡y l¶C4À‹|"´š)7ãËWŠ%L¨žöxÑqˆ^†€`è&½µ­v¥-+º:¨D´}jc5"f¬‡"•b‡x„Ö!rÑHý‹”¨¡÷«p°\jS$¢ød fǨ‘Sã¶*ú::"$tÇ"a/ÀŒÖ¢À¥<1Õ¡am_¸¨”G˜Þ‚¢¹Ÿ©$–"´!ùêPâ–k™ ªŠ„†_*AuT!¥À$r`ì5íˆ&ÌlT®Ï—´“ɦæ»È?Š@è×Ï_/­aÕ§újÀ5‚ßM*s]H–vÅaÖG5„73„ÇÑC ÚæF#ŒÃ#(ñ{2cŠ)Ì=jerôvŒ%o£Õb懰v@+`|•f«j‡ÆòìpTVWû&è”Öb÷NËÔ¦?T¨L±›9a7±°0ð:ét¦ÞÑìxGu J¯Ãñµ,g>ÑCf)ZK£jcØ„ÌMKSe¦`®C §PCцð†)ôÉhœˆ‰w…hAM ¥’Ù%1lIuMƒŸgßV‡ß^,—Ô&3­¶—»°ê¸° ¨CÉb–ù}è|Ñ[Õh%À£#!('}Ú´Œä+„’@³9‹µ¶j½dP#,óL+…}õnŠwj—J†u2LïЕýü4²—¬ñ†žhÆîc–7‰¾*îòf¿Ô KP;ˆáеƒj# Ó€W‹ï€w°E­›ú ºpg4[Z7Í}¶墩DшÒÁ‘Äb_$Ñ#´ëÅH>íí0MÜz¾F.vû}±Ý©Ê¡á,ÚʵѨ^Ù('n`>V‚[aÂì‘LTyâœn£â¤àP¡v[JU(¨ýp¼Ë/+FAbPºØ@ß+µÒ òj^>l+ñ]:EÏøŸã„ãi7t$N ·Æñ¨èuêð§©i`¸WŸ«©Z<å·©¼ §`˜Ý£RZŒìÕìźf5TAúÇ ŠG5lS·ªßmÄû$bp€±¯©’n6©‘lÞº­·Û_ëWiêÌ%ƒÐ»à;(Šüê!Ã_Å LkóË ÐÌÖ!­Úâ6Z²^cÈ싪˜£ÛîêX?Ϥ½¦#ÍiÓéŸ1aI®»VÆÍ{-bßÜi$X‡É½ÖðÔ2Ü/v…Ê›Cc%B1`i°€á×¼š,š‘Èè%J‘~m¦&Õ¬PGö¨ÓU‚€”%ÉÊc%Tåâ «vaä¦9/[‹’³‹…Hyp­&a#£J$jùIXIo¯ì°uA­Æ”¿c}û ø:²Öª‚SÈ-¯g+É>4Â)Œ»LwLò"㜭ÅzÝdæ#1®i“êðl»Í «ÁBª H¸:6ŠB‹–7Ä˳¬3ŸâD6qÒ,…[ÍJ*εÁ}›aµ†ï¼h¥×ÉåÈh…ÞÞ3¬9O5¦—]˜uF3x%ß,dA'‹•þ*%ïðŽ«ê-zUÆ:aׄoÑNKæÛëº3_ìšÀ …a¿{”¬O_snÜݨ1ãDµŽhBµ°^ØP÷g.gÓ"´·F—ˆ’„]?¦ƒ+{FxŸ ªuÖJŸ„ªßpvæ6G4snff£äyËã-›Ï ¡²<5*ƒbx”1$Å)ã[½ IŽU”vG2‹DjjûÕÚ"{pF~qY‰Þ%欑|I1<éGÕºšý©ˆš¸Jèc)*–W @¡;èVüB,ŒE¢ÐO`“±fl#+ˆ€CI±æh%…28pÛÓgÊ#• È—b.!ݯ¾Þ‰B:d,«YkóŠéŒ”¿jì8ùüFB{š#* _]’Jƒ&t½5q~ÃÒC3txp”Þ§ÖàteAK4SÜc°Bâë@¾R CÆÁ@mÒ#J¹¬j½{bÈ ¶\4þ³J€¦/©4UírRÔT+ w)Ÿ&wà6e„M(ðÚñ6[ È=mó_ÿ>¶${bû£¶NÉaÁF)‡èŽíG'FïãÔvÞ26ÆÑo;d»=©¨Í{Ðä$oë:¬Öøµ²zk"6[)ƒô¾vB‘¢CµBýåŒ`Ùmì×á*'…m¸„½yµPª´2nøW›:…¸Ùƒî·}ì¦&ôÀ±ž£r£ö‘ÌOÍiáM¹ªßΊF¡â—+ƒø¾OCtTPÍi=¼ŠBŸìCU0ZÆ=J[ꄺn:ä›l=«fój¤ø6[r²–ÍæÉpæuú¯¯~*²V¡¤É=–^‡òa|ä„…W£4 CŠY“ºTww·yI³í÷¤ƒêXdklC‹“°fs‚€Àó•A½…²>_I#S3EC­cU#êC 1æû[‘ªG¯j†WÜXØ6ÅìsgÖ0k×IJE[慱݄üf¨4íîsFî“LM£½@;cœ„·ñ™0äˆoKqo\•Ô8bôð)X–Ö:ñ· ±ÔYQ«Üe˜öyF ŸÙÁã,TG‹ùq²ŽN®#K³îc@Ä©IhÝPõÃ@a%÷c/?ëÑï—Øn½Ã:bÕÕV42?k߃¦ß?©_öˆA O¯íÃ"{|ŒÎK'íèÁÐ>ë9Z3äx'ܨíU…=æB¶ C²¢MÖ. &D×Ã:þŽýjûÕSè_ÕÒÃßbaštçG•±=ØñôU ¡]uõž=9Ó Ío³®+ >·›l|™¼‡ßZ†ƒ<¥Ñ [•”"½¸#ýyP.†ã£+ ­áíM›ŠÆ”ÌW˜kíL|wk«¹4ÊÛ–ÂF"ÝnÚ}11~ôªF”âG˜)è¹éÞ;U÷~kOø ÜÔ½¿ÀasKìö¾ÕÊZ¤%{z¬×Á˜w‘tÖ·h¥×XíL?{ÂÞXmÆD[ýƒüàà^~ÝA•FJ rÆ>!4ùg¸òîÖØû¨íî7ÇøIëÝ­š·M©y[£æ»§Ô|75·ID¿ñmeâÍZüZ­aº `S5Z¶ïâ«§kÔ—sØú^ã×ÿvÁ}s‰úCéÕÇÆW$ž†»ü¥tÏîÒ€ÄÆDÕ:‘©Ú'2Ë»üè{ÎÚgÌ_$oO›¤¯aëõ«1Á¬xȤ”¬äuƒ:7wƒk)ug³b?é¢*æ£ß„UüÄýŽÅÍÞûégY–vŸÝì}Àû ª}Áö±Q´t«—çé`³ÚÞªì¥Q·â‹»bÞùXo‘sž/6à‹}wè«;þV6ŠùŠºVÊchSç«xÂtp€¸eÜc®ŠØVéÖ¯ÃBWçë× -dø›‚CeÔ›¨ü¶…ÄÏplê½¢oýÚM{)8Wkí—2 µ%¥DÔÐ!M¾:aŽV M ä-Ë€0r—}#ŒånV•}ó‹Röª!ôn €A±Ëx;*MÃùÒ>6íРɽE=O‹ûlwZ}[v®ÝÔ·a¯™&vÙ«zY¦-U/½sµ£]Öω·IÊC9îcÕŒ‹åò¨1åëç—ŽÛ­[/Ý»¡wGïú½T§gi^uÚ§ÏL¸®>-~ÃÕ§Ý1H®!ô«*Îa0¬ßP£|ù@à/×N–nûÇQàï3õ„$¸¦©ê•Èj%瞥B„£B´£G9ö3ƒæF“²Ý¯+¨^öe°§£p€Þ™Ä§èý‰„š"m¡7]Y¸ÐŒØÄ; â‰.‘q˜¸@æÒnLø 9òd´¶Ù_¹ØqO>$)BY·–ø(nò#af¥¯¯º’MÔ»uãvtCàßÊP7õH±,ûCùÈ6‚Ìþ¡¸S1ìv¤a"FÓ¾åwBoYŒŸõ9 Á '¤Ìã0ì@&£ë%¯Š7fí^5Ž\5l¾1Þ|-E–©æ:6ˆ|(3èíýäÈLŸD·Òï—ØiYé¥ÁØ;¡µÜáoQÔ´2<˜Î`¸ÉD‘Ÿß†G—ìÌQËü¬4úÔt¨¥)ßc0Þe½î]ú¢)/_WÄmѽU »Q€yˆ².­ÒŽUðäè=2½··Æ…¹eÓŵ–ˆêÌ9m”ÙÕÖGoßSÙå+¹þ˜U¿Ýøù~ë*õyª²ÒWE+* ¦í&Ù³u¨ÝL(‡½ îF–W;6Bu=§ŸciNY8tþ<«ßVU\é':ŠpÂVbm;…!:Ô ëë"/¢À¬Ô“{M.(@73ÔX¬ªUŽŽKwÜ;Ò7¬ï’_P‘õ"%*t2<Tm¨›³8ã™+ãPÙÒÚä¡ôéÐ/ba¯L+j†¥,ÿVú—*­¬(åýþ±}:ÎÝ~«¾ú9#”  ­Žá©MR‹r<CxÆNTÃ't…¨íMì’\Ä®·Ï)£û óÊ„ÄNp:âÚ¢öûJì|S¿jП{Å‹{ëö'> ÓÞeÜqÜÙÀÅÏʘ¡¹!u¤Í‰ÄÉÙ¼³ |Á­JÑ{óõà6âÝþĬ§5ɯàIÌ,Ï3 K?1öõmõë3Ö™–]¦4º\‰Î8g¥©þI½¾NóŸÎž+œ´cë%½[öö^±£wˆí(3Qß3<¢p\óŽG }jö>„¿kø°÷áŒsBRÍGÍO)6Z?Þ¸–·HþU@6ÝxSŒuN.ÈPËçA>Üá ˜´'R­’¯ˆB×Ì!,EôØ—3ød!ï³>Çza5_É€çR LQ\t,ExµO¤yñn½ëÛCö*™QS ™6“ÛýŽÃœÔÐÙCŠ•=¥Àïàó’ÀCÏåê G^»ž{v vÀë“1á°'‡<§r8æÓ|ãlÔ^7~ކlÎO¬—À}\¨ƒ“¡] ö•hÇW†ëÓ" ‚ƒ˜ÈsÍ!Ñ\ò=ÞÐ7—ë0Mì÷¦èáx¢‡ŒNáìú¹?/S´üÑÏ:Qä$ø…ðRoa4°aÆrÑÛ 6{…!_y3yè†û¬“Î0Ê€$L^óîhì¦H¹T#»§<Ä·;;¬Arìqì€^kôùá)®™N:‘§xÀ`pAƒÔfÇýG×< ##Á`A‰V…|q0ȇ2 W½Û •–¤”•V âCª[ŽØ:»\ÛЛø6qô˜'`Æ@ÉVøÓdKt ¶úéXpÕ%û†"w¸¾§À¤‡ï„$Í#€ìű}ÛÇOxÕh@,\é 'iF)Î…¢%™âàÚ—£AZ|’ïÅ"¯ô…üM©#œðrU|ýi28—2¢3: %Ø‹Îu›WdäyCª(ûÜ&”3ŒM?úÈ[ŽU¯rôDR"QìYk=m†üŠ\5ò|MI*E®;, C툑ឯ«}›'ªã¥FĨÑíËWØ;RVÄ_ŠB»̈RÔd‡ÆômUÍN±+.Å<Éfã.À_¿Uû"ư˜U"¼)Ú¡ŸãàxºI  ¢(Óƒn͇(’»Í-µ¥q5ì~ÖÔÜwD1HjNcùb‘oKýjƒ€ÚÞ ÅÝ äK&º³¬ÔóJa0ˆ)ô IùQeØ*‰Á.²h•¶r þæ6‚bÍyfdyš·>Í×Öö"¥ˆS”á–uVòØ«ŽPó¯©XêwU‡ëíÁ¼ dý{}1së€#üµ%RG±¤‹ÙGÇmWÄÇ—(0ì¶Kí³+¶‘ÆF Ï:47zPÐ1›fóåW½Ûw• œT¿_GÎqój½ ÖÆ,ž%Ó ‡Ät!ÝêC‰nÿ¢òA öìÂÍ­J¤¤.üdH™œ&ÚÆÚX©ƒìûóÈeVC>-iì1wÑÍëq4Ò}s+%”ºú´öOº-lID®Ùm„rÌÌÖã¦Ò| £è蛾 ߘá˜ùZ†EÁŒ´oCß”á!×[ÙÕ¾>"Ú<κu¤÷mPF¶õÂ?=ˆvî¢ËOëb¡ã«M¸®Æ ¹øFè÷Ü&õ?€[œ¾ ´ƒƒy £05D‹µù„WÃ~«èþ,±•n|aúêP7ÝXÿ„·ÑLF,`¦RÇ|¦†›ëä¢÷æ„?‚d#§j:¦<ˆð—T" q˜FÌI·'•9ÖÙÐŽL³·/Çk3ò?í÷ÝóþØ=ûøýùU~ÝýyŽ(Ó¿­N—‰ÔˆqÙðNQ¼ĸ‰#+Tô];ô¸$.zÇ.ô_K. 6Ih@5ë¦äJz·¹h§ ®¦º&i·Äo'÷_ίò/D÷z=X<¨g±Ð4Ƽêߣ·Œ¯o`òëqgœe-~k=êl~¹²o1– ,f§ÔbÄøFÕV©§¤?]¿þÂb¹?÷6ÛÕ¨cüŒãñ!iÆqÛs}ê+ŸîfÑÞ—[¯¾ó!hÆéj߽݌y¨'—(Zg~Óv~ûú ž‚Ù”5Ñž¬§j£Ý7h*›ÒùT†ƒŽ«$&¶’¾¦æ>Ku²u¬¦¨eCÃËøË>3Í€ åňo4XÛã%)]ïT¨Rb©Š(U˜¼2ãL¯ðÔÚbQZl(+zRªè14óíøº.`KTƯ£¡R@s’ïd:½Þ¤zy×ovÚ©qL OȱN_*’šC‡¶ñ²+28±½/½¦¤Ÿ/Í8+&EÉUéX:_б£|¹"u&£x,Å )¾§2¥Í±VÀz€òp`lo­¼·PRˈk¸—‚«÷.UKÉ-Æ”ñ²xg cãgÖ—©ùá«_RIHéuHa-ÏóQL¨!*tL =:„ʱ1ªòÀ@Y­ót:zÔ[ÜÒöMIâcë!u~´æ)ÔúØb©Á*«vÓ·Ó¶ƒ¼wå¼—"<È?@²åB÷1ûƒ`T¿1,FºÛ¥\éåj(ñIl7?ß“›Œ§%Š«ùH“k.WìÕÇ3.ܿӆMCkGÙW;Ê °¦Öõ8üv\^ös"_3FtvÚ,®tNu—¹g9w¹#¹îÙî õùÇq²Î™êû¹ußÏ«û¾²î{Oìû1êó*wµJר’ãE{*—÷;™»ü÷|÷ýxŸj"U~•»ºãˆ“]³`ákœ–Ž×g3Gwæî[ïŽþbÁÂÛTû»tÄ®û¹É]µÚ:¨*»Vˆ™»osftÎòŽ8M—ßáLïœ-Ž8p¹‚pÇ?¿ÚyÄ™v—ît­»Ž;Íœ£ºlVeßÓgMWmgÓñ€ÓŒf¨DµÛô s쮜ãTñÌûã7wqfÝèÌžÕ2ë„Y³8'nYô€3çÎ-ÇÞ™Ùò 3o׃ÎI»ºîwæßï,ØrìyrÑgᮕâagã<¡Fqò ÿü}ÈqNY)扙þÇ_Ñ4»é&gÆ<áÎV=žŠåªÆ-άyBÁ>OÞáÀJ¸ÃqçÊóš=ì4+ ­w8rå´¹Mw®Ø‹UØ4WÞ¹rº]r̼é9ÓœåÎ:g½3×¹Á¹Í¹]åw9÷9÷;§99oqÞ¥ò9u>¡¿?¢Ðò.ç}”ÉùšóMUþˆó9úî8ÓÜõfa[>è®\Ë4šf®tɃλ:f)Þí´írgµo¿ßÉmê¼Ïé¸Ñw«Ùwn¾ÇQx\tƒóõÁ=ât¿×Y|Ÿ³dæªÛœÃbÍB~úçõaaô4›³+ªO…Kïu–Õu¯³Ü]!f‹…·;óÕ3$ý°ëçìë…¢ˆtáÚ­àôgÚõ®*|ÎÎ9780ë\…´Yçméšµ’ªôPºŠÒÕa£®Yk(=ŸÒ 05d´VŽuÄY7k=ÓÕÙ@i/¥)½Ò‹(í£ôbJ/¡t¥›)ÝBéVJ/¥ô1”n£t;¥;(½ŒÒ”^Né”î¢ôJküWQº›Ò=”>–Ò½”>ŽÒ<¥ý”P:Hi@é¥û(¦´@éՔHéˆÕo‰Ò²U2jao²Þ5ÚìâJzq5½¸ßãŒÝàÜ{x ½ÍAk½f×?<”Þf|¢6OosíDm®›èáát€OH/~bzñ“Ò‹Ÿœ^ü”‰ÆóÔô6×OÔæiÖçSú ³JÇuÍz&•<Ë¢gSúJŸKéó(}>¥/ ô…”¾ÈÀ9Ë´}1¥/¡ô¥Ì—QúrJ_a•¿’Ò(½1ÑW¿-? Ù†y“óU”ÞlÍ諜ëßJémõ|b£ðÕ ¾†ÒÛ)}­ìu”¾žÒ;¬ ½Ò7&¦û&Jßl ê-”¾Õjû6Jï ÛJN#ì.Jï¶àßcÁl0­{ÓºÒ·[:’÷׃yÀóJßi!üA«é»(}·UòJJ, /Ç{­’÷Qúþô™| 1“ZCø…(îüáÄB|ØÂG(ý(¥£ôã”~‚ÒO†Á…Ȉ”á|*1œO[3ùŒ5´G(ý¬Õù笧Ÿ§ô Öð¿˜ø—¸û²á+”~•Ò¯Qúu —|ƒÒoRú-«üÛÖgþw(ýn‚0¾W†ï'Ð0uÂH’ĬÏ?¤ôGVÉCÈÄÓºfý—õô'ÖçŸZèü¥?·žþ‚Ò_Rú+JmÁü •ü–ÒßQú{Jÿ@é-8¢ôÏVÉ_(ý+¥£ôï”þÃêñŸ˜¶dœ¨YK&cÕmÆ2]=Èòs×" ÝDp&£™¶d<Ót†ú¢–E)bìvÓ8›ÎÙ1œ5'{žuÙ’96ì…žŸ ŠŽã'3Ã^ŽOŽqg-)둞ÀÙl« ÓÁ'Ò׸%s¢U©lw2‡³¹œÍã줨†E­-™ùqñ´ œÁÂÉ€Ÿ<1ðS’Àý‰€Ÿš€Ðz”Ã;-áô£Ã g&!´M¡=!—„Ð1„΄®ze§%³ˆ³nÎ'¡,ál)gËŽ‰D6È)ªè,~²œ³³9[ÁÙ9f°Ç«/çrÙy6ô•œõØõVqÙjÎÖL6¤óÃ!©/4¬½Ö®¶.ªÖ’YÏÙ†úNeü–•Ô’ÑÙ…v£‹¸¬36›Flp ?ÙÄÙæäøãËÍvKÃÚ[íj—Ú³Õèx gÛìzÛ"og—Ùµw6¬­a_n×¾b2Ø»¦¶ŒWÚÕ®jXmwƒÕ®CÓž,<¶aí½)Xx\ %i¨y»^J= o Á’†õí AÃá 5XsSìߘ<®×2Z2ÎØ2þÙÏY1 r$²”k1ÊÙ5|ÖiZ2ΪœÕèÑ«ì¦cÉþ$ú?˜ìÿgãG,¶|<—]‚$…ôòú ê:ÎNJts8ÙÍ8{¢=¾‚=Á'YSŠÍüÉɹ>…³§Úe×sö4»©îûœ=“³gqölΞcÃx®ÝøyV+SÍGý䜽³qƆä É1¿„³—&— -ÍÎ#™—ßát]rOæ“-eÃ6uÉÜ€˜ÌÜØ’¹éÌ«ÌܼëþÌ-ÝídÇioy‚sš“k¹–rôèm0½ã~νãѽ–Ì­ÿ#]z-6éVÛ(}5}™²SïßášÐÿõ?Éuut>ªÿNgÔ”Kª%óK4ü›|R-™Ûòfb§”nöZÎØ«tt.ª–Ìëm1i9£Z2ìú%y#gì‰ú;ysì‘–™o‰æÐ’y+goãìNÎî²öpbNŒØ×qÕ»9»ÇBðQúÈZ2÷rvgoçŒV ¼_-™ ½WqpöÎÞi70„ø¿ÎŸÿ‹ÎŸ– Wz»]µí÷Ô¯ÒÿOÀC Gë xoÂÑzÞ—€p´ž€÷' ­'à ÆðAÎ>ÄYdÕ{æìßì ˜h,ŽX%ÕvÔµ?bWK1 ?ÊÙÇê'8•á•#`"ÀÇ'W#s±®vc€Æ†6î&óèÚŸLAʧÖÖ°?m×NñÄaOq?cWKñèjLm±µ­þY»vŠ@×ÖûçìÚkX{2»]Wkd·×±±?!>ºÆþÚÿ½€/$@þßõ|1ÑŠàMÿ®ÿ—¦ב̗êMÿ/×™þ_I˜þ¹ãîP&Çq¯¥Mÿ^cú»¿`Óßýlhúõ?×ôׯ~Kækœ}³opöMξÅÙ·9ûgßåì{œ}Ÿ³pÆç|1ŸÁì/šÌÌ™> ú‰Eô-™Ÿ¦Ôÿg)Ê`Kæç)õ«r¬þ/Sêÿг_Ç*þ&¥âoÓ*þ.¥âïÓ*þ!¥âÓ*þ)¥âŸ9û gåìo±fOiöÎø 2ëØõ³™dý,Rf]Îø`2+cͼ”fMœg|.™åsÉ,ŸKf›9›ÁÙ±œƒ<3òñœññc¶…³bÍb&xÞÏžçýìœ$ï»o@Þw_G9òþFÃûÞFæ}¯Ãð~vn‚÷[²óþØ?«8Ÿ³œ-´¹>ËÜ“=%âì–¬Ÿ²N§rÖÊÙiœÎÙœÉYgíœå8눭h'g]œ±‘%#Aï~ÙÅœñÉK–Oå²Ë8#“ ÍâËòya–­„,[ Ùs8c;{g+­ñh YvŒfÙ@È& „ìÎÎçì‚FõÌhÖr¶Ž³õ1 lH©ßË+úÙ cõ/J©ÏçÙ‹9»$VSJýÍœmálk¬þ¥)õùÈ-»³íœñÉZö2Îvrv9gWÄ@îâìJÎX©á/»9c4ûXÎXÓÌ>޳3Íl¬îeŸ+d­/ûìX!kzÙçÆ 5ÌçÇ Y×˾0VÈ*_öűBÖó²/¾Œ³—Ç _ÁÙ+9cÏgöFÎnâŒ5È¿YÍ´‡Ô¬ðÍœÝb#¿ÑžrkÝžr[bOéðµ—tÊ¿SŽ{Ê…fO©Eí)âöpOyµµ§¸jOùÙMZ²è*~ {{KöµG²¯»‰HÿõŒGöcŸoa3ûÎØY}“ýˆýØÙ·XZ²oM©ñ¶X;SjÜ«qwJ{b5îM©ÁžêìÛc¤T¼Ÿ³bßñ¿Ìö(˜Í ôœ=ÈÙ»8{7gì6Î>ÄÙ{9{gïçì±¥`÷L–=wYöf?ÌÙG8ûhã¡°,ûqÎØ;‘eÿQöS±oŸŽõúήJ¬yà‘ø,gŸKiõyξÀÙ9ûRJÅ/söξjÕh,̾V'̾žf§‹q%ÄÎ(GavQ(ÌFYA;Baö K˜I­ sû.ñ¨&óAKdÖ>ý¶Ê³ß!/xö»Ôæ´®“ßÃÓðì·Ñq“ý~Òç­÷i6™³?äìGüLïÓh “±6\R6–³l,gÊÆÙŸsÆfo–Ï ³¿Jé3fffS,Ü,[¸ÙßqÆflöœ±­šýS ÈŸS€°‘še#5«ùŸ*³lfÙ uÙ u3œ±ñéºv®Hvà²Aêzœ±ñé²ñé²ñéNaÔ娨ÅÊ«~lJ˜©ê²©Ê¢Ð=¾!ØY±F-v#¶aÝÙ Ûžk;Çn;·a#vޏºv.v.vÚwOŽ};…3?Öç©vŸdÙiWžKö]Êy­{ºÝäŒä0H÷̸ôqÛÒg‰èPRg©h£¥OŸ‘>™«R™ÍFú¸íÿ™ª”–8.[Å.[ÅngüQE]ö6ÝîØâ-ž Ú—Ô¡}iRègNC¡Ÿñ)G´_Þ[á🾳êüPK Lg08FŒ-$Ñ org/javacc/parser/KindInfo.classmËJÃ@…Ï$ibÒôâ][\ÛdÁ­ˆP¢ ]D“´¤„IICÁ¥$´">€%þ› h`Ιœ?ß™Ìç×Û€ô-Ø6¡cGÊ®”=)û 2X ž&Ñu"¢9ƒrEÉ8<]'v=Š‚ùÕó2ÒÏ‘ç ÚÀw²aÅ _Ìã¼*¼N.+ÚF=MØ6ZR6`Ú°`2ô²|âMù‚‡¡7ã9až$|1κrà¥\L¼›ÇiÒ?¨' ÛêtY@£EUµv:¤ôVé*­6: .ÚÒ»B~쾂¹ê ŠÕíw/RmôÞ\Aûµo¼”E ›uCÇÉ‚#w M~ùàYd³§ç[÷n EQg…mý‹5þbªÄÔ ßPK Lg08£8½÷¼/D€org/javacc/parser/LexGen.classí}{|TÅõøÜ™ÙìdY"$áq  ᥨ  DAQŒËf ÉnÜÝðQ¬ÔW}ÔwCU,>¢­¶š`ˆÅw[líÃW[köý²/íû¥|Ï™™{÷ÞÝ»ÚïïßçóîÌÜ™3gÎ9sΙ3sïè+~þ9BÈ,ßìM÷úéGôz­Ÿ^ œîͧ³èõXºAÐa~c€Pz“ŸÞì§·øéÇd8½5@‚ô¶FoGð;0¹3@FÓ»üônA?ÅA÷ þ“‚Þƒ÷"Ð}ز“ûýôSùd=€ÉØö –ÂÒÃØ¯WÐG}TÐO ú¬}LÐÇý¬Ÿ~NÐ'}2@ûh¿Ÿ YŠê§ì{Q út€ì Ÿô06?#賂>‡ÝžôA_ô%A¿ èýö=‚ÉË‚~YЯúŠ _ôk‚~]Ðoúª ¯ úº oú¦ ßô[‚~[зýŽ o ú]A¿'è÷ý ïúCA$èq䟠*èÏý¹ ¿ô—‚þJÐ_ ú® ¿ô·‚þNÐß úAßô}Aÿ(èŸý³ ô¯ˆâo(³¿cér Ýï§ÿFÿEÿÉ~úa>ÙEBÂÀ0`ÅÃ~{ñ‘û™/Ÿ\ÍòòÉæÇ6I>&L†aô³á˜Ÿ„ÉLFúÙ(EÌ 0)Äd4&E˜œìgc0`ŬK¥˜ŒÃd<&0™ˆ‰‰É$LÊ0™ìg§`>%Ÿ¼Ä¦bi&år«È'wÑ0!l:&•0m¬ K3¤Z°™‚Í‚¹f³1™ƒÎÅ~§שXwš`óöt¨VÔŸ8Ù™‚ÕàC-ŠìŠl>>.Àd!Êæ,?;¢ƒˆiQjûYæKòY=[ŠH–ai9Ž×€2=“sóÉÇX#¢YÉJLš0Y…Éy¼û6c©Kçci »òèÑ£8Ö˜\ˆÉZl¸»­ #l=>n@ž.ÆR+‚\‚!L6bFÑ´ak7aßvÁ6 l VmŤ“N‹ ³d]‚]*XB°$òž¬óm‚mÇ|‡`;»L°]‚]ŽS°[°+»R°=‚]%ØGÅÕ‚í죂]#ص‚]'Øõ‚Ý ØÇ»Q°›»Y°[û¸`·ØmìvÁîìNÁîìn$û‚õ`¾O°O v`÷ vŸ`û»_°OaËÁìAÁìaÁz{D°Gû´`Ÿì1Á쳂}N°'{R°>Áú;(ØS‚ vH°AÁžìó‚ìÁžì9Ážì¶‡#À^d/ öÁ¾(Ø—;‚µD°—û²`_ìÁ¾*Ø×ûº`ßìUFÈÑ£‚½`¯³7òι¾ü//ݲ^°7û¦`ßìÛ‚½%Øw{[°ï ö=Á¾/Ø{G° ö#Á~,ØOû©`?ìç‚ýB°_ ö+Á~-Ø»‚ýF°ß ö;Á~ìÿÜ{O°÷û£`ìÏ‚ýE°¿ ö7Áþ.Ø?û§`ÿìß‚} ؇‚œnNg‚sÁ}‚ç î\ž/x@ða‚.øI‚|¤à£/¼PðÑ‚ ~²àc+x±à%‚— >Nðñ‚O|"¨7ŸjÌËŸ,ø)‚O|ªàÓ/5ã‚O¼Rð*Ág^-øLÁg >[ð9‚ÏüTÁO|žà§ ~†àg ^#x­àó_ øBÁÏülÁ ¾Xð:Á—^/øRÁ— ¾\ðÁÏü\Á_!øJÁ›_%øy‚¯¼YðÁÏ|à~¡àk¿Hðu‚¯|ƒà Þ*ø%‚‡ß(xXð6Á#‚o¼]ðÍ‚Gß"øVÁ;ï<&x\ð.Á/Á÷ ~¿àŸü€àþ à þ°à½‚?"ø£‚ÚÏ?ãçùùãáñd*a¢Æ-¡m¡™ÑøÌU‰h,uA"šŠ$j L¦B©h¸9µí)P`¡XûLU0#Rñ­+Úu¡dre¨3b“B-]É¥ñD3tØè»SÑŽ™ËCÉÍ©ÐÆŽtÞÙ!Abm‘1 âÛµ% B×ÁC 3´£)Ñ…:­ÝܽiSÀ‡Å"ÛuA ×yQ—ou”h{,žˆÔ…’Ä‘Aü¡p*A[éºÆx¢}&b‡gv…ÉHbæ"ÙZ‹=cÑ”…F %ÒI5G/DA ±1=HÐPÉbxèèˆ$[âÍ[£]ï5ÎÊM!ÙFÊKi@ºî žº"á(²-+€z :o‰oÄ@ôm‘M¡îŽTZy‰ÈŽ®1ÕkœÕ‘öîŽP¢@"ɤbM’µ'WG.mƒ‘Ó¡Tx3 ‡b²¸(¶³nsôdøæP²¾³+µSC(C€jŒÇäR00Á‹,©ú^µP«#¡ð榘â"š€o˜ðÎ莌đSÍɸcËÉîNœ š˜ŠÌ+p »bTH‰Ù5ìc Ö¯¨’¢ÎèW×dÊ¥8lk$ÒÕEêâ8Uó‘—…aåkÀÈêâmhÒ¶¤,„€ò‘Kº;»–D6v·¯ˆ¤6ÇQë wG;ÚlujAC1ˆXIi)*ÏÖò °”á‹ÚÚpŽ,=ó•×5àØ>˜“D úÕmŽ„·Ê¹S½ô I¢%¡ Jþ Ô0Ó¼\v/F›¥XJ,‰„ñ5¹+B;”Zðòs*ê€^ãWê)ùÒWFv¤,•øœ³%k\Ó%»¹ç Ô©IÌwHÙií¥±ü ñóÏùçø99SF‹ÁeDAz:äOò>L5Ây??¸øS {h¡‚Z…"Òf58‡V•ˆh“C˜ é\zj?Í?ä‡ù3ÀYÚ ®‰„SqÀ’wTÕÕù³ü9З™ÓÍ ž¿EsúÌ ‘¿ä_@_ä_ ò#üeƒŒÉVI)­ ÿ2­ ò¯`ò &_Åäk˜|Àˆ†Íœ>Ý”ÀæŠP,ÔITÃ00s]Ý;¢a3ŒÊi‚XÍhgWG¤3K% Wé<ð u0©Ô€Ýïrˆ«¡©~G8Ò…Se±uñîŽ63O™áDtØÜâ1kiž”xÀÏ_ ò×ùK0õéYªO$≠9}“3ȿſäoḣêâñ˜C!‚ü;ümƒ´­w››CÛ"fjsĬkZ±¢iekKÓ¹õ+[Õµ44­4ã’(3IU›‹»Sf4e†ºº" 3s§Õ)7 ¦Û&ñtJS4k¦ü ÒÓs[<ÚffQR®d™ªdi4†X¦"aŲխKê뛫Í@Û‰EÀrpÙ¥S‰ßÜ梤ïìIUùwQ6kO˜¹¡r*mš¨Òó˜ñîTWwJ©A¾ijE0Hµ‰³SWKs3Š„:/ôÑåfóÎd*ÒY (À–(¬°.*(æÅJ€@ì’4†rÏ’殌qÚ’µæî ÿ*Æ÷ù7 2Z…‚U F¡Ÿ K¬»£ˆ¢Èï(ЛWÔA¾Àœ…˰šˆ§À AJ™j A†©¼…¹e ®-Á,ަ”©–#Žh•Ùk¥¹-®@5ÁÆ Pu¿D$µ°,0ËÊ02–è&³5¦H³bQ…B‹õuÁXqĆu )ÒXSÛ,TÕ‘X{j³¥zy–*YÊ %–ŠXcBŸurêNuèÊ$Khë°`SÕa“$»nØ#œ™Ö!v‚‘S )‹±n ;t»4«É©¸ £”Ç& Ö’Ënt/Ž4ö¢4jTÚ²]Yf)w¤7 “³@ÊÀ,Zà:ù;¸"þÿ(ÈLÏ´"G`ãç? òŸ¢cüF“rÄ«ñ¶n½xþPÒÅtQžAÏ ò_ð_i*ò¯ø¯aƒâðb°‹s¿K·ùoœÎ§ ‚t]¤M˜¬Âä<ºæ$×N*HëéÒ ÿ-ÿ]FèZ+†pï ƒtE/@ìÑ%Aº“sè"Xbro ‚ô\Úèç¿ò?ð÷‚ôbìÓŠÉùˆg &gËü}é…t-Jêê蘉!ÄøAÚL[‚ü(¶ ˆ·%ö'þç ÿ Jÿ¯˜ü c´¿C‰nEîüj÷Œñ”œriœvé¥ðàÌþãªÖ = )¼„Bhú/‰dIýÒEç7¶éjz’…9 ‘€#ˆéA¿ÒŽFŒJCAþÿ0ÈâÒYì\·9 G‚>â3ü>ô1ÝÇq¤mXòùò‚>?å0s¾|ÔŸ0¶n¤“6L6Câ 3¾aâ bi8Pé;É7"艣|A_!>ކ„.ÇÖ"l8·ci ¶ŽÅÇËP.»1¹ŠA°¾lèºõÈúå·l‰àÎ7`+ãÚKc ¨³ vgí“Ó^~Ë–‘Hl9ÄøY~þJp&W!%¥¾0W»ƒ¾q¸a3fÀVÖÂ<û`s1ƒ¾ñªÀiwtwÆ bVh­2#iµòMÄðÒ'2zvØ&›!fÃÝD&wÊNÎV®qåee@=.gÑ0ø å‹ RŽ‘f4)QúîŽBÁ,30„.ñ.3¾ @‹\Õ`I =}ÐX¡ñ$²¨5C2úÙMm–dAð“ ”4C)YêLJ¸ðÎ0ì0þ4ÈÜ®d!ØÄÉx)»·Ä®è³3Èü!²æÍ—o†Ô\ÀfUaØ 3RŒQ$¬’2*)ÆBÐA“Õ:ÖFì 3@Yœ§½7«U‡.¶_‡€©=Ãà¯Ví¼Ò-èúâìu2:ËÂ}ì–±zÚ\6¡æ‰«]ñØôS®¸ÔN·ØÞa¦i·Î†ôaœê4o@‰¯Ö_)i?g(0›a€Ò,"¼ÃïT·GR‹-(Ùu¡£«âOu¶ËžÝU«DÀÕvWoòõ¬D;¥‹€^z¯!‰O®³†ç1¸]>˃Árì­Åežå&_y ¬)50Š}ráâýØÏñâøx\NדSªõªEWÛÀ9ñ×[m²Ãìÿ@róÿ;±UžÌfž°À¦ YZ•' ª o?ôUó/)ï“’~~J58Då6\bªrÈ3öPÎhh}¦ ¡O…:ç6SÕx<$çÏѪýEªZ;·Ë’k|µs&œnkŒlMË1í¸&¦ûÙ’s»¯R«o¶Yë¥RŸ1¥¬ˆÖí¾aaÄÊŒ%\6¨ˆØÔÊ7µ)ku…ÇQê1í kí~ná”à‚ *ÃÂXdGJËZ®¢£•ëow¼.Ä¥Á"†›æÌ™Ö~­ŒupRmL¬>ó/²šõèò¡V®2šwØÌRqT}ÓR|E-ßÈ¢¶Vzî’ÛEŒIR‰vy—´xÛOèØ?S›¥‘h&jUÇݺ#Îg)³_8^ ™+íadíó¯Dª»ð…IG¬¼lµœX¹<‚Lç/ •Ö©ht¬ 9&Bs®2’úìX˜µ;È€ªÎºóz”«ò±Q…$ú5n¹ "Ÿª@³ßªe–(@­ÅӊѱepZ $ÏÖ6N3<ÌtÎ/ƈI«•;Œ¡ÂZ˜Ã¡$op5L¦FMÐ77²ãQv¹'|c(¼µ»«|z®Yxн}3¾û,/·”ßè ;›:Õ,ÇxÔlL¿¿Ñ0ö[Œ v¼…6š… Íy¸̆it °¦š³N?½ÂñB¨(MŒM ìé.z9¸cP¡ÜbFW~.òà@eÏ‘—–¤¢l¾3•‡&® .D@T†G]¨Ó¸»AؘÐá¬AšÜk¨­­>uE’åjU­†X¸;Ò´©<Í¥—co É+,š¡¶BšÈ©ÒMocœï"­7/–§¨Å(¨áF õ+ôù]Öá]()9q¼h€­Ždßi·#3-?7poËfÌFv9³‚,;•Ñ‹Ë꺉:Ã, ¯øß”0à[‚}®i3:8ôii@+4g6ß[¶¬ˆo‹¸N»—l Íj•ßÞ`Ôë½£m¹+ñµ ª´[‚ ñЭŒ " KîÀŸ—¶Úœ*’=Ö¡/èH([K =¹|ž¹aÇÎÛãm­MïA¼TMÖŘl›¤OQý²¯4g›óõ"Z¡b3Sn„Æ“cƒ¬E¦Wu§Rhè.%‹åz&g¸¹˜aÎÖ:aI'‰‹w\”T½•Wör†=¶—SÎ=D­Í˜ôÁœ³5]þ™K›Î_¹Ä\”95î€]R½bQKÝre9Í ·özg—Á«³ä^¡l­ÂTô¬•YQµž¨rûx]†^‚ËÞ^ܹµV¸²VŒ©¶D!Ìñ=1¸¬åœ—Yi ¶á•Ìrv Ø]v9©?þ”MqÂâpîɲÏ/*M÷_ÆœzÄaöŸ:×î¬Úå4ÓÖ˜EǦÅÅBµÜ[¸ D¾]ä€ÁÏp>ãìGÎÎ'¹x53¤êM °” È­CRúSí.'¤ö%én™qŽý ¾ÚÉ Ô¡GŽH»r™é´jm9™“Ùÿ£ì>éE0×îg‡Ú ˜jc·Ë©è9¶sȯk%ÛÙ{/qY²LoˆŽfîVŽNž@âZÑÚqü•9®á¡A¡óÒgPª_hSÊùÍNº~õªÐ‘¶)j­µ–ØrJÈs †µ9œ<IØ_Ϥ×ûè3D7ÕzÊa2Û<Ë,+Ãs/ï±´c–_ëXS½Àœ¶>6 cBWUbš¤åä´Û³RYé2œ é;T/£Qö+ÐãOÒìU8‚§’³^y¿0HX£ªrÚL•ƒà*UN VY\g¾ °^Ø/ä(N`¥zË‘í¹²\*”ô.Û}Žf[ ÞhS³Æ ¶Ì²£Nëk8Ç7]”õÑ„ÈÆ©™`fü¹>¸SäçuÇ8ÅÈÞµ÷vá‘_‘šÉ¹ÑØ›ƒ¼—$×4Úov‡¢hœqrã›ÿ&|›Qß8„CÝIõ]H"Ò‘{}ó`k×åd´?õ<ÆÆËÅ|TV‘¥)MM«Z—Ô·Ô×µÔ/©p™†‡ðÍ Ç=„.öèo ½,gw‡‹ãFàP‘|Ç·ƒieòz{3Ö‰Ã>`‚iKݧë«ñ£r¼Š2ºÜã<v¢qºéþœÀû˜Çý¦äçœÜ[„ôÚ‹/31gm jõgÉòÏÚ$ê}Œ¦X,ÍÜkÝW†{Í?þÀ-Ÿ‡Š —ëÌ:™A'LE•$Ôkáé 3¦S­x¶¾zéÁhï¹öøÈX†—\&f7©[Ë:âa5È´\«äƒã¦…ÇçzM]úVLh~“üÈ~I4!¿tÞ 2*¯htÞLÁËæ*¯ËCYUê¢ ôÖ«GÔìl8ϧ äóBùœ÷’7@ü’’ˆV&ÃÖ&Aø _[uˆœ4jâ=‡ÈˆCdd?ÕG Há d4ü»rFAÑ9¹ŒÒ¨ Æ’žxÉX|*VO¤„Íã¼¶”qEü’×K~ OE|€ŒL8H&ÎóùFÎßOz?ùB‰>@ž€B‰,´ŸL…¬t?™ÙŒýd,dgí'£ ›¬Pœ~?¹Ô1€ìlö“I™ueýdrŸ_Zr€Œƒ¶R» Ø$§ì5ŒÞ£?Ç!ïGγÚ!-˜ìõ’ü½@!-™Ç{ޱZ0ŸªrKlÓ@*Z\å²XÅ鶬°K¥DZ±Âê3#ݧÚñÌÃd4Î~¾Ì9B†v¹ Lѹ‚-$sçñtÍ 9•Ël~©?@΀‚fkEHx¹x-â=dÔø}d8TV0o€œ¾°Ê!’/Zì!\ÀM±=Cz&ZƒI­Eíü^R Äô¤Aäu o¡[xg¥;í’Ø¢œp‹m¸AR×CÎ$Kö‘¹Î1ê½úÊYYj÷}ÍxÚx†TIKë²,RÂÐøŒ¿:P,K¿ÜI¦ÕÞn?ÇÅÆ¹:oÔù ¯Ôy“ÎWéü<¯Öy³Î[t~¾Î×èü_¨óµ:¿Hçët>%'½ë1ÙàE´|±n —„\pSuÎ`¦MçoÒy»Î7ë<ªó-ÌoÕyG†:3„ËB’ Ýçö‘mdû³dÇÊéOXP{ÈãP¸Ì /]•Éå5œ-…ÝÏ }ä ,Žë¼¼îÚßˤrFÙ³–_ÒOö¨¶fê0€"WØùÈÅ>p'ï¥`¢Oó#Go-g7nøÛ£×Àòé©„É)æã¤Ñ_}ì][“w|ô2¼s¦U¢x£÷è*}&ÐO®|äÙü’g†õ“k×9®w>ÜÐGn`Äð,ùX?¹±ÜÈúÈM@ûMGˆŸ÷ÎúÉ͇É-ÀÀÇûÉ­À#uæà¤n×ùƒðúɲpW?¹{à¹~{É'€-( #úÈmãh“$ü=ݵGçû4êOêüI _y/๯(Ù¯Y½sèô) t Ÿ<`A?¨Ñ=dÍy‚&õb\C(üCHµô¬wÂDN„¬üò(™ƒw?½‡øJ“îó‡–ç–xòiŠvk<“5X?îî#Ï•¯WKŸ"<©;l³”-¯ƒ2òKÉ£=dÄ ùô>t¡Ÿ¹ð'Écýäq­!ç‚Ûë!¢à³½`¡SúÉ™öÂ-Ý甡ö“¼AòÄ yl€ô5²y¾J¥´>pþýƒä`¥VÝ5yÅûT?yزûi÷ƒÝKL‡GqžRãh¸µ8ï0¹ ×ö“§Q]»bN×7kVùSäóÅy‡¥Ðò¡¦Ÿ<ÃŽ/ö£ú²Úbÿx©»»pÁzvž€ô¹yùUhIX‹üEùó|pñâ€ì¹^ô¯®V< 4¾ŸÀ¢ óú<è;ó”`ìûUŒ×Ô‡ÓEù-²ðbÎä5ª’6õÒG¡ø"y©‡,… 䥃ä èNßGNS}Ø¡ÈÇ÷[úP ž»púŠò÷“+Toé%I _ê!Õ}¨þWÓý¤PŽI“zVM½ä,9þ‘˜.{Cxò|8Ú—k‚ÅÁƒäË Ã¯È‚êÊÓGžÆŠWÈW“çTýR¦ `³š 4°â Ãv°­â ´|Íu‘hBá}í9Eæ}h‘Ï‘<ô¡-!”ljÆôëGH¥Ì’o!¦U”A Àߘ†ÿzs‘ø´Tmã¢þ`I5&C~5üð?Âjö‘Wí>s^&#íçXÎdO?y¬óµ>ôIØžhýÌ€UîÚyø¢ks5õ’·\Cd`}ý˜]Á¡¼áÙõ èúfúÅ\¥¹ÛGJ?ƒi¡j,–•RKNï#7{µ7ä`/7zÿý÷½ Ò—É7ÁŠ@ ’oÉ… X••5Ý5@¾pGÔ‡Ž4í­=ƺ–œ1°ÙoC Š=@¾#»>Rðö~¤‹=詯Ue ÉÀâÎ+óïØ‡ñòužM ¿ ¢W!Ö•RÊ ñF/Ð"Y½­¢íãeø ™®žÕc€îïE›0ûHP• Þn$ßUüA(z²m“Ai­O’ïÉ(÷û6H¾|þAyäqßê'ïôþó· ÉéRˆ£§+ù ?”ò{WvùÑ nq ð™þtülü|übü²GŽ7H~5H~ÝGÞí!ÝéèIGY¿‘¾tOV å†úí ~ç õj:û߃êÊÂ@½dá=IÛûàüQ¡ ²–¼ívØ{¶—òÏÈU±†«ÌÇjKp=¦wûJæî£0§÷”T÷ЫdêB·ƒ#+A—×K·oa ¦ÔäÁÏo-æ'AxÂZäZþ~Éüb@š%\PürIEÎþ¬Ø©É“vsOi5˜Å7ܺÞ,ævXØÚù0ŰÝçì“ÆZì+å-ÅÙ£Ç8,sà€ò¶RÅ…ñ¸÷b ƒ1üEcð»jÿ* z@~ü 'äïųÆ/5©Ê¦õerJ†ärMiÖ,áõ‘ÛÇ­Ÿ "œ»GÉð]0‡waeL¨‘JªçXKö?íáKpøÉ% Ä)½d’ôï K‡ü(ZJäd|ˆÉQ½‰3H/¹éÿåp…†!S ©o¡Á°˜'‹\¦>›Üµ”xÝ©ã­%:Þ:Cmº<&ÏÊJGw)¯Phø¡ZTü&óÑÿe–YøO#1ú+»¨B#`†áaˆ22#m©…FÐÅÛpÛNå¹Â²ïIÉþ ¹Ì…|„U‰ òÖdeI ÷–€£ ¢Wž_Ø®ZÁ"@ÿ =:°‹£?i³ÛG^߇Þ܇žðµÒ*› íqeð€œUâÏŸÍèhÉè %3"ÉëÉîÑ»GsŽ3æÄǹvHãØ#Œ=ñ®ÒoZ#Ÿø×a„A£ÊB£´±—Œ4ÆÉ‡ñð&4f. …ÆDH+eÉ̹p“dZ&©xçØ«L¡1Ù†ªw6g‚¿!5çU9£°ÐlÈD0hœ"L9ÆSÑ6ímåî# ‹åÐ….#ªpu,4¦Û'n…F¥} ThTÙ‚›á°Ð¨–GvgÈòÌã ËD ÷f`÷afYXgK¬3dÓ49¯Ê€çÈz¥5s-àS­Âiú€âÿ»Ïss|º¤¡Á…thœg :Ã*œé Û…¶ÆsZkm„ó]çL•V·Vaa†d ³ÜCe`>Ûߢ îKàºAc‰,Ô{¨`¡±Ô6ŸBc™'ÄrÙ»Á͉ËâoÚÏ=®=¯ðBg“¾R-[ÏIîšÜÓºÊ*œgV{ m-¡»èåzQ.'>y¤:näÙ Æ­åm î##'ÆÉÍÀÑ÷ÇÝöX¡Ñü˜îµÛŽG‹aá…^tx¡Ñ2hœ¿lêhcÍÝ÷éÌ‚l¾.ôÓZ« NDï!Óäã:«~½UØ`.–…ý=ä |lµê/± !«°Ñ*„­B›5J‘|ŒXõ›¬B{–m´›­BÔMê«~«Uè° N´òÊ1«2îÆÓeÕ_jV!)—œÔ€Ñ})wêÃ6éÉSRÂÛm ÷’jÛsíÏdy§…ï2«°Ë"a¦K5/· »­ÂVáÊL5ÞãP2K¹®°ÔddÔ„C~£O†f\%uú©Ò^&mÁ}dˆpW£mï1Ú>zŒ¶k\Úkó~­§ûU]®“éõÞjƒUø˜U¸Ñ*Ü”9ÈÍVá«ðq«p«U¸Í*Ünî° wÊEIo‚ »¬ú»­Â'tL¦zäã}/càpÓ]¹O"™kÁ|Òê{Ûn2‚ed÷Z0÷98+˜Ò(£4µþîw[Á²Æ‚)+ ¦¬TÁ÷¶´€•ýßcžTË%v‹«º]U¯pU~JU®tUP•®Êt¥ÞGðç]“Ò£cdQ"õòAmwÃæÂx¨‡æg’ù°è ÑËfâÁË¥Ö#—3û="ÓG¥ŽYý¬HõÓözô™,(nC=æpýÎÑö‘ÆÌÑÏç³’AïÑ?çÀ»ÎÉ”Þ'2(ûìȳ/ÉBíE²TâUnthQ+ü“ÎR~¡Ñ'à%²~™Ì©@·¹—1ØstÌÙPh<åhQ'2xn‡g4äF9Æ4'ÝêHZ¥@åÄ:è‚ór† îéœ-ŸwÌX}fãaäéíc…Y î·¸ e ž•és2}>'æl‹zÑ#²Œ±¶$çiIVgvI~›–ϼVf‚~Ñú¥\3\éfÕ5kG\(rÏÚË.8§X5?S4?ã3{~y(Ї²Îêùw°ÿ:[ °*)|Õ¹ÏÍÎ+9g_Î&¸ç^’'ý÷žûDCæ€_uõÎ%O§¯ÎlùZN­Rí_ÏÙó2}5gûknÌYÂzÝÝ~ lñõîõU0õÆ@zø† ã€&‹Ø7eúÍœ$åfæ[Ž–×<ˆý¶£ýfö·2&nª¤ú;#½í`{®¦ïæ¤ñ{Ž·$¸È-ÜôAÈ `j&ì÷3¤Ö›MTxH"}­ÇØ›ÙþƒãLÉ;9[~˜³åG9[~œ³å'9[~š³åg9[~ž³åŽ–W=¦÷—9{þÊÝó¢Ìö_çìù®cê&{ûOýü­²ßåæ÷9[œÚöfq™|íbfBýÁAf…#pÍ"ö=Obß÷8w(ð§œ-âzû—œ-=ÆJü·ÿj%þûDìnùGΖöœ-ÿÌÙò¯œ-ÿÎÙòAΖs¶ÍÕBIÎ#g ÍÙÂr¶ðÿ@Ö9ý õø,мœ-þ—Á1Æ2Íwi–ÕÑ€³¿ýXöiV>þ×Ñõ¹Ô¯Iž<—úA™Þ‘Óa.tÖ^œ›OùAQ뺻\[*_—â›}ùV=¯—^ÒGn,³öÜ#dôtùÅðéê ùMÆí}äþÒê¹ržÃ)¾_*Ũžä á ^]z¿1ÌîÛCŽJ¢ì—L︷6t¤´f•èFyH¸¸` =aF»`Šœ0…ôä à1.౞‹]0%ž0¥.˜q®Aqµ)±Åû{[®êãe j|² é·/ºéŸ(_ì<ˆ„-uv1íy˜äI_™Ý>Ù±2dÅô”t(ËHlÆ'¿ Æi¨fõýŸõ¡3¾&þqŸã”‡bßv~ðù8ÕYßç8™tœ³åãÿ@«ý÷´Ú¿š­öÓ¼Õ¾ü˜ú¿©\ï¡ÿ CÖÿ‰ÿ§ÿÿþ¿åÔÿWþ ýŸz<ý÷Òï ‡~WXH§ÿ/+z|¬’¢_e+ú?´¢ÿ.[Ñ«NÀ¿ßÔGnðÐï®!ë÷ÒÿÓïÿF¿?tê÷û¥û´âÍŠ÷€,W]ßgþìï'`±¯#½(¿£!ä)£ŸŒ‚ß™ð˳?õ“‡¡æ ­òCð»~÷ÃïSð»1ý8@¾¿=P{'üî†ßµð»~×Ãïh{òà÷IøÝ¿ÛðómÈo‡ßP~ò‡à׿}ð{ê^€ß«ð{?:‡ßkð{~oBûóÖk¢«mvê5;gºY@ò]¤¾› ­BIþPK Kg08ã]xùP!org/javacc/parser/Lookahead.classuRÛNQ]§3e¦å 8J½T´€—vlÄ»%>¨<4JBуL:ÜÁûê`’ææË=XîØ;°ÌG¤lãÏËîWðv®ìj<‘Âzå3NGOæÍ×å.¬.&×+»ƒêø PK Lg08ãíúý %org/javacc/parser/LookaheadCalc.classåW{|UþnvvgvvúÚ2À’” 4Ù¼5hš‚išBË&A‚Á¶`™lf“iggÂìäQT‰¢¢øFE°T#Z$´%°E|£¢ˆˆŠŠŠO<ºN¦ãGD|T¦™2Æñ1 —q=>Á-Ý áFþþ$ì’p_Ùŧði QÔà32nÆg%|Žì‘p‹„Ïó©[%Lr¥Û$ì•°OÂ~·G±S"D±Ó"¾ á%Ü)á.Žðnnä‹Ê! ‡¹ú—$Ü#á˾"á^ ÷Iøª„¯I¸_Â×%< â"¾Éi1mÓ;“!T]Óà ´9}ƒè ®¥2´U§¶éÃzãgZ=FÚsÜÕsgjRŽÛßȧÓéÆAÝÍnc‡î¥6Øg5Ã"¾ÄM· éí j«5›ÂfVï§ýO«^Ð`M mévc·çšv?í!§3m´éVšaE9m¾Àjî§lŒZfÚôR­ Z9áöÑAÝΙŽí‹eL7çþƒõ óÀ/1X¾dôÚ™üš…Õ¶Ý£à"\¬à[ø¶‚ïà» • „RÁ÷ð ‚ïã `8z6°µC™Œá*ø!"®h-í]ëÏTð#üXÁÃø ò# lÏèç²á?Uð(~ÆpÒÜÍÏ7ú‡,Ý%Ì®‘ã )e¤)Ó3\Ýb¨ÐNTÆc ~Ž_00úú%ñ¸‚_á×|½…f‰ÈKµÏÙnØš“Ѷ›vŸÆÑÿFÁø­ÛDüNÁïñ$IÎæ ˆ?(ø#ÜŸxTþŒ¿ˆø«‚§ð´‚¿áIÏàïeãYŒ¿‚àŸ"þ¥àY 0\~Á€™ÓbjiÝÖ .اyŽæ š‘ôvhÚœqéa“_1-‹K¸FÆqiÊÑwä´^Cót.kÚZFv\î"·lÓôÁACçQÓ,ÂÖ â9Ïã:zô­=­m]ëÚ5Û±ëI kÚºlFûÐÞ^ \Âø’7T°—(èç¾×¶åÝvì 5Œ ;Ö0öFœ [Àÿ¢Ôõé"LÏ7Ð×2ð[N»Íø]%¿<Ždz_jU19…Š]¸*©ŠS‚Ðj’T©ÖŸí¯U¥`¶³n?ÂMáºfA ×Óp7”z¦žÏŒ#Ì&CM‘PSTªá]ÐH<¢Fêƒ× ˆ M‘ DÇ¢lâ…GÕÈ8" arL¢¯ëÆDz^Æ&ó8éò–ÇÙ€ úN µT(ÉÊmM{ {Æé>Ú“×¥‹M^÷ „ég+ðH\L…ÖT%Iaî¡W¤ªaÇ„´é¢ä¥Ñc Jj×ïÅ¢ƒX¼);€%SXzË:ë#¾u¥JËéQñý8j*Ÿ9ºh¦‡¼>æ^œÎ_qŠê±ã8¥T7Áui+ji¥"ä¦\5…ªâúX9º:éû‰‹“µÂVLæso ¸-,&·Ñ»"9ã[H|%Åí.hG†ù¡Ðw§Ü,?î‚Ð.]ŠM²*Oã„›Ø5ª¼'Nã¤qˆÂ„Ð>¼¬²)¦ÆŠò»pîAhÿä}ÜWF«šÅ„ºáüB³”ê„ÄÕÔ˜ŸÉši$/¬Sc{qJ÷XŒ|¼Å7.\Rbþ¿3^_büVUnDçlìkJuš•„2ÚX”PâuÓ¨ŸÀ xú4‚¹F.êWÉSrd«Š>p¹àìi;¡øYŠL°gi ¹Ò·ÏÄiã—ïÅ+ò ‹¿’HUª¹MÄ5¢ÙÎ({Õ±W—k΋‘rË28Cr†Íøê)´”h¬! ‘Lœœ„™ëgñuÁ·VMQbÏù³Ân<õâ|kQ‚S幇 eŸ~æKbS^“ÉÃXKÕ3´'ykSµûÑ"<u‡±ÎŸ®;„uT Ú eÕͼµù’ÜD4ÛÉeyi.МWÙ••E2’­Ê @?š ìÉü—TÞÞIùNu aZ¿“*ÛÙ“4:‡6LÆ7 œ…l À"8½`ï^Ó8÷&ìWEªOsjDG]i…Bˆ™U,!ÔòA¢9|D?XIîEê"Y߇Ô4:|‘ˆ*RùhL„ýZ°ª¶ˆNžÚitñÊ}¼6HŠD8á§¾ã>~Œcu~·Ûèß±‚…óK,tóÇ[8“ Ìá\‰¿®`™S:Þ3“òƲYx‹¯Š¿¾ä˜\MíÆ•ÿ ›ŠËUñoPK Lg08CSKF¥9 %org/javacc/parser/LookaheadWalk.class•VÏSGþ†Ì2ˆ¢kEAÁÙ]Q“dQ ¢(È#F#šè¸ÛÂÊî Î.ŠÆ$¦Šs©\Ö\R•àú£b*¥§TyËÅJ*ÇT%—ü 1¯{vØÕ2EU÷ë÷ú{ýõ›ïõòôß°_†± =a¨xŸ½|8¨¡OÃ!nöh8F5ztúùpD‡‚£ÜÐÇ †c:ê0¤aXG;FÂäÕp\Ç| á_i8©£j8¥£#NëhâóG:6óùŒŽŒóŒg5œÓÑŠulÄ'|8¯áÏmó\¹ç(·’ÜJi`.I¨OºN.bÞËÚN>ê• S —¾Á†ÒÙtž¥†í|r’åÈ9tÙ¾jwÎäÓ™ÎS,™w½n ê¾´“ÎêØyJ‚Ü禘㪈÷NO3'%¡½£Zîáøš æô§½\~Œå%ôU¹ÞD'÷&“Ó¶—c^çáÙi›îá:Ý;+Q¬ñÉŒMgÒ”óØkqy]¾çëf2î5AøÐÿ%ì7@·[¸)aË+N9mg¦9dlg¢sôâeµ*ïqÑ·t–aYæä{)é(©rÙ~ReØN¥ûÛø¦ò-¢!.ñîí÷r“ô˜Pn%ËU&¡ê,-4×KqÝ•±Å CL¦é~¤¡ ²úþÝœj Òæ+›‹ÎH MÑã¥ÌPCÑ"´„Z[d;Ÿw§˜C^#{ýs˜gçEZizÒ‰›ÖWª…æG ºÞa³ùà'Åf©qâôTAç: KçÍD³J>êjHx›Vëh–hV¬~ÄFw)¼!úCû›¢÷QuõV´é>B÷!ÏUIóÏÿ 0ÔS>¦ª~j4š¢O ðõ#¨g@h¶DŠÏ­fÊðÕ ùª)¦'”P—QM¹ˆð˜¦RD¿¤i×èœJ'ýi*"~a7•3´—/#úä2Fy ¼ˆÚï°fkL…XÎC c.DInňU]­©+bípì ÖPS"¹`ÅŠ¨ˆõ|Û†zò´}ÃH¨KŽÈñ""â[-nFdq—„I(tÒC¼1'ÓI¿‹“ ØgqpÃØà¶7—‡cä¿ •ø ü3o,`O@Á¡< 9Î˰‰ #ñR‹Ó¹óÏÿ ¦ºPÌ¢€@6•ͯ@n.`ë dÌ"äæ"¶ˆ/ù¦–긻¥ˆ­¼R‹ØVÀ ´Ð@þÖ"Ú(ý²¢®L¹PR ½%•&©45òEÒêR"Н¹í–(T4Bß1ô=ÖÆüµøºëçªÖoñ%—¨ÞO,éò‘žÑ??Õ4?±½å›Û/èE[îa;ywü‚HÉ—M™“5åx‚öú¹õíEtpáúûá–aÊÕÿ¤-±3¡‘f5®.à?L¥”ŒTñ­Ÿ¬!![ …lK¾t€/_îfOè‹ ™7Ê$RþÐPƒN´L•5Uñji) 6䞈©™ò"bçÂö]Ä|žš©òëj%†·Që[$¦¯VÅâD¢+ÍÓ1²ÿüó¿*’W‘ª7U¿W0k4µ’ûeô¬e°@H–^³ˆxËȺ‹mÒ]¬ñe€ÿPK Lg08´âÅC‡ þorg/javacc/parser/Main.classX xÅ~c;Ù±²ÄŽI! YHdËI œ"Ëk[‰,¹’bh+ÖÒÈ^GÚ»«$¦PzÐzß%î =Òh!m²%mzQÚÒzß-zŸ¶À›Ý•¬Ëå˼™ÿóÞ›™7~à©{OÀf2àƒà–Vx5¼†Âk}ð:x=…7Px#…7Qx3…·Px+…·Qx;…wP¸• ³ÞIá]ÞMá=ÞKá}n£p;…÷Sø…Rø…£>Lá#>Jácî p'…»(|œÂ'(ÜMá Ç(|’§(§pÂ׃íCc>Í¿î¥pÒŸÏòÎ) ŸóÁçá |ÑÛá _âô> _æô~ _¡ðUùšøà ø:o¾A᛾Å?¿Má;<(ÀC>ⳃð]¾Gáûü€Â)ü¨Õý˜7?¡ðS®ûg¼ósþõ þõKÎô+®ä×|ì7üë·­ð0üŽÂï}ðüÁòæ1Þ<Λ?Ÿ8êϼù ïþ•Âß(üý ÿ¤ð/ ÿà?<áƒp¿ž„Óxš«8Íùþëƒÿñ¯ÿóæ)Þ<Æ›‡yó46ø×#¼y”7ó1§Ò$f‹wªšj]N Ùßµ@KHÏ0âËRyfšÊ$v[òŠªXé¿:2­TzsŠ6Ù›° U›ÜÁ¹|òá4+Xª®™i!°„ãG }ÒPòó±… ´,ŒÊƒ¹œ/†²H$‹‰€Fq½}¡"i%¸†ó%üqé´¤;ŠzLfY(È”T­P´²jí»;kæ;%Õ”Éd×™–f’ž•ʬ&+(†b±Œ41#™%ÍÌ>YIOyjJX)_4-iÂa×5‡XSLÊ깜~ˆÏgu#oö¸[Úã2kJží:¨äŠLò³Àd`“Ô“H“áЮ¬’3YW=º¯º¯„¬AKîÏKS‘‘i–déUÊ-£È’T% ;‚¢±Q rL”EceQ{bU~BWLÒtKJ+&à h¦j©Ù&ÉÔÇ¥Ä*3Rg3“JR a€4ÓbJíB·v–¥w¢åžtÇ-f9J¡`èCÅÐqÇ;¡Hë†ÁÌ‚®eÐ ®ñ›$EË”ù˜ŠH‡P¥Å&™ÓÒ„®ç˜‚H„y⤧«sa]E{`w0ãe†³R øî¹H,¶78,¤ªŸ?òJ1gI[º<`h8É©àHxh,œO…†åÐÞ9àÖ0––ãu¸j‰Žqžùëâ¢\oJµ¿²(ž$(­›ÈýcC©Ñ`ÛúÂCÑX\N…‚ ¹¡ãªÀ¡ØÈH,ê-0J†cÑÌ@÷Öûb!ph8O%’q982ŸŽçúÇ‘èy®;H£[‹ø_áé¥fË$Ç4L>ݘìu}Ò뺹wöB!×:*­ˆãEÉ nËj«+œÃÒECµfÊ•æEiL:¨ê9ÅYà¡)®Ù2fxªã¯˜†ëX[©"ª[ƒ|E¢:¸Z§Ì1ô¼k=ViR€ÿɲV$ç’µ8´gOÒ`L$ëˆ$’óFe=9_$ "Ù7ŠÄOºDÒM.É&²J =" ŒÆ-¨”õÕÏ^PПf¥Õ¬Ê2eo數e‹XlÌèE)m0^ ð:ÀsaŽÆT,šÜhEr½æf\¹XHc‘2…õ_ÚÂ)¬ u¾Â€@zE²™W£[²U  äb‘l#ÛEr Y%’KysÙŽóò}ÒÍw<4ÌbKH3[Ìåf0²ë뎛%fºa:¥ O[Ü>ébh¼€B¾Öf¡uˆÇ¬c!\Ÿ,#ÌREñ’êaÕìÉN]|©— ä ìHP ý á¾k Èy´Ïåœ{Z8sn¨Â† `b <| 4ëE„¯ˆ”²m7´…Ûš)ù%1ÕÄïåPà ã×G ;¬¢Ø˜÷ÖÍ·†rúžoèë EÀDT Ÿ m¬fU½`·:E‘T5cÞ²Zyn ,Z™†Eî¦F€º!÷˜C¯PKwGðló×ãÑŽ§V(Ÿáë)±]bZ¦óªCÝKT³|)¡Ÿýå¸ûÂYž¨ꤳýñXÂßHÍ–çÏPÍ¡RZ÷Ï„# ÖÚz–Ë+š¥¦Õëk‘i)FcÑΦâBήŸŒ°ÃÎTƒãï ¾ ÓAÌ{ÉÎÙã®3åD©4^ –“Xø‚_ŠãýE5—)ÝUËKIýÓF ßñÜwœß;áJVã~?íW×›$.(øœtòÛýËnzÕ!¾CÃø€34gó78ã®êˆŠ %×P5渫áìˆb¥§ÂZVoè눮P¦p£]©ä4Œ¶{4k“¸a \7ÿ-‚&þW ðì-CJøh÷ w;ÊË*wšÜ‰`ü‘ÛæãÐÂé".ö¨àQZ3ÞêQŸG—xT¬ÁáÑ¥m«™o¯é/óh‡GϬ™_^Ó_áÑ•=Ë£g{t•GÏñèj®ñèZžëÑu•Zë“gãsÑ¥œ›Ï5|- q‚n…É2ØÁ}Ÿ†œòñ­qÆ9åãHÉþ¦¥Mƒ0ÝÔÖ$sêô-8àô‘Öì›Ë'e¸¿€ y4t 6\kƒaƒiƒeCцƒ6²á° 36\gËÜ=ÏPK Lg08 öïcÚ!org/javacc/parser/MatchInfo.class=ŽÍJÃ@…¿›4‰cmÕ•®Üi7ñÄMA´¸sãjŒÓ:¥Md|/D|Jœ‰Ð»8—óù÷ç÷ó¸à('a?£Ç0À(å åPHWzj×¶¤’µn«G!ºóDÍ­Û´×ΘiS ýK[ÛöJˆÏÎo…Þ¤y0^u¦ô²b¥è“*vÈ„“Æ-Š¥~ÖUU..fvvvNF6›Ì¼Ì;Ff Í0Fçü”TVF•ü¢tý¬Ä²Äädý‚Ä¢âÔ"}ßÔ’ÄÓµ"9µ $3?‘ASªE& • À„@³$'æ30°jmg`ÜVÀPK Kg08—Sùµã{org/javacc/parser/Nfa.class}MK1†ŸÙmw]ÝúÑ‹õâɶâ½âÅ«èA(xŒÛXZd+Ûàÿò €?JLÑ‹6ùȼτ™Ï×wà”NŠ"W´S"ò„;Áì*öûBséLå„ÃËE5ÕsódŠB?šji+}uonœqv$Ķœ­³Y9sç>íõÇBãb1±Â¨·Ž]Wë36É„ƒÿE$)‰ÐùS&´Ã›~0åT_ßÍmá8ò3*¿€È_ÏNZû z»å³cbAw°BoD·+â¿a󹆴ý u}“Øû¼†N‚|ø#ä PK Kg08ÈÉвù6V} org/javacc/parser/NfaState.classÅ| |”Õµø½ßýfæÎä „I2Á·d–°iÐQ@T4„ E\“’Lœ$,®P©[­Z—¶‰ bZK­´bìb¡­v_^íëb»Ø×í½×ÍüÏ9÷~ß|“LÀ÷úû½?ÊݾsÏ=÷ÜsÎ=çÞ;|ùO1Ʀ‹/øY¨Ä$‚I&“19“(&Sl¢1KgbrV€}Ä8Kç`r.&Õ˜Ô` ð FK L’˜Ôb2ÍgLGDôm&3ÅÃÃÃXš…Éy˜œI&³1¹“ 1©Çd&s1™‡Iâ»Èo\lÌÇê,-ÄÒ%>cQrëR,]† —c²“+Æ•F#––à×¥ׄ¥e˜\…Õåc…ÑŒÉJÄ{µ4VŒ÷«à칦ĸָ“ë±íLÖJ#…P7úŒ–»Ìˆcc+&iLÖa²“ ˜d0ÙˆÉ&± ±¶cÒ!¬Ïè °•ˆa¥qS€Ýgä¤Ñ…•näöÚŒ¥-XÚŠý·Iãf¸E·Jã6iÜŽ$ÜÔo—ÆÄñ^ïÃüNì´“÷ùŒ»<Ãú4î÷÷Jã>i¼_÷#ÚøŒ0Á’Ʊò°4 ØfãCØòa,}K½˜ô!ôãXzKOb² «»±´GO!ñ{}Æ>¬?É~LžÁ¤?ŠÉÇ0yVÇÁHãÒx;^Ž`ŸôÏc…¸|PÒ8$¤qXG¤qTƒÒø”4>-¥q 9û‚aéei|FŸÅúç0ù¼4^ÁÁ¾ ãX?!/bþ%L¾ŒÉ«˜¼&¯Hã«Òøš4¾.oHã›Òø–4¾-ïHã»Òø7i|OߗƤñCìñº4Þ@Ä?’Æ¿KãÇÒø‰4~*ŸIãMiü\¿Æ/¥ñ«€ñ–ñk„ÿ &¿•Æï¤ñ¶4~µÿƤñGiüI–Æ_¤ñŸÒø/iü·4þ*¿IãïÒø‡4þ)w¤1,ƒN‚cbH!¤0¥ðHá•Â'…”Â/E@Š),)J¥'Åx)ʤ˜ EPŠr)*¤ÄDqš§K–b’•RD¤¨’b²gH•bŠS¥8Sг¤8[Šs¤8WŠj)ЈȞˆûø³XI =ILj1™&Åt)f ÄL)fIqÏ—¢NŠÙR\ Å…RÔK1GйRÌ“¢AŠ‹¤¸XŠùHÕ)Jq‰‹¤¸TŠË¤¸\ŠÅR\b(®”¢QŠ%R,•¢I Tjq•Ë¥X!E3ÖVJqµ«¤x«¥¸FŠ5R\+ÅuR\/Å R¬•"%ÅR´HÑ*EZŠuR¬—bƒ)6J±IŠ6)Ú¥è"+E§7I‘“¢KŠn)z¤Ø,ê¦Ø*Å6)n–âaq«·ùøŸ¸³òžŽLK¶5½*•ëÈt¬¿,³9ÝÁ¿†³ñëÓé\ª;ݺ¢Ò.h]Ì™'Óº°£›³’¶ì†Ì‚mÝiªoíioßFp‹;ZÓ[93[³iÈÚS¹Mœk¡¿ ¿_BíþT[›6ظ1µ95­§;Ó6íêtKw67‡³² âI·ÎÏÃMìÈvÌïjÉdšS7¶¥/Íæ–¤»7d[6}SOf³£oœ…\8/OumèÆf@[ ã.Moí¶q:Ó€~Ћ(\šjGì ³íÙ®L7`+o±ËÔO1ž ´e[6é–qÔ²"ÝÝÕœ½4\ˆlܸpCºeÓÒù­š‹+;R¹mKÓéÖ4Hát–d7#)Æš+€/-R9§a!€äRëÓºÅìÒkc6·~N°¥eZg*וÎM[º.EÀ-¢gꢬtgW¦-Û¡qÝÕÝ9Xtg Ú`¬iª —À9?—Kmã¬jÍɇ62­ö:#âM°Ž0‹¶lJë(¬§+½®§mQY2ÓëÒ´Šmé­„j/¹½Ô%ˆ¯9» HFxHì 5ÓåZ­ñ…«EœÉõeº.Ít¤Ú€À¶,.9È,­3в›iÁž\¶é–ÙŽ¶m aIk{ª»eà ˜D[ZµpXž’–¶lWONK5JׂL·b@ènïtpúÔG:’Ææì%=í€8›kMç´–ì }©®n­Gœ0ôkpJÀº€šAæj÷.Ú3ÐUT×\ ­ A£¡un`À…¹4€/l#*'Wל|Kw@ PЄ”q6£z´†ž ’Pºhkgª£9²³¯^³pq J´t™ÍÙÕ§Âbìü /VÌê…ØŠÔH(-GFU/¤Ö¢›zRmã®YXægœ¸…jÅ€++I5'sÆ¢T¤'“íÀ%\’Î9úW¦ø¸È17œM/›S°7|Yº›P¤ÚÒÝË{:š3íiκL]µ‚ãQ¬{håf ¡¢©³;Óž¹9]¨>fõ58ù‰v÷¼SˆB8fůY(¢ú¡…©èžë²WvA©ˆZ€k)BCŸÔJ”­Ow_šÉuu_jË´.ËM§UF½xq ˆ«ÄΗæ²í@qõÂ" ˜†T¢ºXñŽåíùŽ (ËÓë]T½ð¤¶ë¤‰èÃ[—Å€iž®§™ÉN#³´*–'GâYÙÙŠ[^Og[¦etÏ ‰j£mŒ”Í8·˜²ž(¬ÂéÔ}i1ûR¿xÍb ÌWV‡¸*²"´žj{ÊuçmPQPàBê^}%ð‰EÀ¯!®­(¾¥–¢½Z‘ß(@ýz‚ÍcüjóD×HOP­Ä­­Ø¨5hKÑ´Úº¯ƒÃý‰À£¢ÂNQ•.8~iOûé\Ó:‡Áfõ8Ò&Ø6š:ÒÐNÍEméö¦––\`o5. @•Áv„¼lÏv*£¼Ü º9 jµm°þ„kB¥Puû1œ Hœq_—$7ÑÅ×<²ëòtªÕqÂÅ…šÆ˜´ $…ì£]é™¶§!6[ =:‹-Í. .abŒÖ\S”×UHb¡àu¹u)Y] ´†,¥ìJ·­kÌfažŒ¨\n1ÕFyÒ¤¢Ò‚ÞœUŽ=/€W tG‹Ìk„™ƒS£§¦†˜‚Ý(ŠÌ¨l$̘“T8CD%î©j¿Õ¤6òÓÐY/þ$t99“´g—ÑH ²™¶tnYQB¥PlX•éÞàˆK âC<`”Ár:úíò…&4^Iާ7§#9·¥¼!‹oâmoÇ$‹I'ßhñ›xÎâ]˜tóKÜÁŸ³øf(ñ­|›%¶cõf(ñÛ0¹“[1¹“çñëþ^‹ßÉwZü}˜ÜÅï†éÔ‹ß‹8ÄaÂäaLÃäC˜|Iù&½¼Ïâci~ØÉ^¬>%±C¼×'î´ÄNl~[Þ‡¥rpn'½Yü{…Zâ.þ–%î÷Xâ^qŸO¼ß÷‹Xâñ Åñ,¾‡?eñOñO[ü0?bñ ßèYâƒüs–x“GÄ£œí%N’‡ÅÈ%Õ‚Ö' ~k4ÓÍ¥×÷´¥rÑôÖNp^ºÀbÔ–µ¥ÁÂDÛS›ÒQôi¢Û²=Ø! v.Ú’Íå€SÑå`‹Ò¹è– éúÞB~¨9%¢àÊB=ÕmIuD7€«ÙF¨ry:¢]éîZŸx̶øg`™ÄGD¯OôYâqœÁâI‹Jüóüsœ]½ g=R}0oáÂh}T“Ú•îh¦`2Ù\w4.ÔúèM"'Óþ™MÍ»{C¦«6Ú $mB‚j-±Kì›W×E¹Ê‹ÈÜcü%‹äâ/[ü‹(K'°ú–¾Ì_µøýfxÊ{Å>Î(×HÕ_гn]:g‰§Å~K<#ú!äID-ñQþUK|L ’$ž-þ þu‹›‡‚ˆq}·¢Ñèô­>1`‰CâhoLD‚éxnиmŽÅoáÖMÈO·µõ0C¾è'ü§à\a,”i‰®Ã .Š«²æºèÆ7RüeñTõ‰Ã–8ô‘û,þ4h–8 ÒÏŸD{ñ½Ž¼Þ‚¥7ø,þïüÇßÏßoñŸó_pvåÿŽ)s¢àÙÀæEŽD¡Dʃ¢×¶ ®´øßù?,þgþ‹ÿ’¿iñŸaò š—¢ÎöóÎÎ,˜1XNšp‡ãÀdo±Ä§PÚLd1ÌŸ˜ù6ÿ=¸ÅED,þWþ7؃œ?$Ûm€gFctîÜ(¸ hôA0ªÇ©Ö0Ñs¢ÓgÏ®И FÕé €WC­Ænhˆ^€À“ €33P÷ˆº"ÏȬ« qÍÄA]Ôm]·®ÆÆZ3ȩ̈̓ÄmÍ‚+çÔn‰ºþtMhÙP½q£}´&™Ì\W‚ èÓ(†à´Ä‹âA𨣅ZP¾@'ë-Ãkø,£”ÿt£>`ñ{P¿.üßI#ÊžÁ üéè¨?7â;Ç2¤á·ø°Á,ÃVñOü°ÕŽ%O·‘ã3ëò›7É®Á“h­Fm.m>¶ÕD§Ì‹No¬A}ÄÞå£Q3«F·"<ÿˆ6@¯Èèïð‡>ÓÀÒäüqÀUqA§ƒr j éÓÂŽîxü:B~îI7oÉ*¬¶øoøo9;ë¤àìv¾q šóPE¹uJå9çDÞL 3jeÂÅah,÷:ÝDW9&jKR~áçé…/2¸^9Ÿ8f‰—ÄÅÿÉß± a˜œ1´5½.ÕÓÖ 2ìàÁW¼ð'«3Hfµ]ó»k@¸ÇãGc¶™`ï¸Gef‚Ÿ~Ò?3/¹EæŠaYÕQÈ 3)‹”;g&ÀZ%IñîÑò]„´F]–èH Ÿ5ÌÉå;6F¯""^T¢Å|l‚Ý0¥œÆã”1¸èZ[ªÆÓ)ùU±ŒòŒ ÚÐs;s™ÍèFl£7f³`D;¢î•¬­Îo] ½3ééQ‘]@ÊÀ_a¢Î zB»%Ó¦·mÙ'9ÄæÒÝ=¹Žñ_(xsFØkÝ£;׃'‰eª1¯àpÂ…xÂšÌ Â=#/ÔZ9~æH~4Áššu)Ø òä¨?¸C¸É‹œ½å·YâeqŸ%>ƒ¸O¯ H…½V›³™Vœ–[Êq!Hž¤©Q[éȾk }¸§¨›jñ>¹téãYGJ :øä ·kjrÝJBÒ4¢—%‹kÁ»ÛíÅ­!d×ÍQìÖæ,ZM­ñ8N ‡€Ï‰¢úé0GK,•QFO‹Ú „ˆŠ~™‰_έÕE§{®=É<’"SBŒ£oÄòkÔÎù.°TŸ,ÎP‹Œ?k‰Ï¢ýq~À2ÊÑÕÿÿ¡Åÿ›?Ÿ-gHgþõƒ%>‡1R$OaW“†pY¶«Fé¼lÕÏçyNsÕ“"h‰é)ÝŠõ9ÊÝÑÐÏ €h”2Ñ÷tºcegwšj© âÍ S:Õ^{cªeSOgµ H8ydS:tç¶Eo‰:ž@!Hè&¥ºfjã¥d¤È‹'³6“­]Ü´hkKºû¢é@Ô½!—ÝŽR[=•ÑR}ªB4õè‰MŸ£ÔtÚ4²ä—j´E;²Ýt` ©Äÿ¢…ÏWHi}t¸ÚnKà©Ñm Ë8 íkíɇ e,@o"v<Fñhtg×èãçu#þ4&þµÆ »v›nÜH×°ri|‘0¿­ oÁ†âum ,€Á­ZG\¹«ÞôŠàôÑ7:`<.Ãwz¥¶Ç _ ù@ŽÕÅ—Ù•¹ßÙ¥öù„¿à¾[€‡xôÜgQrbJèê×}n½­«;ÝŽ/ùðiXK¶sèv±~Eš—lÉvt§2øÈ¦è̯~ôÌ›:õÜ p,ð(t¥z¿¨üà64¯@ÔZeµ‘Û=¹å‹ š)òÆc¹º¢ZäÜP¡+9Lº’òâóŠ-êµäˆ;vMy‘;vœnÚYýpµû‚|QGO;¾yPc‡Š~€EÚêZ’Í¥ó2T‚~´#<…yœµוnOu€žÜFÚÇxסV£sX©,=Œ(.ˆã•$»Ŭ¦¥ô¦:;Ó(u‰bØG5©Û* Î§ÝÑQ²é\ûËî¬ý^C¬Ç§ç•b3`Æ!ú>ùúœ Ae1’Ò-¼LΤì×cÞ4¾ÅÁ×èñجY ÇИÅi”tg/G¥U“ U_QtÞåEîâ_Ú¡ç’øÒª‡žX¦·¡IéTo"}]éî¤û¥ËU@ n“À"Øvñéˆz”eAG×Òú׫'3™ø€¶¿C³­Î à>sõ´g¶R}.AI…!©ðñrl K𠌱:æÇkd(ùñr‰×ð”wè<«óN‚“x/Oy—λyå›u¾Eç[ù6ÊoÖù-:¿Uç·éüvß¡óí4Ãë{Êïä;)ŸÎïâwS~Îï¥ñ^ R~?ÿåÝ ¯ö)HçÔùÃ:„r/í©þ˜Î?¤ókz>¢ó^ÞGùãTçx]Iù“º}—î·[ç{øS„¯æß>ÍŸ§ ^â­&åÏèù÷ëïÕ|ÿ–òó_+õ þŒ÷I¨­dÇ`‹Å!Æá¯abr“bøë`¾#L0?¥#¬d€Y”–R:ŽÒñ”–AzÐ1|@¡‡x˜™4È]±£lBÌs¬ä0 ÆøaVŽI&¡Ø‹lâê£ì´Ãìô˜q˜…cÁI‡YeLf¬WQ}2ÖÏÀ$Ц`i*&gbr&gǘ±Ú\ ó8ÌÎÒcGعÐV}˜Õ@;Ìâ6}ù€¦o!3à?Æf¿È@D²1{MܘW˜Ç¡+æ5€ óÚì6اş'|Xh„W2ÿ1v‘˜é{ÙŒXä›ñ–x‡¿O3o?L­°q3î4xÿðWbqø2SQÀ§ñdæ!ÄÁØPåÚcž%1‘±¡A6+ñ¼žÕQ>¨a£zV@ìéñ#ì¼>VBÅAv¾ÂÄ— ú & º@‚•e·];-Yç¶Ël†½èÿˆðBþÕØêØYæZd>ð©®rÛ¾—ùc•GÙ샀¨ü Y8æ9Lxˇê<˜…6W@B*÷^¨Ò,™kÏ‹h> £øUõ™˜@ë¼Tª\©"+ŽÏ ™Ä7=-¡êâ£RÈ´û„¼+Cž:3ä«óÒ Ÿ·xˆ¿¬%g®ÖŒé±ø3ÌcˆÑ?ÔŇöÀÒ Í‹¬6[çíbãb‘óâ‘óvÿQ0ˆ„ÉÀç>Ó÷ò×Ä\þì>6n€!içÌê5Òe³YÌÅõ>”ð4,U*•;Ê.ÚÉaÕßT_/^’ø›ÏY/k…ÂÎd)ôMÚ}g'ó}ëͰy”-ì†Æ°IºU¦Ê \h< ÷+h> pI,©LIÿp/X„K”pŸË«eÌQK_/9JÌÉt¢0LícÕ×gö3Só„ã3' }¹6´È‘ ˜æ´ÕbѤâ™(ðÇ™…™€aQ%+Žáâ¼B¬ ß“i-˜ ºnB~¢;|†• ²K_d—¹¼üeM §tÇ2U §tDz8¾\™…q1¬‚Ú÷³‹É2`uˆLR—Ô†-– sú¾hÆBÕyGØâXüë8Íá¥:„µT£Ÿ]NÚƒUk…ÂZac­PX+k%õ«:/®%û»‚ø§Ð€âS¹Ö(®÷‚`‚¿ºi2nK`§ByêvØ3l+ò~\¯Ê]ZRoŽ %?GØ•Kz¯½Ìí²°70 ç›@ Þ¢xU^ꀄ‘c%¨ô$pp¬ÐèÖ ñèSzs0𠚦éç°¢°¦ìû´»OŸ[ Z7w{ªZÈ—ÄûÙ à »Ùó8c(OÞÃö«…NP Rõ˜Zå¥P®ÔÊYc/Û‚‡ZÕ2P£é‚î'gè8[™ liLQÄ$œÒ6)ÿe/ì廒b}«S$ì!¹}• ù˜ãÀ!„¸u¾þá7Ft¡XwêÉû¼2±4bø½¬žº‰k§U°Ž˨bº+wÅ«+ýÃ/›ÖSŒû*Ø;oðz¬Ø1³^Ç^㎰ŒÌê3r…½‘™*xªÆ¢ žª°è¡b‹^** ²¦¹ØlÔÁ4ªï^v7Ô,ld[¶°·j&yëJ¬“¯±Jáźë—)äX÷b}6`2›Ã éU@šÙì;VRï û"j~5½°¯JÕ«´L ­Üöç{õ6ìDÃ'¦ ²›p7ÈaÒEmf‘6O‘6¯ÝÖ­½’Àë Èžo^]ï?Á–Àtè ÙÖ>ˆìíÑ·A—v3îg· ²€Bq„ÝJ8^ð™蛲Ûn:ìög§‡£ÓsGSÁLˆ©£h$Ök-2bóÿߢöþs{,ä98̶Ãg Q·‹ö_M&îEÑìe%@2_ÑÏþðÀ?NÂo3" áGFøOÁ#ü£ÐþÄŒ×cߨ‚ÀÂà ªÄyòZÿ QÄ{íÓ‘×·î:ˆ¤pë¿JÌ­`w’V'„$àNïd;{éôg;Ô¶²÷õâ!åaVuÎiŽÇTçÃ…݉¡›}põÿ‘j•>¸º2vœùâ'Л±° 'îs»±Í9ð=KŸín†…Žç‹D&ûz¿ à“ô óõ ççOÇ챆âCΰgTÄ"à7ÖæÑýV£“ø3*®؃^¯„ùÝ>˜ ñ3þ¦†joÌdwÛýœÿB»Â{`3—?:~¶‡%à ÃÞ}ÇÑ€¢ãÏÕ›•}ûAðŒ+ŒÂdtmA¹#¦„=İ9nL.yص°êKp„ê+jt ⤰òÔ‚ ö"`?U°Ä x4ì C6T«øµ*ê5¥²× mçî§ñO{éúâÞzOØ£þÒX¢“¿û+º¡oøÍuïïþ!ÀchcOÖ§I §d aß »ÿq=à7û‡?Œ}žÂàWÀdÆã‘Á!;W?¢æZ»FØê|Èš¯€1@DLÅy!Ÿ½Z¿tVs’^ÍqùÕÂuÒ«þ+þ–†;SGC§)/ýJÈÀóï9d8`Ø^â¯mo‡«¯*c1a,p(¸ƒ ¨ ²VÙóþ[ÝéZæeRsy0_[Ýx‚ÍÛ×졦8D²%†Öš­Mªpˆ=„ðq5÷ÎÛaÈïòz`$ô3bn,øðö( @«  Jýp¼¥°%aáfU‚êS$yúÄ´œ&Cf­+î‚/O½FZöñXð1°l5Kßæ¿wHPš› ®mÔ*º@#Œ£ÜGÜ8)’~"¹áï¸àì(®±xÈݬƒ·F  H»œK§·ùhžÐÂC`5ðœx:ø~ÁõÏc \‹ñ–²MË5êRVe‹mxué"rI¼*d6Uì‚ß^Eœ:ÍÕϦtIÿðw³¦–ÙJв%lJÿÀÿ¨)ëÃÇ3Ðy®*»h/›8¹ê–Åd^`:ÙØ‚û'§ãtÝñ,ƒ:^¼—U:K"3q jõþyÄV?ó¿èÞSõMŒ;· ØÐI{†ÿ±¥ÞàÿiŸ¦÷;+ ߮ΠÇé³Ðn e½'ðÆ“ã˜W}º¡±0ÀM yžf¥ ³Øv{%†ŽêMHÍzÝ¢~ê^;†(ØØ ¬Ì–*³Ü&lÿâÚZsm“„뤨óŽ{ëá€6boA VÀŽåm•¶Ï`døCQWBž2×”ù´Qm{B>p1ê°)l‘ÕŠ…J@7̺’~ŽÖ¾Àð­Mà_û‰l ù›èpçùPI/ÛhÔ•YèŠû÷±Éê« É§Ù¸¯®”ju’à’Š5I¢f7;ƒF •îf!$J4»Ç¦¾`HËíî! ü³Œ«X8xóˆ¹^`Q}ø€<_Ú •î,åPV¬üNøÃõãFñ2gÖ•åÙ ÛÂêú y¦ÃÁ°E\…µ(•‡J÷‚wd…ÊkÃA`àêºñ •ÃÁÐx£IÔ•í,‡á¾7ÀÊÂèÀeÃAT“þáûPˆð` /ûZ³Hxœ€My•iKæÙ’ þ`ä{GK¦y`,Y4w£Á'YyÍÏ¿ 7M XÓ)É¢³‰©1]½!¿×{`³Á࣬F°Ÿü•ÿMÏx¢öðè"ÙÎÂßù?4ÌMúEA:ïòŽt\Ò¼4PI‚J$ÉSN áÆŽ§;æ.6%9ä:t*KÀŽžqÏðÛæ4‚ö¢ü“¿£‡ß¨I¼]ØXðqØãûÙœJpP¡öÕ’tk÷Â^ŠŸ„ÆXp¥»)ÝCéS”î¥t¥OSºßqø[l­È€0 "'b°1,ÑÁÐRûfÁLÆ†Ž°gl5A§b+>iM±u”î.*§á¸J—YìpH†|{Y(’µhétQâÆ Æ8  ].O„ð¿Ù b† €Á¤'ÁòÊ#l&ˆ)ßÝÉx¾Ï$éh~GR؃'ñà£ö¸³}6Ý~P¼¡»Ž$I×ü¤}»Q_.!ø‰¾;ðeÊDŸnØ1ÛK cRÔá‰>Þ|Cu‡öþáÛæ¾ÌÄŸ½ëÕû¨v žˆ¡ó½Û}Äë;³|ƒÙx!N­q‚ס¤ÚŸu×X<"޲›ñ°¿ ô+vÊGÙ/õ ¥¨à/¡µ{1h.ƒÜS Ú¸¤hª­dœqzËÀëqýy½?ØŒjœ²ÛÊ3ÀýŸ¬Áõ °r¦-`ñœ)O ù`)MÚíë²²’$~æ`öÜqûkÖ}’4l®÷“÷»‡¾…ý±Hò({¾>òõ)øòp ØLÇûàFDù`”[t3z×hCïšXƒ3+d`7”0ø;3ÐëHÐö¡Ú™Ý¦X?˜‚—(8öDÙ!ðxFŒCÖ•  •â ÁžÈ÷2™ •šÍŠ«–r—aWW—:ëljºñ¡ñáqêb*<.4Þf6z@.–Æ"¡ñö ÈÒÎñèi/ŸEHKq«ßa›jó–ãm’.P{|©ÞVÓ8Â7¢¼Åiût¿ã0ð_›P…ÎMe/Ô™_ÛÖì“ùz/½ûYñ¤ÿR,œÑGï“ÂÔ¸Br¯–-ÚÎÄ7B“érðŠ C¾¿=H-æ€{”V°Ê»Ueƃ}jŽ£hG`]ª $ íg\ËUÁAHÊ.Žly×âÊ}ÊY¹~V²~ŸVÚHÑ)׋NÏà1"ˆî ®wSæ_‚ï6Z4g«‚C ÑäÂÑ a^vÁ|&o p ùûö‘__dë½¶·‡½œýZ°ùf/«.ÄÿY”\bÿœkþg}ÞúŒ è-ß³‡ÍAÌu…^!N öª@Ø=Î3ÎÒ~O¡ÄaŸ ž ¶Fñ^Uˆ÷¸:yF\*žÉ^ulµ:„Îîd‡Ø‰8 CÎ*ÄöÅ<6wW•îe Ú‹ ëù%—šIï”Â|K½u0ß@¥è%W:jëmiê;'­&¼ÕÄ«ÕÄ ûö³¿áªÉ°jò©‰Ôä ÌójòÕ§—…ú‹ zQAƒ*õ}UyAƒ’„ìãýXˆö±H{Δî¿ö°õº»m?Kê–ãìJ»ñ8=¼rƒ‘«¡Ìæ‚-Ú Í%úèïüÊ¥Àn¾½Àhûø²½GÀ€¥¹Úø¿œ×ÇüI—a‘'7àä’ùó»Ì_ Ðüùóçw›¿À(óç7æÏç˜?¿‹JÿH*‹J°v>vÀÃÙóA>|:{dßC×…‚œA0Þ(ÍæBïÒ3ÊÄ…=4Þ¹mbÁïP$÷]JÿÍÅÖÃÒlý1°ã¹oúô&^vìÆѼO ¯—ø&l¤OÀøo®AÞ¹YÀWÅ#)Ü·½y_½¼ù„¶Û˜‘7/ ½yl®—£ï§oà£ÄMÈÛ§àËÃþ‘Þ¼F¹Y7ý§öæ˜  7ï)êÍæ·½.Àw ì{GKN|I¡_2‰/QN|"TN¼fãyc²TÑÅ8pÔyÖ«ø¡¸‹Ä¹MGp¨§.ÆÝè;Ìs¥Üè>K‰…Íýì <:A/a>@.$/Á$/!‰y•Ò‡)|k`Žv¤9¯__%õÑQD#ý´ì8NÎëؼ±-ßWVy‡é\?"³~€vä‡.«6ÕéðºêP…`o¸*Úú.+ô‰ƒ?:ùŽóï'ñ„/w¶‚†"[ÁÒüNИ„ÀŒô²3¼?Æe7Gšæ¼Eý‰óÝmý¿›·þ³Ý4ü§”ÌÔäh«ÿ¸Ëê›x5 VßtY}àktðý eÛtÛ{Ï({oŽmïóžÅ›yDî^…žîhç6ˆÿ$švnU×·æ=EœÛ†#þv…=ûÙw”•ÞÍ^ÓfûY‰ì æZdTõ±Iôt„ÈzÌÇÜp\ï@ù¢Î{´Ïê)ôY=Å|VÏ(ŸÕãöYmÃ?…!C^Zè›>É>?†'j’š]Mj¶L©Y.¯fëßšýœÖm¤Ëš(ªp¿({ ÷ÍöOÕ›¶,|Žˆ^ND7*¢7找áÝýËQ>¬ã„UÔB(¸Í…äò¦ÿsÓÖ(íX£5ÅSOÞP=òV¹ýRÓñK½cû¥¦ã—zGZ¦_æ-S}•Û-5·Ô㲞Ñj¿Ë@y1„åu(_•Û+5¯Ôë¶R¾QVÊûn¼RÓñJOztàöCýøêh‡I¿å3 üÐFå‡.‰à‡Ú?̪ˆÙ¿Ìº·ú‡ßrí¸?y{†ëDœJ`}^‚rFdpFŸ¥˜|ËÝx.…Uð›.Ç\û wSÿ¼º…ª1#Ž^“ÇÞ´'†=ÚiZe{ K]úý™¼z1DÔHïÓí}šx¬ü=Úñ'å|ú Î3ˆKõk¨zÒ¡éþŸ6= %×#©°ë‘T"v„ýšÞAýL¿…ÇXQ¯O¯úÁ)ÿ€#¿q)Òo]ëû;Jߦô÷Jµ@yŸÒÊ»‹}X½MÝAãßç û­È‘EÎsa€~B´#b®u@á>z†æ(Kð6ž@mþèRØ,ÿ„[>´¾)ü³"uûqÖ‡ÙÐêy»ðÍ º=âi­u –óö5˜Hÿs¹Û#fAÏ™NÏÿ²{šªç»8øWJÿF©"ñȓÛãÁ¿SÓ?(ý§+î(w.×i Wêk˜CÌ7€ÿs¼Bš[©ž~$bβ+ÁŸcA?žô%$ƒï,|S¿q1*YØ Cà?Tî¸ÿƒl"…rÎì£ÖrÎ)5ò–ä"VÎU~¯*¦Ê<ÔöJq^§Äë×§2©2ÿ»Ç«DeV ö85ªÒ1É7Š,Â8ÀNô²¥§Ä;~4Þ2•MЖˆ-ü§`XK!ÿnþš™ƒaóiæ=?~”×{ÝΟOŸgò¨óLþP؇?vå÷Ð9áq¾]ŸFLüµ¿É>>¬—x/ñöœ_K¿L‚ˆ–AkêîYæ÷U|“O†–'#*æõC°öž°¿ªvu]@YÏK´‚›Cð!§aŽ6úœx(¦ÙußWUçÙiðpI½>™ÍvÄÔöÒO^±G¹³`”lÁ(ˆ´­Qƒ<Í–ëQ¯Àü¹là¯2šh<Œ©³ ûCžÚ&LCVS¸$ì=Ìž {Ã%áS¦Àýl>t«MÈÌB&š.>&”0’h¦~_AöKlã?ÑVNó 0Ô°‘šñ%l:OÕÍŠUjlXµÂùW+è…  ‚yŸS°ÄŠ“¨T˜ÒIðJ*GF¨ŒØÇ&€vU9Úup€Ã¬«AÆÎƒö3”òEU6EeSUv¦ÊÎRÙÙ*;Ge續H9¯FÐ*„Åå¼Fe`§oäñ^€J®ÌÉ÷OÒÊñ%k9¯ÍOp¥Ó)áF<³`øY¸!Näça^@Àùyí@×¹¡?冞­² Tv!fb×CyŽjšëúb|™çú2ÈìΠ9è…*»Xeó z-sbzØ…63ãùN—Œ9Ô¢ä—:‹VÎ/Ëïö¶t”B‡ËɽÀU[ì^Â+º+G‚7:àKþõE¦MÔAÿ^@ºT Û”ßÅÊù2wå*•-WÙ •5»!Vº·ì«U¶*¿e—ó÷¸>ÙV;º£þÝÛR温ßÖ¯u¿ÐZ€ŠŸ>à¯o=¨4ÍuÜYåÌİ5İ{ t-‚Ì‹Ð7ê BdæÒä vVž…×{"´`׻ܿ91úòˆóøÌS<ü}:Ü@ÞT€ÊZ¬ =»ÞýØoœîÌð€~‰»¤;%æŠyÐëFšipÔL!„áA £³’]‘}æ\hªÒ³n!ªñ7¨Áµ6ÙôúLW¿U݉”ïì#jÅ#ZÂ)ñ4ÍãUZ•Ghy ò°ãG~‹ž0vBbÚÿ ü½yä? ”÷1’ß)Ý©}ŽC,à”,§Ôã”Æ;¥R§4Î)•9ø¶L0رÀ!v{9_wˆÝå@<è@|h{þžàŸÁ­.ÙzØñlv’3ÁÃz‚sO'÷1!$ð:)’ý?PK Kg08;ÄbVtz#org/javacc/parser/NonTerminal.classuQÛJÃ@=ÛFck´õÒz‰—Ö[Û Ä÷ŠŠ‚ˆ >ÉÒnk4Ù„m"~–‚ZPðü(q¶«/3gvæìž9ûþñò`•,F1kb.‹f3Èb^[/d±ˆ%].kT2Q6±Âñ¯:gá†É£k~ËÝ$ö|÷\4âPÕ ÉñÕó¹l»§±òd›z9®ÚI d|÷¯0"6ÖŽBÕv5£Ñp#®:B¹Ç¡ ¸Bý¤{¡$þðŽ'½x—!]­y?lÒSF3 "§zøCÏ©ˆëµ {I«%Tݦò¿å[°0f!¯C3&V-¬aÝÂ8rm0,þ%Tž x’û ö`ÿà.â²C0ÿD›ñ(’œ°«ûÿÊfجÚúï8ÊÐ? `z1BLoÒËù~=IÊ)Bd ÅU¤ ¶Ós^‘ºè"ýã==:¹Ô'•‰dP.8öfÃùÒ3Lç#ÏÈoÝ÷Æñ PK Kg08£‘¥ò(org/javacc/parser/NormalProduction.class…TM[U~o™dÚBµ(«É44µ­Z¥ÅZ¬6  ‚P†ä& LfÆ™›Bv.ü.ݸÕç‘ÐG—.ü7þõœI ´Iq‘÷Üsæ|ä¯ýàvuœÃM êˆáf )Üb˜aøˆá6ÃÇ>az‡¡ÄðiŸ%1«cóÌßÕ° cŸ'ñÓ²NÂEþü%³K Ëë++Xe“{ƒøß0|Ë욎uX¬·¡¡"plW ˆ’À@Åsš W@ó­@º*ÈÌnY÷­bSÙNqIV”L ¤¬JE†áœW=Pp,·^,«Àvë¤w6Ù6ª¸kªåË5åmK—„£äÚjH%ƒ5ÇÕ|PmÞN )‚Üõ-7´=JflÖ êEŽR©É:”Añö“ÏlH6|ÕZðÂÐÞp¸’Uެ©%rþ^/ó^аœ…À«6+ªãLsdÉ­Ê]}Çr¶ËÊRM2×kvªEÎUàLWÑ'ncèÅ¥çPS¯Û®­¦‰Íå—¨Ý3^•’ԫ͆¿ÈšM¡²¹R¾§·šµšän'XUÀÌ•ŽÌ¢,ÕÔsm ¼‡÷ÒÏŽÎÀy¼aÀd¸ÀP`(â’Àkÿßoá²+˜0pÜdÚœ‹¡ä‰’wê¼®¡j@¢fàr§û'ÈùÕbãã6a¸Ž¶°Íì Ç@®Ï€ï ä‘Ó@v!”&Ã$.j¸o`°ÁΓr£`w7¶¨à§DåV¨dƒö¬.ÕäË@µ®åz×·WÒÛh æ9`ù¾té }\3Õ´]¥ ³UëŽnvvbô¨‡N Sù¯ÇÌ1Ž’TÐ mmé©ÜQ½HH 'ŸÑÅIÙnøŽœ§SÉõ­pè©u£HÏU–]q¿TéîâV•Z‘=æ`.÷6ª[Ìs«¤ÿ³ý€4hU1A/×# Þ鈹ˆæ»ÔìÊ/ti¡Kis";ÚûˆÒVGôJ×ßÕ®ÿ·ñNDßh‚7šhœ$t]„SÄ­G<°hîC˜[ÙG|‰Ãç ‡Ïçf$Í´þ;R{Йd0ÌÌPæÄœÜCú×(›G7Ú$EK=÷Ã+Ãø~™¹øôXö'¤ ™SmŒ,ÿ?ÿûwá—ÈTðqtMkdȦ«f¶QóN·ñbz¼—Ì6δq–¬;ìo ‘ù‚ù/Çð#òü‹a™¾¼ò'ÎNM“³ÙÄz¡WÛ_žìÄÄPK Kg08t è‡!org/javacc/parser/OneOrMore.class}RmOÓP=w뺔) N|Á·®tTÁ7ÑÂ’é>`$ñ“¥»,ÅrÛtñ¯ø/аýàðGŸ§lQ²Í4=}nÏsNîóòë÷Ÿb£ˆ ¸¢ã*®é˜A…£ë-2ÜЉ½É)·J¸%†;LÜ-âî3<Ð`j¨ èòs䪎*ÅF·C÷“ëyNäÆ;ÛCº.ß𕟼ÈšÕw¹­°%ÖÍ1²·áG©êÿõK-ZÝ£HÀ2wœæt?pveR¯žWµÝ$öU{³{p ãº2.i° ,Ã6PcXap.bÖ ö<20 «ÖðØÀ†§x¦á¹u¼` z*£×k*ÙŒ_‡±ËnÿíÕ„š©£û²í«†¯ÈCìPA–Òß[aÐ=¢¤¼7 H,U"Pþ§âæþ¡ôºáô¹®¼P%®¯:s樠úžfã¶Z„2 Î{žu‘<çÇw–®âF‘T$¶ÍQÝĬަ¸‰"ZÈZO€ZÄC£(K–ð2fS˜²N!¾ijszKL[Ë'Èôåo®G»‡¼uBoÚPKû0оBŽ`ͪا(¼±­ïÐ3ø‚©Ú1ÇÅ öjßPêÃ`“JîƒÝG¡é½Úqj†?PK Kg08ÏHÐ6 >org/javacc/parser/Options.classX xÕžgKÞ'y;²•àÄ$ŠsÉ’œ&8 ¯åD±,¹’œhkÖÒÚ^"ïi•JJ[hi ”N¡¤HÚæh‡´= Ðûné}Ÿô¾èEçí!¯ìM ßç÷öÍ?3ofÞ¼y£<ý¿‡€õ¤Ï Á‡8ø0ñB5œ`ÃI/(pÂpªNÃG9ø˜<0ÍÁ/Ô g9xØ áç¼Po0œ Ÿ ðc~”I>Fáq Ÿ¤ð)Ê}šÂgØü…')|–ÂSž¦ð9 Ÿ§ð _¤ð% _¦ð _¥ð5 _§ð ߤð- ߦð ÏPø.…ïQø>?ðÂffðfø!~óá'^X?eÃÏ(üœÍ¿`ý’Ù÷+ ¿öâü ¿eÈï˜ÏRø=…?xáð'þ™Â_(üµþ§ð ÿdòÏQø…3ê˜èÙð?J‚XDŽÆÌß‚Q…q±€±‘Ä Ãäž’œÏY&7Z„JÙ&$Û)¨§h‰0iQ™ 3°O-d¥¸hR˜VA˜P]I$k“Ä츤S‹†‰ý’4ÉÎTPó¥ Åpnwnÿ©PÔ…ƒŽY\gY=¤IJ®h£ô‰YM-ƤdgYÒ0f½rA2‰õ–>YídÉÊ*‡q{J£É‚ ¼ÿFå °æ®¦U<èöl^/YÆ“føÀ®„Ša*)¹è¡¬d&ðòY–„ª3õJ£KÂ!ž\L–ó Â$GVð$@VbàfåbŠ&á ñp=ÜV˜µŽ‡WÀíèã\/,^½‚î‹ãXhçѰ’òp ö"àÑ{âÉddW4Ò‹–‘ž¬"¢Å®dLˆGzb;‡b™}î¨Ð×3™ÙMͧפ3‘LLà‰›¬Á ÚíÚ9<I¥£)žÔ0ZA+o‡9nP2Éþhbx ’ˆìŒ¦/šJ%Séè`2•‰%v"ßîÈžÈðP"&${£ÃÑ´ŒbRY„Xbp(ƒå7¶3‘LE‡…HQßîva"[éŠ%œ½T¼=}ñÈÔÂX'Ó“ÍvNêY§ÙDU”G£åÀÚ2§|caV$0)±²R/ˆ%öú¶Ù_ˆÌxA=(Žà³ÒêHE#+Z[4©9à…-W0Æ:œj½Øú¢,G= ñy/RkÄÉI|Mç8uÞnÒˆ,Ê- @Û^À¹9ìTS­'ª&/)cÚ8{±‹‰h†ÿž—t] ³ÉÞQÖ]Õtz¢k5uÝ+ìµYUÑDY)öK‡çt’–‰Øã-ŸŸ3¬Eý}f9qи5¬1½-;<[ ¤ÙáSËôÓð XÌá1xŠ¥‘¢ ?zîÔ q²’“%GØÄ*ŸúÃEM¾¯Zeéâ/7>ƒ(«M!Ë2êd«×ðŸ…ÅÕ°—‘–0’»‚tÑ|®¦S°tvµì4Ï®.®X-¯X­¨ T`++V-«U«Õ«5:×V¬ÖUp+°Ö ,T± W¬Ú*äÚ}³‹NßúÙÅ߯ÙÅ&kqÒ<¡×ÀMæAA5æ@ìlÆÓدÞÑzä>¸$Ô¼1nŸ†®½áúÓpÉ^´ƒk×z¶îE&Wî^ð†ëÛxs9þüSái¸ÔJ‚×–³*hæJsè h MC·ë, UOöúö£À¹Žƒ«ú!S ÛSª «Â¹;äÛ> ;¦`#j¿ì\þ$Ôù®˜È¾Ópùq¨Aʃ°8l$êx|=q¤ú6ÆÃ–%¯‡7˜éX‹:kö<Ú,t»Ð¡&×Yè­‚#™ðEÑgÄ»|}8 C3°ó¤É‰¾w»ÛÚg`W¢ÉýÜßäF“0F—=íƒg 6µwëh [ c¨™¶úv;jn`šû«`ÊfCÜâ°súÊœ­MnÔ˜8+Ê"IKdpŽÙíV轤j6 n[ÀT­Ç 87–…¹¦!…¡t‡âz¤»\áún6»ý®»ÁëwwÕ‡•~7ûv±o¿ßåwßg­8Æà¯¹²xnšҦ‡z ¼˜Â‰ã¤­ívƒÕmúž‰£°´Íž’GYjN´atSÇá™S±¼BçB¶ÀLÞ“ájÍ4ìe»„ý5®kPÊw¥ž2ÆN0U&ï³ÈÍH¾É"ÏÀU]œŸ»Zl;]í°+>~«J÷vs–|=ìö׸¯9&m[}ËQXf€+g.}aÆc‘ö&Ê!9R±±“‹+K?Ž¥[‡Ã/h.fL›™0vÖ—9°IͶ)§ “5²¥ žÅÑax)YN‚lÖ³çå÷‡]Uö¯{^>]30|Ö£ß2}÷#ì8ÌÅPß53 šµzie]zÜfêôé%ð&7ÎÀˆUÞì€/±áoqÀ/²áo…ÛçáM3µð;ðe6üNübþ6|¹ ¿Ë_aÃßî€lø;ð•6üx‹ —¾Ê†O9à«mø| ·¾Ö†ß퀯³á÷8àAþ¼Õ†ß뀇løQ¬â^QñQSñq÷©8§bŒwŸçãeø&x˜TRq¿ŠB؆)ŸäùSìÀÙÅK!<ˆ‡T|ZÅgT|VÅçXÎç|!„|QÁÃ!ìÅ—|YÅWBد²_Sñõ0¾oªø–Šo³Ôï0~TÅwÙïï©ø¾ŠGTü€û¡‚)ø±‚Ÿ”•21mÙîXâ @±“ð\…‘#Æ1£ÍtÚv»¦ííwMOºJ7™¶ém(jlÚGèv'&JžázáŽá¨Œ{¦c'êÊNÂj°á(ø©†ŸáQ GpTÁÏ5<†ÇV:î@+ŠFÛ↛n[—ôŒÝLΈRð ¿„£áW<üš‡ß°¨ß2õ;¦~ÏÔ˜ú#S‚#PUÀEîÖd¿te,³P™YØnZ2ÃÔr™þŒ¿d$X†=ÐÖã‘è@’†¿â OâoóÛ)ža{‰Vkø;þÁaø'ÿâáß<üGƒ…¡K;»gœ¨nw’VL·OwâÒÖûÉ]`i¾l½ßqõãd.Òªá¿xJ`AÖÂ×uÈ´§1­Ññ r-é™VÛ>õr²ôFbµ·kbž(¢smkÖ5Q,JˆÔ›Û4QЧ4¡°k"$‹gŸÛ稴5Q&4M\!ækb(×D…(åI[s3¿ZoÖ} nq€ K?fXI™Ð ;¦Gg¸ž€;¤MOÆô¾:)l ¶ [»½Aéò¹$¸ÂOÀÆ&Šx²Ï2£:¹tû(Ǭl&fúm”ÚºÎÖtJ§_g ­ä(šÎ›ôŽîíúf}ýFMT²ÓU¢Z 5±ˆ²K,殘íüMr inÇpÜ•‰„|õ–Y+zg,PW¨ÓÄ<Á±ÞLd EOŠ+é¬HÿR<ªˆZMÔ‰z y /"‡Í(ÅÜñÒv§5EÒõüøq 5ºdê¡›ƒÕÎ!c@’B †¦Ó§a9½¥¡EË0-°|ŽÓÝí:±d”³S:ë F‚}í‰Ë¨&–‹½(0'm±€âq¸A+¨†ÄJ±Š2æpCC‹"Vkbhô£ÅvR |;›D³@'«“®>`#yº7h&¨`ìu _~:†n}Òò+¥Oz¤S—\º+㎎X+Z¨ä%Á6Ê£&噢ë'©õ‰“šXÇeÙlò’± "(²–ÓgXÔ×Ì…ð{Ÿ;“°tz´eZlÅ€ôvf;xrÈö3µñú¹äû¶. ­½~z£NÒöüÔ_ oô}óÚ½~2t ¸¾(êœÌËoÙ¡ õ7Rµ—û ›’¶•gEeXi`û áRŠHƒšã|†å2ª ÄíµÍ(]>‰¨—i+|ó±vo9·d.›°^wÒ‹'½m¦ëwÁdOcS$·ÝÓ‰+Ñd¯m ±ôÈå]ŸïB#N9&ÐÒ8{¹i+¸'hŸê9‡ lœ#ÄŠÆ|S ˆ§Ë·â2󪳼ôÝÉìªYlæÎOÈ!J23$µÆBŽ0ä9޵‹"‘˜ EÎB—D-Ç–—ûÓÝw„´6b±KIγ<%i+)£SéŒe"s]cŽžˆ™ð ¡Pì”8ß÷åÝb:>Ïé5mJ)ÎÊÞ¸C+½WQE'Ì[ÉÚ lºÁ·ª³ éÅܨø©4ø’ý”í‘^2.PÛ™£Wú…³®š[ð]‹, ¸†i‘síÎ[KgPí¸1~yñ³3Öë7,b«i¸kdÂ_‡â»”‚@.-,¸@þ ‰.Ç•3RÊl9ìÍ\‰ßG)¤ݴ¹q/ÍÚeyΕº5iZ±ü*_2; t«ù}S³äpßl»üª«:Tè€C®¤Æ¢” SèV¥«†L-f®ÀªAžusš|’‡”™½Òï!$dõÿUÈ3¯Q9<êò–¤ßÚ æ÷A.¢8µu"J>W.dïXNåã†kûÂ×Y¸T¹ËéoÁ ½x™˜‡¿tÓ´0¿nÒ\D|z'§1N¿*h¦w4”4OBœB¸…–çñrÑE”A¥ù^±3…yçQ”BñʦPr`¥SPRPS¥á±lõ)h>}Å(*S˜ïÓ FQšBù*L¡’¾Uô­>ÂÂ),"Q‹Ç°d5•WÒ0¥“¨D]…ŽIÔObÙyè£hФ¡• JãWøVNa-®¾8†5h¼„&z"k+›'°v zfk á×T™Â:þÕüš@ÛÖOàªÜEDÑ®¾„kÆqmù¦3Ho® VÏb€ˆÚìªqÝY<=)<£hK]í=¨'vÝ {g3•Âu§ŠÄèôcÁëi¬|¦¯9˜G:5ÖïÎ]xVzÞž7¦çÖ`Î8º)£Í9.eålIÏÏöççLà†]ëîÇVtÑ.p ۺё/y;‰kÇýÜ€îœÀ•;gÔŒN§2š(/NcO ‘ì¢8Œ¡ëÂYlâÕ]³¥ÒjÝÕ±uù2ý@=”ë@wzÞžŸçÏ7å:òHÆ‘z6×cφ’šÂl(­)M£îcʇí¥gƒR£Œc_W˃Ø?‚õ9&>Ÿ½„ýã ¼=H›z(ë5b¶ïði¬ÉÙxsNÄ^ƒ¿–˜½ãxái„Z*úröDs"›³g:2:½’½]vœ2˜'ÐŽêy;îÀÔ—¾ÅÄ)¡²NäU=J•VPõøPK Lg08H¦i‚¨$org/javacc/parser/OutputFile$1.class;õo×>.vVvFÎàʼ’ŒÔ’ÌdvNF¹ü¢tý¬Ä²Äädý‚Ä¢âÔ"}ÿÒ’‚Ò·ÌœTCFFϼ¼Ô"çœÄââÔbFrýœÄ¼t}ÿ¤¬ÔäF|¦0(Í`b€&f0ÍÄ\@qF ‹PK Lg08ºvqõ+93org/javacc/parser/OutputFile$NullOutputStream.class…MKÃ@†ßI›nmýì! =+, ±‡‚O!.º“°Ùøñ³< üþ(q7¢ˆqaÙ™yŸYÞ™·÷—W»XuPCßA}†y†EBã@ÄBjîÖ9¡>J.9Á¾—Bé—¹G¾oçø!ä©Iœ1,iB+Eƒ«e†em?޹EA–ñŒ°éž&òÊ» î‚0ôÒ@f\zã\¥¹:îí›Z“ÇX]s%Â6l4V;•}gyMÓ‰’<¸%t—¦Ý‰÷³Üÿ,û㯉ëÕ> kU6ôZë0dže†Ð»`:ëé—LuûÖSšhiÈÈ}MM%§H 3ÔþYAÿ ã¨WBÆUº)Á¹ÒS·ˆ-Ìb £¦g€8PK Lg08sHÔdØ7org/javacc/parser/OutputFile$TrapClosePrintWriter.class}SmoA~–—.\×B)­ XQ±ÅÒúV-ÕÆMš´IMOXàÌõîr·û‹ü\S!ÑÄà2δ¡R¹;;óì<3ÏÜîï??~XÇN ÜÐÄMÉi¸…Çr·‘縣ãn ÷|[ˆx_à ønQC eŽUŽ5†Õ5¼Â:ÃrÃv;ÕOúg½Ù¬:ºëI·ºßSNO½5LYcˆžXª+•Ѥ¬mÃ2Ô+†Íâô´†T {;T®Ôk¥#†HÝnI†dÓ´=yà–zïJº á¢G@`)4ªYd8¨Ó…sνý7_šÒQ†mql<Âc†¥5u«S¥j†ÕÙíµÛÒõ92T®n÷ÌVÞ²U>àÏ <ÁSgØäx.ð[5lql ¼)ܘ¦¯ðÎÕú„‚ôÕa±gYÒ­›ºçIoLÇ¥CÙâÿg–›Ö ‰“~â)yL³”.q.6.•1ÒoÔGZ-†Ê¨èØØj¥‰Ðp’”iõæ.hGWDŒû ‰ŽT¯?z¶ÙSò@W]Lq’•òbÊîÿʰSîøži‘”«:=BžžC’^CÊ¿1dàaÚ¥±Hëy×¢0[^ýV® : Ž1‚2£CódÙhy€ð9œ½€w‰!Dv­|ÖGä+Vß0óüñT¼ÍGÎ0Û‡ §k}Ì”¢ßCZ5² zš„þPK Lg08€Êð "org/javacc/parser/OutputFile.class•W |åÿÉîÎd`²€°€2‚ÕdsP”¬°\±I €+¶8Ù$‹“°3+`‹Ô–Þ÷]µ‡µµ©­mEÍ.5Ö£G´ö°wµ‡½ïC{ßâ{3»Én²‰6¿ìû®÷½÷Ç÷¾oyúžûœ/*HàU2^]‡Ëñ&¯eò:&¯gòoÄ›$¼YÂ[(x«‚:¼MÆÛ¼ï”ð. ï–ñn`r£„›$¼WÁ"¼OÁB¼_Â,Áͼïƒ2nQð!|XÆ~no•ñ^aòQf¿Å~L!Åg†Û¹÷ &Ÿ¬Ã§p‡„“ ðÜÞÅàî–1ʃ¼‚FdœböO˸GÁî•ñ÷±¬ûe<Àíƒ2>+ãs >/H—ñŒ‡yôE (ØÄÒ¿¤àËø sUƣ쇯Iøº„o(è`ìÀÍ<ùM ßRÐ…oËøŽŒïrw„µ?ƽǙ|‘}ŸyÀ½JxBÂ$üXjG&cfã–á8¦#°°'k Ç-Û1weÓw_6íšY­;gY;sîpÎÝãfMcH`~×– tvto=°kÓîžíá΃Æ5F›edÚˆ+X/07ng×ȸ{ +gNÛ¶Z fø°ÀšN;;ÐÆû“ɶa#ë˜Ù6_ß¶´ežS  ¯MÙ„y¥¯×1“9Z8Ú¶%=`:n9Zb•]Û¶º!‚è'‘óümi»UK}Ò6ÜtŸeî5³NÚÎHö°KÒ²`5óædL3Õc{ˆÄÊŽ­—ØÒ±½£gÙ¶?.ÚΤÝKÖ6Tªœ.°ŠŽÆ½„8n§H¼²õHÒ,᩟"ŒùÔä ™¼züªgÕ7¹igIî9S6ÍiÞ€éV¤Èâ†Æ‰•Q &9r­ÞXG)œåÐÂÒž)Nuíæ(pFÃþÍÕÙHRÏDTç8å£E ÕaË’– ‡pŒbsqÅã*p•Š!dT "­â ¯†%á'*~ŠŸŒ’q›sýýfÖLí6.w—?ÉÂsL~NV“±~¡â—ø•À¹•©ÚmïÉ%7Y6 ‡&âKéV’Ú±³lvQ·­“<==4l™CfÆ5xž5PñküF@¶³ Ð2ëQ›zÒYøo™ü® TY€yé÷*þ€ãg¶Euß¡z‹¾3›Hg +ÎéEáÞ(á*žÄS*þ„? ,ÓR¶ž±]ÝL¥]ÝL;:ÅÆlÔ£m*þ½ÇTüSñwüCÅËp½Šâ_*®ÁaGpT¿Uüÿ-…§,Ü~˜(Âl•¾RÅÿð´ŠÓ sÁJtõ™Ä¥g;\Úr[Uª†Ç%!èÔ¬ÔS¶éøÈޤ·U×÷¥-KO’;\S·3f+M²kÉ^IÔ¨¢V(³õâÉÓ)[£#Uy9 _I†‰÷×ÅtÁ°ûÛ2]“´ì²LÃ1 R†rX·³zÊäß5\´tÇh¤±áꆞ13=idÈ}À¤BNSz?m=jçZ%!©BÆ LyŽvÛî6;—I•åÕ¸³RžÉö°™ñ•QñöD¦8“«ÈEu,kþ¤§·f³6¹¡~"ìÅ*“„¢Š9BUÅ\1O 3¦oŸ@—sØïéÌdµÕ‹E¶õ9y@E)åSÏce’/)·¸2ŸMô ´ÿß÷ Å\̧jvAk{Šn»Z/M¯ÃqUh”¦¢žsõ«°1LÙ&ÆÙ”Э:éÉ}ͤ+pÖ¬°H­Zne·—¡ŽW\éòY0Y¼ýJä½e•5¡ËtcÀôKƒ_F;¼;:IÛ«ÎÎYP!®ãŠ7r\ä›Ë÷÷ fíÃFßNUg½+jv‹=Ê.Ίk}V\¼12ÃFï* ^ª“ NE J·ŽBɺÎ>*Ë3Ü&än)k[»mK9G|ÐÈî1åLòèú™æ«^iÒ0ç›E'Rãk²2P+ž-¡T‘5Ðи3gÇ¡œa9S ðsÍ3 Üð£ŽkÒÁ©µs$`Qå]>ñŒ ÃTRSâ\™'ÓŠ0Fæø73=ÄJ>^PE™9=!üâ²Ý²ûc¤q6}g$è»NÁRÀUô…aШËhÜW6^A”ê8ø ²×ÒŒ¨Æ/0¯=XÓ; ü­BÏ3j—r¥vÍÐ-L²ZìBf ÖE ÑpÍ(j£Q¢M£F›GжŒBjÊC¾O¡.1%ÑTÀœÔX <÷æÅ‚#X AK„ë GBy,xýß?†…´cQBpF$XÀbæ[’ˆ„ ˆÐu«‹òXšˆÉãhŽÈáey,¿K¸>3³Â+¼&V7rúñˆ‘óÐGN?‘ò8›µ¬ÌcÕ)œS"u㘩‹(y<ïF¬ˆÖ’ Í㨋65pnË8VG›Z 8ow¢a ‰¢a²ª™~-Ô„[‰äÑ–Çùžý33¶W2ž$w®ÅF\Šùä\—~šÑ<'ç|'ÓÇq€z€mäˆÕ'½°MòÖðÃŒzÌû0D¢öö’î5¤/z7jYÿ)\À.ô!tO GÑ™ÁqlŽ[Ø—§Ÿl ¯e^¾˜›u±P$Ô|+Î.Š/Yc²Þ—{ NŽ %(A¸¤Ìüç—x.Ã&ZÝ|Œ|PƒU8†ëÉÜÞF6q²ÒK³hÕMdUˆÚãS w·x€ãØ „ã>âæSØ F‘`[oœuÛ4¨MÝÏ i÷I/ »±—€r{Ì*p-^R ÕQKí#äòíáA/Á;G°¤k"½›'³;ê§÷úu$h%øe¼€Œ[<ŠNZíJDiº³€îQl§^è!Èá#¸ßÅ:¦†™¥TFº™;»JY÷BbÆÑP¾7îï•ÈoÓx·ßAöI˜K–NMPúL(Z½‘l¦‡<Úyø'lBø2^Àn–¼¢Br{¦g2½ìŠ1_E-»{±ÏÛÃŽðlgÚ;¼­Kù뤸a P»Ukz½µ—Gï»…¬]¾æ’¦;±÷Ìz6–S¿Í +¼pŽ‚•~Xçzaµ3½°ÆÇÆÒ{­§÷y>6Î÷!Ú |ŒC»ÖùØqj£(áê ,1褖áƒõÐå… ~6tÓ{#=6Ñ#î‡Hx!égÕÐèǽ4r!=R„$- Cxúl°EÀV?lƒ‹\L³—¸”Þ¡/óÂåDÆÔ¹²> Ûéq]Mk\+à:#× ¸AÀ>NnòÂÍ~Ö ·øÁŸð­>)à6šº]À§|L‡;¨Ó/`‡€O ¸SÀ]îö³ep=vÒŸ!]~¸ÔºZ÷“|ð±zÈÒØg îs¤÷C¦éG|^ÀüQ‚|Œ ¨µ›ÀöÐãqz ô^z ØGï'ì÷“û”€§‰³gpPÀ³ðEZ÷=¾DÝCžðe_ðU_ðuRä ¾Aïo xQÀ·|›zß!Î^ð]2ªèñ2=¾ç…ï øÝ1?ð ¡•Ô×HüˆÈÿ±€Ÿø©€×üLÀϼN¶ó ¿¤÷¯èñ†€_ ø 5+àwÞð–€ß x[ÀüQÀŸˆ„?“jÞð/üÕÏöÂßhƒ¿Ó㤯 ø—€wië÷hð°à 5ÆÁË9¹Á^Á]‚k‚»÷î\îÜ/xÂs]ð‚ûØ^>p>²ÃKè1ŠÁG#|ŒàAÁÇ >Nðñ´.$øÁKŸ(x™àÇðñ‚‡Ÿ$ødê øÁO|ªà' ^.x…à•‚W ¡ùjÁ§ >]ð‚Ï|–ë²Ã‡ÓD Ñ?›69ÙÇÜd?ÏÂ#ÔÚK!z<^KÀ§ÐãT’Ä•dû^>‡:´¼ÎËçzù<`Z2I 6mŒnŽNïNN_–êNdV¥º3Fj.°¢.#‘ÞÖÓè4¶ƒ¥À|ÔNd¢=`îg5-Àñ5Àü½¢icV¼;…®/ÓŸ¾Òˆe’„KAÔ(ˆ"ÕÉD;âFn{ F4½Aã±¾;•δ¸€¯ÅM|-­­Ë[ÚV4ÑL¤3ÑDfe4Þg¸0â1`š^º˜z€;JàUKW4œA#˜¾5ÝÛÞiÄâєщ86n¬i7¶öFéîdXYS2Õ5h‰Å¦÷FSi#5½ÑšFz|(#ÍÐZϼîDw¦˜«¼b% ²!ÙiF\L͆ Fl°pù1QV¬Q2^œãóýàVÅ}=½MÉä¦è#Ú™6»|­Ã¢ÄܵJ¼ñh¢kz[Ü%ñ;úºã90I±ÆÐø >l4ѹ8™ê‰fPbjw-w¦& ©YFf1syM!âœâ$…-‹—¥’}±Œ%‘Òšf¶[šä²€êçĶÄ@åÎ|É:±`#jVŽ(GåÅC‘¡,72}©1¼Æ·ß2¦šåÀêMœÃ¤$ªfQ4•;ŽJãv½jp!v1É éëÈú6nl¯iˆÆãüÖäøü>hÖH<$º{úzÚº/:šˆl²^zâò K Æ-É6¾Ü1>Ѿž”±ýcżX\z¤“`2°†c_ntõ¡çã&)#mzüp¨–db…‘Bv¢qÏçèáS†iºyÞu~¯Ã8é¾ aC²;fèüt(Ñù¾Pç |°ÒcÈØ„á³mÆ…}F‚05¦Å| °ãœüÕ·vÉÙ«ÎÏ€b/_ªó3‰tÐÖ„ÑšjN¦P¯‡Ï®1RIkÚa±šn%;ràfEjÛÂx2¶Içg‘ðÆ@PçMPìø÷q{¦ÂI:oæ‹tÞ‚‚€P¬óV8ÞË—éülŽ.5öHŸ[Ø·~=Å·¢ïua·ñô8Gç+ù*/?Wç«¡ý©ðDÂØ¬ó5|-Îòód²ÎÏ'Bñ@¾€Þn÷úp9†"î¿4lÄÓFXõ‹¸¿ÓXí‹gê0ñh×ù:Ecõ£ÏÅ£3_­.:?zKw&¶!\®ó^"¤7Md¦mÂS]Á‡ËåȦùó«gVœ¦Úåuª¡@¼ÜCçGÙ]£-II9/MdŒ.#…ÈSdàƒJŽÔåu„Äß‘2¢›Û P2}|³#¡iÇífá Ê*P¶á©SI–.äEç[Èy¶òm:Ì@-€Ÿ—_¤ƒE:¿˜_¢óKI|¡îeô¸œ_{†‘Ü+ù* ëɳ±÷Q¾{½}ñîîƒ#CµÎ·Óš«èq5=®áWT¯ ©âãZ¤‘_G4Ž«g6¤’[Òáe¤˜Æ­1£WÅÑ4„-æmiί§]yøbß@ò/ ãO&í1ŒÀå¸\“+(ÕPÛòF2ð™0K‡Qøq(6OÎᄱ%ܘJ%Så“›»1®%ºÂ)yö„1?Ê=˜®…»áõ} é:ýHZ~iXÊ"Ž›çiQ뉷Dªäü:¿‰Øs¡½êüf~ 2CøxÅ4œEm~‚t+ÿ$ÙÅÆöæh}=F{†Œmî6š½8„È’<Äåò#. Ø,ÿ0h”sýy¶ E_^1W‡J¨Òù§ÐFÀO†å‰G;Œx;Yb¹eCwÜ—gR}†2fîGêG(c [°)xÐùDªÇ¢¦Ïô“ií A7.':]Ùä§iHÏ‹“fÆô¦º7£üÃÉd܈&Âʨ‹Êñ oGi6“Ä+c çªN:Ó›L«ŽEª#%€ÔŽÍ™†¥çIt‚#M(ÒÒt4—çB][_,†‡^8ž®È¯#1ÈeŽz¹mt³ ßÉïÒùÝü4Ȉ$Z‚;ù|€¼§£Èh0ZçŸá»Ð¥i/$q}c‘ÎïňÇÁñ -Nç÷ñû1çp:—1“ŒçeSkëY Îh\°ͳxÁÒ¦FP(¼#fE&i%DcÊëgrç^êÅ)ãúXeùRÛõ &ªÇ¢© ú¶´„e”_ «!Ù—ÈÃ=ªr(äI‹R…"³ŽåFo2•‘Œ éÐ-MO4½É¼2Ô^)MÔíìlTZ ¹‘¤ WŒNõ  SÁˆ(d‰K2ܘÀìËheÙAÇ Ü'ªQsXŠÆÖLŽžBäM5O&°êcP褿 ZœŠvcaÚÕì1w.FÉ5DcŒ¦ŽLD{Œt{r}Îd54dzª“¶œè7Î2%>÷4Rèí„5wWHš'n$º2°ÛM‘ÓÐŽ GÚœª³ÑÝ%'Ô ¯jÔ!ÙžÙÖkäI&•ã+KÆÕi—È4a/`ÝñF‰ð¨¾²Øî¶£2‹i¦Xçë00:ª 7Õþø.’c Éx_*¬8¯½ÖDƒ”+¾!Mz‰¦P4ˆ¿.#s©|¾]ÝPº»{¢]†ÒÖ"££¯KFdF@ÝF bLÑFôÅe”rÑÝ ÷±”+Rf ÷¨Ìãv2÷D…`}/ÝÅÑSÑ»4¥Ö‘ÑTWI5æÐ\º‡4Ȱ#¾ §Ü¤)ŠšÝt-ä7=œ#éöu¤sWs‹¬KÒº4‘9ÊíݹÍAEºzûé|}@+e©ÂƦ÷’pZQÒ›;öÚÍ»fwLÅ6?šU*“^ÕMnàÈÖéLÍö{­âŽÄúOÀÞ(†©¾Ý•{ÈF`%øÛR=qÖA6ªŸÂÆ6j Hò°g¡–ÍÑ;hTîòˆÜeL?+Á]Æ4!Ò IðX56–ÆÆ™cãÕØx ™cÔØ+¥1׿ĦÂI¦Äna.æÁ÷UJb)+¾‡•i+²p¡ßTS|(¼p¾Ù9ÀŽÃß=ìø!ÎÂ%ÈéÃ9Áä$KaÉÝkY£„8$…H2s!TsDŠiLD i2¢èg^m7;ÁU_–“ò•Ô*S8ë´&‰<-¤å¨ìg3ËîfõLëD@‰tZ¾ØëÜ!÷6…¨gcl‘G bÅfÓÛ˨IÊ#©¹õ‰ÒÞ3õÃñoþÕâ_«ÉLÈÌNÆrSç&1³+ æj­¹,ë.˜8Åšb§ö³HÁÜ| °:R`®†}mÝnV7Àæ…ÐDç•ɃKÚ@=þ¡…)®N¯+ íc €õ³*j-†u^;ªwˆ5äh>ü­#çYsû7⣠elMjó³ð–µ¶^ËI^F?}žI­íf]µEAêìb%8,r­Ø^„JËÔHx€°˜ø”ÿ€©ú™)¿92VZ@ÅbGÚ–ä}†Ô‚¹¥yí„ &δ&ò$Ž i9 rŠ'ýdc84íÃéV9ýv~Õc’±š~¶‹–×ì`;è­­(Øí,k·`Zo­N¯ÞÚˆQ?oš±õòÖÖ´Ÿ5¯íe-ƒ¬õ[†¿uÅ¡âç Y )ׯR¨ØQ:gç,‡o¶ÏÙZ°f¹5ꞟUQÕ/ÿÿô—ÖF€mÒè¬ µBblS²|œ3ÀV†Ýø¾¡$Í Ýûš…4±'¬µÛ(#Wôʄ)¥–‰Á‘á‹på~‡÷Óò‹±çE• ±KúÙKÁ6Î.µqö‹3\†KK<¸§/—lžA­6XRC‹H*Æn¥Ìg¯h©bWZáØG1Q›¸ƒÎÛöÀv’ϦÞU…_}TН1ßךoÂlÙáŒ\}Ao¡ó8l¸æN@ËÞÅFÑjºg;£ƒÝZ9f©•¾$>~|Ç5MÐ,³y8Rù\hª"¢®SD5Qîû1)¸-²Y6ÕäéužÇÚIÔRRk¶á‹äbfSöðw 'Ì€ÙdßþzÛö7<ÏDàÆ,›l ïãiiBJEà&3ºxhðfÇ-ý¬Ó<Ài¬LáuÞ÷;ɾÏ'dÐÆ“]ž$…¹c)CX0 ¾ÌÍx¼‡e]uT ]¾·æå{ë0ùÞú¡Ê×6F›}Ò$i·IÒb²9Œ´Û>Òn´€=Qz·÷³{Qz·JïS6ï$vÉf‰‚M€Ìþ™TI{9•´ªXôɪ~T‹ÕÖÖ=…¹#Æ=k °£ÍUë z­þ.vªl½’ø‹kàÁ(ÓVM ³ðÅŠÛ¶{ѽV‡´!ö馬ûvU#/¡ÓˆZOP:ƒ*ƒ§¡åâ ÇV±^a2²Ýƒ¿–uŸ%KVE%«b'HÒ“ø'„<¸A%uÞ,U£pƒ;ÉÁ†Ø]³Ù!$øñB±,~€Ý­­[½›Ý]+ìÓ÷P.-(çØé íÏ8Ø«'O»FÒ®v…¼mnSÒ®À®¶¦Y!ãÞv3X´Ù0)):ìºÖÒ±V++v)”±J(ãþïåÃáÞ._G¡¸&© ‹+èÂB %ô ÅeûÈ2s4z³üNy?Âo£ûEDiÇIÄö±ûþ}v]µ"(ýýäSpµæ[8Ê’ ‘ãm”ê —2:òFO/Å$_È—‹I¾ÿFLŠÛèø¬IíØŒð§9ã}¤Ÿ³!½ß‰¹èÌɸûá0ø «dßKEb;ìÛ¨}(2<äx2|øžCúh†–H›öXév½sùY“‰û‡9wíf¯H‡<çdÏbºHÎþ*‹ÒËdÕŠÖcÃú#…Êæ«?Î!ŒìfÏd™ð¥ìy7™0|¾ ËXU˜–¯Âð>ĦÛ6ù‰ÌKUø)>ð€-·M–¾YÂj¦Ÿ|@Ø›ñºö(ǽ˜·NCÃ&`›ë"¡Ò¶O²áü®w)4ŸÛö­¡óÄSç±¾nf¿ Ø_ßþä9 Ä#uƒv+`¯ì`#ñ”z…Tò+3*¿AJ´2{éN0RU ž|Õ ¥_t…¼Öu¨AX~mbû *ZN‘˜˜¡ùSq|þTl©¶îA^¯Î_ûÜdbü­ù~ÝÂ,7•Võ;ÊÓ­uÞêò‚¢|NÊèÍ‚Ãè-)דà†É’J—÷~£ÈFÝ„\cÎ~# _Rá|mDʉb@­Y)iVŒ™'›¶òˆ®~1ÈxƒnŒ¸çïƒnJ\_ê¬uÝf¤!ôOea}DFšp„QM.Óò±†ÖfaaD›k‡+8BÕ–T^.[ È}4ÆiõÛæû…ÙÁí ÿT°â)ÙÁˆŒp펴ŒU´Œ“´üÇ[´Ed´lrÜb¼Ú"¤¶x£uÛΡƘg¯æÑ9‰±Ž¸z8̣͌ÍÈì­ ¼3Äþòpàtó ¼¾{]óQuÅ“-ðÎÕÚãì¯êË· Om­ê{÷©•Ç<ò}wægY‰<õÉÁÑnpíhu]ÐRZ¯. Х˴ûØ»íFì~­›_¯ËÞZoYÐ{ó½õÒî¾\†;TÅ»«^–ÿšFÆ™7ê…ʨÝyd K/!®À;÷0Ðxg'[Ä"úuõe¥÷)Óvã{i‹ ÔWèÑTeµT˯ÐÈ [¢>oÓðªáêû¶pa{Š*e›þÝb”ÙÖÕåŽÅìBáN´4±*M¸JðôCM¸4h©ÜMvú7 L(˜xšZ20=«þ_ƒ¯ÂcÙMÇòßóA®heÂ_}ŒÛxL‘þq(÷]z¶rŠrÒËÄzªÕ­|µº•¯6oåIâ´¯x˜Z¦¼ëmaSŠó‡ùÈi¿˜Ç%ÿ,¸˜Ç‘ÉÚ@­‚(­¦ìWèãóWèÎAz³Âøná²ëv>·|ṑ»ž÷æp#|µíz~Ÿu=Ÿ¿èv¸š·x~53ïIÏ¢–ã­¼ù·x­y¿›wg‚œnÞ³ïÞŠ6uÜ;œ}÷:ùQj€­Tÿ¯‚ 3¥sv˜L9_3öI sÍÃobħLsOéø €½q9öÎEçÆá_¨@惆Ü€%æ·ù¹˜µcnw7þEé.ö³m«÷ßÍVæZûöƒ [èOýbÊÚ¬è¸(‡tމ´š‘Õ·BÃþPK Lg08ÅÖ;$û€ &org/javacc/parser/ParseException.classUmsU~¶»I6éÂBŠŠiÑ’%ň T¡¢T VÞ*´ŠÛä6„¦»awƒEåE-*Š/è'pœQF§ü3mÊè ?Ààoð? çìJ`ÈÌ=÷ÜsžórÏ9wó×Ý?îØŠïU¼C¯©Ø§b(†×ñFÏb˜É~&˜¼Éd„o19Á¡ÚøÐ†ÃLލ8ªbTÅÛQÃqc,çÃ;*ÞåýDŒ|¼§Âäëó* |*&UUœŒ¡„SL¦T”UL«°TØ***N«pT¸*¼ª8£â}ÆÍDp6‚$ènEäKfyж\Ï©æ=Û‘ — å«Ž#,ï°=%, öSì=ež1óùÞŠé¸ÂéõU;$´‹r≂/8$NW…•®yllHBÌcñдYV ³“Þ²i{yNÉ*’YØeÊ¥™*¼³d•¼ ¹ÔCS 0MÜn>*A´ UNñ!‘jŠ…·_¸®ŸàšÔæfi´š… áæÍ _¬§™§ffа »%¬(—,‘u¥m%ŽEð¡†pNÃìÔð¶ix}^Àv /¢ŸM_Ö°ƒTâå¾÷T''…£á<.0¹HwÌf³tá$ý$´íµòvÕò„# Éî>Öð ú(lRçÔ0‹KZ’Ý>ãè¯`/Õ¡;izIΔPŸã;þBBÔHæíruÚ"ée6“(ΊQÓM}§lú©¸÷ ’69±'û#øRÃW¸¢ák|CÇ'˜xL,&“L&ÝL61§[l¥_ßr²ß±¬ªá*sÉG`„·½3yQñJ69]½Tªi¼¡€g]OLSK©í#Ž]ŽwVÂö&-}Ì&‡ÍJEX ÆcEÐ:²[—|„víC¦ªc‰*¡êÙ I¦J_¢×*-:!Š%k˜šÉ†¨ÕGú-¾¿Puïá²°ŠÞIÿQ„pþ¤éì¦rK³¹jÉbˆ&®(¨Ÿí©¡&!)XÔ­N¸þ]ô]ËÑ×4…§Ÿ8‰€¿Óðwz´+üD|¤Dob€èKtÊA& Г֥E´¤uYWn#´€pZY@$Y€š6MoY@ìà{¤7U·ï"{z¡H¤ÑÚh-“õ|wÞMðÚÛÓ™eÑñôZ|ËJJ.L»œžGä:¥²íæŸh;¶ˆÃò.y “Ñ;7pz=39b[ëÜ.¹OI(ÿ‹»2ÄÆ‚cBÉæjXOÖU¤¹ÿu´RÈ^C,£¯"Ð(Û…‰Ñu>ÍÊ„¾¢¯>@Rukú¹/”­¿›‰Ð5¬­'·… Djh?СÌcíulhÐq.r®®Ÿƒ·ÜŒõ¾Ù=L#à‰eiwÔðä#à ¡|gCtƒ‘FÀº _gëkèÔ74Jž"ÉrŸÉ®»ö» üŒžFL×Ư]pÕî&}†Îué–›þp(ü• †CÚF³LÃ!¥êûý†“ÍÆ’žI(5<ý;ÛüF+Šàw–JëH]v‚VŒV ü7¸´Úhó‡ô6ѺJkœÖs¸eèÏð$ÌaÎÐ{î'Cßp?z*à.ú总`è逫z&ঠÝ83HõØ@<ù M_üü¯ØW¿‘ÎEèŒÇo#”¡?dÜSõ’¤#Ô¢ëF þVÃÖø÷Æûî?«=¨ þPK Lg08'ÚÕfQ¶S org/javacc/parser/ParseGen.classÝ; ˜TÅÑÝ5 [,õËr -¾nEþä·!¿ùÈïDþY1|ùAtù]ÈïF~ùçß#æîE~òûÅôç…R@þ xøò/"ÿò/#ÿ ò¯"ù×ùÃÈ¿!@¾YË¿…üÛuü;üäßEþ=ä"ÿ>òÇ?ŽüȈüGÈŒü ä?AþSäO"ÿ™X÷çÈü—ÈŸBþ4ò_!ù¯‘?‹ü7È‹üwÈüÈÿˆüOb¹?#ÿ ò¿"ÿò¿#ù?¡"ÿWÿ7ÿòç‘¿€À8 DjF!ŒF¨E@„1uc¢ãÆ#L@˜ˆ0 ¡¡a2B#„©Ó¦#Ì@˜‰pÂ,„Ùs„¹óæ#,@Xˆ°áx„Ba1B±ÍK-­mK–!œ€°áD„“NF8aB;ÂJ„„U§"œ†°ZÐ8¡á „5g"œ…p6BÂ9kÖ!¬G8aÂF„ó6!lFØ‚p>ÂV„ ^p!ÂEÛ.FØŽðJ„n„K’;R=.ÂN„^„>„4Â.„Ý„~„,BaáR„†p ÂÇ>ðI„O!|áV„Ï Ü†p;Âw"|á0„!„»îF8Šð9„{îE¸á~„Ï#<€ð ¾ˆð%„/#|á«!| áë“eÂ7È#á›äÁð­Zøv-|§á¬&W(æ9k\·+yY²%kÙ˜Og‹äÓE7ßÎÙè•élº¸Š³H,¾• ;s=.g£ Åd¾ÈYÝš½)w ˜Îe šw»6Ê{y_-|7 ߃G9[Ë÷¶Ú©TË@2_pó-ëÝbr£èzصðý(<sÖÂgSÌèé¥;ݼÛc&êÍÄ™éŒk£ö`~?42ÉloËæ"‘îU”¢ð#øqž€ŸP …ŸÂ“$üL|ý\|ýB|ý2Ê]¾Ób°kƒÇ>g“;s¥L“ÍÜ€›uvÒʱ'I:;syg1GË&¢ð<ÍÙŸŸ5ù|Žù<…_óœM”s¥b:Ó²ÕMs$Òèsh¨³3 ¿ßÒ^´,v¢ð;ø=uÅ-Qø<…? ‚G£ðgø gS+¿%·ÛÍFá¯ð·(üž‹Â?àŸµð¯(üÂàÙ(å’ÏUDÏr³nžø ¥X«ép6£:©hd é*R'8#7¥/™'‹r“ýJ¸R±» ŸÅ²›¥æ†…™ªXë,åó¤`µšb¨ÁLMüd®»w`Z&[$fÇJŸ2»@¥fvÓTžãl¡™òÐ ©dv WhýL²P¤>-Z_F"“¤ÁEŠ“ úÜbéië$ó®“Éåv“¡;É>7Ù£x‹…˜[- <àlzhÁí_·š8&L¯TÊB²“dƱæ¶mW|¶ñ¬»GE#ã…y?™@ö³(N:˜]a­6z7gœ¨ó€ö“6ùÑ »e€$¸?ÀÙ|j 5wY.ÝS†R‹ rãä8o±¼ÝÙLNÛºè«uom¤>iˆL&¾šià-Ú”þœs:“™LA‰°´;_Ì4E3ÃÙ¼=ç]±ùÖfL)×uŠ&[ib™¶Yò%¢œ=ébŸSN[( dÒäc¾Ù+3C:1.Ö³œBù‚ÔÅl¡‰ôN')$À&¥¬Íû E·?‘+â¤ÈdcóÖlÚ´aÓ g³›Êe{œIJâ¤,&s;½­–1á8óÄ®¥«U3Î…¹’Ó_*7-$u6ÉóŽö(\òÆ>Ò½ŒÓtˆsÁÙ¼eõ–®NÁ…T©\«cĵzJâ€Ò,:½*f¹„ÄŸ¦€Š}ùܹ©òüÆ7ÊQÖ7G›SH¨%Mˆ Ö(\iª¤cE7m%œÍ´`¬Ø—¦x 7‰–i ÌúãÓÞD- …,‚]ÒFCôP¯\¦Õ¬+ÎØ˜°Ó´¥f% 2…:MMqí[ÛÒÛ •uÕp<—IdÜlo±Ï' † Ë™$Ÿ©÷)Ê-6¹FñWYþñÚîe ÐfnÿNùž$4¸¯æãL°‹ ÑÈ”ÈTŠ’ †pܹµ[”\.ªâ¶]âD²=uvL$‰t.aMÙlNÓ6˜.hÆšl)“‹´¼ˆ“$ÿô„›Måz„Á‹•[†Y¹ÙQ©›‡ÁqšÈ"m‰eµ‘éÑÈŒÈLÎIæòûœýåç­ÙºÀÁí‰`è6;môowP)¦ú<žÎÏ ®syÊ ÖhX/ tD|²ÜrS)[L÷û9nLš÷z·P ·‰Åuξ<9UÌÝ2såÙÍÿ¡"ox¹òªØ[PËø¾3;ÐHFpÕÒUQÄwÖÕ/Š^˜r6XUõ‰²UÿûfqíË…7ÅN¼ZtÙêÆŠ8ªbót£MøE¾åïõy/mr$ó“¼dâXƒ“R g§TǬê·iì”;²RùÊ'Sîr?lˆ¯…jé¥UÈõwÕä1ºD„Q›’’Å-ñx/w¶5F¢1’³Ó*®zbóKýn·\OæA”OôÄ•œ`‰Fž)¸Sè¹LÏ陋é)&u™P&nq•ñÍíPAÇKüd+çw…Àu) ™1Il¨d‹FWzì”óZÎQÑž¬ä¨rzDŽf™µŽP«Óѡջ_ç°&‹mjj7QZâ45©«Ö*§­µ5nÝ7Àì3ø"²Øýêfª?:uRJÝ^~kPŸ=}¢–Kùú"*-ŽõL§"_©EŠ;©ÄÎt¾ 4%pÚõeÃ|ÄŠ)£é±þøyIôúµº'î+š©b>™2F+¿›yó<;pœ¼[,åýzI½VœÛPÁÕ¿ªXF£óænµcrÃÚµÎTt7nt¹é]uu-Oe’…‚³Ž²uYÙ\J¥èrHx7ÛSpdT…À„¼ÈÑ9B’¯ Þè+Eúo.õå“’™xX…n÷ÎnLBß¹uùGX«_’Pã=Ì$—,i—…ºJDí–©l´ŒWÓSöæ-åT à^š•Ê?U~‘k´‹²f€Æ|ÂpH“-‘U½Äö*Ë ½¢eugÉrnS¡š¡ªºªö"mg‹_¯È.ŒmÉ e~¬>†£aœ¶»[ªÇ%˜kÆe¤²E1Æ1Û¥0à¦Ò; ׺Š.ÎÏ¡Iåî^)“4mʌłSm¯°+Ë6–^(†Ã¹ž²,´l²\‚œQŸ>¸ÔÙêMŒèôãl…'³Åݱ`8‹ÉÑïâ^`âìÌÀaójL–t ÃP'U²!œÆJY8^u¬¤4¸¤8£¢®)ì³kóZãú”õ´¦Úy¡(h–3”ÑlÙ;:Õï '˜ S-/fæàj–¨ælši¶\ôª•8©mh×åP3«BŒZÐi¢+ÀNÅõ6¬©i»Ÿ Ø'ŽešY»J׎÷¨åYðà…šd• NkÅs°ÅÖ)g(«rdq;ƒ3Ç¿»—vº`Õö×[KûFÑUÙ ¥uÜð (‘Ösd(4èK„?Гd®Ù0§ €r*#yLŽÄciåèâjne¯B‡X'«f´ˆzÔª;ªøa$Ò§ËÉþT5} úŠmu¬ÍÐîÜŽ2}K”YNàS¡ÞÉÁùtÝÝîýÔ£>t-×_W‘‰{àKý©¹f.¸)ä1‹=¡ÚÓ|$ß,ƒbYm‡r¢%N›eäe?—–]ÕqdJQe×Äj ²WŠ òŸ"ëÌ›â´g®d@™d[ z˜}“Ю'CÐ*ãxZ“ê6 ±Ý·’σìè…¾-X»aýhÐá]lökNv¶KÙÙ.²³eK©Õ´¦w7æýÂ×(ˆ.rbm+WîŠÇýÈa!ØbpÆ›8«ÛeÉ1Ý'ëÃiÛœk(„G 6f†Àlk ¤Û½V¾Y!ÆfnWž5‰«é=¨d¹½{qHTom&–á‚,€–¡Ù‚{iYôôù)¤/wcq‚5exÇ÷Qüín3þ«×RñT‡¬ *%±´àrq(N`™ôêŒ@HQæ:Qôh5«,¨«?ÙëÆÍq£r2©0ëB¡ò©hd¶ÈêWkÍ9™tV pb‡Û›Î®£Áf'•Ë”ú³“r˜Ö:[ÐÐÞ~qË$Ex ¦†A†zªÅ£°™>Á´#RÃK=O>+4'©™žGDZì49ó‡m!K«°¨ïbÞÏ.{úÈ2%«Ãé“üª¦Û£\t…³R,c¹«º†lû º¯™{»¼‘Ï­DH¸—–Èbó.ž')*O>Iñx SÉÕ '˜è®®¨@`(úL`Ûá¡h‡11¹JŒ*]Ù7K½²¤¡µÛ¦®Å¥Ã+vkº.£×6_±-Ŷ £Ù¶pÕ¶…èvÙ1è¶­B¹W«rÛ†Ñn[…zÛ5tÐ¥†ÓÆÒíj#ôk!Õ¢Þt5´œò«`0›Ð?uXy† Ç('Ý'`æ(˜Z÷@e­»NAôäy½LŸeQ{•ûµ;ÞGW±œD2ßÛ>Léq@ÕÂÛù]aOº˜ê£H(ÉNr¬O*Y/Ö®d–QºX'2s'h0`’´.ªÌPcLqqÀ+¾´{ «ùE³¢šœ‘µÆ剛ü—oF!y™ë” íÍ$ýü³ŠÂ´Pº¼ø^+Õ|š½ e%eKðŠ7q´–„,“B´tªIôš_§D§IðMa[î_»Ù,¯þ¥¶—÷Êwý—íâ¾v¿®* m¨å L*Ò#ð „Ùh> ÒÍg¢'¢‘¹¼6·òU^™ÍÐýŒ ¼rR½„vV&·ƒ¶²ùj’HÞ{—¤«)š € ”×êÌ]fJòµÇ.räJÄ æ½ðñ„sz)éQËI”‹èæ@ÃJÅRñŒt^¾æ¼Ô‹{/¢‹··I?µ©Rw6Ùïƺò—¸iztr€’îΚc•ÓñŠ!õÚ·¸òsj„îê±J8‘ðÄ‚¬„ßJÛW%Æ&ûcúEú.1ÜP1,FÇÜ~Ò~:¥ô*^ _iL‘rËsIOÖ;âÄð¨T&—uËåÙ°cˆ8G·®5ê5î²E4ˆXd,íJWÑ̉1kQ+ SB˜îjõACY)m_1GÙm½0ˆîÍt·qV#îb$–«xZ-¹ê e}‚$'Ýh3¥O?(Š…¿ß.ŨIÑF×f2MÔô âÕ‰¸%Ïš,%JêÍJZ¢1t‚–îKÖçòîÊXᤞ"kÄNÊõ9¤Œ®:s¡ÿÍBpÂømL|Æð]4 bzƃl,«¥öV¾vˆÁ {”E.<Âjîb£g\”¾ð(«¥HÿÆ\8Äꎲ±½;ÌÆ×O ¯Ãlâ6髟ä°#¬á›|k<Äâë4hýTÒðÓü›~”Í É™÷ÝÎŽ;ÌfÝÏfÓߺ¦ú9‡™s;k4¨s ¾)tÉ!6O<ÍWO‡Ù‚HÇíláa¶hm¡Nä0;þ~£¿!¯¹ƒ-–“Mç.¹‹5s6ÈZ©³„3š_»øN–˜¸ìF†5‡Øxù4ÿF6*ÒA8C¬åÐ 7($h¬o=ÌÚ±±¢»”º>£š·e†š:Aòru¼È Ÿ©f¹§ýå$’Õ±‡ØIƒjí“ilˆ2Èâi…‚0*k'†ØJÁN‡§œCìjºª*è©þæa ±ÕÙº!vú [ŽÖi­0?ä Dp°¦*gàΪ w¶Å^×Áj«žcQ[;È® ‡Zg¯2¿>ÀÓ¹Uá6Œ@g£Åóyƒ|w8Ô¦¨l–{´å0;¿~«zAMÏD'Ssɪȉ55³nf1 ýØX#P.ôP®ªá‡^xLHt‘ð›¬mÖÅ!XÛ-¬-¬WzXÝa’\âM'-7ÙAÞ°bÔôQÚVˆžtˆý­má÷ÖôÑ5‰!æ uìô¨záÁW¯Þ§í†ÛKäÞ…ÎY6\§}R§kËuša~WÀX–+=8z€¼h?"Ævq3¾Ïõ[B^Þ. ³šRN·º½T·yÝt[”Ø¥AÖL4<ö2¥=U<ÖÙdŸò4/—ˆ2 í׿ÌNO¯ ÊvÀ·Õ+‚®(q_­‰¿&åê_[U»¯ 0uå±0'Ú«d{µ^öõ/ˇjŠîªîçܾ©LÚ7WÅ»æ%³ŠÙô}mý[³·jõ¼Mª§Ytß.»sËÞáëïÇdLïÙ˜®{9Ó»L½§ ¿:Þ{­í hî}¾$ƒšÊÁc3Ñ—Ú4m\_ÕÎnÆÎÞÿbíL ö_°þ¿¶-Õáoò™¹éå±ý~zxsU#øµ' ÐWýˆßýèKd:¢=ôßÞZ©–)Ö×L.ֲ緄É|Ì\ÿ¯zvˆY~ÜN‹Ùlý õIÝ~Ês¶úOë¡[uûÝšsó6ÃtR<Ýn˜Ú,žîÐ0wêö³º=¬Û#ºÒí]º½[·Guû9¹Æ=ZÔ{õè}–­HQäìýzôó†/9ú€}0TMkù4ñô…ªJûâ)Ý—ûþeÝ~E·_ÕíCºýšn¿nÉ'Ú‡uû€d$Ãâé›zô[ºý¶n¿#¡d 6ïZ4±I@ªâ{zâQÝ~_·U p¦}¼ªð?ZÔ”JKš)º? ± ‡~Øãk˜'ª0õ“ªÌü4èÒãžô=îgšÀÏuû Ýþ²,ð<è¹9|Ù§ð+Ý>£Û_ëöÙPªç FiÂo(M8XíýÛ*§ ò»Œô÷#Ìÿ! :ÞõǨü©âv÷çÜ_tûWÝþM·×ísºý‡nÿYæ:ÿÒí¿uûÝ>¯ÛTÛÀ™épÓÓ‰˜NM05ðQ!INŒ6Ú2û)3ØŽÕÑÀÇØšhàuÈ>VFþ *nž ̲‡Ø ÓyŒSi'g£T¦p{dÉôÒ*Èk‚’ŸdÖ†™³LçlÓé2sLg­é¬3AtíÍl¹=×{Ñó\Ñ«¹Döýr° ‡Y‡Ž ‹ |£éœg:›Ê­zó±[À– tç›ÎVÓ¹Àt^Q¾Ê…U4ÏΔiÜiè"½Ít.6í¦óÊ0B¼[þr:u*““#ü"{üKüøPK Lg08…'Œ8À=&org/javacc/parser/RCharacterList.classÚxÅúð™=“„„@ò‚È,Mj(*EéH¥P$C‚I(bWl¨¨Xlhì…®X°aï½÷Þ{½ðŸwæ#`»þŸ{ïãù²»Ù6óí¼Ã£;î¸[)ÕY]‘®º¨Ñ*_Ì—CÒÔ˜teÔØ 5NÏpï&ðë‰üxhš*LWj_&s½Ã2Ü»Ãùn _ŽÈPSUQ†{7/Óù]1ß%ÓÔŒ Õ@ÍLw/³øR’¡f«#ùRšî^椩2þr.=—ïŽâK?Vò]ßÍã»ù|™É•ðÏ-L(µsg†êªf&Nعs'ÿæÑü®_zð¥'_vð¥_&ñeršZ”¦ŽÑ*³,9³¨*Y|DiIe•Vz’Vµ‹“•Ó+JæV•WTj•3bvÑü¢NóªJJ;MHNw_öÔª^qÉŒ#Ê$+U&Ç•ÍLºE£Éä§ñsçþñ§ÚUEe•3Ê+æ$‹µª3®œ?ŽJÎs_—j•hÓv‚Vf@yqÒ-:8Y–¬pû4jF‘VÚLj;¢¼bf'îÅôéæUT&+:¹ßÜnÔ=?YQZ4×ýÁmþf©³Š*ЦW%+ünôü÷%ںï5vÞ4ÿI«´¡eò®U›ÿ¿µ³Æ–WT ÜóÖ“œS>߬;Ï%åeZ¥ö*)+©êí¸ÍwÖ€¢²‘EUÓgõ+;š[ôçƒ;Òkz©_2Sí¯ÈTǪã2Õñê­šýuWÆ–”Í,MÖìP¦:Q”¦NÎT§¨Å™j˜ž©NU§eªÓÕb­šþÛ¡dª3ÔI™êL¾ôP=¹%™ªß¨º§©³2ÕÙjd¦ê­údª!|馺gª¡ªV¹{µ¸ ·Ø9ji¦:W-MSçeªó¹W˸å ÔR­²ÿ|£q 3ÕAjp¦ºH]œ©–óã 50S]Âøn7»’ýRîÑeêò¿=¾158Âßè-þf‘äÌy¥EƒέHVVúKe*K%ýõªUz²49'YVÕÏ­žÛfhÛÐ0JÝùê4zÚl·Ç¦ÏrˆÍ`÷5™Í ¼¦Õ„ëïÍ(*.6Í ÿu³¼IÜš5Ê­YšœáN©(™9‹¶à祿¿Ôè¹¼éÜmXgf²jè̲òŠdØDJeUQ…[·Éß·®±U®ºJ$Ë\ƒmôÏ˸VÒ¯¸8Ü·µÜ;i0¦,¹°Š‡8Ôßâ%enªA»O`ƒ¿9ΰh…o.{,šY™ÜsÍŒªŠ’9ãÊÇú+So^YÉt×mL,ª(s-`pÉü¤»lõݱs[~T9½h.w´¼¢¸¤ŒŽªš¹Ž²«+)Jóæuï4›™³!oyo/¯â=ï^k»ÿÜ ï–ë«T¢\¥©Tçôv”Þ¤¢^‰›4^˜ÀM6©Ä½Ê¬PCw}ڦ̕Ò;?‹J½Råòë­Êòãf•¶IÕâ/éü%=üRý¾{+TíÞø˜ÙÍ$º¥ä¯SurSº¬Ué‹S¢êßÉçÕê¨\³ëmjµ$ŸÌÔ.kÔ>áoe†ܮԼÉ5SÃûâe›U]î„Îøû¥Ý–ü1ø…TÕžÛïù—5òk¶ú_þ’Zõoëíù7Ýáî:µjÆÿ|xªý¿ž?³…“õ§“µûdgýádgýuo²üöÓkÞø½Éú§“½çÒ~oÒÿp²³þz²eüš­þ—¿´çÉþûõöü›r²³vŸìÿéðö<Ùÿtxád/Žtõï7Üæ¡VýTÿÐøÔv•pÍO©;܆²WªÖ[Vª´Æ+Tív›TŽû¯žû¡þ •áÞæV«4ÿÙ¨²·ª…›Õ^# 6¨†£ÜK^¶žÜiÄ«•oι)»p^‡šÏ¡ oRªÕþ{|™Ñ#5/ÕµJ¾d®RYü'¿:ìþe“j¼8EWï\Þ!ÏíG“‚[ý1Õb “cj£"÷¥š¸×nïVYãŽÄÁ·kUš©V&q£¬5èת}ÕîµÖüi-WHe­æ²VƒFa•¬F]^±°‡åõ‡îA¸–óÕ­*¿PÎÕfeG&z'º™\³ëìéõþĘ]goYÍGwòz¤$z5Î_­æ4Þõ{'ÿ6œØ¼÷²Öµ5úÏß®Rݪõù–=`·4ÿý®o¶¨x\§Ü´Ý[I_¬Ýé>¿ /Å-ÕtqBWë¬=vÇ]¶°;_ïÞž{þáT¿Õœ‚Æ…¦¸×&ÕlqbgµºëKø s}µº)/u÷®4箨µ»¾àvÜWu òRÝ7-ªÕ’=néî°ÝŸÝöÌÔeUíj5nÏõÝRóR{¤íþοd殯z¤䥅?·Ç‰’}¬9»ÁÓ±Øèêƒ 6©½ÛlTú6¹æCk®ymWÞ\S;ÙxxÝ7«V#£Þî¬Õ4–Ëù®æôõÙõ)œÞ—*äš|3u »ÞÕjF[½ûbY®)ìmv÷#w¯ë/°ùÃçL×Dÿ°­·­F{l«fKî SÖ©Ö+UúÕf…ÊÏÏi»Zu®Y<§í®¿Ú$jçj•[ó“û~óç¤]b£ª¿ëÄ ÛubT+×ùhg£v›U;¿L;9=²Nöîu†Ë:Ã]bƒëóëìùYž‡€°xNûª`WO8B” ·srglèðrÝíªŽ\¢•êFí:ˆŽp;äþ×1Ñçw¦&²û/4ٓƦ@m_˜ õâøÂ4¨—ÇÖ‚zs|av*´r¤jAGŽô@´qÔdB§:êêB×rd²¡3ä@g:êêC×uä@g;ö 4„ÎqäA×w44nàÈX膎8к‘£Y 9tG‹@KhëØ;Ð º©£u  tsGÛ@;è–ŽöèVŽŽÐm¡Û9ö ì ]àØ/к££k tgG÷ÀþÐû:ô€îâèèÝÍq` 7ôŽ>¾Ð=ýý¡t  „îã8Ú]ãìÁ!ÐCà9†F@vŒ Œ‚æ8z„ãÀèQޱqÐ;Æ&@qL  =ÎQ˜=Á19pô¡ŽÃS Ým˜}D`*ôaŽ¢À4è)Žéb詎d`ô4ÇÌÀ,èbGI`6ô Ç‘RèYŽ92èÙŽòÀ\èRÇQ è2Ge  z®c^`>t…cA`!t•ãèÀ"èùŽcÇB/t8úhÇ ¨¡¡'‰'CGOCŸDOOƒ>™ž.ž½˜ž).>ž%ž }:=G\ }&=W<z =_\}½@¼ú\z‘x1ôyt¹x ôùt…¸úz©xô…ôrñ è‹é•â*èåô*q5ô%t¸ú2zµx ôå´Z¼z½N¼z5½A¼z-½I¼ºšÞ"Þ }½M\}#]/n€¾™n7AßB7‹[ o£·C¯£w@¯§[Å;¡7һĻ¡7Ó{ÄmÐ[è½â}ÐwÒûÅ  ŠÛ¡¤‰C?D…~˜>&>ý(}B|ú1ú”ø4ôôñYè§èsâóÐÏÐÄ¡Ÿ£/‰/C¿@__…~‰¾&¾ý }C|ú5ú–ø6ô›ôñ]è·é{âûÐïÒġߧ‰CH??…þ˜~&~ý)ýBüúsú•ø5ô—ôñ[èoèwâ÷ÐßÒÄ¡¿§?‰?CÿJ…þþ&þ½ƒþGÜHÑA­ET‹"C¢A”JSÄTDµhšX QM3eÒÚb&¢º´ŽXQ6ͳåPˆ9ˆêÓzb}D h®Ø ö+z/±!gÐ<$ØèFHœM‹MXJó‘`ÿ¡-ì'tŒÄU´)kh3$n Í‘àuÖ-Ä–Hð:ë½ÅVHð:ëÖb$xu[±¼Îº½X€¯³î vD‚×Yw;ÃhºŒ?_ûÂøó´LíãÏSW± hwqÞ€éD{ÀL¥=Å^0Óèbo˜bÚGì 3ƒöûÃÌ¢Ä0³é ñ ˜R:XSF‡ŠÃ`æÒá☠:RSEG‹Ã̧‡ˆc`Ò±â8˜Et¼8æX:Q<æxZ(N‚9‘NƒaЇ‹S`–Ñ#Ä©0¬ ºHœú §‹Å0¬:)΀YIgг`Xt‰8æ z¤X ú çˆe0¬ º\œ ú +`®¡•b̵tž8æzº@\Ã:¡Á°NècÄcan¥Ç‰ÇðNèÄa6Гēa6ÑSÄÅ0¬ úTñ4˜;èéâ0¬úLq ÌÝô,ñl˜{é9âR˜ûé¹ây0¬ú|q 낾@¼æiz‘x1̳t¹x Ìót…¸æEz©xÌËôrñ ˜Wé•â*˜×éUâjÖ½F\ Ã: ¯¯ñýBµx-Œï®¯‡ñý â0¾_¸I¼Æ÷ ·ˆ·Âø~à6qÌ×t½¸†ý¾Þ(n‚a¿¯7‹[`~¦·‹w eº)èÈö÷Ý]Èf½ÖwÃú~ÿq¬ï÷ïïƒõýþýâ°¾ßPÜëûý‡Ä‡a}¿ÿˆø(¬ïLJõýÙâ“°¾{J|Ö÷_ψÏÂú~ÿ9ñyXßï¿ ¾Û¾$¾ Ûˆ¾"¾ Û„¾&¾kéâ›°Mé[âÛ°Íé;â»°-é{âû°­è⇰mèGâǰíè'â§°ô3ñsØŽô ñKØÎô+ñkØ}é7â·°]èwâ÷°Ýèâ°ûÓŸÄŸa{Ð_Ä_a{ÑßÄßa{Óÿˆ;`ûÒÁHÁö§ZŒ`Ò„h`¢)b*ìš&Ö‚FÓÅ Ø´¶˜ ;ŠÖëÂL³ÄlØ1bì8ZO¬Ëû8ÊÀJ÷ÂN¢yb#ØÃhc± ìš/ZXÖÅ(›Â².FÍÄæ°¬‹Q ±%,ëb´·Ø –u1j-¶e]ŒÚŠí`Y£öb,ëbÔAì˺u;ò.Fûˆû².Fû‰]`Y£®b7XÖŨ»¸?,ëbt€Ø–u1ê)ö‚e]Œ{ò.F}ľ°ÇEýÄþ°ÇEİ|Ί‰Áòy+,åsW4TËç®h¸8–Ï_ÑHq,ëp4Z<–u8:DË:ÇÁ²ÿŠÆ‹`Y7£‰â¡°¬›Q¡8 –u3š,˺.NeÝŒŽ§Â²nFEâ4XÖÍhºX ˺%۬›ÑLq,ëfT"ΆeÝŒŽKaY7£9b,ëfT.Î…eÝŒŽ+`Y7£J± v'·½.Âr\-.‚ÝN…å8,:N<–ã°èñDØÇéIâɰOÒSÄ۬»Ñ©âi°¬»Ñéâ°¬»Ñ™âXÖÝè,ñlXÖÝèq),ënt®x,ënt¾¸ –u7º@¼–u7ºH¼–u7Z.^˺­W²îF—Š—Á²îF—‹WÀ²îFWŠ«`ù\]%®†eŽÖˆkaY‡£«Åk`Y‡£jñZXÖáè:ñzØé â°¬ËÑMâ͈Y7£[óù>º1ëXtâ|º1ëJ´1Ÿç£ ˆÙÏG÷¡›û~w3â‘t âBz»xâÉt«x'âÃé]â݈ ÷ˆÛû~ì^Äåô>ľ]ߘã¥èÄ|îD|%ÝŽØ·£‡3ˆFìïëGßNEìïëÇo¥#ö÷õⓈý}øb>ßEO#ö÷Ý3Ⳉý}òbŽ×£çûûäįG/"ö×ñ%ğЗûëø âÏ諈ýu|M|±?ïo þ…¾‰˜ãäè-Ŀѷsœ½#¾‹f¾.¼‡fþ|¼–¾€–Ì#¢s:rXÍ£süEú$‡µ<ú4§-ù̱^¹ï>Ù.b²½È'ÛoûdûGŸlÿì“í>ÙV;}²í©åÆâ!ÙÖ!ÙN„d;’í”l§„d;-$Ûi!ÙNÉvzH¶k‡d»vH¶ë„d»NH¶³B²’m„d!Ù®’íz!ÙÎ ÉvnH¶÷ Éö^!ÙÎ Év^H¶‡d»qH¶óC²’í8$ÛqH¶›…d»YH¶[„d»EH¶÷ÉöÞ!Ùn’íÖ!Ùn’í¶!Ùn’íö!Ùî’í!Ùî’íN!ÙÞ'$Ûû„d{¿lï’í®!Ùî’íî!Ùî’í!Ùî’í^!Ùî’íÞ!Ùî’í¾!Ùî’íþ!Ùî’í!Ù’íƒB²}PH¶‡„d{HH¶‡‡d{xH¶G†d{dH¶G‡d{tH¶ Éö!!Ù’í±!Ù’íñ!Ùž’í‰!Ù. ÉvaH¶'‡d{rH¶Éöá!Ù>"$ÛG„d»($ÛE!Ùž’íé!ÙN†d;’í™!Ùž’í’l—„dûÈl’í9!Ùž’íòl—‡dû¨l’íÊlW†d{^H¶ç…d{AH¶„d{QH¶ù$Äd›O@L¶½'»Á/=E\ìÁôTñ47襧‹g¸A/=S\â»ô,ñl7¸¥çˆKÝà•ž+žç¥ô|q™dÒ Ä Ý “^$^ì™t¹x‰\ÒâJ7ˆ¤—Š—¹Á#½\¼Â é•â*7X¤W‰«Ý ‘®׺A!½Z¼FÝjñZ7أ׉×K¢{ƒx£ôћě%ѽE¼Õ þèmâ:7ø£ëÅ nðG7Š›Üàn·¸Á½]¼Ã þèVñN7ø£w‰w»Á½GÜæô^ñ>7è£÷‹¸A}PÜî}ô!ña7裈ºA}L|Ü úèâ“nÐGŸŸvƒ>úŒø¬ôÑçÄç%Ñ}A|Ñ úèKâËnÐG__uƒ:úšøºÔÑ7Ä7Ý Ž¾%¾íuôñ]7¨£ï‰ï»Aý@üÐ êèGâÇnPG??uƒ:ú™ø¹ÔÑ/Ä/Ý Ž~%~íuôñ[7¨£ß‰ß»AýAüÑ êèOâÏn@uƒú›ø» Ðÿˆ;Ü €î 2Ùæ“moä4!÷ðOSÄT÷ÐOÓÄZîឦ‹î!ŸÖ3ÝC<­#Öuï4KÌvÑbŽ{X¦õÄúîa™æº‡eÚÀ=üҽĆHøD/Ol„Û=“m>y1ÙæÌ“mŸ¬Y$8"`²ímŠ„OØš!á“´æH°2Ùö¶D‚3.L¶Ù™lû„­µØ θ0Ùö¶C‚3,L¶½Hø„­ƒØ ¶&ÛÞÎH°Ýè}Ä}‘`»Ñû‰]`»Ñ]ÅnH°ÝèîâþH°ÝèÄH°Ýèžb/$|Bv Ø Θè>b_Ÿ°ôƒMûÃBÀ0`²ÍD€É6Ÿ„™lÑÁâ ‡Á$épqÌL:Rãï‹ÑâÁ0GÒCÄ10sèXqŒ¿oÆ‹`Ž¢ÅCa*i¡8 f,³€.NáŒ.“mïTÎè2ÙöNƒáŒ.“mo1 ë“mï Îð2Ùö΂ñ3%%âlΨ2Ùö–Â\Dçˆe0œAe²í úÇdÛ[s)­«`8ƒÊdÛ;†# &ÛÞ…0~†æhqŒŸ©9F<†u’ɶ÷xΨ2ÙöžÃU&ÛÞ“aü Ï)âbßžNOƒñíêtñ ߾ΗÀpF•ɶ÷lΨ2Ùö.…áŒ*“mïy0¬³L¶½Ë`8"b²í½†u—ɶ÷b˜{èrñߎWˆ+a8Âg²í½ †u˜É¶÷ ß®¯WÁøv{•¸†3¦L¶½ka|;¾Z¼†3¦L¶½×ÂpÆdÛ{= G`L¶½7¼Aoo†a]e²í½†u•ɶwŒïÖ‹`|¿°QÜãû…Íâß/Ü.Þãû…­â0¾¸K¼Æ·û{Äm0¬£ú^ñ>ÖQ}¿ø G„úAq;R|»)~fñaX?3÷ˆø(,ë&“mïã°¬›L¶½O²n2Ùö> ˺ÉdÛû,,ë&“mï󰬛L¶½/Âú¿—Ä—aý ß+â«°¬›L¶½¯Ã²n2Ùö¾ ˺ÉdÛû6l}G|¶1}O|–‰“m1ýHü¶ýDü¶ýLüvoú…ø%lkú•ø5,‡ÃL¶½ß¶§ß‰ßÃr(ÍdÛû#¬ŸÁüIüÖÏdü"þ »ýMü¶+ý¸¶;Ýd²}ÕbÛ“&D{ MSa}Â’&Ö‚íGÓÅ Ø´¶˜ ;ˆÖë¦Yb6ìP 1v8­'Ö‡õ N®Ø–uŠÉ¶·!,ë“mo#X>1Ùö6OóE Ëç&ÛÞ¦°>j&6‡õ‰P ±%¬O„ö[ÁúD¨µØ–íɶ·,ë “mo,ë “moGXÖA&ÛÞଃL¶½û²2Ùöved²ííë—îâþ°¬ƒL¶½=`Y™l{{Á²2Ùöö†ed²íí Ë:ÈdÛÛ–uɶw ,ë “mïA°¬ƒL¶½C`Y™l{‡Áò9ŽÉ¶w,Ç…L¶½£`ù/œ˜l{†å¿pb²íËç<&ÛÞq°çÐñâXŸ¸M…eÝe²í˺ËdÛ{,ë.“mïXÖI&ÛÞ©°¬“L¶½Ó`Y'™l{‹aY'™l{gÀ²N2Ùö΂ed²í Ë:ÉdÛ[ ëÀ9b,ë$“mï\XÖI&ÛÞ XÖI&ÛÞ*XÖI&ÛÞù°>A\ .„õ âÑâ"XÖI&ÛÞcaY'™l{‡ås0“m|þe²í=–ãZ&ÛÞŰœqf²í= –ãX&ÛÞ3`}By¦¸–ÏËL¶½gÃúDðq),ë,“mïy°¬³L¶½Ë`Yg™l{/„ee²í½Ö'žËÅK`}â¹B\ Ë:ËdÛ{,ë,“mï°¬³L¶½«`Yg™l{WòÎ2Ùö®…ee²í½Ö'ªÕâµ°>Q½N¼–ÏáL¶½7²î2ÙöÞ ËºÝ"Þ ËºÝ&®ƒeÝÖ‹`¢ÅM°>¡Ý,nAÌj&Û¬§L¶9cÌd›õŽÉ6gp™l³Þ0Ùö)ì=ˆ}ÿ¿ ±Ÿá¼±ïŸïCìûÑûÅû~ôAq;bß>$>ŒØ÷£ˆ"öÉðcˆ}ÿö8b?ƒ÷bß?=‰ØÏà=…Ø÷GO#ö3vÏ öýѳˆýŒÝsˆ}ôiä û‚ŠGqDBóÿY©ˆá°Š^Q!0¥"‹i ûj œÙ¹œn .:gSÅãxBB¨.WfTÌbFFNE?ÊÚêd>=W²Gô¼PQ@Q‚V2j[†™M6 EùÞ„%£¤ÂÆT}<룧 Í"©˜Ã< ° b$ÅE¼¥âm.ù.þ.«xïI×MŲªxŸƒ>À’ŒU|„U|KÂGÑœnfc.É“sSS‚íUÅ´ É4·=´¸¦âS|FjhiÝÔL1/,mRhÎ…‰Œ¦—ÈçøBÆ—*¾Â×¢÷…Ú…Yaj…)mÖ03ÕÜßPw•Œ‹Âiµ! A‘yaÚ'lº±ÈP4¹ÁúÌä u5—¯dëùÛë·ß¨M-J00©ÓwÝCÏàD&3\˜'«3ò düdKd)$ahM×1O#¯gÅúÛ$ý±µß´G¯.'̬M]í§×`±^R ÁS‚¨%anȳ#R+΃3E–Xg&rÔS¤1 gEžêa‘£·œ¥´eéeñÓ´÷¦ä|2¥RôL¦ºË÷Q{ s^Ñ2æéÀ ‹ô!¡ VÆ0õLº³V«¤X¤/ ÝuN,:úƒ†qÂúrú¤ 8¿^,:—ש•.Z³å62i° kZnÔâ±»–ÍiZ%ƒ–å(!/è–éd8P§Ú:l¨þ¶{ûôRØCŸæýŒü#ËG}ãh|ŒVíð4w­B꺅†Ô*<7á½8Qôíª"/Ñg²º*ðu•á­ÀjV6=È·h« xýʱe¸§ u„†­q¯§×Z ¹†#l…|nH\Ë÷ û)¢‚Fž·† Û¸ä“VîþÖsî_ï:ë?© ?Í—&iØ3бžý[nòd÷4/£±û6šËØ–\¹ûí´,ã í´”ÑZÁv*¡“Cn!”ªîR5;VñP*IivR@h‚\¡2ÂËPت`—»Ñ÷öüŠðZ‚U´§†Ý¸49LRÞÌ@\Ÿe u¯ï ¶“2maW† v¯Üý{ÉCÅÆoTk=º^ëxéÈ{úÛ׫œd«ýAUv.㨢û‰y;Ýè‡Óìdwu»cÆ_K DcyíúŸ\§q‡…iÜôôo–ûûMr§’ehßáRw{®`'òÜØÇ«C4óΡ«HÑüð/è¡–ÛO²=Òr ‚a¢4µÐ­FØOSÝ?¢gѺÀƒ.po‡\`·Ã`«{Ë~ªÅQu´ªêPK Lg08¥ª1°é"org/javacc/parser/REndOfFile.class;õo×>.fNv.vnF6›Ì¼Ì;Ff Í0Fçü”TFn÷ԼԢĒT¿´DF)(MŸü¢tý¬Ä²Äädý‚Ä¢âÔ"} œ5 +#ƒ ¦lk^Šš[fÐ8e,Ò©é¥9‰E®E©ÅÅ™ùy Š L@‡#ÈX Éä iF ͪµq#X#;TšH341nË1PK Lg08&=KW<!org/javacc/parser/RJustName.classQMOÂ@œ¥@-ÔPDÁo„@5Ö;Æ 1FC8¨áàmÁµ©––l‹ñgišxðø£Œo‘x³Éìì{3›7»ŸoïQ1``1…–ä ,#¯j+Š­*VPPÔ±¦cA—Â}ÉPnÒ±ïøïví>—¡ö…p—'$aè~!}*|!y$Z·œ¡P½®M1R¤ñFp#’G®ïFÇ ZµÖf8¨N1\÷¯7UÑö¸ïØ—‘t}§^k›HÃ41‹9 ÈèØ0±‰-Û v”ì¢ÌPœ’á|F-Þ£AJÿHÈÿc:£#×oº>ÝÅÎ(Ÿ7¦éq¹xƒ‰’Ý Ix¼#<†ìïT4»AßÐ=*1e$œ§S1Z€a ÁŠ/ˆ=c9½ÀD’›„õ íù§´+ä×h/¨¶µ7D|DRÚ“#èÖþ3ß|PK Lg08­¤¢"org/javacc/parser/ROneOrMore.classR[/A=ÓÝíj»JÝïT•vU‹G„ˆˆˆVDÂÛjG³Ô®L—øY$½$$~€%¾Y"‘¬¤/ç;3ßåÌœ™Ï×w«X×1ÃX„`\ÂD½˜Œ"Ž©(¦1#eg1'IÉæ%KéXБfЯñ§{Á.º¢V¸±­J¥po‰…^{¨[bŸ x£a»Î&Cì€;\X?¾¶H0s™ h¤•ª{n•3„·lÇö¶”Löœa7ÐpæÞrg³«#ÈÃ’†0l`K2úÐo Y&–uä ¬ o  aUÂò SÂe‡—EÉtƒTçbО%<lÈ©G¦‘+ wªdÜÿ5ô*»ÕjÉ}$6dÖï0iÅè?f2D®xÍvжCsØ!=Gݧ1{Ï­?ÜQQ¸â$éWÄéWQ©´˜BŒ¼#¤ÕBSÜy»è TÊ5¡¨ªÙ„6ÙFxC[×h» ]FõïB%–{|z¨ŸÁ _ÐÌz^~Ó#?éEÒU(NÈ´¹ÜD¤…¨Œ± 3ׂö݃/PK Lg08Rfñ?êý(org/javacc/parser/RRepetitionRange.classRMOQ=ofÚ±ÃÓòU¡  PÀv,n\XâÆcBiRº{¶Ï:¤Ì”שaçÆ¿ÀaÃVK›øü þx߀ÑEMÜÜsϽç½wï™ù~ñõ€-G Kc¦nHÕT5Rôöâ?ûµÚî˜ö yÜ—aSêi¶8–q‡auŒ®.»2b²¥.Â6]VøÑjítä‘ c†\q7Y±C7øµ—‡´dE;÷»þ×êTÇ }âú,0meL»•àü5’-„ed&Å%bn¬7óÌ ÏÀü $GhÅká{˜H¾Á:"U5Y9ËûãSeÂô9ìw;»üIäÆLã#Ü2tÀyœÊ§´l€‰r>EâœEr-:Åòœ47ÿhn]iÎ.Œ=(1¹·éžcêS2~PK Lg08ú4ýúB!org/javacc/parser/RSequence.class}’ÏkAÇ¿“ýŽS£nµj“mêF«EDm ö¶&cزîÖÝM/^ü¼Š¼VhS° žûGß4A%îáÍ›yŸ÷÷ÞìñÏoß4qÏBvsÒ” TòPqÅÀÕÃ\m«¾'=W’Ž»ã'©H\Šª>Ž»‚AÞ#¥Vo3”j§eëmŽó(r,¢ÆQ‡Ã°pZõ¹èõC?yòf'iÄÇ,.âÔ8.âÇËh¸Íá¢ÉP˜¼žãî2”§Ü¸!^÷EÔ¡.Ô4x+Nzh1X"¯D”­d²ŸV}ÔQèG=÷Ù‹m¥îµ4óŠW¦Ïg#£¦ˆ¨Ksü7Ã`¬t»kñ.yÕÚÿÄät8é‘2°æéIUú;h#ÇKžBÍŒl‰vŸ‘ƒEëgl€œú³ÒUP~@- íAß<„±Ö؇¹NÆòTæéQža’ô´e[#h€¼zß,™cÍOhJ¯dNк„-[eغ§½7Ù—á±<±l•Î{}ôŽã‚+' ç3Î8•væìëoòò˜\$2Gky‚tŠgpÎYú“ô PK Lg08xUnQ/F&org/javacc/parser/RStringLiteral.classÍ: xTÕÕ÷Þy3ïÎäe›ð€!AAâd5,#K4 H£•!ó&3qfÂâR[‹­µu«ÕšÔ F4ÔÒV„(H± j»×î«Ý÷Ån•ÿœû–y“LBë÷÷ÿå®çž{îÙï}ó™×Ÿ9IYÈ~â£3èF/ÝDßä%qÚ­k°Õ‰ÅµX\‡Å›ez½x:›±ˆÈt>Ö[°èÂ"Š…ŽE7=Xlå4æ£ÛèvNãœöâP‚Ó¤—öѰHa‘Æ"ƒE¿î ;±µËG¢t77bq§7#ž[8} öoÅâ­2}›„èF,nãôí>º‡ÞŽw`ëœÞÁé»8½¾÷~NÞå%mônÜé,îÅÙû8}¯ÞO߇‡|@¦úÈrÄë¥ïÇâ!ìÈtÐGšè°ó0¶>ˆÅ#>º—îÃâQ¢Ét¿\IÇâ ™û`·2=à#ëè‡pë'qäÃØ:ÈéG°þ(§C*žâôNŽ ™‡9=ÂéQNGqêc¸óÓôz‹2}V¦'9ý8rãÏqú ÄðIÿ”L?Íéi}ž¾à9¿Èég8ý,§ŸÃ^>àÊç‘ /qúN¿Èé—8ý2§_áô«8ü5N¿ÎéËœ~ƒÓorú-ÄûmN¿Ãéw9ý§ßçôœþÓ!màô9}…ÓŸ æŸ"Ó†­Ÿcñ ,~Éé¯8ý5§¿áô·œþŽÓßsúNÿÈéŸ8ý3§¯rúNÿÊéß8ý;§ÿàô8ý'§¯qúºëÖ3gÎpz†3ÂåŒqæâLâÌÍ™‡3™3Ι—3gœ)^ÒÄ ¬[Å@+Á¢ ?e>(¦q¦r6³œÍä,ÀÙ,ÎÊ9«ð±ÙìÎæp¦q6¨g•œÍÃú\Îæc]ÅÙy 8,ˆjÎBœÕ ÞZÎpVÇY=g qóó9[ÄÙbl^ÀÙ…œ…9»ˆ³‹9»„³Ζp¶”³eœ-—é\P v)([hevgM¸Íåx˜•8³ ÄÍVãôkÆ%W`q%g-œµrÖÆÙZÎÖqvgë9kçlgWƒe°¸vgo⬃³k8ëäìZήãìÍœ]ÏÙfÎ"œmᬋ³(g:gÝœõp¶·{žÁ¶¡ßxgÛe§Äëôè”ø[¶EvDêã‘DO}{&Kô,¡Ä×Ù+c‰(%´™ ´è Jä®­‘TS"CI¶Ö%Ó‰¦?‹×oÔ»2É )6V­J¦»2±°ëdÞH<ÞŒ»§))ëÌ·i,‘ÑS½z4Éè¸@º:qítçLk$ÓµU”¦3‘T¦=‰ÊKƒ¤ Xã…¦d¼¿”jZ;Ê.½)–ÙÚÜ“H¦ô¦H Ï NÄ”‡‡ ŠÂU1 7+ð2ƒ•€q ºá Å8zYV˜@Äz½1•dÐóÊ¿:¯‚ *àº!sŸ`ŽÉ5Õxàé´Ûº d]_nù$ áOrÊÁei`~MžT<)S¥( DN4;€À—LéeýÝÝ:Ú8Ï$-®O æ=_Ú–¢ÐzºPf½ KÐr…%±èÃâ(èLPè,lUÐrJJÆû…žCç(T£sz.¯Ð*,ÎÃAZ­Ð5´V¡³q=‘YJaiǪ¨…4a‚ZÜPhmG$Þ¯§ë´P=%‹ûú·Äc]º¨ºc 0¨ï¼NÛ¶-=Î$µeÚM ­¤óÀ±Ü²Dfý ÛAO*l'»°Ø ¤°é\™Ý¤°›Ù- { ŽÜJ7(ì­ìm »n¶'ÀÈj5…½‰¤• ÛÃnWØ;Ø;A¸ùù­°;Ø»öZ™Ý©°wS`i;"}7DA×öƒ?ªD¬w!gïÆâvÂî¥u »iy/÷³÷Q²·-™XÐØÞÔܬ¡3tÁ)ÓZZj±„–Ò{úã‘”¦ïêKéét,™¨[×Á2µÞÈv]K÷§tmw²áµÌV]ëJ¦R )m½‰ê)mçVà7Îw¥tPNbèq­–L`?’Ѻ" mk$ T©,ZZÏÔÉì…=ÈÞ¯°‡Øí`Õy´ZalPa`+ìƒìðmÍí²9Ñýc{¶=ª°!l=ÆöÊl?†=2aËì … Ó¥”h±¬o²hk‰¥3ˆë€B/¦—äÝÒ²Tpy'qù‡ö$û°Â"ööQ ¨ËÇPyË4 ØŸéO%@ÿZ“;Ðg(ì)˜ Â¡žÜÁFÀ×j «ÁÆ”ì‚ó¡KA‡Q厠ü²Q™SØ þiöŒe\õÂy¨8Çé• ;åF ]¢°gqä$ûx~¾LZ¥ÌN)ì9ö …}Ifpñ•hK3 “ÝÚvЦÐËh“Â>ÅnaÚ¦/Û*n ºÓ¶m>xàôæçqº/™®pˆÏh‰°^ x²m[¯‘# €á"ðgºs ¢?Ì"8é§‘’u0Õ·ô÷ÀÉôHo]úËx"X ãmI­l‚‡¶ý‰q,aZ‹àKÇ@Aë*Q>wM²©ìz»ÍõQa*ݱT:£Uj5Z0‡Òíüj(*ÿ¨ Cx©Îœ“_'VˆYƒž°o&µ[»IëêO¡bb‰¾þÌõiƒ@(¢8¬^¢K|â ¢ðëbɺæµ+wué}p š^ ˆLõë3h«fLrj…F-¯®\ŠDÇõ]B¦m‘^=Ý ô´˜‚êåÉM¥É&‡‹hÐŒ¹VáÛ[{R+S©dª.®LwEúôtÐPÍ:áí×vͳV æEÕ`´ð­ÇKès¸Ò£gV&¢˜ÇM!ˆ f2@#¿ V#ÇKƒB/k-áØ9¨ÙÉ>‘NÔfPaÖ¬-¾*ìy:Xkø…Ûƒ|C@â`½P¡ ÀåÓUØZ‰ÅjºKÞuÑÄ“ Ï3O碗ŒC>SX«åLQ ‹]±n-„`£Ý ,“ƒÖ´¬U-3òjmÙ2maKµ¡N—fÙ3, Ò–ZÀâejÓFó¸A8 ÎæÌU0¶Ð¤*×èç ZU•6qt%÷hþ›LsÅô¬3Êx÷c9ž°ÃJ” šÅlÍúÛ¶MÜ¡ o¿,–1²)œÇC¥÷ :nÑ sÏjîUY¸Q…'êÓbcúß”Çý6ÍÿM"‘`ß[ kLïŒ![,ObÌAØ~í‹ì3 û,f€Ÿƒ,•}[/±/(ì‹tžÂ¾Ä¾ ffœ® Ó(ÐÚ¸ƒØG6¸£[j·õ8À/ ¢Ëƒ¶å¹µ*à¡Ì¾ù û* n©lE¬«ÄT+‘Ìh[t›q‚yàµ| B/¥+Y­åëÚˆ3ë´æŒ¶î]ãP*t™ÈFë0uƒ¾LþìTšiNdôdra&¹¶+‰[WZ h 2Ãèá›öÚTÕ ˜´ZåÁ¦)¶)ëOĺ’Q}S$…Žr5Z|¯Þ]K®6&ÛÐÃW“130œ°2…õ+)™Ÿç9o‚â•`"îÔÔ$6p_Þi2îyÔ”C~Ý’Ò±ñ™oFq½WG¹ä•"Àzu¢13á1ׄQÂA)©Ê‡!8Š0»à~DÉÅSS=žâæð#³ g¼µš##ñXÔq„;û½)hBe+ÊN¶F„N‚N³@ß’|/÷ö“ëÙžc½¨Ø˜(¤ñ-6“£â øú.|†œ œ¥Ç|ŽZæ[d™r;¨c -ÄgZû®Œº›ç±ÝÖ]wol~«(´Ð4'¢:w»¾ƒõZ+ÔV&ú{qwC Õ¼@ãÖHÝŒ©E€¥Ïf+Uî °-89†;¯í6¾Ê¤Mƒ,e¯ÛQ¥<)|l´Uÿ¢½Ì™Ì^VÇ“[„»*­¿^7Æ)í¤n¹7>hx{Œ˜Ü Ý_Ž)ŠñàID„ßQÄg.ÛëŠ.ܘÓëõ€ýJ·¥¯â»”ÚIXqíê4~JwÅb†¢¶¡ñƒ8wñ«1±ÛP%/„‚>½+&|&þ——çãVc—)LÑN‹<ÐS-7˜1ÅlÖé° $ÿмŒñâ[¾  ζòH«E2ëZ µßy ž ;ÖÓ…Pž½Rw¨Ý¡c„"ø‡Ó‹Ìé*ˆ êY8ª9BØQâÂZ: Kj±Æ‹™”¹ærXƒ»þñãÄÛqŒø“‚’è ¨zŠ&EFU %ô0)…~øWfa¼€^h`d`ðð¡¯è´_%ÓCþ¢œ å œ&>(O_È? †AÏåWÛ]Ë*p|ˆÞ UŢޖÓäý#¤¼¢dE¼Þeßî[½ï$5#¤büØŒ2;wl€tæY»:ÏÚÅ#äœ2§¢nñ 9oŒhƒ¤`„Ì­X<@kjFIå(™7@аy.4Åþ Ú>B¦•x6wÀ!KÖí'…ÆI3Ï%UÃä¤ÿ¼6WXR%X"7Õ¨Ò(©.%g#UÇI¸\³`”Ôú±0æÆH´GI}Û0Ye -lpÜ€Á³Ìeþó ¶ÁíD¶È1Ó¶G¢ÃgnsN/6g€xèMòÍ!&ªö0:üzJÈCdþÙ{æeS”¦R†éE¦:F¬¤Í‡EßTt„=#„ï'\õ€ºÂ\…Ö;d1@‚Ö™aÇZ\ r`KGX%a8 ȘU95÷¢A2O•ùûIù¹x¨cä’AR,&ÿ’1²Tå#¤`”,{µ´à8Y(/íh1¬&%0„XO‘å R@.]vŠ4u4¸Ÿ'3 {ÚÀ«cär%+7©\Ú¬‚Њn<ð(Y5L«½ZèÙc gØU{H•UyŒ¬ÙKîÎ{–ìiÿ ¨l>•çþ¿R¹‡Óá×^1 Œ;ÛªS=RtŒ\±L‡ÐvKG/¦—˜Nð$‘Ðe‘S!%ajWv`×Ç:FZZkËGIëSÇIdmkmmLèARxœ¬ëX°à¹ê)WØ­ºÍ‰!ÒaÂ7HµÒ ÷Q²Þ`•[°ª]pW. ó²Ã 0ãì7c?.|C@jÝã‹~Tlp?qŽŸ̳\!cÄÊÿján7ú%­M ­ò&tPŒ‘kFI§ÿZÃ+ø0ñ†ü× gýfÛœ}øÜg¢ÔðîärýÙ .Ó [ 7;8BÊf-j­}Û€.Ò¶ài²…’² h"QàC@ÂÖápl |÷(éqo%[QÆ÷ý1á~=ÃgŽܧIEÀ].Üw¹íæ½iŒl;8|æ~vÐäÆ2ºÜ$÷foàúFÈöY‹Zjž#ñ2ßâF/zÞS$Ì# dÊy'ž‚ ™DÕw?Ç‚îChG¸L8k.ýYÈJk¤äRºÂ¤D:P.^AÉ’¶ˆmœ$sÐdÿe´ÉY n¨W…@¿Œ¸âv„Ài´†*@g–×`–f«Ò^2Cö¬™½—a£°Ýû™—$‹„ËítàeÐL!> ÞZÚ|¼c)¸f¬ý®¥å08DFFHi¹kXTù¢Ž+O“‡!v–×.ì)‘»M½À\Z.œi•¢Ò†aÒ'B< é©(ßK®Q ÷‘«DÄ?MšE zó"¨1až5Fúóoãç{h…²õyÈ•¶‰|ÌùüœecdÇáþÃÄ-ü™»³¶r£m †U…ü7‰òf(ÇÈ-¤8䋹U”oåÛ¬Ù°m· œo— Øù÷ØÛÝŽÅ;°xgv£<&{‡ƒŒ¬yrühM7­¿cꣽëß<϶\Mט[ÞÜäPïþ¿ûYm:ÒêZ^kZÿõÕZ £A8Ô°¬J³‡ÈtÈqa_•ðŠlå—bbÎl)ŠŽT•%e5ª[Ú Å¢ö=î3Ãg~ ‹žö=.€~¤Æ2´f‹Å‹À?•A]Š®BÚ–FÈ{@ËT Â$K¦æÍ]Y~ßeÓ¹ÒÔ{!7„æ}`÷Ú°PøXÆß+¼?l2Tô¤+ìs…½èÜF kýîo(˜zó÷A :NZPP¥º¨œØGnt…=ªG•¤èY†Û)ª§î1Xç€À‡î’OöÙ*ôb…ˆÔi ÚãÖÊ®<Š+½ÆÊÉÖ “{Û6[‹¥Í‘ðä?h!ñ¿? GœXæ#bÒõ!ÿC¶òg\/göÓ1`zÈ?óZÛœ»,1iœHëì½¶[Ùì̉êB“àA'ÁS# ù?(B²©8ŠsÀ^üHnpVÝî(®ï¶×;NµÔIÊ<Å^{×ì*Ó÷Ygxîl u$=!ÿh¼Yj[Žÿ±¼yD· ZTïw Ñìu[úížù‘‡…×yІFÌàòƒµÍ@ø‡Dù$Þ>ŠªX6>D6çR@Ÿ›Bþ;=èAÜTÉeŠ=ù{ò£Ya+À¨ÇCþ9œùSNÉýM°ã6’Cã%'M$Άä Bå:'ûòdr“œON½ÌÉn¯!5äk½àkµ½`d2¾v2,Ÿ”&ê@þ\òé@ÈĤxé˜þ£¢µ”#PprH¾=P *‹Zkj;ÜÈy­A…ª{®S KÉ[‡èšGȱÚ(ŽX Ž‘±AºØ´·!2¦ŸV=õ˜oz0¿@Kú™jÉŠ!ê3§}ªl䤂¤Dõ”¬ØªÊ›;ÂE 1?!E§É*(­qÈv.rvUwÕ"³GHñiÌmŠsæÝ{É##äPº™f+» H»u„”«E"EÆÊÌ‘»FÈññ£ƒ¤u„œP‹=O.!ϊƵP-#'1Ëò¬„N¡¸ìµ˜1ÆÖìõœ'j16ì™…*úú«"9Ûd/ËêéÇQä…â.Óé?•µ|YÈ5¹ãæÇ¡q‚r<‡Êñ‰†!I×|Kv®rS8×^T„‡ö »\–àØß§™2à öŠÊEtø¤°¾"TG°¥OAO saN6Ÿ¶ýåih!’1ò<êã 6YBâ/äJüéI%¾WH|`‚Ä÷‘Û×È|íyóÎò"Ÿôcä³HØçr†>C/ 9Œ‘/àú/d‘/›—“}ÈáûlÅ{çÅëÿ¿&QàÏCšG’ ­eáR‡­¡Ý Y£ñËa¿êg{ÉjKnÄø•ñîÚv\¥vË?Þ]‹ã«“­v®¹„| )†„Úlùì#B•6†ü_w(¶ôe‹Ã5æ@|#¯óü¦ØmþÙ‘¡¾æA÷õÏWÀ.¾5ÀdÈ™P¼/†üßvÆE#•6çËEyH ÂX‰ä%“g‚ßŰáwÁMCù^nnuȉhq¾dp*!dûôazß;Åžìæ˜%'œÃÜ}é…¹ÑWø€ïOAš3ôeWü ÷ô»s ˆ9ÎÿÜÚäéDXcßÜ—{4úaÞ@ï|4šòÿH4JQµs?†žöb"õ·Ý!ÿ+Ö½ÎôëUjîúïìRgã&•öºogEœ/¡ ÓTï-¶S·'ÅÞûíå?ý¯JÝÆ%Ü—üKÉÖx$YÞülÞàMŸÿ°Á¸ÏÏÄŸ‚™÷ùæW¤ ¬Ÿšœžâá§µö4)¬ ‰·9wùAñÒòUÿëA©…¶Ø\-„“¨/†óœZ͇à6¿Ú A&f_ѽæg§†ÚI=–,?LÊÄ#Ô³äç‡IQ¶Yl^²å!ö=  B”I{#{QCQ è4;(Â÷ LŠ>çýb”üòlÒ œ&Hø—‰ï(è8B^•6%¯“²\8iÞbP¼ãNT¼ ?( …‚%PØÑ€¿É«ÈxKDÃTËvcÔ´ž¬Qã· £…¤Vd¾aw4øž'«Þ ¾yuÀ‡ @Üí¿¶^Ô}»ß¶CÁkûÑ0_Ó,Õ$”ÜB&ûȯ…eµÑµ†e¹ç‰(P£• éeKË]a0-wåþ"Ü…xlú«}ú[Öü=ëé–UÌF77ß^‹@¹®M<­~k"Ä?l÷b8úÿÿ@»ÆÿO¼á«/Ô.O¨˜&ù×gF_1.Û¯X4J" ž€ÇxCdŸÀ–ù A†Ù€œýˆÀ]a¯ê=D® pÕ[o¤ò Ò¢ÿk†7®ñ¿.²xÉÞV¼Ôx­^,5ãç™ìY½pÖ'[^#œ²+ ‹ap»hðdÕm|¬ð|®€OL¢AR.xá®M©øŒ$`¾ç¢7T ’F‹ 2Ê/RuÕVþHWÚùã^z »DºS_¡ìÃy?~®ŽgqIS³w|uceÃxòì—•- O81p`Ʀ&:;ëˆd˜Ü¨rÖØÙ§ÕA“E„ù£”uöw­ ñU„’1Z†?[ ‡Iê{­oÁWÑõ&ä\H~$ü*¯=F§•h£$l|Ï­m[ð” ÞN7˜à5æ7;ë+aè5¤5}Ôø.>šó=ðj›¢Eæoª¬Þ Y~|ƒ?·ÉÒIþPK Lg08}¦¶¨#org/javacc/parser/RZeroOrMore.classR[/A=cw»Ú®KQÔjµ«<"‰—Hômµ£Yj·™®ÆÏ"i+!ñü(ñÍjÄÃJ¼œïÌœï2sf>>_߬aCÇD “a‚„„©00Á f"˜Åœd¤ÎcA ‹’-I–Ô±¬#Å  ^ã Á:rE­xkµ¬J¥Ø°D“‹â¯=Ô-±O ¼Ù´]g‹!zÀ.,ßX40SÎ’F©êž[å ¡mÛ±½%“½dØÍ\¸wÜÙú×dxàHcˆHcÅ@F† Ä0¢#kÀÄªŽœ< ŠÖ$¬£À00¸Ì…{"J® +$ÿq0­éYÂc˜ väÜ#×È…;Urîïz–Ýjµä¶ˆÍ¹õÓLz1ñ‡› ák^³#Û¡>ìÞ£îÓ¨¿½çÖî))Tñ é[ Ò·¢Té1…™G8J«Sô!Dqÿ ìê}¥\Ê1º©šmhÓ]„6µ|B£í.ô|B%”+õ뉹'ÀEïÕkóšù‚þçy¼'§iºBqJÊæjá"2F;0Ì\Úw ¾PK Lg08uôL@$"org/javacc/parser/RZeroOrOne.classQaKÂP=O7׿*µ¬¦–YN”õ14‚¨èK*ùíá^bÄ&oKúY¢PÐèGEwû¼"œwï;‡Ã¹÷}}¿8Æ R(è›uèØŠ¸m;°4”4”4)Æâe*Žn|9vùŒFΔË@HçVŒŸŸ¸¼"‚‰ïu2§ož1¤ëö€A¹ð]Á½ž<½ÎPªí;â:&V±ÆPLdMT°kb/‚,L9ä5TMì£ÆPI8Òï˾Gÿ‘ŸA B.C2KÎwÒ 4eZx.Íñ»†Vwîº]FUµþ—™=@–oÐ÷0:4U)ªh„ëÔåcPK°7 –æâ爾$y†î“¤î—Hw›s(=µ­4æÈ”ÐÚjËRéy•–aÔ©qÕ|ñPK Lg08å'š?ßG#org/javacc/parser/RegExprSpec.classmO=KA}cržùÒK: !¦ÙôJ ˆ] à‰ýºÇŰwì­rËJ°ÈÈ’Ì­Eš›bÞ óxïÍþïw`ŽI\ÄHbŒ ]ÇuI¸].Sý¥Q¥v;õÌÙçV»§ºt\Uyaï m<᪅½4þŸÒ³\ûÔkτɪ!©­¶™J½Ëm&„ÈV/Åá²EE܈œ>ä6÷ 1œÞ½JÊÇâ‡bD¸nMÚ¤LK6„äh¹~Û°ñ¸Á‰¼ t!JˆdÄÏÐ ØÇ 5&ÒÏe‡ˆf? o„:PK Kg08D~Y‹,°)org/javacc/parser/RegularExpression.classuR]OA=C–¶ ­ (Dp»´.ø­EmŒ!A4Ö@äÅ í´]Xw7Ó)Öÿäƒ&–FMüþ(ã•´tΙ{æÌ½gïÏ_ß~XÃÃ2Xŵ$Æa›È§``Eo « Ššx= k)¬ã††›&n™¸Í0ìó}á3Llð#îúíDR´ZdC®ŸEiüÉŽýS;õÆk5†)ûT/ö¨¼’îyúìÎÈeE" ›9»<°†‚Ý?JéÆ" h†æÙÓŽA˜$dÚ©8NãBÉ´8’o1o.ætBžÎÓn ZËNÌ™ê"á|‡ñ¦‡á.FœD¦ÃºÕ«äg­b0,`1¾‚¥™qŠZf(ñ1~Šé_t’[¥' ŠóN®ÐCj»à|Ez»ÅìÂ1,ç ÇÛ-~Š/â7PK Lg08}\b%0org/javacc/parser/Semanticize$EmptyChecker.class”_OÓPÆŸC7ÚnuêÇ „mÕ/£u1ÈQL¸1gåd+vírZü&ûÞpc²Dâ…Ñ[?”ñm7ˆqü±M{þ<¿>ïû¶çô×ïo߬á~—qSÅœŠ[:”r˜GYÃB‹0UÜÖ¡¡¤¡¢bIG>é.«¸£¢ª¢Æ0ýÈ ¼ø1ƒR­m3dœpW0hð©}!ÌêF(;öÿÀ]×îs i7÷û<ˆ¼0X¯íwcê_Ìn¸Š"ÃÒ$õRtÞû\,E¥n¥Iªˆ–Ü ¥0P‡¥â®{˜axpÄüèÅ]/0+ÕF£Q³*¦Ë³-ÌÝ®Ø5Û¦èõã3Š¥t*l¬1ÌO†Û2Å;;Dý§V2²¦zÎv~òÎõIç-ÑãAì¹Þ'±ÜLh§+Üwɧ4þ>!ŸG‘ˆ'­^ÐÈqžùa›ûD,L¯¤o¸O~­>ƒ.Ž+a(Ÿ»H?7s†ëi¥'O4÷½(>=‡Q–M)CI@!»¼É Ãju#ámŸ»ÕÞn¼þ×ÌVú*imÂD¶ÃÚW ]´Tit-í1:lý+Ø$%ˆ™±|ƒÚ)jóÖOL U3‡ch6ˆ’@¯ R˜³~@"s„ìŽUœ>‚úIÔF¢6„žŠ+V1—ŠeóÌ’˜ÂHEÝ*^"ñ8§Uºç¨-Ð?`ÚPK Lg08À\ oh1org/javacc/parser/Semanticize$FixRJustNames.classTÛrG=#_v%Ì%0,6†•%!›ˆI,l#cËŽe @‚2’Æbñ2«š]W~#Oä’—¼@ C‘ªyJU*/ù€üJŠž•p $ ªÒôNwŸîžžÓó×Ï~p•ÆàHÆqSqÄJ ŒS² pLœÖòŒ‰µ<›À9œ×îi÷ãøŸÆ1ŒÏLäL\0ñ¹ÞEúiM|¡÷_jçh™1pÉÀ¼Ë ƒÊ÷C†ÉE_Õ³wù}^­f\BeWE½éq5»ÙP"\_æ†/¸Ò §œä5Bçýš`0ëþ%!B1ØNŸH‚Ë(Bò&ÅàÕ¾ßí{ÍÂ1Œ3êSÛB3‹üž°PÀ‚…+X4°d¡ˆe†‰ÿq†ýÚ#ëqYÏ–BåÊúLs}]áÈUYë®5Û›n•{vèoiKÊg[XÁW ±ñSVQ2°fá*¨Ö£°-\Ç×nX¸‰[¾Á-k­ LiÇm%(O@Amn7”{Ÿ‡Â¦´Î÷nx‡TIòˆÊµÅv½”ì[Üf8ð*\ú2Ó.Ž!ë”®VÒöÒòêlÚ.ÌI– ÅòLqî ˸má;Ø8Cª·k%qËЭº?ˆãsîævÓ†¯í­‚”Bå=z{´7Øíòùyϯp<Žôz¬)!®soC¨åèîX­.(‡¼âÓö-F·Ö ]/{™w"5ñrÈãáhñõ[%ãž>bp]ñO8]ˆåÊ]Q sÉ^•fm£!d!íôæHö¨Úd"œúm Ã^§×/×·í^Í*å+jÕHй‡²Ð†“}ŠîS h†±·2 6½lc ¾ÐŸé©¢wr€þôÐ~‚¾vG`hê ØCèÃqLvÌ#$c$cƒ¿vl'p²cû—B ’ü'õbðwê9bK0nap CÏ1\Ìü‰ÉÔo0n<9ßB¢mKŒî e ÖSìü?¦§Zù92¾×®Ÿp&ÓÂî˜Ú†ŽvA÷èeo¾ÔÁOoãÏ~_ ûßâ}½è ±+MˆƒñA:ó‡^¶aŽÖÉÃÈcæ PK Lg08s|N^Ø™4org/javacc/parser/Semanticize$LookaheadChecker.class…”[SÓPÇÿ‡¤¤- åN”Þ Šw¹(–‹ÅÖΨƒ3Œ/!K $5IÇà³/åEŸä…FxõC9nÇt 3Éž³ûÛ={ÎÙͯß?~¸ŠR]’pQÂ¥(†1â~.Gq£’„‘Š"Ž´«ÉHÈF #%a,‚6WŽGC.J±®E `B ·%ÜahžÒ Í™a’©e1o®q†pÅœã¼Ê-†D²hZ•܆òFQÕ\U±lnåæßVÃÖLc2µB1Õ¡ñÙ,-Õ¶ªº¦jNqVÆt3 ]žòJMW,ò´¸m{¡û‚TÑ47•u®¬1t­ùuSS¹„»2îaRƦ%Ìȸ £• ^¶J¦ÅeÌ⡌AôÉÈcŽ¡?¯pËô醱|3Edè ZŸñ×5n¨´Ð<$,Êx„‚Œ%<–Pdoä±¥Ú;>òw×ùu®nº7 ªä‚ap+¯+¶Ím†¡`È%šå󋺹ªèD ‰çç/â•« = N¬êÞ:9ËîüsTI†vR.˜–Ê‹Š—–§_i˜ËIþŠ®R‰¨ÞÕù“F%åß­WO~\^ÄžZ}TÕ|Õxå‡>½RÏ,ãPº†¶ÞYt©\ÍÑôÜ2WÓ¢ubÿëÜ4u¾Å gÖaèJR¾›®•\yuƒ I·5lZÄkFG5pj% A߆óô—é¥n¢Y:H2’¡ôw°/pªDô™$›HÆ3‡hª#$ìÒ@ðâîÝ#ú+±Éωuôî#$~DdÍu|È@܇´ƒ÷d ב&E¸D¶mij{.­£Óuù„–¬¯iÙÁK¢eŸ–OèÖÝêÑãD·Õ1JtÛ Ý IÓâï6ì¶ïQþ3”¿{<éC͉ÞMPÏdöÐ!|Cg)K{÷ÔÙOÆöpn’¸Q8>‹[ô’Œã:n"üPK Lg08ÅìÐÿ¢2org/javacc/parser/Semanticize$LookaheadFixer.class”kSÛF†ß%˂ڔ@¢47ØN/´Ò´Äâq ”4´)òbbE$9IûOÌè—|É &2ÓI¾öGuzV¢‰=d¦{÷õžç¼Z½üýÏŸ¸…§:F0ªás _dñ%Æ4Œk˜Ðp[ÃWY¤pGÇ×øFÃd¸«CŨTÅ,©¢TSRÅ͘Nü¨L*ÊfJ6c2½$9ržÖaJÀ”€)c2sF÷dS–üý fuÌa>ƒ: Òü*:®'OþVßÉfAÃ’†‡~`Hßv…ÝaH -3(E¿Ê25Šó0Xƒs~P+lÚOmÇ)ìØAȃBéùŽ-B×C+äa;é÷³Ëò(0\i¥x­îÙÁÃØí|+µÈŸÔ¹p¸†GVð#C_+TÜð]‡^¢¿5´Â¿Ìû…/´†+‚ŸM’‰1ðkøÙÀ*~i‹Îùþ–½Áíªkâ²YG­í¤'ãØÀc®$7¥Ú‚ǰ^Ž_xÕš«Tf'ï•&§óùüeG–m _äœø­-Ïwlé”·¬Šð~µB¾m‹Èu(p8%ë™ëyÖ·Ÿ–¥›nP›×°m@Àg˜ý\ÚpÃ#w·&¨Õ|ÛuX(‰je}Úõ¨–;xb @h B¨¡Î0Òná“×pãWŠ;í>—;´ëÝ£,Šž†9 ÷RŠúŽá78Õ€šz¡¼8„>Åg ÄÉ3Cý A©»;¼å Ô]\NTz½‰ÒvÑ™¨LÊËá×HÍì!›Ú‡þô}Ûƒ±K±¨^¡s\1êjât,º›8c*#Mô EÀ㪩&À‡± ଩šJçL•¬sûèÍ™j}0)áüxÚL' bA ýfZq‚™¦ SÙÃES•¹{¸Ô@?uÖ>.7`äz>úW~'çž«$ÐA®×Æ5SK5a˜ZâÝ òî65šm_î׉»ÑÄ ©kùò”¸¡X)Ê>nþ· ËÔêÔcß#ó/PK Lg08É»UÇ«<org/javacc/parser/Semanticize$ProductionDefinedChecker.class…T[OAþ†¶]„"à…Ëʵ¥…â /ETJå"ŠR#>i;”Åíl³»5ÆÂ/ð… ‚ÑÄà“‰?Êx¶­HØ7Ù=;ç|ç2ß93?}ù`Ut¡OA¿‚0" #]Å )ö# FU„ј'ÇCˆz2¦bñ0$TLbJÁ´‚ë n0´ÌÒpçÑX–!˜¶ ‚!T´„( ›A®Zv1¹Ëßð|>Yæ¶#ìdæm™Kǰd*¶I1xÞ¥ÿÿc³ºÑÃ0ìG=ÅŠÉmÛÂqªÑúý¨§–ÜvÉÜÔp3ná¶‚;î"Å0ÔÈÃ.qó™m*Õ"5ÌâC‡Jš\“ë®mÈâ|e{ÛÛn¥˜të9t s¸Oh}‡;º´\='„Ô bÛ¢0¥á*˜×Æ‚† )XÔ°„e+ 3þjÖE‰K×ÈïÄÈßšjñÒ;"ÿÚ«á¿MÚ²”ÂN›Üq„Ã0èO±B«tzÑ´rÜ$Ä€±a ñ‚›o­ÌÐQ>I¶åòœIÝï^­²Sq 3¹Äªšè J^"sdõ,ydëjàBCU.ÃXô”ÇZnWäÝT̯¢^- # ¦èlSÞØ•ËB>õWó©j&¿kÕ4 ç£~\ª!i5Z3¶mÙÄj»Soä–ð4 ã ¶Ø (:a ÒuNx¬r–%Ë+®ã¬ŽAå…BÆ%ò¢Þ4â2Ûð°œ6èt_t6L7I€^:†´ê¥¿N’ŒdóÄØxM .Öͽ$›H¶Æ¿£iÍýà~t —ë WÓ‹ºF ÀVâÇ’àcnÅrïá7üÖ ¥ðþþ…ÿÊ“áw<ý óÿž©ÿP „?ñãÏü» ¦Â§üÅ Ó˜õ?à?™ð¿xø¿Ý°þG‚ÿuÃlž› ÿ'Ã_¹ýKü»§Ü0_ç". ÑX$¡Ã^tò`1IÁ~•d”etq×-a)S*2Žãv¼Œ˜x"?&ÉXÆD“Ýô2…§ËÉœ*ã´.N“Ð#ãt„q†Œ3¹%ãl&>SFÕ m8‡ÅÌ•qžŒó¹{–ŒgËxŽŒü¶€^6îC +¹ýƒ„U×ʸNÆ‹™”¤5Èx ­—±QÆ&]Är›%lqÃu¸_.•°Õ 7r4܈m.X…3ø±HÆvÖl#9 /“p“nÕuýìO$´½úºcÉkvÚ†x4˜ $CÑÈ­3ÑrŒã-YkC»x`µ­—¤Éf7‹rǵîè­1”H"”5^íßá_˜J†Â /ÓÉh|‚JjÝú|q4¹…œÕw-dÚ@`aÌOhñ…­ZW*ìûvÅâZ"Aª«;ÆÚ’ñP¤ËöGºêcDQ²< %W"8*\†à¬5„ $ƒÄjíÑV¡Â9#U˓ײõj[Æ"&ëmÐ%Hy2³8‘ôÇÉ·oW@‹1R48n›?ÑЉƵz‚ñæ/r±?±-éßÖ–Ô{Á„)û€ÌõGØZß.Bˆdª6ØXT‚³Ô 6jɦ(cºÆŽ¡9ïö‡sn]6¶P2[Žñ&x»Àê4$²&r\ÛÓ™*ì˜Fú”¹JâZ9Ø—ÂÂ} œ€“ ¼Ç¼¿¨ÀqîÝ„»¼¿D=Üw îÁ[¼NJx›‚·ãn„ù#×oÒ’þ ܵ¼&á ~™߉w)x7Þ…p—ãª?¨]“òzÔ'¹JD“êV{1-ÞI hA5Š45*ª--ëë.öÕ­QC µ›bAMnóGÔE5ªÚ¦%Mªµ-­õ¾ŽÆºŽú‹}õëÕdTMÆS·$“„™ëÕ(ø¼GÁ{€ûð~ ¿ªà¬ê×ðës?Û1 >ˆ!T¤lÓºý‘d(ºV›_˜Ö¦ìÅo(ø0>¢à7áUŽS‡‡îêTg§FðïÃýµj4HÅ*H‰­†)(U2ž @yxD#š³”$3ÃÇü>°dlUG+N fXãoÃ1„9#E´G·k‘|X¾Ã„³lƒ”´-¦|’MŠAèç|¿KÕ¤QÛ øÃ*Õ€¤¦ÎE8c.™™0bC‹¨A]1²êYxa¦Í"¾H°¥sm(¬)xû.ñµ¬UýBµ…ºÜÁÔ¥©ÝT[Iªš }B! 7ŠÕ6–OT©¡­¦J]î]ÙÞ²Þ×\K«Ä,ºÑ$þÑH¸G ET¿*$˜3¿ášC ÂÒ©dÉšT,Ìš­äF¡çrRb%‰Äà ü^Sð9|^Á#œg¢Vr*Åõº jVa&ª Ã6¶ùZ;„¦MuÍuë|­}|‚RÌH&‘:N3lÐ77,„›,%:ãšVMæD‚£¨×(Ô5R„R¹¡S퉦hˆÑ£î¤à¤°‘3xT¸¬+´CSCI5êŒI5ìߪ…UÒuy³oScÝj_cír_€Wi¿ZÉ0½ˆÏ#4nˆ‡v0ªóØéAþÓ#ÍŒ3ugˆ¨]qw7Ñæò*Q£Àëp<Êò%|„¶Û¦T8Š‘â¦€°ÑIN5BÈpXÍ%•ŽqšLi´%˜4—‹§z‚GÈ0:[ŸÐBd5í^šªÀ÷àeÀÆîÃ×\Uj NuGT_çÌÄ„³s™$œ¡Më&t}u …Hx¹â„è9^æÆFK‹VÑN«kˆ°Ü@…GͳÝI"’!Ö‰íq-Hmí1óÓF½âfO~iomÝÆÆv ¬¹\xÂÃ êø¶a(xæærÜ Zz÷«sü×Oy®NLО7mÌÈ«‘þ#(ßàH›”‹Ë†HRë¢]N ÅÒ›<[9öÆTpVð-.ým#"éI…13YÔ:^rX)’m_R 2 ´’Ÿ4¢”~ÞRð'ì{ïØ*åŸëø üTÁŸr~¼ ï(ð.¼Gu§¦† “é©VW¯¤à}…«ÑÙtˆ±gl”jI:siÁZö ÒÍi-¬K„ͦÛ´kñîP„“ùm|‡êÈH¢:QÓl+zKDk‰7QÊÚî¶[´xÔœ¶aÖ§I„í¬¥¿­NõÛ¢¡ªw¹LÚp[§j„év8]“â‚£à{ÌoCÑïY޶+ø3|HÁ÷¹ª|€?—ð þ?$>ú“Ÿøà5Ì= ~Ä1豩ºÚö›£©”ýÁ%i»ÃS>ÔvìyXÛ^[[µ˜–µ°•O¶kä™#ç/¡·úúuáèV˜o¤t=ò…µnÚ€©VØßòœ !n T°5¼N04,ÉBw=ýZ8¶`ºÜLÒéêÂaƒ”4š=šÎ¾x<'‚ ]Z²Cã—Ž@4Åâm|Øb^;¢Î Rf^Ë—ˆF¿È8ai2žÆÛü´ÑôÃÒN<"öÞåÍ;)¡2~k¤3ï0AuB³ŒðT,È»Ýú"©n.Vú=½Üv‚T£ºÌ¡‘ƒ¢4¢íJZ N©°ÅÚ¥å’hÖ˜7W:ÛŒ1ÝN'<¾Šï1º-·ÄƒZ\¿¯®ûžm3™“ÖhMÌAÕ!Ž/„íòHxÈè¥6‘cKvÀ”øc1-B>¯²sàˆ!ý²ÆŸ`’QóØU¹õe|ÂH2= sLFÑ2/hÚ)ò€uñ7xX|ï‘h¡s=™îb¿·ñvO ´ý‹¿£m1eŸƒâ”v »|²Ã 8’ «Å£‹xß$'ë@‹ÒBbMR`òåvf;éÎMp"©1ÁÒ’Éí$vºò˜ýé6«éÛ{—©î„?tÆãOH 8™ ÛH„B«&}3'ýÅù@À&N'º®%üáËW¶ƒâ0ãjJ”¦áüIZRtêõ’‘ƒµaq­žuÇÂÚ0AÅ¡n?—ÙÒdt#ÅR\ÿp%‘xÞŠÉæd¬>J'¡]$pÞhç}"ùˆIKaÝ€%ú˜AÊû^æbôt…&°e‰Žh§eœ“$RxM`| 'âÑ(©7N|@Û¥SŠ0ͽ“â˜bÎM„ù§ó%‹ìˆí‘¿ó¥¨`rª §Ha­!ÔvQ~ð· «<ÁY—Ÿžèü›OO"©us\Åãþž@4Ö“ûd˜ã 6C J§.N.˜‡aœ óG3êÉüÉŒZ_F¨uó¹ŽÚR@þ¶FÏïÓÛ$jénÅÞÀ#ÝÒéPDú¡È;Ž~pVRc¾nÉñC^èX6h x?Ì£Îô(9ý+‰™_@Þ´03ô¾ tÑ0=u‘.ø!‰,b‘îãP ã¨=4î4”Ò͇AyiÆ9‡)ƒ0¾Æ„4ÈeaR?” ÀäõÞç` BfR§ ©Y8ãL#^Ï LÏ ýjáR‹°±fTfa&Y8ë̪<³‰ëLµl=`î ÌË ½:öjó‰ï¬A8[¬vN!®7 +è×H¢4UÑ|sµ1_QmÌ{éWëô8³PyÎï‡*Ñ€ê“pwk íÊ’ZÆœZv®¥#-:‹ÓÐN«œwƉ‘²ÏÑ œŸ6– ²£.8ÉŽXj‘]hˆ¨=K…ôƒp©0Ë2°›ø—§aê ¬HÃD~å \”.}f ÍôÂJC…Ui8OtMë ea5+]o*}‘¹c¾¼¦Tk,e}Œþ©w2§úam!´ðæØÐÂÓ#¡eízá>S™²upq/ì6ßk‹û¡ÁS,^)&jK<%'tô-[.a[ŠÙŠõ¹ð€ñýÐhp9ØuDP}p6YœÍühÉ‹® ™¡jçAØPh séHÙµ'a¥Ö¥Ðú"´‚ó+Å[;›h†'ÓÍÚã@"Úè×–ú˜'޾›KœåNñ¶fU—;ûá2~+w.&ÝÁƶ=NJÙÑœ`Ç~K µØS,@Ý”v¸E÷lª-q,‘Ê¥ê£û‹þR].-ö”dáó°YK¿ZÙ#Ÿ„5<¾¥&yJúaÃfçUdÿ!Ør6Z—3`ôPù˜µ)_ŽGæ‘LѽÅ \‘&R÷JDMžò/0ä:›ZÖÁ«øá§G?lÍB`‚ešùÖÉo]9·Õä$mË—âÇÕy„ÅÆêÛÓðvÙºZ—c‰›µl¯-õ”¹”{¸0ýj•r*qCºÇÅ»uµ®‚Ñ/¬èªŠÙ=nrËSånç^˜ŸÓ/Êd‚Á2€ÒsNŽ fC`ïà3¸Àxî ׺<®“اÁ Ò‹CH„•´¸ìJ¶4¥“=¨ùéthš8= iÃYnö¸²unYŽ;™ÏŽÞa ;óD\Ä3k 4,àß•G;ÙSÂÔ=d5e;Õ°=fþ®P%32‚ÊÌÑͨ'7·Hts%hN?\{®Ûl ÷†ëM 3Ç8»n°#ÿmK毯R¡å8un$#¾¸^¯*•F$^Y™WUšª¨ª4W$9oIî+‚›Dë¥}ÎÔ' ®ja~fè•ÌÐ^}é4V©ŸýŒJ}·}¥NÃ5¢{ V•9 »8¤Ò|V{Šóà½Ù$á*;k—äbQ-do6ÐÚ­èdH\râÍÆF4Ë 5™Vt³âÊϰ¢¶Ð ±¨Óò[p­ØNš›Û—8I‡^ÀåŸxœË¦§a…c™~æ°Wa:n*{íŒAØ“†IÔ»¥ÜUÎ-‡à2à:«ð! $³¯&cfeÁ¹åVZï6óÜR@8-o1}µÛ3C¿UktG/ÈUƒðåM$MDàa‘·ï3#ïz»í…}…;{árOIÑ!¸ÓS2w¥a™¤wI*Î_I~žªáž\.ßk͔ݗ;5•8Ibfè¦ÌÐ T Øý$ê«:`…>Ó³?'rº[ÑÁö ø±qVÞH\'µ ÞJ=zé×Tu&T‰J´½Š}tÚn·BI­ÎÛ,š ²ôЯ«ÂVgŸ£Ï8;¿ oK¼N-Ç_ò‡Ò0žà{ _£à裑¯§¡ØÉpZ,uÔiÌÂCG<’¦(¢¦×$ý†Ùy8 ^"}8 ä3Åæ›ˆCŸ°ZDý¨NýhöŽJÝ;ô‰£OÈÞ§«±/ ûY Ã07¶Ö ÃEt) ìð¬JaX—cÅLoÛÓ©y|æâJÝÐ'Ày`O팿áYž:ºTîo{‘“GU„oy«Áã<äÝL[œW‚Ç Amx¡Rà3É[it{24˜6ÓYxB Þ_)ƒ½YȈÁ*uÌ*-Ìšª &{«r0P>ý.-•³%•fõ™q³·šè«:(ÉÐoèà ”WøUšÞ~À€ïmxÇ€¯Ô¸¦ y)sîp,Ÿ¡ƒ÷{6~ÆbÊÙ¢½Ð­¿LÕ‹4l²Y6?‰ÿ¡µö …C™x±âê]xÏæV¼Ö+6š7) WqMÿUÂd!w‘;ó«Œ>¿ºgŸÁÖ ·qK·¢Hm…}¸…†6²†ûNCȘÅËÑg’:­ž£b•lzRÏÃ'³ð”m†Y=+kûtê¾,<}ÔÏèYûL¾Kã<ò¬>òl#ýúH#Y}$›…C|À êOì"â¾v!E߸èô«qÇ\ßâPÔ‡¼çÈ<¯ëâÄ´Ð'ì¡‹ÑâaîdøŽØt`ô3º]ôôâÂ[Ú>â¢7ÿñ÷ÏÑ-ïøPK Lg08­XŸÀÅþ'org/javacc/parser/SingleCharacter.class-Ž=Â0 …ŸÛB¡”ß…‰ XÂK'&$ö¢RTR ÷b@H €C!À’õb¿Ï±_ïÇÀ½Zuøh‡è„è‚<3š@ BUùù`žÚq'áÎ,3Y9'ø£ñšÙ¤Ø2Œ’ñ:F„FŒê„aaS±—©”8J{ÒV¬2“æ:ÙI+U©-¡ã|‘K“Šåf¯U‰!ŸðY>gU¸¿Jî[V“·pó«ËJŽÜAWü"Bóo÷ÿ8{2¸Áû3PK Kg08±LFãÆÿ%org/javacc/parser/Token$GTToken.classuN½ÊÂ@œÕhLŒ‚"X¨÷õŠ…íûC ¹ˆOà Yˆð>€%nRØYìÌ.;»3¯÷ÿÀê.,¸ò(ÛðlÔ%£d´ õž@>¡8 uxžšu)"©±>›P“á–`Íã½ò`£ä¡€"¡›@¤ÒÝNœ¤I”›ø¨t±É˜`;Ï×Z™y$“D%„ÖSô8¢Å‘‰‹M²ŽROF‡§6ïóÌÕQgü¸Þ‘»™²Êè2§?*p>PK Kg08šâCÓ}org/javacc/parser/Token.class}SMOÛ@}“—@¡‰¡”ZÇT5÷¢^r@‘"õP„Ô£IV–Á¬‘mhÏUMOT*¢*R@TÕYgfÞì¼Ù7³»öï??ØÁv66¨£c³ÛRî…‰—&¼ tÓ5á̽ýýôXH‚Ó—Rd½$Ìs‘jDZ¨O°EËA,a¦Œ{irvÂ{L!Gã¼ÍÑ$[OˆsÍÁQxI(£à}‘Å2zúR|*­AšEâ‡Ãà4Ìr‘å \âä§b‡‰ÌŠDq&g¬¸äuÿÑ|wx$†…Òì¥#fÝXÆÅ[BÕëpÖë+Xöú÷çP„U¤ãÕ]Ý›Y-)>ê!^?¨òŸC¬r÷©´ƒ6\åÖ8xä ‰EÂÊ”rÂú¦£_ÏÁ3læïÞ 6ø¡mþ$,jÄaVãœÆy y–—ð¸ÄåMŽVð„}‹W³ŒÄX¡  ¬âinAsuÿ ôí†^Õô"ª¨(Aߥ+Tn ÖtËt•qNí÷ÝKTýW—¨M Ÿbý^£ï¨çh©‹Ðô.je£ö×’sÙ>³}aÛšØ5êÚÛ<ÇÅ5Œ22o•žk¥&ë¨FF›~Àšœx†}ƒÑà;æÿí/PK Lg08ñ«Ë;î%org/javacc/parser/TokenMgrError.classTßSUþnÈMºHØ6´” [ª°d±¡þ¬Ð¢4líjhZˆP*–.ÉBÓ n6Çqúä8>:¾éø¢Ó‘_êƒÑÿÿÿƒŽçì&À´qÆ9çžs¾ïž{î¹÷îßÏþø À4ü®& 0—À{xŸÕ¼Ä5Žä$$L‰ëHܰ$>”ø(<™qS¢À3n±s[b‰Çe‰¢ÄÇ+«ŒÞIàU¬IÜ•øDb=q|ÊjŽÕ½8̸ÏÊŽa3†’@_Þ¼cåæóæÒRaI@XËÕ݆o»þŠ]k:*Ÿ–S—‹óE+·A|s)d3"RÖÍ•ù¼µ°ÑIÅL“Áœ¿P¸µ±`Í\Ñ\à`D îx^ÝËÕËŽ@Â.—ÍFÉÞuãz~Ç~dgk¶[É.û^Õ­ÌN¾ˆ†“•¼óyµd×LÎ'`èw-Ëz‘Ÿëš#QqüE§Ñ°+”é´Þ•Ó{¥êVý9ˆ>¹"0Ø¥>‹áÿZ9@Ÿ_knm9ž‚w1CYƒ-l œXßTPÅ[>+—Õ+Õ« VëÔ…iúbx  †‡¬.3ÐTà²[E–nwH Z®Ù¾V«ºŽÆè.Ä”Vª×š]M yQÓL·Toº¾ã9åwo®Ï‘!Æ|*øu¼AKh:5drŠ€¸½ElmF#Â;¸Ì;j(¸]Á[x›]jâhÝ«d¹¥Rv×öŽ—-Ö8îbÅk\ÿQƒÚ‘äó-£jjŽ[ñ·ƒ³ [Ú[Ú¶½yêQT·&säÛ»»Ž[˜ú_—(<ªnà±hë‡V—~½³ê nY]¯F¼ÑÜl´IÃz—+v¸Â°Þ%Ã!{į¬@Gœê–e–ã]6´‚óôŽÇéAõà,& Óä7‡ ùÆ1Šü׎ùÉÏó§IÓ‰‘îEšO˜7éeg)sþ„XÛlj|dn$ÓBägÑŸi!ú+ÍxBGøÝ&‘$ÅvìI‚d›D!ñHúH¾$#ùšd‚ä[’u’öðÔP{Zè]ÝÃ/† ­ U†Öw†­o 5Z õdhù†ª„ÖŽ¡ö…Öý Ðµ«Ií'ÄÓÉÇOp£½õ%b¤“Éô“ÑBr&jt Š E‡¢´×X9ZPCV˜6n¤[8µúUDì=ûÇ ðÓ Á›‡/¡vn'éi^¯…”:HÆgÈ8÷=¤zv—:´! ¦zpîÃd¾š‚^ ÉøPK Kg08ÑHñÜÞ'org/javacc/parser/TokenProduction.classuRÛnÓ@=;±cZJI)—^(© ¸\ÞZ!¡(Q‰pÉð´uŒµ­kGöõ·ª*àø(Ĭª€ÄƒçÌ9»s<³»?}ý`/-\ÇŽÇ*Ø©£'*ØXú ¬ÿÙ17°VÖþÓÆ0ÏÆÓPŠ,ý«vptLþäÛ ë}-,`‘ná†:t8Ä›sü&ñ¥9~‹øò¿MœÚ(ïñé Wgxw¦ß›q¨Dš©Änâa‰[%V(£#¡¸Ml eÀŠ{æ~C%¸€vÝÕÏQu)«}V&Ü«š6ôR[5¾Ã4ÇôÝ©ûAÕ±ü æ\ó¿À¾¬ÂoPK Lg08ë; b…¼$org/javacc/parser/TreeWalkerOp.class;õo×>NvvvFŽô|—ÔÔ‚Ô"F Ÿü¢tý¬Ä²Äädý‚Ä¢âÔ"}׊‚ļâÌüñœ$Œ©˜ò]*åž8gÕà‚¸Vó‚e [¾ð“mê3J' é½ÐõÜæ%]l?{Ž<ò’Jé%¸¨ÛGIì‹ún³Vó⊎<¾êøŠEKXÖ±"Ã* %&Öt B—Ìb˜î—t·vƒÐ¡¥ Ÿèez³CÖ EÂ}AÒÆŒžý«çdB¥ô‹Äqוn†Á«K=È¥ñ÷e‘?<Š·l‰dŒ4==·ÏsNž—ûçï¯ßžb­ˆk¸eâ6@E³YÍæ4Ü5)zO§Ì—p èÀÃ"᱆',USGžlJ2Ì5TÜr¼#Ï÷ÝÈ‹Û"v7á:C~-Aò–!kU?3äÖUS0¬Z—È>©¯BÖ¯ôK-šÃˆÁ¶6:Íí$Aèn‹¤^=?‡žl¹ÛIÈÖûÎþ¾ˆëeÜ0`s,Âá¨iXÒàj¸ŽINãyÆ1Ë+xÎñBÃK¼2ðšco4P?³ÃåíŠXmÅTLU®¨žafDÓ4Ò=Ñ d#äÁ6©É0¥¥ô÷º ;‡””÷„ÄB& åÿZÞÚ;~B%Ž_ CÁW2ñÙf˜²†Õ]ZŽ×l ^ô<#yN_>Z*Å‹"!IìXú‘aXNïÇFŠèFNÐýhDzkIJÄh·„7é4™F€1û ì;¦–1Õ/!C`A‡íÅSdºÈêo®K§‹¼}JoÆ@K¢¯}‡=ÀŠ]qÎPøèØ?afð cµÍ‹ìÔ~ Ô×&•ܧ‡Bã;µ“Ô ÿPK Kg08 WZ­ç„!org/javacc/parser/ZeroOrOne.class}RmOÓ`=Ï6Öu+(S@ˆïv]g|ÃM$| YÜŒ$|²tK±²üÎõÉb÷‘·­>´‘‘.ÃÐø9z€5«bŸ¢ðÖ¶¾CÏà fêÇÌ‹ìÖ¿¡4€a _É}°( 0»[?N›áPK Lg08 íAMETA-INF/þÊPK Kg089)¼^\j¤+META-INF/MANIFEST.MFPK Kg08íA¹org/PK Kg08 íAÛorg/javacc/PK Kg08íAorg/javacc/jjdoc/PK Kg08íA3org/javacc/jjdoc/test/PK Lg08íAgorg/javacc/jjtree/PK Lg08íA—org/javacc/parser/PK Lg08íAÇorg/javacc/parser/test/PK Kg08׃ø Â ¤üjavacc.classPK Kg08“<8Ï ¤èjjdoc.classPK Kg08!¿¬Þ ¤àjjtree.classPK Kg08eÔ\¤¶org/javacc/JavaCCTestCase.classPK Kg08ýY®|¤óorg/javacc/Version.classPK Kg08©íºœˆU ¤¥org/javacc/jjdoc/Generator.classPK Kg08ˆì© §$¤korg/javacc/jjdoc/HTMLGenerator.classPK Kg08¬•Ì B!¤¶org/javacc/jjdoc/JJDoc.classPK Kg08¨Xk'È#¤¼org/javacc/jjdoc/JJDocGlobals.classPK Kg08V“[†± ¤Å org/javacc/jjdoc/JJDocMain.classPK Kg08ÑöESßP#¤´)org/javacc/jjdoc/JJDocOptions.classPK Kg08#ì •ÇY $¤Ô+org/javacc/jjdoc/TextGenerator.classPK Kg08Ã]àœ‚¤Ý1org/javacc/jjtree/ASTBNF.classPK Lg08º[‰SêÀ$¤µ3org/javacc/jjtree/ASTBNFAction.classPK Lg08ÖÁW®õ(¤á6org/javacc/jjtree/ASTBNFAssignment.classPK Lg089L# ©ñ$¤Õ7org/javacc/jjtree/ASTBNFChoice.classPK Lg08†M?c)¤À8org/javacc/jjtree/ASTBNFDeclaration.classPK Lg08U”ÅÈ­ô'¤j;org/javacc/jjtree/ASTBNFLookahead.classPK Lg08¾§æÜ»'¤\<org/javacc/jjtree/ASTBNFNodeScope.classPK Lg08~ÙÕ¯ö)¤}>org/javacc/jjtree/ASTBNFNonTerminal.classPK Lg08tv®Z¬ô'¤s?org/javacc/jjtree/ASTBNFOneOrMore.classPK Lg08ÎÙÇî°ø+¤d@org/javacc/jjtree/ASTBNFParenthesized.classPK Lg08ÙÊÅ«ó&¤]Aorg/javacc/jjtree/ASTBNFSequence.classPK Lg08¬”ˆ“¬ó&¤LBorg/javacc/jjtree/ASTBNFTryBlock.classPK Lg08í¸ZÑ­õ(¤ÊzS¬ô'¤/Dorg/javacc/jjtree/ASTBNFZeroOrOne.classPK Lg08©baïö)¤ Eorg/javacc/jjtree/ASTCharDescriptor.classPK Lg08yçÒ>'*¤Forg/javacc/jjtree/ASTCompilationUnit.classPK Lg08¯«·ó-¤œIorg/javacc/jjtree/ASTExpansionNodeScope.classPK Lg08E6$Ï"¤ÚKorg/javacc/jjtree/ASTGrammar.classPK Lg08Õ猷œÓ#¤éMorg/javacc/jjtree/ASTJavacode.classPK Lg08ù[Þ°S1'¤ÆNorg/javacc/jjtree/ASTJavacodeBody.classPK Lg08Û/§ÀŽè¤^Qorg/javacc/jjtree/ASTLHS.classPK Lg08z"…euF )¤(Sorg/javacc/jjtree/ASTNodeDescriptor.classPK Lg08y=tuÙ$3¤äXorg/javacc/jjtree/ASTNodeDescriptorExpression.classPK Lg08qeòB¦Ø(¤Zorg/javacc/jjtree/ASTOptionBinding.classPK Lg08ärÊý{"¤ú[org/javacc/jjtree/ASTOptions.classPK Lg08ìƒ/ž²ù,¤µ\org/javacc/jjtree/ASTPrimaryExpression.classPK Kg08ß¿;Æö%¤±]org/javacc/jjtree/ASTProduction.classPK Lg08[0â¬ó&¤º_org/javacc/jjtree/ASTProductions.classPK Lg08„uu§£ê¤ª`org/javacc/jjtree/ASTRE.classPK Lg08;úR«ò%¤ˆaorg/javacc/jjtree/ASTRECharList.classPK Lg08ƒ~oÕ¨ð#¤vborg/javacc/jjtree/ASTREChoice.classPK Lg08È$5`¦í ¤_corg/javacc/jjtree/ASTREEOF.classPK Lg08”cu§ï"¤Cdorg/javacc/jjtree/ASTRENamed.classPK Lg08÷¨!«ó&¤*eorg/javacc/jjtree/ASTREOneOrMore.classPK Lg08r’(®÷*¤forg/javacc/jjtree/ASTREParenthesized.classPK Lg083›d«ó&¤gorg/javacc/jjtree/ASTREReference.classPK Lg08%š`;ªò%¤þgorg/javacc/jjtree/ASTRESequence.classPK Lg08Kଧî!¤ëhorg/javacc/jjtree/ASTRESpec.classPK Lg08¹Û±i¯÷*¤Ñiorg/javacc/jjtree/ASTREStringLiteral.classPK Lg08môk¬ô'¤Èjorg/javacc/jjtree/ASTREZeroOrMore.classPK Lg08½²|(«ó&¤¹korg/javacc/jjtree/ASTREZeroOrOne.classPK Lg08i8$°ø+¤¨lorg/javacc/jjtree/ASTRRepetitionRange.classPK Lg08Ù³«ò%¤¡morg/javacc/jjtree/ASTTokenDecls.classPK Lg08’CVœ7 ¤norg/javacc/jjtree/IO.classPK Lg08ä› ‡Ö,¤Ítorg/javacc/jjtree/JJTJJTreeParserState.classPK Lg08†ž½² ù¤žxorg/javacc/jjtree/JJTree.classPK Lg08ªáþÄ}+%¤òƒorg/javacc/jjtree/JJTreeGlobals.classPK Lg08>Óᑬ)¤²‡org/javacc/jjtree/JJTreeIOException.classPK Kg08Ã÷IjôE "¤Šˆorg/javacc/jjtree/JJTreeNode.classPK Lg08¬Ê %¤¾Žorg/javacc/jjtree/JJTreeOptions.classPK Kg08Á<äწ&¤ž“org/javacc/jjtree/JJTreeParser$1.classPK Kg08Âìæl,¤e”org/javacc/jjtree/JJTreeParser$JJCalls.classPK Kg08ÁÌzÇï†5¤••org/javacc/jjtree/JJTreeParser$LookaheadSuccess.classPK Lg08/_ÛRFht€$¤×–org/javacc/jjtree/JJTreeParser.classPK Lg08éΦæ .-¤_ÿorg/javacc/jjtree/JJTreeParserConstants.classPK Lg08øäNª1€z0¤½ org/javacc/jjtree/JJTreeParserTokenManager.classPK Lg08{!øh« 1¤µ>org/javacc/jjtree/JJTreeParserTreeConstants.classPK Lg08}E˜®U p#¤¯Dorg/javacc/jjtree/JJTreeState.classPK Lg08wEŸW P&¤EOorg/javacc/jjtree/JavaCharStream.classPK Lg08ÁcÁîJ¤àYorg/javacc/jjtree/Main.classPK Kg08·—Èi¤[org/javacc/jjtree/Node.classPK Lg08Å‘"á-&!¤ \org/javacc/jjtree/NodeFiles.classPK Kg08·Y aá {!¤*morg/javacc/jjtree/NodeScope.classPK Lg08º”/ þ€ &¤Jxorg/javacc/jjtree/ParseException.classPK Kg08çofôZF"¤Œ}org/javacc/jjtree/SimpleNode.classPK Kg08 àyïÉþ%¤&org/javacc/jjtree/Token$GTToken.classPK Kg08ù.ìÓ}¤2‚org/javacc/jjtree/Token.classPK Lg08· üÛî%¤@„org/javacc/jjtree/TokenMgrError.classPK Lg08{ACL "¤qˆorg/javacc/jjtree/TokenUtils.classPK Kg08W™E&ˆx¤ýorg/javacc/parser/Action.classPK Lg08вçÁÜ %¤Áorg/javacc/parser/BNFProduction.classPK Lg08ÿˉÐÝ&¤àorg/javacc/parser/CharacterRange.classPK Kg08¡öV]uœ¤ô’org/javacc/parser/Choice.classPK Lg08±Ô2p’´!¤¥•org/javacc/parser/Container.classPK Kg08ßr˜$¥!¤v–org/javacc/parser/Expansion.classPK Lg08úq[ðzÅ+¤Ù™org/javacc/parser/ExpansionTreeWalker.classPK Lg08nŠ5%–b$¤œorg/javacc/parser/JavaCCErrors.classPK Kg08´×àËõ ±%¤t¡org/javacc/parser/JavaCCGlobals.classPK Lg08¼Ž¹¬&¤¬®org/javacc/parser/JavaCCParser$1.classPK Lg08Ï¿&›äl,¤o¯org/javacc/parser/JavaCCParser$JJCalls.classPK Lg08›×&}í†5¤°org/javacc/parser/JavaCCParser$LookaheadSuccess.classPK Lg08XTÐW×0¤Ý±org/javacc/parser/JavaCCParser$ModifierSet.classPK Lg08°PF‹Ögòn$¤‚´org/javacc/parser/JavaCCParser.classPK Lg08õ41ψ +-¤šorg/javacc/parser/JavaCCParserConstants.classPK Lg08yˆp+ %-¤m*org/javacc/parser/JavaCCParserInternals.classPK Lg08µÓô·q3‡}0¤ã6org/javacc/parser/JavaCCParserTokenManager.classPK Lg08]¸3W P&¤¢jorg/javacc/parser/JavaCharStream.classPK Kg08ˉŠÇ*¤=uorg/javacc/parser/JavaCodeProduction.classPK Lg08–ZüŠ@íÍ!¤Lvorg/javacc/parser/JavaFiles.classPK Lg08FŒ-$Ñ ¤·org/javacc/parser/KindInfo.classPK Lg08£8½÷¼/D€¤w¸org/javacc/parser/LexGen.classPK Kg08ã]xùP!¤oèorg/javacc/parser/Lookahead.classPK Lg08ãíúý %¤§êorg/javacc/parser/LookaheadCalc.classPK Lg08CSKF¥9 %¤‡õorg/javacc/parser/LookaheadWalk.classPK Lg08´âÅC‡ þ¤oûorg/javacc/parser/Main.classPK Lg08 öïcÚ!¤0org/javacc/parser/MatchInfo.classPK Lg08ä{—;}§*¤Iorg/javacc/parser/MetaParseException.classPK Kg08—Sùµã{¤ org/javacc/parser/Nfa.classPK Kg08ÈÉвù6V} ¤* org/javacc/parser/NfaState.classPK Kg08;ÄbVtz#¤aAorg/javacc/parser/NonTerminal.classPK Kg08£‘¥ò(¤Corg/javacc/parser/NormalProduction.classPK Kg08t è‡!¤Gorg/javacc/parser/OneOrMore.classPK Kg08ÏHÐ6 >¤(Iorg/javacc/parser/Options.classPK Lg08xj" È%¤›Uorg/javacc/parser/OtherFilesGen.classPK Lg08H¦i‚¨$¤_org/javacc/parser/OutputFile$1.classPK Lg08ºvqõ+93¤Ä_org/javacc/parser/OutputFile$NullOutputStream.classPK Lg08sHÔdØ7¤@aorg/javacc/parser/OutputFile$TrapClosePrintWriter.classPK Lg08€Êð "¤²corg/javacc/parser/OutputFile.classPK Lg08Ò<'‚A#¤âmorg/javacc/parser/ParseEngine.classPK Lg08ÅÖ;$û€ &¤¥Šorg/javacc/parser/ParseException.classPK Lg08'ÚÕfQ¶S ¤äorg/javacc/parser/ParseGen.classPK Lg08MõÉãÑ"¤s«org/javacc/parser/Phase3Data.classPK Lg08…'Œ8À=&¤„¬org/javacc/parser/RCharacterList.classPK Lg08/ååÁS ¤ˆÈorg/javacc/parser/RChoice.classPK Lg08¥ª1°é"¤ÛÍorg/javacc/parser/REndOfFile.classPK Lg08&=KW<!¤ËÎorg/javacc/parser/RJustName.classPK Lg08­¤¢"¤aÐorg/javacc/parser/ROneOrMore.classPK Lg08Rfñ?êý(¤CÒorg/javacc/parser/RRepetitionRange.classPK Lg08ú4ýúB!¤sÔorg/javacc/parser/RSequence.classPK Lg08xUnQ/F&¤¬Öorg/javacc/parser/RStringLiteral.classPK Lg08}¦¶¨#¤Aõorg/javacc/parser/RZeroOrMore.classPK Lg08uôL@$"¤*÷org/javacc/parser/RZeroOrOne.classPK Lg08å'š?ßG#¤ªøorg/javacc/parser/RegExprSpec.classPK Kg08D~Y‹,°)¤Êùorg/javacc/parser/RegularExpression.classPK Lg08}\b%0¤=üorg/javacc/parser/Semanticize$EmptyChecker.classPK Lg08À\ oh1¤§þorg/javacc/parser/Semanticize$FixRJustNames.classPK Lg08s|N^Ø™4¤eorg/javacc/parser/Semanticize$LookaheadChecker.classPK Lg08ÅìÐÿ¢2¤org/javacc/parser/Semanticize$LookaheadFixer.classPK Lg08É»UÇ«<¤Þ org/javacc/parser/Semanticize$ProductionDefinedChecker.classPK Lg08ü¸XKI*#¤ã org/javacc/parser/Semanticize.classPK Kg08uœ›° ¤³ org/javacc/parser/Sequence.classPK Lg08­XŸÀÅþ'¤¡#org/javacc/parser/SingleCharacter.classPK Kg08±LFãÆÿ%¤«$org/javacc/parser/Token$GTToken.classPK Kg08šâCÓ}¤´%org/javacc/parser/Token.classPK Lg08ñ«Ë;î%¤Â'org/javacc/parser/TokenMgrError.classPK Kg08ÑHñÜÞ'¤ó+org/javacc/parser/TokenProduction.classPK Lg08ë; b…¼$¤.org/javacc/parser/TreeWalkerOp.classPK Kg08ŒÓ£É ¤Û.org/javacc/parser/TryBlock.classPK Kg08 ?8îêˆ"¤¼0org/javacc/parser/ZeroOrMore.classPK Kg08 WZ­ç„!¤æ2org/javacc/parser/ZeroOrOne.classPK¡¡k3 5javacc-5.0.orig/examples/0000755000175000017500000000000011247044052014345 5ustar mkochmkochjavacc-5.0.orig/examples/Lookahead/0000755000175000017500000000000011247044052016234 5ustar mkochmkochjavacc-5.0.orig/examples/Lookahead/Example8.jj0000644000175000017500000000405210535127040020243 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.basic_expr(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } void basic_expr() : {} { LOOKAHEAD(2) "(" expr() ")" | "(" expr() ")" | "new" | "." } void expr() : {} { "TBD" } TOKEN [IGNORE_CASE] : { } javacc-5.0.orig/examples/Lookahead/Example7.jj0000644000175000017500000000375210535127040020250 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.funny_list(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } void funny_list() : {} { "," ( "," )* } TOKEN [IGNORE_CASE] : { | } javacc-5.0.orig/examples/Lookahead/Example6.jj0000644000175000017500000000403010535127040020235 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.basic_expr(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } void basic_expr() : {} { ( "(" expr() ")" | "." ) | "(" expr() ")" | "new" } void expr() : {} { "TBD" } TOKEN [IGNORE_CASE] : { } javacc-5.0.orig/examples/Lookahead/Example4.jj0000644000175000017500000000372210535127040020242 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.identifier_list(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } void identifier_list() : {} { ( "," )* } TOKEN [IGNORE_CASE] : { } javacc-5.0.orig/examples/Lookahead/Example2.jj0000644000175000017500000000401110535127040020230 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.basic_expr(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } TOKEN [IGNORE_CASE] : { } void basic_expr() : {} { "(" expr() ")" | "(" expr() ")" | "new" } void expr() : {} { "TBD" } javacc-5.0.orig/examples/Lookahead/Example10.jj0000644000175000017500000000373010535127040020316 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.IfStm(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } void IfStm() : {} { "if" C() S() [ "else" S() ] } void C() : {} { "TBD" } void S() : {} { "TBD" | IfStm() } javacc-5.0.orig/examples/Lookahead/Example5.jj0000644000175000017500000000403710535127040020243 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.funny_list(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } void identifier_list() : {} { ( "," )* } void funny_list() : {} { identifier_list() "," } TOKEN [IGNORE_CASE] : { | } javacc-5.0.orig/examples/Lookahead/README0000644000175000017500000006555610535127041017134 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This directory contains the tutorial on LOOKAHEAD along with all examples used in the tutorial. We assume that you have already taken a look at some of the simple examples provided in the release before you read this section. 1. WHAT IS LOOKAHEAD? The job of a parser is to read an input stream and determine whether or not the input stream conforms to the grammar. This determination in its most general form can be quite time consuming. Consider the following example (file Example1.jj): ---------------------------------------------------------------- void Input() : {} { "a" BC() "c" } void BC() : {} { "b" [ "c" ] } In this simple example, it is quite clear that there are exactly two strings that match the above grammar, namely: abc abcc The general way to perform this match is to walk through the grammar based on the string as follows. Here, we use "abc" as the input string: Step 1. There is only one choice here - the first input character must be 'a' - and since that is indeed the case, we are OK. Step 2. We now proceed on to non-terminal BC. Here again, there is only one choice for the next input character - it must be 'b'. The input matches this one too, so we are still OK. Step 3. We now come to a "choice point" in the grammar. We can either go inside the [...] and match it, or ignore it altogether. We decide to go inside. So the next input character must be a 'c'. We are again OK. Step 4. Now we have completed with non-terminal BC and go back to non-terminal Input. Now the grammar says the next character must be yet another 'c'. But there are no more input characters. So we have a problem. Step 5. When we have such a problem in the general case, we conclude that we may have made a bad choice somewhere. In this case, we made the bad choice in Step 3. So we retrace our steps back to step 3 and make another choice and try that. This process is called "backtracking". Step 6. We have now backtracked and made the other choice we could have made at Step 3 - namely, ignore the [...]. Now we have completed with non-terminal BC and go back to non-terminal Input. Now the grammar says the next character must be yet another 'c'. The next input character is a 'c', so we are OK now. Step 7. We realize we have reached the end of the grammar (end of non-terminal Input) successfully. This means we have successfully matched the string "abc" to the grammar. ---------------------------------------------------------------- As the above example indicates, the general problem of matching an input with a grammar may result in large amounts of backtracking and making new choices and this can consume a lot of time. The amount of time taken can also be a function of how the grammar is written. Note that many grammars can be written to cover the same set of inputs - or the same language (i.e., there can be multiple equivalent grammars for the same input language). ---------------------------------------------------------------- For example, the following grammar would speed up the parsing of the same language as compared to the previous grammar: void Input() : {} { "a" "b" "c" [ "c" ] } while the following grammar slows it down even more since the parser has to backtrack all the way to the beginning: void Input() : {} { "a" "b" "c" "c" | "a" "b" "c" } One can even have a grammar that looks like the following: void Input() : {} { "a" ( BC1() | BC2() ) } void BC1() : {} { "b" "c" "c" } void BC2() : {} { "b" "c" [ "c" ] } This grammar can match "abcc" in two ways, and is therefore considered "ambiguous". ---------------------------------------------------------------- The performance hit from such backtracking is unacceptable for most systems that include a parser. Hence most parsers do not backtrack in this general manner (or do not backtrack at all), rather they make decisions at choice points based on limited information and then commit to it. Parsers generated by Java Compiler Compiler make decisions at choice points based on some exploration of tokens further ahead in the input stream, and once they make such a decision, they commit to it. i.e., No backtracking is performed once a decision is made. The process of exploring tokens further in the input stream is termed "looking ahead" into the input stream - hence our use of the term "LOOKAHEAD". Since some of these decisions may be made with less than perfect information (JavaCC will warn you in these situations, so you don't have to worry), you need to know something about LOOKAHEAD to make your grammar work correctly. The two ways in which you make the choice decisions work properly are: . Modify the grammar to make it simpler. . Insert hints at the more complicated choice points to help the parser make the right choices. ---------------------------------------------------------------- 2. CHOICE POINTS IN JAVACC GRAMMARS There are 4 different kinds of choice points in JavaCC: . An expansion of the form: ( exp1 | exp2 | ... ). In this case, the generated parser has to somehow determine which of exp1, exp2, etc. to select to continue parsing. . An expansion of the form: ( exp )?. In this case, the generated parser must somehow determine whether to choose exp or to continue beyond the ( exp )? without choosing exp. Note: ( exp )? may also be written as [ exp ]. . An expansion of the form ( exp )*. In this case, the generated parser must do the same thing as in the previous case, and furthermore, after each time a successful match of exp (if exp was chosen) is completed, this choice determination must be made again. . An expansion of the form ( exp )+. This is essentially similar to the previous case with a mandatory first match to exp. Remember that token specifications that occur within angular brackets <...> also have choice points. But these choices are made in different ways and are the subject of a different tutorial. ---------------------------------------------------------------- 3. THE DEFAULT CHOICE DETERMINATION ALGORITHM The default choice determination algorithm looks ahead 1 token in the input stream and uses this to help make its choice at choice points. The following examples will describe the default algorithm fully: ---------------------------------------------------------------- Consider the following grammar (file Example2.jj): void basic_expr() : {} { "(" expr() ")" // Choice 1 | "(" expr() ")" // Choice 2 | "new" // Choice 3 } The choice determination algorithm works as follows: if (next token is ) { choose Choice 1 } else if (next token is "(") { choose Choice 2 } else if (next token is "new") { choose Choice 3 } else { produce an error message } ---------------------------------------------------------------- In the above example, the grammar has been written such that the default choice determination algorithm does the right thing. Another thing to note is that the choice determination algorithm works in a top to bottom order - if Choice 1 was selected, the other choices are not even considered. While this is not an issue in this example (except for performance), it will become important later below when local ambiguities require the insertion of LOOKAHEAD hints. Suppose the above grammar was modified to (file Example3.jj): void basic_expr() : {} { "(" expr() ")" // Choice 1 | "(" expr() ")" // Choice 2 | "new" // Choice 3 | "." // Choice 4 } Then the default algorithm will always choose Choice 1 when the next input token is and never choose Choice 4 even if the token following is a ".". More on this later. You can try running the parser generated from Example3.jj on the input "id1.id2". It will complain that it encountered a "." when it was expecting a "(". Note - when you built the parser, it would have given you the following warning message: Warning: Choice conflict involving two expansions at line 25, column 3 and line 31, column 3 respectively. A common prefix is: Consider using a lookahead of 2 for earlier expansion. Essentially, JavaCC is saying it has detected a situation in your grammar which may cause the default lookahead algorithm to do strange things. The generated parser will still work using the default lookahead algorithm - except that it may not do what you expect of it. ---------------------------------------------------------------- Now consider the following example (file Example 4.jj): void identifier_list() : {} { ( "," )* } Suppose the first has already been matched and that the parser has reached the choice point (the (...)* construct). Here's how the choice determination algorithm works: while (next token is ",") { choose the nested expansion (i.e., go into the (...)* construct) consume the "," token if (next token is ) consume it, otherwise report error } ---------------------------------------------------------------- In the above example, note that the choice determination algorithm does not look beyond the (...)* construct to make its decision. Suppose there was another production in that same grammar as follows (file Example5.jj): void funny_list() : {} { identifier_list() "," } When the default algorithm is making a choice at ( "," )*, it will always go into the (...)* construct if the next token is a ",". It will do this even when identifier_list was called from funny_list and the token after the "," is an . Intuitively, the right thing to do in this situation is to skip the (...)* construct and return to funny_list. More on this later. As a concrete example, suppose your input was "id1, id2, 5", the parser will complain that it encountered a 5 when it was expecting an . Note - when you built the parser, it would have given you the following warning message: Warning: Choice conflict in (...)* construct at line 25, column 8. Expansion nested within construct and expansion following construct have common prefixes, one of which is: "," Consider using a lookahead of 2 or more for nested expansion. Essentially, JavaCC is saying it has detected a situation in your grammar which may cause the default lookahead algorithm to do strange things. The generated parser will still work using the default lookahead algorithm - except that it may not do what you expect of it. ---------------------------------------------------------------- We have shown you examples of two kinds of choice points in the examples above - "exp1 | exp2 | ...", and "(exp)*". The other two kinds of choice points - "(exp)+" and "(exp)?" - behave similarly to (exp)* and we will not be providing examples of their use here. ---------------------------------------------------------------- 4. MULTIPLE TOKEN LOOKAHEAD SPECIFICATIONS So far, we have described the default lookahead algorithm of the generated parsers. In the majority of situations, the default algorithm works just fine. In situations where it does not work well, Java Compiler Compiler provides you with warning messages like the ones shown above. If you have a grammar that goes through Java Compiler Compiler without producing any warnings, then the grammar is a LL(1) grammar. Essentially, LL(1) grammars are those that can be handled by top-down parsers (such as those generated by Java Compiler Compiler) using at most one token of LOOKAHEAD. When you get these warning messages, you can do one of two things. ---------------------------------------------------------------- Option 1 You can modify your grammar so that the warning messages go away. That is, you can attempt to make your grammar LL(1) by making some changes to it. The following (file Example6.jj) shows how you may change Example3.jj to make it LL(1): void basic_expr() : {} { ( "(" expr() ")" | "." ) | "(" expr() ")" | "new" } What we have done here is to factor the fourth choice into the first choice. Note how we have placed their common first token outside the parentheses, and then within the parentheses, we have yet another choice which can now be performed by looking at only one token in the input stream and comparing it with "(" and ".". This process of modifying grammars to make them LL(1) is called "left factoring". The following (file Example7.jj) shows how Example5.jj may be changed to make it LL(1): void funny_list() : {} { "," ( "," )* } Note that this change is somewhat more drastic. ---------------------------------------------------------------- Option 2 You can provide the generated parser with some hints to help it out in the non-LL(1) situations that the warning messages bring to your attention. All such hints are specified using either setting the global LOOKAHEAD value to a larger value (see below) or by using the LOOKAHEAD(...) construct to provide a local hint. A design decision must be made to determine if Option 1 or Option 2 is the right one to take. The only advantage of choosing Option 1 is that it makes your grammar perform better. JavaCC generated parsers can handle LL(1) constructs much faster than other constructs. However, the advantage of choosing Option 2 is that you have a simpler grammar - one that is easier to develop and maintain - one that focuses on human-friendliness and not machine-friendliness. Sometimes Option 2 is the only choice - especially in the presence of user actions. Suppose Example3.jj contained actions as shown below: void basic_expr() : {} { { initMethodTables(); } "(" expr() ")" | "(" expr() ")" | "new" | { initObjectTables(); } "." } Since the actions are different, left-factoring cannot be performed. ---------------------------------------------------------------- 4.1. SETTING A GLOBAL LOOKAHEAD SPECIFICATION You can set a global LOOKAHEAD specification by using the option "LOOKAHEAD" either from the command line, or at the beginning of the grammar file in the options section. The value of this option is an integer which is the number of tokens to look ahead when making choice decisions. As you may have guessed, the default value of this option is 1 - which derives the default LOOKAHEAD algorithm described above. Suppose you set the value of this option to 2. Then the LOOKAHEAD algorithm derived from this looks at two tokens (instead of just one token) before making a choice decision. Hence, in Example3.jj, choice 1 will be taken only if the next two tokens are and "(", while choice 4 will be taken only if the next two tokens are and ".". Hence, the parser will now work properly for Example3.jj. Similarly, the problem with Example5.jj also goes away since the parser goes into the (...)* construct only when the next two tokens are "," and . By setting the global LOOKAHEAD to 2, the parsing algorithm essentially becomes LL(2). Since you can set the global LOOKAHEAD to any value, parsers generated by Java Compiler Compiler are called LL(k) parsers. ---------------------------------------------------------------- 4.2. SETTING A LOCAL LOOKAHEAD SPECIFICATION You can also set a local LOOKAHEAD specification that affects only a specific choice point. This way, the majority of the grammar can remain LL(1) and hence perform better, while at the same time one gets the flexibility of LL(k) grammars. Here's how Example3.jj is modified with local LOOKAHEAD to fix the choice ambiguity problem (file Example8.jj): void basic_expr() : {} { LOOKAHEAD(2) "(" expr() ")" // Choice 1 | "(" expr() ")" // Choice 2 | "new" // Choice 3 | "." // Choice 4 } Only the first choice (the first condition in the translation below) is affected by the LOOKAHEAD specification. All others continue to use a single token of LOOKAHEAD: if (next 2 tokens are and "(" ) { choose Choice 1 } else if (next token is "(") { choose Choice 2 } else if (next token is "new") { choose Choice 3 } else if (next token is ) { choose Choice 4 } else { produce an error message } Similarily, Example5.jj can be modified as shown below (file Example9.jj): void identifier_list() : {} { ( LOOKAHEAD(2) "," )* } Note, the LOOKAHEAD specification has to occur inside the (...)* which is the choice is being made. The translation for this construct is shown below (after the first has been consumed): while (next 2 tokens are "," and ) { choose the nested expansion (i.e., go into the (...)* construct) consume the "," token consume the token } ---------------------------------------------------------------- We strongly discourage you from modifying the global LOOKAHEAD default. Most grammars are predominantly LL(1), hence you will be unnecessarily degrading performance by converting the entire grammar to LL(k) to facilitate just some portions of the grammar that are not LL(1). If your grammar and input files being parsed are very small, then this is okay. You should also keep in mind that the warning messages JavaCC prints when it detects ambiguities at choice points (such as the two messages shown earlier) simply tells you that the specified choice points are not LL(1). JavaCC does not verify the correctness of your local LOOKAHEAD specification - it assumes you know what you are doing, in fact, it really cannot verify the correctness of local LOOKAHEAD's as the following example of if statements illustrates (file Example10.jj): void IfStm() : {} { "if" C() S() [ "else" S() ] } void S() : {} { ... | IfStm() } This example is the famous "dangling else" problem. If you have a program that looks like: "if C1 if C2 S1 else S2" The "else S2" can be bound to either of the two if statements. The standard interpretation is that it is bound to the inner if statement (the one closest to it). The default choice determination algorithm happens to do the right thing, but it still prints the following warning message: Warning: Choice conflict in [...] construct at line 25, column 15. Expansion nested within construct and expansion following construct have common prefixes, one of which is: "else" Consider using a lookahead of 2 or more for nested expansion. To suppress the warning message, you could simply tell JavaCC that you know what you are doing as follows: void IfStm() : {} { "if" C() S() [ LOOKAHEAD(1) "else" S() ] } To force lookahead ambiguity checking in such instances, set the option FORCE_LA_CHECK to true. ---------------------------------------------------------------- 5. SYNTACTIC LOOKAHEAD Consider the following production taken from the Java grammar: void TypeDeclaration() : {} { ClassDeclaration() | InterfaceDeclaration() } At the syntactic level, ClassDeclaration can start with any number of "abstract"s, "final"s, and "public"s. While a subsequent semantic check will produce error messages for multiple uses of the same modifier, this does not happen until parsing is completely over. Similarly, InterfaceDeclaration can start with any number of "abstract"s and "public"s. What if the next tokens in the input stream are a very large number of "abstract"s (say 100 of them) followed by "interface"? It is clear that a fixed amount of LOOKAHEAD (such as LOOKAHEAD(100) for example) will not suffice. One can argue that this is such a wierd situation that it does not warrant any reasonable error message and that it is okay to make the wrong choice in some pathalogical situations. But suppose one wanted to be precise about this. The solution here is to set the LOOKAHEAD to infinity - that is set no bounds on the number of tokens to look ahead. One way to do this is to use a very large integer value (such as the largest possible integer) as follows: void TypeDeclaration() : {} { LOOKAHEAD(2147483647) ClassDeclaration() | InterfaceDeclaration() } One can also achieve the same effect with "syntactic LOOKAHEAD". In syntactic LOOKAHEAD, you specify an expansion to try out and it that succeeds, then the following choice is taken. The above example is rewritten using syntactic LOOKAHEAD below: void TypeDeclaration() : {} { LOOKAHEAD(ClassDeclaration()) ClassDeclaration() | InterfaceDeclaration() } Essentially, what this is saying is: if (the tokens from the input stream match ClassDeclaration) { choose ClassDeclaration() } else if (next token matches InterfaceDeclaration) { choose InterfaceDeclaration() } else { produce an error message } The problem with the above syntactic LOOKAHEAD specification is that the LOOKAHEAD calculation takes too much time and does a lot of unnecessary checking. In this case, the LOOKAHEAD calculation can stop as soon as the token "class" is encountered, but the specification forces the calculation to continue until the end of the class declaration has been reached - which is rather time consuming. This problem can be solved by placing a shorter expansion to try out in the syntactic LOOKAHEAD specification as in the following example: void TypeDeclaration() : {} { LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" ) ClassDeclaration() | InterfaceDeclaration() } Essentially, what this is saying is: if (the nest set of tokens from the input stream are a sequence of "abstract"s, "final"s, and "public"s followed by a "class") { choose ClassDeclaration() } else if (next token matches InterfaceDeclaration) { choose InterfaceDeclaration() } else { produce an error message } By doing this, you make the choice determination algorithm stop as soon as it sees "class" - i.e., make its decision at the earliest possible time. You can place a bound on the number of tokens to consume during syntactic lookahead as follows: void TypeDeclaration() : {} { LOOKAHEAD(10, ( "abstract" | "final" | "public" )* "class" ) ClassDeclaration() | InterfaceDeclaration() } In this case, the LOOKAHEAD determination is not permitted to go beyond 10 tokens. If it reaches this limit and is still successfully matching ( "abstract" | "final" | "public" )* "class", then ClassDeclaration is selected. Actually, when such a limit is not specified, it defaults to the largest integer value (2147483647). ---------------------------------------------------------------- 6. SEMANTIC LOOKAHEAD Let us go back to Example1.jj: void Input() : {} { "a" BC() "c" } void BC() : {} { "b" [ "c" ] } Let us suppose that there is a good reason for writing a grammar this way (maybe the way actions are embedded). As noted earlier, this grammar recognizes two string "abc" and "abcc". The problem here is that the default LL(1) algorithm will choose the [ "c" ] everytime it sees a "c" and therefore "abc" will never be matched. We need to specify that this choice must be made only when the next token is a "c", and the token following that is not a "c". This is a negative statement - one that cannot be made using syntactic LOOKAHEAD. We can use semantic LOOKAHEAD for this purpose. With semantic LOOKAHEAD, you can specify any arbitrary boolean expression whose evaluation determines which choice to take at a choice point. The above example can be instrumented with semantic LOOKAHEAD as follows: void BC() : {} { "b" [ LOOKAHEAD( { getToken(1).kind == C && getToken(2).kind != C } ) ] } First we give the token "c" a label C so that we can refer to it from the semantic LOOKAHEAD. The boolean expression essentially states the desired property. The choice determination decision is therefore: if (next token is "c" and following token is not "c") { choose the nested expansion (i.e., go into the [...] construct) } else { go beyond the [...] construct without entering it. } This example can be rewritten to combine both syntactic and semantic LOOKAHEAD as follows (recognize the first "c" using syntactic LOOKAHEAD and the absence of the second using semantic LOOKAHEAD): void BC() : {} { "b" [ LOOKAHEAD( "c", { getToken(2).kind != C } ) ] } ---------------------------------------------------------------- 7. GENERAL STRUCTURE OF LOOKAHEAD We've pretty much covered the various aspects of LOOKAHEAD in the previous sections. A couple of advanced topics follow. However, we shall now present a formal language reference for LOOKAHEAD in Java Compiler Compiler: The general structure of a LOOKAHEAD specification is: LOOKAHEAD( amount, expansion, { boolean_expression } ) "amount" specifies the number of tokens to LOOKAHEAD,"expansion" specifies the expansion to use to perform syntactic LOOKAHEAD, and "boolean_expression" is the expression to use for semantic LOOKAHEAD. At least one of the three entries must be present. If more than one are present, they are separated by commas. The default values for each of these entities is defined below: "amount": - if "expansion is present, this defaults to 2147483647. - otherwise ("boolean_expression" must be present then) this defaults to 0. Note: When "amount" is 0, no syntactic LOOKAHEAD is performed. Also, "amount" does not affect the semantic LOOKAHEAD. "expansion": - defaults to the expansion being considered. "boolean_expression": - defaults to true. ---------------------------------------------------------------- 8. NESTED EVALUATION OF SEMANTIC LOOKAHEAD TBD ---------------------------------------------------------------- 9. JAVACODE PRODUCTIONS TBD ---------------------------------------------------------------- javacc-5.0.orig/examples/Lookahead/Example3.jj0000644000175000017500000000403310535127040020235 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.basic_expr(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } void basic_expr() : {} { "(" expr() ")" | "(" expr() ")" | "new" | "." } void expr() : {} { "TBD" } TOKEN [IGNORE_CASE] : { } javacc-5.0.orig/examples/Lookahead/Example1.jj0000644000175000017500000000365210535127040020241 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.Input(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } void Input() : {} { "a" BC() "c" } void BC() : {} { "b" [ "c" ] } javacc-5.0.orig/examples/Lookahead/Example9.jj0000644000175000017500000000405410535127041020247 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Example) public class Example { public static void main(String args[]) throws ParseException { Example parser = new Example(System.in); parser.funny_list(); } } PARSER_END(Example) SKIP : { " " | "\t" | "\n" | "\r" } void identifier_list() : {} { ( LOOKAHEAD(2) "," )* } void funny_list() : {} { identifier_list() "," } TOKEN [IGNORE_CASE] : { | } javacc-5.0.orig/examples/Interpreter/0000755000175000017500000000000011247044051016647 5ustar mkochmkochjavacc-5.0.orig/examples/Interpreter/ASTOrNode.java0000644000175000017500000000416010604710302021244 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTOrNode extends SimpleNode { public ASTOrNode(int id) { super(id); } public ASTOrNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); if (((Boolean)stack[top]).booleanValue()) { stack[top] = new Boolean(true); return; } jjtGetChild(1).interpret(); stack[--top] = new Boolean(((Boolean)stack[top]).booleanValue() || ((Boolean)stack[top + 1]).booleanValue()); } } javacc-5.0.orig/examples/Interpreter/ASTReadStatement.java0000644000175000017500000000477410604707356022650 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ import java.io.IOException; public class ASTReadStatement extends SimpleNode { String name; public ASTReadStatement(int id) { super(id); } public ASTReadStatement(SPLParser p, int id) { super(p, id); } public void interpret() { Object o; char[] b = new char[64]; if ((o = symtab.get(name)) == null) System.err.println("Undefined variable : " + name); try { if (o instanceof Boolean) { out.write("Enter a value for \'" + name + "\' (boolean) : "); out.flush(); in.read(b); symtab.put(name, new Boolean((new String(b)).trim())); } else if (o instanceof Integer) { out.write("Enter a value for \'" + name + "\' (int) : "); out.flush(); in.read(b); symtab.put(name, new Integer((new String(b)).trim())); } } catch (IOException e) { e.printStackTrace(); System.exit(1); } } } javacc-5.0.orig/examples/Interpreter/SPL.java0000644000175000017500000000544110604706217020161 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** * Stupid Programming Language parser. */ public class SPL { /** Main entry point. */ public static void main(String args[]) { SPLParser parser; if (args.length == 1) { System.out.println("Stupid Programming Language Interpreter Version 0.1: Reading from file " + args[0] + " . . ."); try { parser = new SPLParser(new java.io.FileInputStream(args[0])); } catch (java.io.FileNotFoundException e) { System.out.println("Stupid Programming Language Interpreter Version 0.1: File " + args[0] + " not found."); return; } } else { System.out.println("Stupid Programming Language Interpreter Version 0.1: Usage :"); System.out.println(" java SPL inputfile"); return; } try { parser.CompilationUnit(); parser.jjtree.rootNode().interpret(); } catch (ParseException e) { System.out.println("Stupid Programming Language Interpreter Version 0.1: Encountered errors during parse."); e.printStackTrace(); } catch (Exception e1) { System.out.println("Stupid Programming Language Interpreter Version 0.1: Encountered errors during interpretation/tree building."); e1.printStackTrace(); } } } javacc-5.0.orig/examples/Interpreter/odd.spl0000644000175000017500000000015707671171030020144 0ustar mkochmkochint num; boolean odd; num = 10; read num; if (num % 2 != 0) odd = true; else odd = false; write odd; javacc-5.0.orig/examples/Interpreter/ASTWhileStatement.java0000644000175000017500000000376710604710302023027 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTWhileStatement extends SimpleNode { public ASTWhileStatement(int id) { super(id); } public ASTWhileStatement(SPLParser p, int id) { super(p, id); } public void interpret() { do { jjtGetChild(0).interpret(); if (((Boolean)stack[top--]).booleanValue()) jjtGetChild(1).interpret(); else break; } while (true); } } javacc-5.0.orig/examples/Interpreter/ASTBitwiseXorNode.java0000644000175000017500000000436510604710300022770 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTBitwiseXorNode extends SimpleNode { public ASTBitwiseXorNode(int id) { super(id); } public ASTBitwiseXorNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); if (stack[top] instanceof Boolean) stack[--top] = new Boolean(((Boolean)stack[top]).booleanValue() ^ ((Boolean)stack[top + 1]).booleanValue()); else if (stack[top] instanceof Integer) stack[--top] = new Integer(((Integer)stack[top]).intValue() ^ ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTMulNode.java0000644000175000017500000000376410604710301021431 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTMulNode extends SimpleNode { public ASTMulNode(int id) { super(id); } public ASTMulNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); stack[--top] = new Integer(((Integer)stack[top]).intValue() * ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/sqrt.spl0000644000175000017500000000021107671171030020356 0ustar mkochmkoch int val; read val; int sqrt; sqrt = 1; while (sqrt * sqrt <= val && ((sqrt + 1) * (sqrt + 1)) <= val) sqrt = sqrt + 1; write sqrt javacc-5.0.orig/examples/Interpreter/SPL.jjt0000644000175000017500000001522010705770414020025 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { MULTI=true; NODE_EXTENDS="MyNode"; TRACK_TOKENS=true; } PARSER_BEGIN(SPLParser) /** Stupid Programming Language parser. */ public class SPLParser { /** * Returns the root node of the AST. * It only makes sense to call this after a successful parse. * @return the root node */ public Node rootNode() { return jjtree.rootNode(); } } PARSER_END(SPLParser) SKIP : /* WHITE SPACE */ { " " | "\t" | "\n" | "\r" | "\f" } TOKEN : /* Types */ { < INT: "int" > | < BOOL: "boolean" > } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: ()+ > } /* * Program structuring syntax follows. */ /** Compilation unit. */ void CompilationUnit() : { String name; } { ( VarDeclaration() ";" | Statement() )* } /** Variable declaration. */ void VarDeclaration() : { Token t; } { ( "boolean" { jjtThis.type = BOOL; } | "int" { jjtThis.type = INT; } ) t = { jjtThis.name = t.image; } } /* * Expression syntax follows. */ /** Expression. */ void Expression() #void: {} { LOOKAHEAD( PrimaryExpression() "=" ) Assignment() | ConditionalOrExpression() } /** Assignment. */ void Assignment() #Assignment(2) : {} { PrimaryExpression() "=" Expression() } /** Conditional or expression. */ void ConditionalOrExpression() #void : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() #OrNode(2) )* } /** Conditional and expression. */ void ConditionalAndExpression() #void : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() #AndNode(2) )* } /** Inclusive or expression. */ void InclusiveOrExpression() #void : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() #BitwiseOrNode(2) )* } /** Exclusive or expression. */ void ExclusiveOrExpression() #void : {} { AndExpression() ( "^" AndExpression() #BitwiseXorNode(2) )* } /** And expression. */ void AndExpression() #void : {} { EqualityExpression() ( "&" EqualityExpression() #BitwiseAndNode(2) )* } /** Equality expression. */ void EqualityExpression() #void : {} { RelationalExpression() ( "==" RelationalExpression() #EQNode(2) | "!=" RelationalExpression() #NENode(2) )* } /** Relational expression. */ void RelationalExpression() #void : {} { AdditiveExpression() ( "<" AdditiveExpression() #LTNode(2) | ">" AdditiveExpression() #GTNode(2) | "<=" AdditiveExpression() #LENode(2) | ">=" AdditiveExpression() #GENode(2) )* } /** Additive expression. */ void AdditiveExpression() #void : {} { MultiplicativeExpression() ( "+" MultiplicativeExpression() #AddNode(2) | "-" MultiplicativeExpression() #SubtractNode(2) )* } /** Multiplicative expression. */ void MultiplicativeExpression() #void : {} { UnaryExpression() ( "*" UnaryExpression() #MulNode(2) | "/" UnaryExpression() #DivNode(2) | "%" UnaryExpression() #ModNode(2) )* } /** Unary expression. */ void UnaryExpression() #void : {} { "~" UnaryExpression() #BitwiseComplNode(1) | "!" UnaryExpression() #NotNode(1) | PrimaryExpression() } /** Primary expression. */ void PrimaryExpression() #void : { String name; } { Literal() | Id() | "(" Expression() ")" } /** An Id. */ void Id() : { Token t; } { t = { jjtThis.name = t.image; } } /** A literal. */ void Literal() #void : { Token t; } { ( t= { jjtThis.val = Integer.parseInt(t.image); } )#IntConstNode | BooleanLiteral() } /** A boolean literal. */ void BooleanLiteral() #void : {} { "true" #TrueNode | "false" #FalseNode } /* * Statement syntax follows. */ /** A statement. */ void Statement() #void : {} { ";" | LOOKAHEAD(2) LabeledStatement() | Block() | StatementExpression() | IfStatement() | WhileStatement() | IOStatement() } /** A labeled statement. */ void LabeledStatement() #void : {} { ":" Statement() } /** A block. */ void Block() : {} { "{" ( Statement() )* "}" } /** A statement expression. */ void StatementExpression() : /* * The last expansion of this production accepts more than the legal * SPL expansions for StatementExpression. */ {} { Assignment() ";" } /** An if statement. */ void IfStatement() : /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } /** A while statement. */ void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } /** An IO statement. */ void IOStatement() #void : { String name; } { ReadStatement() | WriteStatement() } /** A read statement. */ void ReadStatement() : { Token t; } { "read" t = { jjtThis.name = t.image; } } /** A write statement. */ void WriteStatement() : { Token t; } { "write" t = { jjtThis.name = t.image; } } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: [ "a"-"z", "A"-"Z" ] > | < #DIGIT: [ "0"-"9"] > } javacc-5.0.orig/examples/Interpreter/ASTBitwiseComplNode.java0000644000175000017500000000364510604710300023272 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTBitwiseComplNode extends SimpleNode { public ASTBitwiseComplNode(int id) { super(id); } public ASTBitwiseComplNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); stack[top] = new Integer(~((Integer)stack[top]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTEQNode.java0000644000175000017500000000427510604710300021176 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTEQNode extends SimpleNode { public ASTEQNode(int id) { super(id); } public ASTEQNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); if (stack[top] instanceof Boolean) stack[--top] = new Boolean(((Boolean)stack[top]).booleanValue() == ((Boolean)stack[top + 1]).booleanValue()); else stack[--top] = new Boolean(((Integer)stack[top]).intValue() == ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTLTNode.java0000644000175000017500000000376110604710301021210 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTLTNode extends SimpleNode { public ASTLTNode(int id) { super(id); } public ASTLTNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); stack[--top] = new Boolean(((Integer)stack[top]).intValue() < ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTStatementExpression.java0000644000175000017500000000362510604710302024107 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTStatementExpression extends SimpleNode { public ASTStatementExpression(int id) { super(id); } public ASTStatementExpression(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); top--; //just throw away the value. } } javacc-5.0.orig/examples/Interpreter/ASTGTNode.java0000644000175000017500000000376410604710301021206 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTGTNode extends SimpleNode { public ASTGTNode(int id) { super(id); } public ASTGTNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); stack[--top] = new Boolean(((Integer)stack[top]).intValue() > ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/MyNode.java0000644000175000017500000000475210604706360020721 0ustar mkochmkoch/* Copyright (c) 2006, Sreenivasa Viswanadha * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.io.Writer; /** * Specialised node. */ public class MyNode { /** Symbol table */ protected static java.util.Hashtable symtab = new java.util.Hashtable(); /** Stack for calculations. */ protected static Object[] stack = new Object[1024]; protected static int top = -1; /** @throws UnsupportedOperationException if called */ public void interpret() { throw new UnsupportedOperationException(); // It better not come here. } protected static Writer out = new PrintWriter(System.out); protected static Reader in = new InputStreamReader(System.in); /** * @param in the input to set */ public static void setIn(Reader in) { MyNode.in = in; } /** * @param out the output to set */ public static void setOut(Writer out) { MyNode.out = out; } } javacc-5.0.orig/examples/Interpreter/ASTNENode.java0000644000175000017500000000427610604710301021175 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTNENode extends SimpleNode { public ASTNENode(int id) { super(id); } public ASTNENode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); if (stack[top] instanceof Boolean) stack[--top] = new Boolean(((Boolean)stack[top]).booleanValue() != ((Boolean)stack[top + 1]).booleanValue()); else stack[--top] = new Boolean(((Integer)stack[top]).intValue() != ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTLENode.java0000644000175000017500000000376210604710301021172 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTLENode extends SimpleNode { public ASTLENode(int id) { super(id); } public ASTLENode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); stack[--top] = new Boolean(((Integer)stack[top]).intValue() <= ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTIntConstNode.java0000644000175000017500000000355110604710301022427 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTIntConstNode extends SimpleNode { int val; public ASTIntConstNode(int id) { super(id); } public ASTIntConstNode(SPLParser p, int id) { super(p, id); } public void interpret() { stack[++top] = new Integer(val); } } javacc-5.0.orig/examples/Interpreter/ASTIfStatement.java0000644000175000017500000000376610604710301022313 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTIfStatement extends SimpleNode { public ASTIfStatement(int id) { super(id); } public ASTIfStatement(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); if (((Boolean)stack[top--]).booleanValue()) jjtGetChild(1).interpret(); else if (jjtGetNumChildren() == 3) jjtGetChild(2).interpret(); } } javacc-5.0.orig/examples/Interpreter/ASTBlock.java0000644000175000017500000000361110604710300021106 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTBlock extends SimpleNode { public ASTBlock(int id) { super(id); } public ASTBlock(SPLParser p, int id) { super(p, id); } public void interpret() { int i, k = jjtGetNumChildren(); for (i = 0; i < k; i++) jjtGetChild(i).interpret(); } } javacc-5.0.orig/examples/Interpreter/ASTGENode.java0000644000175000017500000000376210604710301021165 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTGENode extends SimpleNode { public ASTGENode(int id) { super(id); } public ASTGENode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); stack[--top] = new Boolean(((Integer)stack[top]).intValue() >= ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTAssignment.java0000644000175000017500000000364510604710300022173 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTAssignment extends SimpleNode { public ASTAssignment(int id) { super(id); } public ASTAssignment(SPLParser p, int id) { super(p, id); } public void interpret() { String name; jjtGetChild(1).interpret(); symtab.put(name = ((ASTId)jjtGetChild(0)).name, stack[top]); } } javacc-5.0.orig/examples/Interpreter/ASTAddNode.java0000644000175000017500000000376310604710277021377 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTAddNode extends SimpleNode { public ASTAddNode(int id) { super(id); } public ASTAddNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); stack[--top] = new Integer(((Integer)stack[top]).intValue() + ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTCompilationUnit.java0000644000175000017500000000434410707462500023210 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTCompilationUnit extends SimpleNode { public ASTCompilationUnit(int id) { super(id); } public ASTCompilationUnit(SPLParser p, int id) { super(p, id); } public void interpret() { int i, k = jjtGetNumChildren(); for (i = 0; i < k; i++) { System.out.print("Executing:"); Token first = ((SimpleNode)jjtGetChild(i)).jjtGetFirstToken(); Token last = ((SimpleNode)jjtGetChild(i)).jjtGetLastToken(); for (Token t = first; t != null; t = t.next) { System.out.print(" " + t); if (t == last) break; } System.out.println(); jjtGetChild(i).interpret(); } } } javacc-5.0.orig/examples/Interpreter/ASTVarDeclaration.java0000644000175000017500000000402110604710302022750 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTVarDeclaration extends SimpleNode implements SPLParserConstants { int type; String name; public ASTVarDeclaration(int id) { super(id); } public ASTVarDeclaration(SPLParser p, int id) { super(p, id); } public void interpret() { if (type == BOOL) symtab.put(name, new Boolean(false)); else symtab.put(name, new Integer(0)); } } javacc-5.0.orig/examples/Interpreter/ASTId.java0000644000175000017500000000351710604710301020416 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTId extends SimpleNode { String name; public ASTId(int id) { super(id); } public ASTId(SPLParser p, int id) { super(p, id); } public void interpret() { stack[++top] = symtab.get(name); } } javacc-5.0.orig/examples/Interpreter/ASTDivNode.java0000644000175000017500000000376410604710300021415 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTDivNode extends SimpleNode { public ASTDivNode(int id) { super(id); } public ASTDivNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); stack[--top] = new Integer(((Integer)stack[top]).intValue() / ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTNotNode.java0000644000175000017500000000361710604710301021431 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTNotNode extends SimpleNode { public ASTNotNode(int id) { super(id); } public ASTNotNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); stack[top] = new Boolean(!((Boolean)stack[top]).booleanValue()); } } javacc-5.0.orig/examples/Interpreter/README0000644000175000017500000000416710535127035017542 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This is an interpreter for SPL (Stupid Programming Language). It builds jjtree's for a given SPL program and interprets it. It shows how you can implement simple loop and conditional constructs. Note how easy it is to annotate a grammar file to build useful tree nodes and then extend these nodes for purposes of interpreting, etc. This example will be improved as JJTree evolves. To run it : jjtree SPL.jjt javacc SPL.jj javac *.java java SPL fact.spl java SPL sqrt.spl java SPL odd.spl javacc-5.0.orig/examples/Interpreter/ASTTrueNode.java0000644000175000017500000000352410604710302021606 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTTrueNode extends SimpleNode { public ASTTrueNode(int id) { super(id); } public ASTTrueNode(SPLParser p, int id) { super(p, id); } public void interpret() { stack[++top] = new Boolean(true); } } javacc-5.0.orig/examples/Interpreter/ASTFalseNode.java0000644000175000017500000000352510604710301021721 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTFalseNode extends SimpleNode { public ASTFalseNode(int id) { super(id); } public ASTFalseNode(SPLParser p, int id) { super(p, id); } public void interpret() { stack[++top] = new Boolean(false); } } javacc-5.0.orig/examples/Interpreter/ASTAndNode.java0000644000175000017500000000416510604710300021371 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTAndNode extends SimpleNode { public ASTAndNode(int id) { super(id); } public ASTAndNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); if (!((Boolean)stack[top]).booleanValue()) { stack[top] = new Boolean(false); return; } jjtGetChild(1).interpret(); stack[--top] = new Boolean(((Boolean)stack[top]).booleanValue() && ((Boolean)stack[top + 1]).booleanValue()); } } javacc-5.0.orig/examples/Interpreter/Node.java0000644000175000017500000000524210752305551020407 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** * All AST nodes must implement this interface. * It provides basic machinery for constructing the parent and * child relationships between nodes. */ public interface Node { /** This method is called after the node has been made the current node. It indicates that child nodes can now be added to it. */ public void jjtOpen(); /** This method is called after all the child nodes have been added. */ public void jjtClose(); /** This pair of methods are used to inform the node of its parent. */ public void jjtSetParent(Node n); /** Get this node's parent. */ public Node jjtGetParent(); /** This method tells the node to add its argument to the node's list of children. */ public void jjtAddChild(Node n, int i); /** This method returns a child node. The children are numbered from zero, left to right. */ public Node jjtGetChild(int i); /** Return the number of children the node has. */ int jjtGetNumChildren(); /************************* Added by Sreeni. *******************/ /** Interpret method */ public void interpret(); } javacc-5.0.orig/examples/Interpreter/ASTModNode.java0000644000175000017500000000376410604710301021413 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTModNode extends SimpleNode { public ASTModNode(int id) { super(id); } public ASTModNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); stack[--top] = new Integer(((Integer)stack[top]).intValue() % ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTWriteStatement.java0000644000175000017500000000422210604707356023053 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ import java.io.IOException; public class ASTWriteStatement extends SimpleNode { String name; public ASTWriteStatement(int id) { super(id); } public ASTWriteStatement(SPLParser p, int id) { super(p, id); } public void interpret() { if (symtab.get(name) == null) System.err.println("Undefined variable : " + name); else try { out.write("Value of " + name + " : " + symtab.get(name)); out.flush(); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } } javacc-5.0.orig/examples/Interpreter/fact.spl0000644000175000017500000000014707671171030020312 0ustar mkochmkochint n; int fact; read n; fact = 1; while (n > 1) { fact = fact * n; n = n - 1; } write fact; javacc-5.0.orig/examples/Interpreter/ASTBitwiseAndNode.java0000644000175000017500000000436610604710300022723 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTBitwiseAndNode extends SimpleNode { public ASTBitwiseAndNode(int id) { super(id); } public ASTBitwiseAndNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); if (stack[top] instanceof Boolean) stack[--top] = new Boolean(((Boolean)stack[top]).booleanValue() & ((Boolean)stack[top + 1]).booleanValue()); else if (stack[top] instanceof Integer) stack[--top] = new Integer(((Integer)stack[top]).intValue() & ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTBitwiseOrNode.java0000644000175000017500000000436210604710300022575 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTBitwiseOrNode extends SimpleNode { public ASTBitwiseOrNode(int id) { super(id); } public ASTBitwiseOrNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); if (stack[top] instanceof Boolean) stack[--top] = new Boolean(((Boolean)stack[top]).booleanValue() | ((Boolean)stack[top + 1]).booleanValue()); else if (stack[top] instanceof Integer) stack[--top] = new Integer(((Integer)stack[top]).intValue() | ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Interpreter/ASTSubtractNode.java0000644000175000017500000000400610604710302022452 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ public class ASTSubtractNode extends SimpleNode { public ASTSubtractNode(int id) { super(id); } public ASTSubtractNode(SPLParser p, int id) { super(p, id); } public void interpret() { jjtGetChild(0).interpret(); jjtGetChild(1).interpret(); stack[--top] = new Integer(((Integer)stack[top]).intValue() - ((Integer)stack[top + 1]).intValue()); } } javacc-5.0.orig/examples/Transformer/0000755000175000017500000000000011247044052016647 5ustar mkochmkochjavacc-5.0.orig/examples/Transformer/SimpleNode.java0000644000175000017500000001063411052407264021557 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* Generated By:JJTree: Do not edit this line. SimpleNode.java */ /* JJT: 0.3pre1 */ import java.io.PrintWriter; public class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; public SimpleNode(int i) { id = i; } public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return ToyParserTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode)children[i]; if (n != null) { n.dump(prefix + " "); } } } } // Manually inserted code begins here protected Token begin, end; public void setFirstToken(Token t) { begin = t; } public void setLastToken(Token t) { end = t; } public void process (PrintWriter ostr) { System.out.println("Error - this should not be called"); throw new Error(); } // The following method prints token t, as well as all preceding // special tokens (essentially, white space and comments). protected void print(Token t, PrintWriter ostr) { Token tt = t.specialToken; if (tt != null) { while (tt.specialToken != null) tt = tt.specialToken; while (tt != null) { ostr.print(addUnicodeEscapes(tt.image)); tt = tt.next; } } ostr.print(addUnicodeEscapes(t.image)); } private String addUnicodeEscapes(String str) { String retval = ""; char ch; for (int i = 0; i < str.length(); i++) { ch = str.charAt(i); if ((ch < 0x20 || ch > 0x7e) && ch != '\t' && ch != '\n' && ch != '\r' && ch != '\f') { String s = "0000" + Integer.toString(ch, 16); retval += "\\u" + s.substring(s.length() - 4, s.length()); } else { retval += ch; } } return retval; } } javacc-5.0.orig/examples/Transformer/divide.toy0000644000175000017500000000336110535127044020655 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ class Test { int divide(int x, int y) { return x/y; } catch (ArithmeticException e) { return Integer.MAX_VALUE; } } javacc-5.0.orig/examples/Transformer/ASTCompilationUnit.java0000644000175000017500000000424411052407264023206 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ import java.io.*; public class ASTCompilationUnit extends SimpleNode { ASTCompilationUnit(int id) { super(id); } // Manually inserted code begins here public void process (PrintWriter ostr) { Token t = begin; ASTSpecialBlock bnode; for (int i = 0; i < jjtGetNumChildren(); i++) { bnode = (ASTSpecialBlock)jjtGetChild(i); do { print(t, ostr); t = t.next; } while (t != bnode.begin); bnode.process(ostr); t = bnode.end.next; } while (t != null) { print(t, ostr); t = t.next; } } } javacc-5.0.orig/examples/Transformer/README0000644000175000017500000000514710535127043017537 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ The example in this directory takes an extension of Java as input and converts it into proper Java. The purpose of this example is to illustrate: 1. The use of the "next" field of tokens. 2. To illustrate how one can use JJTree to build a parse tree for a small part of the input and ignore the rest of the file. 3. Combine 1 and 2 to process the portion for which tree nodes are created and leave the rest of the file unchanged. The Java language extension handled by the grammar (ToyJava.jjt) allows catch and finally specifications at the end of method blocks. So the following is allowed (as an example): void foo() { ... } catch (Exception e) { ... } The grammar file ToyJava.jjt is a modification of Java1.1.jj. Note how we have changed the SKIP tokens to SPECIAL_TOKENS so that the output file is identical to the input file. To try this out, type: jjtree ToyJava.jjt javacc ToyJava.jj javac *.java java ToyParser divide.toy divide.java And then compare divide.java to divide.toy. javacc-5.0.orig/examples/Transformer/ASTSpecialBlock.java0000644000175000017500000000407611052407264022426 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* JJT: 0.2.2 */ import java.io.*; public class ASTSpecialBlock extends SimpleNode { ASTSpecialBlock(int id) { super(id); } // Manually inserted code begins here public void process (PrintWriter ostr) { Token t = begin; // t corresponds to the "{" of the special block. t.image = "{ try {"; while (t != end) { print(t, ostr); t = t.next; } // t now corresponds to the last "}" of the special block. t.image = "} }"; print(t, ostr); } } javacc-5.0.orig/examples/Transformer/ToyJava.jjt0000644000175000017500000004535310535127043020750 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { MULTI = true; NODE_DEFAULT_VOID = true; JAVA_UNICODE_ESCAPE = true; } PARSER_BEGIN(ToyParser) import java.io.*; public class ToyParser { public static void main(String args[]) throws Exception { ToyParser parser; ASTCompilationUnit node; if (args.length == 2) { System.out.println("Toy Preprocessor: Reading from file " + args[0] + " . . ."); try { parser = new ToyParser(new FileInputStream(args[0])); } catch (FileNotFoundException e) { System.out.println("Toy Preprocessor: File " + args[0] + " not found."); return; } } else { System.out.println("Toy Preprocessor: Usage is \"java ToyParser inputfile outputfile\""); return; } try { node = parser.CompilationUnit(); PrintWriter ostr = new PrintWriter(new FileWriter(args[1])); node.process(ostr); ostr.close(); System.out.println("Toy Preprocessor: Transformation completed successfully."); } catch (ParseException e) { System.out.println("Toy Preprocessor: Encountered errors during parse."); } catch (IOException e) { System.out.println("Toy Preprocessor: Could not create file " + args[1]); } } } PARSER_END(ToyParser) SPECIAL_TOKEN : /* WHITE SPACE */ { " " | "\t" | "\n" | "\r" | "\f" } SPECIAL_TOKEN : /* COMMENTS */ { | | } TOKEN : /* RESERVED WORDS AND LITERALS */ { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } TOKEN : /* SEPARATORS */ { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } TOKEN : /* OPERATORS */ { < ASSIGN: "=" > | < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > | < LSHIFT: "<<" > | < RSIGNEDSHIFT: ">>" > | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > | < LSHIFTASSIGN: "<<=" > | < RSIGNEDSHIFTASSIGN: ">>=" > | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ ASTCompilationUnit CompilationUnit() #CompilationUnit : {} { { jjtThis.setFirstToken(getToken(1)); } [ PackageDeclaration() ] ( ImportDeclaration() )* ( TypeDeclaration() )* { return jjtThis; } } void PackageDeclaration() : {} { "package" Name() ";" } void ImportDeclaration() : {} { "import" Name() [ "." "*" ] ";" } void TypeDeclaration() : {} { LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" ) ClassDeclaration() | InterfaceDeclaration() | ";" } /* * Declaration syntax follows. */ void ClassDeclaration() : {} { ( "abstract" | "final" | "public" )* UnmodifiedClassDeclaration() } void UnmodifiedClassDeclaration() : {} { "class" [ "extends" Name() ] [ "implements" NameList() ] ClassBody() } void ClassBody() : {} { "{" ( ClassBodyDeclaration() )* "}" } void NestedClassDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedClassDeclaration() } void ClassBodyDeclaration() : {} { LOOKAHEAD(2) Initializer() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( [ "public" | "protected" | "private" ] Name() "(" ) ConstructorDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } // This production is to determine lookahead only. void MethodDeclarationLookahead() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() "(" } void InterfaceDeclaration() : {} { ( "abstract" | "public" )* UnmodifiedInterfaceDeclaration() } void NestedInterfaceDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedInterfaceDeclaration() } void UnmodifiedInterfaceDeclaration() : {} { "interface" [ "extends" NameList() ] "{" ( InterfaceMemberDeclaration() )* "}" } void InterfaceMemberDeclaration() : {} { LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } void FieldDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" )* Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator() : {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId() : {} { ( "[" "]" )* } void VariableInitializer() : {} { ArrayInitializer() | Expression() } void ArrayInitializer() : {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration() : { Token t; } { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() MethodDeclarator() [ "throws" NameList() ] ( { t = getToken(1); } Block() [ ( ( ( "catch" "(" FormalParameter() ")" Block() )+ [ "finally" Block() ] | "finally" Block() ) { jjtThis.setFirstToken(t); jjtThis.setLastToken(getToken(0)); } ) #SpecialBlock ] | ";" ) } void MethodDeclarator() : {} { FormalParameters() ( "[" "]" )* } void FormalParameters() : {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter() : {} { [ "final" ] Type() VariableDeclaratorId() } void ConstructorDeclaration() : {} { [ "public" | "protected" | "private" ] FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation() : {} { LOOKAHEAD("this" Arguments() ";") "this" Arguments() ";" | [ LOOKAHEAD(2) PrimaryExpression() "." ] "super" Arguments() ";" } void Initializer() : {} { [ "static" ] Block() } /* * Type, name and expression syntax follows. */ void Type() : {} { ( PrimitiveType() | Name() ) ( "[" "]" )* } void PrimitiveType() : {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { "void" | Type() } void Name() : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ {} { ( LOOKAHEAD(2) "." )* } void NameList() : {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : {} { LOOKAHEAD( PrimaryExpression() AssignmentOperator() ) Assignment() | ConditionalExpression() } void Assignment() : {} { PrimaryExpression() AssignmentOperator() Expression() } void AssignmentOperator() : {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression() : {} { ConditionalOrExpression() [ "?" Expression() ":" ConditionalExpression() ] } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^" AndExpression() )* } void AndExpression() : {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression() : {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression() : {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression() : {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression() : {} { AdditiveExpression() ( ( "<<" | ">>" | ">>>" ) AdditiveExpression() )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression() : {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression() : {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression() : {} { "++" PrimaryExpression() } void PreDecrementExpression() : {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus() : {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead() : {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Name() "[") "(" Name() "[" "]" | "(" Name() ")" ( "~" | "!" | "(" | | "this" | "super" | "new" | Literal() ) } void PostfixExpression() : {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression() : {} { LOOKAHEAD("(" PrimitiveType()) "(" Type() ")" UnaryExpression() | LOOKAHEAD("(" Name()) "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() : {} { PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* } void PrimaryPrefix() : {} { Literal() | Name() | "this" | "super" "." | "(" Expression() ")" | AllocationExpression() } void PrimarySuffix() : {} { LOOKAHEAD(2) "." "this" | LOOKAHEAD(2) "." "class" | LOOKAHEAD(2) "." AllocationExpression() | "[" Expression() "]" | "." | Arguments() } void Literal() : {} { | | | | BooleanLiteral() | NullLiteral() } void BooleanLiteral() : {} { "true" | "false" } void NullLiteral() : {} { "null" } void Arguments() : {} { "(" [ ArgumentList() ] ")" } void ArgumentList() : {} { Expression() ( "," Expression() )* } void AllocationExpression() : {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimensions() [ ArrayInitializer() ] | "new" Name() ( ArrayDimensions() [ ArrayInitializer() ] | Arguments() [ ClassBody() ] ) } /* * The second LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimensions() : {} { ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* } /* * Statement syntax follows. */ void Statement() : {} { LOOKAHEAD(2) LabeledStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void LabeledStatement() : {} { ":" Statement() } void Block() : {} { "{" ( BlockStatement() )* "}" } void BlockStatement() : {} { LOOKAHEAD([ "final" ] Type() ) LocalVariableDeclaration() ";" | Statement() | UnmodifiedClassDeclaration() | UnmodifiedInterfaceDeclaration() } void LocalVariableDeclaration() : {} { [ "final" ] Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement() : {} { ";" } void StatementExpression() : /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. */ {} { PreIncrementExpression() | PreDecrementExpression() | LOOKAHEAD( PrimaryExpression() AssignmentOperator() ) Assignment() | PostfixExpression() } void SwitchStatement() : {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel() : {} { "case" Expression() ":" | "default" ":" } void IfStatement() : /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void DoStatement() : {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement() : {} { "for" "(" [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ")" Statement() } void ForInit() : {} { LOOKAHEAD( [ "final" ] Type() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList() : {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate() : {} { StatementExpressionList() } void BreakStatement() : {} { "break" [ ] ";" } void ContinueStatement() : {} { "continue" [ ] ";" } void ReturnStatement() : {} { "return" [ Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement() : {} { "synchronized" "(" Expression() ")" Block() } void TryStatement() : /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } javacc-5.0.orig/examples/GUIParsing/0000755000175000017500000000000011247044051016314 5ustar mkochmkochjavacc-5.0.orig/examples/GUIParsing/ParserVersion/0000755000175000017500000000000011247044051021116 5ustar mkochmkochjavacc-5.0.orig/examples/GUIParsing/ParserVersion/CalcInput.jj0000644000175000017500000000600410535127031023324 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { USER_TOKEN_MANAGER = true; } PARSER_BEGIN(CalcInputParser) public class CalcInputParser { } PARSER_END(CalcInputParser) void Input() : { double larg = 0.0; double rarg; } { ( [ larg=Number() { CalcGUI.print(larg); } ] ( rarg=Number() { larg = larg + rarg; CalcGUI.print(larg); } | rarg=Number() { larg = larg - rarg; CalcGUI.print(larg); } | rarg=Number() { larg = larg * rarg; CalcGUI.print(larg); } |
rarg=Number() { larg = (rarg==0) ? Float.POSITIVE_INFINITY : (larg / rarg); CalcGUI.print(larg); } )* { image += t.image; value = value*10 + Integer.parseInt(t.image); CalcGUI.print(image); } )+ [ { image += "."; CalcGUI.print(image); } ( t= { image += t.image; decimalPlace *= 0.1; value = value + Integer.parseInt(t.image)*decimalPlace; CalcGUI.print(image); } )+ ] { return value; } | { image = "0."; CalcGUI.print(image); } ( t= { image += t.image; decimalPlace *= 0.1; value = value + Integer.parseInt(t.image)*decimalPlace; CalcGUI.print(image); } )+ { return value; } } javacc-5.0.orig/examples/GUIParsing/ParserVersion/ProducerConsumer.java0000644000175000017500000000501711052407262025264 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ public class ProducerConsumer { /** * A single producer-consumer instance that is used by others. */ public static ProducerConsumer pc = new ProducerConsumer(); /** * The data structure where the tokens are stored. */ private java.util.Vector queue = new java.util.Vector(); /** * The producer calls this method to add a new token * whenever it is available. */ synchronized public void addToken(Token token) { queue.addElement(token); notify(); } /** * The consumer calls this method to get the next token * in the queue. If the queue is empty, this method * blocks until a token becomes available. */ synchronized public Token getToken() { if (queue.isEmpty()) { try { wait(); } catch (InterruptedException willNotHappen) { throw new Error(); } } Token retval = (Token)(queue.elementAt(0)); queue.removeElementAt(0); return retval; } } javacc-5.0.orig/examples/GUIParsing/ParserVersion/TokenCollector.java0000644000175000017500000000333111052407262024711 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ public class TokenCollector implements TokenManager { public Token getNextToken() { return ProducerConsumer.pc.getToken(); } } javacc-5.0.orig/examples/GUIParsing/ParserVersion/Main.java0000644000175000017500000000362611052407262022655 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ public class Main { public static void main(String[] args) { new CalcGUI(); TokenManager tm = new TokenCollector(); CalcInputParser cp = new CalcInputParser(tm); while (true) { try { cp.Input(); } catch (ParseException e) { CalcGUI.print("ERROR (click 0)"); } } } } javacc-5.0.orig/examples/GUIParsing/ParserVersion/README0000644000175000017500000000525210535127032022002 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This version of the GUI parsing example defines the GUI interaction as a JavaCC grammar using tokens that are generated by a user built token manager. Note that these tokens appear in the parser (CalcInput.jj) without definitions (such as , , etc.). JavaCC does not require token definitions when USER_TOKEN_MANAGER is set to true. The token manager is implemented in TokenCollector.java to extract tokens from a producer-consumer object in ProducerConsumer.java. The tokens are stuffed into ProducerConsumer.java by the GUI which is defined in CalcGUI.java. The whole system is invoked through Main.java. The point of this example is to illustrate: . How a parser can be used without the standard token manager. . The fact that tokens can be generated by entities that are not even streams (a GUI in this example). . That GUI interaction can be modeled as a grammar and this grammar can then be used to implement the innards of a GUI based tool. To run the calculator (which is what this example implements), do: javacc CalcInput.jj javac *.java java Main javacc-5.0.orig/examples/GUIParsing/ParserVersion/CalcGUI.java0000644000175000017500000001571311052407262023200 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ import java.awt.*; public class CalcGUI extends Frame implements CalcInputParserConstants { /** * A button object is created for each calculator button. Since * there is going to be only one calculator GUI, these objects can * be static. */ static Button one = new Button("1"); static Button two = new Button("2"); static Button three = new Button("3"); static Button four = new Button("4"); static Button five = new Button("5"); static Button six = new Button("6"); static Button seven = new Button("7"); static Button eight = new Button("8"); static Button nine = new Button("9"); static Button zero = new Button("0"); static Button dot = new Button("."); static Button equal = new Button("="); static Button add = new Button("+"); static Button sub = new Button("-"); static Button mul = new Button("*"); static Button div = new Button("/"); static Button quit = new Button("QUIT"); /** * The display window with its initial setting. */ static Label display = new Label("0 "); /** * Constructor that creates the full GUI. This is called by the * main program to create one calculator GUI. */ public CalcGUI() { super("Calculator"); GridBagLayout gb = new GridBagLayout(); setLayout(gb); GridBagConstraints gbc = new GridBagConstraints(); display.setFont(new Font("TimesRoman", Font.BOLD, 18)); display.setAlignment(Label.RIGHT); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 0.0; gb.setConstraints(display, gbc); add(display); Panel buttonPanel = new Panel(); buttonPanel.setFont(new Font("TimesRoman", Font.BOLD, 14)); buttonPanel.setLayout(new GridLayout(4,4)); buttonPanel.add(one); buttonPanel.add(two); buttonPanel.add(three); buttonPanel.add(four); buttonPanel.add(five); buttonPanel.add(six); buttonPanel.add(seven); buttonPanel.add(eight); buttonPanel.add(nine); buttonPanel.add(zero); buttonPanel.add(dot); buttonPanel.add(equal); buttonPanel.add(add); buttonPanel.add(sub); buttonPanel.add(mul); buttonPanel.add(div); gbc.weighty = 1.0; gb.setConstraints(buttonPanel, gbc); add(buttonPanel); quit.setFont(new Font("TimesRoman", Font.BOLD, 14)); gbc.gridheight = GridBagConstraints.REMAINDER; gbc.weighty = 0.0; gb.setConstraints(quit, gbc); add(quit); pack(); show(); } /** * Note how handleEvent creates tokens and sends them to the parser * through the producer-consumer. */ public boolean handleEvent(Event evt) { Token t; if (evt.id != Event.ACTION_EVENT) { return false; } if (evt.target == one) { t = new Token(); t.kind = DIGIT; t.image = "1"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == two) { t = new Token(); t.kind = DIGIT; t.image = "2"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == three) { t = new Token(); t.kind = DIGIT; t.image = "3"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == four) { t = new Token(); t.kind = DIGIT; t.image = "4"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == five) { t = new Token(); t.kind = DIGIT; t.image = "5"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == six) { t = new Token(); t.kind = DIGIT; t.image = "6"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == seven) { t = new Token(); t.kind = DIGIT; t.image = "7"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == eight) { t = new Token(); t.kind = DIGIT; t.image = "8"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == nine) { t = new Token(); t.kind = DIGIT; t.image = "9"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == zero) { t = new Token(); t.kind = DIGIT; t.image = "0"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == dot) { t = new Token(); t.kind = DOT; t.image = "."; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == equal) { t = new Token(); t.kind = EQ; t.image = "="; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == add) { t = new Token(); t.kind = ADD; t.image = "+"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == sub) { t = new Token(); t.kind = SUB; t.image = "-"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == mul) { t = new Token(); t.kind = MUL; t.image = "*"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == div) { t = new Token(); t.kind = DIV; t.image = "/"; ProducerConsumer.pc.addToken(t); return true; } if (evt.target == quit) { System.exit(0); } return false; } public static void print(double value) { display.setText(Double.toString(value) + " "); } public static void print(String image) { display.setText(image + " "); } } javacc-5.0.orig/examples/GUIParsing/README0000644000175000017500000000427610535127031017204 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ In this directory are two examples that illustrate the use of JavaCC generated parsers to collect input from a GUI and process it appropriately. The example used is a simple calculator. There are two versions of this example: . A version that uses a JavaCC parser without the JavaCC token manager in directory ParserVersion. . A version that uses a JavaCC token manager without the JavaCC parser in directory TokenMgrVersion. This example also illustrates the ability to build a state machine as a lexical specification. The README files in these directories provide more details. javacc-5.0.orig/examples/GUIParsing/TokenMgrVersion/0000755000175000017500000000000011247044051021410 5ustar mkochmkochjavacc-5.0.orig/examples/GUIParsing/TokenMgrVersion/CalcInput.jj0000644000175000017500000001205110535127032023616 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { USER_CHAR_STREAM = true; BUILD_PARSER = false; } PARSER_BEGIN(CalcInputParser) public class CalcInputParser { } PARSER_END(CalcInputParser) /** * This example shows an elaborate example to construct a Finite Automaton * where for every character, there is a move. */ TOKEN_MGR_DECLS: { /** * A pointer to the GUI object. */ static CalcGUI gui; /** * Holds the result of the expression evaluation so far. */ static double result = 0.0; /** * Flag to indiate the very first operand so that the correct result * is displayed in this case. */ static boolean firstOperand = true; /** * Shows the result after a particular operation. */ private static void ShowResult() { if (firstOperand) { image.setLength(image.length() - 1); if (image.length() > 0) result = Double.valueOf(image.toString()).doubleValue(); else result = 0.0; firstOperand = false; } gui.print(result); } } /** * The first operand */ MORE : { < ["0"-"9"] > | "." : REQUIRED_DIGIT } /** * This state is entered when we need to get at least one digit (after a .) */ MORE: { < ["0"-"9"] > : OPTIONAL_DIGIT } /** * FA for (["0"-"9"])*. */ MORE: { < ["0"-"9"] > } /** * You can get an operator at any time (in any lexical state), except when * a digit is required (afdter a .). Then just go to a state where the next * operand is scanned (for that particular operator). */ SKIP: { { ShowResult(); } : SEEN_PLUS | { ShowResult(); } : SEEN_MINUS | { ShowResult(); } : SEEN_STAR | { ShowResult(); } : SEEN_SLASH } /** * If you get a = in any state, just display the current result. */ SKIP: { } MORE: { < ["0"-"9"] > { firstOperand = true; } : OPERAND | "." { firstOperand = true; } : REQUIRED_DIGIT } MORE: { < ["0"-"9"] > : ADD_RIGHT_OPERAND | "." : ADD_REQUIRED_DIGIT } MORE: { < ["0"-"9"] > : DO_ADD } SKIP: { < "" > { result += Double.valueOf(image.toString()).doubleValue(); } : OP_LOOP } MORE: { < ["0"-"9"] > : SUB_RIGHT_OPERAND | "." : SUB_REQUIRED_DIGIT } MORE: { < ["0"-"9"] > : DO_SUB } SKIP: { < "" > { result -= Double.valueOf(image.toString()).doubleValue(); } : OP_LOOP } MORE: { < ["0"-"9"] > : MUL_RIGHT_OPERAND | "." : MUL_REQUIRED_DIGIT } MORE: { < ["0"-"9"] > : DO_MUL } SKIP: { < "" > { result *= Double.valueOf(image.toString()).doubleValue(); } : OP_LOOP } MORE: { < ["0"-"9"] > : DIV_RIGHT_OPERAND | "." : DIV_REQUIRED_DIGIT } MORE: { < ["0"-"9"] > : DO_DIV } SKIP: { < "" > { result /= Double.valueOf(image.toString()).doubleValue(); } : OP_LOOP } javacc-5.0.orig/examples/GUIParsing/TokenMgrVersion/CharCollector.java0000644000175000017500000001304411052407262025002 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ public class CharCollector implements CharStream { int bufsize; int available; int tokenBegin; public int bufpos = -1; private char[] buffer; private int maxNextCharInd = 0; private final void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { System.out.println("Error : " + t.getClass().getName()); throw new Error(); } bufsize += 2048; available = bufsize; tokenBegin = 0; } private final void FillBuff() { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } try { wait(); } catch (InterruptedException willNotHappen) { throw new Error(); } } /** * Puts a character into the buffer. */ synchronized public final void put(char c) { buffer[maxNextCharInd++] = c; notify(); } public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } private int inBuf = 0; synchronized public final char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]); } if (++bufpos >= maxNextCharInd) FillBuff(); return buffer[bufpos]; } /** * @deprecated * @see #getEndColumn */ public final int getColumn() { return 0; } /** * @deprecated * @see #getEndLine */ public final int getLine() { return 0; } public final int getEndColumn() { return 0; } public final int getEndLine() { return 0; } public final int getBeginColumn() { return 0; } public final int getBeginLine() { return 0; } public final void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } public CharCollector(int buffersize) { available = bufsize = buffersize; buffer = new char[buffersize]; } public CharCollector() { available = bufsize = 4096; buffer = new char[4096]; } public void Clear() { bufpos = -1; maxNextCharInd = 0; inBuf = 0; } public final String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } public final char[] GetSuffix(int len) { char[] ret = new char[len]; if (bufpos + 1 >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos, bufpos + 1); } return ret; } public void Done() { buffer = null; } } javacc-5.0.orig/examples/GUIParsing/TokenMgrVersion/MyLexer.java0000644000175000017500000000416311052407263023646 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** * A subclass of CalcInputTokenManager so that we can do better error reporting * via the GUI object. */ class MyLexer extends CalcInputParserTokenManager { /** * We redefined the lexical error reporting function so that it beeps * and displays a message thru the GUI. */ protected void LexicalError() { CalcGUI.Error("ERROR (click 0)"); ReInit(gui.getCollector(), OPERAND); result = 0.0; } public MyLexer(CalcGUI guiObj) { super(guiObj.getCollector(), OPERAND); gui = guiObj; } } javacc-5.0.orig/examples/GUIParsing/TokenMgrVersion/Main.java0000644000175000017500000000351311052407262023142 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ public class Main { public static void main(String[] args) { CalcGUI gui = new CalcGUI(); MyLexer lexer = new MyLexer(gui); while (true) { try { lexer.getNextToken(); } catch (TokenMgrError e) { } } } } javacc-5.0.orig/examples/GUIParsing/TokenMgrVersion/README0000644000175000017500000000546210575551351022310 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This version of the GUI parsing example defines the GUI interaction as a JavaCC lexical specification where the characters are read from the GUI and there is an finite automaton (FA) built out of lexical states that have moves on these characters. In the grammar, the USER_CHAR_STREAM option is set to true and the BUILD_PARSER option has been set to false. The event handler method stuffs the characters into a buffer from which characters are returned to the lexical analyzer (by readChar). The whole system is invoked through Main.java. The point of this example is to illustrate: . A very detailed example of an FA simulation using lexical states where every character moves the FA. . How a lexical analyzer can be used without a standard (JavaCC generated) CharStream object. . How a lexical analyzer can be used without a parser. . The fact that input can come from entities that are not even streams (a GUI in this example). . That GUI interaction can be modeled as a regular expression specification. To run the calculator (which is what this example implements), do: javacc CalcInput.jj javac *.java java Main Homework: Simplify the grammar so that (["0"-"9"])* is treated as a single entity for moving the FA. javacc-5.0.orig/examples/GUIParsing/TokenMgrVersion/CalcGUI.java0000644000175000017500000001540711052407262023472 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ import java.awt.*; public class CalcGUI extends Frame implements CalcInputParserConstants { /** * A button object is created for each calculator button. Since * there is going to be only one calculator GUI, these objects can * be static. */ static Button one = new Button("1"); static Button two = new Button("2"); static Button three = new Button("3"); static Button four = new Button("4"); static Button five = new Button("5"); static Button six = new Button("6"); static Button seven = new Button("7"); static Button eight = new Button("8"); static Button nine = new Button("9"); static Button zero = new Button("0"); static Button dot = new Button("."); static Button equal = new Button("="); static Button add = new Button("+"); static Button sub = new Button("-"); static Button mul = new Button("*"); static Button div = new Button("/"); static Button quit = new Button("QUIT"); /** * The display window with its initial setting. */ static Label display = new Label("0 "); /** * The class that collects the characters produced by the GUI */ static final CharCollector collector = new CharCollector(); static final CharStream getCollector() { return collector; } /** * string that holds what the calculator displays */ static String label = "0"; /** * flag to indicate if this is the first digit. */ static boolean firstDigit = true; /** * Indicates an error has occured */ static boolean error = false; /** * Constructor that creates the full GUI. This is called by the * main program to create one calculator GUI. */ public CalcGUI() { super("Calculator"); GridBagLayout gb = new GridBagLayout(); setLayout(gb); GridBagConstraints gbc = new GridBagConstraints(); display.setFont(new Font("TimesRoman", Font.BOLD, 18)); display.setAlignment(Label.RIGHT); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 0.0; gb.setConstraints(display, gbc); add(display); Panel buttonPanel = new Panel(); buttonPanel.setFont(new Font("TimesRoman", Font.BOLD, 14)); buttonPanel.setLayout(new GridLayout(4,4)); buttonPanel.add(one); buttonPanel.add(two); buttonPanel.add(three); buttonPanel.add(four); buttonPanel.add(five); buttonPanel.add(six); buttonPanel.add(seven); buttonPanel.add(eight); buttonPanel.add(nine); buttonPanel.add(zero); buttonPanel.add(dot); buttonPanel.add(equal); buttonPanel.add(add); buttonPanel.add(sub); buttonPanel.add(mul); buttonPanel.add(div); gbc.weighty = 1.0; gb.setConstraints(buttonPanel, gbc); add(buttonPanel); quit.setFont(new Font("TimesRoman", Font.BOLD, 14)); gbc.gridheight = GridBagConstraints.REMAINDER; gbc.weighty = 0.0; gb.setConstraints(quit, gbc); add(quit); pack(); show(); } /** * Here we just return the character that is input. */ public boolean handleEvent(Event evt) { char c = 0; if (evt.id != Event.ACTION_EVENT) { return false; } if (evt.target == quit) { System.exit(0); } if (error) { if (evt.target == zero) { error = false; print("0"); firstDigit = true; return true; } return false; } if (evt.target == equal) { c = '='; firstDigit = true; } else if (evt.target == add) { c = '+'; label = "0"; firstDigit = true; } else if (evt.target == sub) { c = '-'; label = "0"; firstDigit = true; } else if (evt.target == mul) { c = '*'; label = "0"; firstDigit = true; } else if (evt.target == div) { c = '/'; label = "0"; firstDigit = true; } else { if (firstDigit) label = ""; firstDigit = false; if (evt.target == one) { c = '1'; label += c; } else if (evt.target == two) { c = '2'; label += c; } else if (evt.target == three) { c = '3'; label += c; } else if (evt.target == four) { c = '4'; label += c; } else if (evt.target == five) { c = '5'; label += c; } else if (evt.target == six) { c = '6'; label += c; } else if (evt.target == seven) { c = '7'; label += c; } else if (evt.target == eight) { c = '8'; label += c; } else if (evt.target == nine) { c = '9'; label += c; } else if (evt.target == zero) { c = '0'; label += c; } else if (evt.target == dot) { c = '.'; label += "."; } else return false; } print(label); collector.put(c); return true; } public static void print(double value) { display.setText(label = Double.toString(value)); } public static void print(String image) { display.setText(label = image); } public static void Error(String image) { print(image); Toolkit.getDefaultToolkit().beep(); collector.Clear(); label = "0"; error = true; } } javacc-5.0.orig/examples/SimpleExamples/0000755000175000017500000000000011247044052017275 5ustar mkochmkochjavacc-5.0.orig/examples/SimpleExamples/Simple3.jj0000644000175000017500000000435310604736401021145 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Simple3) /** Simple brace matcher. */ public class Simple3 { /** Main entry point. */ public static void main(String args[]) throws ParseException { Simple3 parser = new Simple3(System.in); parser.Input(); } } PARSER_END(Simple3) SKIP : { " " | "\t" | "\n" | "\r" } TOKEN : { | } /** Root production. */ void Input() : { int count; } { count=MatchedBraces() { System.out.println("The levels of nesting is " + count); } } /** Brace counting production. */ int MatchedBraces() : { int nested_count=0; } { [ nested_count=MatchedBraces() ] { return ++nested_count; } } javacc-5.0.orig/examples/SimpleExamples/NL_Xlator.jj0000644000175000017500000000757410604736401021503 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(NL_Xlator) /** New line translator. */ public class NL_Xlator { /** Main entry point. */ public static void main(String args[]) throws ParseException { NL_Xlator parser = new NL_Xlator(System.in); parser.ExpressionList(); } } PARSER_END(NL_Xlator) SKIP : { " " | "\t" | "\n" | "\r" } TOKEN : { < ID: ["a"-"z","A"-"Z","_"] ( ["a"-"z","A"-"Z","_","0"-"9"] )* > | < NUM: ( ["0"-"9"] )+ > } /** Top level production. */ void ExpressionList() : { String s; } { { System.out.println("Please type in an expression followed by a \";\" or ^D to quit:"); System.out.println(""); } ( s=Expression() ";" { System.out.println(s); System.out.println(""); System.out.println("Please type in another expression followed by a \";\" or ^D to quit:"); System.out.println(""); } )* } /** An Expression. */ String Expression() : { java.util.Vector termimage = new java.util.Vector(); String s; } { s=Term() { termimage.addElement(s); } ( "+" s=Term() { termimage.addElement(s); } )* { if (termimage.size() == 1) { return (String)termimage.elementAt(0); } else { s = "the sum of " + (String)termimage.elementAt(0); for (int i = 1; i < termimage.size()-1; i++) { s += ", " + (String)termimage.elementAt(i); } if (termimage.size() > 2) { s += ","; } s += " and " + (String)termimage.elementAt(termimage.size()-1); return s; } } } /** A Term. */ String Term() : { java.util.Vector factorimage = new java.util.Vector(); String s; } { s=Factor() { factorimage.addElement(s); } ( "*" s=Factor() { factorimage.addElement(s); } )* { if (factorimage.size() == 1) { return (String)factorimage.elementAt(0); } else { s = "the product of " + (String)factorimage.elementAt(0); for (int i = 1; i < factorimage.size()-1; i++) { s += ", " + (String)factorimage.elementAt(i); } if (factorimage.size() > 2) { s += ","; } s += " and " + (String)factorimage.elementAt(factorimage.size()-1); return s; } } } /** A Factor. */ String Factor() : { Token t; String s; } { t= { return t.image; } | t= { return t.image; } | "(" s=Expression() ")" { return s; } } javacc-5.0.orig/examples/SimpleExamples/Simple1.jj0000644000175000017500000000472010604736401021141 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { LOOKAHEAD = 1; CHOICE_AMBIGUITY_CHECK = 2; OTHER_AMBIGUITY_CHECK = 1; STATIC = true; DEBUG_PARSER = false; DEBUG_LOOKAHEAD = false; DEBUG_TOKEN_MANAGER = false; ERROR_REPORTING = true; JAVA_UNICODE_ESCAPE = false; UNICODE_INPUT = false; IGNORE_CASE = false; USER_TOKEN_MANAGER = false; USER_CHAR_STREAM = false; BUILD_PARSER = true; BUILD_TOKEN_MANAGER = true; SANITY_CHECK = true; FORCE_LA_CHECK = false; } PARSER_BEGIN(Simple1) /** Simple brace matcher. */ public class Simple1 { /** Main entry point. */ public static void main(String args[]) throws ParseException { Simple1 parser = new Simple1(System.in); parser.Input(); } } PARSER_END(Simple1) /** Root production. */ void Input() : {} { MatchedBraces() ("\n"|"\r")* } /** Brace matching production. */ void MatchedBraces() : {} { "{" [ MatchedBraces() ] "}" } javacc-5.0.orig/examples/SimpleExamples/README0000644000175000017500000003766010535127043020172 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This directory contains five examples to get you started using JavaCC. Each example is contained in a single grammar file and are listed below: Simple1.jj Simple2.jj Simple3.jj Simple4.jj NL_Xlator.jj IdList.jj Once you have tried out and understood each of these examples, you should take a look at more complex examples in other sub-directories under the examples directory. But even with just these examples, you should be able to get started on reasonable complex grammars. --------------------------------------------------------------------- Summary Instructions: If you are a parser and lexical analyzer expert and can understand the examples by just reading them, the following instructions show you how to get started with javacc. The instructions below are with respect to Simple1.jj, but you can build any parser using the same set of commands. 1. Run javacc on the grammar input file to generate a bunch of Java files that implement the parser and lexical analyzer (or token manager): javacc Simple1.jj 2. Now compile the resulting Java programs: javac *.java 3. The parser is now ready to use. To run the parser, type: java Simple1 The Simple1 parser and others in this directory are designed to take input from standard input. Simple1 recognizes matching braces followed by zero or more line terminators and then an end of file. Examples of legal strings in this grammar are: "{}", "{{{{{}}}}}", etc. Examples of illegal strings are: "{{{{", "{}{}", "{}}", "{{}{}}", "{ }", "{x}", etc. Try typing various different inputs to Simple1. Remember may be used to indicate the end of file (this is on the UNIX platform). Here are some sample runs: % java Simple1 {{}} % % java Simple1 {x Lexical error at line 1, column 2. Encountered: "x" TokenMgrError: Lexical error at line 1, column 2. Encountered: "x" (120), after : "" at Simple1TokenManager.getNextToken(Simple1TokenManager.java:146) at Simple1.getToken(Simple1.java:140) at Simple1.MatchedBraces(Simple1.java:51) at Simple1.Input(Simple1.java:10) at Simple1.main(Simple1.java:6) % % java Simple1 {}} ParseException: Encountered "}" at line 1, column 3. Was expecting one of: "\n" ... "\r" ... at Simple1.generateParseException(Simple1.java:184) at Simple1.jj_consume_token(Simple1.java:126) at Simple1.Input(Simple1.java:32) at Simple1.main(Simple1.java:6) % --------------------------------------------------------------------- DETAILED DESCRIPTION OF Simple1.jj: This is a simple JavaCC grammar that recognizes a set of left braces followed by the same number of right braces and finally followed by zero or more line terminators and finally an end of file. Examples of legal strings in this grammar are: "{}", "{{{{{}}}}}", etc. Examples of illegal strings are: "{{{{", "{}{}", "{}}", "{{}{}}", etc. This grammar file starts with settings for all the options offered by JavaCC. In this case the option settings are their default values. Hence these option settings were really not necessary. One could as well have completely omitted the options section, or omitted one or more of the individual option settings. The details of the individual options is described in the JavaCC documentation in the web pages. Following this is a Java compilation unit enclosed between "PARSER_BEGIN(name)" and "PARSER_END(name)". This compilation unit can be of arbitrary complexity. The only constraint on this compilation unit is that it must define a class called "name" - the same as the arguments to PARSER_BEGIN and PARSER_END. This is the name that is used as the prefix for the Java files generated by the parser generator. The parser code that is generated is inserted immediately before the closing brace of the class called "name". In the above example, the class in which the parser is generated contains a main program. This main program creates an instance of the parser object (an object of type Simple1) by using a constructor that takes one argument of type java.io.InputStream ("System.in" in this case). The main program then makes a call to the non-terminal in the grammar that it would like to parse - "Input" in this case. All non-terminals have equal status in a JavaCC generated parser, and hence one may parse with respect to any grammar non-terminal. Following this is a list of productions. In this example, there are two productions, that define the non-terminals "Input" and "MatchedBraces" respectively. In JavaCC grammars, non-terminals are written and implemented (by JavaCC) as Java methods. When the non-terminal is used on the left-hand side of a production, it is considered to be declared and its syntax follows the Java syntax. On the right-hand side its use is similar to a method call in Java. Each production defines its left-hand side non-terminal followed by a colon. This is followed by a bunch of declarations and statements within braces (in both cases in the above example, there are no declarations and hence this appears as "{}") which are generated as common declarations and statements into the generated method. This is then followed by a set of expansions also enclosed within braces. Lexical tokens (regular expressions) in a JavaCC input grammar are either simple strings ("{", "}", "\n", and "\r" in the above example), or a more complex regular expression. In our example above, there is one such regular expression "" which is matched by the end of file. All complex regular expressions are enclosed within angular brackets. The first production above says that the non-terminal "Input" expands to the non-terminal "MethodBraces" followed by zero or more line terminators ("\n" or "\r") and then the end of file. The second production above says that the non-terminal "MatchedBraces" expands to the token "{" followed by an optional nested expansion of "MatchedBraces" followed by the token "}". Square brackets [...] in a JavaCC input file indicate that the ... is optional. [...] may also be written as (...)?. These two forms are equivalent. Other structures that may appear in expansions are: e1 | e2 | e3 | ... : A choice of e1, e2, e3, etc. ( e )+ : One or more occurrences of e ( e )* : Zero or more occurrences of e Note that these may be nested within each other, so we can have something like: (( e1 | e2 )* [ e3 ] ) | e4 To build this parser, simply run JavaCC on this file and compile the resulting Java files: javacc Simple1.jj javac *.java Now you should be able to run the generated parser. Make sure that the current directory is in your CLASSPATH and type: java Simple1 Now type a sequence of matching braces followed by a return and an end of file (CTRL-D on UNIX machines). If this is a problem on your machine, you can create a file and pipe it as input to the generated parser in this manner (piping also does not work on all machines - if this is a problem, just replace "System.in" in the grammar file with 'new FileInputStream("testfile")' and place your input inside this file): java Simple1 < myfile Also try entering illegal sequences such as mismatched braces, spaces, and carriage returns between braces as well as other characters and take a look at the error messages produced by the parser. --------------------------------------------------------------------- DETAILED DESCRIPTION OF Simple2.jj: Simple2.jj is a minor modification to Simple1.jj to allow white space characters to be interspersed among the braces. So then input such as: "{{ }\n}\n\n" will now be legal. Take a look at Simple2.jj. The first thing you will note is that we have omitted the options section. This does not change anything since the options in Simple1.jj were all assigned their default values. The other difference between this file and Simple1.jj is that this file contains a lexical specification - the region that starts with "SKIP". Within this region are 4 regular expressions - space, tab, newline, and return. This says that matches of these regular expressions are to be ignored (and not considered for parsing). Hence whenever any of these 4 characters are encountered, they are just thrown away. In addition to SKIP, JavaCC has three other lexical specification regions. These are: . TOKEN: This is used to specify lexical tokens (see next example) . SPECIAL_TOKEN: This is used to specify lexical tokens that are to be ignored during parsing. In this sense, SPECIAL_TOKEN is the same as SKIP. However, these tokens can be recovered within parser actions to be handled appropriately. . MORE: This specifies a partial token. A complete token is made up of a sequence of MORE's followed by a TOKEN or SPECIAL_TOKEN. Please take a look at some of the more complex grammars such as the Java grammars for examples of usage of these lexical specification regions. You may build Simple2 and invoke the generated parser with input from the keyboard as standard input. You can also try generating the parser with the various debug options turned on and see what the output looks like. To do this type: javacc -debug_parser Simple2.jj javac Simple2*.java java Simple2 Then type: javacc -debug_token_manager Simple2.jj javac Simple2*.java java Simple2 Note that token manager debugging produces a lot of diagnostic information and it is typically used to look at debug traces a single token at a time. --------------------------------------------------------------------- DETAILED DESCRIPTION OF Simple3.jj: Simple3.jj is the third and final version of our matching brace detector. This example illustrates the use of the TOKEN region for specifying lexical tokens. In this case, "{" and "}" are defined as tokens and given names LBRACE and RBRACE respectively. These labels can then be used within angular brackets (as in the example) to refer to this token. Typically such token specifications are used for complex tokens such as identifiers and literals. Tokens that are simple strings are left as is (in the previous examples). This example also illustrates the use of actions in the grammar productions. The actions inserted in this example count the number of matching braces. Note the use of the declaration region to declare variables "count" and "nested_count". Also note how the non-terminal "MatchedBraces" returns its value as a function return value. --------------------------------------------------------------------- DETAILED DESCRIPTION OF NL_Xlator.jj: This example goes into the details of writing regular expressions in JavaCC grammar files. It also illustrates a slightly more complex set of actions that translate the expressions described by the grammar into English. The new concept in the above example is the use of more complex regular expressions. The regular expression: < ID: ["a"-"z","A"-"Z","_"] ( ["a"-"z","A"-"Z","_","0"-"9"] )* > creates a new regular expression whose name is ID. This can be referred anywhere else in the grammar simply as . What follows in square brackets are a set of allowable characters - in this case it is any of the lower or upper case letters or the underscore. This is followed by 0 or more occurrences of any of the lower or upper case letters, digits, or the underscore. Other constructs that may appear in regular expressions are: ( ... )+ : One or more occurrences of ... ( ... )? : An optional occurrence of ... (Note that in the case of lexical tokens, (...)? and [...] are not equivalent) ( r1 | r2 | ... ) : Any one of r1, r2, ... A construct of the form [...] is a pattern that is matched by the characters specified in ... . These characters can be individual characters or character ranges. A "~" before this construct is a pattern that matches any character not specified in ... . Therefore: ["a"-"z"] matches all lower case letters ~[] matches any character ~["\n","\r"] matches any character except the new line characters When a regular expression is used in an expansion, it takes a value of type "Token". This is generated into the generated parser directory as "Token.java". In the above example, we have defined a variable of type "Token" and assigned the value of the regular expression to it. --------------------------------------------------------------------- DETAILED DESCRIPTION OF IdList.jj: This example illustrates an important attribute of the SKIP specification. The main point to note is that the regular expressions in the SKIP specification are only ignored *between tokens* and not *within tokens*. This grammar accepts any sequence of identifiers with white space in between. A legal input for this grammar is: "abc xyz123 A B C \t\n aaa" This is because any number of the SKIP regular expressions are allowed in between consecutive 's. However, the following is not a legal input: "xyz 123" This is because the space character after "xyz" is in the SKIP category and therefore causes one token to end and another to begin. This requires "123" to be a separate token and hence does not match the grammar. If spaces were OK within 's, then all one has to do is to replace the definition of Id to: TOKEN : { < Id: ["a"-"z","A"-"Z"] ( (" ")* ["a"-"z","A"-"Z","0"-"9"] )* > } Note that having a space character within a TOKEN specification does not mean that the space character cannot be used in the SKIP specification. All this means is that any space character that appears in the context where it can be placed within an identifier will participate in the match for , whereas all other space characters will be ignored. The details of the matching algorithm are described in the JavaCC documentation in the web pages. As a corollary, one must define as tokens anything within which characters such as white space characters must not be present. In the above example, if was defined as a grammar production rather than a lexical token as shown below this paragraph, then "xyz 123" would have been recognized as a legitimate (wrongly). void Id() : {} { <["a"-"z","A"-"Z"]> ( <["a"-"z","A"-"Z","0"-"9"]> )* } Note that in the above definition of non-terminal Id, it is made up of a sequence of single character tokens (note the location of <...>s), and hence white space is allowed between these characters. --------------------------------------------------------------------- javacc-5.0.orig/examples/SimpleExamples/Simple2.jj0000644000175000017500000000404510604736401021142 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Simple2) /** Simple brace matcher. */ public class Simple2 { /** Main entry point. */ public static void main(String args[]) throws ParseException { Simple2 parser = new Simple2(System.in); parser.Input(); } } PARSER_END(Simple2) SKIP : { " " | "\t" | "\n" | "\r" } /** Root production. */ void Input() : {} { MatchedBraces() } /** Brace matching production. */ void MatchedBraces() : {} { "{" [ MatchedBraces() ] "}" } javacc-5.0.orig/examples/SimpleExamples/IdList.jj0000644000175000017500000000377510604736401021030 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(IdList) /** ID lister. */ public class IdList { /** Main entry point. */ public static void main(String args[]) throws ParseException { IdList parser = new IdList(System.in); parser.Input(); } } PARSER_END(IdList) SKIP : { " " | "\t" | "\n" | "\r" } TOKEN : { < Id: ["a"-"z","A"-"Z"] ( ["a"-"z","A"-"Z","0"-"9"] )* > } /** Top level production. */ void Input() : {} { ( )+ } javacc-5.0.orig/examples/Obfuscator/0000755000175000017500000000000011247044052016454 5ustar mkochmkochjavacc-5.0.orig/examples/Obfuscator/useids0000644000175000017500000000011307671171031017672 0ustar mkochmkoch// Obfuscated identifiers to use (preferably). fileName randomNumber html javacc-5.0.orig/examples/Obfuscator/maps0000644000175000017500000000013207671171031017337 0ustar mkochmkoch// Mappings from original names to obfuscated names incr -> square_root; Incr -> MyMath; javacc-5.0.orig/examples/Obfuscator/nochangeids0000644000175000017500000000010707671171031020663 0ustar mkochmkoch// Identifiers that must not be obfuscated. System out println String javacc-5.0.orig/examples/Obfuscator/Globals.java0000644000175000017500000000537411052407263020714 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ import java.io.*; import java.util.*; public class Globals { // The mappings from old id's to new id's. static Hashtable mappings = new Hashtable(); // A table of targets of all known mappings. static Hashtable mapTargets = new Hashtable(); // These id's may not be changed. static Hashtable noChangeIds = new Hashtable(); // These id's should be used for mappings. static Hashtable useIds = new Hashtable(); // The location of the input and output directories. static File inpDir, outDir; // Set to true by Java parser if class has a main program. static boolean mainExists; // Returns the map of old to obfuscated id. If map does not // exist, it is created. static String map(String str) { Object obj = mappings.get(str); if (obj != null) { return (String)obj; } if (useIds.isEmpty()) { String newId = "O0" + counter++; mappings.put(str, newId); return newId; } else { obj = useIds.keys().nextElement(); useIds.remove(obj); String newId = (String)obj; mappings.put(str, newId); return newId; } } // A counter used to generate new identifiers static int counter = 0; } javacc-5.0.orig/examples/Obfuscator/Obfuscator.java0000644000175000017500000002321011052407263021425 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ import java.io.*; import java.util.*; public class Obfuscator extends Globals { // These data structures implement a stack that is used to recursively // walk the input directory structure looking for Java files. static String[][] dirStack = new String[100][]; static int[] dirStackIndex = new int[100]; static int dirStackSize; static File[] dirFile = new File[100]; static { dirFile[0] = inpDir; dirStackSize = 1; dirStack[dirStackSize] = dirFile[dirStackSize-1].list(); dirStackIndex[dirStackSize] = 0; } // Returns true if this is a Java file. static boolean javaFile(String name) { if (name.length() < 6) { return false; } if (name.substring(name.length() - 5).equals(".java")) { return true; } return false; } // The iterator. This uses the above datastructures to walk the input // directory tree. Everytime it finds a Java file or when it cannot find // any more Java file, it returns to the caller. static void nextJavaFile() { while (true) { if (dirStackIndex[dirStackSize] == dirStack[dirStackSize].length) { dirStackSize--; if (dirStackSize == 0) { return; } else { dirStackIndex[dirStackSize]++; } } else { dirFile[dirStackSize] = new File(dirFile[dirStackSize-1], dirStack[dirStackSize][dirStackIndex[dirStackSize]]); if (dirStack[dirStackSize][dirStackIndex[dirStackSize]].equals("SCCS")) { dirStackIndex[dirStackSize]++; } else if (dirFile[dirStackSize].isDirectory()) { dirStackSize++; dirStack[dirStackSize] = dirFile[dirStackSize-1].list(); dirStackIndex[dirStackSize] = 0; } else if (javaFile(dirStack[dirStackSize][dirStackIndex[dirStackSize]])) { dirStackIndex[dirStackSize]++; return; } else { dirStackIndex[dirStackSize]++; } } } } // The main Obfuscator routine. It calls the iterator for each Java file to // work on. It then creates the output file, then parses the input Java file // to determine whether or not it has a main program and also to collect the // tokens that make up this file. It then calls printOutputFile that takes // first token and walks the next field chain printing tokens as it goes along. // Finally a main program is created if necessary. static public void start() { boolean parserInitialized = false; JavaParser parser = null; Token first; while (true) { nextJavaFile(); if (dirStackSize == 0) { break; } createOutputFile(); System.out.println("Obfuscating " + dirFile[dirStackSize].getPath()); System.out.println(" into " + outFile.getPath()); try { if (parserInitialized) { parser.ReInit(new FileInputStream(dirFile[dirStackSize])); } else { parser = new JavaParser(new FileInputStream(dirFile[dirStackSize])); parserInitialized = true; } first = parser.CompilationUnit(dirStack[dirStackSize][dirStackIndex[dirStackSize]-1]); } catch (ParseException e1) { System.out.println("Parse error in file " + dirFile[dirStackSize].getPath()); throw new Error(); } catch (IOException e2) { System.out.println("Could not open file " + dirFile[dirStackSize].getPath()); throw new Error(); } printOutputFile(first); if (mainExists) { createMainClass(); } } } static File outFile; static PrintWriter ostr; static void createOutputFile() { // sets outFile and ostr outFile = outDir; for (int i = 1; i < dirStackSize; i++) { outFile = new File(outFile, map(dirStack[i][dirStackIndex[i]])); if (outFile.exists()) { if (!outFile.isDirectory()) { System.out.println("Unexpected error!"); throw new Error(); } } else { if (!outFile.mkdir()) { System.out.println("Could not create directory " + outFile.getPath()); throw new Error(); } } } String origFileName = dirStack[dirStackSize][dirStackIndex[dirStackSize]-1]; String newFileName = map(origFileName.substring(0, origFileName.length() - 5)) + ".java"; outFile = new File(outFile, newFileName); try { ostr = new PrintWriter(new FileWriter(outFile)); } catch (IOException e) { System.out.println("Could not create file " + outFile.getPath()); throw new Error(); } } static void printOutputFile(Token first) { Token t = first; for (int i = 1; i < t.beginColumn; i++) { ostr.print(" "); } while (true) { if (t.kind == JavaParserConstants.IDENTIFIER) { t.image = map(t.image); } ostr.print(addUnicodeEscapes(t.image)); if (t.next == null) { ostr.println(""); break; } if (t.endLine != t.next.beginLine) { for (int i = t.endLine; i < t.next.beginLine; i++) { ostr.println(""); } for (int i = 1; i < t.next.beginColumn; i++) { ostr.print(" "); } } else { for (int i = t.endColumn+1; i < t.next.beginColumn; i++) { ostr.print(" "); } } t = t.next; } ostr.close(); } static String addUnicodeEscapes(String str) { String retval = ""; char ch; for (int i = 0; i < str.length(); i++) { ch = str.charAt(i); if (ch < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval += "\\u" + s.substring(s.length() - 4, s.length()); } else { retval += ch; } } return retval; } // This creates a main program if there was one in the original file. This // main program has the same name and resides in the same package as the original // file and it simply calls the obfuscated main program. This allows scripts // to continue to work. static void createMainClass() { PrintWriter mstr; boolean mustCreate = false; File mFile = outDir; for (int i = 1; i < dirStackSize; i++) { mFile = new File(mFile, dirStack[i][dirStackIndex[i]]); mustCreate = mustCreate || !map(dirStack[i][dirStackIndex[i]]).equals(dirStack[i][dirStackIndex[i]]); if (mFile.exists()) { if (!mFile.isDirectory()) { System.out.println("Error: Created file " + mFile.getPath() + ", but need to create a main program with the same path prefix. Please remove identifiers from the path prefix from your and run again."); throw new Error(); } } } String origFileName = dirStack[dirStackSize][dirStackIndex[dirStackSize]-1]; String newFileName = map(origFileName.substring(0, origFileName.length() - 5)) + ".java"; if (!mustCreate && origFileName.equals(newFileName)) { return; // this main program has not been obfuscated. } if (!mFile.exists() && !mFile.mkdirs()) { System.out.println("Could not create " + mFile.getPath()); throw new Error(); } mFile = new File(mFile, origFileName); try { mstr = new PrintWriter(new FileWriter(mFile)); } catch (IOException e) { System.out.println("Could not create " + mFile.getPath()); throw new Error(); } System.out.print("Generating main program "); String pname = ""; if (dirStackSize > 1) { for (int i = 1; i < dirStackSize; i++) { pname += "." + dirStack[i][dirStackIndex[i]]; } mstr.println("package " + pname.substring(1) + ";"); System.out.print(pname.substring(1) + "."); mstr.println(""); } System.out.println(origFileName.substring(0, origFileName.length() - 5)); mstr.println("public class " + origFileName.substring(0, origFileName.length() - 5) + " {"); mstr.println(""); mstr.println(" public static void main(String[] args) {"); pname = ""; for (int i = 1; i < dirStackSize; i++) { pname += map(dirStack[i][dirStackIndex[i]]) + "."; } mstr.println(" " + pname + map(origFileName.substring(0, origFileName.length() - 5)) + ".main(args);"); mstr.println(" }"); mstr.println(""); mstr.println("}"); mstr.close(); } } javacc-5.0.orig/examples/Obfuscator/MapFile.jj0000644000175000017500000001220610535127042020317 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { JAVA_UNICODE_ESCAPE = true; STATIC = false; } PARSER_BEGIN(MapFile) import java.util.*; public class MapFile { } PARSER_END(MapFile) /* * Following is the only production in this grammar. This describes the grammar * of the mapsfile, which is simply a list of maps from actual identifiers to * obfuscated identifiers. The actions here insert these mappings into the * appropriate Hashtable's in Globals.java. */ void input() : { Token t1, t2; } { ( t1= "->" t2= ";" { if (Globals.mappings.get(t1.image) != null) { if (!t1.image.equals(t2.image)) { System.out.println("Warning: Map specification of " + t1.image + " to " + t2.image + " overrides entry in ."); } } // truncate size just to be safe on machines like Macs if (t2.image.length() > 24) { t2.image = t2.image.substring(0,24); } Globals.mappings.put(t1.image, t2.image); Globals.mapTargets.put(t2.image, ""); if (t2.image.length() > 2 && t2.image.substring(0,2).equals("O0")) { int i = Integer.parseInt(t2.image.substring(2)); if (i > Globals.counter) { Globals.counter = i; } } } )* } // Lexical specifications follow (copied from the Java 1.1 grammar) SKIP : /* WHITE SPACE */ { " " | "\t" | "\n" | "\r" | "\f" } SKIP : /* COMMENTS */ { | | } TOKEN : /* RESERVED WORDS */ { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } javacc-5.0.orig/examples/Obfuscator/Main.java0000644000175000017500000001065511052407263020213 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ import java.io.*; import java.util.*; public class Main extends Globals { /* * This main program collects the input arguments. If one or more of the three * latter arguments are present, then these files are opened and parsed with the * appropriate parsers. Then the method Obfuscator.start() is called that does * the actual obfuscation. Finally, the file map.log is generated. */ public static void main(String[] args) throws FileNotFoundException { IdsFile idparser = null; if (args.length < 2 || args.length > 5) { System.out.println("Usage is \"java Main \""); System.out.println(" must be the CLASSPATH directory."); System.out.println(" , , and are optional, but if any of"); System.out.println(" these are present, then the ones preceding them must also be present."); return; } inpDir = new File(args[0]); if (!inpDir.isDirectory()) { System.out.println("Error: " + args[0] + " is not a directory."); return; } outDir = new File(args[1]); if (outDir.exists()) { if (!outDir.isDirectory()) { System.out.println("Error: " + args[1] + " is not a directory."); return; } } else { System.out.println(args[1] + " does not exist. Will create it."); if (!outDir.mkdirs()) { System.out.println("Could not create directory " + args[1]); return; } } if (args.length >= 4) { try { idparser = new IdsFile(new FileInputStream(args[3])); idparser.input(true, args[3]); } catch (ParseException e) { System.out.println("Parse error in " + args[3]); return; } } if (args.length >= 3) { try { MapFile mapparser = new MapFile(new FileInputStream(args[2])); mapparser.input(); } catch (ParseException e) { System.out.println("Parse error in " + args[2]); return; } } if (args.length == 5) { try { idparser.ReInit(new FileInputStream(args[4])); idparser.input(false, args[4]); } catch (ParseException e) { System.out.println("Parse error in " + args[4]); return; } } mappings.put("main", "main"); Obfuscator.start(); System.out.println("Dumping mappings used into map.log."); PrintWriter mstr; try { mstr = new PrintWriter(new FileWriter("map.log")); } catch (IOException e) { System.out.println("Could not create file map.log"); throw new Error(); } for (Enumeration enumeration = mappings.keys(); enumeration.hasMoreElements();) { String from = (String)enumeration.nextElement(); String to = (String)mappings.get(from); mstr.println(from + " -> " + to + ";"); } mstr.close(); } } javacc-5.0.orig/examples/Obfuscator/README0000644000175000017500000001064210535127042017337 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This directory contains an obfuscation program. This program takes the following inputs: . An input directory which contains the original Java programs. This must be the CLASSPATH directory. All Java files within this directory except those under SCCS directories are considered for obfuscation. . An output directory into which the obfuscated files are generated. It should be possible to build the obfuscated version by setting the CLASSPATH to this directory. . A file of mappings of the form: ( originalId "->" obfuscatedId ";" )* This specifies mappings from original identifiers to corresponding obfuscated ones. This file is optional, and even when it is present, it does not have to specify all identifiers in the input file. . A file containing identifiers that must not be obfuscated. This is typically used to prevent references to the standard API's from being changed. This file is optional. . A file containing identifiers to be used for obfuscation. If an identifier is encountered in the original file that does not have a specified mapping and is not an identifier that must not be obfuscated, then identifiers from this file are used for obfuscation. Once identifiers from this file are exhausted, then identifiers starting with "O0" the letter 'O' followed by the digit '0' are generated automatically. This file is optional. The output of the program is: . An obfuscated version for each input Java file. Since package and class names are also obfuscated, the directory and file names will be different also. . A main program for each of the original main programs in their original forms (with the same package and class names) that calls the corresponding obfuscated main program. This is useful to retain access to the system as before. . A file containing all the mappings used during the obfuscation process. This file is in the same syntax as the input mapping file, and therefore it can be used as input for future obfuscations. This is useful when related systems are obfuscated in different runs of this program. To build the obfuscator, do the following: javacc Java1.1.jj javacc IdsFile.jj javacc MapFile.jj javac *.java Now the obfuscator is ready for use. Try it out as follows on the example provided: java Main input output maps nochangeids useids And take a look at the input and output directories. This example illustrates the use of multiple grammar files, some of which are used more than once while the system is running. Take a look at the usage of ReInit's and also the actions in the grammar. Note how easy it was to include actions into the Java grammar to determine whether or not it had a main program. Also note how easy it is to modify this program. Some comments are present in each of the files that comprise this example. javacc-5.0.orig/examples/Obfuscator/IdsFile.jj0000644000175000017500000001232310535127041020320 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { JAVA_UNICODE_ESCAPE = true; STATIC = false; } PARSER_BEGIN(IdsFile) import java.util.*; public class IdsFile { } PARSER_END(IdsFile) /* * Following is the only production in this grammar. This describes the grammar * of the nochangeidsfile and useidsfile, which are simply lists of identifiers. * The actions here insert these identifiers into the appropriate Hashtable's * in Globals.java. */ void input(boolean noChangeIds, String fileName) : { Token t; Object obj; Hashtable symtab = noChangeIds ? Globals.noChangeIds : Globals.useIds; } { ( t= { if (!noChangeIds) { // truncate size just to be safe on machines like Macs if (t.image.length() > 24) { t.image = t.image.substring(0,24); } } if (!noChangeIds && Globals.mapTargets.get(t.image) != null) { System.out.println("Warning: Identifier " + t.image + " from already mapped."); } else { obj = symtab.put(t.image, ""); if (obj != null) { System.out.println("Warning: Multiple occurrence of identifier " + t.image + " in " + fileName); } else if (noChangeIds) { Globals.mappings.put(t.image, t.image); Globals.mapTargets.put(t.image, ""); } } } )* } // Lexical specifications follow (copied from the Java 1.1 grammar) SKIP : /* WHITE SPACE */ { " " | "\t" | "\n" | "\r" | "\f" } SKIP : /* COMMENTS */ { | | } TOKEN : /* RESERVED WORDS */ { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } javacc-5.0.orig/examples/Obfuscator/input/0000755000175000017500000000000011247044052017613 5ustar mkochmkochjavacc-5.0.orig/examples/Obfuscator/input/package2/0000755000175000017500000000000011247044052021270 5ustar mkochmkochjavacc-5.0.orig/examples/Obfuscator/input/package2/Incr.java0000644000175000017500000000352511052407263023034 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package package2; public class Incr { static private int count = 0; /** * Returns the next integer value each time it is called. The * state information is stored in the variable count. */ static public int incr() { return count++; } } javacc-5.0.orig/examples/Obfuscator/input/package1/0000755000175000017500000000000011247044052021267 5ustar mkochmkochjavacc-5.0.orig/examples/Obfuscator/input/package1/Main.java0000644000175000017500000000346611052407263023030 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package package1; public class Main { public static void main(String[] args) { System.out.println("Calling incr 10 times..."); for (int i = 0; i < 10; i++) { System.out.println(package2.Incr.incr()); } } } javacc-5.0.orig/examples/Obfuscator/Java1.1.jj0000644000175000017500000004557710535127041020123 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* * This modifies the original Java1.1.jj to include actions to determine * if the file has a main program or not. This information is stored in * Globals.mainExists and used to decide when to generate main programs. * The method CompilationUnit returns the first token of the Java program * using which all tokens can be recovered through the next field. */ options { JAVA_UNICODE_ESCAPE = true; STATIC = false; } PARSER_BEGIN(JavaParser) import java.util.*; public class JavaParser { static String className, fileName; } PARSER_END(JavaParser) /* WHITE SPACE */ SKIP : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > | < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > | < LSHIFT: "<<" > | < RSIGNEDSHIFT: ">>" > | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > | < LSHIFTASSIGN: "<<=" > | < RSIGNEDSHIFTASSIGN: ">>=" > | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ Token CompilationUnit(String file) : { Token retval = getToken(1); fileName = file; Globals.mainExists = false; } { [ PackageDeclaration() ] ( ImportDeclaration() )* ( TypeDeclaration() )* { return retval; } } void PackageDeclaration() : {} { "package" Name() ";" } void ImportDeclaration() : {} { "import" Name() [ "." "*" ] ";" } void TypeDeclaration() : {} { LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" ) ClassDeclaration() | InterfaceDeclaration() | ";" } /* * Declaration syntax follows. */ void ClassDeclaration() : {} { ( "abstract" | "final" | "public" )* UnmodifiedClassDeclaration(true) } void UnmodifiedClassDeclaration(boolean topLevel) : { Token t; String backupOfClassName = ""; } { "class" t= [ "extends" Name() ] [ "implements" NameList() ] { if (topLevel) { className = t.image; } else if (!className.equals("")) { backupOfClassName = className; className = ""; } } ClassBody() { if (topLevel) { className = ""; } else if (!backupOfClassName.equals("")) { className = backupOfClassName; } } } void ClassBody() : {} { "{" ( ClassBodyDeclaration() )* "}" } void NestedClassDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedClassDeclaration(false) } void ClassBodyDeclaration() : {} { LOOKAHEAD(2) Initializer() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( [ "public" | "protected" | "private" ] Name() "(" ) ConstructorDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } // This production is to determine lookahead only. void MethodDeclarationLookahead() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() "(" } void InterfaceDeclaration() : {} { ( "abstract" | "public" )* UnmodifiedInterfaceDeclaration() } void NestedInterfaceDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedInterfaceDeclaration() } void UnmodifiedInterfaceDeclaration() : {} { "interface" [ "extends" NameList() ] "{" ( InterfaceMemberDeclaration() )* "}" } void InterfaceMemberDeclaration() : {} { LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } void FieldDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" )* Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator() : {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId() : {} { ( "[" "]" )* } void VariableInitializer() : {} { ArrayInitializer() | Expression() } void ArrayInitializer() : {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator() : { Token t; } { t= FormalParameters() ( "[" "]" )* { if (fileName.substring(0, fileName.length() - 5).equals(className)) { if (t.image.equals("main")) { Globals.mainExists = true; } } } } void FormalParameters() : {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter() : {} { [ "final" ] Type() VariableDeclaratorId() } void ConstructorDeclaration() : {} { [ "public" | "protected" | "private" ] FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation() : {} { LOOKAHEAD("this" Arguments() ";") "this" Arguments() ";" | [ LOOKAHEAD(2) PrimaryExpression() "." ] "super" Arguments() ";" } void Initializer() : {} { [ "static" ] Block() } /* * Type, name and expression syntax follows. */ void Type() : {} { ( PrimitiveType() | Name() ) ( "[" "]" )* } void PrimitiveType() : {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { "void" | Type() } void Name() : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ {} { ( LOOKAHEAD(2) "." )* } void NameList() : {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ {} { ConditionalExpression() [ AssignmentOperator() Expression() ] } void AssignmentOperator() : {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression() : {} { ConditionalOrExpression() [ "?" Expression() ":" ConditionalExpression() ] } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^" AndExpression() )* } void AndExpression() : {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression() : {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression() : {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression() : {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression() : {} { AdditiveExpression() ( ( "<<" | ">>" | ">>>" ) AdditiveExpression() )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression() : {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression() : {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression() : {} { "++" PrimaryExpression() } void PreDecrementExpression() : {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus() : {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead() : {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Name() "[") "(" Name() "[" "]" | "(" Name() ")" ( "~" | "!" | "(" | | "this" | "super" | "new" | Literal() ) } void PostfixExpression() : {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression() : {} { LOOKAHEAD("(" PrimitiveType()) "(" Type() ")" UnaryExpression() | "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() : {} { PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* } void PrimaryPrefix() : {} { Literal() | "this" | "super" "." | "(" Expression() ")" | AllocationExpression() | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class" | Name() } void PrimarySuffix() : {} { LOOKAHEAD(2) "." "this" | LOOKAHEAD(2) "." AllocationExpression() | "[" Expression() "]" | "." | Arguments() } void Literal() : {} { | | | | BooleanLiteral() | NullLiteral() } void BooleanLiteral() : {} { "true" | "false" } void NullLiteral() : {} { "null" } void Arguments() : {} { "(" [ ArgumentList() ] ")" } void ArgumentList() : {} { Expression() ( "," Expression() )* } void AllocationExpression() : {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimsAndInits() | "new" Name() ( ArrayDimsAndInits() | Arguments() [ ClassBody() ] ) } /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimsAndInits() : {} { LOOKAHEAD(2) ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* | ( "[" "]" )+ ArrayInitializer() } /* * Statement syntax follows. */ void Statement() : {} { LOOKAHEAD(2) LabeledStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void LabeledStatement() : {} { ":" Statement() } void Block() : {} { "{" ( BlockStatement() )* "}" } void BlockStatement() : {} { LOOKAHEAD([ "final" ] Type() ) LocalVariableDeclaration() ";" | Statement() | UnmodifiedClassDeclaration(false) | UnmodifiedInterfaceDeclaration() } void LocalVariableDeclaration() : {} { [ "final" ] Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement() : {} { ";" } void StatementExpression() : /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ {} { PreIncrementExpression() | PreDecrementExpression() | PrimaryExpression() [ "++" | "--" | AssignmentOperator() Expression() ] } void SwitchStatement() : {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel() : {} { "case" Expression() ":" | "default" ":" } void IfStatement() : /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void DoStatement() : {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement() : {} { "for" "(" [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ")" Statement() } void ForInit() : {} { LOOKAHEAD( [ "final" ] Type() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList() : {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate() : {} { StatementExpressionList() } void BreakStatement() : {} { "break" [ ] ";" } void ContinueStatement() : {} { "continue" [ ] ";" } void ReturnStatement() : {} { "return" [ Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement() : {} { "synchronized" "(" Expression() ")" Block() } void TryStatement() : /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } javacc-5.0.orig/examples/JJTreeExamples/0000755000175000017500000000000011247044051017166 5ustar mkochmkochjavacc-5.0.orig/examples/JJTreeExamples/ASTMyID.java0000644000175000017500000000402710604730422021206 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** * An ID. */ public class ASTMyID extends SimpleNode { private String name; /** * Constructor. * @param id the id */ public ASTMyID(int id) { super(id); } /** * Set the name. * @param n the name */ public void setName(String n) { name = n; } /** * {@inheritDoc} * @see org.javacc.examples.jjtree.eg2.SimpleNode#toString() */ public String toString() { return "Identifier: " + name; } } javacc-5.0.orig/examples/JJTreeExamples/Eg4DumpVisitor.java0000644000175000017500000000724010610746500022662 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** * This is an example of how the Visitor pattern might be used to * implement the dumping code that comes with SimpleNode. It's a bit * long-winded, but it does illustrate a couple of the main points. *
    *
  1. the visitor can maintain state between the nodes that it visits * (for example the current indentation level). *
  2. * *
  3. if you don't implement a jjtAccept() method for a subclass of * SimpleNode, then SimpleNode's acceptor will get called. *
  4. *
  5. the utility method childrenAccept() can be useful when * implementing preorder or postorder tree walks. *
  6. *
* */ public class Eg4DumpVisitor implements Eg4Visitor { private int indent = 0; private String indentString() { StringBuffer sb = new StringBuffer(); for (int i = 0; i < indent; ++i) { sb.append(' '); } return sb.toString(); } public Object visit(SimpleNode node, Object data) { System.out.println(indentString() + node + ": acceptor not unimplemented in subclass?"); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTStart node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTAdd node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTMult node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTMyOtherID node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } public Object visit(ASTInteger node, Object data) { System.out.println(indentString() + node); ++indent; data = node.childrenAccept(this, data); --indent; return data; } } /*end*/ javacc-5.0.orig/examples/JJTreeExamples/ASTMyOtherID.java0000644000175000017500000000426710604730447022225 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** * Another ID. */ public class ASTMyOtherID extends SimpleNode { private String name; /** * Constructor. * @param id the id */ public ASTMyOtherID(int id) { super(id); } /** Accept the visitor. **/ public Object jjtAccept(Eg4Visitor visitor, Object data) { return visitor.visit(this, data); } /** * Set the name. * * @param n the name to set */ public void setName(String n) { name = n; } /** * {@inheritDoc} * @see org.javacc.examples.jjtree.eg4.SimpleNode#toString() */ public String toString() { return "Identifier: " + name; } } javacc-5.0.orig/examples/JJTreeExamples/eg2.jjt0000644000175000017500000000673210712740145020367 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { MULTI=true; KEEP_LINE_COLUMN = false; } PARSER_BEGIN(Eg2) /** An Arithmetic Grammar. */ public class Eg2 { /** Main entry point. */ public static void main(String args[]) { System.out.println("Reading from standard input..."); Eg2 t = new Eg2(System.in); try { ASTStart n = t.Start(); n.dump(""); System.out.println("Thank you."); } catch (Exception e) { System.out.println("Oops."); System.out.println(e.getMessage()); e.printStackTrace(); } } } PARSER_END(Eg2) SKIP : { " " | "\t" | "\n" | "\r" | <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> | <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: ["_","a"-"z","A"-"Z"] > | < #DIGIT: ["0"-"9"] > } /** Main production. */ ASTStart Start() : {} { Expression() ";" { return jjtThis; } } /** An Expression. */ void Expression() #void : {} { AdditiveExpression() } /** An Additive Expression. */ void AdditiveExpression() #void : {} { ( MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* ) #Add(>1) } /** A Multiplicative Expression. */ void MultiplicativeExpression() #void : {} { ( UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* ) #Mult(>1) } /** A Unary Expression. */ void UnaryExpression() #void : {} { "(" Expression() ")" | MyID() | Integer() } /** An Identifier. */ void MyID() : { Token t; } { t= { jjtThis.setName(t.image); } } /** An Integer. */ void Integer() : {} { } javacc-5.0.orig/examples/JJTreeExamples/README0000644000175000017500000001775310575552355020101 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ JJTreeExamples This directory contains some simple JJTree input files intended to illustrate some of the basic ideas. All of them are based on a grammar to recognize arithmetic expressions built out of identifiers and constants. eg1.jjt This example is just the JavaCC grammar, with a little extra code in the parser's main method to call the dump method on the generated tree. It illustrates how the default behavior of JJTree will produce a tree of non-terminals. eg2.jjt This example is the same grammar as eg1.jjt with modifications to customize the generated tree. It illustrates how unnecessary intermediate nodes can be suppressed and how actions in the grammar can attach extra information to the nodes. eg3.jjt This example is a modification of eg2.jjt with the NODE_DEFAULT_VOID option set. This instructs JJTree to treat all undecorated non-terminals as if they were decorated as #void. The default JJTree behavior is to treat such non-terminals as if they were decorated with the name of the non-terminal. eg4.jjt This is a modification of eg3.jjt with the VISITOR option set. This instructs JJTree to insert a jjtAccept() method into all nodes it generates, and to produce a visitor class. The visitor is used to dump the tree. Here are some instructions on how to run the examples using the Ant build scripts, and the output you can expect to see. eg1.jjt ------- The only bit of JJTree-specific code is an action in the start production that dumps the constructed parse tree when the parse is complete. It uses JJTree simple mode. The input file is eg1.jjt. $ ant eg1 Buildfile: build.xml eg1: [mkdir] Created dir: /home/tom/javacc/javacc/examples/JJTreeExamples/eg1 [copy] Copying 1 file to /home/tom/javacc/javacc/examples/JJTreeExamples/eg1 [jjtree] Java Compiler Compiler Version 3.2 (Tree Builder) [jjtree] (type "jjtree" with no arguments for help) [jjtree] Reading from file /home/tom/javacc/javacc/examples/JJTreeExamples/eg1.jjt . . . [jjtree] File "/home/tom/javacc/javacc/examples/JJTreeExamples/eg1/Node.java" does not exist. Will create one. [jjtree] File "/home/tom/javacc/javacc/examples/JJTreeExamples/eg1/SimpleNode.java" does not exist. Will create one. [jjtree] Annotated grammar generated successfully in /home/tom/javacc/javacc/examples/JJTreeExamples/eg1/eg1.jj [javacc] Java Compiler Compiler Version 3.2 (Parser Generator) [javacc] (type "javacc" with no arguments for help) [javacc] Reading from file /home/tom/javacc/javacc/examples/JJTreeExamples/eg1/eg1.jj . . . [javacc] File "TokenMgrError.java" does not exist. Will create one. [javacc] File "ParseException.java" does not exist. Will create one. [javacc] File "Token.java" does not exist. Will create one. [javacc] File "SimpleCharStream.java" does not exist. Will create one. [javacc] Parser generated successfully. [javac] Compiling 11 source files to /home/tom/javacc/javacc/examples/JJTreeExamples/eg1 [echo] ******* [echo] ******* Now cd into the eg1 directory and run 'java eg1' ****** [echo] ******* BUILD SUCCESSFUL Total time: 3 seconds [tom@hal JJTreeExamples]$ cd eg1 [tom@hal eg1]$ java eg1 Reading from standard input... (a + b) * (c + 1); Start Expression AdditiveExpression MultiplicativeExpression UnaryExpression Expression AdditiveExpression MultiplicativeExpression UnaryExpression Identifier MultiplicativeExpression UnaryExpression Identifier UnaryExpression Expression AdditiveExpression MultiplicativeExpression UnaryExpression Identifier MultiplicativeExpression UnaryExpression Integer Thank you. eg2.jjt ------- This is a modification of the first example to illustrate how the parse tree can be customized: $ ant eg2 Buildfile: build.xml eg2: [mkdir] Created dir: /home/tom/javacc/javacc/examples/JJTreeExamples/eg2 [copy] Copying 1 file to /home/tom/javacc/javacc/examples/JJTreeExamples/eg2 [copy] Copying 1 file to /home/tom/javacc/javacc/examples/JJTreeExamples/eg2 [jjtree] Java Compiler Compiler Version 3.2 (Tree Builder) [jjtree] (type "jjtree" with no arguments for help) [jjtree] Reading from file /home/tom/javacc/javacc/examples/JJTreeExamples/eg2.jjt . . . [jjtree] File "/home/tom/javacc/javacc/examples/JJTreeExamples/eg2/Node.java" does not exist. Will create one. [jjtree] File "/home/tom/javacc/javacc/examples/JJTreeExamples/eg2/SimpleNode.java" does not exist. Will create one. [jjtree] File "/home/tom/javacc/javacc/examples/JJTreeExamples/eg2/ASTStart.java" does not exist. Will create one. [jjtree] File "/home/tom/javacc/javacc/examples/JJTreeExamples/eg2/ASTAdd.java" does not exist. Will create one. [jjtree] File "/home/tom/javacc/javacc/examples/JJTreeExamples/eg2/ASTMult.java" does not exist. Will create one. [jjtree] File "/home/tom/javacc/javacc/examples/JJTreeExamples/eg2/ASTInteger.java" does not exist. Will create one. [jjtree] Annotated grammar generated successfully in /home/tom/javacc/javacc/examples/JJTreeExamples/eg2/eg2.jj [javacc] Java Compiler Compiler Version 3.2 (Parser Generator) [javacc] (type "javacc" with no arguments for help) [javacc] Reading from file /home/tom/javacc/javacc/examples/JJTreeExamples/eg2/eg2.jj . . . [javacc] File "TokenMgrError.java" does not exist. Will create one. [javacc] File "ParseException.java" does not exist. Will create one. [javacc] File "Token.java" does not exist. Will create one. [javacc] File "SimpleCharStream.java" does not exist. Will create one. [javacc] Parser generated successfully. [javac] Compiling 16 source files to /home/tom/javacc/javacc/examples/JJTreeExamples/eg2 [echo] ******* [echo] ******* Now cd into the eg2 directory and run 'java eg2' ****** [echo] ******* BUILD SUCCESSFUL Total time: 3 seconds [tom@hal JJTreeExamples]$ cd eg2 [tom@hal eg2]$ java eg2 Reading from standard input... (a + b) * (c + 1); Start Mult Add Identifier: a Identifier: b Add Identifier: c Integer Thank you. Look at eg2.jjt to see how node annotations can be used to restructure the parse tree, and at ASTMyID.java to see how you can write your own node classes that maintain more information from the input stream. eg3.jjt ------- This example can be run in the same manner as you ran eg2.jjt. eg4.jjt ------- This example again can be run in the same manner as you ran eg2.jjt. javacc-5.0.orig/examples/JJTreeExamples/build.xml0000644000175000017500000000546310610746405021024 0ustar mkochmkoch javacc-5.0.orig/examples/JJTreeExamples/eg1.jjt0000644000175000017500000000650010604730310020350 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Eg1) /** An Arithmetic Grammar. */ public class Eg1 { /** Main entry point. */ public static void main(String args[]) { System.out.println("Reading from standard input..."); Eg1 t = new Eg1(System.in); try { SimpleNode n = t.Start(); n.dump(""); System.out.println("Thank you."); } catch (Exception e) { System.out.println("Oops."); System.out.println(e.getMessage()); e.printStackTrace(); } } } PARSER_END(Eg1) SKIP : { " " | "\t" | "\n" | "\r" | <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> | <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: ["_","a"-"z","A"-"Z"] > | < #DIGIT: ["0"-"9"] > } /** Main production. */ SimpleNode Start() : {} { Expression() ";" { return jjtThis; } } /** An Expression. */ void Expression() : {} { AdditiveExpression() } /** An Additive Expression. */ void AdditiveExpression() : {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } /** A Multiplicative Expression. */ void MultiplicativeExpression() : {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } /** A Unary Expression. */ void UnaryExpression() : {} { "(" Expression() ")" | Identifier() | Integer() } /** An Identifier. */ void Identifier() : {} { } /** An Integer. */ void Integer() : {} { } javacc-5.0.orig/examples/JJTreeExamples/eg3.jjt0000644000175000017500000000674110604730310020361 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { MULTI=true; NODE_DEFAULT_VOID=true; } PARSER_BEGIN(Eg3) /** An Arithmetic Grammar. */ public class Eg3 { /** Main entry point. */ public static void main(String args[]) { System.out.println("Reading from standard input..."); Eg3 t = new Eg3(System.in); try { ASTStart n = t.Start(); n.dump(""); System.out.println("Thank you."); } catch (Exception e) { System.out.println("Oops."); System.out.println(e.getMessage()); e.printStackTrace(); } } } PARSER_END(Eg3) SKIP : { " " | "\t" | "\n" | "\r" | <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> | <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: ["_","a"-"z","A"-"Z"] > | < #DIGIT: ["0"-"9"] > } /** Main production. */ ASTStart Start() #Start : {} { Expression() ";" { return jjtThis; } } /** An Expression. */ void Expression() : {} { AdditiveExpression() } /** An Additive Expression. */ void AdditiveExpression() : {} { ( MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* ) #Add(>1) } /** A Multiplicative Expression. */ void MultiplicativeExpression() : {} { ( UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* ) #Mult(>1) } /** A Unary Expression. */ void UnaryExpression() : {} { "(" Expression() ")" | Identifier() | Integer() } /** An Identifier. */ void Identifier() #MyID : { Token t; } { t= { jjtThis.setName(t.image); } } /** An Integer. */ void Integer() #Integer : {} { } javacc-5.0.orig/examples/JJTreeExamples/eg4.jjt0000644000175000017500000000706010604730310020355 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { MULTI=true; VISITOR=true; NODE_DEFAULT_VOID=true; } PARSER_BEGIN(Eg4) /** An Arithmetic Grammar. */ public class Eg4 { /** Main entry point. */ public static void main(String args[]) { System.out.println("Reading from standard input..."); Eg4 t = new Eg4(System.in); try { ASTStart n = t.Start(); Eg4Visitor v = new Eg4DumpVisitor(); n.jjtAccept(v, null); System.out.println("Thank you."); } catch (Exception e) { System.out.println("Oops."); System.out.println(e.getMessage()); e.printStackTrace(); } } } PARSER_END(Eg4) SKIP : { " " | "\t" | "\n" | "\r" | <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> | <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: ["_","a"-"z","A"-"Z"] > | < #DIGIT: ["0"-"9"] > } /** Main production. */ ASTStart Start() #Start : {} { Expression() ";" { return jjtThis; } } /** An Expression. */ void Expression() : {} { AdditiveExpression() } /** An Additive Expression. */ void AdditiveExpression() : {} { ( MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* ) #Add(>1) } /** A Multiplicative Expression. */ void MultiplicativeExpression() : {} { ( UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* ) #Mult(>1) } /** A Unary Expression. */ void UnaryExpression() : {} { "(" Expression() ")" | Identifier() | Integer() } /** An Identifier. */ void Identifier() #MyOtherID : { Token t; } { t= { jjtThis.setName(t.image); } } /** An Integer. */ void Integer() #Integer : {} { } javacc-5.0.orig/examples/JavaGrammars/0000755000175000017500000000000011247044051016717 5ustar mkochmkochjavacc-5.0.orig/examples/JavaGrammars/OPTIMIZING0000644000175000017500000002232410535127037020343 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This file describes in a step by step manner how you can modify the lookaheads in your grammar to optimize for space in the generated parser. This is only necessary until JavaCC is improved to do this optimization automatically (at which time, we will delete this file). 1. How much space optimization can one expect? The optimizations that we show here gets rid of all methods in the generated parser which start with "jj_2" and "jj_3" respectively. So take a look at your generated parser and figure out how much space is occupied by these methods. When we performed this optimization on the Java grammar, we were able to decrease the size of the generated parser by more than 50%. 2. Why are "jj_2" and "jj_3" methods generated? These methods are generated to handle all lookaheads except the following: a. A syntactic lookahead of 1 (the most common situation). b. For any amount of syntactic lookahead - when the target expansion can match the empty string. c. When the syntactic lookahead is 0. Typically there is only semantic lookahead this situation. The "jj_2" and "jj_3" methods are also generated for lookaheads in the (a) and (b) categories above when hoisting of semantic predicates is required. 3. Summary of how we achieve the optimization: Essentially, we go through the entire grammar looking for choice points that are not one of (a), (b), or (c) above. We then replace the lookaheads at these points with one of kind (c) above. When we do this, JavaCC generates a parser where all the new semantic lookaheads causes hoisting which affect other related choice points and cause the "jj_2" and "jj_3" methods to be generated there. So the final step is to locate these related choice points and insert explicit lookahead specifications here to prevent hoisting from taking place. 4. When is a grammar amenable to such optimization? If the majority of the choice points in your grammar use lookaheads that fall into the categories (a), (b), or (c) above then go for it. Otherwise, you'll be spending too much work and essentially rewriting the entire parser. It took a few hours to optimize the Java grammar. But I would not recommend doing it for C++ (for C++, just wait for JavaCC to be upgraded to do it automatically). 5. Step by step instructions: Suppose your grammar file is called Grammar.jj. You are going to go through two steps - in the first step, you create Grammar1.jj, and in the second step you create the final grammar file - Grammar2.jj. Lets also assume that the parsers generated from these grammar files are Grammar.java, Grammar1.java, and Grammar2.java respectively. STEP 1: For every lookahead in your grammar that does not fit into categories (a), (b), or (c) above, replace it with an equivalent semantic lookahead. When you're done with all such replacements, the resulting file is Grammar1.jj. Example: In the Java1.1.jj grammar, we have the following production for Name: void Name() : {} { ( LOOKAHEAD(2) "." )* } It uses a lookahead of 2 - obviously this means that the choice selection succeeds only if the next two characters are a "." and an . The following modification replaces the syntactic lookahead with a semantic lookahead: void Name() : {} { ( LOOKAHEAD( { getToken(1).kind == DOT && getToken(2).kind == IDENTIFIER } ) "." )* } STEP 2: Run JavaCC on both Grammar.jj and Grammar1.jj to obtain Grammar.java and Grammar1.java. Remember, the goal is to get rid of "jj_2" and "jj_3" methods from the grammar. Changes are you will see a bunch of "jj_2" and "jj_3" methods in Grammar1.java. We need to focus only on the "jj_2" methods. When these methods are removed, the "jj_3" methods automatically go away too. In the Java grammar, we found 23 "jj_2" methods to get rid of in this step. Search for calls to "jj_2" methods in Grammar1.java. Locate the corresponding portions in Grammar1.jj (the choice points in the grammar corresponding to these calls). These calls are there to perform hoisting (which you don't want - you don't need to understand hoisting to perform this step). Now look for corresponding locations in Grammar.java. You will see references to a token mask array instead of a "jj_2" call at these locations. Take a look at the value of the token mask array. Use these values to create a new lookahead for this choice point to get rid of the "jj_2" call. The resulting grammar (Grammar2.jj) is the grammar you want. Obviously, we need an example: The Java parser generated after performing step 1 has the following method with a call to a "jj_2" method ("jj_2_3"): static final public void UnmodifiedInterfaceDeclaration() throws ParseException { jj_consume_token(INTERFACE); jj_consume_token(IDENTIFIER); if (jj_mask_29[getToken(1).kind]) { jj_consume_token(EXTENDS); NameList(); } else { jj_expLA1[29] = jj_gen; ; } jj_consume_token(LBRACE); label_8: while (true) { if (jj_2_3(1)) { ; } else { break label_8; } InterfaceMemberDeclaration(); } jj_consume_token(RBRACE); } The corresponding location in the Java grammar is: void UnmodifiedInterfaceDeclaration() : {} { "interface" [ "extends" NameList() ] "{" ( // <-- the choice point InterfaceMemberDeclaration() )* "}" } The choice point corresponding to the call to "jj_2_3" above is marked by the arrow. Now lets take a look at the parser generated from the original Java grammar. The above method is shown below: static final public void UnmodifiedInterfaceDeclaration() throws ParseException { jj_consume_token(INTERFACE); jj_consume_token(IDENTIFIER); if (jj_mask_40[getToken(1).kind]) { jj_consume_token(EXTENDS); NameList(); } else { jj_expLA1[40] = jj_gen; ; } jj_consume_token(LBRACE); label_9: while (true) { if (jj_mask_41[getToken(1).kind]) { ; } else { jj_expLA1[41] = jj_gen; break label_9; } InterfaceMemberDeclaration(); } jj_consume_token(RBRACE); } Instead of the call to "jj_2_3", there is a reference to the token mask array "jj_mask_41". Now take a look at the initialization of "jj_mask_41" that occurs a few lines further on: static boolean[] jj_mask_41 = new boolean[120]; static { jj_mask_41[ABSTRACT] = jj_mask_41[BOOLEAN] = jj_mask_41[BYTE] = jj_mask_41[CHAR] = jj_mask_41[CLASS] = jj_mask_41[DOUBLE] = jj_mask_41[FINAL] = jj_mask_41[FLOAT] = jj_mask_41[INT] = jj_mask_41[INTERFACE] = jj_mask_41[LONG] = jj_mask_41[NATIVE] = jj_mask_41[PRIVATE] = jj_mask_41[PROTECTED] = jj_mask_41[PUBLIC] = jj_mask_41[SHORT] = jj_mask_41[STATIC] = jj_mask_41[SYNCHRONIZED] = jj_mask_41[TRANSIENT] = jj_mask_41[VOID] = jj_mask_41[VOLATILE] = jj_mask_41[IDENTIFIER] = true; } This defines the tokens that must be matched at the choice point in order for that choice point to succeed. Use this to explicitly insert a lookahead specification into the grammar to prevent the hoisting of semantic predicates. Hence the resulting production in the final grammar is: void UnmodifiedInterfaceDeclaration() : {} { "interface" [ "extends" NameList() ] "{" ( LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | ) InterfaceMemberDeclaration() )* "}" } javacc-5.0.orig/examples/JavaGrammars/1.5/0000755000175000017500000000000011247044052017223 5ustar mkochmkochjavacc-5.0.orig/examples/JavaGrammars/1.5/MyToken.java0000644000175000017500000000064211054064607021462 0ustar mkochmkochpublic class MyToken extends Token { /** * Constructs a new token for the specified Image and Kind. */ public MyToken(int kind, String image) { this.kind = kind; this.image = image; } int realKind = JavaParserConstants.GT; /** * Returns a new Token object. */ public static final Token newToken(int ofKind, String tokenImage) { return new MyToken(ofKind, tokenImage); } } javacc-5.0.orig/examples/JavaGrammars/1.5/JavaGenerics.java0000644000175000017500000000027711054064607022441 0ustar mkochmkochimport java.util.*; public class JavaGenerics { private Map map; public void jriat() { int i = 1 >>> 4; int j = 1 >> 4; boolean b = 1 > 4; } } javacc-5.0.orig/examples/JavaGrammars/1.5/Java1.5.jj0000644000175000017500000012510111054064607020661 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { JAVA_UNICODE_ESCAPE = true; ERROR_REPORTING = false; STATIC = false; COMMON_TOKEN_ACTION = false; TOKEN_FACTORY = "MyToken"; JDK_VERSION = "1.5"; } PARSER_BEGIN(JavaParser) import java.io.*; /** * Grammar to parse Java version 1.5 * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5 */ public class JavaParser { /** * Class to hold modifiers. */ static public final class ModifierSet { /* Definitions of the bits in the modifiers field. */ public static final int PUBLIC = 0x0001; public static final int PROTECTED = 0x0002; public static final int PRIVATE = 0x0004; public static final int ABSTRACT = 0x0008; public static final int STATIC = 0x0010; public static final int FINAL = 0x0020; public static final int SYNCHRONIZED = 0x0040; public static final int NATIVE = 0x0080; public static final int TRANSIENT = 0x0100; public static final int VOLATILE = 0x0200; public static final int STRICTFP = 0x1000; /** A set of accessors that indicate whether the specified modifier is in the set. */ public boolean isPublic(int modifiers) { return (modifiers & PUBLIC) != 0; } public boolean isProtected(int modifiers) { return (modifiers & PROTECTED) != 0; } public boolean isPrivate(int modifiers) { return (modifiers & PRIVATE) != 0; } public boolean isStatic(int modifiers) { return (modifiers & STATIC) != 0; } public boolean isAbstract(int modifiers) { return (modifiers & ABSTRACT) != 0; } public boolean isFinal(int modifiers) { return (modifiers & FINAL) != 0; } public boolean isNative(int modifiers) { return (modifiers & NATIVE) != 0; } public boolean isStrictfp(int modifiers) { return (modifiers & STRICTFP) != 0; } public boolean isSynchronized(int modifiers) { return (modifiers & SYNCHRONIZED) != 0; } public boolean isTransient(int modifiers) { return (modifiers & TRANSIENT) != 0; } public boolean isVolatile(int modifiers) { return (modifiers & VOLATILE) != 0; } /** * Removes the given modifier. */ static int removeModifier(int modifiers, int mod) { return modifiers & ~mod; } } public JavaParser(String fileName) { this(System.in); try { ReInit(new FileInputStream(new File(fileName))); } catch(Exception e) { e.printStackTrace(); } } public static void main(String args[]) { JavaParser parser; if (args.length == 0) { System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); parser = new JavaParser(System.in); } else if (args.length == 1) { System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); try { parser = new JavaParser(new java.io.FileInputStream(args[0])); } catch (java.io.FileNotFoundException e) { System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); return; } } else { System.out.println("Java Parser Version 1.1: Usage is one of:"); System.out.println(" java JavaParser < inputfile"); System.out.println("OR"); System.out.println(" java JavaParser inputfile"); return; } try { parser.CompilationUnit(); System.out.println("Java Parser Version 1.1: Java program parsed successfully."); } catch (ParseException e) { System.out.println(e.getMessage()); System.out.println("Java Parser Version 1.1: Encountered errors during parse."); } } } PARSER_END(JavaParser) /* WHITE SPACE */ SKIP : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ MORE : { <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < ASSERT: "assert" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < ENUM: "enum" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < STRICTFP: "strictfp" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: | > | < #DECIMAL_FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < #HEXADECIMAL_FLOATING_POINT_LITERAL: "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? (["f","F","d","D"])? | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ (["f","F","d","D"])? > | < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: ()* > | < #LETTER: [ // all chars for which Character.isIdentifierStart is true "$", "A"-"Z", "_", "a"-"z", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u064a", "\u0671"-"\u06d3", "\u06d5", "\u06e5"-"\u06e6", "\u06fa"-"\u06fc", "\u0710", "\u0712"-"\u072c", "\u0780"-"\u07a5", "\u0905"-"\u0939", "\u093d", "\u0950", "\u0958"-"\u0961", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09dc"-"\u09dd", "\u09df"-"\u09e1", "\u09f0"-"\u09f3", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a72"-"\u0a74", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abd", "\u0ad0", "\u0ae0", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3d", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c60"-"\u0c61", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cde", "\u0ce0"-"\u0ce1", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d60"-"\u0d61", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0e01"-"\u0e30", "\u0e32"-"\u0e33", "\u0e3f"-"\u0e46", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb0", "\u0eb2"-"\u0eb3", "\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0edc"-"\u0edd", "\u0f00", "\u0f40"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f88"-"\u0f8b", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u1050"-"\u1055", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17b3", "\u17db", "\u1820"-"\u1877", "\u1880"-"\u18a8", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u203f"-"\u2040", "\u207f", "\u20a0"-"\u20af", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u3029", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d", "\ufb1f"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\uff04", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6" ] > | < #PART_LETTER: [ // all chars for which Character.isIdentifierPart is true "\u0000"-"\u0008", "\u000e"-"\u001b", "$", "0"-"9", "A"-"Z", "_", "a"-"z", "\u007f"-"\u009f", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u0300"-"\u034e", "\u0360"-"\u0362", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u0483"-"\u0486", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u0591"-"\u05a1", "\u05a3"-"\u05b9", "\u05bb"-"\u05bd", "\u05bf", "\u05c1"-"\u05c2", "\u05c4", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u0655", "\u0660"-"\u0669", "\u0670"-"\u06d3", "\u06d5"-"\u06dc", "\u06df"-"\u06e8", "\u06ea"-"\u06ed", "\u06f0"-"\u06fc", "\u070f"-"\u072c", "\u0730"-"\u074a", "\u0780"-"\u07b0", "\u0901"-"\u0903", "\u0905"-"\u0939", "\u093c"-"\u094d", "\u0950"-"\u0954", "\u0958"-"\u0963", "\u0966"-"\u096f", "\u0981"-"\u0983", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09bc", "\u09be"-"\u09c4", "\u09c7"-"\u09c8", "\u09cb"-"\u09cd", "\u09d7", "\u09dc"-"\u09dd", "\u09df"-"\u09e3", "\u09e6"-"\u09f3", "\u0a02", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a3c", "\u0a3e"-"\u0a42", "\u0a47"-"\u0a48", "\u0a4b"-"\u0a4d", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a66"-"\u0a74", "\u0a81"-"\u0a83", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abc"-"\u0ac5", "\u0ac7"-"\u0ac9", "\u0acb"-"\u0acd", "\u0ad0", "\u0ae0", "\u0ae6"-"\u0aef", "\u0b01"-"\u0b03", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3c"-"\u0b43", "\u0b47"-"\u0b48", "\u0b4b"-"\u0b4d", "\u0b56"-"\u0b57", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b66"-"\u0b6f", "\u0b82"-"\u0b83", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0bbe"-"\u0bc2", "\u0bc6"-"\u0bc8", "\u0bca"-"\u0bcd", "\u0bd7", "\u0be7"-"\u0bef", "\u0c01"-"\u0c03", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c3e"-"\u0c44", "\u0c46"-"\u0c48", "\u0c4a"-"\u0c4d", "\u0c55"-"\u0c56", "\u0c60"-"\u0c61", "\u0c66"-"\u0c6f", "\u0c82"-"\u0c83", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cbe"-"\u0cc4", "\u0cc6"-"\u0cc8", "\u0cca"-"\u0ccd", "\u0cd5"-"\u0cd6", "\u0cde", "\u0ce0"-"\u0ce1", "\u0ce6"-"\u0cef", "\u0d02"-"\u0d03", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d3e"-"\u0d43", "\u0d46"-"\u0d48", "\u0d4a"-"\u0d4d", "\u0d57", "\u0d60"-"\u0d61", "\u0d66"-"\u0d6f", "\u0d82"-"\u0d83", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0dca", "\u0dcf"-"\u0dd4", "\u0dd6", "\u0dd8"-"\u0ddf", "\u0df2"-"\u0df3", "\u0e01"-"\u0e3a", "\u0e3f"-"\u0e4e", "\u0e50"-"\u0e59", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb9", "\u0ebb"-"\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0ec8"-"\u0ecd", "\u0ed0"-"\u0ed9", "\u0edc"-"\u0edd", "\u0f00", "\u0f18"-"\u0f19", "\u0f20"-"\u0f29", "\u0f35", "\u0f37", "\u0f39", "\u0f3e"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f71"-"\u0f84", "\u0f86"-"\u0f8b", "\u0f90"-"\u0f97", "\u0f99"-"\u0fbc", "\u0fc6", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u102c"-"\u1032", "\u1036"-"\u1039", "\u1040"-"\u1049", "\u1050"-"\u1059", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u1369"-"\u1371", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17d3", "\u17db", "\u17e0"-"\u17e9", "\u180b"-"\u180e", "\u1810"-"\u1819", "\u1820"-"\u1877", "\u1880"-"\u18a9", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u200c"-"\u200f", "\u202a"-"\u202e", "\u203f"-"\u2040", "\u206a"-"\u206f", "\u207f", "\u20a0"-"\u20af", "\u20d0"-"\u20dc", "\u20e1", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u302f", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u3099"-"\u309a", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe20"-"\ufe23", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\ufeff", "\uff04", "\uff10"-"\uff19", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6", "\ufff9"-"\ufffb" ] > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > | < AT: "@" > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > | < LSHIFT: "<<" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > | < LSHIFTASSIGN: "<<=" > | < RSIGNEDSHIFTASSIGN: ">>=" > | < RUNSIGNEDSHIFTASSIGN: ">>>=" > | < ELLIPSIS: "..." > } /* >'s need special attention due to generics syntax. */ TOKEN : { < RUNSIGNEDSHIFT: ">>>" > { matchedToken.kind = GT; ((MyToken)matchedToken).realKind = RUNSIGNEDSHIFT; input_stream.backup(2); matchedToken.image = ">"; } | < RSIGNEDSHIFT: ">>" > { matchedToken.kind = GT; ((MyToken)matchedToken).realKind = RSIGNEDSHIFT; input_stream.backup(1); matchedToken.image = ">"; } | < GT: ">" > } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ void CompilationUnit(): {} { [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ] ( ImportDeclaration() )* ( TypeDeclaration() )+ ( < "\u001a" > )? ( )? } void PackageDeclaration(): {} { Modifiers() "package" Name() ";" } void ImportDeclaration(): {} { "import" [ "static" ] Name() [ "." "*" ] ";" } /* * Modifiers. We match all modifiers in a single rule to reduce the chances of * syntax errors for simple modifier mistakes. It will also enable us to give * better error messages. */ int Modifiers(): { int modifiers = 0; } { ( LOOKAHEAD(2) ( "public" { modifiers |= ModifierSet.PUBLIC; } | "static" { modifiers |= ModifierSet.STATIC; } | "protected" { modifiers |= ModifierSet.PROTECTED; } | "private" { modifiers |= ModifierSet.PRIVATE; } | "final" { modifiers |= ModifierSet.FINAL; } | "abstract" { modifiers |= ModifierSet.ABSTRACT; } | "synchronized" { modifiers |= ModifierSet.SYNCHRONIZED; } | "native" { modifiers |= ModifierSet.NATIVE; } | "transient" { modifiers |= ModifierSet.TRANSIENT; } | "volatile" { modifiers |= ModifierSet.VOLATILE; } | "strictfp" { modifiers |= ModifierSet.STRICTFP; } | Annotation() ) )* { return modifiers; } } /* * Declaration syntax follows. */ void TypeDeclaration(): { int modifiers; } { ";" | modifiers = Modifiers() ( ClassOrInterfaceDeclaration(modifiers) | EnumDeclaration(modifiers) | AnnotationTypeDeclaration(modifiers) ) } void ClassOrInterfaceDeclaration(int modifiers): { boolean isInterface = false; } { ( "class" | "interface" { isInterface = true; } ) [ TypeParameters() ] [ ExtendsList(isInterface) ] [ ImplementsList(isInterface) ] ClassOrInterfaceBody(isInterface) } void ExtendsList(boolean isInterface): { boolean extendsMoreThanOne = false; } { "extends" ClassOrInterfaceType() ( "," ClassOrInterfaceType() { extendsMoreThanOne = true; } )* { if (extendsMoreThanOne && !isInterface) throw new ParseException("A class cannot extend more than one other class"); } } void ImplementsList(boolean isInterface): {} { "implements" ClassOrInterfaceType() ( "," ClassOrInterfaceType() )* { if (isInterface) throw new ParseException("An interface cannot implement other interfaces"); } } void EnumDeclaration(int modifiers): {} { "enum" [ ImplementsList(false) ] EnumBody() } void EnumBody(): {} { "{" [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ] [ "," ] [ ";" ( ClassOrInterfaceBodyDeclaration(false) )* ] "}" } void EnumConstant(): {} { Modifiers() [ Arguments() ] [ ClassOrInterfaceBody(false) ] } void TypeParameters(): {} { "<" TypeParameter() ( "," TypeParameter() )* ">" } void TypeParameter(): {} { [ TypeBound() ] } void TypeBound(): {} { "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )* } void ClassOrInterfaceBody(boolean isInterface): {} { "{" ( ClassOrInterfaceBodyDeclaration(isInterface) )* "}" } void ClassOrInterfaceBodyDeclaration(boolean isInterface): { boolean isNestedInterface = false; int modifiers; } { LOOKAHEAD(2) Initializer() { if (isInterface) throw new ParseException("An interface cannot have initializers"); } | modifiers = Modifiers() // Just get all the modifiers out of the way. If you want to do // more checks, pass the modifiers down to the member ( ClassOrInterfaceDeclaration(modifiers) | EnumDeclaration(modifiers) | LOOKAHEAD( [ TypeParameters() ] "(" ) ConstructorDeclaration() | LOOKAHEAD( Type() ( "[" "]" )* ( "," | "=" | ";" ) ) FieldDeclaration(modifiers) | MethodDeclaration(modifiers) | AnnotationTypeDeclaration(modifiers) ) | ";" } void FieldDeclaration(int modifiers): {} { // Modifiers are already matched in the caller Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator(): {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId(): {} { ( "[" "]" )* } void VariableInitializer(): {} { ArrayInitializer() | Expression() } void ArrayInitializer(): {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration(int modifiers): {} { // Modifiers already matched in the caller! [ TypeParameters() ] ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator(): {} { FormalParameters() ( "[" "]" )* } void FormalParameters(): {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter(): {} { // danson, added // [ "final" | Annotation() ] // See Java Language Specification, 3rd Edition, section 8.4.1 Modifiers() [ "final" | Annotation() ] Type() [ "..." ] VariableDeclaratorId() } void ConstructorDeclaration(): {} { [ TypeParameters() ] // Modifiers matched in the caller FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation(): {} { ( "." )* [ LOOKAHEAD(2) "this" "." ] [ TypeArguments() ] ("this"|"super") Arguments() ";" } void Initializer(): {} { [ "static" ] Block() } /* * Type, name and expression syntax follows. */ void Type(): {} { LOOKAHEAD(2) ReferenceType() | PrimitiveType() } void ReferenceType(): {} { PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+ | ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )* } void ClassOrInterfaceType(): {} { [ LOOKAHEAD(2) TypeArguments() ] ( LOOKAHEAD(2) "." [ LOOKAHEAD(2) TypeArguments() ] )* } void TypeArguments(): {} { "<" TypeArgument() ( "," TypeArgument() )* ">" } void TypeArgument(): {} { ReferenceType() | "?" [ WildcardBounds() ] } void WildcardBounds(): {} { "extends" ReferenceType() | "super" ReferenceType() } void PrimitiveType(): {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType(): {} { "void" | Type() } void Name(): /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ {} { ( LOOKAHEAD(2) "." )* } void NameList(): {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression(): /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ {} { ConditionalExpression() [ LOOKAHEAD(2) AssignmentOperator() Expression() ] } void AssignmentOperator(): {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression(): {} { ConditionalOrExpression() [ "?" Expression() ":" Expression() ] } void ConditionalOrExpression(): {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression(): {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression(): {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression(): {} { AndExpression() ( "^" AndExpression() )* } void AndExpression(): {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression(): {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression(): {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression(): {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression(): {} { AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )* } void AdditiveExpression(): {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression(): {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression(): {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression(): {} { "++" PrimaryExpression() } void PreDecrementExpression(): {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus(): {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead(): {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Type() "[") "(" Type() "[" "]" | "(" Type() ")" ( "~" | "!" | "(" | | "this" | "super" | "new" | Literal() ) } void PostfixExpression(): {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression(): {} { LOOKAHEAD("(" PrimitiveType()) "(" Type() ")" UnaryExpression() | "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression(): {} { PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* } void MemberSelector(): {} { "." TypeArguments() } void PrimaryPrefix(): {} { Literal() | LOOKAHEAD( ( "." )* "this" ) ( "." )* "this" | "super" "." | // danson, added this part to support a construct like: // Buffer.super.setDirty(true); // See Java Language Specification, 3rd edition, section 15.11.2. LOOKAHEAD( ClassOrInterfaceType() "." "super" "." ) ClassOrInterfaceType() "." "super" "." | "(" Expression() ")" | AllocationExpression() | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class" | Name() } void PrimarySuffix(): {} { LOOKAHEAD("." "super" ".") "." "super" | LOOKAHEAD("." "this") "." "this" | LOOKAHEAD(2) "." AllocationExpression() | LOOKAHEAD(3) MemberSelector() | "[" Expression() "]" | "." | Arguments() } void Literal(): {} { | | | | BooleanLiteral() | NullLiteral() } void BooleanLiteral(): {} { "true" | "false" } void NullLiteral(): {} { "null" } void Arguments(): {} { "(" [ ArgumentList() ] ")" } void ArgumentList(): {} { Expression() ( "," Expression() )* } void AllocationExpression(): {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimsAndInits() | "new" ClassOrInterfaceType() [ TypeArguments() ] ( ArrayDimsAndInits() | Arguments() [ ClassOrInterfaceBody(false) ] ) } /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimsAndInits(): {} { LOOKAHEAD(2) ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* | ( "[" "]" )+ ArrayInitializer() } /* * Statement syntax follows. */ void Statement(): {} { LOOKAHEAD(2) LabeledStatement() | AssertStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void AssertStatement(): {} { "assert" Expression() [ ":" Expression() ] ";" } void LabeledStatement(): {} { ":" Statement() } void Block(): {} { "{" ( BlockStatement() )* "}" } void BlockStatement(): {} { LOOKAHEAD( Modifiers() Type() ) LocalVariableDeclaration() ";" | Statement() | ClassOrInterfaceDeclaration(0) } void LocalVariableDeclaration(): {} { Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement(): {} { ";" } void StatementExpression(): /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ {} { PreIncrementExpression() | PreDecrementExpression() | PrimaryExpression() [ "++" | "--" | AssignmentOperator() Expression() ] } void SwitchStatement(): {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel(): {} { "case" Expression() ":" | "default" ":" } void IfStatement(): /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement(): {} { "while" "(" Expression() ")" Statement() } void DoStatement(): {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement(): {} { "for" "(" ( LOOKAHEAD(Modifiers() Type() ":") Modifiers() Type() ":" Expression() | [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ) ")" Statement() } void ForInit(): {} { LOOKAHEAD( Modifiers() Type() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList(): {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate(): {} { StatementExpressionList() } void BreakStatement(): {} { "break" [ ] ";" } void ContinueStatement(): {} { "continue" [ ] ";" } void ReturnStatement(): {} { "return" [ Expression() ] ";" } void ThrowStatement(): {} { "throw" Expression() ";" } void SynchronizedStatement(): {} { "synchronized" "(" Expression() ")" Block() } void TryStatement(): /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } /* We use productions to match >>>, >> and > so that we can keep the * type declaration syntax with generics clean */ void RUNSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((MyToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) ">" ">" ">" ) } void RSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((MyToken)getToken(1)).realKind == RSIGNEDSHIFT} ) ">" ">" ) } /* Annotation syntax follows. */ void Annotation(): {} { LOOKAHEAD( "@" Name() "(" ( "=" | ")" )) NormalAnnotation() | LOOKAHEAD( "@" Name() "(" ) SingleMemberAnnotation() | MarkerAnnotation() } void NormalAnnotation(): {} { "@" Name() "(" [ MemberValuePairs() ] ")" } void MarkerAnnotation(): {} { "@" Name() } void SingleMemberAnnotation(): {} { "@" Name() "(" MemberValue() ")" } void MemberValuePairs(): {} { MemberValuePair() ( "," MemberValuePair() )* } void MemberValuePair(): {} { "=" MemberValue() } void MemberValue(): {} { Annotation() | MemberValueArrayInitializer() | ConditionalExpression() } void MemberValueArrayInitializer(): {} { "{" (MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ])? "}" } /* Annotation Types. */ void AnnotationTypeDeclaration(int modifiers): {} { "@" "interface" AnnotationTypeBody() } void AnnotationTypeBody(): {} { "{" ( AnnotationTypeMemberDeclaration() )* "}" } void AnnotationTypeMemberDeclaration(): { int modifiers; } { modifiers = Modifiers() ( LOOKAHEAD(Type() "(") Type() "(" ")" [ DefaultValue() ] ";" | ClassOrInterfaceDeclaration(modifiers) | EnumDeclaration(modifiers) | AnnotationTypeDeclaration(modifiers) | FieldDeclaration(modifiers) ) | ( ";" ) } void DefaultValue(): {} { "default" MemberValue() } javacc-5.0.orig/examples/JavaGrammars/1.5/Main.java0000644000175000017500000000227610234737074020771 0ustar mkochmkochimport java.io.*; class Main { private static int parseFilesFromFileList(String fileName) { LineNumberReader str = null; int cnt = 0; try { str = new LineNumberReader(new FileReader(new File(fileName)) ); String s; while ((s = str.readLine()) != null) { try { cnt++; System.out.println("Parsing: " + s); new JavaParser(s).CompilationUnit(); } catch(ParseException e) { e.printStackTrace(); } catch(TokenMgrError tme) { tme.printStackTrace(); } } } catch(Exception e) { e.printStackTrace(); } finally { if (str != null) try { str.close(); } catch(Exception e) {} } return cnt; } public static void main(String[] args) throws Throwable { int cnt = 1; long l = System.currentTimeMillis(); JavaParser parser; if (args[0].charAt(0) == '@') { cnt = parseFilesFromFileList(args[0].substring(1)); } else { JavaParser.main(args); } System.out.println("Parsed " + cnt + " files in: " + (System.currentTimeMillis() - l)); } } javacc-5.0.orig/examples/JavaGrammars/1.5/README0000644000175000017500000000136207773417032020120 0ustar mkochmkoch This directory contains the JavaCC grammar for parsing (the proposed) JDK 1.5 Java language syntax. It handles generics, new for loops, static imports and annotation types. BUILDING -------- Just run ant in this directory and it will build the parser. RUNNING ------- You can run the parser directly using java JavaParser or there is a new Main class that accepts @ where the file with contains list of files one per line: java Main @ REPORTING BUGS -------------- If you find bugs in the grammar, please file an issue at javacc.dev.java.net, by logging in and clicking on the 'Issue Tracking' link on the navigation bar on the left side. You can also send email to: sreeni@viswanadha.net. javacc-5.0.orig/examples/JavaGrammars/1.5/build.xml0000644000175000017500000000376111054064610021051 0ustar mkochmkoch javacc-5.0.orig/examples/JavaGrammars/1.5/Test.java0000644000175000017500000000061710111515250021001 0ustar mkochmkochimport java.io.*; class Test { public static void main(String[] args) throws Exception { Reader fr = null; if (args.length == 2) fr = new InputStreamReader(new FileInputStream(new File(args[0])), args[1]); else fr = new InputStreamReader(new FileInputStream(new File(args[0]))); JavaParser jp = new JavaParser(fr); jp.CompilationUnit(); } } javacc-5.0.orig/examples/JavaGrammars/README0000644000175000017500000000614210535127037017607 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This directory contains a bunch of Java grammars: Java1.0.2.jj: This is our most thoroughly tested Java grammar. It is a faithful rendering of the language syntax as specified by the Java Language Specification by Gosling, Joy, and Steele. Java.1.0.2LS.jj: This is a minor modification of Java1.0.2.jj which uses lexical states to express the comment tokens. While this is a cleaner grammar, it has not been tested as thoroughly as the previous grammar. Over time, we will make this grammar our primary grammar and delete Java1.0.2.jj. Java1.1.jj: This is the grammar that includes the Java 1.1 language extensions. It is based on the Java Language Specification by Gosling, Joy, and Steele augmented by the inner class document released with JDK 1.1. Java1.1noLA.jj: Same as Java1.1.jj, but all explicit syntactic lookaheads are replaced by semantic lookaheads to minimize the space requirements of the generated parser. To do the same kind of optimization for your grammar, please see file OPTIMIZING in this directory. To build a parser from a .jj file, simply type: "javacc " in this directory. The files that comprise the Java parser are generated into this directory. Compile these files using "javac". JavaParser.java contains a main program that takes input from either the standard input or from the file specified as the argument to "java". i.e., A Java program can be parser in either of the following ways: java JavaParser < javafile java JavaParser javafile javacc-5.0.orig/examples/JavaGrammars/Java1.1noLA.jj0000644000175000017500000010471110535127037021130 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { JAVA_UNICODE_ESCAPE = true; } PARSER_BEGIN(JavaParser) public class JavaParser { public static void main(String args[]) { JavaParser parser; if (args.length == 0) { System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); parser = new JavaParser(System.in); } else if (args.length == 1) { System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); try { parser = new JavaParser(new java.io.FileInputStream(args[0])); } catch (java.io.FileNotFoundException e) { System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); return; } } else { System.out.println("Java Parser Version 1.1: Usage is one of:"); System.out.println(" java JavaParser < inputfile"); System.out.println("OR"); System.out.println(" java JavaParser inputfile"); return; } try { parser.CompilationUnit(); System.out.println("Java Parser Version 1.1: Java program parsed successfully."); } catch (ParseException e) { System.out.println(e.getMessage()); System.out.println("Java Parser Version 1.1: Encountered errors during parse."); } } // Semantic lookahead rules follow. // implements: LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" ) static boolean isClassDeclaration() { int curTok = 1; Token tok; while (true) { tok = getToken(curTok); switch (tok.kind) { case ABSTRACT: case FINAL: case PUBLIC: curTok++; break; case CLASS: return true; default: return false; } } } // implements: LOOKAHEAD(2) for Initializer() static boolean isInitializer() { Token tok = getToken(1); if (tok.kind == LBRACE) return true; if (tok.kind == STATIC) { tok = getToken(2); if (tok.kind == LBRACE) return true; } return false; } // implements: LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) static boolean isNestedClassDeclaration() { int curTok = 1; Token tok; while (true) { tok = getToken(curTok); switch (tok.kind) { case STATIC: case ABSTRACT: case FINAL: case PUBLIC: case PROTECTED: case PRIVATE: curTok++; break; case CLASS: return true; default: return false; } } } // implements: LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) static boolean isNestedInterfaceDeclaration() { int curTok = 1; Token tok; while (true) { tok = getToken(curTok); switch (tok.kind) { case STATIC: case ABSTRACT: case FINAL: case PUBLIC: case PROTECTED: case PRIVATE: curTok++; break; case INTERFACE: return true; default: return false; } } } // implements: LOOKAHEAD( [ "public" | "protected" | "private" ] Name() "(" ) static boolean isConstructorDeclaration() { int curTok = 1; Token tok; tok = getToken(1); switch (tok.kind) { case PUBLIC: case PROTECTED: case PRIVATE: curTok = 2; } tok = getToken(curTok++); if (tok.kind != IDENTIFIER) return false; while (true) { tok = getToken(curTok++); if (tok.kind == LPAREN) return true; if (tok.kind != DOT) return false; tok = getToken(curTok++); if (tok.kind != IDENTIFIER) return false; } } // Returns true if the next set of tokens cannot be a field declaration. // Returns false if the next set of tokens cannot be a method declaration. // Note how this method is used in the grammar. We don't have to do a // comprehensive check like we have done in the lookahead methods above. // This show (therefore) another way you can implement lookahead methods. // The way we do it is to see if we can find a "(" before either a "=" or // a ";", in which case we return true. static boolean isMethodDeclaration() { int curTok = 1; Token tok; while (true) { tok = getToken(curTok++); switch (tok.kind) { case LPAREN: return true; case ASSIGN: case SEMICOLON: case EOF: return false; } } } // Checks that there is a "," and then there is no "}" following that. static boolean moreVariableInitializers() { return getToken(1).kind == COMMA && getToken(2).kind != RBRACE; } // Checks that this is a constructor invocation as opposed to a block // statement. static boolean isConstructorInvocation() { int curTok = 1; Token tok = getToken(1); switch (tok.kind) { case THIS: case SUPER: // We are assuming here that if the statement starts with "this" // or "super", and the next token is "(", then it has to be a // constructor invocation. return getToken(2).kind == LPAREN; case STRING_LITERAL: case LPAREN: case NEW: case IDENTIFIER: // Now move across tokens until the end of the statement - the // first semicolon not nested within any kind of parentheses. // If a "super(" is matched also not nested and before this // semicolon, we return true. Otherwise return false. int nestingLevel = 0; while (true) { tok = getToken(curTok++); switch (tok.kind) { case SEMICOLON: if (nestingLevel == 0) { return false; } break; case SUPER: if (nestingLevel == 0) { return getToken(curTok).kind == LPAREN; } break; case LPAREN: case LBRACE: case LBRACKET: nestingLevel++; break; case RPAREN: case RBRACE: case RBRACKET: nestingLevel--; break; case EOF: return false; } } default: return false; } } // Returns true if this is a primitive type (or an array of primitive // type) cast. static boolean isPrimitiveTypeCast() { if (getToken(1).kind != LPAREN) return false; Token tok = getToken(2); switch (tok.kind) { case BOOLEAN: case CHAR: case BYTE: case SHORT: case INT: case LONG: case FLOAT: case DOUBLE: return true; } return false; } // Returns true if this is a type cast. static boolean isTypeCast() { if (isPrimitiveTypeCast()) return true; if (getToken(1).kind != LPAREN) return false; int curTok = 2; Token tok = getToken(curTok++); if (tok.kind != IDENTIFIER) return false; while (true) { tok = getToken(curTok++); if (tok.kind != DOT) break; tok = getToken(curTok++); if (tok.kind != IDENTIFIER) return false; } if (tok.kind == RPAREN) { tok = getToken(curTok); switch (tok.kind) { case TILDE: case BANG: case LPAREN: case IDENTIFIER: case THIS: case SUPER: case NEW: case INTEGER_LITERAL: case FLOATING_POINT_LITERAL: case CHARACTER_LITERAL: case STRING_LITERAL: case TRUE: case FALSE: case NULL: return true; } return false; } else { if (tok.kind != LBRACKET) return false; tok = getToken(curTok); if (tok.kind != RBRACKET) return false; return true; } } // Distinguishes between ClassSelector and Name. static boolean isClassSelector() { int curTok = 1; Token tok = getToken(curTok++); if (tok.kind != IDENTIFIER) return true; while (true) { tok = getToken(curTok++); while (tok.kind == LBRACKET) { // A simple loop to accept "[]"s. We are a little sloppy // in that we don't require it to be at the end, but then // this is only a lookahead check. tok = getToken(curTok++); if (tok.kind != RBRACKET) return false; tok = getToken(curTok++); } if (tok.kind != DOT) return false; tok = getToken(curTok++); if (tok.kind == CLASS) return true; if (tok.kind != IDENTIFIER) return false; } } // implements: LOOKAHEAD([ "final" ] Type() ) static boolean isLocalVariableDeclaration() { int curTok = 1; Token tok = getToken(curTok++); if (tok.kind == FINAL) tok = getToken(curTok++); switch (tok.kind) { case BOOLEAN: case CHAR: case BYTE: case SHORT: case INT: case LONG: case FLOAT: case DOUBLE: tok = getToken(curTok++); break; case IDENTIFIER: while (true) { tok = getToken(curTok++); if (tok.kind != DOT) break; tok = getToken(curTok++); if (tok.kind != IDENTIFIER) return false; } break; default: return false; } while (tok.kind == LBRACKET) { tok = getToken(curTok++); if (tok.kind != RBRACKET) return false; tok = getToken(curTok++); } return tok.kind == IDENTIFIER; } static boolean isPrimarySuffix() { Token tok = getToken(1); if (tok.kind == LPAREN || tok.kind == LBRACKET) return true; if (tok.kind == DOT) { tok = getToken(2); switch (tok.kind) { case THIS: case NEW: case IDENTIFIER: return true; } } return false; } } PARSER_END(JavaParser) /* WHITE SPACE */ SKIP : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > | < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > | < LSHIFT: "<<" > | < RSIGNEDSHIFT: ">>" > | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > | < LSHIFTASSIGN: "<<=" > | < RSIGNEDSHIFTASSIGN: ">>=" > | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ void CompilationUnit() : {} { [ PackageDeclaration() ] ( ImportDeclaration() )* ( LOOKAHEAD(1, | | | | | ) TypeDeclaration() )* } void PackageDeclaration() : {} { "package" Name() ";" } void ImportDeclaration() : {} { "import" Name() [ "." "*" ] ";" } void TypeDeclaration() : {} { LOOKAHEAD( { isClassDeclaration() } ) ClassDeclaration() | InterfaceDeclaration() | ";" } /* * Declaration syntax follows. */ void ClassDeclaration() : {} { ( "abstract" | "final" | "public" )* UnmodifiedClassDeclaration() } void UnmodifiedClassDeclaration() : {} { "class" [ "extends" Name() ] [ "implements" NameList() ] ClassBody() } void ClassBody() : {} { "{" ( LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | ) ClassBodyDeclaration() )* "}" } void NestedClassDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedClassDeclaration() } void ClassBodyDeclaration() : {} { LOOKAHEAD( { isInitializer() } ) Initializer() | LOOKAHEAD( { isNestedClassDeclaration() } ) NestedClassDeclaration() | LOOKAHEAD( { isNestedInterfaceDeclaration() } ) NestedInterfaceDeclaration() | LOOKAHEAD( { isConstructorDeclaration() } ) ConstructorDeclaration() | LOOKAHEAD( { isMethodDeclaration() } ) MethodDeclaration() | FieldDeclaration() } void InterfaceDeclaration() : {} { ( "abstract" | "public" )* UnmodifiedInterfaceDeclaration() } void NestedInterfaceDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedInterfaceDeclaration() } void UnmodifiedInterfaceDeclaration() : {} { "interface" [ "extends" NameList() ] "{" ( LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | ) InterfaceMemberDeclaration() )* "}" } void InterfaceMemberDeclaration() : {} { LOOKAHEAD( { isNestedClassDeclaration() } ) NestedClassDeclaration() | LOOKAHEAD( { isNestedInterfaceDeclaration() } ) NestedInterfaceDeclaration() | LOOKAHEAD( { isMethodDeclaration() } ) MethodDeclaration() | FieldDeclaration() } void FieldDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" )* Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator() : {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId() : {} { ( "[" "]" )* } void VariableInitializer() : {} { ArrayInitializer() | LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | | | | ) Expression() } void ArrayInitializer() : {} { "{" [ LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | | | | | ) VariableInitializer() ( LOOKAHEAD( { getToken(1).kind == COMMA && getToken(2).kind != RBRACE } ) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator() : {} { FormalParameters() ( "[" "]" )* } void FormalParameters() : {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter() : {} { [ "final" ] Type() VariableDeclaratorId() } void ConstructorDeclaration() : {} { [ "public" | "protected" | "private" ] FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD( { isConstructorInvocation() } ) ExplicitConstructorInvocation() ] ( LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ) BlockStatement() )* "}" } void ExplicitConstructorInvocation() : {} { LOOKAHEAD( { getToken(1).kind == THIS && getToken(2).kind == LPAREN } ) "this" Arguments() ";" | LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | ) [ LOOKAHEAD( { getToken(1).kind != SUPER || getToken(2).kind != LPAREN } ) PrimaryExpression() "." ] "super" Arguments() ";" } void Initializer() : {} { [ "static" ] Block() } /* * Type, name and expression syntax follows. */ void Type() : {} { ( PrimitiveType() | Name() ) ( "[" "]" )* } void PrimitiveType() : {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { "void" | Type() } void Name() : {} { ( LOOKAHEAD( { getToken(1).kind == DOT && getToken(2).kind == IDENTIFIER } ) "." )* } void NameList() : {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ {} { ConditionalExpression() [ AssignmentOperator() Expression() ] } void AssignmentOperator() : {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression() : {} { ConditionalOrExpression() [ "?" Expression() ":" ConditionalExpression() ] } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^" AndExpression() )* } void AndExpression() : {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression() : {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression() : {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression() : {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression() : {} { AdditiveExpression() ( ( "<<" | ">>" | ">>>" ) AdditiveExpression() )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression() : {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression() : {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | ) UnaryExpressionNotPlusMinus() } void PreIncrementExpression() : {} { "++" PrimaryExpression() } void PreDecrementExpression() : {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus() : {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( { isTypeCast() } ) CastExpression() | LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | ) PostfixExpression() } void PostfixExpression() : {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression() : {} { LOOKAHEAD( { isPrimitiveTypeCast() } ) "(" Type() ")" UnaryExpression() | "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() : {} { PrimaryPrefix() ( LOOKAHEAD( { isPrimarySuffix() } ) PrimarySuffix() )* } void PrimaryPrefix() : {} { Literal() | "this" | "super" "." | "(" Expression() ")" | LOOKAHEAD(1, ) AllocationExpression() | LOOKAHEAD( { isClassSelector() } ) ResultType() "." "class" | Name() } void PrimarySuffix() : {} { LOOKAHEAD( { getToken(1).kind == DOT && getToken(2).kind == THIS } ) "." "this" | LOOKAHEAD( { getToken(1).kind == DOT && getToken(2).kind == NEW } ) "." AllocationExpression() | "[" Expression() "]" | "." | Arguments() } void Literal() : {} { | | | | BooleanLiteral() | NullLiteral() } void BooleanLiteral() : {} { "true" | "false" } void NullLiteral() : {} { "null" } void Arguments() : {} { "(" [ LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | | | | ) ArgumentList() ] ")" } void ArgumentList() : {} { Expression() ( "," Expression() )* } void AllocationExpression() : {} { LOOKAHEAD( { getToken(2).kind != IDENTIFIER } ) "new" PrimitiveType() ArrayDimsAndInits() | "new" Name() ( LOOKAHEAD(1, ) ArrayDimsAndInits() | Arguments() [ ClassBody() ] ) } /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimsAndInits() : {} { LOOKAHEAD( { getToken(2).kind != RBRACKET } ) ( LOOKAHEAD( { getToken(1).kind == LBRACKET && getToken(2).kind != RBRACKET } ) "[" Expression() "]" )+ ( LOOKAHEAD( { getToken(1).kind == LBRACKET && getToken(2).kind == RBRACKET } ) "[" "]" )* | ( "[" "]" )+ ArrayInitializer() } /* * Statement syntax follows. */ void Statement() : {} { LOOKAHEAD( { getToken(1).kind == IDENTIFIER && getToken(2).kind == COLON } ) LabeledStatement() | Block() | EmptyStatement() | LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | ) StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void LabeledStatement() : {} { ":" Statement() } void Block() : {} { "{" ( LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ) BlockStatement() )* "}" } void BlockStatement() : {} { LOOKAHEAD( { isLocalVariableDeclaration() } ) LocalVariableDeclaration() ";" | LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ) Statement() | UnmodifiedClassDeclaration() | UnmodifiedInterfaceDeclaration() } void LocalVariableDeclaration() : {} { [ "final" ] Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement() : {} { ";" } void StatementExpression() : /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ {} { PreIncrementExpression() | PreDecrementExpression() | LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | ) PrimaryExpression() [ "++" | "--" | AssignmentOperator() Expression() ] } void SwitchStatement() : {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ) BlockStatement() )* )* "}" } void SwitchLabel() : {} { "case" Expression() ":" | "default" ":" } void IfStatement() : /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void DoStatement() : {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement() : {} { "for" "(" [ LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | ) ForInit() ] ";" [ LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | | | | ) Expression() ] ";" [ LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | ) ForUpdate() ] ")" Statement() } void ForInit() : {} { LOOKAHEAD( { isLocalVariableDeclaration() } ) LocalVariableDeclaration() | LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | ) StatementExpressionList() } void StatementExpressionList() : {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate() : {} { StatementExpressionList() } void BreakStatement() : {} { "break" [ ] ";" } void ContinueStatement() : {} { "continue" [ ] ";" } void ReturnStatement() : {} { "return" [ LOOKAHEAD(1, | | | | | | | | | | | | | | | | | | | | | | | | | | ) Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement() : {} { "synchronized" "(" Expression() ")" Block() } void TryStatement() : /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } javacc-5.0.orig/examples/JavaGrammars/Test.java0000644000175000017500000000061710111515250020476 0ustar mkochmkochimport java.io.*; class Test { public static void main(String[] args) throws Exception { Reader fr = null; if (args.length == 2) fr = new InputStreamReader(new FileInputStream(new File(args[0])), args[1]); else fr = new InputStreamReader(new FileInputStream(new File(args[0]))); JavaParser jp = new JavaParser(fr); jp.CompilationUnit(); } } javacc-5.0.orig/examples/JavaGrammars/Java1.0.2.jj0000644000175000017500000004153110535127037020515 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { JAVA_UNICODE_ESCAPE = true; } PARSER_BEGIN(JavaParser) public class JavaParser { public static void main(String args[]) { JavaParser parser; if (args.length == 0) { System.out.println("Java Parser Version 1.0.2: Reading from standard input . . ."); parser = new JavaParser(System.in); } else if (args.length == 1) { System.out.println("Java Parser Version 1.0.2: Reading from file " + args[0] + " . . ."); try { parser = new JavaParser(new java.io.FileInputStream(args[0])); } catch (java.io.FileNotFoundException e) { System.out.println("Java Parser Version 1.0.2: File " + args[0] + " not found."); return; } } else { System.out.println("Java Parser Version 1.0.2: Usage is one of:"); System.out.println(" java JavaParser < inputfile"); System.out.println("OR"); System.out.println(" java JavaParser inputfile"); return; } try { parser.CompilationUnit(); System.out.println("Java Parser Version 1.0.2: Java program parsed successfully."); } catch (ParseException e) { System.out.println("Java Parser Version 1.0.2: Encountered errors during parse."); } } } PARSER_END(JavaParser) SKIP : /* WHITE SPACE */ { " " | "\t" | "\n" | "\r" | "\f" } SPECIAL_TOKEN : /* COMMENTS */ { | | } TOKEN : /* RESERVED WORDS AND LITERALS */ { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } TOKEN : /* SEPARATORS */ { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } TOKEN : /* OPERATORS */ { < ASSIGN: "=" > | < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > | < LSHIFT: "<<" > | < RSIGNEDSHIFT: ">>" > | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > | < LSHIFTASSIGN: "<<=" > | < RSIGNEDSHIFTASSIGN: ">>=" > | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ void CompilationUnit() : {} { [ PackageDeclaration() ] ( ImportDeclaration() )* ( TypeDeclaration() )* } void PackageDeclaration() : {} { "package" Name() ";" } void ImportDeclaration() : {} { "import" Name() [ "." "*" ] ";" } void TypeDeclaration() : {} { LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" ) ClassDeclaration() | InterfaceDeclaration() | ";" } /* * Declaration syntax follows. */ void ClassDeclaration() : {} { ( "abstract" | "final" | "public" )* "class" [ "extends" Name() ] [ "implements" NameList() ] "{" ( ClassBodyDeclaration() )* "}" } void ClassBodyDeclaration() : {} { LOOKAHEAD(2) StaticInitializer() | LOOKAHEAD( [ "public" | "protected" | "private" ] Name() "(" ) ConstructorDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } // This production is to determine lookahead only. void MethodDeclarationLookahead() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() "(" } void InterfaceDeclaration() : {} { ( "abstract" | "public" )* "interface" [ "extends" NameList() ] "{" ( InterfaceMemberDeclaration() )* "}" } void InterfaceMemberDeclaration() : {} { LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } void FieldDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" )* Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator() : {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId() : {} { ( "[" "]" )* } void VariableInitializer() : {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" | Expression() } void MethodDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator() : {} { FormalParameters() ( "[" "]" )* } void FormalParameters() : {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter() : {} { Type() VariableDeclaratorId() } void ConstructorDeclaration() : {} { [ "public" | "protected" | "private" ] FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(2) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation() : {} { "this" Arguments() ";" | "super" Arguments() ";" } void StaticInitializer() : {} { "static" Block() } /* * Type, name and expression syntax follows. */ void Type() : {} { ( PrimitiveType() | Name() ) ( "[" "]" )* } void PrimitiveType() : {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { "void" | Type() } void Name() : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ {} { ( LOOKAHEAD(2) "." )* } void NameList() : {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : {} { LOOKAHEAD( PrimaryExpression() AssignmentOperator() ) Assignment() | ConditionalExpression() } void Assignment() : {} { PrimaryExpression() AssignmentOperator() Expression() } void AssignmentOperator() : {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression() : {} { ConditionalOrExpression() [ "?" Expression() ":" ConditionalExpression() ] } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^" AndExpression() )* } void AndExpression() : {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression() : {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression() : {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression() : {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression() : {} { AdditiveExpression() ( ( "<<" | ">>" | ">>>" ) AdditiveExpression() )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression() : {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression() : {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression() : {} { "++" PrimaryExpression() } void PreDecrementExpression() : {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus() : {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead() : {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Name() "[") "(" Name() "[" "]" | "(" Name() ")" ( "~" | "!" | "(" | | "this" | "super" | "new" | Literal() ) } void PostfixExpression() : {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression() : {} { LOOKAHEAD(2) "(" PrimitiveType() ( "[" "]" )* ")" UnaryExpression() | "(" Name() ( "[" "]" )* ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() : {} { PrimaryPrefix() ( PrimarySuffix() )* } void PrimaryPrefix() : {} { Literal() | Name() | "this" | "super" "." | "(" Expression() ")" | AllocationExpression() } void PrimarySuffix() : {} { "[" Expression() "]" | "." | Arguments() } void Literal() : {} { | | | | BooleanLiteral() | NullLiteral() } void BooleanLiteral() : {} { "true" | "false" } void NullLiteral() : {} { "null" } void Arguments() : {} { "(" [ ArgumentList() ] ")" } void ArgumentList() : {} { Expression() ( "," Expression() )* } void AllocationExpression() : {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimensions() | "new" Name() ( Arguments() | ArrayDimensions() ) } /* * The second LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimensions() : {} { ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* } /* * Statement syntax follows. */ void Statement() : {} { LOOKAHEAD(2) LabeledStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void LabeledStatement() : {} { ":" Statement() } void Block() : {} { "{" ( BlockStatement() )* "}" } void BlockStatement() : {} { LOOKAHEAD(Type() ) LocalVariableDeclaration() ";" | Statement() } void LocalVariableDeclaration() : {} { Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement() : {} { ";" } void StatementExpression() : /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. */ {} { PreIncrementExpression() | PreDecrementExpression() | LOOKAHEAD( PrimaryExpression() AssignmentOperator() ) Assignment() | PostfixExpression() } void SwitchStatement() : {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel() : {} { "case" Expression() ":" | "default" ":" } void IfStatement() : /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void DoStatement() : {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement() : {} { "for" "(" [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ")" Statement() } void ForInit() : {} { LOOKAHEAD( Type() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList() : {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate() : {} { StatementExpressionList() } void BreakStatement() : {} { "break" [ ] ";" } void ContinueStatement() : {} { "continue" [ ] ";" } void ReturnStatement() : {} { "return" [ Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement() : {} { "synchronized" "(" Expression() ")" Block() } void TryStatement() : /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } javacc-5.0.orig/examples/JavaGrammars/Java1.0.2LS.jj0000644000175000017500000004215510535127037020757 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { JAVA_UNICODE_ESCAPE = true; } PARSER_BEGIN(JavaParser) public class JavaParser { public static void main(String args[]) { JavaParser parser; if (args.length == 0) { System.out.println("Java Parser Version 1.0.2: Reading from standard input . . ."); parser = new JavaParser(System.in); } else if (args.length == 1) { System.out.println("Java Parser Version 1.0.2: Reading from file " + args[0] + " . . ."); try { parser = new JavaParser(new java.io.FileInputStream(args[0])); } catch (java.io.FileNotFoundException e) { System.out.println("Java Parser Version 1.0.2: File " + args[0] + " not found."); return; } } else { System.out.println("Java Parser Version 1.0.2: Usage is one of:"); System.out.println(" java JavaParser < inputfile"); System.out.println("OR"); System.out.println(" java JavaParser inputfile"); return; } try { parser.CompilationUnit(); System.out.println("Java Parser Version 1.0.2: Java program parsed successfully."); } catch (ParseException e) { System.out.println("Java Parser Version 1.0.2: Encountered errors during parse."); } } } PARSER_END(JavaParser) /* WHITE SPACE */ SKIP : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } TOKEN : /* SEPARATORS */ { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } TOKEN : /* OPERATORS */ { < ASSIGN: "=" > | < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > | < LSHIFT: "<<" > | < RSIGNEDSHIFT: ">>" > | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > | < LSHIFTASSIGN: "<<=" > | < RSIGNEDSHIFTASSIGN: ">>=" > | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ void CompilationUnit() : {} { [ PackageDeclaration() ] ( ImportDeclaration() )* ( TypeDeclaration() )* } void PackageDeclaration() : {} { "package" Name() ";" } void ImportDeclaration() : {} { "import" Name() [ "." "*" ] ";" } void TypeDeclaration() : {} { LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" ) ClassDeclaration() | InterfaceDeclaration() | ";" } /* * Declaration syntax follows. */ void ClassDeclaration() : {} { ( "abstract" | "final" | "public" )* "class" [ "extends" Name() ] [ "implements" NameList() ] "{" ( ClassBodyDeclaration() )* "}" } void ClassBodyDeclaration() : {} { LOOKAHEAD(2) StaticInitializer() | LOOKAHEAD( [ "public" | "protected" | "private" ] Name() "(" ) ConstructorDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } // This production is to determine lookahead only. void MethodDeclarationLookahead() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() "(" } void InterfaceDeclaration() : {} { ( "abstract" | "public" )* "interface" [ "extends" NameList() ] "{" ( InterfaceMemberDeclaration() )* "}" } void InterfaceMemberDeclaration() : {} { LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } void FieldDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" )* Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator() : {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId() : {} { ( "[" "]" )* } void VariableInitializer() : {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" | Expression() } void MethodDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator() : {} { FormalParameters() ( "[" "]" )* } void FormalParameters() : {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter() : {} { Type() VariableDeclaratorId() } void ConstructorDeclaration() : {} { [ "public" | "protected" | "private" ] FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(2) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation() : {} { "this" Arguments() ";" | "super" Arguments() ";" } void StaticInitializer() : {} { "static" Block() } /* * Type, name and expression syntax follows. */ void Type() : {} { ( PrimitiveType() | Name() ) ( "[" "]" )* } void PrimitiveType() : {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { "void" | Type() } void Name() : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ {} { ( LOOKAHEAD(2) "." )* } void NameList() : {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : {} { LOOKAHEAD( PrimaryExpression() AssignmentOperator() ) Assignment() | ConditionalExpression() } void Assignment() : {} { PrimaryExpression() AssignmentOperator() Expression() } void AssignmentOperator() : {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression() : {} { ConditionalOrExpression() [ "?" Expression() ":" ConditionalExpression() ] } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^" AndExpression() )* } void AndExpression() : {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression() : {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression() : {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression() : {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression() : {} { AdditiveExpression() ( ( "<<" | ">>" | ">>>" ) AdditiveExpression() )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression() : {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression() : {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression() : {} { "++" PrimaryExpression() } void PreDecrementExpression() : {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus() : {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead() : {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Name() "[") "(" Name() "[" "]" | "(" Name() ")" ( "~" | "!" | "(" | | "this" | "super" | "new" | Literal() ) } void PostfixExpression() : {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression() : {} { LOOKAHEAD(2) "(" PrimitiveType() ( "[" "]" )* ")" UnaryExpression() | "(" Name() ( "[" "]" )* ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() : {} { PrimaryPrefix() ( PrimarySuffix() )* } void PrimaryPrefix() : {} { Literal() | Name() | "this" | "super" "." | "(" Expression() ")" | AllocationExpression() } void PrimarySuffix() : {} { "[" Expression() "]" | "." | Arguments() } void Literal() : {} { | | | | BooleanLiteral() | NullLiteral() } void BooleanLiteral() : {} { "true" | "false" } void NullLiteral() : {} { "null" } void Arguments() : {} { "(" [ ArgumentList() ] ")" } void ArgumentList() : {} { Expression() ( "," Expression() )* } void AllocationExpression() : {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimensions() | "new" Name() ( Arguments() | ArrayDimensions() ) } /* * The second LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimensions() : {} { ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* } /* * Statement syntax follows. */ void Statement() : {} { LOOKAHEAD(2) LabeledStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void LabeledStatement() : {} { ":" Statement() } void Block() : {} { "{" ( BlockStatement() )* "}" } void BlockStatement() : {} { LOOKAHEAD(Type() ) LocalVariableDeclaration() ";" | Statement() } void LocalVariableDeclaration() : {} { Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement() : {} { ";" } void StatementExpression() : /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. */ {} { PreIncrementExpression() | PreDecrementExpression() | LOOKAHEAD( PrimaryExpression() AssignmentOperator() ) Assignment() | PostfixExpression() } void SwitchStatement() : {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel() : {} { "case" Expression() ":" | "default" ":" } void IfStatement() : /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void DoStatement() : {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement() : {} { "for" "(" [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ")" Statement() } void ForInit() : {} { LOOKAHEAD( Type() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList() : {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate() : {} { StatementExpressionList() } void BreakStatement() : {} { "break" [ ] ";" } void ContinueStatement() : {} { "continue" [ ] ";" } void ReturnStatement() : {} { "return" [ Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement() : {} { "synchronized" "(" Expression() ")" Block() } void TryStatement() : /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } javacc-5.0.orig/examples/JavaGrammars/Java1.1.jj0000644000175000017500000010506210535127037020356 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { JAVA_UNICODE_ESCAPE = true; } PARSER_BEGIN(JavaParser) public class JavaParser { public static void main(String args[]) { JavaParser parser; if (args.length == 0) { System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); parser = new JavaParser(System.in); } else if (args.length == 1) { System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); try { parser = new JavaParser(new java.io.FileInputStream(args[0])); } catch (java.io.FileNotFoundException e) { System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); return; } } else { System.out.println("Java Parser Version 1.1: Usage is one of:"); System.out.println(" java JavaParser < inputfile"); System.out.println("OR"); System.out.println(" java JavaParser inputfile"); return; } try { parser.CompilationUnit(); System.out.println("Java Parser Version 1.1: Java program parsed successfully."); } catch (ParseException e) { System.out.println(e.getMessage()); System.out.println("Java Parser Version 1.1: Encountered errors during parse."); } } } PARSER_END(JavaParser) /* WHITE SPACE */ SKIP : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: ()* > | < #LETTER: [ // all chars for which Character.isIdentifierStart is true "$", "A"-"Z", "_", "a"-"z", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u064a", "\u0671"-"\u06d3", "\u06d5", "\u06e5"-"\u06e6", "\u06fa"-"\u06fc", "\u0710", "\u0712"-"\u072c", "\u0780"-"\u07a5", "\u0905"-"\u0939", "\u093d", "\u0950", "\u0958"-"\u0961", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09dc"-"\u09dd", "\u09df"-"\u09e1", "\u09f0"-"\u09f3", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a72"-"\u0a74", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abd", "\u0ad0", "\u0ae0", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3d", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c60"-"\u0c61", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cde", "\u0ce0"-"\u0ce1", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d60"-"\u0d61", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0e01"-"\u0e30", "\u0e32"-"\u0e33", "\u0e3f"-"\u0e46", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb0", "\u0eb2"-"\u0eb3", "\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0edc"-"\u0edd", "\u0f00", "\u0f40"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f88"-"\u0f8b", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u1050"-"\u1055", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17b3", "\u17db", "\u1820"-"\u1877", "\u1880"-"\u18a8", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u203f"-"\u2040", "\u207f", "\u20a0"-"\u20af", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u3029", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d", "\ufb1f"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\uff04", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6" ] > | < #PART_LETTER: [ // all chars for which Character.isIdentifierPart is true "\u0000"-"\u0008", "\u000e"-"\u001b", "$", "0"-"9", "A"-"Z", "_", "a"-"z", "\u007f"-"\u009f", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u0300"-"\u034e", "\u0360"-"\u0362", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u0483"-"\u0486", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u0591"-"\u05a1", "\u05a3"-"\u05b9", "\u05bb"-"\u05bd", "\u05bf", "\u05c1"-"\u05c2", "\u05c4", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u0655", "\u0660"-"\u0669", "\u0670"-"\u06d3", "\u06d5"-"\u06dc", "\u06df"-"\u06e8", "\u06ea"-"\u06ed", "\u06f0"-"\u06fc", "\u070f"-"\u072c", "\u0730"-"\u074a", "\u0780"-"\u07b0", "\u0901"-"\u0903", "\u0905"-"\u0939", "\u093c"-"\u094d", "\u0950"-"\u0954", "\u0958"-"\u0963", "\u0966"-"\u096f", "\u0981"-"\u0983", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09bc", "\u09be"-"\u09c4", "\u09c7"-"\u09c8", "\u09cb"-"\u09cd", "\u09d7", "\u09dc"-"\u09dd", "\u09df"-"\u09e3", "\u09e6"-"\u09f3", "\u0a02", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a3c", "\u0a3e"-"\u0a42", "\u0a47"-"\u0a48", "\u0a4b"-"\u0a4d", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a66"-"\u0a74", "\u0a81"-"\u0a83", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abc"-"\u0ac5", "\u0ac7"-"\u0ac9", "\u0acb"-"\u0acd", "\u0ad0", "\u0ae0", "\u0ae6"-"\u0aef", "\u0b01"-"\u0b03", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3c"-"\u0b43", "\u0b47"-"\u0b48", "\u0b4b"-"\u0b4d", "\u0b56"-"\u0b57", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b66"-"\u0b6f", "\u0b82"-"\u0b83", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0bbe"-"\u0bc2", "\u0bc6"-"\u0bc8", "\u0bca"-"\u0bcd", "\u0bd7", "\u0be7"-"\u0bef", "\u0c01"-"\u0c03", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c3e"-"\u0c44", "\u0c46"-"\u0c48", "\u0c4a"-"\u0c4d", "\u0c55"-"\u0c56", "\u0c60"-"\u0c61", "\u0c66"-"\u0c6f", "\u0c82"-"\u0c83", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cbe"-"\u0cc4", "\u0cc6"-"\u0cc8", "\u0cca"-"\u0ccd", "\u0cd5"-"\u0cd6", "\u0cde", "\u0ce0"-"\u0ce1", "\u0ce6"-"\u0cef", "\u0d02"-"\u0d03", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d3e"-"\u0d43", "\u0d46"-"\u0d48", "\u0d4a"-"\u0d4d", "\u0d57", "\u0d60"-"\u0d61", "\u0d66"-"\u0d6f", "\u0d82"-"\u0d83", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0dca", "\u0dcf"-"\u0dd4", "\u0dd6", "\u0dd8"-"\u0ddf", "\u0df2"-"\u0df3", "\u0e01"-"\u0e3a", "\u0e3f"-"\u0e4e", "\u0e50"-"\u0e59", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb9", "\u0ebb"-"\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0ec8"-"\u0ecd", "\u0ed0"-"\u0ed9", "\u0edc"-"\u0edd", "\u0f00", "\u0f18"-"\u0f19", "\u0f20"-"\u0f29", "\u0f35", "\u0f37", "\u0f39", "\u0f3e"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f71"-"\u0f84", "\u0f86"-"\u0f8b", "\u0f90"-"\u0f97", "\u0f99"-"\u0fbc", "\u0fc6", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u102c"-"\u1032", "\u1036"-"\u1039", "\u1040"-"\u1049", "\u1050"-"\u1059", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u1369"-"\u1371", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17d3", "\u17db", "\u17e0"-"\u17e9", "\u180b"-"\u180e", "\u1810"-"\u1819", "\u1820"-"\u1877", "\u1880"-"\u18a9", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u200c"-"\u200f", "\u202a"-"\u202e", "\u203f"-"\u2040", "\u206a"-"\u206f", "\u207f", "\u20a0"-"\u20af", "\u20d0"-"\u20dc", "\u20e1", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u302f", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u3099"-"\u309a", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe20"-"\ufe23", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\ufeff", "\uff04", "\uff10"-"\uff19", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6", "\ufff9"-"\ufffb" ] > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > | < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > | < LSHIFT: "<<" > | < RSIGNEDSHIFT: ">>" > | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > | < LSHIFTASSIGN: "<<=" > | < RSIGNEDSHIFTASSIGN: ">>=" > | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ void CompilationUnit() : {} { [ PackageDeclaration() ] ( ImportDeclaration() )* ( TypeDeclaration() )* } void PackageDeclaration() : {} { "package" Name() ";" } void ImportDeclaration() : {} { "import" Name() [ "." "*" ] ";" } void TypeDeclaration() : {} { LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" ) ClassDeclaration() | InterfaceDeclaration() | ";" } /* * Declaration syntax follows. */ void ClassDeclaration() : {} { ( "abstract" | "final" | "public" )* UnmodifiedClassDeclaration() } void UnmodifiedClassDeclaration() : {} { "class" [ "extends" Name() ] [ "implements" NameList() ] ClassBody() } void ClassBody() : {} { "{" ( ClassBodyDeclaration() )* "}" } void NestedClassDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedClassDeclaration() } void ClassBodyDeclaration() : {} { LOOKAHEAD(2) Initializer() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( [ "public" | "protected" | "private" ] Name() "(" ) ConstructorDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } // This production is to determine lookahead only. void MethodDeclarationLookahead() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() "(" } void InterfaceDeclaration() : {} { ( "abstract" | "public" )* UnmodifiedInterfaceDeclaration() } void NestedInterfaceDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedInterfaceDeclaration() } void UnmodifiedInterfaceDeclaration() : {} { "interface" [ "extends" NameList() ] "{" ( InterfaceMemberDeclaration() )* "}" } void InterfaceMemberDeclaration() : {} { LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } void FieldDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" )* Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator() : {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId() : {} { ( "[" "]" )* } void VariableInitializer() : {} { ArrayInitializer() | Expression() } void ArrayInitializer() : {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator() : {} { FormalParameters() ( "[" "]" )* } void FormalParameters() : {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter() : {} { [ "final" ] Type() VariableDeclaratorId() } void ConstructorDeclaration() : {} { [ "public" | "protected" | "private" ] FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation() : {} { LOOKAHEAD("this" Arguments() ";") "this" Arguments() ";" | [ LOOKAHEAD(2) PrimaryExpression() "." ] "super" Arguments() ";" } void Initializer() : {} { [ "static" ] Block() } /* * Type, name and expression syntax follows. */ void Type() : {} { ( PrimitiveType() | Name() ) ( "[" "]" )* } void PrimitiveType() : {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { "void" | Type() } void Name() : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ {} { ( LOOKAHEAD(2) "." )* } void NameList() : {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ {} { ConditionalExpression() [ AssignmentOperator() Expression() ] } void AssignmentOperator() : {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression() : {} { ConditionalOrExpression() [ "?" Expression() ":" ConditionalExpression() ] } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^" AndExpression() )* } void AndExpression() : {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression() : {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression() : {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression() : {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression() : {} { AdditiveExpression() ( ( "<<" | ">>" | ">>>" ) AdditiveExpression() )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression() : {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression() : {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression() : {} { "++" PrimaryExpression() } void PreDecrementExpression() : {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus() : {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead() : {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Name() "[") "(" Name() "[" "]" | "(" Name() ")" ( "~" | "!" | "(" | | "this" | "super" | "new" | Literal() ) } void PostfixExpression() : {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression() : {} { LOOKAHEAD("(" PrimitiveType()) "(" Type() ")" UnaryExpression() | "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() : {} { PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* } void PrimaryPrefix() : {} { Literal() | "this" | "super" "." | "(" Expression() ")" | AllocationExpression() | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class" | Name() } void PrimarySuffix() : {} { LOOKAHEAD(2) "." "this" | LOOKAHEAD(2) "." AllocationExpression() | "[" Expression() "]" | "." | Arguments() } void Literal() : {} { | | | | BooleanLiteral() | NullLiteral() } void BooleanLiteral() : {} { "true" | "false" } void NullLiteral() : {} { "null" } void Arguments() : {} { "(" [ ArgumentList() ] ")" } void ArgumentList() : {} { Expression() ( "," Expression() )* } void AllocationExpression() : {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimsAndInits() | "new" Name() ( ArrayDimsAndInits() | Arguments() [ ClassBody() ] ) } /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimsAndInits() : {} { LOOKAHEAD(2) ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* | ( "[" "]" )+ ArrayInitializer() } /* * Statement syntax follows. */ void Statement() : {} { LOOKAHEAD(2) LabeledStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void LabeledStatement() : {} { ":" Statement() } void Block() : {} { "{" ( BlockStatement() )* "}" } void BlockStatement() : {} { LOOKAHEAD([ "final" ] Type() ) LocalVariableDeclaration() ";" | Statement() | UnmodifiedClassDeclaration() | UnmodifiedInterfaceDeclaration() } void LocalVariableDeclaration() : {} { [ "final" ] Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement() : {} { ";" } void StatementExpression() : /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ {} { PreIncrementExpression() | PreDecrementExpression() | PrimaryExpression() [ "++" | "--" | AssignmentOperator() Expression() ] } void SwitchStatement() : {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel() : {} { "case" Expression() ":" | "default" ":" } void IfStatement() : /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void DoStatement() : {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement() : {} { "for" "(" [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ")" Statement() } void ForInit() : {} { LOOKAHEAD( [ "final" ] Type() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList() : {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate() : {} { StatementExpressionList() } void BreakStatement() : {} { "break" [ ] ";" } void ContinueStatement() : {} { "continue" [ ] ";" } void ReturnStatement() : {} { "return" [ Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement() : {} { "synchronized" "(" Expression() ")" Block() } void TryStatement() : /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } javacc-5.0.orig/examples/README0000644000175000017500000000763510535127030015235 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This directory contains many examples of JavaCC and JJTree input grammars. We recommend you see the examples in the following order. Each directory contains a README file with more detailed instructions: SimpleExamples: This is a set of very simple JavaCC examples. After trying these examples out, you should be able to build reasonably complex examples yourself. MailProcessing: These examples illustrate the use of JavaCC in parsing emacs mail files. They highlight the use of lexical states. JJTreeExamples: There are simple input grammars for JJTree, the tree building preprocessor. CORBA-IDL: This is a grammar for the IDL interface definition language of OMG CORBA 2.0. JavaGrammars: This directory contains extremely well debugged and maintained Java grammars for both the 1.0.2 and 1.1 versions of the language. JavaCCGrammar: This directory contains the official JavaCC/JJTree grammar. This is the grammar based on which JavaCC and JJTree are built. Transformer: This example illustrates how a Java language extension is defined and transformed back into Java. This makes use of JJTree. GUIParsing: These examples illustrate how one may obtain input for parsing or lexical analysis from a GUI, and thereby provide "parsing" of GUI interactions. In addition, one of these examples illustrates how state machines may be described as lexical specifications. Obfuscator: This is a complete implementation of a Java obfuscator. This allows one to take a set of Java source files and modify them into semantically equivalent source files that are much more difficult to read. This example shows the usage of multiple parsers used from one system. Interpreter: This is an interpreter for a simple language with declarations, assignments, expressions, conditionals, loops, etc. It demonstrates really nicely a complex example where JJTree is used to drastically simplify the process of generating parse trees. All actions are really methods built into the generated tree nodes. Lookahead: This directory contains the tutorial on LOOKAHEAD along with all examples used in the tutorial. VTransformer: This directory contains an example of using the Visitor design pattern with JJTree. Like the Transformer example, it shows how a Java program can be processed into a slightly different form. javacc-5.0.orig/examples/VTransformer/0000755000175000017500000000000011247044052016775 5ustar mkochmkochjavacc-5.0.orig/examples/VTransformer/SimpleNode.java0000644000175000017500000000772311052407264021712 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ //package VTransformer; public class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; protected JavaParser parser; protected Token first, last; public SimpleNode(int i) { id = i; } public SimpleNode(JavaParser p, int i) { this(i); parser = p; } public static Node jjtCreate(JavaParser p, int id) { return new SimpleNode(p, id); } public void jjtOpen() { first = parser.getToken(1); // new } public void jjtClose() { last = parser.getToken(0); // new } public Token getFirstToken() { return first; } // new public Token getLastToken() { return last; } // new public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } /** Accept the visitor. **/ public Object jjtAccept(JavaParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** Accept the visitor. **/ public Object acceptChildren(JavaParserVisitor visitor, Object data) { if (children != null) { for (int i = 0; i < children.length; ++i) { children[i].jjtAccept(visitor, data); } } return data; } /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return JavaParserTreeConstants.jjtNodeName[id]; } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode)children[i]; if (n != null) { n.dump(prefix + " "); } } } } } javacc-5.0.orig/examples/VTransformer/UnparseVisitor.java0000644000175000017500000002653711052407264022654 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ //package VTransformer; import java.io.PrintStream; public class UnparseVisitor implements JavaParserVisitor { protected PrintStream out; public UnparseVisitor(PrintStream o) { out = o; } public Object print(SimpleNode node, Object data) { Token t1 = node.getFirstToken(); Token t = new Token(); t.next = t1; SimpleNode n; for (int ord = 0; ord < node.jjtGetNumChildren(); ord++) { n = (SimpleNode)node.jjtGetChild(ord); while (true) { t = t.next; if (t == n.getFirstToken()) break; print(t); } n.jjtAccept(this, data); t = n.getLastToken(); } while (t != node.getLastToken()) { t = t.next; print(t); } return data; } protected void print(Token t) { Token tt = t.specialToken; if (tt != null) { while (tt.specialToken != null) tt = tt.specialToken; while (tt != null) { out.print(addUnicodeEscapes(tt.image)); tt = tt.next; } } out.print(addUnicodeEscapes(t.image)); } private String addUnicodeEscapes(String str) { String retval = ""; char ch; for (int i = 0; i < str.length(); i++) { ch = str.charAt(i); if ((ch < 0x20 || ch > 0x7e) && ch != '\t' && ch != '\n' && ch != '\r' && ch != '\f') { String s = "0000" + Integer.toString(ch, 16); retval += "\\u" + s.substring(s.length() - 4, s.length()); } else { retval += ch; } } return retval; } public Object visit(SimpleNode node, Object data) { return print(node, data); } public Object visit(ASTCompilationUnit node, Object data) { return print(node, data); } public Object visit(ASTPackageDeclaration node, Object data) { return print(node, data); } public Object visit(ASTImportDeclaration node, Object data) { return print(node, data); } public Object visit(ASTTypeDeclaration node, Object data) { return print(node, data); } public Object visit(ASTClassDeclaration node, Object data) { return print(node, data); } public Object visit(ASTUnmodifiedClassDeclaration node, Object data) { return print(node, data); } public Object visit(ASTClassBody node, Object data) { return print(node, data); } public Object visit(ASTNestedClassDeclaration node, Object data) { return print(node, data); } public Object visit(ASTClassBodyDeclaration node, Object data) { return print(node, data); } public Object visit(ASTMethodDeclarationLookahead node, Object data) { return print(node, data); } public Object visit(ASTInterfaceDeclaration node, Object data) { return print(node, data); } public Object visit(ASTNestedInterfaceDeclaration node, Object data) { return print(node, data); } public Object visit(ASTUnmodifiedInterfaceDeclaration node, Object data) { return print(node, data); } public Object visit(ASTInterfaceMemberDeclaration node, Object data) { return print(node, data); } public Object visit(ASTFieldDeclaration node, Object data) { return print(node, data); } public Object visit(ASTVariableDeclarator node, Object data) { return print(node, data); } public Object visit(ASTVariableDeclaratorId node, Object data) { return print(node, data); } public Object visit(ASTVariableInitializer node, Object data) { return print(node, data); } public Object visit(ASTArrayInitializer node, Object data) { return print(node, data); } public Object visit(ASTMethodDeclaration node, Object data) { return print(node, data); } public Object visit(ASTMethodDeclarator node, Object data) { return print(node, data); } public Object visit(ASTFormalParameters node, Object data) { return print(node, data); } public Object visit(ASTFormalParameter node, Object data) { return print(node, data); } public Object visit(ASTConstructorDeclaration node, Object data) { return print(node, data); } public Object visit(ASTExplicitConstructorInvocation node, Object data) { return print(node, data); } public Object visit(ASTInitializer node, Object data) { return print(node, data); } public Object visit(ASTType node, Object data) { return print(node, data); } public Object visit(ASTPrimitiveType node, Object data) { return print(node, data); } public Object visit(ASTResultType node, Object data) { return print(node, data); } public Object visit(ASTName node, Object data) { return print(node, data); } public Object visit(ASTNameList node, Object data) { return print(node, data); } public Object visit(ASTExpression node, Object data) { return print(node, data); } public Object visit(ASTAssignmentOperator node, Object data) { return print(node, data); } public Object visit(ASTConditionalExpression node, Object data) { return print(node, data); } public Object visit(ASTConditionalOrExpression node, Object data) { return print(node, data); } public Object visit(ASTConditionalAndExpression node, Object data) { return print(node, data); } public Object visit(ASTInclusiveOrExpression node, Object data) { return print(node, data); } public Object visit(ASTExclusiveOrExpression node, Object data) { return print(node, data); } public Object visit(ASTAndExpression node, Object data) { return print(node, data); } public Object visit(ASTEqualityExpression node, Object data) { return print(node, data); } public Object visit(ASTInstanceOfExpression node, Object data) { return print(node, data); } public Object visit(ASTRelationalExpression node, Object data) { return print(node, data); } public Object visit(ASTShiftExpression node, Object data) { return print(node, data); } public Object visit(ASTAdditiveExpression node, Object data) { return print(node, data); } public Object visit(ASTMultiplicativeExpression node, Object data) { return print(node, data); } public Object visit(ASTUnaryExpression node, Object data) { return print(node, data); } public Object visit(ASTPreIncrementExpression node, Object data) { return print(node, data); } public Object visit(ASTPreDecrementExpression node, Object data) { return print(node, data); } public Object visit(ASTUnaryExpressionNotPlusMinus node, Object data) { return print(node, data); } public Object visit(ASTCastLookahead node, Object data) { return print(node, data); } public Object visit(ASTPostfixExpression node, Object data) { return print(node, data); } public Object visit(ASTCastExpression node, Object data) { return print(node, data); } public Object visit(ASTPrimaryExpression node, Object data) { return print(node, data); } public Object visit(ASTPrimaryPrefix node, Object data) { return print(node, data); } public Object visit(ASTPrimarySuffix node, Object data) { return print(node, data); } public Object visit(ASTLiteral node, Object data) { return print(node, data); } public Object visit(ASTBooleanLiteral node, Object data) { return print(node, data); } public Object visit(ASTNullLiteral node, Object data) { return print(node, data); } public Object visit(ASTArguments node, Object data) { return print(node, data); } public Object visit(ASTArgumentList node, Object data) { return print(node, data); } public Object visit(ASTAllocationExpression node, Object data) { return print(node, data); } public Object visit(ASTArrayDimsAndInits node, Object data) { return print(node, data); } public Object visit(ASTStatement node, Object data) { return print(node, data); } public Object visit(ASTLabeledStatement node, Object data) { return print(node, data); } public Object visit(ASTBlock node, Object data) { return print(node, data); } public Object visit(ASTBlockStatement node, Object data) { return print(node, data); } public Object visit(ASTLocalVariableDeclaration node, Object data) { return print(node, data); } public Object visit(ASTEmptyStatement node, Object data) { return print(node, data); } public Object visit(ASTStatementExpression node, Object data) { return print(node, data); } public Object visit(ASTSwitchStatement node, Object data) { return print(node, data); } public Object visit(ASTSwitchLabel node, Object data) { return print(node, data); } public Object visit(ASTIfStatement node, Object data) { return print(node, data); } public Object visit(ASTWhileStatement node, Object data) { return print(node, data); } public Object visit(ASTDoStatement node, Object data) { return print(node, data); } public Object visit(ASTForStatement node, Object data) { return print(node, data); } public Object visit(ASTForInit node, Object data) { return print(node, data); } public Object visit(ASTStatementExpressionList node, Object data) { return print(node, data); } public Object visit(ASTForUpdate node, Object data) { return print(node, data); } public Object visit(ASTBreakStatement node, Object data) { return print(node, data); } public Object visit(ASTContinueStatement node, Object data) { return print(node, data); } public Object visit(ASTReturnStatement node, Object data) { return print(node, data); } public Object visit(ASTThrowStatement node, Object data) { return print(node, data); } public Object visit(ASTSynchronizedStatement node, Object data) { return print(node, data); } public Object visit(ASTTryStatement node, Object data) { return print(node, data); } } javacc-5.0.orig/examples/VTransformer/Java1.1.jjt0000644000175000017500000004373110714434126020622 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { JAVA_UNICODE_ESCAPE = true; STATIC=false; MULTI=true; VISITOR=true; NODE_USES_PARSER=true; NODE_FACTORY = true; } PARSER_BEGIN(JavaParser) //package VTransformer; public class JavaParser {} PARSER_END(JavaParser) /* WHITE SPACE */ SPECIAL_TOKEN : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > | < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > | < LSHIFT: "<<" > | < RSIGNEDSHIFT: ">>" > | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > | < LSHIFTASSIGN: "<<=" > | < RSIGNEDSHIFTASSIGN: ">>=" > | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************/ /* * Program structuring syntax follows. */ ASTCompilationUnit CompilationUnit() : {} { [ PackageDeclaration() ] ( ImportDeclaration() )* ( TypeDeclaration() )* { return jjtThis; } } void PackageDeclaration() : {} { "package" Name() ";" } void ImportDeclaration() : {} { "import" Name() [ "." "*" ] ";" } void TypeDeclaration() : {} { LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" ) ClassDeclaration() | InterfaceDeclaration() | ";" } /* * Declaration syntax follows. */ void ClassDeclaration() : {} { ( "abstract" | "final" | "public" )* UnmodifiedClassDeclaration() } void UnmodifiedClassDeclaration() : {} { "class" [ "extends" Name() ] [ "implements" NameList() ] ClassBody() } void ClassBody() : {} { "{" ( ClassBodyDeclaration() )* "}" } void NestedClassDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedClassDeclaration() } void ClassBodyDeclaration() : {} { LOOKAHEAD(2) Initializer() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( [ "public" | "protected" | "private" ] Name() "(" ) ConstructorDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } // This production is to determine lookahead only. void MethodDeclarationLookahead() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() "(" } void InterfaceDeclaration() : {} { ( "abstract" | "public" )* UnmodifiedInterfaceDeclaration() } void NestedInterfaceDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedInterfaceDeclaration() } void UnmodifiedInterfaceDeclaration() : {} { "interface" [ "extends" NameList() ] "{" ( InterfaceMemberDeclaration() )* "}" } void InterfaceMemberDeclaration() : {} { LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } void FieldDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" )* Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator() : {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId() : {} { ( "[" "]" )* } void VariableInitializer() : {} { ArrayInitializer() | Expression() } void ArrayInitializer() : {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator() : {} { FormalParameters() ( "[" "]" )* } void FormalParameters() : {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter() : {} { [ "final" ] Type() VariableDeclaratorId() } void ConstructorDeclaration() : {} { [ "public" | "protected" | "private" ] FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation() : {} { LOOKAHEAD("this" Arguments() ";") "this" Arguments() ";" | [ LOOKAHEAD(2) PrimaryExpression() "." ] "super" Arguments() ";" } void Initializer() : {} { [ "static" ] Block() } /* * Type, name and expression syntax follows. */ void Type() : {} { ( PrimitiveType() | Name() ) ( "[" "]" )* } void PrimitiveType() : {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { "void" | Type() } void Name() : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ {} { ( LOOKAHEAD(2) "." )* } void NameList() : {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ {} { ConditionalExpression() [ AssignmentOperator() Expression() ] } void AssignmentOperator() : {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression() : {} { ConditionalOrExpression() [ "?" Expression() ":" ConditionalExpression() ] } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^" AndExpression() )* } void AndExpression() : {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression() : {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression() : {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression() : {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression() : {} { AdditiveExpression() ( ( "<<" | ">>" | ">>>" ) AdditiveExpression() )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression() : {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression() : {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression() : {} { "++" PrimaryExpression() } void PreDecrementExpression() : {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus() : {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead() : {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Name() "[") "(" Name() "[" "]" | "(" Name() ")" ( "~" | "!" | "(" | | "this" | "super" | "new" | Literal() ) } void PostfixExpression() : {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression() : {} { LOOKAHEAD("(" PrimitiveType()) "(" Type() ")" UnaryExpression() | LOOKAHEAD("(" Name()) "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() : {} { PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* } void PrimaryPrefix() : {} { Literal() | "this" | "super" "." | "(" Expression() ")" | AllocationExpression() | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class" | Name() } void PrimarySuffix() : {} { LOOKAHEAD(2) "." "this" | LOOKAHEAD(2) "." AllocationExpression() | "[" Expression() "]" | "." | Arguments() } void Literal() : {} { | | | | BooleanLiteral() | NullLiteral() } void BooleanLiteral() : {} { "true" | "false" } void NullLiteral() : {} { "null" } void Arguments() : {} { "(" [ ArgumentList() ] ")" } void ArgumentList() : {} { Expression() ( "," Expression() )* } void AllocationExpression() : {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimsAndInits() | "new" Name() ( ArrayDimsAndInits() | Arguments() [ ClassBody() ] ) } /* * The second LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimsAndInits() : {} { LOOKAHEAD(2) ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* | ( "[" "]" )+ ArrayInitializer() } /* * Statement syntax follows. */ void Statement() : {} { LOOKAHEAD(2) LabeledStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void LabeledStatement() : {} { ":" Statement() } void Block() : {} { "{" ( BlockStatement() )* "}" } void BlockStatement() : {} { LOOKAHEAD([ "final" ] Type() ) LocalVariableDeclaration() ";" | Statement() | UnmodifiedClassDeclaration() } void LocalVariableDeclaration() : {} { [ "final" ] Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement() : {} { ";" } void StatementExpression() : /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ {} { PreIncrementExpression() | PreDecrementExpression() | PrimaryExpression() [ "++" | "--" | AssignmentOperator() Expression() ] } void SwitchStatement() : {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel() : {} { "case" Expression() ":" | "default" ":" } void IfStatement() : /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void DoStatement() : {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement() : {} { "for" "(" [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ")" Statement() } void ForInit() : {} { LOOKAHEAD( [ "final" ] Type() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList() : {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate() : {} { StatementExpressionList() } void BreakStatement() : {} { "break" [ ] ";" } void ContinueStatement() : {} { "continue" [ ] ";" } void ReturnStatement() : {} { "return" [ Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement() : {} { "synchronized" "(" Expression() ")" Block() } void TryStatement() : /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } javacc-5.0.orig/examples/VTransformer/AddAcceptVisitor.java0000644000175000017500000000472111052407264023036 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ //package VTransformer; import java.io.PrintStream; public class AddAcceptVisitor extends UnparseVisitor { public AddAcceptVisitor(PrintStream o) { super(o); } public Object visit(ASTClassBodyDeclaration node, Object data) { /* Are we the first child of our parent? */ if (node == node.jjtGetParent().jjtGetChild(0)) { /** Attempt to make the new code match the indentation of the node. */ StringBuffer pre = new StringBuffer(""); for (int i = 1; i < node.getFirstToken().beginColumn; ++i) { pre.append(' '); } out.println(pre + ""); out.println(pre + "/** Accept the visitor. **/"); out.println(pre + "public Object jjtAccept(JavaParserVisitor visitor, Object data) {"); out.println(pre + " return visitor.visit(this, data);"); out.println(pre + "}"); } return super.visit(node, data); } } javacc-5.0.orig/examples/VTransformer/Main.java0000644000175000017500000000417711052407264020537 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ //package VTransformer; import java.io.*; public class Main { public static void main(String args[]) { System.err.println("Reading from standard input..."); JavaParser p = new JavaParser(System.in); try { ASTCompilationUnit cu = p.CompilationUnit(); JavaParserVisitor visitor = new AddAcceptVisitor(System.out); cu.jjtAccept(visitor, null); System.err.println("Thank you."); } catch (Exception e) { System.err.println("Oops."); System.err.println(e.getMessage()); e.printStackTrace(); } } } javacc-5.0.orig/examples/VTransformer/README0000644000175000017500000001321510535127044017661 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This directory contains an example of using the Visitor design pattern with JJTree. Like the Transformer example, it shows how a Java program can be processed into a slightly different form. In this case the input code is transformed so that each class has a jjtAccept() method inserted. This might be useful for updating node files created with an earlier version of JJTree so that they can be used with the Visitor support. Here is an overview of the source files: Java1.1.jjt This JJTree source file has been slightly modified from the Java 1.1 grammar distributed in the JavaGrammars examples directory. Here are the main differences: 1) Removed the main method from the parser class; 2) Added a couple of JJTree options; 3) Made the CompilationUnit production return a root AST node; 4) Made white space SPECIAL_TOKENs rather than SKIPs; These changes illustrate how a JavaCC grammar can be used with JJTree with very little modification. In particular, there are no node annotations -- instead each production in the grammar is represented as a node. Main.java Simply calls the parser to create the AST, creates a Visitor, and then asks the root node to accept the visitor. SimpleNode.java This is modified from the automatically generated file. SimpleNodes now maintain their first and last tokens so that the input can be reconstituted. The jjtOpen() and jjtClose() methods are used as hooks to collect and store these tokens. The NODE_USES_PARSER option is specified so that the parser object is available to these methods. UnparseVisitor.java This is a generally useful Visitor that simply unparses the nodes that it visits. It is intended to be a superclass for transformation-specific Visitors such as AddAcceptVisitor. AddAcceptVisitor.java This is a Visitor for a particular transformation. It extends UnparseVisitor and overrides methods for those nodes that require special treatment. In this case, only the visit method for ClassBodyDeclaration nodes needs to be overridden. The visitor determines whether the node currently being visited is the first child of its parent, and if so it inserts the new text. It makes an attempt to indent the new text at the same level as the current node. Here's how to build the transformer: 1) Run the JJTree on the grammar. It will generate many node files because the MULTI option is set. trane% jjtree Java1.1.jjt Java Compiler Compiler Version 2.0 (Tree Builder) Copyright (c) 1996-1999 Sun Microsystems, Inc. Copyright (c) 1997-1999 Metamata, Inc. (type "jjtree" with no arguments for help) Reading from file Java1.1.jjt . . . File "Node.java" does not exist. Will create one. File "ASTCompilationUnit.java" does not exist. Will create one. File "ASTPackageDeclaration.java" does not exist. Will create one. ... lots more nodes generated here File "ASTSynchronizedStatement.java" does not exist. Will create one. File "ASTTryStatement.java" does not exist. Will create one. Annotated grammar generated successfully in Java1.1.jj trane% 2) Run JavaCC on the generated grammar. trane% javacc Java1.1.jj Java Compiler Compiler Version 2.0 (Parser Generator) Copyright (c) 1996-1999 Sun Microsystems, Inc. Copyright (c) 1997-1999 Metamata, Inc. (type "javacc" with no arguments for help) Reading from file Java1.1.jj . . . File "TokenMgrError.java" does not exist. Will create one. File "ParseException.java" does not exist. Will create one. File "Token.java" does not exist. Will create one. File "ASCII_UCodeESC_CharStream.java" does not exist. Will create one. Parser generated successfully. trane% 3) Ensure that your class path is set up correctly. The examples directory (above VTransformer) should be in your class path. 4) Compile the Java files trane% javac Main.java 5) And finally run it. It works as a filter now, but it would be straightforward to make it take file names as arguments. The example below shows how to apply the filter on Main.java itself. trane% java Main < Main.java > Main.new Reading from standard input... Thank you. trane% javacc-5.0.orig/examples/CORBA-IDL/0000755000175000017500000000000011247044051015600 5ustar mkochmkochjavacc-5.0.orig/examples/CORBA-IDL/Hello.idl0000644000175000017500000000010710604710375017340 0ustar mkochmkochmodule HelloApp { interface Hello { string sayHello(); }; }; javacc-5.0.orig/examples/CORBA-IDL/README0000644000175000017500000000341110535127031016456 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This directory contains an CORBA 2.0 grammar for IDL. Build it in the usual manner and try it out. javacc IDL.jj javac *.java java IDLParser javacc-5.0.orig/examples/CORBA-IDL/IDL.jj0000644000175000017500000002667310713453627016565 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(IDLParser) public class IDLParser { public static void main(String args[]) { IDLParser parser; if (args.length == 0) { System.out.println("IDL Parser Version 0.1: Reading from standard input . . ."); parser = new IDLParser(System.in); } else if (args.length == 1) { System.out.println("IDL Parser Version 0.1: Reading from file " + args[0] + " . . ."); try { parser = new IDLParser(new java.io.FileInputStream(args[0])); } catch (java.io.FileNotFoundException e) { System.out.println("IDL Parser Version 0.1: File " + args[0] + " not found."); return; } } else { System.out.println("IDL Parser Version 0.1: Usage is one of:"); System.out.println(" java IDLParser < inputfile"); System.out.println("OR"); System.out.println(" java IDLParser inputfile"); return; } try { parser.specification(); System.out.println("IDL Parser Version 0.1: IDL file parsed successfully."); } catch (ParseException e) { System.out.println("IDL Parser Version 0.1: Encountered errors during parse."); } } } PARSER_END(IDLParser) /* * Tokens to ignore in the BNF follow. */ SKIP : { < " " > | < "\t" > | < "\n" > | < "\r" > | < "//" (~["\n"])* "\n" > | <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> | < "#" ([" ","\t"])* (["0"-"9"])+ (([" ","\t"])* "\"" (~["\""])+ "\"" ([" ","\t"])* (["0"-"9"])* ([" ","\t"])* (["0"-"9"])*)? "\n" > } /* Production 1 */ void specification() : {} { ( definition() )+ } /* Production 2 */ void definition() : {} { type_dcl() ";" | const_dcl() ";" | except_dcl() ";" | interfacex() ";" | module() ";" } /* Production 3 */ void module() : {} { "module" identifier() "{" ( definition() )+ "}" } /* Production 4 */ void interfacex() : {} { LOOKAHEAD(3) interface_dcl() | forward_dcl() } /* Production 5 */ void interface_dcl() : {} { interface_header() "{" interface_body() "}" } /* Production 6 */ void forward_dcl() : {} { "interface" identifier() } /* Production 7 */ void interface_header() : {} { "interface" identifier() [ inheritance_spec() ] } /* Production 8 */ void interface_body() : {} { ( export() )* } /* Production 9 */ void export() : {} { type_dcl() ";" | const_dcl() ";" | except_dcl() ";" | attr_dcl() ";" | op_dcl() ";" } /* Production 10 */ void inheritance_spec() : {} { ":" scoped_name() ( "," scoped_name() )* } /* Production 11 */ void scoped_name() : {} { [ "::" ] identifier() ( "::" identifier() )* } /* Production 12 */ void const_dcl() : {} { "const" const_type() identifier() "=" const_exp() } /* Production 13 */ void const_type() : {} { integer_type() | char_type() | boolean_type() | floating_pt_type() | string_type() | scoped_name() } /* Production 14 */ void const_exp() : {} { or_expr() } /* Production 15 */ void or_expr() : {} { xor_expr() ( "|" xor_expr() )* } /* Production 16 */ void xor_expr() : {} { and_expr() ( "^" and_expr() )* } /* Production 17 */ void and_expr() : {} { shift_expr() ( "&" shift_expr() )* } /* Production 18 */ void shift_expr() : {} { add_expr() ( ( ">>" | "<<" ) add_expr() )* } /* Production 19 */ void add_expr() : {} { mult_expr() ( ( "+" | "-" ) mult_expr() )* } /* Production 20 */ void mult_expr() : {} { unary_expr() ( ( "*" | "/" | "%" ) unary_expr() )* } /* Production 21 */ void unary_expr() : {} { [ unary_operator() ] primary_expr() } /* Production 22 */ void unary_operator() : {} { "-" | "+" | "~" } /* Production 23 */ void primary_expr() : {} { scoped_name() | literal() | "(" const_exp() ")" } /* Production 24 */ void literal() : {} { integer_literal() | string_literal() | character_literal() | floating_pt_literal() | boolean_literal() } /* Production 25 */ void boolean_literal() : {} { "TRUE" | "FALSE" } /* Production 26 */ void positive_int_const() : {} { const_exp() } /* Production 27 */ void type_dcl() : {} { "typedef" type_declarator() | struct_type() | union_type() | enum_type() } /* Production 28 */ void type_declarator() : {} { type_spec() declarators() } /* Production 29 */ void type_spec() : {} { simple_type_spec() | constr_type_spec() } /* Production 30 */ void simple_type_spec() : {} { base_type_spec() | template_type_spec() | scoped_name() } /* Production 31 */ void base_type_spec() : {} { floating_pt_type() | integer_type() | char_type() | boolean_type() | octet_type() | any_type() } /* Production 32 */ void template_type_spec() : {} { sequence_type() | string_type() } /* Production 33 */ void constr_type_spec() : {} { struct_type() | union_type() | enum_type() } /* Production 34 */ void declarators() : {} { declarator() ( "," declarator() )* } /* Production 35 */ void declarator() : {} { LOOKAHEAD(2) complex_declarator() | simple_declarator() } /* Production 36 */ void simple_declarator() : {} { identifier() } /* Production 37 */ void complex_declarator() : {} { array_declarator() } /* Production 38 */ void floating_pt_type() : {} { "float" | "double" } /* Production 39 */ void integer_type() : {} { signed_int() | unsigned_int() } /* Production 40 */ void signed_int() : {} { signed_long_int() | signed_short_int() } /* Production 41 */ void signed_long_int() : {} { "long" } /* Production 42 */ void signed_short_int() : {} { "short" } /* Production 43 */ void unsigned_int() : {} { LOOKAHEAD(2) unsigned_long_int() | unsigned_short_int() } /* Production 44 */ void unsigned_long_int() : {} { "unsigned" "long" } /* Production 45 */ void unsigned_short_int() : {} { "unsigned" "short" } /* Production 46 */ void char_type() : {} { "char" } /* Production 47 */ void boolean_type() : {} { "boolean" } /* Production 48 */ void octet_type() : {} { "octet" } /* Production 49 */ void any_type() : {} { "any" } /* Production 50 */ void struct_type() : {} { "struct" identifier() "{" member_list() "}" } /* Production 51 */ void member_list() : {} { ( member() )+ } /* Production 52 */ void member() : {} { type_spec() declarators() ";" } /* Production 53 */ void union_type() : {} { "union" identifier() "switch" "(" switch_type_spec() ")" "{" switch_body() "}" } /* Production 54 */ void switch_type_spec() : {} { integer_type() | char_type() | boolean_type() | enum_type() | scoped_name() } /* Production 55 */ void switch_body() : {} { ( casex() )+ } /* Production 56 */ void casex() : {} { ( case_label() )+ element_spec() ";" } /* Production 57 */ void case_label() : {} { "case" const_exp() ":" | "default" ":" } /* Production 58 */ void element_spec() : {} { type_spec() declarator() } /* Production 59 */ void enum_type() : {} { "enum" identifier() "{" enumerator() ( "," enumerator() )* "}" } /* Production 60 */ void enumerator() : {} { identifier() } /* Production 61 */ void sequence_type() : {} { "sequence" "<" simple_type_spec() [ "," positive_int_const() ] ">" } /* Production 62 */ void string_type() : {} { "string" [ "<" positive_int_const() ">" ] } /* Production 63 */ void array_declarator() : {} { identifier() ( fixed_array_size() )+ } /* Production 64 */ void fixed_array_size() : {} { "[" positive_int_const() "]" } /* Production 65 */ void attr_dcl() : {} { [ "readonly" ] "attribute" param_type_spec() simple_declarator() ( "," simple_declarator() )* } /* Production 66 */ void except_dcl() : {} { "exception" identifier() "{" ( member() )* "}" } /* Production 67 */ void op_dcl() : {} { [ op_attribute() ] op_type_spec() identifier() parameter_dcls() [ raises_expr() ] [ context_expr() ] } /* Production 68 */ void op_attribute() : {} { "oneway" } /* Production 69 */ void op_type_spec() : {} { param_type_spec() | "void" } /* Production 70 */ void parameter_dcls() : {} { "(" [ param_dcl() ( "," param_dcl() )* ] ")" } /* Production 71 */ void param_dcl() : {} { param_attribute() param_type_spec() simple_declarator() } /* Production 72 */ void param_attribute() : {} { "in" | "out" | "inout" } /* Production 73 */ void raises_expr() : {} { "raises" "(" scoped_name() ( "," scoped_name() )* ")" } /* Production 74 */ void context_expr() : {} { "context" "(" string_literal() ( "," string_literal() )* ")" } /* Production 75 */ void param_type_spec() : {} { base_type_spec() | string_type() | scoped_name() } /* Definitions of complex regular expressions follow */ void identifier() : {} { } void integer_literal() : {} { | | } void string_literal() : {} { } void character_literal() : {} { } void floating_pt_literal() : {} { | } TOKEN : { < ID : ["a"-"z","A"-"Z", "_"] (["a"-"z","A"-"Z","0"-"9","_"])* > | < OCTALINT : "0" (["0"-"7"])* (["u","U","l","L"])? > | < DECIMALINT : ["1"-"9"] (["0"-"9"])* (["u","U","l","L"])? > | < HEXADECIMALINT : ("0x"|"0X") (["0"-"9","a"-"f","A"-"F"])+ (["u","U","l","L"])? > | < FLOATONE : ((["0"-"9"])+ "." (["0"-"9"])* | (["0"-"9"])* "." (["0"-"9"])+) (["e","E"] (["-","+"])? (["0"-"9"])+)? (["f","F","l","L"])? > | < FLOATTWO : (["0"-"9"])+ ["e","E"] (["-","+"])? (["0"-"9"])+ (["f","F","l","L"])? > | < CHARACTER : "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","v","b","r","f","a","\\","?","'","\""] | "0" (["0"-"7"])* | ["1"-"9"] (["0"-"9"])* | ("0x" | "0X") (["0"-"9","a"-"f","A"-"F"])+ ) ) ) "'" > | < STRING : "\"" ( ( ~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","v","b","r","f","a","\\","?","'","\""] | "0" (["0"-"7"])* | ["1"-"9"] (["0"-"9"])* | ("0x" | "0X") (["0"-"9","a"-"f","A"-"F"])+ ) ) )* "\"" > } javacc-5.0.orig/examples/JavaCCGrammar/0000755000175000017500000000000011247044051016742 5ustar mkochmkochjavacc-5.0.orig/examples/JavaCCGrammar/JavaCC.jj0000644000175000017500000006555310535127037020401 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { JAVA_UNICODE_ESCAPE = true; } PARSER_BEGIN(JavaCCParser) public class JavaCCParser { public static void main(String args[]) { JavaCCParser parser; if (args.length == 0) { System.out.println("JavaCC Parser: Reading from standard input . . ."); parser = new JavaCCParser(System.in); } else if (args.length == 1) { System.out.println("JavaCC Parser: Reading from file " + args[0] + " . . ."); try { parser = new JavaCCParser(new java.io.FileInputStream(args[0])); } catch (java.io.FileNotFoundException e) { System.out.println("JavaCC Parser: File " + args[0] + " not found."); return; } } else { System.out.println("JavaCC Parser: Usage is one of:"); System.out.println(" java JavaCCParser < inputfile"); System.out.println("OR"); System.out.println(" java JavaCCParser inputfile"); return; } try { parser.javacc_input(); System.out.println("JavaCC Parser: Java program parsed successfully."); } catch (ParseException e) { System.out.println(e.getMessage()); System.out.println("JavaCC Parser: Encountered errors during parse."); } } /* * Returns true if the next token is not in the FOLLOW list of "expansion". * It is used to decide when the end of an "expansion" has been reached. */ static private boolean notTailOfExpansionUnit() { Token t; t = getToken(1); if (t.kind == BIT_OR || t.kind == COMMA || t.kind == RPAREN || t.kind == RBRACE || t.kind == RBRACKET) return false; return true; } } PARSER_END(JavaCCParser) /********************************************** * THE JAVACC TOKEN SPECIFICATION STARTS HERE * **********************************************/ /* JAVACC RESERVED WORDS: These are the only tokens in JavaCC but not in Java */ TOKEN : { < _OPTIONS: "options" > | < _LOOKAHEAD: "LOOKAHEAD" > | < _IGNORE_CASE: "IGNORE_CASE" > | < _PARSER_BEGIN: "PARSER_BEGIN" > | < _PARSER_END: "PARSER_END" > | < _JAVACODE: "JAVACODE" > | < _TOKEN: "TOKEN" > | < _SPECIAL_TOKEN: "SPECIAL_TOKEN" > | < _MORE: "MORE" > | < _SKIP: "SKIP" > | < _TOKEN_MGR_DECLS: "TOKEN_MGR_DECLS" > | < _EOF: "EOF" > } /* * The remainder of the tokens are exactly (except for the removal of tokens * containing ">>" and "<<") as in the Java grammar and must be diff equivalent * (again with the exceptions above) to it. */ /* WHITE SPACE */ SKIP : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* JAVA RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* JAVA LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: (|)* > | < #LETTER: [ "\u0024", "\u0041"-"\u005a", "\u005f", "\u0061"-"\u007a", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u00ff", "\u0100"-"\u1fff", "\u3040"-"\u318f", "\u3300"-"\u337f", "\u3400"-"\u3d2d", "\u4e00"-"\u9fff", "\uf900"-"\ufaff" ] > | < #DIGIT: [ "\u0030"-"\u0039", "\u0660"-"\u0669", "\u06f0"-"\u06f9", "\u0966"-"\u096f", "\u09e6"-"\u09ef", "\u0a66"-"\u0a6f", "\u0ae6"-"\u0aef", "\u0b66"-"\u0b6f", "\u0be7"-"\u0bef", "\u0c66"-"\u0c6f", "\u0ce6"-"\u0cef", "\u0d66"-"\u0d6f", "\u0e50"-"\u0e59", "\u0ed0"-"\u0ed9", "\u1040"-"\u1049" ] > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > | < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > // | < LSHIFT: "<<" > // | < RSIGNEDSHIFT: ">>" > // | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > // | < LSHIFTASSIGN: "<<=" > // | < RSIGNEDSHIFTASSIGN: ">>=" > // | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /************************************************ * THE JAVACC GRAMMAR SPECIFICATION STARTS HERE * ************************************************/ void javacc_input() : {} { javacc_options() "PARSER_BEGIN" "(" identifier() ")" CompilationUnit() "PARSER_END" "(" identifier() ")" ( production() )+ } void javacc_options() : {} { [ "options" "{" ( option_binding() )+ "}" ] } void option_binding() : {} { ( | "LOOKAHEAD" | "IGNORE_CASE" | "static" ) "=" ( IntegerLiteral() | BooleanLiteral() | StringLiteral() ) ";" } void production() : {} { LOOKAHEAD(1) /* * Since JAVACODE is both a JavaCC reserved word and a Java identifier, * we need to give preference to "javacode_production" over * "bnf_production". */ javacode_production() | LOOKAHEAD(1) /* * Since SKIP, TOKEN, etc. are both JavaCC reserved words and Java * identifiers, we need to give preference to "regular_expression_production" * over "bnf_production". */ regular_expr_production() | LOOKAHEAD(1) /* * Since TOKEN_MGR_DECLS is both a JavaCC reserved word and a Java identifier, * we need to give preference to "token_manager_decls" over * "bnf_production". */ token_manager_decls() | bnf_production() } void javacode_production() : {} { "JAVACODE" ResultType() identifier() FormalParameters() [ "throws" Name() ( "," Name() )* ] [ node_descriptor() ] Block() } void bnf_production() : {} { ResultType() identifier() FormalParameters() [ "throws" Name() ( "," Name() )* ] [ node_descriptor() ] ":" Block() "{" expansion_choices() "}" } void regular_expr_production() : {} { [ LOOKAHEAD(2) "<" "*" ">" | "<" ( "," )* ">" ] regexpr_kind() [ "[" "IGNORE_CASE" "]" ] ":" "{" regexpr_spec() ( "|" regexpr_spec() )* "}" } void token_manager_decls() : {} { "TOKEN_MGR_DECLS" ":" ClassBody() } void regexpr_kind() : {} { "TOKEN" | "SPECIAL_TOKEN" | "SKIP" | "MORE" } void regexpr_spec() : {} { regular_expression() [ Block() ] [ ":" ] } void expansion_choices() : {} { expansion() ( "|" expansion() )* } void expansion() : {} { ( LOOKAHEAD(1) "LOOKAHEAD" "(" local_lookahead() ")" )? ( LOOKAHEAD(0, { notTailOfExpansionUnit() } ) expansion_unit() [ node_descriptor() ] )+ } void local_lookahead() : { boolean commaAtEnd = false, emptyLA = true; } { [ /* * The lookahead of 1 is to turn off the warning message that lets * us know that an expansion choice can also start with an integer * literal because a primary expression can do the same. But we * know that this is what we want. */ LOOKAHEAD(1) IntegerLiteral() { emptyLA = false; } ] [ LOOKAHEAD(0, { !emptyLA && (getToken(1).kind != RPAREN) } ) "," { commaAtEnd = true; } ] [ LOOKAHEAD(0, { getToken(1).kind != RPAREN && getToken(1).kind != LBRACE } ) expansion_choices() { emptyLA = false; commaAtEnd = false; } ] [ LOOKAHEAD(0, { !emptyLA && !commaAtEnd && (getToken(1).kind != RPAREN) } ) "," { commaAtEnd = true; } ] [ LOOKAHEAD(0, { emptyLA || commaAtEnd } ) "{" Expression() "}" ] } void expansion_unit() : {} { LOOKAHEAD(1) /* * We give this priority over primary expressions which use LOOKAHEAD as the * name of its identifier. */ "LOOKAHEAD" "(" local_lookahead() ")" | Block() | "[" expansion_choices() "]" | "try" "{" expansion_choices() "}" ( "catch" "(" Name() ")" Block() )* [ "finally" Block() ] | LOOKAHEAD( identifier() | StringLiteral() | "<" | PrimaryExpression() "=" ) [ LOOKAHEAD(PrimaryExpression() "=") PrimaryExpression() "=" ] ( regular_expression() | identifier() Arguments() ) | "(" expansion_choices() ")" ( "+" | "*" | "?" )? } void regular_expression() : {} { StringLiteral() | LOOKAHEAD(3) "<" [ [ "#" ] identifier() ":" ] complex_regular_expression_choices() ">" | LOOKAHEAD(2) "<" identifier() ">" | "<" "EOF" ">" } void complex_regular_expression_choices() : {} { complex_regular_expression() ( "|" complex_regular_expression() )* } void complex_regular_expression() : {} { ( complex_regular_expression_unit() )+ } void complex_regular_expression_unit() : {} { StringLiteral() | "<" identifier() ">" | character_list() | "(" complex_regular_expression_choices() ")" ( "+" | "*" | "?" )? } void character_list() : {} { [ "~" ] "[" [ character_descriptor() ( "," character_descriptor() )* ] "]" } void character_descriptor() : {} { StringLiteral() [ "-" StringLiteral() ] } void identifier() : {} { } /********************************************** * THE JJTREE PRODUCTIONS START HERE * **********************************************/ void node_descriptor() : {} { "#" ( | ) [ LOOKAHEAD(1) "(" [ ">" ] node_descriptor_expression() ")" ] } JAVACODE void node_descriptor_expression() { Token tok; int nesting = 1; while (true) { tok = getToken(1); if (tok.kind == 0) { throw new ParseException(); } if (tok.kind == LPAREN) nesting++; if (tok.kind == RPAREN) { nesting--; if (nesting == 0) break; } tok = getNextToken(); } } /********************************************** * THE JAVA GRAMMAR SPECIFICATION STARTS HERE * **********************************************/ /* * The Java grammar is modified to use sequences of tokens * for the missing tokens - those that include "<<" and ">>". */ /* * The following production defines Java identifiers - it * includes the reserved words of JavaCC also. */ void JavaIdentifier() : {} { | "options" | "LOOKAHEAD" | "IGNORE_CASE" | "PARSER_BEGIN" | "PARSER_END" | "JAVACODE" | "TOKEN" | "SPECIAL_TOKEN" | "MORE" | "SKIP" | "TOKEN_MGR_DECLS" | "EOF" } /* * The productions for the missing code follows. Obviously * these productions accept more than what is legal in Java, * but that is OK for our purposes. */ void ShiftOps() : {} { "<" "<" | ">" ">" [ ">" ] } void OtherAssignmentOps() : {} { "<" "<=" | ">" [ ">" ] ">=" } /* * Program structuring syntax follows. */ void CompilationUnit() : /* * The is deleted since the compilation unit is embedded * within grammar code. To parse to CompilationUnit, we use * a special production JavaCompilationUnit below. */ {} { [ PackageDeclaration() ] ( ImportDeclaration() )* ( TypeDeclaration() )* } void JavaCompilationUnit() : /* * Use this to parse a Java compilation unit. */ {} { CompilationUnit() } void PackageDeclaration() : {} { "package" Name() ";" } void ImportDeclaration() : {} { "import" Name() [ "." "*" ] ";" } void TypeDeclaration() : {} { LOOKAHEAD( ( "abstract" | "final" | "public" )* "class" ) ClassDeclaration() | InterfaceDeclaration() | ";" } /* * Declaration syntax follows. */ void ClassDeclaration() : {} { ( "abstract" | "final" | "public" )* UnmodifiedClassDeclaration() } void UnmodifiedClassDeclaration() : {} { "class" JavaIdentifier() [ "extends" Name() ] [ "implements" NameList() ] ClassBody() } void ClassBody() : {} { "{" ( ClassBodyDeclaration() )* "}" } void NestedClassDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedClassDeclaration() } void ClassBodyDeclaration() : {} { LOOKAHEAD(2) Initializer() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( [ "public" | "protected" | "private" ] Name() "(" ) ConstructorDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } // This production is to determine lookahead only. void MethodDeclarationLookahead() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() JavaIdentifier() "(" } void InterfaceDeclaration() : {} { ( "abstract" | "public" )* UnmodifiedInterfaceDeclaration() } void NestedInterfaceDeclaration() : {} { ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* UnmodifiedInterfaceDeclaration() } void UnmodifiedInterfaceDeclaration() : {} { "interface" JavaIdentifier() [ "extends" NameList() ] "{" ( InterfaceMemberDeclaration() )* "}" } void InterfaceMemberDeclaration() : {} { LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "class" ) NestedClassDeclaration() | LOOKAHEAD( ( "static" | "abstract" | "final" | "public" | "protected" | "private" )* "interface" ) NestedInterfaceDeclaration() | LOOKAHEAD( MethodDeclarationLookahead() ) MethodDeclaration() | FieldDeclaration() } void FieldDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "final" | "transient" | "volatile" )* Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator() : {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId() : {} { JavaIdentifier() ( "[" "]" )* } void VariableInitializer() : {} { ArrayInitializer() | Expression() } void ArrayInitializer() : {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration() : {} { ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" )* ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator() : {} { JavaIdentifier() FormalParameters() ( "[" "]" )* } void FormalParameters() : {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter() : {} { [ "final" ] Type() VariableDeclaratorId() } void ConstructorDeclaration() : {} { [ "public" | "protected" | "private" ] JavaIdentifier() FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation() : {} { LOOKAHEAD("this" Arguments() ";") "this" Arguments() ";" | [ LOOKAHEAD(2) PrimaryExpression() "." ] "super" Arguments() ";" } void Initializer() : {} { [ "static" ] Block() } /* * Type, name and expression syntax follows. */ void Type() : {} { ( PrimitiveType() | Name() ) ( "[" "]" )* } void PrimitiveType() : {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { "void" | Type() } void Name() : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ {} { JavaIdentifier() ( LOOKAHEAD(2) "." JavaIdentifier() )* } void NameList() : {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ {} { ConditionalExpression() [ AssignmentOperator() Expression() ] } void AssignmentOperator() : {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "&=" | "^=" | "|=" | OtherAssignmentOps() } void ConditionalExpression() : {} { ConditionalOrExpression() [ "?" Expression() ":" ConditionalExpression() ] } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^" AndExpression() )* } void AndExpression() : {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression() : {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression() : {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression() : {} { /* * The lookahead of 2 below is due to the fact that we have split * the shift and shift assignment operator into multiple tokens that * now clash with these tokens. */ ShiftExpression() ( LOOKAHEAD(2) ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression() : {} { /* * The lookahead of 3 below is due to the fact that we have split * the shift and shift assignment operator into multiple tokens that * now clash with these tokens and the relational operators. */ AdditiveExpression() ( LOOKAHEAD(3) ( ShiftOps() ) AdditiveExpression() )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression() : {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression() : {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression() : {} { "++" PrimaryExpression() } void PreDecrementExpression() : {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus() : {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead() : {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Name() "[") "(" Name() "[" "]" | "(" Name() ")" ( "~" | "!" | "(" | JavaIdentifier() | "this" | "super" | "new" | Literal() ) } void PostfixExpression() : {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression() : {} { LOOKAHEAD("(" PrimitiveType()) "(" Type() ")" UnaryExpression() | LOOKAHEAD("(" Name()) "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() : {} { PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* } void PrimaryPrefix() : {} { Literal() | "this" | "super" "." JavaIdentifier() | "(" Expression() ")" | AllocationExpression() | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class" | Name() } void PrimarySuffix() : {} { LOOKAHEAD(2) "." "this" | LOOKAHEAD(2) "." AllocationExpression() | "[" Expression() "]" | "." JavaIdentifier() | Arguments() } void Literal() : {} { | | | | BooleanLiteral() | NullLiteral() } void IntegerLiteral() : {} { } void BooleanLiteral() : {} { "true" | "false" } void StringLiteral() : {} { } void NullLiteral() : {} { "null" } void Arguments() : {} { "(" [ ArgumentList() ] ")" } void ArgumentList() : {} { Expression() ( "," Expression() )* } void AllocationExpression() : {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimsAndInits() | "new" Name() ( ArrayDimsAndInits() | Arguments() [ ClassBody() ] ) } /* * The second LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimsAndInits() : {} { LOOKAHEAD(2) ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* | ( "[" "]" )+ ArrayInitializer() } /* * Statement syntax follows. */ void Statement() : {} { LOOKAHEAD(2) LabeledStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void LabeledStatement() : {} { JavaIdentifier() ":" Statement() } void Block() : {} { "{" ( BlockStatement() )* "}" } void BlockStatement() : {} { LOOKAHEAD([ "final" ] Type() JavaIdentifier()) LocalVariableDeclaration() ";" | Statement() | UnmodifiedClassDeclaration() | UnmodifiedInterfaceDeclaration() } void LocalVariableDeclaration() : {} { [ "final" ] Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement() : {} { ";" } void StatementExpression() : /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ {} { PreIncrementExpression() | PreDecrementExpression() | PrimaryExpression() [ "++" | "--" | AssignmentOperator() Expression() ] } void SwitchStatement() : {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel() : {} { "case" Expression() ":" | "default" ":" } void IfStatement() : /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void DoStatement() : {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement() : {} { "for" "(" [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ")" Statement() } void ForInit() : {} { LOOKAHEAD( [ "final" ] Type() JavaIdentifier() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList() : {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate() : {} { StatementExpressionList() } void BreakStatement() : {} { "break" [ JavaIdentifier() ] ";" } void ContinueStatement() : {} { "continue" [ JavaIdentifier() ] ";" } void ReturnStatement() : {} { "return" [ Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement() : {} { "synchronized" "(" Expression() ")" Block() } void TryStatement() : /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } javacc-5.0.orig/examples/MailProcessing/0000755000175000017500000000000011247044052017264 5ustar mkochmkochjavacc-5.0.orig/examples/MailProcessing/Faq.jj0000644000175000017500000001147610535127041020330 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Faq) import java.io.*; public class Faq { static int count = 0; static int beginAt = 1; static PrintWriter indstr; static { try { indstr = new PrintWriter(new FileWriter("index.html")); indstr.println("Selected list of emails from the JavaCC mailing list"); indstr.println("

Selected list of emails from the JavaCC mailing list

"); } catch (IOException e) { throw new Error(); } } static String fix(String s) { String retval = ""; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '<') { retval += "<"; } else if (c == '>') { retval += ">"; } else { retval += c; } } return retval; } public static void main(String args[]) throws ParseException { if (args.length == 1) { beginAt = Integer.parseInt(args[0]); } Faq parser = new Faq(System.in); parser.MailFile(); } } PARSER_END(Faq) // PARSER SPECIFICATIONS BEGIN HERE void MailFile() : { } { ( { count++; } MailMessage() { System.out.print(count + "."); System.out.flush(); } )* { System.out.println(""); indstr.close(); } } void MailMessage() : { PrintWriter msgstr = null; Token subj=null, from=null, date=null, body; if (count >= beginAt) { try { msgstr = new PrintWriter(new FileWriter(count + ".html")); } catch (IOException e) { throw new Error(); } } } { ( subj= | from= | date= )+ { indstr.print("
"); if (subj == null) { indstr.println("no subject
"); } else { indstr.println(fix(subj.image) + "
"); } if (count >= beginAt) { msgstr.println("" + ((subj==null) ? "no subject" : fix(subj.image)) + ""); msgstr.println("Subject: " + ((subj==null) ? "no subject" : fix(subj.image)) + "
"); msgstr.println("From: " + ((from==null) ? "" : fix(from.image)) + "
"); msgstr.println("Date: " + ((date==null) ? "" : fix(date.image)) + "
"); msgstr.println("
"); } } ( body= { if (count >= beginAt) { msgstr.print(fix(body.image) + "
"); } } )* { if (count >= beginAt) { msgstr.close(); } } } // LEXICAL SPECIFICATIONS BEGIN HERE TOKEN: { <#EOL: "\n" | "\r" | "\r\n"> | <#TWOEOLS: (("\n"|"\r\n") ) | ("\r\r" [ "\n" ])> | <#NOT_EOL: ~["\n","\r"]> } SKIP: { < "*** EOOH ***" > : MAILHEADER | <~[]> } SKIP: { <_TWOEOLS: > : MAILBODY // We cannot have just a reference to a regular expression in a // lexical specification - i.e., we cannot simply have . | "Subject: " : MAILSUBJECT | "From: " : MAILFROM | "Date: " : MAILDATE | <~[]> } TOKEN: { )+> } SKIP: { <_EOL1: > : MAILHEADER } TOKEN: { )+> } SKIP: { <_EOL2: > : MAILHEADER } TOKEN: { )+> } SKIP: { <_EOL3: > : MAILHEADER } TOKEN: { > | : DEFAULT } javacc-5.0.orig/examples/MailProcessing/sampleMailFile0000644000175000017500000002501510535127041022075 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ BABYL OPTIONS: Version: 5 Labels: Note: This is the header of an rmail file. Note: If you are seeing it in rmail, Note: it means the file has no messages in it.  1, filed,, Summary-line: 11-Jan sreeni@cs.albany.edu #A note on using RE's matching the emty string Return-Path: Received: from Eng.Sun.COM by schizophrenia.Eng.Sun.COM (SMI-8.6/SMI-SVR4) id HAA21134; Sat, 11 Jan 1997 07:47:28 -0800 Received: from sunmail1.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) id HAA02652; Sat, 11 Jan 1997 07:44:26 -0800 Received: from Eng.Sun.COM by sunmail1.Sun.COM (SMI-8.6/SMI-4.1) id HAA06974; Sat, 11 Jan 1997 07:44:26 -0800 Received: from suntest.Eng.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) id HAA02640; Sat, 11 Jan 1997 07:44:24 -0800 Received: from asap.Eng.Sun.COM by suntest.Eng.Sun.COM (SMI-8.6/SMI-SVR4) id HAA21295; Sat, 11 Jan 1997 07:44:18 -0800 Received: from Eng.Sun.COM by asap.Eng.Sun.COM (SMI-8.6/SMI-SVR4) id HAA24684; Sat, 11 Jan 1997 07:44:19 -0800 Received: from mercury.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) id HAA02630; Sat, 11 Jan 1997 07:44:17 -0800 Received: from cs.albany.edu (cs.albany.edu [169.226.2.22]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id HAA01828 for ; Sat, 11 Jan 1997 07:44:18 -0800 Received: from bhaskara.cs.albany.edu (sreeni@bhaskara.cs.albany.edu [169.226.2.60]) by cs.albany.edu (8.7.4/HUB03) with ESMTP id KAA01464; Sat, 11 Jan 1997 10:44:06 -0500 (EST) Received: (from sreeni@localhost) by bhaskara.cs.albany.edu (8.7.4/CLI2) id KAA09608; Sat, 11 Jan 1997 10:43:58 -0500 (EST) From: Sreenivasa Rao Viswanadha Date: Sat, 11 Jan 1997 10:43:58 -0500 (EST) Message-Id: <199701111543.KAA09608@bhaskara.cs.albany.edu> To: jack-interest@asap.Eng.Sun.COM Subject: A note on using RE's matching the emty string Cc: sreeni@cs.albany.edu X-Sun-Charset: US-ASCII Content-Type: text Content-Length: 1639 X-Lines: 32 Status: RO *** EOOH *** Return-Path: From: Sreenivasa Rao Viswanadha Date: Sat, 11 Jan 1997 10:43:58 -0500 (EST) To: jack-interest@asap.Eng.Sun.COM Subject: A note on using RE's matching the emty string Cc: sreeni@cs.albany.edu X-Sun-Charset: US-ASCII Content-Type: text Content-Length: 1639 X-Lines: 32 In the last couple of days, we had seen a couple of users facing problems with regular expressions that match "". There is a minor bug in the way it is implemented in 0.6.-9. We will fix it. But the purpose of this mail is to suggest you should be careful when you use RE's that match the "" string. Consider the following example of string literals where two consecutive "" are interpreted as the literal " (equivalent to \" in Java). < STRING_LITERAL: ( "\"" (~["\""])* "\"" )* > This will work in general. But, if this a part of a lot of other lexical rules, then if there a lexical error, say a char is given that cannot be the first one of any token, then, the lexer decides to use the empty string "" and match it as STRING_LITERAL without actually giving the lexical error. And since this is the empty string, no character will be consumed and you will start getting the same STRING_LITERAL token (with "" as the image) infinte number of times. In fact, if this was the only lexical rule, then if you give a input that starts with any char other than the ", you will get into an infinite loop. So a better alternative is to use the + operator which will not match the empty string. As a matter of fact, I don't know any practical grammar where matching "" is useful. In version 0.5, the lexer generated implicitly treated it as + (which is not totally right). But in 0.6.-9, it does it right and so there is a chance that your grammar that used to work with 0.5 will not work with 0.6.-9. So if you have any top-level lexical rule with ? or *, please change those rules so that they don't match the empty string "". Sreeni.  1,, Summary-line: 11-Jan kimbo@highway1.com #Re: Looking for HTML.jack Return-Path: Received: from Eng.Sun.COM by schizophrenia.Eng.Sun.COM (SMI-8.6/SMI-SVR4) id QAA21339; Sat, 11 Jan 1997 16:41:53 -0800 Received: from sunmail1.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) id QAA18458; Sat, 11 Jan 1997 16:38:44 -0800 Received: from Eng.Sun.COM by sunmail1.Sun.COM (SMI-8.6/SMI-4.1) id QAA16642; Sat, 11 Jan 1997 16:38:51 -0800 Received: from suntest.Eng.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) id QAA18449; Sat, 11 Jan 1997 16:38:42 -0800 Received: from asap.Eng.Sun.COM by suntest.Eng.Sun.COM (SMI-8.6/SMI-SVR4) id QAA23127; Sat, 11 Jan 1997 16:38:42 -0800 Received: from Eng.Sun.COM by asap.Eng.Sun.COM (SMI-8.6/SMI-SVR4) id QAA24956; Sat, 11 Jan 1997 16:38:41 -0800 Received: from mercury.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) id QAA18438; Sat, 11 Jan 1997 16:38:36 -0800 Received: from chmls01.highway1.com (ne.highway1.com [24.128.1.82]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id QAA22125 for ; Sat, 11 Jan 1997 16:38:42 -0800 Received: from papa ([24.128.36.164]) by chmls01.highway1.com (Netscape Mail Server v2.0) with SMTP id AAA17669; Sat, 11 Jan 1997 19:38:31 -0400 Message-ID: <32D83288.5A8@highway1.com> Date: Sat, 11 Jan 1997 19:38:32 -0500 From: kimbo@highway1.com (Kimbo Mundy) X-Mailer: Mozilla 3.0Gold (WinNT; U) MIME-Version: 1.0 To: Rupert Nagler CC: jack-interest@asap.Eng.Sun.COM Subject: Re: Looking for HTML.jack References: <1.5.4.32.19970111214054.0069e40c@mail.austria.eu.net> Content-Transfer-Encoding: 7bit X-Lines: 13 Status: RO Content-Type: text/plain; charset="us-ascii" Content-Length: 447 *** EOOH *** Return-Path: Date: Sat, 11 Jan 1997 19:38:32 -0500 From: kimbo@highway1.com (Kimbo Mundy) X-Mailer: Mozilla 3.0Gold (WinNT; U) MIME-Version: 1.0 To: Rupert Nagler CC: jack-interest@asap.Eng.Sun.COM Subject: Re: Looking for HTML.jack References: <1.5.4.32.19970111214054.0069e40c@mail.austria.eu.net> Content-Transfer-Encoding: 7bit X-Lines: 13 Content-Type: text/plain; charset="us-ascii" Content-Length: 447 Rupert Nagler wrote: > > I am very impressed by the Jack-Concept and I am looking for a "HTML.jack". > Is there anybody out there who has an example of a Jack-Definition file for > HTML 3.2? I previously sent a message entitled "A first cut at an HTML grammar". Did people not get it? If not, see: http://www.tiac.net/users/kimbo/jack/HTML.jack > Is there a way to construct a *.jack file out of a *.sgml file? Sorry, I can't help with this.  1,, Summary-line: 13-Jan kimbo@highway1.com #Re: HTML? Return-Path: Received: from suntest.Eng.Sun.COM by schizophrenia.Eng.Sun.COM (SMI-8.6/SMI-SVR4) id XAA21746; Sun, 12 Jan 1997 23:06:34 -0800 Received: from Eng.Sun.COM by suntest.Eng.Sun.COM (SMI-8.6/SMI-SVR4) id XAA29422; Sun, 12 Jan 1997 23:03:31 -0800 Received: from mercury.Sun.COM by Eng.Sun.COM (SMI-8.6/SMI-5.3) id XAA07269; Sun, 12 Jan 1997 23:03:30 -0800 Received: from chmls01.highway1.com (ne.highway1.com [24.128.1.82]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id XAA18021 for ; Sun, 12 Jan 1997 23:03:30 -0800 Received: from papa ([24.128.36.164]) by chmls01.highway1.com (Netscape Mail Server v2.0) with SMTP id AAA20062 for ; Mon, 13 Jan 1997 02:03:25 -0400 Message-ID: <32D9DE40.3604@highway1.com> Date: Mon, 13 Jan 1997 02:03:28 -0500 From: kimbo@highway1.com (Kimbo Mundy) X-Mailer: Mozilla 3.0Gold (WinNT; U) MIME-Version: 1.0 To: Sriram Sankar Subject: Re: HTML? References: <199612162037.MAA29649@schizophrenia.Eng.Sun.COM> Content-Transfer-Encoding: 7bit X-Lines: 34 Status: RO Content-Type: text/plain; charset="us-ascii" Content-Length: 1420 *** EOOH *** Return-Path: Date: Mon, 13 Jan 1997 02:03:28 -0500 From: kimbo@highway1.com (Kimbo Mundy) X-Mailer: Mozilla 3.0Gold (WinNT; U) MIME-Version: 1.0 To: Sriram Sankar Subject: Re: HTML? References: <199612162037.MAA29649@schizophrenia.Eng.Sun.COM> Content-Transfer-Encoding: 7bit X-Lines: 34 Content-Type: text/plain; charset="us-ascii" Content-Length: 1420 Well, I finally got an HTML grammar out there (at http://www.tiac.net/users/kimbo/jack/HTML.jack). I hope you saw it, I got some mailer errors, that seemed like the kind that you could ignore, but at least one person didn't receive my first posting. I'd be interested to know if this is the sort of thing people are looking for, or do they want the full set of tags enumerated in the grammar as well? Also, if there you have any desire to bundle this with Jack (possibly after upgrades and/or integration with other people's work), please feel free. I must say Jack is an amazing tool. It was really easy to learn. I love how readable the grammars are, and I love being able to pass info up and down the productions as the parser runs. I never want to have to settle for LALR(1) again! Thanks for writing it!  javacc-5.0.orig/examples/MailProcessing/Digest.jj0000644000175000017500000001047010535127041021031 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ PARSER_BEGIN(Digest) import java.io.*; public class Digest { static int count = 0; static String buffer = ""; public static void main(String args[]) throws ParseException { Digest parser = new Digest(System.in); System.out.println("DIGEST OF RECENT MESSAGES FROM THE JAVACC MAILING LIST"); System.out.println("----------------------------------------------------------------------"); System.out.println(""); System.out.println("MESSAGE SUMMARY:"); System.out.println(""); parser.MailFile(); if (count == 0) { System.out.println("There have been no messages since the last digest posting."); System.out.println(""); System.out.println("----------------------------------------------------------------------"); } else { System.out.println(""); System.out.println("----------------------------------------------------------------------"); System.out.println(""); System.out.println(buffer); } } } PARSER_END(Digest) // PARSER SPECIFICATIONS BEGIN HERE void MailFile() : { } { ( { count++; } MailMessage() )* } void MailMessage() : { Token subj=null, from=null, date=null, body; } { ( subj= | from= | date= )+ { System.out.println(count + ". " + ((subj==null) ? "no subject" : subj.image)); buffer += "\n"; buffer += "Message " + count + ":\n"; buffer += "\n"; buffer += "Subject: " + ((subj==null) ? "no subject" : subj.image) + "\n"; buffer += "From: " + ((from==null) ? "" : from.image) + "\n"; buffer += "Date: " + ((date==null) ? "" : date.image) + "\n"; buffer += "\n"; } ( body= { buffer += body.image; } )* { buffer += "\n"; buffer += "----------------------------------------------------------------------\n"; } } // LEXICAL SPECIFICATIONS BEGIN HERE TOKEN: { <#EOL: "\n" | "\r" | "\r\n"> | <#TWOEOLS: (("\n"|"\r\n") ) | ("\r\r" [ "\n" ])> | <#NOT_EOL: ~["\n","\r"]> } SKIP: { < "*** EOOH ***" > : MAILHEADER | <~[]> } SKIP: { <_TWOEOLS: > : MAILBODY // We cannot have just a reference to a regular expression in a // lexical specification - i.e., we cannot simply have . | "Subject: " : MAILSUBJECT | "From: " : MAILFROM | "Date: " : MAILDATE | <~[]> } TOKEN: { )+> } SKIP: { <_EOL1: > : MAILHEADER } TOKEN: { )+> } SKIP: { <_EOL2: > : MAILHEADER } TOKEN: { )+> } SKIP: { <_EOL3: > : MAILHEADER } TOKEN: { > | : DEFAULT } javacc-5.0.orig/examples/MailProcessing/README0000644000175000017500000001203010535127041020137 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ This example illustrates the use of lexical states. In this directory are two grammar files Digest.jj and Faq.jj. These generate parsers that process RMAIL files that are created by the GNU emacs editor. A sample RMAIL file called sampleMailFile is also included. Digest.jj and Faq.jj are both identical in their grammar and lexical specifications. They only differ in their actions. Digest.jj takes a mail file as standard input and produces a digest version of the messages to standard output. This is what we used (before we moved over to an automatic mailing list software) to produce the weekly mail digest of the JavaCC mailing list. Faq.jj takes a mail file as standard input and produces a mail FAQ in HTML format. It produces a file "index.html" that contains all the mail headers and links to other HTML files called "1.html", "2.html", etc. that contain the 1st, 2nd, etc. messages. The parser generated from Faq.jj accepts an optional integer argument that specifies the message number from where to begin processing. Type the following: javacc Digest.jj javacc Faq.jj javac *.java java Digest < sampleMailFile > digestFile java Faq < sampleMailFile And take a look at the output files created. MORE DETAILS ON HOW THE GRAMMARS WORK: The grammar specification is rather trivial. It simply says that a MailFile is is a sequence of MailMessage's followed by an end of file. And that a MailMessage is a list of one or more 's, 's, and 's followed by a list of zero or more 's followed by an . Essentially, there are five lexical tokens: , : Are the strings of the Subject, From, and Date fields of the message. : Is a single line of the message body. : is the end of message token. The lexical specification starts with a set of reusable private regular expressions EOL, TWOEOLS, and NOT_EOL. These are defined to be portable across different platforms where the end of line characters are different. In the lexical state, the token manager simply eats up characters until it sees the beginning of a message which is marked by < "*** EOOH ***" >. See the sample mail file for details. At this point, it switches to state . In the state , two consecutive end of line's indicate the end of the mail header and therefore the token manager goes to the lexical state. Also, if it sees "Subject: ", it goes to the lexical state, and similarly for "From: " and "Date: ". The end of message is signified by the "^_" character, of "\u001f". The state returns to the state when it sees this character, otherwise it simply returns message body lines one by one. The general flow chart for the lexical states is shown below. It is useful to make such a diagram when building complex lexical specifications. ---> --+--> -->+ ^ | ^ | | | | | | | | | | +--> ----->+ +- <--+ | | | | | | | +--> ----->+ | | | | +----------------------------+ javacc-5.0.orig/makedist0000755000175000017500000000426210535127030014257 0ustar mkochmkoch#!/bin/sh -f # Copyright (c) 2006, Sun Microsystems, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the Sun Microsystems, Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF # THE POSSIBILITY OF SUCH DAMAGE. install_name="javacc-$1" export install_name /bin/rm -rf dist /bin/rm -f ${install_name}.tar.gz /bin/rm -f ${install_name}.zip mkdir -p dist/${install_name} cp -rf bin dist/${install_name}/bin chmod a+x dist/${install_name}/bin/javacc chmod a+x dist/${install_name}/bin/jjdoc chmod a+x dist/${install_name}/bin/jjtree cp -rf www/doc dist/${install_name}/doc cp -rf examples dist/${install_name}/examples cp -rf LICENSE dist/${install_name} find dist -name CVS -exec /bin/rm -rf {} \; 1> /dev/null 2>&1 cd dist tar cpf ../${install_name}.tar . gzip ../${install_name}.tar zip -qr ../${install_name}.zip . /bin/rm -rf dist javacc-5.0.orig/version.properties0000644000175000017500000000006011227703632016332 0ustar mkochmkochversion.major=5 version.minor=0 version.patch=0 javacc-5.0.orig/README0000644000175000017500000000460311227706027013417 0ustar mkochmkoch ========== JavaCC 5.0 ========== Copyright (c) 2006, Sun Microsystems, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Sun Microsystems, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SUMMARY JavaCC is an open source compiler compiler. It takes a grammar specification as input and produces a stand-alone parser written in Java. CONTENTS This distribution contains the javacc, jjtree and jjdoc sources, launcher scripts, example grammars and documentation. It also contains a bootstrap version of JavaCC needed to build JavaCC. BUILDING You need ant-1.5.3 or above to build JavaCC. You can get ant from: http://ant.apache.org Once you install ant, make sure ant is in your path. Then you can simply come to this directory (JavaCC source install directory) and type: $ ant it will build the javacc.jar file in the bin/lib directory. On unix-based systems, you need to make sure the files in the bin directory of this distribution are in your path. javacc-5.0.orig/pom.xml0000644000175000017500000010174411227706027014060 0ustar mkochmkoch 5.0.0 net.java.dev.javacc javacc jar JavaCC 4.2 JavaCC is a parser/scanner generator for java. https://javacc.dev.java.net/ java.dev https://javacc.dev.java.net/servlets/ProjectIssues 1996 java.net http://www.java.net/ scm:cvs:pserver:user@cvs.dev.java.net:/cvs:javacc scm:cvs:ext:user@cvs.dev.java.net:/cvs:javacc https://javacc.dev.java.net/source/browse/javacc/ Announce https://javacc.dev.java.net/servlets/SummarizeList?listName=announce Users https://javacc.dev.java.net/servlets/SummarizeList?listName=users Developers https://javacc.dev.java.net/servlets/SummarizeList?listName=dev CVS https://javacc.dev.java.net/servlets/SummarizeList?listName=cvs Issues https://javacc.dev.java.net/servlets/SummarizeList?listName=issues Sreenivasa Viswanadha sreeni sreeni At dev.java.net Owner 0 java.net http://www.java.net/ Tim Pizey timp timp AT paneris.org Maven maven Developer 0 http://paneris.org/~timp Context Computing http://www.context-computing.co.uk/ Berkeley Software Distribution (BSD) License http://www.opensource.org/licenses/bsd-license.html repo src src org.codehaus.mojo javacc-maven-plugin jcc generate-sources javacc org.javacc.parser src\org\javacc\parser jjt generate-sources jjtree **/parser/** org.javacc.jjtree src\org\javacc\jjtree jjt-jcc generate-sources javacc org.javacc.jjtree target\generated-sources\jjtree org.apache.maven.plugins maven-compiler-plugin 5 5 **/*Test.java org.apache.maven.plugins maven-surefire-plugin true once **/*Test.java maven-antrun-plugin overwrite process-sources run tests test ${test.corba.out} ${spl.out1} ${spl.out2} ${spl.out3} ${jjtree.eg1.out} ${jjtree.eg2.out} ${jjtree.eg3.out} ${jjtree.eg4.out} run org.codehaus.mojo cobertura-maven-plugin 2.0 clean net.java.dev.javacc javacc-maven-plugin src/org/javacc/parser org.javacc.parser org.apache.maven.plugins maven-pmd-plugin /rulesets/basic.xml 128m 256 xml true utf-8 100 org.codehaus.mojo jdepend-maven-plugin org.codehaus.mojo taglist-maven-plugin @todo FIXME @deprecated HACK NOTE org.apache.maven.plugins maven-jxr-plugin org.apache.maven.plugins maven-javadoc-plugin 128m 512 org.codehaus.mojo cobertura-maven-plugin 2.0 org.apache.maven.plugins maven-surefire-report-plugin org.apache.maven.plugins maven-site-plugin www en junit junit 3.8.1 compile maven2-repository.dev.java.net Java.net Repository for Maven https://maven2-repository.dev.java.net/nonav/repository default javacc-5.0.orig/build.xml0000644000175000017500000004435311226741735014372 0ustar mkochmkoch ${test.corba.out} ${spl.out1} ${spl.out2} ${spl.out3} ${jjtree.eg1.out} ${jjtree.eg2.out} ${jjtree.eg3.out} ${jjtree.eg4.out} javacc-5.0.orig/LICENSE0000644000175000017500000000300010535127030013522 0ustar mkochmkochCopyright (c) 2006, Sun Microsystems, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Sun Microsystems, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. javacc-5.0.orig/src/0000755000175000017500000000000011247044052013316 5ustar mkochmkochjavacc-5.0.orig/src/jjtree.java0000644000175000017500000000357310751636205015462 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** * Intermediary between OS script and main program of application. * Having this intermediary allows the OS scripts to be package name * independent. */ public final class jjtree { private jjtree() {} public static void main(String[] args) { org.javacc.jjtree.Main.main(args); } } javacc-5.0.orig/src/javacc.java0000644000175000017500000000361210574036573015425 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** * Intermediary between OS script and main program of application. * Having this intermediary allows the OS scripts to be package name * independent. */ public final class javacc { private javacc() {} public static void main(String[] args) throws Exception { org.javacc.parser.Main.main(args); } } javacc-5.0.orig/src/jjdoc.java0000644000175000017500000000361610751636205015266 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /** * Intermediary between OS script and main program of application. * Having this intermediary allows the OS scripts to be package name * independent. */ public final class jjdoc { private jjdoc() {} public static void main(String[] args) throws Exception { org.javacc.jjdoc.JJDocMain.main(args); } } javacc-5.0.orig/src/package.html0000644000175000017500000000064710575555143015621 0ustar mkochmkoch Default package

A package independant layer for ease of use in scripts.

javacc-5.0.orig/src/org/0000755000175000017500000000000011247044052014105 5ustar mkochmkochjavacc-5.0.orig/src/org/javacc/0000755000175000017500000000000011247044054015336 5ustar mkochmkochjavacc-5.0.orig/src/org/javacc/jjdoc/0000755000175000017500000000000011247044052016425 5ustar mkochmkochjavacc-5.0.orig/src/org/javacc/jjdoc/TextGenerator.java0000644000175000017500000001725511070513743022077 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjdoc; import java.io.PrintWriter; import org.javacc.parser.Expansion; import org.javacc.parser.JavaCodeProduction; import org.javacc.parser.NonTerminal; import org.javacc.parser.NormalProduction; import org.javacc.parser.RegularExpression; import org.javacc.parser.TokenProduction; /** * Output BNF in text format. */ public class TextGenerator implements Generator { protected PrintWriter ostr; public TextGenerator() { } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#text(java.lang.String) */ public void text(String s) { print(s); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#print(java.lang.String) */ public void print(String s) { ostr.print(s); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#documentStart() */ public void documentStart() { ostr = create_output_stream(); ostr.print("\nDOCUMENT START\n"); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#documentEnd() */ public void documentEnd() { ostr.print("\nDOCUMENT END\n"); ostr.close(); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#specialTokens(java.lang.String) */ public void specialTokens(String s) { ostr.print(s); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#tokenStart(org.javacc.parser.TokenProduction) */ public void tokenStart(TokenProduction tp) { } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#tokenEnd(org.javacc.parser.TokenProduction) */ public void tokenEnd(TokenProduction tp) { } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#nonterminalsStart() */ public void nonterminalsStart() { text("NON-TERMINALS\n"); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#nonterminalsEnd() */ public void nonterminalsEnd() { } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#tokensStart() */ public void tokensStart() { text("TOKENS\n"); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#tokensEnd() */ public void tokensEnd() { } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#javacode(org.javacc.parser.JavaCodeProduction) */ public void javacode(JavaCodeProduction jp) { productionStart(jp); text("java code"); productionEnd(jp); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#productionStart(org.javacc.parser.NormalProduction) */ public void productionStart(NormalProduction np) { ostr.print("\t" + np.getLhs() + "\t:=\t"); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#productionEnd(org.javacc.parser.NormalProduction) */ public void productionEnd(NormalProduction np) { ostr.print("\n"); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#expansionStart(org.javacc.parser.Expansion, boolean) */ public void expansionStart(Expansion e, boolean first) { if (!first) { ostr.print("\n\t\t|\t"); } } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#expansionEnd(org.javacc.parser.Expansion, boolean) */ public void expansionEnd(Expansion e, boolean first) { } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#nonTerminalStart(org.javacc.parser.NonTerminal) */ public void nonTerminalStart(NonTerminal nt) { } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#nonTerminalEnd(org.javacc.parser.NonTerminal) */ public void nonTerminalEnd(NonTerminal nt) { } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#reStart(org.javacc.parser.RegularExpression) */ public void reStart(RegularExpression r) { } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#reEnd(org.javacc.parser.RegularExpression) */ public void reEnd(RegularExpression r) { } /** * Create an output stream for the generated Jack code. Try to open a file * based on the name of the parser, but if that fails use the standard output * stream. */ protected PrintWriter create_output_stream() { if (JJDocOptions.getOutputFile().equals("")) { if (JJDocGlobals.input_file.equals("standard input")) { return new java.io.PrintWriter( new java.io.OutputStreamWriter( System.out)); } else { String ext = ".html"; if (JJDocOptions.getText()) { ext = ".txt"; } int i = JJDocGlobals.input_file.lastIndexOf('.'); if (i == -1) { JJDocGlobals.output_file = JJDocGlobals.input_file + ext; } else { String suffix = JJDocGlobals.input_file.substring(i); if (suffix.equals(ext)) { JJDocGlobals.output_file = JJDocGlobals.input_file + ext; } else { JJDocGlobals.output_file = JJDocGlobals.input_file.substring(0, i) + ext; } } } } else { JJDocGlobals.output_file = JJDocOptions.getOutputFile(); } try { ostr = new java.io.PrintWriter( new java.io.FileWriter( JJDocGlobals.output_file)); } catch (java.io.IOException e) { error("JJDoc: can't open output stream on file " + JJDocGlobals.output_file + ". Using standard output."); ostr = new java.io.PrintWriter(new java.io.OutputStreamWriter(System.out)); } return ostr; } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#debug(java.lang.String) */ public void debug(String message) { System.err.println(message); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#info(java.lang.String) */ public void info(String message) { System.err.println(message); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#warn(java.lang.String) */ public void warn(String message) { System.err.println(message); } /** * {@inheritDoc} * @see org.javacc.jjdoc.Generator#error(java.lang.String) */ public void error(String message) { System.err.println(message); } } javacc-5.0.orig/src/org/javacc/jjdoc/test/0000755000175000017500000000000011247044053017405 5ustar mkochmkochjavacc-5.0.orig/src/org/javacc/jjdoc/test/JJDocMainTest.java0000644000175000017500000000564010751636206022661 0ustar mkochmkoch/* Copyright (c) 2006, Tim Pizey * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjdoc.test; import org.javacc.JavaCCTestCase; import org.javacc.jjdoc.JJDocMain; /** * @author timp * @since 7 Mar 2007 * */ public class JJDocMainTest extends JavaCCTestCase { /** * @param name */ public JJDocMainTest(String name) { super(name); } /** * {@inheritDoc} * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); } /** * {@inheritDoc} * @see junit.framework.TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /** * Test method for {@link org.javacc.jjdoc.JJDocMain#main(java.lang.String[])}. */ public void testMain() { } /** * Test method for {@link org.javacc.jjdoc.JJDocMain#mainProgram(java.lang.String[])}. */ public void testMainProgramHTML() throws Exception { assertEquals(0, JJDocMain.mainProgram(new String[] {"-OUTPUT_FILE:" + getJJDocOutputDirectory() + "JavaCC.html", getJJInputDirectory() + "JavaCC.jj"})); } /** * Test method for {@link org.javacc.jjdoc.JJDocMain#mainProgram(java.lang.String[])}. */ public void testMainProgramText() throws Exception { assertEquals(0, JJDocMain.mainProgram(new String[] {"-OUTPUT_FILE:" + getJJDocOutputDirectory() + "JavaCC.txt", "-TEXT:true",getJJInputDirectory() + "JavaCC.jj"})); } } javacc-5.0.orig/src/org/javacc/jjdoc/test/package.html0000644000175000017500000000074710574014644021703 0ustar mkochmkoch org.javacc.jjdoc.test

Tests for the org.javacc.jjdoc package.

The tests generate output in the docs directory.

javacc-5.0.orig/src/org/javacc/jjdoc/JJDocMain.java0000644000175000017500000001575111220416762021041 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjdoc; import org.javacc.parser.JavaCCErrors; import org.javacc.parser.JavaCCParser; import org.javacc.parser.Main; /** * Main class. */ public final class JJDocMain extends JJDocGlobals { private JJDocMain() {} static void help_message() { info(""); info(" jjdoc option-settings - (to read from standard input)"); info("OR"); info(" jjdoc option-settings inputfile (to read from a file)"); info(""); info("WHERE"); info(" \"option-settings\" is a sequence of settings separated by spaces."); info(""); info("Each option setting must be of one of the following forms:"); info(""); info(" -optionname=value (e.g., -TEXT=false)"); info(" -optionname:value (e.g., -TEXT:false)"); info(" -optionname (equivalent to -optionname=true. e.g., -TEXT)"); info(" -NOoptionname (equivalent to -optionname=false. e.g., -NOTEXT)"); info(""); info("Option settings are not case-sensitive, so one can say \"-nOtExT\" instead"); info("of \"-NOTEXT\". Option values must be appropriate for the corresponding"); info("option, and must be either an integer, boolean or string value."); info(""); info("The string valued options are:"); info(""); info(" OUTPUT_FILE"); info(" CSS"); info(""); info("The boolean valued options are:"); info(""); info(" ONE_TABLE (default true)"); info(" TEXT (default false)"); info(" BNF (default false)"); info(""); info(""); info("EXAMPLES:"); info(" jjdoc -ONE_TABLE=false mygrammar.jj"); info(" jjdoc - < mygrammar.jj"); info(""); info("ABOUT JJDoc:"); info(" JJDoc generates JavaDoc documentation from JavaCC grammar files."); info(""); info(" For more information, see the online JJDoc documentation at"); info(" https://javacc.dev.java.net/doc/JJDoc.html"); } /** * A main program that exercises the parser. */ public static void main(String args[]) throws Exception { int errorcode = mainProgram(args); System.exit(errorcode); } /** * The method to call to exercise the parser from other Java programs. * It returns an error code. See how the main program above uses * this method. */ public static int mainProgram(String args[]) throws Exception { Main.reInitAll(); JJDocOptions.init(); bannerLine("Documentation Generator", "0.1.4"); JavaCCParser parser = null; if (args.length == 0) { help_message(); return 1; } else { info("(type \"jjdoc\" with no arguments for help)"); } if (JJDocOptions.isOption(args[args.length-1])) { error("Last argument \"" + args[args.length-1] + "\" is not a filename or \"-\". "); return 1; } for (int arg = 0; arg < args.length-1; arg++) { if (!JJDocOptions.isOption(args[arg])) { error("Argument \"" + args[arg] + "\" must be an option setting. "); return 1; } JJDocOptions.setCmdLineOption(args[arg]); } if (args[args.length-1].equals("-")) { info("Reading from standard input . . ."); parser = new JavaCCParser(new java.io.DataInputStream(System.in)); JJDocGlobals.input_file = "standard input"; JJDocGlobals.output_file = "standard output"; } else { info("Reading from file " + args[args.length-1] + " . . ."); try { java.io.File fp = new java.io.File(args[args.length-1]); if (!fp.exists()) { error("File " + args[args.length-1] + " not found."); return 1; } if (fp.isDirectory()) { error(args[args.length-1] + " is a directory. Please use a valid file name."); return 1; } JJDocGlobals.input_file = fp.getName(); parser = new JavaCCParser(new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(args[args.length-1]), JJDocOptions.getGrammarEncoding()))); } catch (SecurityException se) { error("Security violation while trying to open " + args[args.length-1]); return 1; } catch (java.io.FileNotFoundException e) { error("File " + args[args.length-1] + " not found."); return 1; } } try { parser.javacc_input(); JJDoc.start(); if (JavaCCErrors.get_error_count() == 0) { if (JavaCCErrors.get_warning_count() == 0) { info("Grammar documentation generated successfully in " + JJDocGlobals.output_file); } else { info("Grammar documentation generated with 0 errors and " + JavaCCErrors.get_warning_count() + " warnings."); } return 0; } else { error("Detected " + JavaCCErrors.get_error_count() + " errors and " + JavaCCErrors.get_warning_count() + " warnings."); return (JavaCCErrors.get_error_count()==0)?0:1; } } catch (org.javacc.parser.MetaParseException e) { error(e.toString()); error("Detected " + JavaCCErrors.get_error_count() + " errors and " + JavaCCErrors.get_warning_count() + " warnings."); return 1; } catch (org.javacc.parser.ParseException e) { error(e.toString()); error("Detected " + (JavaCCErrors.get_error_count()+1) + " errors and " + JavaCCErrors.get_warning_count() + " warnings."); return 1; } } } javacc-5.0.orig/src/org/javacc/jjdoc/HTMLGenerator.java0000644000175000017500000001365111070513743021713 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjdoc; import java.util.Hashtable; import org.javacc.parser.Expansion; import org.javacc.parser.JavaCodeProduction; import org.javacc.parser.NonTerminal; import org.javacc.parser.NormalProduction; import org.javacc.parser.RegularExpression; import org.javacc.parser.TokenProduction; /** * Output BNF in HTML 3.2 format. */ public class HTMLGenerator extends TextGenerator implements Generator { private Hashtable id_map = new Hashtable(); private int id = 1; public HTMLGenerator() { super(); } protected String get_id(String nt) { String i = (String)id_map.get(nt); if (i == null) { i = "prod" + id++; id_map.put(nt, i); } return i; } private void println(String s) { print(s + "\n"); } public void text(String s) { String ss = ""; for (int i = 0; i < s.length(); ++i) { if (s.charAt(i) == '<') { ss += "<"; } else if (s.charAt(i) == '>') { ss += ">"; } else if (s.charAt(i) == '&') { ss += "&"; } else { ss += s.charAt(i); } } print(ss); } public void print(String s) { ostr.print(s); } public void documentStart() { ostr = create_output_stream(); println(""); println(""); println(""); if (!"".equals(JJDocOptions.getCSS())) { println(""); } if (JJDocGlobals.input_file != null) { println("BNF for " + JJDocGlobals.input_file + ""); } else { println("A BNF grammar by JJDoc"); } println(""); println(""); println("

BNF for " + JJDocGlobals.input_file + "

"); } public void documentEnd() { println(""); println(""); ostr.close(); } /** * Prints out comments, used for tokens and non-terminals. * {@inheritDoc} * @see org.javacc.jjdoc.TextGenerator#specialTokens(java.lang.String) */ public void specialTokens(String s) { println(" "); println(" "); println(" "); println("
");
    print(s);
    println("
"); println(" "); println(" "); } public void tokenStart(TokenProduction tp) { println(" "); println(" "); println(" "); println("
");
  }

  public void tokenEnd(TokenProduction tp) {
    println("   
"); println(" "); println(" "); } public void nonterminalsStart() { println("

NON-TERMINALS

"); if (JJDocOptions.getOneTable()) { println(""); } } public void nonterminalsEnd() { if (JJDocOptions.getOneTable()) { println("
"); } } public void tokensStart() { println("

TOKENS

"); println(""); } public void tokensEnd() { println("
"); } public void javacode(JavaCodeProduction jp) { productionStart(jp); println("java code"); productionEnd(jp); } public void productionStart(NormalProduction np) { if (!JJDocOptions.getOneTable()) { println(""); println(""); println(""); } println(""); println(""); println(""); print("
" + np.getLhs() + "
" + np.getLhs() + "::="); } public void productionEnd(NormalProduction np) { if (!JJDocOptions.getOneTable()) { println("
"); println("
"); } } public void expansionStart(Expansion e, boolean first) { if (!first) { println(""); println(""); println("|"); print(""); } } public void expansionEnd(Expansion e, boolean first) { println(""); println(""); } public void nonTerminalStart(NonTerminal nt) { print(""); } public void nonTerminalEnd(NonTerminal nt) { print(""); } public void reStart(RegularExpression r) { } public void reEnd(RegularExpression r) { } } javacc-5.0.orig/src/org/javacc/jjdoc/BNFGenerator.java0000644000175000017500000001215411220416762021551 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjdoc; import java.util.*; import org.javacc.parser.*; import java.io.*; public class BNFGenerator implements Generator { private Hashtable id_map = new Hashtable(); private int id = 1; protected PrintWriter ostr; private boolean printing = true; protected String get_id(String nt) { String i = (String)id_map.get(nt); if (i == null) { i = "prod" + id++; id_map.put(nt, i); } return i; } protected PrintWriter create_output_stream() { if (JJDocOptions.getOutputFile().equals("")) { if (JJDocGlobals.input_file.equals("standard input")) { return new java.io.PrintWriter( new java.io.OutputStreamWriter( System.out)); } else { String ext = ".bnf"; int i = JJDocGlobals.input_file.lastIndexOf('.'); if (i == -1) { JJDocGlobals.output_file = JJDocGlobals.input_file + ext; } else { String suffix = JJDocGlobals.input_file.substring(i); if (suffix.equals(ext)) { JJDocGlobals.output_file = JJDocGlobals.input_file + ext; } else { JJDocGlobals.output_file = JJDocGlobals.input_file.substring(0, i) + ext; } } } } else { JJDocGlobals.output_file = JJDocOptions.getOutputFile(); } try { ostr = new java.io.PrintWriter( new java.io.FileWriter( JJDocGlobals.output_file)); } catch (java.io.IOException e) { error("JJDoc: can't open output stream on file " + JJDocGlobals.output_file + ". Using standard output."); ostr = new java.io.PrintWriter(new java.io.OutputStreamWriter(System.out)); } return ostr; } private void println(String s) { print(s + "\n"); } public void text(String s) { if (printing && !(s.length() == 1 && (s.charAt(0) == '\n' || s.charAt(0) == '\r'))) { print(s); } } public void print(String s) { ostr.print(s); } public void documentStart() { ostr = create_output_stream(); } public void documentEnd() { ostr.close(); } public void specialTokens(String s) { } public void tokenStart(TokenProduction tp) { printing = false; } public void tokenEnd(TokenProduction tp) { printing = true; } public void nonterminalsStart() { } public void nonterminalsEnd() { } public void tokensStart() { } public void tokensEnd() { } public void javacode(JavaCodeProduction jp) { } public void expansionEnd(Expansion e, boolean first) { } public void nonTerminalStart(NonTerminal nt) { } public void nonTerminalEnd(NonTerminal nt) { } public void productionStart(NormalProduction np) { println(""); print(np.getLhs() + " ::= "); } public void productionEnd(NormalProduction np) { println(""); } public void expansionStart(Expansion e, boolean first) { if (!first) { print(" | "); } } public void reStart(RegularExpression r) { if (r.getClass().equals(RJustName.class) || r.getClass().equals(RCharacterList.class)) { printing = false; } } public void reEnd(RegularExpression r) { printing = true; } public void debug(String message) { System.err.println(message); } public void info(String message) { System.err.println(message); } public void warn(String message) { System.err.println(message); } public void error(String message) { System.err.println(message); } } javacc-5.0.orig/src/org/javacc/jjdoc/JJDocGlobals.java0000644000175000017500000000702511220416762021533 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjdoc; import org.javacc.parser.JavaCCGlobals; /** * Global variables for JJDoc. * */ public class JJDocGlobals extends JavaCCGlobals { /** * The name of the input file. */ public static String input_file; /** * The name of the output file. */ public static String output_file; /** * The Generator to create output with. */ public static Generator generator; /** * @param generator * The generator to set. */ public static void setGenerator(Generator generator) { JJDocGlobals.generator = generator; } /** * The commandline option is either TEXT or not, but the generator might * have been set to some other Generator using the setGenerator method. * * @return the generator configured in options or set by setter. */ public static Generator getGenerator() { if (generator == null) { if (JJDocOptions.getText()) { generator = new TextGenerator(); } else if (JJDocOptions.getBNF()) { generator = new BNFGenerator(); } else { generator = new HTMLGenerator(); } } else { if (JJDocOptions.getText()) { if(generator instanceof HTMLGenerator) { generator = new TextGenerator(); } } else if (JJDocOptions.getBNF()) { generator = new BNFGenerator(); } else { if(generator instanceof TextGenerator) { generator = new HTMLGenerator(); } } } return generator; } /** * Log informational messages. * @param message the message to log */ public static void debug(String message) { getGenerator().debug(message); } /** * Log informational messages. * @param message the message to log */ public static void info(String message) { getGenerator().info(message); } /** * Log error messages. * @param message the message to log */ public static void error(String message) { getGenerator().error(message); } } javacc-5.0.orig/src/org/javacc/jjdoc/JJDocOptions.java0000644000175000017500000000625611220416762021610 0ustar mkochmkoch/* Copyright (c) 2005-2006, Kees Jan Koster kjkoster@kjkoster.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjdoc; import org.javacc.parser.Options; /** * The options, specific to JJDoc. * * @author Kees Jan Koster <kjkoster@kjkoster.org> */ public class JJDocOptions extends Options { /** * Limit subclassing to derived classes. */ protected JJDocOptions() { super(); } /** * Initialize the options. */ public static void init() { Options.init(); Options.optionValues.put("ONE_TABLE", Boolean.TRUE); Options.optionValues.put("TEXT", Boolean.FALSE); Options.optionValues.put("BNF", Boolean.FALSE); Options.optionValues.put("OUTPUT_FILE", ""); Options.optionValues.put("CSS", ""); } /** * Find the one table value. * * @return The requested one table value. */ public static boolean getOneTable() { return booleanValue("ONE_TABLE"); } /** * Find the CSS value. * * @return The requested CSS value. */ public static String getCSS() { return stringValue("CSS"); } /** * Find the text value. * * @return The requested text value. */ public static boolean getText() { return booleanValue("TEXT"); } /** * Find the BNF value. * * @return The requested text value. */ public static boolean getBNF() { return booleanValue("BNF"); } /** * Find the output file value. * * @return The requested output value. */ public static String getOutputFile() { return stringValue("OUTPUT_FILE"); } } javacc-5.0.orig/src/org/javacc/jjdoc/package.html0000644000175000017500000000063410574014644020717 0ustar mkochmkoch org.javacc.jjdoc

Generates BNF documentation from a grammar.

javacc-5.0.orig/src/org/javacc/jjdoc/build.xml0000644000175000017500000000415410706262343020256 0ustar mkochmkoch javacc-5.0.orig/src/org/javacc/jjdoc/JJDoc.java0000644000175000017500000003516711104322434020230 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjdoc; import java.util.Enumeration; import java.util.Iterator; import java.util.List; import org.javacc.parser.Action; import org.javacc.parser.BNFProduction; import org.javacc.parser.CharacterRange; import org.javacc.parser.Choice; import org.javacc.parser.Expansion; import org.javacc.parser.JavaCCParserInternals; import org.javacc.parser.JavaCodeProduction; import org.javacc.parser.Lookahead; import org.javacc.parser.NonTerminal; import org.javacc.parser.NormalProduction; import org.javacc.parser.OneOrMore; import org.javacc.parser.RCharacterList; import org.javacc.parser.RChoice; import org.javacc.parser.REndOfFile; import org.javacc.parser.RJustName; import org.javacc.parser.ROneOrMore; import org.javacc.parser.RSequence; import org.javacc.parser.RStringLiteral; import org.javacc.parser.RZeroOrMore; import org.javacc.parser.RZeroOrOne; import org.javacc.parser.RRepetitionRange; import org.javacc.parser.RegExprSpec; import org.javacc.parser.RegularExpression; import org.javacc.parser.Sequence; import org.javacc.parser.SingleCharacter; import org.javacc.parser.Token; import org.javacc.parser.TokenProduction; import org.javacc.parser.TryBlock; import org.javacc.parser.ZeroOrMore; import org.javacc.parser.ZeroOrOne; /** * The main entry point for JJDoc. */ public class JJDoc extends JJDocGlobals { static void start() { generator = getGenerator(); generator.documentStart(); emitTokenProductions(generator, rexprlist); emitNormalProductions(generator, bnfproductions); generator.documentEnd(); } private static Token getPrecedingSpecialToken(Token tok) { Token t = tok; while (t.specialToken != null) { t = t.specialToken; } return (t != tok) ? t : null; } private static void emitTopLevelSpecialTokens(Token tok, Generator gen) { if (tok == null) { // Strange ... return; } tok = getPrecedingSpecialToken(tok); String s = ""; if (tok != null) { cline = tok.beginLine; ccol = tok.beginColumn; while (tok != null) { s += printTokenOnly(tok); tok = tok.next; } } if (!s.equals("")) gen.specialTokens(s); } /* private static boolean toplevelExpansion(Expansion exp) { return exp.parent != null && ( (exp.parent instanceof NormalProduction) || (exp.parent instanceof TokenProduction) ); } */ private static void emitTokenProductions(Generator gen, List prods) { gen.tokensStart(); // FIXME there are many empty productions here for (Iterator it = prods.iterator(); it.hasNext();) { TokenProduction tp = (TokenProduction)it.next(); emitTopLevelSpecialTokens(tp.firstToken, gen); String token = ""; if (tp.isExplicit) { if (tp.lexStates == null) { token += "<*> "; } else { token += "<"; for (int i = 0; i < tp.lexStates.length; ++i) { token += tp.lexStates[i]; if (i < tp.lexStates.length - 1) { token += ","; } } token += "> "; } token += TokenProduction.kindImage[tp.kind]; if (tp.ignoreCase) { token += " [IGNORE_CASE]"; } token += " : {\n"; for (Iterator it2 = tp.respecs.iterator(); it2.hasNext();) { RegExprSpec res = (RegExprSpec)it2.next(); token += emitRE(res.rexp); if (res.nsTok != null) { token += " : " + res.nsTok.image; } token += "\n"; if (it2.hasNext()) { token += "| "; } } token += "}\n\n"; } if (!token.equals("")) { gen.tokenStart(tp); gen.text(token); gen.tokenEnd(tp); } } gen.tokensEnd(); } private static void emitNormalProductions(Generator gen, List prods) { gen.nonterminalsStart(); for (Iterator it = prods.iterator(); it.hasNext();) { NormalProduction np = (NormalProduction)it.next(); emitTopLevelSpecialTokens(np.getFirstToken(), gen); if (np instanceof BNFProduction) { gen.productionStart(np); if (np.getExpansion() instanceof Choice) { boolean first = true; Choice c = (Choice)np.getExpansion(); for (Iterator expansionsIterator = c.getChoices().iterator(); expansionsIterator.hasNext();) { Expansion e = (Expansion)(expansionsIterator.next()); gen.expansionStart(e, first); emitExpansionTree(e, gen); gen.expansionEnd(e, first); first = false; } } else { gen.expansionStart(np.getExpansion(), true); emitExpansionTree(np.getExpansion(), gen); gen.expansionEnd(np.getExpansion(), true); } gen.productionEnd(np); } else if (np instanceof JavaCodeProduction) { gen.javacode((JavaCodeProduction)np); } } gen.nonterminalsEnd(); } private static void emitExpansionTree(Expansion exp, Generator gen) { // gen.text("[->" + exp.getClass().getName() + "]"); if (exp instanceof Action) { emitExpansionAction((Action)exp, gen); } else if (exp instanceof Choice) { emitExpansionChoice((Choice)exp, gen); } else if (exp instanceof Lookahead) { emitExpansionLookahead((Lookahead)exp, gen); } else if (exp instanceof NonTerminal) { emitExpansionNonTerminal((NonTerminal)exp, gen); } else if (exp instanceof OneOrMore) { emitExpansionOneOrMore((OneOrMore)exp, gen); } else if (exp instanceof RegularExpression) { emitExpansionRegularExpression((RegularExpression)exp, gen); } else if (exp instanceof Sequence) { emitExpansionSequence((Sequence)exp, gen); } else if (exp instanceof TryBlock) { emitExpansionTryBlock((TryBlock)exp, gen); } else if (exp instanceof ZeroOrMore) { emitExpansionZeroOrMore((ZeroOrMore)exp, gen); } else if (exp instanceof ZeroOrOne) { emitExpansionZeroOrOne((ZeroOrOne)exp, gen); } else { error("Oops: Unknown expansion type."); } // gen.text("[<-" + exp.getClass().getName() + "]"); } private static void emitExpansionAction(Action a, Generator gen) { } private static void emitExpansionChoice(Choice c, Generator gen) { for (Iterator it = c.getChoices().iterator(); it.hasNext();) { Expansion e = (Expansion)(it.next()); emitExpansionTree(e, gen); if (it.hasNext()) { gen.text(" | "); } } } private static void emitExpansionLookahead(Lookahead l, Generator gen) { } private static void emitExpansionNonTerminal(NonTerminal nt, Generator gen) { gen.nonTerminalStart(nt); gen.text(nt.getName()); gen.nonTerminalEnd(nt); } private static void emitExpansionOneOrMore(OneOrMore o, Generator gen) { gen.text("( "); emitExpansionTree(o.expansion, gen); gen.text(" )+"); } private static void emitExpansionRegularExpression(RegularExpression r, Generator gen) { String reRendered = emitRE(r); if (!reRendered.equals("")) { gen.reStart(r); gen.text(reRendered); gen.reEnd(r); } } private static void emitExpansionSequence(Sequence s, Generator gen) { boolean firstUnit = true; for (Iterator it = s.units.iterator(); it.hasNext();) { Expansion e = (Expansion)it.next(); if (e instanceof Lookahead || e instanceof Action) { continue; } if (!firstUnit) { gen.text(" "); } boolean needParens = (e instanceof Choice) || (e instanceof Sequence); if (needParens) { gen.text("( "); } emitExpansionTree(e, gen); if (needParens) { gen.text(" )"); } firstUnit = false; } } private static void emitExpansionTryBlock(TryBlock t, Generator gen) { boolean needParens = t.exp instanceof Choice; if (needParens) { gen.text("( "); } emitExpansionTree(t.exp, gen); if (needParens) { gen.text(" )"); } } private static void emitExpansionZeroOrMore(ZeroOrMore z, Generator gen) { gen.text("( "); emitExpansionTree(z.expansion, gen); gen.text(" )*"); } private static void emitExpansionZeroOrOne(ZeroOrOne z, Generator gen) { gen.text("( "); emitExpansionTree(z.expansion, gen); gen.text(" )?"); } private static String emitRE(RegularExpression re) { String returnString = ""; boolean hasLabel = !re.label.equals(""); boolean justName = re instanceof RJustName; boolean eof = re instanceof REndOfFile; boolean isString = re instanceof RStringLiteral; boolean toplevelRE = (re.tpContext != null); boolean needBrackets = justName || eof || hasLabel || (!isString && toplevelRE); if (needBrackets) { returnString += "<"; if (!justName) { if (re.private_rexp) { returnString += "#"; } if (hasLabel) { returnString += re.label; returnString += ": "; } } } if (re instanceof RCharacterList) { RCharacterList cl = (RCharacterList)re; if (cl.negated_list) { returnString += "~"; } returnString += "["; for (Iterator it = cl.descriptors.iterator(); it.hasNext();) { Object o = it.next(); if (o instanceof SingleCharacter) { returnString += "\""; char s[] = { ((SingleCharacter)o).ch }; returnString += add_escapes(new String(s)); returnString += "\""; } else if (o instanceof CharacterRange) { returnString += "\""; char s[] = { ((CharacterRange)o).getLeft() }; returnString += add_escapes(new String(s)); returnString += "\"-\""; s[0] = ((CharacterRange)o).getRight(); returnString += add_escapes(new String(s)); returnString += "\""; } else { error("Oops: unknown character list element type."); } if (it.hasNext()) { returnString += ","; } } returnString += "]"; } else if (re instanceof RChoice) { RChoice c = (RChoice)re; for (Iterator it = c.getChoices().iterator(); it.hasNext();) { RegularExpression sub = (RegularExpression)(it.next()); returnString += emitRE(sub); if (it.hasNext()) { returnString += " | "; } } } else if (re instanceof REndOfFile) { returnString += "EOF"; } else if (re instanceof RJustName) { RJustName jn = (RJustName)re; returnString += jn.label; } else if (re instanceof ROneOrMore) { ROneOrMore om = (ROneOrMore)re; returnString += "("; returnString += emitRE(om.regexpr); returnString += ")+"; } else if (re instanceof RSequence) { RSequence s = (RSequence)re; for (Iterator it = s.units.iterator(); it.hasNext();) { RegularExpression sub = (RegularExpression)(it.next()); boolean needParens = false; if (sub instanceof RChoice) { needParens = true; } if (needParens) { returnString += "("; } returnString += emitRE(sub); if (needParens) { returnString += ")"; } if (it.hasNext()) { returnString += " "; } } } else if (re instanceof RStringLiteral) { RStringLiteral sl = (RStringLiteral)re; returnString += ("\"" + JavaCCParserInternals.add_escapes(sl.image) + "\""); } else if (re instanceof RZeroOrMore) { RZeroOrMore zm = (RZeroOrMore)re; returnString += "("; returnString += emitRE(zm.regexpr); returnString += ")*"; } else if (re instanceof RZeroOrOne) { RZeroOrOne zo = (RZeroOrOne)re; returnString += "("; returnString += emitRE(zo.regexpr); returnString += ")?"; } else if (re instanceof RRepetitionRange) { RRepetitionRange zo = (RRepetitionRange)re; returnString += "("; returnString += emitRE(zo.regexpr); returnString += ")"; returnString += "{"; if (zo.hasMax) { returnString += zo.min; returnString += ","; returnString += zo.max; } else { returnString += zo.min; } returnString += "}"; } else { error("Oops: Unknown regular expression type."); } if (needBrackets) { returnString += ">"; } return returnString; } /* private static String v2s(Vector v, boolean newLine) { String s = ""; boolean firstToken = true; for (Enumeration enumeration = v.elements(); enumeration.hasMoreElements();) { Token tok = (Token)enumeration.nextElement(); Token stok = getPrecedingSpecialToken(tok); if (firstToken) { if (stok != null) { cline = stok.beginLine; ccol = stok.beginColumn; } else { cline = tok.beginLine; ccol = tok.beginColumn; } s = ws(ccol - 1); firstToken = false; } while (stok != null) { s += printToken(stok); stok = stok.next; } s += printToken(tok); } return s; } */ /** * A utility to produce a string of blanks. */ /* private static String ws(int len) { String s = ""; for (int i = 0; i < len; ++i) { s += " "; } return s; } */ } javacc-5.0.orig/src/org/javacc/jjdoc/Generator.java0000644000175000017500000001130410751636205021223 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjdoc; import org.javacc.parser.Expansion; import org.javacc.parser.JavaCodeProduction; import org.javacc.parser.NonTerminal; import org.javacc.parser.NormalProduction; import org.javacc.parser.RegularExpression; import org.javacc.parser.TokenProduction; /** * A report generator for a grammar. * @author timp * @since 11-Dec-2006 * */ public interface Generator { /** * Output string with entity substitution for brackets and ampersands. * @param s the String to output */ void text(String s); /** * Output String. * @param s String to output */ void print(String s); /** * Output document header. */ void documentStart(); /** * Output document footer. */ void documentEnd(); /** * Output Special Tokens. * @param s tokens to output */ void specialTokens(String s); /** * Output start of a TokenProduction. * @param tp the TokenProduction being output */ void tokenStart(TokenProduction tp); /** * Output end of a TokenProduction. * @param tp the TokenProduction being output */ void tokenEnd(TokenProduction tp); /** * Output start of non-terminal. */ void nonterminalsStart(); /** * Output end of non-terminal. */ void nonterminalsEnd(); /** * Output start of tokens. */ void tokensStart(); /** * Output end of tokens. */ void tokensEnd(); /** * Output comment from a production. * @param jp the JavaCodeProduction to output */ void javacode(JavaCodeProduction jp); /** * Output start of a normal production. * @param np the NormalProduction being output */ void productionStart(NormalProduction np); /** * Output end of a normal production. * @param np the NormalProduction being output */ void productionEnd(NormalProduction np); /** * Output start of an Expansion. * @param e Expansion being output * @param first whether this is the first expansion */ void expansionStart(Expansion e, boolean first); /** * Output end of Expansion. * @param e Expansion being output * @param first whether this is the first expansion */ void expansionEnd(Expansion e, boolean first); /** * Output start of non-terminal. * @param nt the NonTerminal being output */ void nonTerminalStart(NonTerminal nt); /** * Output end of non-terminal. * @param nt the NonTerminal being output */ void nonTerminalEnd(NonTerminal nt); /** * Output start of regular expression. * @param re the RegularExpression being output */ void reStart(RegularExpression re); /** * Output end of regular expression. * @param re the RegularExpression being output */ void reEnd(RegularExpression re); /** * Log debug messages. * @param message the string to log */ void debug(String message); /** * Log informational messages. * @param message the string to log */ void info(String message); /** * Log warning messages. * @param message the string to log */ void warn(String message); /** * Log error messages. * @param message the string to log */ void error(String message); } javacc-5.0.orig/src/org/javacc/Version.java0000644000175000017500000000521311226741736017637 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc; import java.io.IOException; import java.io.InputStream; import java.util.Properties; /** * Supply the version number. */ public class Version { private Version() {} public static final String majorVersion; public static final String minorVersion; public static final String patchVersion; public static final String versionNumber; static { String major = "??"; String minor = "??"; String patch = "??"; Properties props = new Properties(); InputStream is = Version.class.getResourceAsStream("/version.properties"); if (is != null) { try { props.load(is); } catch (IOException e) { System.err.println("Could not read version.properties: " + e); } major = props.getProperty("version.major", major); minor = props.getProperty("version.minor", minor); patch = props.getProperty("version.patch", patch); } majorVersion = major; minorVersion = minor; patchVersion = patch; versionNumber = majorVersion + "." + minorVersion; } } javacc-5.0.orig/src/org/javacc/parser/0000755000175000017500000000000011247044054016632 5ustar mkochmkochjavacc-5.0.orig/src/org/javacc/parser/test/0000755000175000017500000000000011247044054017611 5ustar mkochmkochjavacc-5.0.orig/src/org/javacc/parser/test/NfaStateTest.java0000644000175000017500000005550111146612647023036 0ustar mkochmkochpackage org.javacc.parser.test; import java.io.PrintWriter; import java.io.StringWriter; import org.javacc.JavaCCTestCase; import org.javacc.parser.JavaCCGlobals; import org.javacc.parser.JavaCCParser; import org.javacc.parser.LexGen; import org.javacc.parser.Main; import org.javacc.parser.NfaState; import org.javacc.parser.Options; import org.javacc.parser.Semanticize; /** * A sea anchor, to ensure that code is not inadvertently broken. * * @author timp * @since 16 Mar 2007 * */ public class NfaStateTest extends JavaCCTestCase { String parserInput = getJJInputDirectory() + "JavaCC.jj"; /** * @param name */ public NfaStateTest(String name) { super(name); } /** * {@inheritDoc} * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); Options.init(); Main.reInitAll(); } /** * {@inheritDoc} * @see junit.framework.TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } protected void setupState() throws Exception { JavaCCParser parser = new JavaCCParser(new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(parserInput), Options.getGrammarEncoding()))); parser.javacc_input(); JavaCCGlobals.fileName = JavaCCGlobals.origFileName = parserInput; JavaCCGlobals.jjtreeGenerated = JavaCCGlobals.isGeneratedBy("JJTree", parserInput); JavaCCGlobals.toolNames = JavaCCGlobals.getToolNames(parserInput); Semanticize.start(); LexGen.start(); } /** * Test method for {@link org.javacc.parser.NfaState#ReInit()}. */ public void testReInit() { } /** * Test method for {@link org.javacc.parser.NfaState#HasTransitions()}. */ public void testHasTransitions() { } /** * Test method for {@link org.javacc.parser.NfaState#ComputeClosures()}. */ public void testComputeClosures() { } /** * Test method for {@link org.javacc.parser.NfaState#CanStartNfaUsingAscii(char)}. */ public void testCanStartNfaUsingAscii() { } /** * Test method for {@link org.javacc.parser.NfaState#getFirstValidPos(java.lang.String, int, int)}. */ public void testGetFirstValidPos() { } /** * Test method for {@link org.javacc.parser.NfaState#MoveFrom(char, java.util.Vector)}. */ public void testMoveFrom() { } /** * Test method for {@link org.javacc.parser.NfaState#MoveFromSet(char, java.util.Vector, java.util.Vector)}. */ public void testMoveFromSet() { } /** * Test method for {@link org.javacc.parser.NfaState# * moveFromSetForRegEx(char, org.javacc.parser.NfaState[], * org.javacc.parser.NfaState[], int)}. */ public void testMoveFromSetForRegEx() { } /** * Test method for {@link org.javacc.parser.NfaState# * GenerateInitMoves(java.io.PrintWriter)}. */ public void testGenerateInitMoves() { } /** * Test method for {@link org.javacc.parser.NfaState# * DumpStateSets(java.io.PrintWriter)}. */ public void testDumpStateSets() { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); NfaState.DumpStateSets(contentWriter); assertEquals("static final int[] jjnextStates = {\n};\n" , output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState# * DumpStateSets(java.io.PrintWriter)}. */ public void testDumpStateSetsInitialised() throws Exception { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); setupState(); NfaState.DumpStateSets(contentWriter); assertEquals("static final int[] jjnextStates = {\n" + " 34, 35, 12, 38, 39, 42, 43, 23, 24, 26, 14, 16, 49, 51, 6, 52, \n" + " 59, 8, 9, 12, 23, 24, 28, 26, 34, 35, 12, 44, 45, 12, 53, 54, \n" + " 60, 61, 62, 10, 11, 17, 18, 20, 25, 27, 29, 36, 37, 40, 41, 46, \n" + " 47, 55, 56, 57, 58, 63, 64, \n" + "};\n" , output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState# * DumpCharAndRangeMoves(java.io.PrintWriter)}. */ public void testDumpCharAndRangeMoves() throws Exception { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); NfaState.DumpCharAndRangeMoves(contentWriter); assertEquals( " int i2 = (curChar & 0xff) >> 6;\n" + " long l2 = 1L << (curChar & 077);\n" + " do\n" + " {\n" + " switch(jjstateSet[--i])\n" + " {\n" + " default : break;\n" + " }\n" + " } while(i != startsAt);\n" ,output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState# * DumpCharAndRangeMoves(java.io.PrintWriter)}. */ public void testDumpCharAndRangeMovesInitialised() throws Exception { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); setupState(); NfaState.DumpCharAndRangeMoves(contentWriter); assertEquals( " int hiByte = (int)(curChar >> 8);\n" + " int i1 = hiByte >> 6;\n" + " long l1 = 1L << (hiByte & 077);\n" + " int i2 = (curChar & 0xff) >> 6;\n" + " long l2 = 1L << (curChar & 077);\n" + " do\n" + " {\n" + " switch(jjstateSet[--i])\n" + " {\n" + " default : break;\n" + " }\n" + " } while(i != startsAt);\n" ,output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState# * DumpNonAsciiMoveMethods(java.io.PrintWriter)}. */ public void testDumpNonAsciiMoveMethods() { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); NfaState.DumpNonAsciiMoveMethods(contentWriter); assertEquals("", output.toString()); } /** * Test method for {@link org.javacc.parser.NfaState# * DumpNonAsciiMoveMethods(java.io.PrintWriter)}. */ public void testDumpNonAsciiMoveMethodsInitialised() throws Exception { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); setupState(); NfaState.DumpNonAsciiMoveMethods(contentWriter); assertEquals("private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)\n" + "{\n" + " switch(hiByte)\n" + " {\n" + " case 0:\n" + " return ((jjbitVec2[i2] & l2) != 0L);\n" + " default :\n" + " if ((jjbitVec0[i1] & l1) != 0L)\n" + " return true;\n" + " return false;\n" + " }\n" + "}\n" + "private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)\n" + "{\n" + " switch(hiByte)\n" + " {\n" + " case 0:\n" + " return ((jjbitVec4[i2] & l2) != 0L);\n" + " case 2:\n" + " return ((jjbitVec5[i2] & l2) != 0L);\n" + " case 3:\n" + " return ((jjbitVec6[i2] & l2) != 0L);\n" + " case 4:\n" + " return ((jjbitVec7[i2] & l2) != 0L);\n" + " case 5:\n" + " return ((jjbitVec8[i2] & l2) != 0L);\n" + " case 6:\n" + " return ((jjbitVec9[i2] & l2) != 0L);\n" + " case 7:\n" + " return ((jjbitVec10[i2] & l2) != 0L);\n" + " case 9:\n" + " return ((jjbitVec11[i2] & l2) != 0L);\n" + " case 10:\n" + " return ((jjbitVec12[i2] & l2) != 0L);\n" + " case 11:\n" + " return ((jjbitVec13[i2] & l2) != 0L);\n" + " case 12:\n" + " return ((jjbitVec14[i2] & l2) != 0L);\n" + " case 13:\n" + " return ((jjbitVec15[i2] & l2) != 0L);\n" + " case 14:\n" + " return ((jjbitVec16[i2] & l2) != 0L);\n" + " case 15:\n" + " return ((jjbitVec17[i2] & l2) != 0L);\n" + " case 16:\n" + " return ((jjbitVec18[i2] & l2) != 0L);\n" + " case 17:\n" + " return ((jjbitVec19[i2] & l2) != 0L);\n" + " case 18:\n" + " return ((jjbitVec20[i2] & l2) != 0L);\n" + " case 19:\n" + " return ((jjbitVec21[i2] & l2) != 0L);\n" + " case 20:\n" + " return ((jjbitVec0[i2] & l2) != 0L);\n" + " case 22:\n" + " return ((jjbitVec22[i2] & l2) != 0L);\n" + " case 23:\n" + " return ((jjbitVec23[i2] & l2) != 0L);\n" + " case 24:\n" + " return ((jjbitVec24[i2] & l2) != 0L);\n" + " case 30:\n" + " return ((jjbitVec25[i2] & l2) != 0L);\n" + " case 31:\n" + " return ((jjbitVec26[i2] & l2) != 0L);\n" + " case 32:\n" + " return ((jjbitVec27[i2] & l2) != 0L);\n" + " case 33:\n" + " return ((jjbitVec28[i2] & l2) != 0L);\n" + " case 48:\n" + " return ((jjbitVec29[i2] & l2) != 0L);\n" + " case 49:\n" + " return ((jjbitVec30[i2] & l2) != 0L);\n" + " case 77:\n" + " return ((jjbitVec31[i2] & l2) != 0L);\n" + " case 159:\n" + " return ((jjbitVec32[i2] & l2) != 0L);\n" + " case 164:\n" + " return ((jjbitVec33[i2] & l2) != 0L);\n" + " case 215:\n" + " return ((jjbitVec34[i2] & l2) != 0L);\n" + " case 250:\n" + " return ((jjbitVec35[i2] & l2) != 0L);\n" + " case 251:\n" + " return ((jjbitVec36[i2] & l2) != 0L);\n" + " case 253:\n" + " return ((jjbitVec37[i2] & l2) != 0L);\n" + " case 254:\n" + " return ((jjbitVec38[i2] & l2) != 0L);\n" + " case 255:\n" + " return ((jjbitVec39[i2] & l2) != 0L);\n" + " default :\n" + " if ((jjbitVec3[i1] & l1) != 0L)\n" + " return true;\n" + " return false;\n" + " }\n" + "}\n" + "private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2)\n" + "{\n" + " switch(hiByte)\n" + " {\n" + " case 0:\n" + " return ((jjbitVec40[i2] & l2) != 0L);\n" + " case 2:\n" + " return ((jjbitVec5[i2] & l2) != 0L);\n" + " case 3:\n" + " return ((jjbitVec41[i2] & l2) != 0L);\n" + " case 4:\n" + " return ((jjbitVec42[i2] & l2) != 0L);\n" + " case 5:\n" + " return ((jjbitVec43[i2] & l2) != 0L);\n" + " case 6:\n" + " return ((jjbitVec44[i2] & l2) != 0L);\n" + " case 7:\n" + " return ((jjbitVec45[i2] & l2) != 0L);\n" + " case 9:\n" + " return ((jjbitVec46[i2] & l2) != 0L);\n" + " case 10:\n" + " return ((jjbitVec47[i2] & l2) != 0L);\n" + " case 11:\n" + " return ((jjbitVec48[i2] & l2) != 0L);\n" + " case 12:\n" + " return ((jjbitVec49[i2] & l2) != 0L);\n" + " case 13:\n" + " return ((jjbitVec50[i2] & l2) != 0L);\n" + " case 14:\n" + " return ((jjbitVec51[i2] & l2) != 0L);\n" + " case 15:\n" + " return ((jjbitVec52[i2] & l2) != 0L);\n" + " case 16:\n" + " return ((jjbitVec53[i2] & l2) != 0L);\n" + " case 17:\n" + " return ((jjbitVec19[i2] & l2) != 0L);\n" + " case 18:\n" + " return ((jjbitVec20[i2] & l2) != 0L);\n" + " case 19:\n" + " return ((jjbitVec54[i2] & l2) != 0L);\n" + " case 20:\n" + " return ((jjbitVec0[i2] & l2) != 0L);\n" + " case 22:\n" + " return ((jjbitVec22[i2] & l2) != 0L);\n" + " case 23:\n" + " return ((jjbitVec55[i2] & l2) != 0L);\n" + " case 24:\n" + " return ((jjbitVec56[i2] & l2) != 0L);\n" + " case 30:\n" + " return ((jjbitVec25[i2] & l2) != 0L);\n" + " case 31:\n" + " return ((jjbitVec26[i2] & l2) != 0L);\n" + " case 32:\n" + " return ((jjbitVec57[i2] & l2) != 0L);\n" + " case 33:\n" + " return ((jjbitVec28[i2] & l2) != 0L);\n" + " case 48:\n" + " return ((jjbitVec58[i2] & l2) != 0L);\n" + " case 49:\n" + " return ((jjbitVec30[i2] & l2) != 0L);\n" + " case 77:\n" + " return ((jjbitVec31[i2] & l2) != 0L);\n" + " case 159:\n" + " return ((jjbitVec32[i2] & l2) != 0L);\n" + " case 164:\n" + " return ((jjbitVec33[i2] & l2) != 0L);\n" + " case 215:\n" + " return ((jjbitVec34[i2] & l2) != 0L);\n" + " case 250:\n" + " return ((jjbitVec35[i2] & l2) != 0L);\n" + " case 251:\n" + " return ((jjbitVec59[i2] & l2) != 0L);\n" + " case 253:\n" + " return ((jjbitVec37[i2] & l2) != 0L);\n" + " case 254:\n" + " return ((jjbitVec60[i2] & l2) != 0L);\n" + " case 255:\n" + " return ((jjbitVec61[i2] & l2) != 0L);\n" + " default :\n" + " if ((jjbitVec3[i1] & l1) != 0L)\n" + " return true;\n" + " return false;\n" + " }\n" + "}\n", output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState#DumpMoveNfa(java.io.PrintWriter)}. */ public void testDumpMoveNfa() { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); try { NfaState.DumpMoveNfa(contentWriter); fail("Should have bombed"); } catch (ArrayIndexOutOfBoundsException e) { e = null; } assertEquals("", output.toString()); /* assertEquals("static private final void jjCheckNAdd(int state)\n" + "{\n" + " if (jjrounds[state] != jjround)\n" + " {\n" + " jjstateSet[jjnewStateCnt++] = state;\n" + " jjrounds[state] = jjround;\n" + " }\n" + "}\n" + "static private final void jjAddStates(int start, int end)\n" + "{\n" + " do {\n" + " jjstateSet[jjnewStateCnt++] = jjnextStates[start];\n" + " } while (start++ != end);\n" + "}\n" + "static private final void jjCheckNAddTwoStates(int state1, int state2)\n" + "{\n" + " jjCheckNAdd(state1);\n" + " jjCheckNAdd(state2);\n" + "}\n" + "static private final void jjCheckNAddStates(int start, int end)\n" + "{\n" + " do {\n" + " jjCheckNAdd(jjnextStates[start]);\n" + " } while (start++ != end);\n" + "}\n" + "static private final void jjCheckNAddStates(int start)\n" + "{\n" + " jjCheckNAdd(jjnextStates[start]);\n" + " jjCheckNAdd(jjnextStates[start + 1]);\n" + "}\n" + "", output.toString()); */ } /** * Test method for {@link org.javacc.parser.NfaState#DumpMoveNfa(java.io.PrintWriter)}. */ public void testDumpMoveNfaInitialised() throws Exception { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); setupState(); NfaState.DumpMoveNfa(contentWriter); assertEquals("private int jjMoveNfa_3(int startState, int curPos)\n" + "{\n" + " return curPos;\n" + "}\n", output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState# * DumpStatesForState(java.io.PrintWriter)}. */ public void testDumpStatesForState() throws Exception { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); NfaState.DumpStatesForState(contentWriter); assertEquals("protected static final int[][][] statesForState = null;\n" , output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState# * DumpStatesForState(java.io.PrintWriter)}. */ public void testDumpStatesForStateInitialised() throws Exception { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); setupState(); NfaState.DumpStatesForState(contentWriter); assertEquals("protected static final int[][][] statesForState = {\n" + " {\n" + " { 0 },\n" + " { 1 },\n" + " { 2 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 5 },\n" + " { 6 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 8 },\n" + " { 9 },\n" + " { 10 },\n" + " { 11 },\n" + " { 12 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 14 },\n" + " { 15 },\n" + " { 16 },\n" + " { 17 },\n" + " { 18 },\n" + " { 19 },\n" + " { 20 },\n" + " { 21 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 23 },\n" + " { 24 },\n" + " { 25 },\n" + " { 26 },\n" + " { 27 },\n" + " { 28 },\n" + " { 29 },\n" + " { 30 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 32 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 34 },\n" + " { 35 },\n" + " { 36 },\n" + " { 37 },\n" + " { 38 },\n" + " { 39 },\n" + " { 40 },\n" + " { 41 },\n" + " { 42 },\n" + " { 43 },\n" + " { 44 },\n" + " { 45 },\n" + " { 46 },\n" + " { 47 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 49 },\n" + " { 50 },\n" + " { 51 },\n" + " { 52 },\n" + " { 53 },\n" + " { 54 },\n" + " { 55 },\n" + " { 56 },\n" + " { 57 },\n" + " { 58 },\n" + " { 59 },\n" + " { 60 },\n" + " { 61 },\n" + " { 62 },\n" + " { 63 },\n" + " { 64 },\n" + " },\n" + " null,\n" + " {\n" + " { 0, 2, },\n" + " { 1 },\n" + " { 0, 2, },\n" + " },\n" + " null,\n" + " null,\n" + "\n" + "};\n", output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState#DumpStatesForKind(java.io.PrintWriter)}. */ public void testDumpStatesForKind() { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); NfaState.DumpStatesForKind(contentWriter); assertEquals("protected static final int[][][] statesForState = null;\n" + "protected static final int[][] kindForState = null;\n" , output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState#DumpStatesForKind(java.io.PrintWriter)}. */ public void testDumpStatesForKindInitialised() throws Exception { StringWriter output = new StringWriter(); PrintWriter contentWriter = new PrintWriter(output); setupState(); NfaState.DumpStatesForKind(contentWriter); assertEquals("protected static final int[][][] statesForState = {\n" + " {\n" + " { 0 },\n" + " { 1 },\n" + " { 2 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 5 },\n" + " { 6 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 8 },\n" + " { 9 },\n" + " { 10 },\n" + " { 11 },\n" + " { 12 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 14 },\n" + " { 15 },\n" + " { 16 },\n" + " { 17 },\n" + " { 18 },\n" + " { 19 },\n" + " { 20 },\n" + " { 21 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 23 },\n" + " { 24 },\n" + " { 25 },\n" + " { 26 },\n" + " { 27 },\n" + " { 28 },\n" + " { 29 },\n" + " { 30 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 32 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 34 },\n" + " { 35 },\n" + " { 36 },\n" + " { 37 },\n" + " { 38 },\n" + " { 39 },\n" + " { 40 },\n" + " { 41 },\n" + " { 42 },\n" + " { 43 },\n" + " { 44 },\n" + " { 45 },\n" + " { 46 },\n" + " { 47 },\n" + " { 3, 4, 7, 13, 22, 31, 33, 48, },\n" + " { 49 },\n" + " { 50 },\n" + " { 51 },\n" + " { 52 },\n" + " { 53 },\n" + " { 54 },\n" + " { 55 },\n" + " { 56 },\n" + " { 57 },\n" + " { 58 },\n" + " { 59 },\n" + " { 60 },\n" + " { 61 },\n" + " { 62 },\n" + " { 63 },\n" + " { 64 },\n" + " },\n" + " null,\n" + " {\n" + " { 0, 2, },\n" + " { 1 },\n" + " { 0, 2, },\n" + " },\n" + " null,\n" + " null,\n" + "\n" + "};\n" + "protected static final int[][] kindForState = {\n" + "{ 20, 20, 20, 20, 80, 80, 80, 84, 84, 84, 84, 84, 84, 89,\n" + " 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90,\n" + " 90, 90, 140, 140, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,\n" + " 84, 84, 84, 84, 84, 80, 80, 80, 84, 84, 84, 84, 84, 84, 84,\n" + " 84, 84, 84, 84, 84, 84},\n" + "null\n" + ",\n" + "{ 23, 23, 23},\n" + "null\n,\n" + "null\n\n" + "};\n", output.toString().replaceAll("\r", "")); } /** * Test method for {@link org.javacc.parser.NfaState#reInit()}. */ public void testReInit1() { } } javacc-5.0.orig/src/org/javacc/parser/JavaCCParserInternals.java0000644000175000017500000002423211070513744023625 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.List; /** * Utilities. */ public abstract class JavaCCParserInternals extends JavaCCGlobals { static protected void initialize() { Integer i = new Integer(0); lexstate_S2I.put("DEFAULT", i); lexstate_I2S.put(i, "DEFAULT"); simple_tokens_table.put("DEFAULT", new java.util.Hashtable()); } static protected void addcuname(String id) { cu_name = id; } static protected void compare(Token t, String id1, String id2) { if (!id2.equals(id1)) { JavaCCErrors.parse_error(t, "Name " + id2 + " must be the same as that used at PARSER_BEGIN (" + id1 + ")"); } } static private List add_cu_token_here = cu_to_insertion_point_1; static private Token first_cu_token; static private boolean insertionpoint1set = false; static private boolean insertionpoint2set = false; static protected void setinsertionpoint(Token t, int no) { do { add_cu_token_here.add(first_cu_token); first_cu_token = first_cu_token.next; } while (first_cu_token != t); if (no == 1) { if (insertionpoint1set) { JavaCCErrors.parse_error(t, "Multiple declaration of parser class."); } else { insertionpoint1set = true; add_cu_token_here = cu_to_insertion_point_2; } } else { add_cu_token_here = cu_from_insertion_point_2; insertionpoint2set = true; } first_cu_token = t; } static protected void insertionpointerrors(Token t) { while (first_cu_token != t) { add_cu_token_here.add(first_cu_token); first_cu_token = first_cu_token.next; } if (!insertionpoint1set || !insertionpoint2set) { JavaCCErrors.parse_error(t, "Parser class has not been defined between PARSER_BEGIN and PARSER_END."); } } static protected void set_initial_cu_token(Token t) { first_cu_token = t; } static protected void addproduction(NormalProduction p) { bnfproductions.add(p); } static protected void production_addexpansion(BNFProduction p, Expansion e) { e.parent = p; p.setExpansion(e); } static private int nextFreeLexState = 1; static protected void addregexpr(TokenProduction p) { Integer ii; rexprlist.add(p); if (Options.getUserTokenManager()) { if (p.lexStates == null || p.lexStates.length != 1 || !p.lexStates[0].equals("DEFAULT")) { JavaCCErrors.warning(p, "Ignoring lexical state specifications since option " + "USER_TOKEN_MANAGER has been set to true."); } } if (p.lexStates == null) { return; } for (int i = 0; i < p.lexStates.length; i++) { for (int j = 0; j < i; j++) { if (p.lexStates[i].equals(p.lexStates[j])) { JavaCCErrors.parse_error(p, "Multiple occurrence of \"" + p.lexStates[i] + "\" in lexical state list."); } } if (lexstate_S2I.get(p.lexStates[i]) == null) { ii = new Integer(nextFreeLexState++); lexstate_S2I.put(p.lexStates[i], ii); lexstate_I2S.put(ii, p.lexStates[i]); simple_tokens_table.put(p.lexStates[i], new java.util.Hashtable()); } } } static protected void add_token_manager_decls(Token t, java.util.List decls) { if (token_mgr_decls != null) { JavaCCErrors.parse_error(t, "Multiple occurrence of \"TOKEN_MGR_DECLS\"."); } else { token_mgr_decls = decls; if (Options.getUserTokenManager()) { JavaCCErrors.warning(t, "Ignoring declarations in \"TOKEN_MGR_DECLS\" since option " + "USER_TOKEN_MANAGER has been set to true."); } } } static protected void add_inline_regexpr(RegularExpression r) { if (!(r instanceof REndOfFile)) { TokenProduction p = new TokenProduction(); p.isExplicit = false; p.lexStates = new String[] {"DEFAULT"}; p.kind = TokenProduction.TOKEN; RegExprSpec res = new RegExprSpec(); res.rexp = r; res.rexp.tpContext = p; res.act = new Action(); res.nextState = null; res.nsTok = null; p.respecs.add(res); rexprlist.add(p); } } static protected boolean hexchar(char ch) { if (ch >= '0' && ch <= '9') return true; if (ch >= 'A' && ch <= 'F') return true; if (ch >= 'a' && ch <= 'f') return true; return false; } static protected int hexval(char ch) { if (ch >= '0' && ch <= '9') return ((int)ch) - ((int)'0'); if (ch >= 'A' && ch <= 'F') return ((int)ch) - ((int)'A') + 10; return ((int)ch) - ((int)'a') + 10; } static protected String remove_escapes_and_quotes(Token t, String str) { String retval = ""; int index = 1; char ch, ch1; int ordinal; while (index < str.length()-1) { if (str.charAt(index) != '\\') { retval += str.charAt(index); index++; continue; } index++; ch = str.charAt(index); if (ch == 'b') { retval += '\b'; index++; continue; } if (ch == 't') { retval += '\t'; index++; continue; } if (ch == 'n') { retval += '\n'; index++; continue; } if (ch == 'f') { retval += '\f'; index++; continue; } if (ch == 'r') { retval += '\r'; index++; continue; } if (ch == '"') { retval += '\"'; index++; continue; } if (ch == '\'') { retval += '\''; index++; continue; } if (ch == '\\') { retval += '\\'; index++; continue; } if (ch >= '0' && ch <= '7') { ordinal = ((int)ch) - ((int)'0'); index++; ch1 = str.charAt(index); if (ch1 >= '0' && ch1 <= '7') { ordinal = ordinal*8 + ((int)ch1) - ((int)'0'); index++; ch1 = str.charAt(index); if (ch <= '3' && ch1 >= '0' && ch1 <= '7') { ordinal = ordinal*8 + ((int)ch1) - ((int)'0'); index++; } } retval += (char)ordinal; continue; } if (ch == 'u') { index++; ch = str.charAt(index); if (hexchar(ch)) { ordinal = hexval(ch); index++; ch = str.charAt(index); if (hexchar(ch)) { ordinal = ordinal*16 + hexval(ch); index++; ch = str.charAt(index); if (hexchar(ch)) { ordinal = ordinal*16 + hexval(ch); index++; ch = str.charAt(index); if (hexchar(ch)) { ordinal = ordinal*16 + hexval(ch); index++; continue; } } } } JavaCCErrors.parse_error(t, "Encountered non-hex character '" + ch + "' at position " + index + " of string " + "- Unicode escape must have 4 hex digits after it."); return retval; } JavaCCErrors.parse_error(t, "Illegal escape sequence '\\" + ch + "' at position " + index + " of string."); return retval; } return retval; } static protected char character_descriptor_assign(Token t, String s) { if (s.length() != 1) { JavaCCErrors.parse_error(t, "String in character list may contain only one character."); return ' '; } else { return s.charAt(0); } } static protected char character_descriptor_assign(Token t, String s, String left) { if (s.length() != 1) { JavaCCErrors.parse_error(t, "String in character list may contain only one character."); return ' '; } else if ((int)(left.charAt(0)) > (int)(s.charAt(0))) { JavaCCErrors.parse_error(t, "Right end of character range \'" + s + "\' has a lower ordinal value than the left end of character range \'" + left + "\'."); return left.charAt(0); } else { return s.charAt(0); } } static protected void makeTryBlock( Token tryLoc, Container result, Container nestedExp, List types, List ids, List catchblks, List finallyblk ) { if (catchblks.size() == 0 && finallyblk == null) { JavaCCErrors.parse_error(tryLoc, "Try block must contain at least one catch or finally block."); return; } TryBlock tblk = new TryBlock(); tblk.setLine(tryLoc.beginLine); tblk.setColumn(tryLoc.beginColumn); tblk.exp = (Expansion)(nestedExp.member); tblk.exp.parent = tblk; tblk.exp.ordinal = 0; tblk.types = types; tblk.ids = ids; tblk.catchblks = catchblks; tblk.finallyblk = finallyblk; result.member = tblk; } public static void reInit() { add_cu_token_here = cu_to_insertion_point_1; first_cu_token = null; insertionpoint1set = false; insertionpoint2set = false; nextFreeLexState = 1; } } javacc-5.0.orig/src/org/javacc/parser/TokenProduction.java0000644000175000017500000000751511070513745022636 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; /** * Describes the various regular expression productions. */ public class TokenProduction { /** * Definitions of constants that identify the kind of regular * expression production this is. */ public static final int TOKEN = 0, SKIP = 1, MORE = 2, SPECIAL = 3; /** * The image of the above constants. */ public static final String[] kindImage = { "TOKEN", "SKIP", "MORE", "SPECIAL" }; /** * The starting line and column of this token production. */ private int column; private int line; /** * The states in which this regular expression production exists. If * this array is null, then "<*>" has been specified and this regular * expression exists in all states. However, this null value is * replaced by a String array that includes all lexical state names * during the semanticization phase. */ public String[] lexStates; /** * The kind of this token production - TOKEN, SKIP, MORE, or SPECIAL. */ public int kind; /** * The list of regular expression specifications that comprise this * production. Each entry is a "RegExprSpec". */ public List respecs = new ArrayList(); /** * This is true if this corresponds to a production that actually * appears in the input grammar. Otherwise (if this is created to * describe a regular expression that is part of the BNF) this is set * to false. */ public boolean isExplicit = true; /** * This is true if case is to be ignored within the regular expressions * of this token production. */ public boolean ignoreCase = false; /** * The first and last tokens from the input stream that represent this * production. */ public Token firstToken, lastToken; /** * @param line the line to set */ public void setLine(int line) { this.line = line; } /** * @return the line */ public int getLine() { return line; } /** * @param column the column to set */ public void setColumn(int column) { this.column = column; } /** * @return the column */ public int getColumn() { return column; } } javacc-5.0.orig/src/org/javacc/parser/ZeroOrMore.java0000644000175000017500000000457411070513745021554 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.Set; /** * Describes zero-or-more expansions (e.g., foo*). */ public class ZeroOrMore extends Expansion { /** * The expansion which is repeated zero or more times. */ public Expansion expansion; public ZeroOrMore() {} public ZeroOrMore(Token token, Expansion expansion) { this.setLine(token.beginLine); this.setColumn(token.beginColumn); this.expansion = expansion; this.expansion.parent = this; } public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = super.dump(indent, alreadyDumped); if (alreadyDumped.contains(this)) return sb; alreadyDumped.add(this); sb.append(eol).append(expansion.dump(indent + 1, alreadyDumped)); return sb; } } javacc-5.0.orig/src/org/javacc/parser/ParseEngine.java0000644000175000017500000013171411070513744021705 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.List; public class ParseEngine extends JavaCCGlobals { static private java.io.PrintWriter ostr; static private int gensymindex = 0; static private int indentamt; static private boolean jj2LA; /** * These lists are used to maintain expansions for which code generation * in phase 2 and phase 3 is required. Whenever a call is generated to * a phase 2 or phase 3 routine, a corresponding entry is added here if * it has not already been added. * The phase 3 routines have been optimized in version 0.7pre2. Essentially * only those methods (and only those portions of these methods) are * generated that are required. The lookahead amount is used to determine * this. This change requires the use of a hash table because it is now * possible for the same phase 3 routine to be requested multiple times * with different lookaheads. The hash table provides a easily searchable * capability to determine the previous requests. * The phase 3 routines now are performed in a two step process - the first * step gathers the requests (replacing requests with lower lookaheads with * those requiring larger lookaheads). The second step then generates these * methods. * This optimization and the hashtable makes it look like we do not need * the flag "phase3done" any more. But this has not been removed yet. */ static private List phase2list = new ArrayList(); static private List phase3list = new ArrayList(); static private java.util.Hashtable phase3table = new java.util.Hashtable(); /** * The phase 1 routines generates their output into String's and dumps * these String's once for each method. These String's contain the * special characters '\u0001' to indicate a positive indent, and '\u0002' * to indicate a negative indent. '\n' is used to indicate a line terminator. * The characters '\u0003' and '\u0004' are used to delineate portions of * text where '\n's should not be followed by an indentation. */ /** * Returns true if there is a JAVACODE production that the argument expansion * may directly expand to (without consuming tokens or encountering lookahead). */ static private boolean javaCodeCheck(Expansion exp) { if (exp instanceof RegularExpression) { return false; } else if (exp instanceof NonTerminal) { NormalProduction prod = ((NonTerminal)exp).getProd(); if (prod instanceof JavaCodeProduction) { return true; } else { return javaCodeCheck(prod.getExpansion()); } } else if (exp instanceof Choice) { Choice ch = (Choice)exp; for (int i = 0; i < ch.getChoices().size(); i++) { if (javaCodeCheck((Expansion)(ch.getChoices().get(i)))) { return true; } } return false; } else if (exp instanceof Sequence) { Sequence seq = (Sequence)exp; for (int i = 0; i < seq.units.size(); i++) { Expansion[] units = (Expansion[])seq.units.toArray(new Expansion[seq.units.size()]); if (units[i] instanceof Lookahead && ((Lookahead)units[i]).isExplicit()) { // An explicit lookahead (rather than one generated implicitly). Assume // the user knows what he / she is doing, e.g. // "A" ( "B" | LOOKAHEAD("X") jcode() | "C" )* "D" return false; } else if (javaCodeCheck((units[i]))) { return true; } else if (!Semanticize.emptyExpansionExists(units[i])) { return false; } } return false; } else if (exp instanceof OneOrMore) { OneOrMore om = (OneOrMore)exp; return javaCodeCheck(om.expansion); } else if (exp instanceof ZeroOrMore) { ZeroOrMore zm = (ZeroOrMore)exp; return javaCodeCheck(zm.expansion); } else if (exp instanceof ZeroOrOne) { ZeroOrOne zo = (ZeroOrOne)exp; return javaCodeCheck(zo.expansion); } else if (exp instanceof TryBlock) { TryBlock tb = (TryBlock)exp; return javaCodeCheck(tb.exp); } else { return false; } } /** * An array used to store the first sets generated by the following method. * A true entry means that the corresponding token is in the first set. */ static private boolean[] firstSet; /** * Sets up the array "firstSet" above based on the Expansion argument * passed to it. Since this is a recursive function, it assumes that * "firstSet" has been reset before the first call. */ static private void genFirstSet(Expansion exp) { if (exp instanceof RegularExpression) { firstSet[((RegularExpression)exp).ordinal] = true; } else if (exp instanceof NonTerminal) { if (!(((NonTerminal)exp).getProd() instanceof JavaCodeProduction)) { genFirstSet(((BNFProduction)(((NonTerminal)exp).getProd())).getExpansion()); } } else if (exp instanceof Choice) { Choice ch = (Choice)exp; for (int i = 0; i < ch.getChoices().size(); i++) { genFirstSet((Expansion)(ch.getChoices().get(i))); } } else if (exp instanceof Sequence) { Sequence seq = (Sequence)exp; Object obj = seq.units.get(0); if ((obj instanceof Lookahead) && (((Lookahead)obj).getActionTokens().size() != 0)) { jj2LA = true; } for (int i = 0; i < seq.units.size(); i++) { Expansion unit = (Expansion) seq.units.get(i); // Javacode productions can not have FIRST sets. Instead we generate the FIRST set // for the preceding LOOKAHEAD (the semantic checks should have made sure that // the LOOKAHEAD is suitable). if (unit instanceof NonTerminal && ((NonTerminal)unit).getProd() instanceof JavaCodeProduction) { if (i > 0 && seq.units.get(i-1) instanceof Lookahead) { Lookahead la = (Lookahead)seq.units.get(i-1); genFirstSet(la.getLaExpansion()); } } else { genFirstSet((Expansion)(seq.units.get(i))); } if (!Semanticize.emptyExpansionExists((Expansion)(seq.units.get(i)))) { break; } } } else if (exp instanceof OneOrMore) { OneOrMore om = (OneOrMore)exp; genFirstSet(om.expansion); } else if (exp instanceof ZeroOrMore) { ZeroOrMore zm = (ZeroOrMore)exp; genFirstSet(zm.expansion); } else if (exp instanceof ZeroOrOne) { ZeroOrOne zo = (ZeroOrOne)exp; genFirstSet(zo.expansion); } else if (exp instanceof TryBlock) { TryBlock tb = (TryBlock)exp; genFirstSet(tb.exp); } } /** * Constants used in the following method "buildLookaheadChecker". */ static final int NOOPENSTM = 0; static final int OPENIF = 1; static final int OPENSWITCH = 2; private static void dumpLookaheads(Lookahead[] conds, String[] actions) { for (int i = 0; i < conds.length; i++) { System.err.println("Lookahead: " + i); System.err.println(conds[i].dump(0, new HashSet())); System.err.println(); } } /** * This method takes two parameters - an array of Lookahead's * "conds", and an array of String's "actions". "actions" contains * exactly one element more than "conds". "actions" are Java source * code, and "conds" translate to conditions - so lets say * "f(conds[i])" is true if the lookahead required by "conds[i]" is * indeed the case. This method returns a string corresponding to * the Java code for: * * if (f(conds[0]) actions[0] * else if (f(conds[1]) actions[1] * . . . * else actions[action.length-1] * * A particular action entry ("actions[i]") can be null, in which * case, a noop is generated for that action. */ static String buildLookaheadChecker(Lookahead[] conds, String[] actions) { // The state variables. int state = NOOPENSTM; int indentAmt = 0; boolean[] casedValues = new boolean[tokenCount]; String retval = ""; Lookahead la; Token t = null; int tokenMaskSize = (tokenCount-1)/32 + 1; int[] tokenMask = null; // Iterate over all the conditions. int index = 0; while (index < conds.length) { la = conds[index]; jj2LA = false; if ((la.getAmount() == 0) || Semanticize.emptyExpansionExists(la.getLaExpansion()) || javaCodeCheck(la.getLaExpansion()) ) { // This handles the following cases: // . If syntactic lookahead is not wanted (and hence explicitly specified // as 0). // . If it is possible for the lookahead expansion to recognize the empty // string - in which case the lookahead trivially passes. // . If the lookahead expansion has a JAVACODE production that it directly // expands to - in which case the lookahead trivially passes. if (la.getActionTokens().size() == 0) { // In addition, if there is no semantic lookahead, then the // lookahead trivially succeeds. So break the main loop and // treat this case as the default last action. break; } else { // This case is when there is only semantic lookahead // (without any preceding syntactic lookahead). In this // case, an "if" statement is generated. switch (state) { case NOOPENSTM: retval += "\n" + "if ("; indentAmt++; break; case OPENIF: retval += "\u0002\n" + "} else if ("; break; case OPENSWITCH: retval += "\u0002\n" + "default:" + "\u0001"; if (Options.getErrorReporting()) { retval += "\njj_la1[" + maskindex + "] = jj_gen;"; maskindex++; } maskVals.add(tokenMask); retval += "\n" + "if ("; indentAmt++; } printTokenSetup((Token)(la.getActionTokens().get(0))); for (Iterator it = la.getActionTokens().iterator(); it.hasNext();) { t = (Token)it.next(); retval += printToken(t); } retval += printTrailingComments(t); retval += ") {\u0001" + actions[index]; state = OPENIF; } } else if (la.getAmount() == 1 && la.getActionTokens().size() == 0) { // Special optimal processing when the lookahead is exactly 1, and there // is no semantic lookahead. if (firstSet == null) { firstSet = new boolean[tokenCount]; } for (int i = 0; i < tokenCount; i++) { firstSet[i] = false; } // jj2LA is set to false at the beginning of the containing "if" statement. // It is checked immediately after the end of the same statement to determine // if lookaheads are to be performed using calls to the jj2 methods. genFirstSet(la.getLaExpansion()); // genFirstSet may find that semantic attributes are appropriate for the next // token. In which case, it sets jj2LA to true. if (!jj2LA) { // This case is if there is no applicable semantic lookahead and the lookahead // is one (excluding the earlier cases such as JAVACODE, etc.). switch (state) { case OPENIF: retval += "\u0002\n" + "} else {\u0001"; // Control flows through to next case. case NOOPENSTM: retval += "\n" + "switch ("; if (Options.getCacheTokens()) { retval += "jj_nt.kind) {\u0001"; } else { retval += "(jj_ntk==-1)?jj_ntk():jj_ntk) {\u0001"; } for (int i = 0; i < tokenCount; i++) { casedValues[i] = false; } indentAmt++; tokenMask = new int[tokenMaskSize]; for (int i = 0; i < tokenMaskSize; i++) { tokenMask[i] = 0; } // Don't need to do anything if state is OPENSWITCH. } for (int i = 0; i < tokenCount; i++) { if (firstSet[i]) { if (!casedValues[i]) { casedValues[i] = true; retval += "\u0002\ncase "; int j1 = i/32; int j2 = i%32; tokenMask[j1] |= 1 << j2; String s = (String)(names_of_tokens.get(new Integer(i))); if (s == null) { retval += i; } else { retval += s; } retval += ":\u0001"; } } } retval += actions[index]; retval += "\nbreak;"; state = OPENSWITCH; } } else { // This is the case when lookahead is determined through calls to // jj2 methods. The other case is when lookahead is 1, but semantic // attributes need to be evaluated. Hence this crazy control structure. jj2LA = true; } if (jj2LA) { // In this case lookahead is determined by the jj2 methods. switch (state) { case NOOPENSTM: retval += "\n" + "if ("; indentAmt++; break; case OPENIF: retval += "\u0002\n" + "} else if ("; break; case OPENSWITCH: retval += "\u0002\n" + "default:" + "\u0001"; if (Options.getErrorReporting()) { retval += "\njj_la1[" + maskindex + "] = jj_gen;"; maskindex++; } maskVals.add(tokenMask); retval += "\n" + "if ("; indentAmt++; } jj2index++; // At this point, la.la_expansion.internal_name must be "". la.getLaExpansion().internal_name = "_" + jj2index; phase2list.add(la); retval += "jj_2" + la.getLaExpansion().internal_name + "(" + la.getAmount() + ")"; if (la.getActionTokens().size() != 0) { // In addition, there is also a semantic lookahead. So concatenate // the semantic check with the syntactic one. retval += " && ("; printTokenSetup((Token)(la.getActionTokens().get(0))); for (Iterator it = la.getActionTokens().iterator(); it.hasNext();) { t = (Token)it.next(); retval += printToken(t); } retval += printTrailingComments(t); retval += ")"; } retval += ") {\u0001" + actions[index]; state = OPENIF; } index++; } // Generate code for the default case. Note this may not // be the last entry of "actions" if any condition can be // statically determined to be always "true". switch (state) { case NOOPENSTM: retval += actions[index]; break; case OPENIF: retval += "\u0002\n" + "} else {\u0001" + actions[index]; break; case OPENSWITCH: retval += "\u0002\n" + "default:" + "\u0001"; if (Options.getErrorReporting()) { retval += "\njj_la1[" + maskindex + "] = jj_gen;"; maskVals.add(tokenMask); maskindex++; } retval += actions[index]; } for (int i = 0; i < indentAmt; i++) { retval += "\u0002\n}"; } return retval; } static void dumpFormattedString(String str) { char ch = ' '; char prevChar; boolean indentOn = true; for (int i = 0; i < str.length(); i++) { prevChar = ch; ch = str.charAt(i); if (ch == '\n' && prevChar == '\r') { // do nothing - we've already printed a new line for the '\r' // during the previous iteration. } else if (ch == '\n' || ch == '\r') { if (indentOn) { phase1NewLine(); } else { ostr.println(""); } } else if (ch == '\u0001') { indentamt += 2; } else if (ch == '\u0002') { indentamt -= 2; } else if (ch == '\u0003') { indentOn = false; } else if (ch == '\u0004') { indentOn = true; } else { ostr.print(ch); } } } static void buildPhase1Routine(BNFProduction p) { Token t; t = (Token)(p.getReturnTypeTokens().get(0)); boolean voidReturn = false; if (t.kind == JavaCCParserConstants.VOID) { voidReturn = true; } printTokenSetup(t); ccol = 1; printLeadingComments(t, ostr); ostr.print(" " + staticOpt() + "final " +(p.getAccessMod() != null ? p.getAccessMod() : "public")+ " "); cline = t.beginLine; ccol = t.beginColumn; printTokenOnly(t, ostr); for (int i = 1; i < p.getReturnTypeTokens().size(); i++) { t = (Token)(p.getReturnTypeTokens().get(i)); printToken(t, ostr); } printTrailingComments(t, ostr); ostr.print(" " + p.getLhs() + "("); if (p.getParameterListTokens().size() != 0) { printTokenSetup((Token)(p.getParameterListTokens().get(0))); for (java.util.Iterator it = p.getParameterListTokens().iterator(); it.hasNext();) { t = (Token)it.next(); printToken(t, ostr); } printTrailingComments(t, ostr); } ostr.print(") throws ParseException"); for (java.util.Iterator it = p.getThrowsList().iterator(); it.hasNext();) { ostr.print(", "); java.util.List name = (java.util.List)it.next(); for (java.util.Iterator it2 = name.iterator(); it2.hasNext();) { t = (Token)it2.next(); ostr.print(t.image); } } ostr.print(" {"); indentamt = 4; if (Options.getDebugParser()) { ostr.println(""); ostr.println(" trace_call(\"" + p.getLhs() + "\");"); ostr.print(" try {"); indentamt = 6; } if (p.getDeclarationTokens().size() != 0) { printTokenSetup((Token)(p.getDeclarationTokens().get(0))); cline--; for (Iterator it = p.getDeclarationTokens().iterator(); it.hasNext();) { t = (Token)it.next(); printToken(t, ostr); } printTrailingComments(t, ostr); } String code = phase1ExpansionGen(p.getExpansion()); dumpFormattedString(code); ostr.println(""); if (p.isJumpPatched() && !voidReturn) { ostr.println(" throw new Error(\"Missing return statement in function\");"); } if (Options.getDebugParser()) { ostr.println(" } finally {"); ostr.println(" trace_return(\"" + p.getLhs() + "\");"); ostr.println(" }"); } ostr.println(" }"); ostr.println(""); } static void phase1NewLine() { ostr.println(""); for (int i = 0; i < indentamt; i++) { ostr.print(" "); } } static String phase1ExpansionGen(Expansion e) { String retval = ""; Token t = null; Lookahead[] conds; String[] actions; if (e instanceof RegularExpression) { RegularExpression e_nrw = (RegularExpression)e; retval += "\n"; if (e_nrw.lhsTokens.size() != 0) { printTokenSetup((Token)(e_nrw.lhsTokens.get(0))); for (java.util.Iterator it = e_nrw.lhsTokens.iterator(); it.hasNext();) { t = (Token)it.next(); retval += printToken(t); } retval += printTrailingComments(t); retval += " = "; } String tail = e_nrw.rhsToken == null ? ");" : ")." + e_nrw.rhsToken.image + ";"; if (e_nrw.label.equals("")) { Object label = names_of_tokens.get(new Integer(e_nrw.ordinal)); if (label != null) { retval += "jj_consume_token(" + (String)label + tail; } else { retval += "jj_consume_token(" + e_nrw.ordinal + tail; } } else { retval += "jj_consume_token(" + e_nrw.label + tail; } } else if (e instanceof NonTerminal) { NonTerminal e_nrw = (NonTerminal)e; retval += "\n"; if (e_nrw.getLhsTokens().size() != 0) { printTokenSetup((Token)(e_nrw.getLhsTokens().get(0))); for (java.util.Iterator it = e_nrw.getLhsTokens().iterator(); it.hasNext();) { t = (Token)it.next(); retval += printToken(t); } retval += printTrailingComments(t); retval += " = "; } retval += e_nrw.getName() + "("; if (e_nrw.getArgumentTokens().size() != 0) { printTokenSetup((Token)(e_nrw.getArgumentTokens().get(0))); for (java.util.Iterator it = e_nrw.getArgumentTokens().iterator(); it.hasNext();) { t = (Token)it.next(); retval += printToken(t); } retval += printTrailingComments(t); } retval += ");"; } else if (e instanceof Action) { Action e_nrw = (Action)e; retval += "\u0003\n"; if (e_nrw.getActionTokens().size() != 0) { printTokenSetup((Token)(e_nrw.getActionTokens().get(0))); ccol = 1; for (Iterator it = e_nrw.getActionTokens().iterator(); it.hasNext();) { t = (Token)it.next(); retval += printToken(t); } retval += printTrailingComments(t); } retval += "\u0004"; } else if (e instanceof Choice) { Choice e_nrw = (Choice)e; conds = new Lookahead[e_nrw.getChoices().size()]; actions = new String[e_nrw.getChoices().size() + 1]; actions[e_nrw.getChoices().size()] = "\n" + "jj_consume_token(-1);\n" + "throw new ParseException();"; // In previous line, the "throw" never throws an exception since the // evaluation of jj_consume_token(-1) causes ParseException to be // thrown first. Sequence nestedSeq; for (int i = 0; i < e_nrw.getChoices().size(); i++) { nestedSeq = (Sequence)(e_nrw.getChoices().get(i)); actions[i] = phase1ExpansionGen(nestedSeq); conds[i] = (Lookahead)(nestedSeq.units.get(0)); } retval = buildLookaheadChecker(conds, actions); } else if (e instanceof Sequence) { Sequence e_nrw = (Sequence)e; // We skip the first element in the following iteration since it is the // Lookahead object. for (int i = 1; i < e_nrw.units.size(); i++) { retval += phase1ExpansionGen((Expansion)(e_nrw.units.get(i))); } } else if (e instanceof OneOrMore) { OneOrMore e_nrw = (OneOrMore)e; Expansion nested_e = e_nrw.expansion; Lookahead la; if (nested_e instanceof Sequence) { la = (Lookahead)(((Sequence)nested_e).units.get(0)); } else { la = new Lookahead(); la.setAmount(Options.getLookahead()); la.setLaExpansion(nested_e); } retval += "\n"; int labelIndex = ++gensymindex; retval += "label_" + labelIndex + ":\n"; retval += "while (true) {\u0001"; retval += phase1ExpansionGen(nested_e); conds = new Lookahead[1]; conds[0] = la; actions = new String[2]; actions[0] = "\n;"; actions[1] = "\nbreak label_" + labelIndex + ";"; retval += buildLookaheadChecker(conds, actions); retval += "\u0002\n" + "}"; } else if (e instanceof ZeroOrMore) { ZeroOrMore e_nrw = (ZeroOrMore)e; Expansion nested_e = e_nrw.expansion; Lookahead la; if (nested_e instanceof Sequence) { la = (Lookahead)(((Sequence)nested_e).units.get(0)); } else { la = new Lookahead(); la.setAmount(Options.getLookahead()); la.setLaExpansion(nested_e); } retval += "\n"; int labelIndex = ++gensymindex; retval += "label_" + labelIndex + ":\n"; retval += "while (true) {\u0001"; conds = new Lookahead[1]; conds[0] = la; actions = new String[2]; actions[0] = "\n;"; actions[1] = "\nbreak label_" + labelIndex + ";"; retval += buildLookaheadChecker(conds, actions); retval += phase1ExpansionGen(nested_e); retval += "\u0002\n" + "}"; } else if (e instanceof ZeroOrOne) { ZeroOrOne e_nrw = (ZeroOrOne)e; Expansion nested_e = e_nrw.expansion; Lookahead la; if (nested_e instanceof Sequence) { la = (Lookahead)(((Sequence)nested_e).units.get(0)); } else { la = new Lookahead(); la.setAmount(Options.getLookahead()); la.setLaExpansion(nested_e); } conds = new Lookahead[1]; conds[0] = la; actions = new String[2]; actions[0] = phase1ExpansionGen(nested_e); actions[1] = "\n;"; retval += buildLookaheadChecker(conds, actions); } else if (e instanceof TryBlock) { TryBlock e_nrw = (TryBlock)e; Expansion nested_e = e_nrw.exp; java.util.List list; retval += "\n"; retval += "try {\u0001"; retval += phase1ExpansionGen(nested_e); retval += "\u0002\n" + "}"; for (int i = 0; i < e_nrw.catchblks.size(); i++) { retval += " catch ("; list = (java.util.List)(e_nrw.types.get(i)); if (list.size() != 0) { printTokenSetup((Token)(list.get(0))); for (java.util.Iterator it = list.iterator(); it.hasNext();) { t = (Token)it.next(); retval += printToken(t); } retval += printTrailingComments(t); } retval += " "; t = (Token)(e_nrw.ids.get(i)); printTokenSetup(t); retval += printToken(t); retval += printTrailingComments(t); retval += ") {\u0003\n"; list = (java.util.List)(e_nrw.catchblks.get(i)); if (list.size() != 0) { printTokenSetup((Token)(list.get(0))); ccol = 1; for (java.util.Iterator it = list.iterator(); it.hasNext();) { t = (Token)it.next(); retval += printToken(t); } retval += printTrailingComments(t); } retval += "\u0004\n" + "}"; } if (e_nrw.finallyblk != null) { retval += " finally {\u0003\n"; if (e_nrw.finallyblk.size() != 0) { printTokenSetup((Token)(e_nrw.finallyblk.get(0))); ccol = 1; for (java.util.Iterator it = e_nrw.finallyblk.iterator(); it.hasNext();) { t = (Token)it.next(); retval += printToken(t); } retval += printTrailingComments(t); } retval += "\u0004\n" + "}"; } } return retval; } static void buildPhase2Routine(Lookahead la) { Expansion e = la.getLaExpansion(); ostr.println(" " + staticOpt() + "private boolean jj_2" + e.internal_name + "(int xla) {"); ostr.println(" jj_la = xla; jj_lastpos = jj_scanpos = token;"); ostr.println(" try { return !jj_3" + e.internal_name + "(); }"); ostr.println(" catch(LookaheadSuccess ls) { return true; }"); if (Options.getErrorReporting()) ostr.println(" finally { jj_save(" + (Integer.parseInt(e.internal_name.substring(1))-1) + ", xla); }"); ostr.println(" }"); ostr.println(""); Phase3Data p3d = new Phase3Data(e, la.getAmount()); phase3list.add(p3d); phase3table.put(e, p3d); } static private boolean xsp_declared; static Expansion jj3_expansion; static String genReturn(boolean value) { String retval = (value ? "true" : "false"); if (Options.getDebugLookahead() && jj3_expansion != null) { String tracecode = "trace_return(\"" + ((NormalProduction)jj3_expansion.parent).getLhs() + "(LOOKAHEAD " + (value ? "FAILED" : "SUCCEEDED") + ")\");"; if (Options.getErrorReporting()) { tracecode = "if (!jj_rescan) " + tracecode; } return "{ " + tracecode + " return " + retval + "; }"; } else { return "return " + retval + ";"; } } private static void generate3R(Expansion e, Phase3Data inf) { Expansion seq = e; if (e.internal_name.equals("")) { while (true) { if (seq instanceof Sequence && ((Sequence)seq).units.size() == 2) { seq = (Expansion)((Sequence)seq).units.get(1); } else if (seq instanceof NonTerminal) { NonTerminal e_nrw = (NonTerminal)seq; NormalProduction ntprod = (NormalProduction)(production_table.get(e_nrw.getName())); if (ntprod instanceof JavaCodeProduction) { break; // nothing to do here } else { seq = ntprod.getExpansion(); } } else break; } if (seq instanceof RegularExpression) { e.internal_name = "jj_scan_token(" + ((RegularExpression)seq).ordinal + ")"; return; } gensymindex++; // if (gensymindex == 100) // { // new Error().printStackTrace(); // System.out.println(" ***** seq: " + seq.internal_name + "; size: " + ((Sequence)seq).units.size()); // } e.internal_name = "R_" + gensymindex; } Phase3Data p3d = (Phase3Data)(phase3table.get(e)); if (p3d == null || p3d.count < inf.count) { p3d = new Phase3Data(e, inf.count); phase3list.add(p3d); phase3table.put(e, p3d); } } static void setupPhase3Builds(Phase3Data inf) { Expansion e = inf.exp; if (e instanceof RegularExpression) { ; // nothing to here } else if (e instanceof NonTerminal) { // All expansions of non-terminals have the "name" fields set. So // there's no need to check it below for "e_nrw" and "ntexp". In // fact, we rely here on the fact that the "name" fields of both these // variables are the same. NonTerminal e_nrw = (NonTerminal)e; NormalProduction ntprod = (NormalProduction)(production_table.get(e_nrw.getName())); if (ntprod instanceof JavaCodeProduction) { ; // nothing to do here } else { generate3R(ntprod.getExpansion(), inf); } } else if (e instanceof Choice) { Choice e_nrw = (Choice)e; for (int i = 0; i < e_nrw.getChoices().size(); i++) { generate3R((Expansion)(e_nrw.getChoices().get(i)), inf); } } else if (e instanceof Sequence) { Sequence e_nrw = (Sequence)e; // We skip the first element in the following iteration since it is the // Lookahead object. int cnt = inf.count; for (int i = 1; i < e_nrw.units.size(); i++) { Expansion eseq = (Expansion)(e_nrw.units.get(i)); setupPhase3Builds(new Phase3Data(eseq, cnt)); cnt -= minimumSize(eseq); if (cnt <= 0) break; } } else if (e instanceof TryBlock) { TryBlock e_nrw = (TryBlock)e; setupPhase3Builds(new Phase3Data(e_nrw.exp, inf.count)); } else if (e instanceof OneOrMore) { OneOrMore e_nrw = (OneOrMore)e; generate3R(e_nrw.expansion, inf); } else if (e instanceof ZeroOrMore) { ZeroOrMore e_nrw = (ZeroOrMore)e; generate3R(e_nrw.expansion, inf); } else if (e instanceof ZeroOrOne) { ZeroOrOne e_nrw = (ZeroOrOne)e; generate3R(e_nrw.expansion, inf); } } private static String genjj_3Call(Expansion e) { if (e.internal_name.startsWith("jj_scan_token")) return e.internal_name; else return "jj_3" + e.internal_name + "()"; } static Hashtable generated = new Hashtable(); static void buildPhase3Routine(Phase3Data inf, boolean recursive_call) { Expansion e = inf.exp; Token t = null; if (e.internal_name.startsWith("jj_scan_token")) return; if (!recursive_call) { ostr.println(" " + staticOpt() + "private boolean jj_3" + e.internal_name + "() {"); xsp_declared = false; if (Options.getDebugLookahead() && e.parent instanceof NormalProduction) { ostr.print(" "); if (Options.getErrorReporting()) { ostr.print("if (!jj_rescan) "); } ostr.println("trace_call(\"" + ((NormalProduction)e.parent).getLhs() + "(LOOKING AHEAD...)\");"); jj3_expansion = e; } else { jj3_expansion = null; } } if (e instanceof RegularExpression) { RegularExpression e_nrw = (RegularExpression)e; if (e_nrw.label.equals("")) { Object label = names_of_tokens.get(new Integer(e_nrw.ordinal)); if (label != null) { ostr.println(" if (jj_scan_token(" + (String)label + ")) " + genReturn(true)); } else { ostr.println(" if (jj_scan_token(" + e_nrw.ordinal + ")) " + genReturn(true)); } } else { ostr.println(" if (jj_scan_token(" + e_nrw.label + ")) " + genReturn(true)); } //ostr.println(" if (jj_la == 0 && jj_scanpos == jj_lastpos) " + genReturn(false)); } else if (e instanceof NonTerminal) { // All expansions of non-terminals have the "name" fields set. So // there's no need to check it below for "e_nrw" and "ntexp". In // fact, we rely here on the fact that the "name" fields of both these // variables are the same. NonTerminal e_nrw = (NonTerminal)e; NormalProduction ntprod = (NormalProduction)(production_table.get(e_nrw.getName())); if (ntprod instanceof JavaCodeProduction) { ostr.println(" if (true) { jj_la = 0; jj_scanpos = jj_lastpos; " + genReturn(false) + "}"); } else { Expansion ntexp = ntprod.getExpansion(); //ostr.println(" if (jj_3" + ntexp.internal_name + "()) " + genReturn(true)); ostr.println(" if (" + genjj_3Call(ntexp)+ ") " + genReturn(true)); //ostr.println(" if (jj_la == 0 && jj_scanpos == jj_lastpos) " + genReturn(false)); } } else if (e instanceof Choice) { Sequence nested_seq; Choice e_nrw = (Choice)e; if (e_nrw.getChoices().size() != 1) { if (!xsp_declared) { xsp_declared = true; ostr.println(" Token xsp;"); } ostr.println(" xsp = jj_scanpos;"); } for (int i = 0; i < e_nrw.getChoices().size(); i++) { nested_seq = (Sequence)(e_nrw.getChoices().get(i)); Lookahead la = (Lookahead)(nested_seq.units.get(0)); if (la.getActionTokens().size() != 0) { // We have semantic lookahead that must be evaluated. lookaheadNeeded = true; ostr.println(" jj_lookingAhead = true;"); ostr.print(" jj_semLA = "); printTokenSetup((Token)(la.getActionTokens().get(0))); for (Iterator it = la.getActionTokens().iterator(); it.hasNext();) { t = (Token)it.next(); printToken(t, ostr); } printTrailingComments(t, ostr); ostr.println(";"); ostr.println(" jj_lookingAhead = false;"); } ostr.print(" if ("); if (la.getActionTokens().size() != 0) { ostr.print("!jj_semLA || "); } if (i != e_nrw.getChoices().size() - 1) { //ostr.println("jj_3" + nested_seq.internal_name + "()) {"); ostr.println(genjj_3Call(nested_seq) + ") {"); ostr.println(" jj_scanpos = xsp;"); } else { //ostr.println("jj_3" + nested_seq.internal_name + "()) " + genReturn(true)); ostr.println(genjj_3Call(nested_seq) + ") " + genReturn(true)); //ostr.println(" if (jj_la == 0 && jj_scanpos == jj_lastpos) " + genReturn(false)); } } for (int i = 1; i < e_nrw.getChoices().size(); i++) { //ostr.println(" } else if (jj_la == 0 && jj_scanpos == jj_lastpos) " + genReturn(false)); ostr.println(" }"); } } else if (e instanceof Sequence) { Sequence e_nrw = (Sequence)e; // We skip the first element in the following iteration since it is the // Lookahead object. int cnt = inf.count; for (int i = 1; i < e_nrw.units.size(); i++) { Expansion eseq = (Expansion)(e_nrw.units.get(i)); buildPhase3Routine(new Phase3Data(eseq, cnt), true); // System.out.println("minimumSize: line: " + eseq.line + ", column: " + eseq.column + ": " + // minimumSize(eseq));//Test Code cnt -= minimumSize(eseq); if (cnt <= 0) break; } } else if (e instanceof TryBlock) { TryBlock e_nrw = (TryBlock)e; buildPhase3Routine(new Phase3Data(e_nrw.exp, inf.count), true); } else if (e instanceof OneOrMore) { if (!xsp_declared) { xsp_declared = true; ostr.println(" Token xsp;"); } OneOrMore e_nrw = (OneOrMore)e; Expansion nested_e = e_nrw.expansion; //ostr.println(" if (jj_3" + nested_e.internal_name + "()) " + genReturn(true)); ostr.println(" if (" + genjj_3Call(nested_e) + ") " + genReturn(true)); //ostr.println(" if (jj_la == 0 && jj_scanpos == jj_lastpos) " + genReturn(false)); ostr.println(" while (true) {"); ostr.println(" xsp = jj_scanpos;"); //ostr.println(" if (jj_3" + nested_e.internal_name + "()) { jj_scanpos = xsp; break; }"); ostr.println(" if (" + genjj_3Call(nested_e) + ") { jj_scanpos = xsp; break; }"); //ostr.println(" if (jj_la == 0 && jj_scanpos == jj_lastpos) " + genReturn(false)); ostr.println(" }"); } else if (e instanceof ZeroOrMore) { if (!xsp_declared) { xsp_declared = true; ostr.println(" Token xsp;"); } ZeroOrMore e_nrw = (ZeroOrMore)e; Expansion nested_e = e_nrw.expansion; ostr.println(" while (true) {"); ostr.println(" xsp = jj_scanpos;"); //ostr.println(" if (jj_3" + nested_e.internal_name + "()) { jj_scanpos = xsp; break; }"); ostr.println(" if (" + genjj_3Call(nested_e) + ") { jj_scanpos = xsp; break; }"); //ostr.println(" if (jj_la == 0 && jj_scanpos == jj_lastpos) " + genReturn(false)); ostr.println(" }"); } else if (e instanceof ZeroOrOne) { if (!xsp_declared) { xsp_declared = true; ostr.println(" Token xsp;"); } ZeroOrOne e_nrw = (ZeroOrOne)e; Expansion nested_e = e_nrw.expansion; ostr.println(" xsp = jj_scanpos;"); //ostr.println(" if (jj_3" + nested_e.internal_name + "()) jj_scanpos = xsp;"); ostr.println(" if (" + genjj_3Call(nested_e) + ") jj_scanpos = xsp;"); //ostr.println(" else if (jj_la == 0 && jj_scanpos == jj_lastpos) " + genReturn(false)); } if (!recursive_call) { ostr.println(" " + genReturn(false)); ostr.println(" }"); ostr.println(""); } } static int minimumSize(Expansion e) { return minimumSize(e, Integer.MAX_VALUE); } /* * Returns the minimum number of tokens that can parse to this expansion. */ static int minimumSize(Expansion e, int oldMin) { int retval = 0; // should never be used. Will be bad if it is. if (e.inMinimumSize) { // recursive search for minimum size unnecessary. return Integer.MAX_VALUE; } e.inMinimumSize = true; if (e instanceof RegularExpression) { retval = 1; } else if (e instanceof NonTerminal) { NonTerminal e_nrw = (NonTerminal)e; NormalProduction ntprod = (NormalProduction)(production_table.get(e_nrw.getName())); if (ntprod instanceof JavaCodeProduction) { retval = Integer.MAX_VALUE; // Make caller think this is unending (for we do not go beyond JAVACODE during // phase3 execution). } else { Expansion ntexp = ntprod.getExpansion(); retval = minimumSize(ntexp); } } else if (e instanceof Choice) { int min = oldMin; Expansion nested_e; Choice e_nrw = (Choice)e; for (int i = 0; min > 1 && i < e_nrw.getChoices().size(); i++) { nested_e = (Expansion)(e_nrw.getChoices().get(i)); int min1 = minimumSize(nested_e, min); if (min > min1) min = min1; } retval = min; } else if (e instanceof Sequence) { int min = 0; Sequence e_nrw = (Sequence)e; // We skip the first element in the following iteration since it is the // Lookahead object. for (int i = 1; i < e_nrw.units.size(); i++) { Expansion eseq = (Expansion)(e_nrw.units.get(i)); int mineseq = minimumSize(eseq); if (min == Integer.MAX_VALUE || mineseq == Integer.MAX_VALUE) { min = Integer.MAX_VALUE; // Adding infinity to something results in infinity. } else { min += mineseq; if (min > oldMin) break; } } retval = min; } else if (e instanceof TryBlock) { TryBlock e_nrw = (TryBlock)e; retval = minimumSize(e_nrw.exp); } else if (e instanceof OneOrMore) { OneOrMore e_nrw = (OneOrMore)e; retval = minimumSize(e_nrw.expansion); } else if (e instanceof ZeroOrMore) { retval = 0; } else if (e instanceof ZeroOrOne) { retval = 0; } else if (e instanceof Lookahead) { retval = 0; } else if (e instanceof Action) { retval = 0; } e.inMinimumSize = false; return retval; } static void build(java.io.PrintWriter ps) { NormalProduction p; JavaCodeProduction jp; Token t = null; ostr = ps; for (java.util.Iterator prodIterator = bnfproductions.iterator(); prodIterator.hasNext();) { p = (NormalProduction)prodIterator.next(); if (p instanceof JavaCodeProduction) { jp = (JavaCodeProduction)p; t = (Token)(jp.getReturnTypeTokens().get(0)); printTokenSetup(t); ccol = 1; printLeadingComments(t, ostr); ostr.print(" " + staticOpt() + (p.getAccessMod() != null ? p.getAccessMod() + " " : "")); cline = t.beginLine; ccol = t.beginColumn; printTokenOnly(t, ostr); for (int i = 1; i < jp.getReturnTypeTokens().size(); i++) { t = (Token)(jp.getReturnTypeTokens().get(i)); printToken(t, ostr); } printTrailingComments(t, ostr); ostr.print(" " + jp.getLhs() + "("); if (jp.getParameterListTokens().size() != 0) { printTokenSetup((Token)(jp.getParameterListTokens().get(0))); for (java.util.Iterator it = jp.getParameterListTokens().iterator(); it.hasNext();) { t = (Token)it.next(); printToken(t, ostr); } printTrailingComments(t, ostr); } ostr.print(") throws ParseException"); for (java.util.Iterator it = jp.getThrowsList().iterator(); it.hasNext();) { ostr.print(", "); java.util.List name = (java.util.List)it.next(); for (java.util.Iterator it2 = name.iterator(); it2.hasNext();) { t = (Token)it2.next(); ostr.print(t.image); } } ostr.print(" {"); if (Options.getDebugParser()) { ostr.println(""); ostr.println(" trace_call(\"" + jp.getLhs() + "\");"); ostr.print(" try {"); } if (jp.getCodeTokens().size() != 0) { printTokenSetup((Token)(jp.getCodeTokens().get(0))); cline--; printTokenList(jp.getCodeTokens(), ostr); } ostr.println(""); if (Options.getDebugParser()) { ostr.println(" } finally {"); ostr.println(" trace_return(\"" + jp.getLhs() + "\");"); ostr.println(" }"); } ostr.println(" }"); ostr.println(""); } else { buildPhase1Routine((BNFProduction)p); } } for (int phase2index = 0; phase2index < phase2list.size(); phase2index++) { buildPhase2Routine((Lookahead)(phase2list.get(phase2index))); } int phase3index = 0; while (phase3index < phase3list.size()) { for (; phase3index < phase3list.size(); phase3index++) { setupPhase3Builds((Phase3Data)(phase3list.get(phase3index))); } } for (java.util.Enumeration enumeration = phase3table.elements(); enumeration.hasMoreElements();) { buildPhase3Routine((Phase3Data)(enumeration.nextElement()), false); } } public static void reInit() { ostr = null; gensymindex = 0; indentamt = 0; jj2LA = false; phase2list = new ArrayList(); phase3list = new ArrayList(); phase3table = new java.util.Hashtable(); firstSet = null; xsp_declared = false; jj3_expansion = null; } } /** * This class stores information to pass from phase 2 to phase 3. */ class Phase3Data { /* * This is the expansion to generate the jj3 method for. */ Expansion exp; /* * This is the number of tokens that can still be consumed. This * number is used to limit the number of jj3 methods generated. */ int count; Phase3Data(Expansion e, int c) { exp = e; count = c; } } javacc-5.0.orig/src/org/javacc/parser/NfaState.java0000644000175000017500000026326611070513744021222 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; import java.util.Vector; /** * The state of a Non-deterministic Finite Automaton. */ public class NfaState { public static boolean unicodeWarningGiven = false; public static int generatedStates = 0; private static int idCnt = 0; private static int lohiByteCnt; private static int dummyStateIndex = -1; private static boolean done; private static boolean mark[]; private static boolean stateDone[]; private static List allStates = new ArrayList(); private static List indexedAllStates = new ArrayList(); private static List nonAsciiTableForMethod = new ArrayList(); private static Hashtable equivStatesTable = new Hashtable(); private static Hashtable allNextStates = new Hashtable(); private static Hashtable lohiByteTab = new Hashtable(); private static Hashtable stateNameForComposite = new Hashtable(); private static Hashtable compositeStateTable = new Hashtable(); private static Hashtable stateBlockTable = new Hashtable(); private static Hashtable stateSetsToFix = new Hashtable(); private static boolean jjCheckNAddStatesUnaryNeeded = false; private static boolean jjCheckNAddStatesDualNeeded = false; public static void ReInit() { generatedStates = 0; idCnt = 0; dummyStateIndex = -1; done = false; mark = null; stateDone = null; allStates.clear(); indexedAllStates.clear(); equivStatesTable.clear(); allNextStates.clear(); compositeStateTable.clear(); stateBlockTable.clear(); stateNameForComposite.clear(); stateSetsToFix.clear(); } long[] asciiMoves = new long[2]; char[] charMoves = null; private char[] rangeMoves = null; NfaState next = null; private NfaState stateForCase; Vector epsilonMoves = new Vector(); private String epsilonMovesString; private NfaState[] epsilonMoveArray; private int id; int stateName = -1; int kind = Integer.MAX_VALUE; private int lookingFor; private int usefulEpsilonMoves = 0; int inNextOf; private int lexState; private int nonAsciiMethod = -1; private int kindToPrint = Integer.MAX_VALUE; boolean dummy = false; private boolean isComposite = false; private int[] compositeStates = null; boolean isFinal = false; private Vector loByteVec; private int[] nonAsciiMoveIndices; private int round = 0; private int onlyChar = 0; private char matchSingleChar; NfaState() { id = idCnt++; allStates.add(this); lexState = LexGen.lexStateIndex; lookingFor = LexGen.curKind; } NfaState CreateClone() { NfaState retVal = new NfaState(); retVal.isFinal = isFinal; retVal.kind = kind; retVal.lookingFor = lookingFor; retVal.lexState = lexState; retVal.inNextOf = inNextOf; retVal.MergeMoves(this); return retVal; } static void InsertInOrder(List v, NfaState s) { int j; for (j = 0; j < v.size(); j++) if (((NfaState)v.get(j)).id > s.id) break; else if (((NfaState)v.get(j)).id == s.id) return; v.add(j, s); } private static char[] ExpandCharArr(char[] oldArr, int incr) { char[] ret = new char[oldArr.length + incr]; System.arraycopy(oldArr, 0, ret, 0, oldArr.length); return ret; } void AddMove(NfaState newState) { if (!epsilonMoves.contains(newState)) InsertInOrder(epsilonMoves, newState); } private final void AddASCIIMove(char c) { asciiMoves[c / 64] |= (1L << (c % 64)); } void AddChar(char c) { onlyChar++; matchSingleChar = c; int i; char temp; char temp1; if ((int)c < 128) // ASCII char { AddASCIIMove(c); return; } if (charMoves == null) charMoves = new char[10]; int len = charMoves.length; if (charMoves[len - 1] != 0) { charMoves = ExpandCharArr(charMoves, 10); len += 10; } for (i = 0; i < len; i++) if (charMoves[i] == 0 || charMoves[i] > c) break; if (!unicodeWarningGiven && c > 0xff && !Options.getJavaUnicodeEscape() && !Options.getUserCharStream()) { unicodeWarningGiven = true; JavaCCErrors.warning(LexGen.curRE, "Non-ASCII characters used in regular expression.\n" + "Please make sure you use the correct Reader when you create the parser, " + "one that can handle your character set."); } temp = charMoves[i]; charMoves[i] = c; for (i++; i < len; i++) { if (temp == 0) break; temp1 = charMoves[i]; charMoves[i] = temp; temp = temp1; } } void AddRange(char left, char right) { onlyChar = 2; int i; char tempLeft1, tempLeft2, tempRight1, tempRight2; if (left < 128) { if (right < 128) { for (; left <= right; left++) AddASCIIMove(left); return; } for (; left < 128; left++) AddASCIIMove(left); } if (!unicodeWarningGiven && (left > 0xff || right > 0xff) && !Options.getJavaUnicodeEscape() && !Options.getUserCharStream()) { unicodeWarningGiven = true; JavaCCErrors.warning(LexGen.curRE, "Non-ASCII characters used in regular expression.\n" + "Please make sure you use the correct Reader when you create the parser, " + "one that can handle your character set."); } if (rangeMoves == null) rangeMoves = new char[20]; int len = rangeMoves.length; if (rangeMoves[len - 1] != 0) { rangeMoves = ExpandCharArr(rangeMoves, 20); len += 20; } for (i = 0; i < len; i += 2) if (rangeMoves[i] == 0 || (rangeMoves[i] > left) || ((rangeMoves[i] == left) && (rangeMoves[i + 1] > right))) break; tempLeft1 = rangeMoves[i]; tempRight1 = rangeMoves[i + 1]; rangeMoves[i] = left; rangeMoves[i + 1] = right; for (i += 2; i < len; i += 2) { if (tempLeft1 == 0) break; tempLeft2 = rangeMoves[i]; tempRight2 = rangeMoves[i + 1]; rangeMoves[i] = tempLeft1; rangeMoves[i + 1] = tempRight1; tempLeft1 = tempLeft2; tempRight1 = tempRight2; } } // From hereon down all the functions are used for code generation private static boolean EqualCharArr(char[] arr1, char[] arr2) { if (arr1 == arr2) return true; if (arr1 != null && arr2 != null && arr1.length == arr2.length) { for (int i = arr1.length; i-- > 0;) if (arr1[i] != arr2[i]) return false; return true; } return false; } private boolean closureDone = false; /** This function computes the closure and also updates the kind so that * any time there is a move to this state, it can go on epsilon to a * new state in the epsilon moves that might have a lower kind of token * number for the same length. */ private void EpsilonClosure() { int i = 0; if (closureDone || mark[id]) return; mark[id] = true; // Recursively do closure for (i = 0; i < epsilonMoves.size(); i++) ((NfaState)epsilonMoves.get(i)).EpsilonClosure(); Enumeration e = epsilonMoves.elements(); while (e.hasMoreElements()) { NfaState tmp = (NfaState)e.nextElement(); for (i = 0; i < tmp.epsilonMoves.size(); i++) { NfaState tmp1 = (NfaState)tmp.epsilonMoves.get(i); if (tmp1.UsefulState() && !epsilonMoves.contains(tmp1)) { InsertInOrder(epsilonMoves, tmp1); done = false; } } if (kind > tmp.kind) kind = tmp.kind; } if (HasTransitions() && !epsilonMoves.contains(this)) InsertInOrder(epsilonMoves, this); } private boolean UsefulState() { return isFinal || HasTransitions(); } public boolean HasTransitions() { return (asciiMoves[0] != 0L || asciiMoves[1] != 0L || (charMoves != null && charMoves[0] != 0) || (rangeMoves != null && rangeMoves[0] != 0)); } void MergeMoves(NfaState other) { // Warning : This function does not merge epsilon moves if (asciiMoves == other.asciiMoves) { JavaCCErrors.semantic_error("Bug in JavaCC : Please send " + "a report along with the input that caused this. Thank you."); throw new Error(); } asciiMoves[0] = asciiMoves[0] | other.asciiMoves[0]; asciiMoves[1] = asciiMoves[1] | other.asciiMoves[1]; if (other.charMoves != null) { if (charMoves == null) charMoves = other.charMoves; else { char[] tmpCharMoves = new char[charMoves.length + other.charMoves.length]; System.arraycopy(charMoves, 0, tmpCharMoves, 0, charMoves.length); charMoves = tmpCharMoves; for (int i = 0; i < other.charMoves.length; i++) AddChar(other.charMoves[i]); } } if (other.rangeMoves != null) { if (rangeMoves == null) rangeMoves = other.rangeMoves; else { char[] tmpRangeMoves = new char[rangeMoves.length + other.rangeMoves.length]; System.arraycopy(rangeMoves, 0, tmpRangeMoves, 0, rangeMoves.length); rangeMoves = tmpRangeMoves; for (int i = 0; i < other.rangeMoves.length; i += 2) AddRange(other.rangeMoves[i], other.rangeMoves[i + 1]); } } if (other.kind < kind) kind = other.kind; if (other.kindToPrint < kindToPrint) kindToPrint = other.kindToPrint; isFinal |= other.isFinal; } NfaState CreateEquivState(List states) { NfaState newState = ((NfaState)states.get(0)).CreateClone(); newState.next = new NfaState(); InsertInOrder(newState.next.epsilonMoves, ((NfaState)states.get(0)).next); for (int i = 1; i < states.size(); i++) { NfaState tmp2 = ((NfaState)states.get(i)); if (tmp2.kind < newState.kind) newState.kind = tmp2.kind; newState.isFinal |= tmp2.isFinal; InsertInOrder(newState.next.epsilonMoves, tmp2.next); } return newState; } private NfaState GetEquivalentRunTimeState() { Outer : for (int i = allStates.size(); i-- > 0;) { NfaState other = (NfaState)allStates.get(i); if (this != other && other.stateName != -1 && kindToPrint == other.kindToPrint && asciiMoves[0] == other.asciiMoves[0] && asciiMoves[1] == other.asciiMoves[1] && EqualCharArr(charMoves, other.charMoves) && EqualCharArr(rangeMoves, other.rangeMoves)) { if (next == other.next) return other; else if (next != null && other.next != null) { if (next.epsilonMoves.size() == other.next.epsilonMoves.size()) { for (int j = 0; j < next.epsilonMoves.size(); j++) if (next.epsilonMoves.get(j) != other.next.epsilonMoves.get(j)) continue Outer; return other; } } } } return null; } // generates code (without outputting it) and returns the name used. void GenerateCode() { if (stateName != -1) return; if (next != null) { next.GenerateCode(); if (next.kind != Integer.MAX_VALUE) kindToPrint = next.kind; } if (stateName == -1 && HasTransitions()) { NfaState tmp = GetEquivalentRunTimeState(); if (tmp != null) { stateName = tmp.stateName; //???? //tmp.inNextOf += inNextOf; //???? dummy = true; return; } stateName = generatedStates++; indexedAllStates.add(this); GenerateNextStatesCode(); } } public static void ComputeClosures() { for (int i = allStates.size(); i-- > 0; ) { NfaState tmp = (NfaState)allStates.get(i); if (!tmp.closureDone) tmp.OptimizeEpsilonMoves(true); } for (int i = 0; i < allStates.size(); i++) { NfaState tmp = (NfaState)allStates.get(i); if (!tmp.closureDone) tmp.OptimizeEpsilonMoves(false); } for (int i = 0; i < allStates.size(); i++) { NfaState tmp = (NfaState)allStates.get(i); tmp.epsilonMoveArray = new NfaState[tmp.epsilonMoves.size()]; tmp.epsilonMoves.copyInto(tmp.epsilonMoveArray); } } void OptimizeEpsilonMoves(boolean optReqd) { int i; // First do epsilon closure done = false; while (!done) { if (mark == null || mark.length < allStates.size()) mark = new boolean[allStates.size()]; for (i = allStates.size(); i-- > 0;) mark[i] = false; done = true; EpsilonClosure(); } for (i = allStates.size(); i-- > 0;) ((NfaState)allStates.get(i)).closureDone = mark[((NfaState)allStates.get(i)).id]; // Warning : The following piece of code is just an optimization. // in case of trouble, just remove this piece. boolean sometingOptimized = true; NfaState newState = null; NfaState tmp1, tmp2; int j; List equivStates = null; while (sometingOptimized) { sometingOptimized = false; for (i = 0; optReqd && i < epsilonMoves.size(); i++) { if ((tmp1 = (NfaState)epsilonMoves.get(i)).HasTransitions()) { for (j = i + 1; j < epsilonMoves.size(); j++) { if ((tmp2 = (NfaState)epsilonMoves.get(j)). HasTransitions() && (tmp1.asciiMoves[0] == tmp2.asciiMoves[0] && tmp1.asciiMoves[1] == tmp2.asciiMoves[1] && EqualCharArr(tmp1.charMoves, tmp2.charMoves) && EqualCharArr(tmp1.rangeMoves, tmp2.rangeMoves))) { if (equivStates == null) { equivStates = new ArrayList(); equivStates.add(tmp1); } InsertInOrder(equivStates, tmp2); epsilonMoves.removeElementAt(j--); } } } if (equivStates != null) { sometingOptimized = true; String tmp = ""; for (int l = 0; l < equivStates.size(); l++) tmp += String.valueOf( ((NfaState)equivStates.get(l)).id) + ", "; if ((newState = (NfaState)equivStatesTable.get(tmp)) == null) { newState = CreateEquivState(equivStates); equivStatesTable.put(tmp, newState); } epsilonMoves.removeElementAt(i--); epsilonMoves.add(newState); equivStates = null; newState = null; } } for (i = 0; i < epsilonMoves.size(); i++) { //if ((tmp1 = (NfaState)epsilonMoves.elementAt(i)).next == null) //continue; tmp1 = (NfaState)epsilonMoves.get(i); for (j = i + 1; j < epsilonMoves.size(); j++) { tmp2 = (NfaState)epsilonMoves.get(j); if (tmp1.next == tmp2.next) { if (newState == null) { newState = tmp1.CreateClone(); newState.next = tmp1.next; sometingOptimized = true; } newState.MergeMoves(tmp2); epsilonMoves.removeElementAt(j--); } } if (newState != null) { epsilonMoves.removeElementAt(i--); epsilonMoves.add(newState); newState = null; } } } // End Warning // Generate an array of states for epsilon moves (not vector) if (epsilonMoves.size() > 0) { for (i = 0; i < epsilonMoves.size(); i++) // Since we are doing a closure, just epsilon moves are unncessary if (((NfaState)epsilonMoves.get(i)).HasTransitions()) usefulEpsilonMoves++; else epsilonMoves.removeElementAt(i--); } } void GenerateNextStatesCode() { if (next.usefulEpsilonMoves > 0) next.GetEpsilonMovesString(); } String GetEpsilonMovesString() { int[] stateNames = new int[usefulEpsilonMoves]; int cnt = 0; if (epsilonMovesString != null) return epsilonMovesString; if (usefulEpsilonMoves > 0) { NfaState tempState; epsilonMovesString = "{ "; for (int i = 0; i < epsilonMoves.size(); i++) { if ((tempState = (NfaState)epsilonMoves.get(i)). HasTransitions()) { if (tempState.stateName == -1) tempState.GenerateCode(); ((NfaState)indexedAllStates.get(tempState.stateName)).inNextOf++; stateNames[cnt] = tempState.stateName; epsilonMovesString += tempState.stateName + ", "; if (cnt++ > 0 && cnt % 16 == 0) epsilonMovesString += "\n"; } } epsilonMovesString += "};"; } usefulEpsilonMoves = cnt; if (epsilonMovesString != null && allNextStates.get(epsilonMovesString) == null) { int[] statesToPut = new int[usefulEpsilonMoves]; System.arraycopy(stateNames, 0, statesToPut, 0, cnt); allNextStates.put(epsilonMovesString, statesToPut); } return epsilonMovesString; } public static boolean CanStartNfaUsingAscii(char c) { if (c >= 128) throw new Error("JavaCC Bug: Please send mail to sankar@cs.stanford.edu"); String s = LexGen.initialState.GetEpsilonMovesString(); if (s == null || s.equals("null;")) return false; int[] states = (int[])allNextStates.get(s); for (int i = 0; i < states.length; i++) { NfaState tmp = (NfaState)indexedAllStates.get(states[i]); if ((tmp.asciiMoves[c / 64 ] & (1L << c % 64)) != 0L) return true; } return false; } final boolean CanMoveUsingChar(char c) { int i; if (onlyChar == 1) return c == matchSingleChar; if (c < 128) return ((asciiMoves[c / 64 ] & (1L << c % 64)) != 0L); // Just check directly if there is a move for this char if (charMoves != null && charMoves[0] != 0) { for (i = 0; i < charMoves.length; i++) { if (c == charMoves[i]) return true; else if (c < charMoves[i] || charMoves[i] == 0) break; } } // For ranges, iterate thru the table to see if the current char // is in some range if (rangeMoves != null && rangeMoves[0] != 0) for (i = 0; i < rangeMoves.length; i += 2) if (c >= rangeMoves[i] && c <= rangeMoves[i + 1]) return true; else if (c < rangeMoves[i] || rangeMoves[i] == 0) break; //return (nextForNegatedList != null); return false; } public int getFirstValidPos(String s, int i, int len) { if (onlyChar == 1) { char c = matchSingleChar; while (c != s.charAt(i) && ++i < len); return i; } do { if (CanMoveUsingChar(s.charAt(i))) return i; } while (++i < len); return i; } public int MoveFrom(char c, List newStates) { if (CanMoveUsingChar(c)) { for (int i = next.epsilonMoves.size(); i-- > 0;) InsertInOrder(newStates, (NfaState)next.epsilonMoves.get(i)); return kindToPrint; } return Integer.MAX_VALUE; } public static int MoveFromSet(char c, List states, List newStates) { int tmp; int retVal = Integer.MAX_VALUE; for (int i = states.size(); i-- > 0;) if (retVal > (tmp = ((NfaState)states.get(i)).MoveFrom(c, newStates))) retVal = tmp; return retVal; } public static int moveFromSetForRegEx(char c, NfaState[] states, NfaState[] newStates, int round) { int start = 0; int sz = states.length; for (int i = 0; i < sz; i++) { NfaState tmp1, tmp2; if ((tmp1 = states[i]) == null) break; if (tmp1.CanMoveUsingChar(c)) { if (tmp1.kindToPrint != Integer.MAX_VALUE) { newStates[start] = null; return 1; } NfaState[] v = tmp1.next.epsilonMoveArray; for (int j = v.length; j-- > 0;) { if ((tmp2 = v[j]).round != round) { tmp2.round = round; newStates[start++] = tmp2; } } } } newStates[start] = null; return Integer.MAX_VALUE; } static List allBitVectors = new ArrayList(); /* This function generates the bit vectors of low and hi bytes for common bit vectors and returns those that are not common with anything (in loBytes) and returns an array of indices that can be used to generate the function names for char matching using the common bit vectors. It also generates code to match a char with the common bit vectors. (Need a better comment). */ static int[] tmpIndices = new int[512]; // 2 * 256 void GenerateNonAsciiMoves(java.io.PrintWriter ostr) { int i = 0, j = 0; char hiByte; int cnt = 0; long[][] loBytes = new long[256][4]; if ((charMoves == null || charMoves[0] == 0) && (rangeMoves == null || rangeMoves[0] == 0)) return; if (charMoves != null) { for (i = 0; i < charMoves.length; i++) { if (charMoves[i] == 0) break; hiByte = (char)(charMoves[i] >> 8); loBytes[hiByte][(charMoves[i] & 0xff) / 64] |= (1L << ((charMoves[i] & 0xff) % 64)); } } if (rangeMoves != null) { for (i = 0; i < rangeMoves.length; i += 2) { if (rangeMoves[i] == 0) break; char c, r; r = (char)(rangeMoves[i + 1] & 0xff); hiByte = (char)(rangeMoves[i] >> 8); if (hiByte == (char)(rangeMoves[i + 1] >> 8)) { for (c = (char)(rangeMoves[i] & 0xff); c <= r; c++) loBytes[hiByte][c / 64] |= (1L << (c % 64)); continue; } for (c = (char)(rangeMoves[i] & 0xff); c <= 0xff; c++) loBytes[hiByte][c / 64] |= (1L << (c % 64)); while (++hiByte < (char)(rangeMoves[i + 1] >> 8)) { loBytes[hiByte][0] |= 0xffffffffffffffffL; loBytes[hiByte][1] |= 0xffffffffffffffffL; loBytes[hiByte][2] |= 0xffffffffffffffffL; loBytes[hiByte][3] |= 0xffffffffffffffffL; } for (c = 0; c <= r; c++) loBytes[hiByte][c / 64] |= (1L << (c % 64)); } } long[] common = null; boolean[] done = new boolean[256]; for (i = 0; i <= 255; i++) { if (done[i] || (done[i] = loBytes[i][0] == 0 && loBytes[i][1] == 0 && loBytes[i][2] == 0 && loBytes[i][3] == 0)) continue; for (j = i + 1; j < 256; j++) { if (done[j]) continue; if (loBytes[i][0] == loBytes[j][0] && loBytes[i][1] == loBytes[j][1] && loBytes[i][2] == loBytes[j][2] && loBytes[i][3] == loBytes[j][3]) { done[j] = true; if (common == null) { done[i] = true; common = new long[4]; common[i / 64] |= (1L << (i % 64)); } common[j / 64] |= (1L << (j % 64)); } } if (common != null) { Integer ind; String tmp; tmp = "{\n 0x" + Long.toHexString(common[0]) + "L, " + "0x" + Long.toHexString(common[1]) + "L, " + "0x" + Long.toHexString(common[2]) + "L, " + "0x" + Long.toHexString(common[3]) + "L\n};"; if ((ind = (Integer)lohiByteTab.get(tmp)) == null) { allBitVectors.add(tmp); if (!AllBitsSet(tmp)) ostr.println("static final long[] jjbitVec" + lohiByteCnt + " = " + tmp); lohiByteTab.put(tmp, ind = new Integer(lohiByteCnt++)); } tmpIndices[cnt++] = ind.intValue(); tmp = "{\n 0x" + Long.toHexString(loBytes[i][0]) + "L, " + "0x" + Long.toHexString(loBytes[i][1]) + "L, " + "0x" + Long.toHexString(loBytes[i][2]) + "L, " + "0x" + Long.toHexString(loBytes[i][3]) + "L\n};"; if ((ind = (Integer)lohiByteTab.get(tmp)) == null) { allBitVectors.add(tmp); if (!AllBitsSet(tmp)) ostr.println("static final long[] jjbitVec" + lohiByteCnt + " = " + tmp); lohiByteTab.put(tmp, ind = new Integer(lohiByteCnt++)); } tmpIndices[cnt++] = ind.intValue(); common = null; } } nonAsciiMoveIndices = new int[cnt]; System.arraycopy(tmpIndices, 0, nonAsciiMoveIndices, 0, cnt); /* System.out.println("state : " + stateName + " cnt : " + cnt); while (cnt > 0) { System.out.print(nonAsciiMoveIndices[cnt - 1] + ", " + nonAsciiMoveIndices[cnt - 2] + ", "); cnt -= 2; } System.out.println(""); */ for (i = 0; i < 256; i++) { if (done[i]) loBytes[i] = null; else { //System.out.print(i + ", "); String tmp; Integer ind; tmp = "{\n 0x" + Long.toHexString(loBytes[i][0]) + "L, " + "0x" + Long.toHexString(loBytes[i][1]) + "L, " + "0x" + Long.toHexString(loBytes[i][2]) + "L, " + "0x" + Long.toHexString(loBytes[i][3]) + "L\n};"; if ((ind = (Integer)lohiByteTab.get(tmp)) == null) { allBitVectors.add(tmp); if (!AllBitsSet(tmp)) ostr.println("static final long[] jjbitVec" + lohiByteCnt + " = " + tmp); lohiByteTab.put(tmp, ind = new Integer(lohiByteCnt++)); } if (loByteVec == null) loByteVec = new Vector(); loByteVec.add(new Integer(i)); loByteVec.add(ind); } } //System.out.println(""); UpdateDuplicateNonAsciiMoves(); } private void UpdateDuplicateNonAsciiMoves() { for (int i = 0; i < nonAsciiTableForMethod.size(); i++) { NfaState tmp = (NfaState)nonAsciiTableForMethod.get(i); if (EqualLoByteVectors(loByteVec, tmp.loByteVec) && EqualNonAsciiMoveIndices(nonAsciiMoveIndices, tmp.nonAsciiMoveIndices)) { nonAsciiMethod = i; return; } } nonAsciiMethod = nonAsciiTableForMethod.size(); nonAsciiTableForMethod.add(this); } private static boolean EqualLoByteVectors(List vec1, List vec2) { if (vec1 == null || vec2 == null) return false; if (vec1 == vec2) return true; if (vec1.size() != vec2.size()) return false; for (int i = 0; i < vec1.size(); i++) { if (((Integer)vec1.get(i)).intValue() != ((Integer)vec2.get(i)).intValue()) return false; } return true; } private static boolean EqualNonAsciiMoveIndices(int[] moves1, int[] moves2) { if (moves1 == moves2) return true; if (moves1 == null || moves2 == null) return false; if (moves1.length != moves2.length) return false; for (int i = 0; i < moves1.length; i++) { if (moves1[i] != moves2[i]) return false; } return true; } static String allBits = "{\n 0xffffffffffffffffL, " + "0xffffffffffffffffL, " + "0xffffffffffffffffL, " + "0xffffffffffffffffL\n};"; static boolean AllBitsSet(String bitVec) { return bitVec.equals(allBits); } static int AddStartStateSet(String stateSetString) { return AddCompositeStateSet(stateSetString, true); } private static int AddCompositeStateSet(String stateSetString, boolean starts) { Integer stateNameToReturn; if ((stateNameToReturn = (Integer)stateNameForComposite.get(stateSetString)) != null) return stateNameToReturn.intValue(); int toRet = 0; int[] nameSet = (int[])allNextStates.get(stateSetString); if (!starts) stateBlockTable.put(stateSetString, stateSetString); if (nameSet == null) throw new Error("JavaCC Bug: Please send mail to sankar@cs.stanford.edu; nameSet null for : " + stateSetString); if (nameSet.length == 1) { stateNameToReturn = new Integer(nameSet[0]); stateNameForComposite.put(stateSetString, stateNameToReturn); return nameSet[0]; } for (int i = 0; i < nameSet.length; i++) { if (nameSet[i] == -1) continue; NfaState st = (NfaState)indexedAllStates.get(nameSet[i]); st.isComposite = true; st.compositeStates = nameSet; } while (toRet < nameSet.length && (starts && ((NfaState)indexedAllStates.get(nameSet[toRet])).inNextOf > 1)) toRet++; Enumeration e = compositeStateTable.keys(); String s; while (e.hasMoreElements()) { s = (String)e.nextElement(); if (!s.equals(stateSetString) && Intersect(stateSetString, s)) { int[] other = (int[])compositeStateTable.get(s); while (toRet < nameSet.length && ((starts && ((NfaState)indexedAllStates.get(nameSet[toRet])).inNextOf > 1) || ElemOccurs(nameSet[toRet], other) >= 0)) toRet++; } } int tmp; if (toRet >= nameSet.length) { if (dummyStateIndex == -1) tmp = dummyStateIndex = generatedStates; else tmp = ++dummyStateIndex; } else tmp = nameSet[toRet]; stateNameToReturn = new Integer(tmp); stateNameForComposite.put(stateSetString, stateNameToReturn); compositeStateTable.put(stateSetString, nameSet); return tmp; } private static int StateNameForComposite(String stateSetString) { return ((Integer)stateNameForComposite.get(stateSetString)).intValue(); } static int InitStateName() { String s = LexGen.initialState.GetEpsilonMovesString(); if (LexGen.initialState.usefulEpsilonMoves != 0) return StateNameForComposite(s); return -1; } public void GenerateInitMoves(java.io.PrintWriter ostr) { GetEpsilonMovesString(); if (epsilonMovesString == null) epsilonMovesString = "null;"; AddStartStateSet(epsilonMovesString); } static Hashtable tableToDump = new Hashtable(); static List orderedStateSet = new ArrayList(); static int lastIndex = 0; private static int[] GetStateSetIndicesForUse(String arrayString) { int[] ret; int[] set = (int[])allNextStates.get(arrayString); if ((ret = (int[])tableToDump.get(arrayString)) == null) { ret = new int[2]; ret[0] = lastIndex; ret[1] = lastIndex + set.length - 1; lastIndex += set.length; tableToDump.put(arrayString, ret); orderedStateSet.add(set); } return ret; } public static void DumpStateSets(java.io.PrintWriter ostr) { int cnt = 0; ostr.print("static final int[] jjnextStates = {"); for (int i = 0; i < orderedStateSet.size(); i++) { int[] set = (int[])orderedStateSet.get(i); for (int j = 0; j < set.length; j++) { if (cnt++ % 16 == 0) ostr.print("\n "); ostr.print(set[j] + ", "); } } ostr.println("\n};"); } static String GetStateSetString(int[] states) { String retVal = "{ "; for (int i = 0; i < states.length; ) { retVal += states[i] + ", "; if (i++ > 0 && i % 16 == 0) retVal += "\n"; } retVal += "};"; allNextStates.put(retVal, states); return retVal; } static String GetStateSetString(List states) { if (states == null || states.size() == 0) return "null;"; int[] set = new int[states.size()]; String retVal = "{ "; for (int i = 0; i < states.size(); ) { int k; retVal += (k = ((NfaState)states.get(i)).stateName) + ", "; set[i] = k; if (i++ > 0 && i % 16 == 0) retVal += "\n"; } retVal += "};"; allNextStates.put(retVal, set); return retVal; } static int NumberOfBitsSet(long l) { int ret = 0; for (int i = 0; i < 63; i++) if (((l >> i) & 1L) != 0L) ret++; return ret; } static int OnlyOneBitSet(long l) { int oneSeen = -1; for (int i = 0; i < 64; i++) if (((l >> i) & 1L) != 0L) { if (oneSeen >= 0) return -1; oneSeen = i; } return oneSeen; } private static int ElemOccurs(int elem, int[] arr) { for (int i = arr.length; i-- > 0;) if (arr[i] == elem) return i; return -1; } private boolean FindCommonBlocks() { if (next == null || next.usefulEpsilonMoves <= 1) return false; if (stateDone == null) stateDone = new boolean[generatedStates]; String set = next.epsilonMovesString; int[] nameSet = (int[])allNextStates.get(set); if (nameSet.length <= 2 || compositeStateTable.get(set) != null) return false; int i; int freq[] = new int[nameSet.length]; boolean live[] = new boolean[nameSet.length]; int[] count = new int[allNextStates.size()]; for (i = 0; i < nameSet.length; i++) { if (nameSet[i] != -1) { if (live[i] = !stateDone[nameSet[i]]) count[0]++; } } int j, blockLen = 0, commonFreq = 0; Enumeration e = allNextStates.keys(); boolean needUpdate; while (e.hasMoreElements()) { int[] tmpSet = (int[])allNextStates.get(e.nextElement()); if (tmpSet == nameSet) continue; needUpdate = false; for (j = 0; j < nameSet.length; j++) { if (nameSet[j] == -1) continue; if (live[j] && ElemOccurs(nameSet[j], tmpSet) >= 0) { if (!needUpdate) { needUpdate = true; commonFreq++; } count[freq[j]]--; count[commonFreq]++; freq[j] = commonFreq; } } if (needUpdate) { int foundFreq = -1; blockLen = 0; for (j = 0; j <= commonFreq; j++) if (count[j] > blockLen) { foundFreq = j; blockLen = count[j]; } if (blockLen <= 1) return false; for (j = 0; j < nameSet.length; j++) if (nameSet[j] != -1 && freq[j] != foundFreq) { live[j] = false; count[freq[j]]--; } } } if (blockLen <= 1) return false; int[] commonBlock = new int[blockLen]; int cnt = 0; //System.out.println("Common Block for " + set + " :"); for (i = 0; i < nameSet.length; i++) { if (live[i]) { if (((NfaState)indexedAllStates.get(nameSet[i])).isComposite) return false; stateDone[nameSet[i]] = true; commonBlock[cnt++] = nameSet[i]; //System.out.print(nameSet[i] + ", "); } } //System.out.println(""); String s = GetStateSetString(commonBlock); e = allNextStates.keys(); Outer : while (e.hasMoreElements()) { int at; boolean firstOne = true; String stringToFix; int[] setToFix = (int[])allNextStates.get(stringToFix = (String)e.nextElement()); if (setToFix == commonBlock) continue; for (int k = 0; k < cnt; k++) { if ((at = ElemOccurs(commonBlock[k], setToFix)) >= 0) { if (!firstOne) setToFix[at] = -1; firstOne = false; } else continue Outer; } if (stateSetsToFix.get(stringToFix) == null) stateSetsToFix.put(stringToFix, setToFix); } next.usefulEpsilonMoves -= blockLen - 1; AddCompositeStateSet(s, false); return true; } private boolean CheckNextOccursTogether() { if (next == null || next.usefulEpsilonMoves <= 1) return true; String set = next.epsilonMovesString; int[] nameSet = (int[])allNextStates.get(set); if (nameSet.length == 1 || compositeStateTable.get(set) != null || stateSetsToFix.get(set) != null) return false; int i; Hashtable occursIn = new Hashtable(); NfaState tmp = (NfaState)allStates.get(nameSet[0]); for (i = 1; i < nameSet.length; i++) { NfaState tmp1 = (NfaState)allStates.get(nameSet[i]); if (tmp.inNextOf != tmp1.inNextOf) return false; } int isPresent, j; Enumeration e = allNextStates.keys(); while (e.hasMoreElements()) { String s; int[] tmpSet = (int[])allNextStates.get(s = (String)e.nextElement()); if (tmpSet == nameSet) continue; isPresent = 0; for (j = 0; j < nameSet.length; j++) { if (ElemOccurs(nameSet[j], tmpSet) >= 0) isPresent++; else if (isPresent > 0) return false; } if (isPresent == j) { if (tmpSet.length > nameSet.length) occursIn.put(s, tmpSet); //May not need. But safe. if (compositeStateTable.get(s) != null || stateSetsToFix.get(s) != null) return false; } else if (isPresent != 0) return false; } e = occursIn.keys(); while (e.hasMoreElements()) { String s; int[] setToFix = (int[])occursIn.get(s = (String)e.nextElement()); if (stateSetsToFix.get(s) == null) stateSetsToFix.put(s, setToFix); for (int k = 0; k < setToFix.length; k++) if (ElemOccurs(setToFix[k], nameSet) > 0) // Not >= since need the first one (0) setToFix[k] = -1; } next.usefulEpsilonMoves = 1; AddCompositeStateSet(next.epsilonMovesString, false); return true; } private static void FixStateSets() { Hashtable fixedSets = new Hashtable(); Enumeration e = stateSetsToFix.keys(); int[] tmp = new int[generatedStates]; int i; while (e.hasMoreElements()) { String s; int[] toFix = (int[])stateSetsToFix.get(s = (String)e.nextElement()); int cnt = 0; //System.out.print("Fixing : "); for (i = 0; i < toFix.length; i++) { //System.out.print(toFix[i] + ", "); if (toFix[i] != -1) tmp[cnt++] = toFix[i]; } int[] fixed = new int[cnt]; System.arraycopy(tmp, 0, fixed, 0, cnt); fixedSets.put(s, fixed); allNextStates.put(s, fixed); //System.out.println(" as " + GetStateSetString(fixed)); } for (i = 0; i < allStates.size(); i++) { NfaState tmpState = (NfaState)allStates.get(i); int[] newSet; if (tmpState.next == null || tmpState.next.usefulEpsilonMoves == 0) continue; /*if (compositeStateTable.get(tmpState.next.epsilonMovesString) != null) tmpState.next.usefulEpsilonMoves = 1; else*/ if ((newSet = (int[])fixedSets.get(tmpState.next.epsilonMovesString)) != null) tmpState.FixNextStates(newSet); } } private final void FixNextStates(int[] newSet) { next.usefulEpsilonMoves = newSet.length; //next.epsilonMovesString = GetStateSetString(newSet); } private static boolean Intersect(String set1, String set2) { if (set1 == null || set2 == null) return false; int[] nameSet1 = (int[])allNextStates.get(set1); int[] nameSet2 = (int[])allNextStates.get(set2); if (nameSet1 == null || nameSet2 == null) return false; if (nameSet1 == nameSet2) return true; for (int i = nameSet1.length; i-- > 0; ) for (int j = nameSet2.length; j-- > 0; ) if (nameSet1[i] == nameSet2[j]) return true; return false; } private static void DumpHeadForCase(java.io.PrintWriter ostr, int byteNum) { if (byteNum == 0) ostr.println(" long l = 1L << curChar;"); else if (byteNum == 1) ostr.println(" long l = 1L << (curChar & 077);"); else { if (Options.getJavaUnicodeEscape() || unicodeWarningGiven) { ostr.println(" int hiByte = (int)(curChar >> 8);"); ostr.println(" int i1 = hiByte >> 6;"); ostr.println(" long l1 = 1L << (hiByte & 077);"); } ostr.println(" int i2 = (curChar & 0xff) >> 6;"); ostr.println(" long l2 = 1L << (curChar & 077);"); } //ostr.println(" MatchLoop: do"); ostr.println(" do"); ostr.println(" {"); ostr.println(" switch(jjstateSet[--i])"); ostr.println(" {"); } private static Vector PartitionStatesSetForAscii(int[] states, int byteNum) { int[] cardinalities = new int[states.length]; Vector original = new Vector(); Vector partition = new Vector(); NfaState tmp; original.setSize(states.length); int cnt = 0; for (int i = 0; i < states.length; i++) { tmp = (NfaState)allStates.get(states[i]); if (tmp.asciiMoves[byteNum] != 0L) { int j; int p = NumberOfBitsSet(tmp.asciiMoves[byteNum]); for (j = 0; j < i; j++) if (cardinalities[j] <= p) break; for (int k = i; k > j; k--) cardinalities[k] = cardinalities[k - 1]; cardinalities[j] = p; original.insertElementAt(tmp, j); cnt++; } } original.setSize(cnt); while (original.size() > 0) { tmp = (NfaState)original.get(0); original.removeElement(tmp); long bitVec = tmp.asciiMoves[byteNum]; List subSet = new ArrayList(); subSet.add(tmp); for (int j = 0; j < original.size(); j++) { NfaState tmp1 = (NfaState)original.get(j); if ((tmp1.asciiMoves[byteNum] & bitVec) == 0L) { bitVec |= tmp1.asciiMoves[byteNum]; subSet.add(tmp1); original.removeElementAt(j--); } } partition.add(subSet); } return partition; } private String PrintNoBreak(java.io.PrintWriter ostr, int byteNum, boolean[] dumped) { if (inNextOf != 1) throw new Error("JavaCC Bug: Please send mail to sankar@cs.stanford.edu"); dumped[stateName] = true; if (byteNum >= 0) { if (asciiMoves[byteNum] != 0L) { ostr.println(" case " + stateName + ":"); DumpAsciiMoveForCompositeState(ostr, byteNum, false); return ""; } } else if (nonAsciiMethod != -1) { ostr.println(" case " + stateName + ":"); DumpNonAsciiMoveForCompositeState(ostr); return ""; } return (" case " + stateName + ":\n"); } private static void DumpCompositeStatesAsciiMoves(java.io.PrintWriter ostr, String key, int byteNum, boolean[] dumped) { int i; int[] nameSet = (int[])allNextStates.get(key); if (nameSet.length == 1 || dumped[StateNameForComposite(key)]) return; NfaState toBePrinted = null; int neededStates = 0; NfaState tmp; NfaState stateForCase = null; String toPrint = ""; boolean stateBlock = (stateBlockTable.get(key) != null); for (i = 0; i < nameSet.length; i++) { tmp = (NfaState)allStates.get(nameSet[i]); if (tmp.asciiMoves[byteNum] != 0L) { if (neededStates++ == 1) break; else toBePrinted = tmp; } else dumped[tmp.stateName] = true; if (tmp.stateForCase != null) { if (stateForCase != null) throw new Error("JavaCC Bug: Please send mail to sankar@cs.stanford.edu : "); stateForCase = tmp.stateForCase; } } if (stateForCase != null) toPrint = stateForCase.PrintNoBreak(ostr, byteNum, dumped); if (neededStates == 0) { if (stateForCase != null && toPrint.equals("")) ostr.println(" break;"); return; } if (neededStates == 1) { //if (byteNum == 1) //System.out.println(toBePrinted.stateName + " is the only state for " //+ key + " ; and key is : " + StateNameForComposite(key)); if (!toPrint.equals("")) ostr.print(toPrint); ostr.println(" case " + StateNameForComposite(key) + ":"); if (!dumped[toBePrinted.stateName] && !stateBlock && toBePrinted.inNextOf > 1) ostr.println(" case " + toBePrinted.stateName + ":"); dumped[toBePrinted.stateName] = true; toBePrinted.DumpAsciiMove(ostr, byteNum, dumped); return; } List partition = PartitionStatesSetForAscii(nameSet, byteNum); if (!toPrint.equals("")) ostr.print(toPrint); int keyState = StateNameForComposite(key); ostr.println(" case " + keyState + ":"); if (keyState < generatedStates) dumped[keyState] = true; for (i = 0; i < partition.size(); i++) { List subSet = (List)partition.get(i); for (int j = 0; j < subSet.size(); j++) { tmp = (NfaState)subSet.get(j); if (stateBlock) dumped[tmp.stateName] = true; tmp.DumpAsciiMoveForCompositeState(ostr, byteNum, j != 0); } } if (stateBlock) ostr.println(" break;"); else ostr.println(" break;"); } private boolean selfLoop() { if (next == null || next.epsilonMovesString == null) return false; int[] set = (int[])allNextStates.get(next.epsilonMovesString); return ElemOccurs(stateName, set) >= 0; } private void DumpAsciiMoveForCompositeState(java.io.PrintWriter ostr, int byteNum, boolean elseNeeded) { boolean nextIntersects = selfLoop(); for (int j = 0; j < allStates.size(); j++) { NfaState temp1 = (NfaState)allStates.get(j); if (this == temp1 || temp1.stateName == -1 || temp1.dummy || stateName == temp1.stateName || temp1.asciiMoves[byteNum] == 0L) continue; if (!nextIntersects && Intersect(temp1.next.epsilonMovesString, next.epsilonMovesString)) { nextIntersects = true; break; } } //System.out.println(stateName + " \'s nextIntersects : " + nextIntersects); String prefix = ""; if (asciiMoves[byteNum] != 0xffffffffffffffffL) { int oneBit = OnlyOneBitSet(asciiMoves[byteNum]); if (oneBit != -1) ostr.println(" " + (elseNeeded ? "else " : "") + "if (curChar == " + (64 * byteNum + oneBit) + ")"); else ostr.println(" " + (elseNeeded ? "else " : "") + "if ((0x" + Long.toHexString(asciiMoves[byteNum]) + "L & l) != 0L)"); prefix = " "; } if (kindToPrint != Integer.MAX_VALUE) { if (asciiMoves[byteNum] != 0xffffffffffffffffL) { ostr.println(" {"); } ostr.println(prefix + " if (kind > " + kindToPrint + ")"); ostr.println(prefix + " kind = " + kindToPrint + ";"); } if (next != null && next.usefulEpsilonMoves > 0) { int[] stateNames = (int[])allNextStates.get( next.epsilonMovesString); if (next.usefulEpsilonMoves == 1) { int name = stateNames[0]; if (nextIntersects) ostr.println(prefix + " jjCheckNAdd(" + name + ");"); else ostr.println(prefix + " jjstateSet[jjnewStateCnt++] = " + name + ";"); } else if (next.usefulEpsilonMoves == 2 && nextIntersects) { ostr.println(prefix + " jjCheckNAddTwoStates(" + stateNames[0] + ", " + stateNames[1] + ");"); } else { int[] indices = GetStateSetIndicesForUse(next.epsilonMovesString); boolean notTwo = (indices[0] + 1 != indices[1]); if (nextIntersects) { ostr.print(prefix + " jjCheckNAddStates(" + indices[0]); if (notTwo) { jjCheckNAddStatesDualNeeded = true; ostr.print(", " + indices[1]); } else { jjCheckNAddStatesUnaryNeeded = true; } ostr.println(");"); } else ostr.println(prefix + " jjAddStates(" + indices[0] + ", " + indices[1] + ");"); } } if (asciiMoves[byteNum] != 0xffffffffffffffffL && kindToPrint != Integer.MAX_VALUE) ostr.println(" }"); } private void DumpAsciiMove(java.io.PrintWriter ostr, int byteNum, boolean dumped[]) { boolean nextIntersects = selfLoop() && isComposite; boolean onlyState = true; for (int j = 0; j < allStates.size(); j++) { NfaState temp1 = (NfaState)allStates.get(j); if (this == temp1 || temp1.stateName == -1 || temp1.dummy || stateName == temp1.stateName || temp1.asciiMoves[byteNum] == 0L) continue; if (onlyState && (asciiMoves[byteNum] & temp1.asciiMoves[byteNum]) != 0L) onlyState = false; if (!nextIntersects && Intersect(temp1.next.epsilonMovesString, next.epsilonMovesString)) nextIntersects = true; if (!dumped[temp1.stateName] && !temp1.isComposite && asciiMoves[byteNum] == temp1.asciiMoves[byteNum] && kindToPrint == temp1.kindToPrint && (next.epsilonMovesString == temp1.next.epsilonMovesString || (next.epsilonMovesString != null && temp1.next.epsilonMovesString != null && next.epsilonMovesString.equals( temp1.next.epsilonMovesString)))) { dumped[temp1.stateName] = true; ostr.println(" case " + temp1.stateName + ":"); } } //if (onlyState) //nextIntersects = false; int oneBit = OnlyOneBitSet(asciiMoves[byteNum]); if (asciiMoves[byteNum] != 0xffffffffffffffffL) { if ((next == null || next.usefulEpsilonMoves == 0) && kindToPrint != Integer.MAX_VALUE) { String kindCheck = ""; if (!onlyState) kindCheck = " && kind > " + kindToPrint; if (oneBit != -1) ostr.println(" if (curChar == " + (64 * byteNum + oneBit) + kindCheck + ")"); else ostr.println(" if ((0x" + Long.toHexString(asciiMoves[byteNum]) + "L & l) != 0L" + kindCheck + ")"); ostr.println(" kind = " + kindToPrint + ";"); if (onlyState) ostr.println(" break;"); else ostr.println(" break;"); return; } } String prefix = ""; if (kindToPrint != Integer.MAX_VALUE) { if (oneBit != -1) { ostr.println(" if (curChar != " + (64 * byteNum + oneBit) + ")"); ostr.println(" break;"); } else if (asciiMoves[byteNum] != 0xffffffffffffffffL) { ostr.println(" if ((0x" + Long.toHexString(asciiMoves[byteNum]) + "L & l) == 0L)"); ostr.println(" break;"); } if (onlyState) { ostr.println(" kind = " + kindToPrint + ";"); } else { ostr.println(" if (kind > " + kindToPrint + ")"); ostr.println(" kind = " + kindToPrint + ";"); } } else { if (oneBit != -1) { ostr.println(" if (curChar == " + (64 * byteNum + oneBit) + ")"); prefix = " "; } else if (asciiMoves[byteNum] != 0xffffffffffffffffL) { ostr.println(" if ((0x" + Long.toHexString(asciiMoves[byteNum]) + "L & l) != 0L)"); prefix = " "; } } if (next != null && next.usefulEpsilonMoves > 0) { int[] stateNames = (int[])allNextStates.get( next.epsilonMovesString); if (next.usefulEpsilonMoves == 1) { int name = stateNames[0]; if (nextIntersects) ostr.println(prefix + " jjCheckNAdd(" + name + ");"); else ostr.println(prefix + " jjstateSet[jjnewStateCnt++] = " + name + ";"); } else if (next.usefulEpsilonMoves == 2 && nextIntersects) { ostr.println(prefix + " jjCheckNAddTwoStates(" + stateNames[0] + ", " + stateNames[1] + ");"); } else { int[] indices = GetStateSetIndicesForUse(next.epsilonMovesString); boolean notTwo = (indices[0] + 1 != indices[1]); if (nextIntersects) { ostr.print(prefix + " jjCheckNAddStates(" + indices[0]); if (notTwo) { jjCheckNAddStatesDualNeeded = true; ostr.print(", " + indices[1]); } else { jjCheckNAddStatesUnaryNeeded = true; } ostr.println(");"); } else ostr.println(prefix + " jjAddStates(" + indices[0] + ", " + indices[1] + ");"); } } if (onlyState) ostr.println(" break;"); else ostr.println(" break;"); } private static void DumpAsciiMoves(java.io.PrintWriter ostr, int byteNum) { boolean[] dumped = new boolean[Math.max(generatedStates, dummyStateIndex + 1)]; Enumeration e = compositeStateTable.keys(); DumpHeadForCase(ostr, byteNum); while (e.hasMoreElements()) DumpCompositeStatesAsciiMoves(ostr, (String)e.nextElement(), byteNum, dumped); for (int i = 0; i < allStates.size(); i++) { NfaState temp = (NfaState)allStates.get(i); if (dumped[temp.stateName] || temp.lexState != LexGen.lexStateIndex || !temp.HasTransitions() || temp.dummy || temp.stateName == -1) continue; String toPrint = ""; if (temp.stateForCase != null) { if (temp.inNextOf == 1) continue; if (dumped[temp.stateForCase.stateName]) continue; toPrint = (temp.stateForCase.PrintNoBreak(ostr, byteNum, dumped)); if (temp.asciiMoves[byteNum] == 0L) { if (toPrint.equals("")) ostr.println(" break;"); continue; } } if (temp.asciiMoves[byteNum] == 0L) continue; if (!toPrint.equals("")) ostr.print(toPrint); dumped[temp.stateName] = true; ostr.println(" case " + temp.stateName + ":"); temp.DumpAsciiMove(ostr, byteNum, dumped); } ostr.println(" default : break;"); ostr.println(" }"); ostr.println(" } while(i != startsAt);"); } private static void DumpCompositeStatesNonAsciiMoves(java.io.PrintWriter ostr, String key, boolean[] dumped) { int i; int[] nameSet = (int[])allNextStates.get(key); if (nameSet.length == 1 || dumped[StateNameForComposite(key)]) return; NfaState toBePrinted = null; int neededStates = 0; NfaState tmp; NfaState stateForCase = null; String toPrint = ""; boolean stateBlock = (stateBlockTable.get(key) != null); for (i = 0; i < nameSet.length; i++) { tmp = (NfaState)allStates.get(nameSet[i]); if (tmp.nonAsciiMethod != -1) { if (neededStates++ == 1) break; else toBePrinted = tmp; } else dumped[tmp.stateName] = true; if (tmp.stateForCase != null) { if (stateForCase != null) throw new Error("JavaCC Bug: Please send mail to sankar@cs.stanford.edu : "); stateForCase = tmp.stateForCase; } } if (stateForCase != null) toPrint = stateForCase.PrintNoBreak(ostr, -1, dumped); if (neededStates == 0) { if (stateForCase != null && toPrint.equals("")) ostr.println(" break;"); return; } if (neededStates == 1) { if (!toPrint.equals("")) ostr.print(toPrint); ostr.println(" case " + StateNameForComposite(key) + ":"); if (!dumped[toBePrinted.stateName] && !stateBlock && toBePrinted.inNextOf > 1) ostr.println(" case " + toBePrinted.stateName + ":"); dumped[toBePrinted.stateName] = true; toBePrinted.DumpNonAsciiMove(ostr, dumped); return; } if (!toPrint.equals("")) ostr.print(toPrint); int keyState = StateNameForComposite(key); ostr.println(" case " + keyState + ":"); if (keyState < generatedStates) dumped[keyState] = true; for (i = 0; i < nameSet.length; i++) { tmp = (NfaState)allStates.get(nameSet[i]); if (tmp.nonAsciiMethod != -1) { if (stateBlock) dumped[tmp.stateName] = true; tmp.DumpNonAsciiMoveForCompositeState(ostr); } } if (stateBlock) ostr.println(" break;"); else ostr.println(" break;"); } private final void DumpNonAsciiMoveForCompositeState(java.io.PrintWriter ostr) { boolean nextIntersects = selfLoop(); for (int j = 0; j < allStates.size(); j++) { NfaState temp1 = (NfaState)allStates.get(j); if (this == temp1 || temp1.stateName == -1 || temp1.dummy || stateName == temp1.stateName || (temp1.nonAsciiMethod == -1)) continue; if (!nextIntersects && Intersect(temp1.next.epsilonMovesString, next.epsilonMovesString)) { nextIntersects = true; break; } } if (!Options.getJavaUnicodeEscape() && !unicodeWarningGiven) { if (loByteVec != null && loByteVec.size() > 1) ostr.println(" if ((jjbitVec" + ((Integer)loByteVec.get(1)).intValue() + "[i2" + "] & l2) != 0L)"); } else { ostr.println(" if (jjCanMove_" + nonAsciiMethod + "(hiByte, i1, i2, l1, l2))"); } if (kindToPrint != Integer.MAX_VALUE) { ostr.println(" {"); ostr.println(" if (kind > " + kindToPrint + ")"); ostr.println(" kind = " + kindToPrint + ";"); } if (next != null && next.usefulEpsilonMoves > 0) { int[] stateNames = (int[])allNextStates.get( next.epsilonMovesString); if (next.usefulEpsilonMoves == 1) { int name = stateNames[0]; if (nextIntersects) ostr.println(" jjCheckNAdd(" + name + ");"); else ostr.println(" jjstateSet[jjnewStateCnt++] = " + name + ";"); } else if (next.usefulEpsilonMoves == 2 && nextIntersects) { ostr.println(" jjCheckNAddTwoStates(" + stateNames[0] + ", " + stateNames[1] + ");"); } else { int[] indices = GetStateSetIndicesForUse(next.epsilonMovesString); boolean notTwo = (indices[0] + 1 != indices[1]); if (nextIntersects) { ostr.print(" jjCheckNAddStates(" + indices[0]); if (notTwo) { jjCheckNAddStatesDualNeeded = true; ostr.print(", " + indices[1]); } else { jjCheckNAddStatesUnaryNeeded = true; } ostr.println(");"); } else ostr.println(" jjAddStates(" + indices[0] + ", " + indices[1] + ");"); } } if (kindToPrint != Integer.MAX_VALUE) ostr.println(" }"); } private final void DumpNonAsciiMove(java.io.PrintWriter ostr, boolean dumped[]) { boolean nextIntersects = selfLoop() && isComposite; for (int j = 0; j < allStates.size(); j++) { NfaState temp1 = (NfaState)allStates.get(j); if (this == temp1 || temp1.stateName == -1 || temp1.dummy || stateName == temp1.stateName || (temp1.nonAsciiMethod == -1)) continue; if (!nextIntersects && Intersect(temp1.next.epsilonMovesString, next.epsilonMovesString)) nextIntersects = true; if (!dumped[temp1.stateName] && !temp1.isComposite && nonAsciiMethod == temp1.nonAsciiMethod && kindToPrint == temp1.kindToPrint && (next.epsilonMovesString == temp1.next.epsilonMovesString || (next.epsilonMovesString != null && temp1.next.epsilonMovesString != null && next.epsilonMovesString.equals(temp1.next.epsilonMovesString)))) { dumped[temp1.stateName] = true; ostr.println(" case " + temp1.stateName + ":"); } } if (next == null || next.usefulEpsilonMoves <= 0) { String kindCheck = " && kind > " + kindToPrint; if (!Options.getJavaUnicodeEscape() && !unicodeWarningGiven) { if (loByteVec != null && loByteVec.size() > 1) ostr.println(" if ((jjbitVec" + ((Integer)loByteVec.get(1)).intValue() + "[i2" + "] & l2) != 0L" + kindCheck + ")"); } else { ostr.println(" if (jjCanMove_" + nonAsciiMethod + "(hiByte, i1, i2, l1, l2)" + kindCheck + ")"); } ostr.println(" kind = " + kindToPrint + ";"); ostr.println(" break;"); return; } String prefix = " "; if (kindToPrint != Integer.MAX_VALUE) { if (!Options.getJavaUnicodeEscape() && !unicodeWarningGiven) { if (loByteVec != null && loByteVec.size() > 1) { ostr.println(" if ((jjbitVec" + ((Integer)loByteVec.get(1)).intValue() + "[i2" + "] & l2) == 0L)"); ostr.println(" break;"); } } else { ostr.println(" if (!jjCanMove_" + nonAsciiMethod + "(hiByte, i1, i2, l1, l2))"); ostr.println(" break;"); } ostr.println(" if (kind > " + kindToPrint + ")"); ostr.println(" kind = " + kindToPrint + ";"); prefix = ""; } else if (!Options.getJavaUnicodeEscape() && !unicodeWarningGiven) { if (loByteVec != null && loByteVec.size() > 1) ostr.println(" if ((jjbitVec" + ((Integer)loByteVec.get(1)).intValue() + "[i2" + "] & l2) != 0L)"); } else { ostr.println(" if (jjCanMove_" + nonAsciiMethod + "(hiByte, i1, i2, l1, l2))"); } if (next != null && next.usefulEpsilonMoves > 0) { int[] stateNames = (int[])allNextStates.get( next.epsilonMovesString); if (next.usefulEpsilonMoves == 1) { int name = stateNames[0]; if (nextIntersects) ostr.println(prefix + " jjCheckNAdd(" + name + ");"); else ostr.println(prefix + " jjstateSet[jjnewStateCnt++] = " + name + ";"); } else if (next.usefulEpsilonMoves == 2 && nextIntersects) { ostr.println(prefix + " jjCheckNAddTwoStates(" + stateNames[0] + ", " + stateNames[1] + ");"); } else { int[] indices = GetStateSetIndicesForUse(next.epsilonMovesString); boolean notTwo = (indices[0] + 1 != indices[1]); if (nextIntersects) { ostr.print(prefix + " jjCheckNAddStates(" + indices[0]); if (notTwo) { jjCheckNAddStatesDualNeeded = true; ostr.print(", " + indices[1]); } else { jjCheckNAddStatesUnaryNeeded = true; } ostr.println(");"); } else ostr.println(prefix + " jjAddStates(" + indices[0] + ", " + indices[1] + ");"); } } ostr.println(" break;"); } public static void DumpCharAndRangeMoves(java.io.PrintWriter ostr) { boolean[] dumped = new boolean[Math.max(generatedStates, dummyStateIndex + 1)]; Enumeration e = compositeStateTable.keys(); int i; DumpHeadForCase(ostr, -1); while (e.hasMoreElements()) DumpCompositeStatesNonAsciiMoves(ostr, (String)e.nextElement(), dumped); for (i = 0; i < allStates.size(); i++) { NfaState temp = (NfaState)allStates.get(i); if (temp.stateName == -1 || dumped[temp.stateName] || temp.lexState != LexGen.lexStateIndex || !temp.HasTransitions() || temp.dummy ) continue; String toPrint = ""; if (temp.stateForCase != null) { if (temp.inNextOf == 1) continue; if (dumped[temp.stateForCase.stateName]) continue; toPrint = (temp.stateForCase.PrintNoBreak(ostr, -1, dumped)); if (temp.nonAsciiMethod == -1) { if (toPrint.equals("")) ostr.println(" break;"); continue; } } if (temp.nonAsciiMethod == -1) continue; if (!toPrint.equals("")) ostr.print(toPrint); dumped[temp.stateName] = true; //System.out.println("case : " + temp.stateName); ostr.println(" case " + temp.stateName + ":"); temp.DumpNonAsciiMove(ostr, dumped); } ostr.println(" default : break;"); ostr.println(" }"); ostr.println(" } while(i != startsAt);"); } public static void DumpNonAsciiMoveMethods(java.io.PrintWriter ostr) { if (!Options.getJavaUnicodeEscape() && !unicodeWarningGiven) return; if (nonAsciiTableForMethod.size() <= 0) return; for (int i = 0; i < nonAsciiTableForMethod.size(); i++) { NfaState tmp = (NfaState)nonAsciiTableForMethod.get(i); tmp.DumpNonAsciiMoveMethod(ostr); } } void DumpNonAsciiMoveMethod(java.io.PrintWriter ostr) { int j; ostr.println("private static final boolean jjCanMove_" + nonAsciiMethod + "(int hiByte, int i1, int i2, long l1, long l2)"); ostr.println("{"); ostr.println(" switch(hiByte)"); ostr.println(" {"); if (loByteVec != null && loByteVec.size() > 0) { for (j = 0; j < loByteVec.size(); j += 2) { ostr.println(" case " + ((Integer)loByteVec.get(j)).intValue() + ":"); if (!AllBitsSet((String)allBitVectors.get( ((Integer)loByteVec.get(j + 1)).intValue()))) { ostr.println(" return ((jjbitVec" + ((Integer)loByteVec.get(j + 1)).intValue() + "[i2" + "] & l2) != 0L);"); } else ostr.println(" return true;"); } } ostr.println(" default :"); if (nonAsciiMoveIndices != null && (j = nonAsciiMoveIndices.length) > 0) { do { if (!AllBitsSet((String)allBitVectors.get( nonAsciiMoveIndices[j - 2]))) ostr.println(" if ((jjbitVec" + nonAsciiMoveIndices[j - 2] + "[i1] & l1) != 0L)"); if (!AllBitsSet((String)allBitVectors.get( nonAsciiMoveIndices[j - 1]))) { ostr.println(" if ((jjbitVec" + nonAsciiMoveIndices[j - 1] + "[i2] & l2) == 0L)"); ostr.println(" return false;"); ostr.println(" else"); } ostr.println(" return true;"); } while ((j -= 2) > 0); } ostr.println(" return false;"); ostr.println(" }"); ostr.println("}"); } private static void ReArrange() { List v = allStates; allStates = new ArrayList(Collections.nCopies(generatedStates, null)); if (allStates.size() != generatedStates) throw new Error("What??"); for (int j = 0; j < v.size(); j++) { NfaState tmp = (NfaState)v.get(j); if (tmp.stateName != -1 && !tmp.dummy) allStates.set(tmp.stateName, tmp); } } //private static boolean boilerPlateDumped = false; static void PrintBoilerPlate(java.io.PrintWriter ostr) { ostr.println((Options.getStatic() ? "static " : "") + "private void " + "jjCheckNAdd(int state)"); ostr.println("{"); ostr.println(" if (jjrounds[state] != jjround)"); ostr.println(" {"); ostr.println(" jjstateSet[jjnewStateCnt++] = state;"); ostr.println(" jjrounds[state] = jjround;"); ostr.println(" }"); ostr.println("}"); ostr.println((Options.getStatic() ? "static " : "") + "private void " + "jjAddStates(int start, int end)"); ostr.println("{"); ostr.println(" do {"); ostr.println(" jjstateSet[jjnewStateCnt++] = jjnextStates[start];"); ostr.println(" } while (start++ != end);"); ostr.println("}"); ostr.println((Options.getStatic() ? "static " : "") + "private void " + "jjCheckNAddTwoStates(int state1, int state2)"); ostr.println("{"); ostr.println(" jjCheckNAdd(state1);"); ostr.println(" jjCheckNAdd(state2);"); ostr.println("}"); ostr.println(""); if(jjCheckNAddStatesDualNeeded) { ostr.println((Options.getStatic() ? "static " : "") + "private void " + "jjCheckNAddStates(int start, int end)"); ostr.println("{"); ostr.println(" do {"); ostr.println(" jjCheckNAdd(jjnextStates[start]);"); ostr.println(" } while (start++ != end);"); ostr.println("}"); ostr.println(""); } if(jjCheckNAddStatesUnaryNeeded) { ostr.println((Options.getStatic() ? "static " : "") + "private void " + "jjCheckNAddStates(int start)"); ostr.println("{"); ostr.println(" jjCheckNAdd(jjnextStates[start]);"); ostr.println(" jjCheckNAdd(jjnextStates[start + 1]);"); ostr.println("}"); ostr.println(""); } } private static void FindStatesWithNoBreak() { Hashtable printed = new Hashtable(); boolean[] put = new boolean[generatedStates]; int cnt = 0; int i, j, foundAt = 0; Outer : for (j = 0; j < allStates.size(); j++) { NfaState stateForCase = null; NfaState tmpState = (NfaState)allStates.get(j); if (tmpState.stateName == -1 || tmpState.dummy || !tmpState.UsefulState() || tmpState.next == null || tmpState.next.usefulEpsilonMoves < 1) continue; String s = tmpState.next.epsilonMovesString; if (compositeStateTable.get(s) != null || printed.get(s) != null) continue; printed.put(s, s); int[] nexts = (int[])allNextStates.get(s); if (nexts.length == 1) continue; int state = cnt; //System.out.println("State " + tmpState.stateName + " : " + s); for (i = 0; i < nexts.length; i++) { if ((state = nexts[i]) == -1) continue; NfaState tmp = (NfaState)allStates.get(state); if (!tmp.isComposite && tmp.inNextOf == 1) { if (put[state]) throw new Error("JavaCC Bug: Please send mail to sankar@cs.stanford.edu"); foundAt = i; cnt++; stateForCase = tmp; put[state] = true; //System.out.print(state + " : " + tmp.inNextOf + ", "); break; } } //System.out.println(""); if (stateForCase == null) continue; for (i = 0; i < nexts.length; i++) { if ((state = nexts[i]) == -1) continue; NfaState tmp = (NfaState)allStates.get(state); if (!put[state] && tmp.inNextOf > 1 && !tmp.isComposite && tmp.stateForCase == null) { cnt++; nexts[i] = -1; put[state] = true; int toSwap = nexts[0]; nexts[0] = nexts[foundAt]; nexts[foundAt] = toSwap; tmp.stateForCase = stateForCase; stateForCase.stateForCase = tmp; stateSetsToFix.put(s, nexts); //System.out.println("For : " + s + "; " + stateForCase.stateName + //" and " + tmp.stateName); continue Outer; } } for (i = 0; i < nexts.length; i++) { if ((state = nexts[i]) == -1) continue; NfaState tmp = (NfaState)allStates.get(state); if (tmp.inNextOf <= 1) put[state] = false; } } } static int[][] kinds; static int[][][] statesForState; public static void DumpMoveNfa(java.io.PrintWriter ostr) { //if (!boilerPlateDumped) // PrintBoilerPlate(ostr); //boilerPlateDumped = true; int i; int[] kindsForStates = null; if (kinds == null) { kinds = new int[LexGen.maxLexStates][]; statesForState = new int[LexGen.maxLexStates][][]; } ReArrange(); for (i = 0; i < allStates.size(); i++) { NfaState temp = (NfaState)allStates.get(i); if (temp.lexState != LexGen.lexStateIndex || !temp.HasTransitions() || temp.dummy || temp.stateName == -1) continue; if (kindsForStates == null) { kindsForStates = new int[generatedStates]; statesForState[LexGen.lexStateIndex] = new int[Math.max(generatedStates, dummyStateIndex + 1)][]; } kindsForStates[temp.stateName] = temp.lookingFor; statesForState[LexGen.lexStateIndex][temp.stateName] = temp.compositeStates; temp.GenerateNonAsciiMoves(ostr); } Enumeration e = stateNameForComposite.keys(); while (e.hasMoreElements()) { String s = (String)e.nextElement(); int state = ((Integer)stateNameForComposite.get(s)).intValue(); if (state >= generatedStates) statesForState[LexGen.lexStateIndex][state] = (int[])allNextStates.get(s); } if (stateSetsToFix.size() != 0) FixStateSets(); kinds[LexGen.lexStateIndex] = kindsForStates; ostr.println((Options.getStatic() ? "static " : "") + "private int " + "jjMoveNfa" + LexGen.lexStateSuffix + "(int startState, int curPos)"); ostr.println("{"); if (generatedStates == 0) { ostr.println(" return curPos;"); ostr.println("}"); return; } if (LexGen.mixed[LexGen.lexStateIndex]) { ostr.println(" int strKind = jjmatchedKind;"); ostr.println(" int strPos = jjmatchedPos;"); ostr.println(" int seenUpto;"); ostr.println(" input_stream.backup(seenUpto = curPos + 1);"); ostr.println(" try { curChar = input_stream.readChar(); }"); ostr.println(" catch(java.io.IOException e) { throw new Error(\"Internal Error\"); }"); ostr.println(" curPos = 0;"); } ostr.println(" int startsAt = 0;"); ostr.println(" jjnewStateCnt = " + generatedStates + ";"); ostr.println(" int i = 1;"); ostr.println(" jjstateSet[0] = startState;"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(\" Starting NFA to match one of : \" + " + "jjKindsForStateVector(curLexState, jjstateSet, 0, 1));"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(" + (LexGen.maxLexStates > 1 ? "\"<\" + lexStateNames[curLexState] + \">\" + " : "") + "\"Current character : \" + " + "TokenMgrError.addEscapes(String.valueOf(curChar)) + \" (\" + (int)curChar + \") " + "at line \" + input_stream.getEndLine() + \" column \" + input_stream.getEndColumn());"); ostr.println(" int kind = 0x" + Integer.toHexString(Integer.MAX_VALUE) + ";"); ostr.println(" for (;;)"); ostr.println(" {"); ostr.println(" if (++jjround == 0x" + Integer.toHexString(Integer.MAX_VALUE) + ")"); ostr.println(" ReInitRounds();"); ostr.println(" if (curChar < 64)"); ostr.println(" {"); DumpAsciiMoves(ostr, 0); ostr.println(" }"); ostr.println(" else if (curChar < 128)"); ostr.println(" {"); DumpAsciiMoves(ostr, 1); ostr.println(" }"); ostr.println(" else"); ostr.println(" {"); DumpCharAndRangeMoves(ostr); ostr.println(" }"); ostr.println(" if (kind != 0x" + Integer.toHexString(Integer.MAX_VALUE) + ")"); ostr.println(" {"); ostr.println(" jjmatchedKind = kind;"); ostr.println(" jjmatchedPos = curPos;"); ostr.println(" kind = 0x" + Integer.toHexString(Integer.MAX_VALUE) + ";"); ostr.println(" }"); ostr.println(" ++curPos;"); if (Options.getDebugTokenManager()) { ostr.println(" if (jjmatchedKind != 0 && jjmatchedKind != 0x" + Integer.toHexString(Integer.MAX_VALUE) + ")"); ostr.println(" debugStream.println(" + "\" Currently matched the first \" + (jjmatchedPos + 1) + \" characters as" + " a \" + tokenImage[jjmatchedKind] + \" token.\");"); } ostr.println(" if ((i = jjnewStateCnt) == (startsAt = " + generatedStates + " - (jjnewStateCnt = startsAt)))"); if (LexGen.mixed[LexGen.lexStateIndex]) ostr.println(" break;"); else ostr.println(" return curPos;"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(\" Possible kinds of longer matches : \" + " + "jjKindsForStateVector(curLexState, jjstateSet, startsAt, i));"); ostr.println(" try { curChar = input_stream.readChar(); }"); if (LexGen.mixed[LexGen.lexStateIndex]) ostr.println(" catch(java.io.IOException e) { break; }"); else ostr.println(" catch(java.io.IOException e) { return curPos; }"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(" + (LexGen.maxLexStates > 1 ? "\"<\" + lexStateNames[curLexState] + \">\" + " : "") + "\"Current character : \" + " + "TokenMgrError.addEscapes(String.valueOf(curChar)) + \" (\" + (int)curChar + \") " + "at line \" + input_stream.getEndLine() + \" column \" + input_stream.getEndColumn());"); ostr.println(" }"); if (LexGen.mixed[LexGen.lexStateIndex]) { ostr.println(" if (jjmatchedPos > strPos)"); ostr.println(" return curPos;"); ostr.println(""); ostr.println(" int toRet = Math.max(curPos, seenUpto);"); ostr.println(""); ostr.println(" if (curPos < toRet)"); ostr.println(" for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; )"); ostr.println(" try { curChar = input_stream.readChar(); }"); ostr.println(" catch(java.io.IOException e) { " + "throw new Error(\"Internal Error : Please send a bug report.\"); }"); ostr.println(""); ostr.println(" if (jjmatchedPos < strPos)"); ostr.println(" {"); ostr.println(" jjmatchedKind = strKind;"); ostr.println(" jjmatchedPos = strPos;"); ostr.println(" }"); ostr.println(" else if (jjmatchedPos == strPos && jjmatchedKind > strKind)"); ostr.println(" jjmatchedKind = strKind;"); ostr.println(""); ostr.println(" return toRet;"); } ostr.println("}"); allStates.clear(); } public static void DumpStatesForState(java.io.PrintWriter ostr) { ostr.print("protected static final int[][][] statesForState = "); if (statesForState == null) { ostr.println("null;"); return; } else ostr.println("{"); for (int i = 0; i < statesForState.length; i++) { if (statesForState[i] == null) { ostr.println(" null,"); continue; } ostr.println(" {"); for (int j = 0; j < statesForState[i].length; j++) { int[] stateSet = statesForState[i][j]; if (stateSet == null) { ostr.println(" { " + j + " },"); continue; } ostr.print(" { "); for (int k = 0; k < stateSet.length; k++) ostr.print(stateSet[k] + ", "); ostr.println("},"); } ostr.println(" },"); } ostr.println("\n};"); } public static void DumpStatesForKind(java.io.PrintWriter ostr) { DumpStatesForState(ostr); boolean moreThanOne = false; int cnt = 0; ostr.print("protected static final int[][] kindForState = "); if (kinds == null) { ostr.println("null;"); return; } else ostr.println("{"); for (int i = 0; i < kinds.length; i++) { if (moreThanOne) ostr.println(","); moreThanOne = true; if (kinds[i] == null) ostr.println("null"); else { cnt = 0; ostr.print("{ "); for (int j = 0; j < kinds[i].length; j++) { if (cnt++ > 0) ostr.print(","); if (cnt % 15 == 0) ostr.print("\n "); else if (cnt > 1) ostr.print(" "); ostr.print(kinds[i][j]); } ostr.print("}"); } } ostr.println("\n};"); } public static void reInit() { unicodeWarningGiven = false; generatedStates = 0; idCnt = 0; lohiByteCnt = 0; dummyStateIndex = -1; done = false; mark = null; stateDone = null; allStates = new ArrayList(); indexedAllStates = new ArrayList(); nonAsciiTableForMethod = new ArrayList(); equivStatesTable = new Hashtable(); allNextStates = new Hashtable(); lohiByteTab = new Hashtable(); stateNameForComposite = new Hashtable(); compositeStateTable = new Hashtable(); stateBlockTable = new Hashtable(); stateSetsToFix = new Hashtable(); allBitVectors = new ArrayList(); tmpIndices = new int[512]; allBits = "{\n 0xffffffffffffffffL, " + "0xffffffffffffffffL, " + "0xffffffffffffffffL, " + "0xffffffffffffffffL\n};"; tableToDump = new Hashtable(); orderedStateSet = new ArrayList(); lastIndex = 0; //boilerPlateDumped = false; jjCheckNAddStatesUnaryNeeded = false; jjCheckNAddStatesDualNeeded = false; kinds = null; statesForState = null; } } javacc-5.0.orig/src/org/javacc/parser/Options.java0000644000175000017500000004526511165261216021144 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.io.File; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; /** * A class with static state that stores all option information. */ public class Options { /** * Limit subclassing to derived classes. */ protected Options() { } /** * A mapping of option names (Strings) to values (Integer, Boolean, String). * This table is initialized by the main program. Its contents defines the * set of legal options. Its initial values define the default option * values, and the option types can be determined from these values too. */ protected static Map optionValues = null; /** * Convenience method to retrieve integer options. */ protected static int intValue(final String option) { return ((Integer) optionValues.get(option)).intValue(); } /** * Convenience method to retrieve boolean options. */ protected static boolean booleanValue(final String option) { return ((Boolean) optionValues.get(option)).booleanValue(); } /** * Convenience method to retrieve string options. */ protected static String stringValue(final String option) { return (String) optionValues.get(option); } public static Map getOptions() { return new HashMap(optionValues); } /** * Keep track of what options were set as a command line argument. We use * this to see if the options set from the command line and the ones set in * the input files clash in any way. */ private static Set cmdLineSetting = null; /** * Keep track of what options were set from the grammar file. We use this to * see if the options set from the command line and the ones set in the * input files clash in any way. */ private static Set inputFileSetting = null; /** * Initialize for JavaCC */ public static void init() { optionValues = new HashMap(); cmdLineSetting = new HashSet(); inputFileSetting = new HashSet(); optionValues.put("LOOKAHEAD", new Integer(1)); optionValues.put("CHOICE_AMBIGUITY_CHECK", new Integer(2)); optionValues.put("OTHER_AMBIGUITY_CHECK", new Integer(1)); optionValues.put("STATIC", Boolean.TRUE); optionValues.put("DEBUG_PARSER", Boolean.FALSE); optionValues.put("DEBUG_LOOKAHEAD", Boolean.FALSE); optionValues.put("DEBUG_TOKEN_MANAGER", Boolean.FALSE); optionValues.put("ERROR_REPORTING", Boolean.TRUE); optionValues.put("JAVA_UNICODE_ESCAPE", Boolean.FALSE); optionValues.put("UNICODE_INPUT", Boolean.FALSE); optionValues.put("IGNORE_CASE", Boolean.FALSE); optionValues.put("USER_TOKEN_MANAGER", Boolean.FALSE); optionValues.put("USER_CHAR_STREAM", Boolean.FALSE); optionValues.put("BUILD_PARSER", Boolean.TRUE); optionValues.put("BUILD_TOKEN_MANAGER", Boolean.TRUE); optionValues.put("TOKEN_MANAGER_USES_PARSER", Boolean.FALSE); optionValues.put("SANITY_CHECK", Boolean.TRUE); optionValues.put("FORCE_LA_CHECK", Boolean.FALSE); optionValues.put("COMMON_TOKEN_ACTION", Boolean.FALSE); optionValues.put("CACHE_TOKENS", Boolean.FALSE); optionValues.put("KEEP_LINE_COLUMN", Boolean.TRUE); optionValues.put("GENERATE_CHAINED_EXCEPTION", Boolean.FALSE); optionValues.put("GENERATE_GENERICS", Boolean.FALSE); optionValues.put("GENERATE_STRING_BUILDER", Boolean.FALSE); optionValues.put("GENERATE_ANNOTATIONS", Boolean.FALSE); optionValues.put("SUPPORT_CLASS_VISIBILITY_PUBLIC", Boolean.TRUE); optionValues.put("OUTPUT_DIRECTORY", "."); optionValues.put("JDK_VERSION", "1.5"); optionValues.put("TOKEN_EXTENDS", ""); optionValues.put("TOKEN_FACTORY", ""); optionValues.put("GRAMMAR_ENCODING", ""); } /** * Returns a string representation of the specified options of interest. * Used when, for example, generating Token.java to record the JavaCC options * that were used to generate the file. All of the options must be * boolean values. * @param interestingOptions the options of interest, eg {"STATIC", "CACHE_TOKENS"} * @return the string representation of the options, eg "STATIC=true,CACHE_TOKENS=false" */ public static String getOptionsString(String[] interestingOptions) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < interestingOptions.length; i++) { String key = interestingOptions[i]; sb.append(key); sb.append('='); sb.append(optionValues.get(key)); if (i != interestingOptions.length -1) { sb.append(','); } } return sb.toString(); } /** * Determine if a given command line argument might be an option flag. * Command line options start with a dash (-). * * @param opt * The command line argument to examine. * @return True when the argument looks like an option flag. */ public static boolean isOption(final String opt) { return opt != null && opt.length() > 1 && opt.charAt(0) == '-'; } /** * Help function to handle cases where the meaning of an option has changed * over time. If the user has supplied an option in the old format, it will * be converted to the new format. * * @param name The name of the option being checked. * @param value The option's value. * @return The upgraded value. */ public static Object upgradeValue(final String name, Object value) { if (name.equalsIgnoreCase("NODE_FACTORY") && value.getClass() == Boolean.class) { if (((Boolean)value).booleanValue()) { value = "*"; } else { value = ""; } } return value; } public static void setInputFileOption(Object nameloc, Object valueloc, String name, Object value) { String s = name.toUpperCase(); if (!optionValues.containsKey(s)) { JavaCCErrors.warning(nameloc, "Bad option name \"" + name + "\". Option setting will be ignored."); return; } final Object existingValue = optionValues.get(s); value = upgradeValue(name, value); if (existingValue != null) { if ((existingValue.getClass() != value.getClass()) || (value instanceof Integer && ((Integer)value).intValue() <= 0)) { JavaCCErrors.warning(valueloc, "Bad option value \"" + value + "\" for \"" + name + "\". Option setting will be ignored."); return; } if (inputFileSetting.contains(s)) { JavaCCErrors.warning(nameloc, "Duplicate option setting for \"" + name + "\" will be ignored."); return; } if (cmdLineSetting.contains(s)) { if (!existingValue.equals(value)) { JavaCCErrors.warning(nameloc, "Command line setting of \"" + name + "\" modifies option value in file."); } return; } } optionValues.put(s, value); inputFileSetting.add(s); } /** * Process a single command-line option. * The option is parsed and stored in the optionValues map. * @param arg */ public static void setCmdLineOption(String arg) { final String s; if (arg.charAt(0) == '-') { s = arg.substring(1); } else { s = arg; } String name; Object Val; // Look for the first ":" or "=", which will separate the option name // from its value (if any). final int index1 = s.indexOf('='); final int index2 = s.indexOf(':'); final int index; if (index1 < 0) index = index2; else if (index2 < 0) index = index1; else if (index1 < index2) index = index1; else index = index2; if (index < 0) { name = s.toUpperCase(); if (optionValues.containsKey(name)) { Val = Boolean.TRUE; } else if (name.length() > 2 && name.charAt(0) == 'N' && name.charAt(1) == 'O') { Val = Boolean.FALSE; name = name.substring(2); } else { System.out.println("Warning: Bad option \"" + arg + "\" will be ignored."); return; } } else { name = s.substring(0, index).toUpperCase(); if (s.substring(index + 1).equalsIgnoreCase("TRUE")) { Val = Boolean.TRUE; } else if (s.substring(index + 1).equalsIgnoreCase("FALSE")) { Val = Boolean.FALSE; } else { try { int i = Integer.parseInt(s.substring(index + 1)); if (i <= 0) { System.out.println("Warning: Bad option value in \"" + arg + "\" will be ignored."); return; } Val = new Integer(i); } catch (NumberFormatException e) { Val = s.substring(index + 1); if (s.length() > index + 2) { // i.e., there is space for two '"'s in value if (s.charAt(index + 1) == '"' && s.charAt(s.length() - 1) == '"') { // remove the two '"'s. Val = s.substring(index + 2, s.length() - 1); } } } } } if (!optionValues.containsKey(name)) { System.out.println("Warning: Bad option \"" + arg + "\" will be ignored."); return; } Object valOrig = optionValues.get(name); if (Val.getClass() != valOrig.getClass()) { System.out.println("Warning: Bad option value in \"" + arg + "\" will be ignored."); return; } if (cmdLineSetting.contains(name)) { System.out.println("Warning: Duplicate option setting \"" + arg + "\" will be ignored."); return; } Val = upgradeValue(name, Val); optionValues.put(name, Val); cmdLineSetting.add(name); } public static void normalize() { if (getDebugLookahead() && !getDebugParser()) { if (cmdLineSetting.contains("DEBUG_PARSER") || inputFileSetting.contains("DEBUG_PARSER")) { JavaCCErrors .warning("True setting of option DEBUG_LOOKAHEAD overrides " + "false setting of option DEBUG_PARSER."); } optionValues.put("DEBUG_PARSER", Boolean.TRUE); } // Now set the "GENERATE" options from the supplied (or default) JDK version. optionValues.put("GENERATE_CHAINED_EXCEPTION", Boolean.valueOf(jdkVersionAtLeast(1.4))); optionValues.put("GENERATE_GENERICS", Boolean.valueOf(jdkVersionAtLeast(1.5))); optionValues.put("GENERATE_STRING_BUILDER", Boolean.valueOf(jdkVersionAtLeast(1.5))); optionValues.put("GENERATE_ANNOTATIONS", Boolean.valueOf(jdkVersionAtLeast(1.5))); } /** * Find the lookahead setting. * * @return The requested lookahead value. */ public static int getLookahead() { return intValue("LOOKAHEAD"); } /** * Find the choice ambiguity check value. * * @return The requested choice ambiguity check value. */ public static int getChoiceAmbiguityCheck() { return intValue("CHOICE_AMBIGUITY_CHECK"); } /** * Find the other ambiguity check value. * * @return The requested other ambiguity check value. */ public static int getOtherAmbiguityCheck() { return intValue("OTHER_AMBIGUITY_CHECK"); } /** * Find the static value. * * @return The requested static value. */ public static boolean getStatic() { return booleanValue("STATIC"); } /** * Find the debug parser value. * * @return The requested debug parser value. */ public static boolean getDebugParser() { return booleanValue("DEBUG_PARSER"); } /** * Find the debug lookahead value. * * @return The requested debug lookahead value. */ public static boolean getDebugLookahead() { return booleanValue("DEBUG_LOOKAHEAD"); } /** * Find the debug tokenmanager value. * * @return The requested debug tokenmanager value. */ public static boolean getDebugTokenManager() { return booleanValue("DEBUG_TOKEN_MANAGER"); } /** * Find the error reporting value. * * @return The requested error reporting value. */ public static boolean getErrorReporting() { return booleanValue("ERROR_REPORTING"); } /** * Find the Java unicode escape value. * * @return The requested Java unicode escape value. */ public static boolean getJavaUnicodeEscape() { return booleanValue("JAVA_UNICODE_ESCAPE"); } /** * Find the unicode input value. * * @return The requested unicode input value. */ public static boolean getUnicodeInput() { return booleanValue("UNICODE_INPUT"); } /** * Find the ignore case value. * * @return The requested ignore case value. */ public static boolean getIgnoreCase() { return booleanValue("IGNORE_CASE"); } /** * Find the user tokenmanager value. * * @return The requested user tokenmanager value. */ public static boolean getUserTokenManager() { return booleanValue("USER_TOKEN_MANAGER"); } /** * Find the user charstream value. * * @return The requested user charstream value. */ public static boolean getUserCharStream() { return booleanValue("USER_CHAR_STREAM"); } /** * Find the build parser value. * * @return The requested build parser value. */ public static boolean getBuildParser() { return booleanValue("BUILD_PARSER"); } /** * Find the build token manager value. * * @return The requested build token manager value. */ public static boolean getBuildTokenManager() { return booleanValue("BUILD_TOKEN_MANAGER"); } /** * Find the token manager uses parser value. * * @return The requested token manager uses parser value; */ public static boolean getTokenManagerUsesParser(){ return booleanValue("TOKEN_MANAGER_USES_PARSER"); } /** * Find the sanity check value. * * @return The requested sanity check value. */ public static boolean getSanityCheck() { return booleanValue("SANITY_CHECK"); } /** * Find the force lookahead check value. * * @return The requested force lookahead value. */ public static boolean getForceLaCheck() { return booleanValue("FORCE_LA_CHECK"); } /** * Find the common token action value. * * @return The requested common token action value. */ public static boolean getCommonTokenAction() { return booleanValue("COMMON_TOKEN_ACTION"); } /** * Find the cache tokens value. * * @return The requested cache tokens value. */ public static boolean getCacheTokens() { return booleanValue("CACHE_TOKENS"); } /** * Find the keep line column value. * * @return The requested keep line column value. */ public static boolean getKeepLineColumn() { return booleanValue("KEEP_LINE_COLUMN"); } /** * Find the JDK version. * * @return The requested jdk version. */ public static String getJdkVersion() { return stringValue("JDK_VERSION"); } /** * Should the generated code create Exceptions using a constructor taking a nested exception? * @return */ public static boolean getGenerateChainedException() { return booleanValue("GENERATE_CHAINED_EXCEPTION"); } /** * Should the generated code contain Generics? * @return */ public static boolean getGenerateGenerics() { return booleanValue("GENERATE_GENERICS"); } /** * Should the generated code use StringBuilder rather than StringBuffer? * @return */ public static boolean getGenerateStringBuilder() { return booleanValue("GENERATE_STRING_BUILDER"); } /** * Should the generated code contain Annotations? * @return */ public static boolean getGenerateAnnotations() { return booleanValue("GENERATE_ANNOTATIONS"); } /** * Should the generated code class visibility public? * @return */ public static boolean getSupportClassVisibilityPublic() { return booleanValue("SUPPORT_CLASS_VISIBILITY_PUBLIC"); } /** * Determine if the output language is at least the specified * version. * @param version the version to check against. E.g. 1.5 * @return true if the output version is at least the specified version. */ public static boolean jdkVersionAtLeast(double version) { double jdkVersion = Double.parseDouble(getJdkVersion()); // Comparing doubles is safe here, as it is two simple assignments. return jdkVersion >= version; } /** * Return the Token's superclass. * * @return The required base class for Token. */ public static String getTokenExtends() { return stringValue("TOKEN_EXTENDS"); } /** * Return the Token's factory class. * * @return The required factory class for Token. */ public static String getTokenFactory() { return stringValue("TOKEN_FACTORY"); } /** * Return the file encoding; this will return the file.encoding system property if no value was explicitly set * * @return The file encoding (e.g., UTF-8, ISO_8859-1, MacRoman) */ public static String getGrammarEncoding() { if (stringValue("GRAMMAR_ENCODING").equals("")) { return System.getProperties().getProperty("file.encoding"); } else { return stringValue("GRAMMAR_ENCODING"); } } /** * Find the output directory. * * @return The requested output directory. */ public static File getOutputDirectory() { return new File(stringValue("OUTPUT_DIRECTORY")); } public static String stringBufOrBuild() { if (getGenerateStringBuilder()) { return "StringBuilder"; } else { return "StringBuffer"; } } } javacc-5.0.orig/src/org/javacc/parser/TryBlock.java0000644000175000017500000000530411070137746021235 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.List; import java.util.Set; /** * Describes expansions of the form "try {...} ...". */ public class TryBlock extends Expansion { /** * The expansion contained within the try block. */ public Expansion exp; /** * The types of each catch block. Each list entry is itself a * list which in turn contains tokens as entries. */ public List types; /** * The exception identifiers of each catch block. Each list entry * is a token. */ public List ids; /** * The block part of each catch block. Each list entry is itself a * list which in turn contains tokens as entries. */ public List catchblks; /** * The block part of the finally block. Each list entry is a token. * If there is no finally block, this is null. */ public List finallyblk; public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = super.dump(indent, alreadyDumped); if (alreadyDumped.contains(this)) return sb; alreadyDumped.add(this); sb.append(eol).append(exp.dump(indent + 1, alreadyDumped)); return sb; } } javacc-5.0.orig/src/org/javacc/parser/REndOfFile.java0000644000175000017500000000343110574036602021415 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Describes the EOF regular expression */ public class REndOfFile extends RegularExpression { public Nfa GenerateNfa(boolean ignoreCase) { return null; } } javacc-5.0.orig/src/org/javacc/parser/OptionsTest.java0000644000175000017500000001522411165261216021774 0ustar mkochmkochpackage org.javacc.parser; import java.io.File; import junit.framework.TestCase; /** * Test cases to prod at the valitity of Options a little. * * @author Kees Jan Koster <kjkoster@kjkoster.org> */ public final class OptionsTest extends TestCase { public void testDefaults() { Options.init(); JavaCCErrors.reInit(); assertEquals(31, Options.optionValues.size()); assertEquals(true, Options.getBuildParser()); assertEquals(true, Options.getBuildTokenManager()); assertEquals(false, Options.getCacheTokens()); assertEquals(false, Options.getCommonTokenAction()); assertEquals(false, Options.getDebugLookahead()); assertEquals(false, Options.getDebugParser()); assertEquals(false, Options.getDebugTokenManager()); assertEquals(true, Options.getErrorReporting()); assertEquals(false, Options.getForceLaCheck()); assertEquals(false, Options.getIgnoreCase()); assertEquals(false, Options.getJavaUnicodeEscape()); assertEquals(true, Options.getKeepLineColumn()); assertEquals(true, Options.getSanityCheck()); assertEquals(true, Options.getStatic()); assertEquals(false, Options.getUnicodeInput()); assertEquals(false, Options.getUserCharStream()); assertEquals(false, Options.getUserTokenManager()); assertEquals(false, Options.getTokenManagerUsesParser()); assertEquals(2, Options.getChoiceAmbiguityCheck()); assertEquals(1, Options.getLookahead()); assertEquals(1, Options.getOtherAmbiguityCheck()); assertEquals("1.5", Options.getJdkVersion()); assertEquals(new File("."), Options.getOutputDirectory()); assertEquals("", Options.getTokenExtends()); assertEquals("", Options.getTokenFactory()); assertEquals(System.getProperties().get("file.encoding"), Options.getGrammarEncoding()); assertEquals(0, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); assertEquals(0, JavaCCErrors.get_parse_error_count()); assertEquals(0, JavaCCErrors.get_semantic_error_count()); } public void testSetBooleanOption() { Options.init(); JavaCCErrors.reInit(); assertEquals(true, Options.getStatic()); Options.setCmdLineOption("-NOSTATIC"); assertEquals(false, Options.getStatic()); assertEquals(false, Options.getJavaUnicodeEscape()); Options.setCmdLineOption("-JAVA_UNICODE_ESCAPE:true"); assertEquals(true, Options.getJavaUnicodeEscape()); assertEquals(true, Options.getSanityCheck()); Options.setCmdLineOption("-SANITY_CHECK=false"); assertEquals(false, Options.getSanityCheck()); assertEquals(0, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); assertEquals(0, JavaCCErrors.get_parse_error_count()); assertEquals(0, JavaCCErrors.get_semantic_error_count()); } public void testIntBooleanOption() { Options.init(); JavaCCErrors.reInit(); assertEquals(1, Options.getLookahead()); Options.setCmdLineOption("LOOKAHEAD=2"); assertEquals(2, Options.getLookahead()); assertEquals(0, JavaCCErrors.get_warning_count()); Options.setCmdLineOption("LOOKAHEAD=0"); assertEquals(2, Options.getLookahead()); assertEquals(0, JavaCCErrors.get_warning_count()); Options.setInputFileOption(null, null, "LOOKAHEAD", new Integer(0)); assertEquals(2, Options.getLookahead()); assertEquals(1, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); assertEquals(0, JavaCCErrors.get_parse_error_count()); assertEquals(0, JavaCCErrors.get_semantic_error_count()); } public void testSetStringOption() { Options.init(); JavaCCErrors.reInit(); assertEquals("", Options.getTokenExtends()); Options.setCmdLineOption("-TOKEN_EXTENDS=java.lang.Object"); assertEquals("java.lang.Object", Options.getTokenExtends()); Options.setInputFileOption(null, null, "TOKEN_EXTENDS", "Object"); // File option does not override cmd line assertEquals("java.lang.Object", Options.getTokenExtends()); Options.init(); JavaCCErrors.reInit(); Options.setInputFileOption(null, null, "TOKEN_EXTENDS", "Object"); assertEquals("Object", Options.getTokenExtends()); Options.setCmdLineOption("-TOKEN_EXTENDS=java.lang.Object"); assertEquals("java.lang.Object", Options.getTokenExtends()); } public void testSetNonexistentOption() { Options.init(); JavaCCErrors.reInit(); assertEquals(0, JavaCCErrors.get_warning_count()); Options.setInputFileOption(null, null, "OPTION", Boolean.TRUE ); assertEquals(1, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); assertEquals(0, JavaCCErrors.get_parse_error_count()); assertEquals(0, JavaCCErrors.get_semantic_error_count()); } public void testSetWrongTypeForOption() { Options.init(); JavaCCErrors.reInit(); assertEquals(0, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); Options.setInputFileOption(null, null, "STATIC", new Integer(8)); assertEquals(1, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); assertEquals(0, JavaCCErrors.get_parse_error_count()); assertEquals(0, JavaCCErrors.get_semantic_error_count()); } public void testNormalize() { Options.init(); JavaCCErrors.reInit(); assertEquals(false, Options.getDebugLookahead()); assertEquals(false, Options.getDebugParser()); Options.setCmdLineOption("-DEBUG_LOOKAHEAD=TRUE"); Options.normalize(); assertEquals(true, Options.getDebugLookahead()); assertEquals(true, Options.getDebugParser()); assertEquals(0, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); assertEquals(0, JavaCCErrors.get_parse_error_count()); assertEquals(0, JavaCCErrors.get_semantic_error_count()); } public void testOptionsString() throws ParseException { Options.init(); JavaCCErrors.reInit(); Options.setCmdLineOption("-STATIC=False"); Options.setCmdLineOption("-IGNORE_CASE=True"); String[] options = { "STATIC", "IGNORE_CASE" }; String optionString = Options.getOptionsString(options); assertEquals("STATIC=false,IGNORE_CASE=true", optionString); } } javacc-5.0.orig/src/org/javacc/parser/SingleCharacter.java0000644000175000017500000000455511070513745022546 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Describes single character descriptors in a character list. */ public class SingleCharacter { /** * The line and column number of the construct that corresponds * most closely to this node. */ private int column; private int line; /** * The character of this descriptor. */ public char ch; SingleCharacter() { } SingleCharacter(char c) { ch = c; } /** * @param line the line to set */ void setLine(int line) { this.line = line; } /** * @return the line */ int getLine() { return line; } /** * @param column the column to set */ void setColumn(int column) { this.column = column; } /** * @return the column */ int getColumn() { return column; } } javacc-5.0.orig/src/org/javacc/parser/JavaCC.jj0000644000175000017500000020506211070513744020254 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ /* * This file contains the grammar and actions that describe * JavaCCParser. When passed as input to JavaCCParser it generates * another copy of itself. Hence JavaCCParser may be modified by * modifying this file, and therefore this file is to be considered * the master version of JavaCCParser. */ options { JAVA_UNICODE_ESCAPE = true; STATIC=false; } PARSER_BEGIN(JavaCCParser) /** * This file contains the code for JavaCCParser generated * by JavaCCParser itself. */ package org.javacc.parser; import java.util.List; import java.util.ArrayList; public class JavaCCParser extends JavaCCParserInternals { /** * The name of the parser class. */ String parser_class_name; /** * This flag is set to true when the part between PARSER_BEGIN and * PARSER_END is being parsed. */ boolean processing_cu = false; /** * The level of class nesting. */ int class_nesting = 0; /** * This int variable is incremented while parsing local lookaheads. * Hence it keeps track of *syntactic* lookahead nesting. * This is used to provide warnings when actions and nested lookaheads * are used in syntactic lookahead productions. This is to prevent * typos such as leaving out the comma in LOOKAHEAD( foo(), {check()} ). */ int inLocalLA = 0; /** * Set to true when the parser is within an action. */ boolean inAction = false; /** * This flag keeps track of whether or not return and throw * statements have been patched during the parsing of a production. * The value of this flag is assigned the field with the same * name in BNFProduction.java. */ boolean jumpPatched = false; /* * Returns true if the next token is not in the FOLLOW list of "expansion". * It is used to decide when the end of an "expansion" has been reached. */ private boolean notTailOfExpansionUnit() { Token t; t = getToken(1); if (t.kind == BIT_OR || t.kind == COMMA || t.kind == RPAREN || t.kind == RBRACE || t.kind == RBRACKET) return false; return true; } /** * Class to hold modifiers. */ static public final class ModifierSet { /* Definitions of the bits in the modifiers field. */ public static final int PUBLIC = 0x0001; public static final int PROTECTED = 0x0002; public static final int PRIVATE = 0x0004; public static final int ABSTRACT = 0x0008; public static final int STATIC = 0x0010; public static final int FINAL = 0x0020; public static final int SYNCHRONIZED = 0x0040; public static final int NATIVE = 0x0080; public static final int TRANSIENT = 0x0100; public static final int VOLATILE = 0x0200; public static final int STRICTFP = 0x1000; /** A set of accessors that indicate whether the specified modifier is in the set. */ public boolean isPublic(int modifiers) { return (modifiers & PUBLIC) != 0; } public boolean isProtected(int modifiers) { return (modifiers & PROTECTED) != 0; } public boolean isPrivate(int modifiers) { return (modifiers & PRIVATE) != 0; } public boolean isStatic(int modifiers) { return (modifiers & STATIC) != 0; } public boolean isAbstract(int modifiers) { return (modifiers & ABSTRACT) != 0; } public boolean isFinal(int modifiers) { return (modifiers & FINAL) != 0; } public boolean isNative(int modifiers) { return (modifiers & NATIVE) != 0; } public boolean isStrictfp(int modifiers) { return (modifiers & STRICTFP) != 0; } public boolean isSynchronized(int modifiers) { return (modifiers & SYNCHRONIZED) != 0; } public boolean isTransient(int modifiers) { return (modifiers & TRANSIENT) != 0; } public boolean isVolatile(int modifiers) { return (modifiers & VOLATILE) != 0; } /** * Removes the given modifier. */ static int removeModifier(int modifiers, int mod) { return modifiers & ~mod; } } } PARSER_END(JavaCCParser) TOKEN_MGR_DECLS : { int beginLine[] = new int[10]; int beginCol[] = new int[10]; int depth = 0; int size = 10; void saveBeginLineCol(int l, int c) { if (depth == size) { size += 5; int tmpbeginLine[] = new int[size]; int tmpbeginCol[] = new int[size]; System.arraycopy(beginLine, 0, beginLine = tmpbeginLine, 0, depth); System.arraycopy(beginCol, 0, beginCol = tmpbeginCol, 0, depth); } beginLine[depth] = l; beginCol[depth] = c; depth++; } void restoreBeginLineCol() { depth--; input_stream.adjustBeginLineColumn(beginLine[depth], beginCol[depth]); } } /********************************************** * THE JAVACC TOKEN SPECIFICATION STARTS HERE * **********************************************/ /* JAVACC RESERVED WORDS: These are the only tokens in JavaCC but not in Java */ TOKEN : { // "options" is no longer reserved (see issue 126). // < _OPTIONS: "options" > < _LOOKAHEAD: "LOOKAHEAD" > | < _IGNORE_CASE: "IGNORE_CASE" > | < _PARSER_BEGIN: "PARSER_BEGIN" > | < _PARSER_END: "PARSER_END" > | < _JAVACODE: "JAVACODE" > | < _TOKEN: "TOKEN" > | < _SPECIAL_TOKEN: "SPECIAL_TOKEN" > | < _MORE: "MORE" > | < _SKIP: "SKIP" > | < _TOKEN_MGR_DECLS: "TOKEN_MGR_DECLS" > | < _EOF: "EOF" > } /* * The remainder of the tokens are exactly (except for the removal of tokens * containing ">>" and "<<") as in the Java grammar and must be diff equivalent * (again with the exceptions above) to it. */ /* WHITE SPACE */ SKIP : { " " | "\t" | "\n" | "\r" | "\f" | "/*@egen*/" : AFTER_EGEN } SKIP : { <~[]> { restoreBeginLineCol(); input_stream.backup(1); } : DEFAULT } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT | "/*@bgen(jjtree" { saveBeginLineCol(input_stream.getBeginLine(), input_stream.getBeginColumn()); } : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* JAVA RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < ASSERT: "assert" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < ENUM: "enum" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < STRICTFP: "strictfp" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* JAVA LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: | > | < #DECIMAL_FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < #HEXADECIMAL_FLOATING_POINT_LITERAL: "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? (["f","F","d","D"])? | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ (["f","F","d","D"])? > | < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > //| < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > // | < LSHIFT: "<<" > // | < RSIGNEDSHIFT: ">>" > // | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > // | < LSHIFTASSIGN: "<<=" > // | < RSIGNEDSHIFTASSIGN: ">>=" > // | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /* >'s need special attention due to generics syntax. */ TOKEN : { < RUNSIGNEDSHIFT: ">>>" > { matchedToken.kind = GT; ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; input_stream.backup(2); matchedToken.image = ">"; } | < RSIGNEDSHIFT: ">>" > { matchedToken.kind = GT; ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT; input_stream.backup(1); matchedToken.image = ">"; } | < GT: ">" > } /************************************************ * THE JAVACC GRAMMAR SPECIFICATION STARTS HERE * ************************************************/ void javacc_input() : { String id1, id2; initialize(); } { javacc_options() "PARSER_BEGIN" "(" id1=identifier() { addcuname(id1); } ")" { processing_cu = true; parser_class_name = id1; } CompilationUnit() { processing_cu = false; } "PARSER_END" "(" id2=identifier() { compare(getToken(0), id1, id2); } ")" ( production() )+ } void javacc_options() : {} { [ LOOKAHEAD({ getToken(1).image.equals("options") }) "{" ( option_binding() )* "}" ] { Options.normalize(); } } void option_binding() : { String option_name; int int_val; boolean bool_val; String string_val; Token t = getToken(1); } { ( | "LOOKAHEAD" | "IGNORE_CASE" | "static" ) { option_name = t.image; } "=" ( int_val = IntegerLiteral() { Options.setInputFileOption(t, getToken(0), option_name, new Integer(int_val)); } | bool_val = BooleanLiteral() { Options.setInputFileOption(t, getToken(0), option_name, new Boolean(bool_val)); } | string_val = StringLiteral() { Options.setInputFileOption(t, getToken(0), option_name, string_val); } ) ";" } void production() : {} { LOOKAHEAD(1) /* * Since JAVACODE is both a JavaCC reserved word and a Java identifier, * we need to give preference to "javacode_production" over * "bnf_production". */ javacode_production() | LOOKAHEAD(1) /* * Since SKIP, TOKEN, etc. are both JavaCC reserved words and Java * identifiers, we need to give preference to "regular_expression_production" * over "bnf_production". */ regular_expr_production() | LOOKAHEAD(1) /* * Since TOKEN_MGR_DECLS is both a JavaCC reserved word and a Java identifier, * we need to give preference to "token_manager_decls" over * "bnf_production". */ token_manager_decls() | bnf_production() } void javacode_production() : { JavaCodeProduction p = new JavaCodeProduction(); String lhs; Token t = getToken(1); p.setFirstToken(t); java.util.List excName; p.setThrowsList(new java.util.ArrayList()); p.setLine(t.beginLine); p.setColumn(t.beginColumn); } { "JAVACODE" AccessModifier(p) ResultType(p.getReturnTypeTokens()) lhs=identifier() { p.setLhs(lhs); } FormalParameters(p.getParameterListTokens()) [ "throws" { excName = new ArrayList(); } Name(excName) { p.getThrowsList().add(excName); } ( { excName = new ArrayList(); } "," Name(excName) { p.getThrowsList().add(excName); } )* ] Block(p.getCodeTokens()) { p.setLastToken(getToken(0)); addproduction(p); } } void bnf_production() : { BNFProduction p = new BNFProduction(); Container c = new Container(); Token t = getToken(1); p.setFirstToken(t); java.util.List excName; String lhs; p.setThrowsList(new java.util.ArrayList()); p.setLine(t.beginLine); p.setColumn(t.beginColumn); jumpPatched = false; } { AccessModifier(p) ResultType(p.getReturnTypeTokens()) lhs=identifier() { p.setLhs(lhs); } FormalParameters(p.getParameterListTokens()) [ "throws" { excName = new ArrayList(); } Name(excName) { p.getThrowsList().add(excName); } ( { excName = new ArrayList(); } "," Name(excName) { p.getThrowsList().add(excName); } )* ] ":" Block(p.getDeclarationTokens()) "{" expansion_choices(c) t="}" { p.setLastToken(t); p.setJumpPatched(jumpPatched); production_addexpansion(p, (Expansion)(c.member)); addproduction(p); } } void AccessModifier(NormalProduction p) : { Token t = null; } { ( t = "public" | t = "protected" | t = "private" )? { if(t != null){ p.setAccessMod(t.image); } } } void regular_expr_production() : { TokenProduction p = new TokenProduction(); java.util.List states; Token t = p.firstToken = getToken(1); p.setLine(t.beginLine); p.setColumn(t.beginColumn); } { { // set p.lexStates assuming there is no state spec. // and then override if necessary. p.lexStates = new String[] {"DEFAULT"}; } [ LOOKAHEAD(2) "<" "*" ">" { p.lexStates = null; } | "<" { states = new java.util.ArrayList(); } t= { states.add(t.image); } ( "," t= { states.add(t.image); } )* ">" { p.lexStates = new String[states.size()]; for (int i = 0; i < states.size(); i++) { p.lexStates[i] = (String)states.get(i); } } ] regexpr_kind(p) { if (p.kind != TokenProduction.TOKEN && Options.getUserTokenManager()) { JavaCCErrors.warning(getToken(0), "Regular expression is being treated as if it were a TOKEN since option USER_TOKEN_MANAGER has been set to true."); } } [ "[" t="IGNORE_CASE" "]" { p.ignoreCase = true; if (Options.getUserTokenManager()) { JavaCCErrors.warning(t, "Ignoring \"IGNORE_CASE\" specification since option USER_TOKEN_MANAGER has been set to true."); } } ] ":" "{" regexpr_spec(p) ( "|" regexpr_spec(p) )* t="}" { p.lastToken = t; addregexpr(p); } } void token_manager_decls() : { java.util.List decls = new java.util.ArrayList(); Token t; } { t="TOKEN_MGR_DECLS" ":" ClassOrInterfaceBody(false, decls) { add_token_manager_decls(t, decls); } } void regexpr_kind(TokenProduction p) : {} { "TOKEN" { p.kind = TokenProduction.TOKEN; } | "SPECIAL_TOKEN" { p.kind = TokenProduction.SPECIAL; } | "SKIP" { p.kind = TokenProduction.SKIP; } | "MORE" { p.kind = TokenProduction.MORE; } } void regexpr_spec(TokenProduction p) : { Container c = new Container(); Action act = new Action(); Token t = null; RegExprSpec res = new RegExprSpec(); } { regular_expression(c) { res.rexp = (RegularExpression)c.member; res.rexp.tpContext = p; } [ { t = getToken(1); } Block(act.getActionTokens()) { if (Options.getUserTokenManager()) { JavaCCErrors.warning(t, "Ignoring action in regular expression specification since option USER_TOKEN_MANAGER has been set to true."); } if (res.rexp.private_rexp) { JavaCCErrors.parse_error(t, "Actions are not permitted on private (#) regular expressions."); } } ] [ ":" t= { res.nextState = t.image; if (res.rexp.private_rexp) { JavaCCErrors.parse_error(t, "Lexical state changes are not permitted after private (#) regular expressions."); } } ] { res.act = act; res.nsTok = t; p.respecs.add(res); } } void expansion_choices(Container c1) : { boolean morethanone = false; Choice ch = null; // unnecessary initialization to make Java compiler happy! Container c2 = new Container(); } { expansion(c1) ( "|" expansion(c2) { if (morethanone) { ch.getChoices().add(c2.member); ((Expansion)c2.member).parent = ch; } else { morethanone = true; ch = new Choice((Expansion)c1.member); ((Expansion)c1.member).parent = ch; ch.getChoices().add(c2.member); ((Expansion)c2.member).parent = ch; } } )* { if (morethanone) { c1.member = ch; } } } void expansion(Container c1) : { Sequence seq = new Sequence(); Container c2 = new Container(); Lookahead la = new Lookahead(); Token t = getToken(1); seq.setLine(t.beginLine); seq.setColumn(t.beginColumn); la.setLine(t.beginLine); la.setColumn(t.beginColumn); } { { la.setAmount(Options.getLookahead()); la.setLaExpansion(null); la.setExplicit(false); } ( LOOKAHEAD(1) t="LOOKAHEAD" "(" la=local_lookahead() ")" { if (inLocalLA != 0 && la.getAmount() != 0) { JavaCCErrors.warning(t, "Only semantic lookahead specifications within other lookahead specifications is considered. Syntactic lookahead is ignored."); } } )? { seq.units.add(la); } ( LOOKAHEAD(0, { notTailOfExpansionUnit() } ) expansion_unit(c2) { seq.units.add(c2.member); ((Expansion)c2.member).parent = seq; ((Expansion)c2.member).ordinal = seq.units.size()-1; } )+ { if (la.getLaExpansion() == null) { la.setLaExpansion(seq); } c1.member = seq; } } Lookahead local_lookahead() : { Lookahead la = new Lookahead(); la.setExplicit(true); Token t = getToken(1); la.setLine(t.beginLine); la.setColumn(t.beginColumn); la.setLaExpansion(null); Container c = new Container(); boolean commaAtEnd = false, emptyLA = true; int laAmount; inLocalLA++; } { [ /* * The lookahead of 1 is to turn off the warning message that lets * us know that an expansion choice can also start with an integer * literal because a primary expression can do the same. But we * know that this is what we want. */ LOOKAHEAD(1) laAmount = IntegerLiteral() { emptyLA = false; la.setAmount(laAmount); } ] [ LOOKAHEAD(0, { !emptyLA && (getToken(1).kind != RPAREN) } ) "," { commaAtEnd = true; } ] [ LOOKAHEAD(0, { getToken(1).kind != RPAREN && getToken(1).kind != LBRACE } ) expansion_choices(c) { emptyLA = false; commaAtEnd = false; la.setLaExpansion((Expansion)c.member); } ] [ LOOKAHEAD(0, { !emptyLA && !commaAtEnd && (getToken(1).kind != RPAREN) } ) "," { commaAtEnd = true; } ] [ LOOKAHEAD(0, { emptyLA || commaAtEnd } ) "{" Expression(la.getActionTokens()) "}" { if (emptyLA) { la.setAmount(0); } } ] { inLocalLA--; return la; } } void expansion_unit(Container c) : { String name; java.util.List lhsTokens = new java.util.ArrayList(); NonTerminal nt; Action act; Token t; Lookahead la; } { LOOKAHEAD(1) /* * We give this priority over primary expressions which use LOOKAHEAD as the * name of its identifier. */ t="LOOKAHEAD" "(" la=local_lookahead() ")" { // Now set the la_expansion field of la with a dummy // expansion (we use EOF). la.setLaExpansion(new REndOfFile()); // Create a singleton choice with an empty action. Choice ch = new Choice(t); Sequence seq = new Sequence(t, la); la.parent = seq; la.ordinal = 0; act = new Action(); act.setLine(t.beginLine); act.setColumn(t.beginColumn); seq.units.add(act); act.parent = seq; act.ordinal = 1; ch.getChoices().add(seq); seq.parent = ch; seq.ordinal = 0; if (la.getAmount() != 0) { if (la.getActionTokens().size() != 0) { JavaCCErrors.warning(t, "Encountered LOOKAHEAD(...) at a non-choice location. Only semantic lookahead will be considered here."); } else { JavaCCErrors.warning(t, "Encountered LOOKAHEAD(...) at a non-choice location. This will be ignored."); } } c.member = ch; } | { act = new Action(); t = getToken(1); act.setLine(t.beginLine); act.setColumn(t.beginColumn); inAction = true; } Block(act.getActionTokens()) { inAction = false; if (inLocalLA != 0) { JavaCCErrors.warning(t, "Action within lookahead specification will be ignored."); } c.member = act; } | t="[" expansion_choices(c) "]" { c.member = new ZeroOrOne(t, (Expansion)c.member); } | { Container expch = new Container(); java.util.List types = new java.util.ArrayList(); java.util.List ids = new java.util.ArrayList(); java.util.List catchblks = new java.util.ArrayList(); java.util.List finallyblk = null; java.util.List vec = new java.util.ArrayList(); Token t0; } t0="try" "{" expansion_choices(expch) "}" ( "catch" "(" Name(vec) t= ")" { types.add(vec); ids.add(t); vec = new java.util.ArrayList(); inAction = true; } Block(vec) { inAction = false; catchblks.add(vec); vec = new java.util.ArrayList(); } )* [ { inAction = true; } "finally" Block(vec) { inAction = false; finallyblk = vec; } ] { makeTryBlock(t0, c, expch, types, ids, catchblks, finallyblk); } | LOOKAHEAD( identifier() | StringLiteral() | "<" | PrimaryExpression() "=" ) [ LOOKAHEAD(PrimaryExpression() "=") { Token first = getToken(1); } PrimaryExpression() { Token last = getToken(0); } "=" { t = first; while (true) { lhsTokens.add(t); if (t == last) break; t = t.next; } } ] ( LOOKAHEAD( identifier() "(") { nt = new NonTerminal(); t = getToken(1); nt.setLine(t.beginLine); nt.setColumn(t.beginColumn); nt.setLhsTokens(lhsTokens); } name=identifier() Arguments(nt.getArgumentTokens()) { nt.setName(name); c.member = nt; } | regular_expression(c) { ((RegularExpression)(c.member)).lhsTokens = lhsTokens; add_inline_regexpr((RegularExpression)(c.member)); } [ "." t= { ((RegularExpression)(c.member)).rhsToken = t; } ] ) | t="(" expansion_choices(c) ")" ( "+" { c.member = new OneOrMore(t, (Expansion)c.member); } | "*" { c.member = new ZeroOrMore(t, (Expansion)c.member); } | "?" { c.member = new ZeroOrOne(t, (Expansion)c.member); } )? } void regular_expression(Container c) : { REndOfFile ef; String image; boolean private_rexp = false; Token t = getToken(1); } { image=StringLiteral() { c.member = new RStringLiteral(t, image); } | LOOKAHEAD(3) { image = ""; } < LANGLE: "<" > [ [ "#" { private_rexp = true; } ] image=identifier() ":" ] complex_regular_expression_choices(c) < RANGLE: ">" > { RegularExpression re; if (c.member instanceof RJustName) { RSequence seq = new RSequence(); seq.units.add(c.member); re = seq; } else { re = (RegularExpression)c.member; } re.label = image; re.private_rexp = private_rexp; re.setLine(t.beginLine); re.setColumn(t.beginColumn); c.member = re; } | LOOKAHEAD(2) "<" image=identifier() ">" { c.member = new RJustName(t, image); } | "<" "EOF" ">" { ef = new REndOfFile(); ef.setLine(t.beginLine); ef.setColumn(t.beginColumn); ef.ordinal = 0; c.member = ef; } } void complex_regular_expression_choices(Container c1) : { boolean morethanone = false; RChoice ch = null; // unnecessary initialization to make Java compiler happy! Container c2 = new Container(); } { complex_regular_expression(c1) ( "|" complex_regular_expression(c2) { if (morethanone) { ch.getChoices().add(c2.member); } else { morethanone = true; ch = new RChoice(); ch.setLine(((RegularExpression)c1.member).getLine()); ch.setColumn(((RegularExpression)c1.member).getColumn()); ch.getChoices().add(c1.member); ch.getChoices().add(c2.member); } } )* { if (morethanone) { c1.member = ch; } } } void complex_regular_expression(Container c1) : { int count = 0; RSequence seq = null; // unnecessary initialization to make Java compiler happy! Container c2 = new Container(); } { ( complex_regular_expression_unit(c2) { count++; if (count == 1) { c1.member = c2.member; // if count does not go beyond 1, we are done. } else if (count == 2) { // more than 1, so create a sequence. seq = new RSequence(); seq.setLine(((RegularExpression)c1.member).getLine()); seq.setColumn(((RegularExpression)c1.member).getColumn()); seq.units.add(c1.member); seq.units.add(c2.member); } else { seq.units.add(c2.member); } } )+ { if (count > 1) { c1.member = seq; } } } void complex_regular_expression_unit(Container c) : { String image; Token t = getToken(1); int r1 = 0, r2 = -1; boolean hasMax = false; } { image=StringLiteral() { c.member = new RStringLiteral(t, image); } | "<" image=identifier() ">" { c.member = new RJustName(t, image); } | character_list(c) | "(" complex_regular_expression_choices(c) ")" ( "+" { c.member = new ROneOrMore(t, (RegularExpression)c.member); } | "*" { c.member = new RZeroOrMore(t, (RegularExpression)c.member); } | "?" { RZeroOrOne zorexp = new RZeroOrOne(); zorexp.setLine(t.beginLine); zorexp.setColumn(t.beginColumn); zorexp.regexpr = (RegularExpression)c.member; c.member = zorexp; } | "{" r1 = IntegerLiteral() [ "," { hasMax = true; } [ r2 = IntegerLiteral() ] ] "}" { RRepetitionRange rrrexp = new RRepetitionRange(); rrrexp.setLine(t.beginLine); rrrexp.setColumn(t.beginColumn); rrrexp.min = r1; rrrexp.max = r2; rrrexp.hasMax = hasMax; rrrexp.regexpr = (RegularExpression)c.member; c.member = rrrexp; } )? } void character_list(Container c1) : { RCharacterList chlist = new RCharacterList(); Token t = getToken(1); chlist.setLine(t.beginLine); chlist.setColumn(t.beginColumn); Container c2 = new Container(); } { ["~" { chlist.negated_list = true; } ] "[" [ character_descriptor(c2) { chlist.descriptors.add(c2.member); } ( "," character_descriptor(c2) { chlist.descriptors.add(c2.member); } )* ] "]" { c1.member = chlist; } } void character_descriptor(Container c) : { char c1, c2 = ' '; // unnecessary initialization to make Java compiler happy! boolean isrange = false; String imageL, imageR; Token t = getToken(1); } { imageL=StringLiteral() { c1 = character_descriptor_assign(getToken(0), imageL); } [ "-" imageR=StringLiteral() { isrange = true; c2 = character_descriptor_assign(getToken(0), imageR, imageL); } ] { if (isrange) { CharacterRange cr = new CharacterRange(); cr.setLine(t.beginLine); cr.setColumn(t.beginColumn); cr.setLeft(c1); cr.setRight(c2); c.member = cr; } else { SingleCharacter sc = new SingleCharacter(); sc.setLine(t.beginLine); sc.setColumn(t.beginColumn); sc.ch = c1; c.member = sc; } } } String identifier() : { Token t; } { t= { return t.image; } } /********************************************** * THE JAVA GRAMMAR SPECIFICATION STARTS HERE * **********************************************/ /* * The Java grammar is modified to use sequences of tokens * for the missing tokens - those that include "<<" and ">>". */ /* * The following production defines Java identifiers - it * includes the reserved words of JavaCC also. */ Token JavaIdentifier() : {} { ( | "LOOKAHEAD" | "IGNORE_CASE" | "PARSER_BEGIN" | "PARSER_END" | "JAVACODE" | "TOKEN" | "SPECIAL_TOKEN" | "MORE" | "SKIP" | "TOKEN_MGR_DECLS" | "EOF" ) { Token retval = getToken(0); retval.kind = IDENTIFIER; return retval; } } /* * Program structuring syntax follows. */ void CompilationUnit() : /* * The is deleted since the compilation unit is embedded * within grammar code. */ { set_initial_cu_token(getToken(1)); } { [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ] ( ImportDeclaration() )* ( TypeDeclaration() )* { insertionpointerrors(getToken(1)); } } void PackageDeclaration() : {} { Modifiers() "package" Name(null) ";" } void ImportDeclaration() : {} { "import" [ "static" ] Name(null) [ "." "*" ] ";" } /* * Modifiers. We match all modifiers in a single rule to reduce the chances of * syntax errors for simple modifier mistakes. It will also enable us to give * better error messages. */ int Modifiers(): { int modifiers = 0; } { ( LOOKAHEAD(2) ( "public" { modifiers |= ModifierSet.PUBLIC; } | "static" { modifiers |= ModifierSet.STATIC; } | "protected" { modifiers |= ModifierSet.PROTECTED; } | "private" { modifiers |= ModifierSet.PRIVATE; } | "final" { modifiers |= ModifierSet.FINAL; } | "abstract" { modifiers |= ModifierSet.ABSTRACT; } | "synchronized" { modifiers |= ModifierSet.SYNCHRONIZED; } | "native" { modifiers |= ModifierSet.NATIVE; } | "transient" { modifiers |= ModifierSet.TRANSIENT; } | "volatile" { modifiers |= ModifierSet.VOLATILE; } | "strictfp" { modifiers |= ModifierSet.STRICTFP; } | Annotation() ) )* { return modifiers; } } /* * Declaration syntax follows. */ void TypeDeclaration(): { int modifiers; } { ";" | modifiers = Modifiers() ( ClassOrInterfaceDeclaration(modifiers, null) | EnumDeclaration(modifiers) | AnnotationTypeDeclaration(modifiers) ) } void ClassOrInterfaceDeclaration(int modifiers, List tokens): { boolean isInterface = false; class_nesting++; Token t; boolean is_parser_class = false; if (tokens == null) tokens = new ArrayList(); } { ( "class" | "interface" { isInterface = true; } ) t= [ TypeParameters() ] [ ExtendsList(isInterface) ] [ ImplementsList(isInterface) ] { if (t.image.equals(parser_class_name) && class_nesting == 1 && processing_cu) { is_parser_class = true; setinsertionpoint(getToken(1), 1); } } ClassOrInterfaceBody(isInterface, null) { if (is_parser_class) { setinsertionpoint(getToken(0), 2); } class_nesting--; } } void ExtendsList(boolean isInterface): { boolean extendsMoreThanOne = false; } { "extends" ClassOrInterfaceType() ( "," ClassOrInterfaceType() { extendsMoreThanOne = true; } )* { if (extendsMoreThanOne && !isInterface) throw new ParseException("A class cannot extend more than one other class"); } } void ImplementsList(boolean isInterface): {} { "implements" ClassOrInterfaceType() ( "," ClassOrInterfaceType() )* { if (isInterface) throw new ParseException("An interface cannot implement other interfaces"); } } void EnumDeclaration(int modifiers): {} { "enum" [ ImplementsList(false) ] EnumBody() } void EnumBody(): {} { "{" [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ] [ "," ] [ ";" ( ClassOrInterfaceBodyDeclaration(false) )* ] "}" } void EnumConstant(): {} { Modifiers() [ Arguments(null) ] [ ClassOrInterfaceBody(false, null) ] } void TypeParameters(): {} { "<" TypeParameter() ( "," TypeParameter() )* ">" } void TypeParameter(): {} { [ TypeBound() ] } void TypeBound(): {} { "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )* } void ClassOrInterfaceBody(boolean isInterface, List tokens): /* * Parsing this fills "tokens" with all tokens of the block * excluding the braces at each end. */ { Token first, last; if (tokens == null) tokens = new ArrayList(); } { "{" { first = getToken(1); } ( ClassOrInterfaceBodyDeclaration(isInterface) )* { last = getToken(0); } "}" { if (last.next != first) { // i.e., this is not an empty sequence Token t = first; while (true) { tokens.add(t); if (t == last) break; t = t.next; } } } } void ClassOrInterfaceBodyDeclaration(boolean isInterface): { int modifiers; } { LOOKAHEAD(2) Initializer() { if (isInterface) throw new ParseException("An interface cannot have initializers"); } | modifiers = Modifiers() // Just get all the modifiers out of the way. If you want to do // more checks, pass the modifiers down to the member ( ClassOrInterfaceDeclaration(modifiers, null) | EnumDeclaration(modifiers) | LOOKAHEAD( [ TypeParameters() ] "(" ) ConstructorDeclaration() | LOOKAHEAD( Type() ( "[" "]" )* ( "," | "=" | ";" ) ) FieldDeclaration(modifiers) | MethodDeclaration(modifiers) ) | ";" } void FieldDeclaration(int modifiers): {} { // Modifiers are already matched in the caller Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator(): {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId(): {} { ( "[" "]" )* } void VariableInitializer(): {} { ArrayInitializer() | Expression(null) } void ArrayInitializer(): {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration(int modifiers): {} { // Modifiers already matched in the caller! [ TypeParameters() ] ResultType(null) MethodDeclarator() [ "throws" NameList() ] ( Block(null) | ";" ) } void MethodDeclarator(): {} { FormalParameters(null) ( "[" "]" )* } void FormalParameters(List tokens) : /* * Parsing this fills "tokens" with all tokens of the formal * parameters excluding the parentheses at each end. */ { Token first, last; if (tokens == null) tokens = new ArrayList(); } { "(" { first = getToken(1); } [ FormalParameter() ( "," FormalParameter() )* ] { last = getToken(0); } ")" { if (last.next != first) { // i.e., this is not an empty sequence Token t = first; while (true) { tokens.add(t); if (t == last) break; t = t.next; } } } } void FormalParameter(): {} { Modifiers() Type() [ "..." ] VariableDeclaratorId() } void ConstructorDeclaration(): {} { [ TypeParameters() ] // Modifiers matched in the caller FormalParameters(null) [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation(): {} { LOOKAHEAD("this" Arguments(null) ";") "this" Arguments(null) ";" | [ LOOKAHEAD(2) PrimaryExpression() "." ] "super" Arguments(null) ";" } void Initializer(): {} { [ "static" ] Block(null) } /* * Type, name and expression syntax follows. */ void Type(): {} { LOOKAHEAD(2) ReferenceType() | PrimitiveType() } void ReferenceType(): {} { PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+ | ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )* } void ClassOrInterfaceType(): {} { [ LOOKAHEAD(2) TypeArguments() ] ( LOOKAHEAD(2) "." [ LOOKAHEAD(2) TypeArguments() ] )* } void TypeArguments(): {} { "<" TypeArgument() ( "," TypeArgument() )* ">" } void TypeArgument(): {} { ReferenceType() | "?" [ WildcardBounds() ] } void WildcardBounds(): {} { "extends" ReferenceType() | "super" ReferenceType() } void PrimitiveType(): {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType(List tokens) : { Token first = getToken(1); if (tokens == null) tokens = new ArrayList(); } { ( "void" | Type() ) { Token last = getToken(0); Token t = first; while (true) { tokens.add(t); if (t == last) break; t = t.next; } } } void Name(List tokens) : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ { if (tokens == null) tokens = new ArrayList(); Token first = getToken(1); } { JavaIdentifier() ( LOOKAHEAD(2) "." JavaIdentifier() )* { Token last = getToken(0); Token t = first; while (true) { tokens.add(t); if (t == last) break; t = t.next; } } } void NameList(): {} { Name(null) ( "," Name(null) )* } /* * Expression syntax follows. */ void Expression(List tokens) : /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ { Token first = getToken(1); if (tokens == null) tokens = new ArrayList(); } { ConditionalExpression() [ LOOKAHEAD(2) AssignmentOperator() Expression(null) ] { Token last = getToken(0); Token t = first; while (true) { tokens.add(t); if (t == last) break; t = t.next; } } } void AssignmentOperator(): {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression(): {} { ConditionalOrExpression() [ "?" Expression(null) ":" Expression(null) ] } void ConditionalOrExpression(): {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression(): {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression(): {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression(): {} { AndExpression() ( "^" AndExpression() )* } void AndExpression(): {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression(): {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression(): {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression(): {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression(): {} { AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )* } void AdditiveExpression(): {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression(): {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression(): {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression(): {} { "++" PrimaryExpression() } void PreDecrementExpression(): {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus(): {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead(): {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Type() "[") "(" Type() "[" "]" | "(" Type() ")" ( "~" | "!" | "(" | | "this" | "super" | "new" | Literal() ) } void PostfixExpression(): {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression(): {} { LOOKAHEAD("(" PrimitiveType()) "(" Type() ")" UnaryExpression() | "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression(): {} { PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* } void MemberSelector(): {} { "." TypeArguments() } void PrimaryPrefix(): {} { Literal() | "this" | "super" "." | "(" Expression(null) ")" | AllocationExpression() | LOOKAHEAD( ResultType(null) "." "class" ) ResultType(null) "." "class" | Name(null) } void PrimarySuffix(): {} { LOOKAHEAD(2) "." "this" | LOOKAHEAD(2) "." AllocationExpression() | LOOKAHEAD(3) MemberSelector() | "[" Expression(null) "]" | "." | Arguments(null) } void Literal(): {} { | | | | BooleanLiteral() | NullLiteral() } int IntegerLiteral() : {} { { try { return Integer.parseInt(token.image); } catch (NumberFormatException e) { throw new Error(); } } } boolean BooleanLiteral() : {} { "true" { return true; } | "false" { return false; } } String StringLiteral() : { Token t; } { t= { return remove_escapes_and_quotes(t, t.image); } } void NullLiteral() : {} { "null" } void Arguments(java.util.List tokens) : /* * Parsing this fills "tokens" with all tokens of the arguments * excluding the parentheses at each end. */ { Token first, last; if (tokens == null) tokens = new ArrayList(); } { "(" { first = getToken(1); } [ ArgumentList() ] { last = getToken(0); } ")" { if (last.next != first) { // i.e., this is not an empty sequence Token t = first; while (true) { tokens.add(t); if (t == last) break; t = t.next; } } } } void ArgumentList(): {} { Expression(null) ( "," Expression(null) )* } void AllocationExpression(): {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimsAndInits() | "new" ClassOrInterfaceType() [ TypeArguments() ] ( ArrayDimsAndInits() | Arguments(null) [ ClassOrInterfaceBody(false, null) ] ) } /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimsAndInits(): {} { LOOKAHEAD(2) ( LOOKAHEAD(2) "[" Expression(null) "]" )+ ( LOOKAHEAD(2) "[" "]" )* | ( "[" "]" )+ ArrayInitializer() } /* * Statement syntax follows. */ void Statement(): {} { LOOKAHEAD(2) LabeledStatement() | AssertStatement() | Block(null) | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void AssertStatement(): {} { "assert" Expression(null) [ ":" Expression(null) ] ";" } void LabeledStatement(): {} { ":" Statement() } void Block(List tokens) : /* * Parsing this fills "tokens" with all tokens of the block * excluding the braces at each end. */ { Token first, last; if (tokens == null) tokens = new ArrayList(); } { "{" { first = getToken(1); } ( BlockStatement() )* { last = getToken(0); } "}" { if (last.next != first) { // i.e., this is not an empty sequence Token t = first; while (true) { tokens.add(t); if (t == last) break; t = t.next; } } } } void BlockStatement(): {} { LOOKAHEAD( Modifiers() Type() ) LocalVariableDeclaration() ";" | Statement() | ClassOrInterfaceDeclaration(0, null) } void LocalVariableDeclaration(): {} { Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement(): {} { ";" } void StatementExpression(): /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ {} { PreIncrementExpression() | PreDecrementExpression() | PrimaryExpression() [ "++" | "--" | AssignmentOperator() Expression(null) ] } void SwitchStatement(): {} { "switch" "(" Expression(null) ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel(): {} { "case" Expression(null) ":" | "default" ":" } void IfStatement(): /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression(null) ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement(): {} { "while" "(" Expression(null) ")" Statement() } void DoStatement(): {} { "do" Statement() "while" "(" Expression(null) ")" ";" } void ForStatement(): {} { "for" "(" ( LOOKAHEAD(Modifiers() Type() ":") Modifiers() Type() ":" Expression(null) | [ ForInit() ] ";" [ Expression(null) ] ";" [ ForUpdate() ] ) ")" Statement() } void ForInit(): {} { LOOKAHEAD( Modifiers() Type() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList(): {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate(): {} { StatementExpressionList() } void BreakStatement(): {} { "break" [ ] ";" } void ContinueStatement(): {} { "continue" [ ] ";" } void ReturnStatement() : { Token t; } { t="return" { // Add if statement to prevent subsequent code generated // from being dead code. if (inAction) { t.image = "{if (true) return"; jumpPatched = true; } } [ Expression(null) ] t=";" { // Add closing brace for above if statement. if (inAction) { t.image = ";}"; } } } void ThrowStatement() : { Token t; } { t="throw" { // Add if statement to prevent subsequent code generated // from being dead code. if (inAction) { t.image = "{if (true) throw"; jumpPatched = true; } } Expression(null) t=";" { // Add closing brace for above if statement. if (inAction) { t.image = ";}"; } } } void SynchronizedStatement(): {} { "synchronized" "(" Expression(null) ")" Block(null) } void TryStatement(): /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block(null) ( "catch" "(" FormalParameter() ")" Block(null) )* [ "finally" Block(null) ] } /* We use productions to match >>>, >> and > so that we can keep the * type declaration syntax with generics clean */ void RUNSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) ">" ">" ">" ) } void RSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} ) ">" ">" ) } /* Annotation syntax follows. */ void Annotation(): {} { LOOKAHEAD( "@" Name(null) "(" ( "=" | ")" )) NormalAnnotation() | LOOKAHEAD( "@" Name(null) "(" ) SingleMemberAnnotation() | MarkerAnnotation() } void NormalAnnotation(): {} { "@" Name(null) "(" [ MemberValuePairs() ] ")" } void MarkerAnnotation(): {} { "@" Name(null) } void SingleMemberAnnotation(): {} { "@" Name(null) "(" MemberValue() ")" } void MemberValuePairs(): {} { MemberValuePair() ( "," MemberValuePair() )* } void MemberValuePair(): {} { "=" MemberValue() } void MemberValue(): {} { Annotation() | MemberValueArrayInitializer() | ConditionalExpression() } void MemberValueArrayInitializer(): {} { "{" MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] "}" } /* Annotation Types. */ void AnnotationTypeDeclaration(int modifiers): {} { "@" "interface" AnnotationTypeBody() } void AnnotationTypeBody(): {} { "{" ( AnnotationTypeMemberDeclaration() )* "}" } void AnnotationTypeMemberDeclaration(): { int modifiers; } { modifiers = Modifiers() ( LOOKAHEAD(Type() "(") Type() "(" ")" [ DefaultValue() ] ";" | ClassOrInterfaceDeclaration(modifiers, null) | EnumDeclaration(modifiers) | AnnotationTypeDeclaration(modifiers) | FieldDeclaration(modifiers) ) | ( ";" ) } void DefaultValue(): {} { "default" MemberValue() } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: ()* > | < #LETTER: [ // all chars for which Character.isIdentifierStart is true "$", "A"-"Z", "_", "a"-"z", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u064a", "\u0671"-"\u06d3", "\u06d5", "\u06e5"-"\u06e6", "\u06fa"-"\u06fc", "\u0710", "\u0712"-"\u072c", "\u0780"-"\u07a5", "\u0905"-"\u0939", "\u093d", "\u0950", "\u0958"-"\u0961", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09dc"-"\u09dd", "\u09df"-"\u09e1", "\u09f0"-"\u09f3", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a72"-"\u0a74", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abd", "\u0ad0", "\u0ae0", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3d", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c60"-"\u0c61", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cde", "\u0ce0"-"\u0ce1", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d60"-"\u0d61", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0e01"-"\u0e30", "\u0e32"-"\u0e33", "\u0e3f"-"\u0e46", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb0", "\u0eb2"-"\u0eb3", "\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0edc"-"\u0edd", "\u0f00", "\u0f40"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f88"-"\u0f8b", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u1050"-"\u1055", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17b3", "\u17db", "\u1820"-"\u1877", "\u1880"-"\u18a8", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u203f"-"\u2040", "\u207f", "\u20a0"-"\u20af", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u3029", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d", "\ufb1f"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\uff04", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6" ] > | < #PART_LETTER: [ // all chars for which Character.isIdentifierPart is true "\u0000"-"\u0008", "\u000e"-"\u001b", "$", "0"-"9", "A"-"Z", "_", "a"-"z", "\u007f"-"\u009f", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u0300"-"\u034e", "\u0360"-"\u0362", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u0483"-"\u0486", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u0591"-"\u05a1", "\u05a3"-"\u05b9", "\u05bb"-"\u05bd", "\u05bf", "\u05c1"-"\u05c2", "\u05c4", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u0655", "\u0660"-"\u0669", "\u0670"-"\u06d3", "\u06d5"-"\u06dc", "\u06df"-"\u06e8", "\u06ea"-"\u06ed", "\u06f0"-"\u06fc", "\u070f"-"\u072c", "\u0730"-"\u074a", "\u0780"-"\u07b0", "\u0901"-"\u0903", "\u0905"-"\u0939", "\u093c"-"\u094d", "\u0950"-"\u0954", "\u0958"-"\u0963", "\u0966"-"\u096f", "\u0981"-"\u0983", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09bc", "\u09be"-"\u09c4", "\u09c7"-"\u09c8", "\u09cb"-"\u09cd", "\u09d7", "\u09dc"-"\u09dd", "\u09df"-"\u09e3", "\u09e6"-"\u09f3", "\u0a02", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a3c", "\u0a3e"-"\u0a42", "\u0a47"-"\u0a48", "\u0a4b"-"\u0a4d", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a66"-"\u0a74", "\u0a81"-"\u0a83", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abc"-"\u0ac5", "\u0ac7"-"\u0ac9", "\u0acb"-"\u0acd", "\u0ad0", "\u0ae0", "\u0ae6"-"\u0aef", "\u0b01"-"\u0b03", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3c"-"\u0b43", "\u0b47"-"\u0b48", "\u0b4b"-"\u0b4d", "\u0b56"-"\u0b57", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b66"-"\u0b6f", "\u0b82"-"\u0b83", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0bbe"-"\u0bc2", "\u0bc6"-"\u0bc8", "\u0bca"-"\u0bcd", "\u0bd7", "\u0be7"-"\u0bef", "\u0c01"-"\u0c03", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c3e"-"\u0c44", "\u0c46"-"\u0c48", "\u0c4a"-"\u0c4d", "\u0c55"-"\u0c56", "\u0c60"-"\u0c61", "\u0c66"-"\u0c6f", "\u0c82"-"\u0c83", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cbe"-"\u0cc4", "\u0cc6"-"\u0cc8", "\u0cca"-"\u0ccd", "\u0cd5"-"\u0cd6", "\u0cde", "\u0ce0"-"\u0ce1", "\u0ce6"-"\u0cef", "\u0d02"-"\u0d03", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d3e"-"\u0d43", "\u0d46"-"\u0d48", "\u0d4a"-"\u0d4d", "\u0d57", "\u0d60"-"\u0d61", "\u0d66"-"\u0d6f", "\u0d82"-"\u0d83", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0dca", "\u0dcf"-"\u0dd4", "\u0dd6", "\u0dd8"-"\u0ddf", "\u0df2"-"\u0df3", "\u0e01"-"\u0e3a", "\u0e3f"-"\u0e4e", "\u0e50"-"\u0e59", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb9", "\u0ebb"-"\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0ec8"-"\u0ecd", "\u0ed0"-"\u0ed9", "\u0edc"-"\u0edd", "\u0f00", "\u0f18"-"\u0f19", "\u0f20"-"\u0f29", "\u0f35", "\u0f37", "\u0f39", "\u0f3e"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f71"-"\u0f84", "\u0f86"-"\u0f8b", "\u0f90"-"\u0f97", "\u0f99"-"\u0fbc", "\u0fc6", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u102c"-"\u1032", "\u1036"-"\u1039", "\u1040"-"\u1049", "\u1050"-"\u1059", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u1369"-"\u1371", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17d3", "\u17db", "\u17e0"-"\u17e9", "\u180b"-"\u180e", "\u1810"-"\u1819", "\u1820"-"\u1877", "\u1880"-"\u18a9", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u200c"-"\u200f", "\u202a"-"\u202e", "\u203f"-"\u2040", "\u206a"-"\u206f", "\u207f", "\u20a0"-"\u20af", "\u20d0"-"\u20dc", "\u20e1", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u302f", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u3099"-"\u309a", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe20"-"\ufe23", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\ufeff", "\uff04", "\uff10"-"\uff19", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6", "\ufff9"-"\ufffb" ] > } javacc-5.0.orig/src/org/javacc/parser/RCharacterList.java0000644000175000017500000006066111070513744022361 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; /** * Describes character lists. */ public class RCharacterList extends RegularExpression { /** * This is true if a tilde (~) appears before the character list. * Otherwise, this is false. */ public boolean negated_list = false; /** * This is the list of descriptors of the character list. Each list * entry will narrow to either SingleCharacter or to CharacterRange. */ public List descriptors = new ArrayList(); static final char[] diffLowerCaseRanges = { 65, 90, 192, 214, 216, 222, 256, 256, 258, 258, 260, 260, 262, 262, 264, 264, 266, 266, 268, 268, 270, 270, 272, 272, 274, 274, 276, 276, 278, 278, 280, 280, 282, 282, 284, 284, 286, 286, 288, 288, 290, 290, 292, 292, 294, 294, 296, 296, 298, 298, 300, 300, 302, 302, /* new for fixing 1.0.2 */ 304, 304, /* End new */ 306, 306, 308, 308, 310, 310, 313, 313, 315, 315, 317, 317, 319, 319, 321, 321, 323, 323, 325, 325, 327, 327, 330, 330, 332, 332, 334, 334, 336, 336, 338, 338, 340, 340, 342, 342, 344, 344, 346, 346, 348, 348, 350, 350, 352, 352, 354, 354, 356, 356, 358, 358, 360, 360, 362, 362, 364, 364, 366, 366, 368, 368, 370, 370, 372, 372, 374, 374, 376, 376, 377, 377, 379, 379, 381, 381, 385, 385, 386, 386, 388, 388, 390, 390, 391, 391, /* new for fixing 1.0.2 */ 393, 393, /* End new */ 394, 394, 395, 395, /*398, Sreeni fixed for 1.2*/ 399, 399, 400, 400, 401, 401, 403, 403, 404, 404, 406, 406, 407, 407, 408, 408, 412, 412, 413, 413, 416, 416, 418, 418, 420, 420, 423, 423, 425, 425, 428, 428, 430, 430, 431, 431, 433, 434, 435, 435, 437, 437, 439, 439, 440, 440, 444, 444, 452, 452, 453, 453, 455, 455, 456, 456, 458, 458, 459, 459, 461, 461, 463, 463, 465, 465, 467, 467, 469, 469, 471, 471, 473, 473, 475, 475, 478, 478, 480, 480, 482, 482, 484, 484, 486, 486, 488, 488, 490, 490, 492, 492, 494, 494, 497, 497, 498, 498, 500, 500, 506, 506, 508, 508, 510, 510, 512, 512, 514, 514, 516, 516, 518, 518, 520, 520, 522, 522, 524, 524, 526, 526, 528, 528, 530, 530, 532, 532, 534, 534, 902, 902, 904, 906, 908, 908, 910, 911, 913, 929, 931, 939, 994, 994, 996, 996, 998, 998, 1000, 1000, 1002, 1002, 1004, 1004, 1006, 1006, 1025, 1036, 1038, 1039, 1040, 1040, 1041, 1041, 1042, 1071, 1120, 1120, 1122, 1122, 1124, 1124, 1126, 1126, 1128, 1128, 1130, 1130, 1132, 1132, 1134, 1134, 1136, 1136, 1138, 1138, 1140, 1140, 1142, 1142, 1144, 1144, 1146, 1146, 1148, 1148, 1150, 1150, 1152, 1152, 1168, 1168, 1170, 1170, 1172, 1172, 1174, 1174, 1176, 1176, 1178, 1178, 1180, 1180, 1182, 1182, 1184, 1184, 1186, 1186, 1188, 1188, 1190, 1190, 1192, 1192, 1194, 1194, 1196, 1196, 1198, 1198, 1200, 1200, 1202, 1202, 1204, 1204, 1206, 1206, 1208, 1208, 1210, 1210, 1212, 1212, 1214, 1214, 1217, 1217, 1219, 1219, 1223, 1223, 1227, 1227, 1232, 1232, 1234, 1234, 1236, 1236, 1238, 1238, 1240, 1240, 1242, 1242, 1244, 1244, 1246, 1246, 1248, 1248, 1250, 1250, 1252, 1252, 1254, 1254, 1256, 1256, 1258, 1258, 1262, 1262, 1264, 1264, 1266, 1266, 1268, 1268, 1272, 1272, 1329, 1366, 4256, 4293, 7680, 7680, 7682, 7682, 7684, 7684, 7686, 7686, 7688, 7688, 7690, 7690, 7692, 7692, 7694, 7694, 7696, 7696, 7698, 7698, 7700, 7700, 7702, 7702, 7704, 7704, 7706, 7706, 7708, 7708, 7710, 7710, 7712, 7712, 7714, 7714, 7716, 7716, 7718, 7718, 7720, 7720, 7722, 7722, 7724, 7724, 7726, 7726, 7728, 7728, 7730, 7730, 7732, 7732, 7734, 7734, 7736, 7736, 7738, 7738, 7740, 7740, 7742, 7742, 7744, 7744, 7746, 7746, 7748, 7748, 7750, 7750, 7752, 7752, 7754, 7754, 7756, 7756, 7758, 7758, 7760, 7760, 7762, 7762, 7764, 7764, 7766, 7766, 7768, 7768, 7770, 7770, 7772, 7772, 7774, 7774, 7776, 7776, 7778, 7778, 7780, 7780, 7782, 7782, 7784, 7784, 7786, 7786, 7788, 7788, 7790, 7790, 7792, 7792, 7794, 7794, 7796, 7796, 7798, 7798, 7800, 7800, 7802, 7802, 7804, 7804, 7806, 7806, 7808, 7808, 7810, 7810, 7812, 7812, 7814, 7814, 7816, 7816, 7818, 7818, 7820, 7820, 7822, 7822, 7824, 7824, 7826, 7826, 7828, 7828, 7840, 7840, 7842, 7842, 7844, 7844, 7846, 7846, 7848, 7848, 7850, 7850, 7852, 7852, 7854, 7854, 7856, 7856, 7858, 7858, 7860, 7860, 7862, 7862, 7864, 7864, 7866, 7866, 7868, 7868, 7870, 7870, 7872, 7872, 7874, 7874, 7876, 7876, 7878, 7878, 7880, 7880, 7882, 7882, 7884, 7884, 7886, 7886, 7888, 7888, 7890, 7890, 7892, 7892, 7894, 7894, 7896, 7896, 7898, 7898, 7900, 7900, 7902, 7902, 7904, 7904, 7906, 7906, 7908, 7908, 7910, 7910, 7912, 7912, 7914, 7914, 7916, 7916, 7918, 7918, 7920, 7920, 7922, 7922, 7924, 7924, 7926, 7926, 7928, 7928, 7944, 7951, 7960, 7965, 7976, 7983, 7992, 7999, 8008, 8013, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8031, 8040, 8047, 8072, 8079, 8088, 8095, 8104, 8111, 8120, 8121, 8122, 8123, 8124, 8124, 8136, 8139, 8140, 8140, 8152, 8153, 8154, 8155, 8168, 8169, 8170, 8171, 8172, 8172, 8184, 8185, 8186, 8187, 8188, 8188, 8544, 8559, 9398, 9423, 65313, 65338, 65339, 0xfffe, 0xffff, 0xffff }; static final char[] diffUpperCaseRanges = { 97, 122, 224, 246, 248, 254, 255, 255, 257, 257, 259, 259, 261, 261, 263, 263, 265, 265, 267, 267, 269, 269, 271, 271, 273, 273, 275, 275, 277, 277, 279, 279, 281, 281, 283, 283, 285, 285, 287, 287, 289, 289, 291, 291, 293, 293, 295, 295, 297, 297, 299, 299, 301, 301, 303, 303, 305, 305, 307, 307, 309, 309, 311, 311, 314, 314, 316, 316, 318, 318, 320, 320, 322, 322, 324, 324, 326, 326, 328, 328, 331, 331, 333, 333, 335, 335, 337, 337, 339, 339, 341, 341, 343, 343, 345, 345, 347, 347, 349, 349, 351, 351, 353, 353, 355, 355, 357, 357, 359, 359, 361, 361, 363, 363, 365, 365, 367, 367, 369, 369, 371, 371, 373, 373, 375, 375, 378, 378, 380, 380, 382, 382, 383, 383, 387, 387, 389, 389, 392, 392, 396, 396, 402, 402, 409, 409, 417, 417, 419, 419, 421, 421, 424, 424, 429, 429, 432, 432, 436, 436, 438, 438, 441, 441, 445, 445, 453, 453, 454, 454, 456, 456, 457, 457, 459, 459, 460, 460, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 479, 479, 481, 481, 483, 483, 485, 485, 487, 487, 489, 489, 491, 491, 493, 493, 495, 495, 498, 498, 499, 499, 501, 501, 507, 507, 509, 509, 511, 511, 513, 513, 515, 515, 517, 517, 519, 519, 521, 521, 523, 523, 525, 525, 527, 527, 529, 529, 531, 531, 533, 533, 535, 535, 595, 595, 596, 596, 598, /* new for fixing 1.0.2 */ 598, 599, /* End new */ 599, /*600, Sreeni fixed for 1.2 */ 601, 601, 603, 603, 608, 608, 611, 611, 616, 616, 617, 617, 623, 623, 626, 626, 643, 643, 648, 648, 650, 651, 658, 658, 940, 940, 941, 943, 945, 961, /* new for fixing 1.0.2 */ 962, 962, /* End new */ 963, 971, 972, 972, 973, 974, 976, 976, 977, 977, 981, 981, 982, 982, 995, 995, 997, 997, 999, 999, 1001, 1001, 1003, 1003, 1005, 1005, 1007, 1007, 1008, 1008, 1009, 1009, 1072, 1103, 1105, 1116, 1118, 1119, 1121, 1121, 1123, 1123, 1125, 1125, 1127, 1127, 1129, 1129, 1131, 1131, 1133, 1133, 1135, 1135, 1137, 1137, 1139, 1139, 1141, 1141, 1143, 1143, 1145, 1145, 1147, 1147, 1149, 1149, 1151, 1151, 1153, 1153, 1169, 1169, 1171, 1171, 1173, 1173, 1175, 1175, 1177, 1177, 1179, 1179, 1181, 1181, 1183, 1183, 1185, 1185, 1187, 1187, 1189, 1189, 1191, 1191, 1193, 1193, 1195, 1195, 1197, 1197, 1199, 1199, 1201, 1201, 1203, 1203, 1205, 1205, 1207, 1207, 1209, 1209, 1211, 1211, 1213, 1213, 1215, 1215, 1218, 1218, 1220, 1220, 1224, 1224, 1228, 1228, 1233, 1233, 1235, 1235, 1237, 1237, 1239, 1239, 1241, 1241, 1243, 1243, 1245, 1245, 1247, 1247, 1249, 1249, 1251, 1251, 1253, 1253, 1255, 1255, 1257, 1257, 1259, 1259, 1263, 1263, 1265, 1265, 1267, 1267, 1269, 1269, 1273, 1273, 1377, 1414, 7681, 7681, 7683, 7683, 7685, 7685, 7687, 7687, 7689, 7689, 7691, 7691, 7693, 7693, 7695, 7695, 7697, 7697, 7699, 7699, 7701, 7701, 7703, 7703, 7705, 7705, 7707, 7707, 7709, 7709, 7711, 7711, 7713, 7713, 7715, 7715, 7717, 7717, 7719, 7719, 7721, 7721, 7723, 7723, 7725, 7725, 7727, 7727, 7729, 7729, 7731, 7731, 7733, 7733, 7735, 7735, 7737, 7737, 7739, 7739, 7741, 7741, 7743, 7743, 7745, 7745, 7747, 7747, 7749, 7749, 7751, 7751, 7753, 7753, 7755, 7755, 7757, 7757, 7759, 7759, 7761, 7761, 7763, 7763, 7765, 7765, 7767, 7767, 7769, 7769, 7771, 7771, 7773, 7773, 7775, 7775, 7777, 7777, 7779, 7779, 7781, 7781, 7783, 7783, 7785, 7785, 7787, 7787, 7789, 7789, 7791, 7791, 7793, 7793, 7795, 7795, 7797, 7797, 7799, 7799, 7801, 7801, 7803, 7803, 7805, 7805, 7807, 7807, 7809, 7809, 7811, 7811, 7813, 7813, 7815, 7815, 7817, 7817, 7819, 7819, 7821, 7821, 7823, 7823, 7825, 7825, 7827, 7827, 7829, 7829, 7841, 7841, 7843, 7843, 7845, 7845, 7847, 7847, 7849, 7849, 7851, 7851, 7853, 7853, 7855, 7855, 7857, 7857, 7859, 7859, 7861, 7861, 7863, 7863, 7865, 7865, 7867, 7867, 7869, 7869, 7871, 7871, 7873, 7873, 7875, 7875, 7877, 7877, 7879, 7879, 7881, 7881, 7883, 7883, 7885, 7885, 7887, 7887, 7889, 7889, 7891, 7891, 7893, 7893, 7895, 7895, 7897, 7897, 7899, 7899, 7901, 7901, 7903, 7903, 7905, 7905, 7907, 7907, 7909, 7909, 7911, 7911, 7913, 7913, 7915, 7915, 7917, 7917, 7919, 7919, 7921, 7921, 7923, 7923, 7925, 7925, 7927, 7927, 7929, 7929, 7936, 7943, 7952, 7957, 7968, 7975, 7984, 7991, 8000, 8005, 8017, 8017, 8019, 8019, 8021, 8021, 8023, 8023, 8032, 8039, 8048, 8049, 8050, 8053, 8054, 8055, 8056, 8057, 8058, 8059, 8060, 8061, 8064, 8071, 8080, 8087, 8096, 8103, 8112, 8113, 8115, 8115, 8131, 8131, 8144, 8145, 8160, 8161, 8165, 8165, 8179, 8179, 8560, 8575, 9424, 9449, 65345, 65370, 65371, 0xfffe, 0xffff, 0xffff }; void ToCaseNeutral() { int cnt = descriptors.size(); for (int i = 0; i < cnt; i++) { if (descriptors.get(i) instanceof SingleCharacter) { char ch = ((SingleCharacter)descriptors.get(i)).ch; if (ch != Character.toLowerCase(ch)) descriptors.add(new SingleCharacter(Character.toLowerCase(ch))); if (ch != Character.toUpperCase(ch)) descriptors.add(new SingleCharacter(Character.toUpperCase(ch))); } else { char l = ((CharacterRange)descriptors.get(i)).getLeft(); char r = ((CharacterRange)descriptors.get(i)).getRight(); int j = 0; /* Add ranges for which lower case is different. */ for (;;) { while (l > diffLowerCaseRanges[j]) j += 2; if (l < diffLowerCaseRanges[j]) { if (r < diffLowerCaseRanges[j]) break; if (r <= diffLowerCaseRanges[j + 1]) { descriptors.add(new CharacterRange(Character.toLowerCase(diffLowerCaseRanges[j]), (char)(Character.toLowerCase(diffLowerCaseRanges[j]) + r - diffLowerCaseRanges[j]))); break; } descriptors.add(new CharacterRange(Character.toLowerCase(diffLowerCaseRanges[j]), Character.toLowerCase(diffLowerCaseRanges[j + 1]))); } else { if (r <= diffLowerCaseRanges[j + 1]) { descriptors.add(new CharacterRange( (char)(Character.toLowerCase(diffLowerCaseRanges[j]) + l - diffLowerCaseRanges[j]), (char)(Character.toLowerCase(diffLowerCaseRanges[j]) + r - diffLowerCaseRanges[j]))); break; } descriptors.add(new CharacterRange( (char)(Character.toLowerCase(diffLowerCaseRanges[j]) + l - diffLowerCaseRanges[j]), Character.toLowerCase(diffLowerCaseRanges[j + 1]))); } j += 2; while (r > diffLowerCaseRanges[j]) { if (r <= diffLowerCaseRanges[j + 1]) { descriptors.add(new CharacterRange(Character.toLowerCase(diffLowerCaseRanges[j]), (char)(Character.toLowerCase(diffLowerCaseRanges[j]) + r - diffLowerCaseRanges[j]))); break; } descriptors.add(new CharacterRange(Character.toLowerCase(diffLowerCaseRanges[j]), Character.toLowerCase(diffLowerCaseRanges[j + 1]))); j += 2; } break; } /* Add ranges for which upper case is different. */ j = 0; while (l > diffUpperCaseRanges[j]) j += 2; if (l < diffUpperCaseRanges[j]) { if (r < diffUpperCaseRanges[j]) continue; if (r <= diffUpperCaseRanges[j + 1]) { descriptors.add(new CharacterRange(Character.toUpperCase(diffUpperCaseRanges[j]), (char)(Character.toUpperCase(diffUpperCaseRanges[j]) + r - diffUpperCaseRanges[j]))); continue; } descriptors.add(new CharacterRange(Character.toUpperCase(diffUpperCaseRanges[j]), Character.toUpperCase(diffUpperCaseRanges[j + 1]))); } else { if (r <= diffUpperCaseRanges[j + 1]) { descriptors.add(new CharacterRange( (char)(Character.toUpperCase(diffUpperCaseRanges[j]) + l - diffUpperCaseRanges[j]), (char)(Character.toUpperCase(diffUpperCaseRanges[j]) + r - diffUpperCaseRanges[j]))); continue; } descriptors.add(new CharacterRange( (char)(Character.toUpperCase(diffUpperCaseRanges[j]) + l - diffUpperCaseRanges[j]), Character.toUpperCase(diffUpperCaseRanges[j + 1]))); } j += 2; while (r > diffUpperCaseRanges[j]) { if (r <= diffUpperCaseRanges[j + 1]) { descriptors.add(new CharacterRange(Character.toUpperCase(diffUpperCaseRanges[j]), (char)(Character.toUpperCase(diffUpperCaseRanges[j]) + r - diffUpperCaseRanges[j]))); break; } descriptors.add(new CharacterRange(Character.toUpperCase(diffUpperCaseRanges[j]), Character.toUpperCase(diffUpperCaseRanges[j + 1]))); j += 2; } } } } boolean transformed = false; public Nfa GenerateNfa(boolean ignoreCase) { if (!transformed) { if (Options.getIgnoreCase() || ignoreCase) { /* int i; System.out.println("Before:"); for (i = 0; i < descriptors.size(); i++) { if (descriptors.get(i) instanceof SingleCharacter) { char c = ((SingleCharacter)descriptors.get(i)).ch; System.out.print((int)c + " "); } else { char l = ((CharacterRange)descriptors.get(i)).left; char r = ((CharacterRange)descriptors.get(i)).right; System.out.print((int)l + "-" + (int)r + " "); } if ((i + 1) % 6 == 0) System.out.println(""); } System.out.println(""); */ ToCaseNeutral(); SortDescriptors(); /* System.out.println("After:"); for (i = 0; i < descriptors.size(); i++) { if (descriptors.get(i) instanceof SingleCharacter) { char c = ((SingleCharacter)descriptors.get(i)).ch; System.out.print((int)c + " "); } else { char l = ((CharacterRange)descriptors.get(i)).left; char r = ((CharacterRange)descriptors.get(i)).right; System.out.print((int)l + "-" + (int)r + " "); } if ((i + 1) % 6 == 0) System.out.println(""); } System.out.println(""); */ } if (negated_list) RemoveNegation(); // This also sorts the list else SortDescriptors(); } if (descriptors.size() == 0 && !negated_list) { JavaCCErrors.semantic_error(this, "Empty character set is not allowed as it will not match any character."); return new Nfa(); } transformed = true; Nfa retVal = new Nfa(); NfaState startState = retVal.start; NfaState finalState = retVal.end; int i; for (i = 0; i < descriptors.size(); i++) { if (descriptors.get(i) instanceof SingleCharacter) startState.AddChar(((SingleCharacter)descriptors.get(i)).ch); else // if (descriptors.get(i) instanceof CharacterRange) { CharacterRange cr = (CharacterRange)descriptors.get(i); if (cr.getLeft() == cr.getRight()) startState.AddChar(cr.getLeft()); else startState.AddRange(cr.getLeft(), cr.getRight()); } } startState.next = finalState; return retVal; } static boolean Overlaps(CharacterRange r1, CharacterRange r2) { return (r1.getLeft() <= r2.getRight() && r1.getRight() > r2.getRight()); } static boolean SubRange(CharacterRange r1, CharacterRange r2) { return (r1.getLeft() >= r2.getLeft() && r1.getRight() <= r2.getRight()); } static boolean InRange(char c, CharacterRange range) { return (c >= range.getLeft() && c <= range.getRight()); } void SortDescriptors() { int j; List newDesc = new ArrayList(descriptors.size()); int cnt = 0; Outer: for (int i = 0; i < descriptors.size(); i++) { SingleCharacter s; CharacterRange range; if (descriptors.get(i) instanceof SingleCharacter) { s = (SingleCharacter)descriptors.get(i); for (j = 0; j < cnt; j++) { if (newDesc.get(j) instanceof SingleCharacter) { if (((SingleCharacter)newDesc.get(j)).ch > s.ch) break; else if (((SingleCharacter)newDesc.get(j)).ch == s.ch) continue Outer; } else { char l = ((CharacterRange)newDesc.get(j)).getLeft(); if (InRange(s.ch, (CharacterRange)newDesc.get(j))) continue Outer; else if (l > s.ch) break; } } newDesc.add(j, s); cnt++; } else { range = (CharacterRange)descriptors.get(i); for (j = 0; j < cnt; j++) { if (newDesc.get(j) instanceof SingleCharacter) { if (InRange(((SingleCharacter)newDesc.get(j)).ch, range)) { newDesc.remove(j--); cnt--; } else if (((SingleCharacter)newDesc.get(j)).ch > range.getRight()) break; } else { if (SubRange(range, (CharacterRange)newDesc.get(j))) { continue Outer; } else if (SubRange((CharacterRange)newDesc.get(j), range)) { newDesc.set(j, range); continue Outer; } else if (Overlaps(range, (CharacterRange)newDesc.get(j))) { range.setLeft((char)(((CharacterRange)newDesc.get(j)).getRight() + 1)); } else if (Overlaps((CharacterRange)newDesc.get(j), range)) { CharacterRange tmp = range; ((CharacterRange)newDesc.get(j)).setRight((char)(range.getLeft() + 1)); range = (CharacterRange)newDesc.get(j); newDesc.set(j, tmp); } else if (((CharacterRange)newDesc.get(j)).getLeft() > range.getRight()) break; } } newDesc.add(j, range); cnt++; } } descriptors = newDesc; } void RemoveNegation() { int i; SortDescriptors(); /* System.out.println("REM. NEG Before:"); for (i = 0; i < descriptors.size(); i++) { if (descriptors.get(i) instanceof SingleCharacter) { char c = ((SingleCharacter)descriptors.get(i)).ch; System.out.print((int)c + " "); } else { char l = ((CharacterRange)descriptors.get(i)).left; char r = ((CharacterRange)descriptors.get(i)).right; System.out.print((int)l + "-" + (int)r + " "); } } System.out.println(""); */ List newDescriptors = new ArrayList(); int lastRemoved = -1; // One less than the first valid character. for (i = 0; i < descriptors.size(); i++) { if (descriptors.get(i) instanceof SingleCharacter) { char c = ((SingleCharacter)descriptors.get(i)).ch; if (c >= 0 && c <= lastRemoved + 1) { lastRemoved = c; continue; } //System.out.println("lastRemoved : " + (int)lastRemoved + "; char : " + (int)c); newDescriptors.add(new CharacterRange((char)(lastRemoved + 1), (char)((lastRemoved = c) - 1))); } else { char l = ((CharacterRange)descriptors.get(i)).getLeft(); char r = ((CharacterRange)descriptors.get(i)).getRight(); if (l >= 0 && l <= lastRemoved + 1) { lastRemoved = r; continue; } //System.out.println("lastRemoved : " + (int)lastRemoved + "; left : " + l + "; right : " + (int)r); newDescriptors.add(new CharacterRange((char)(lastRemoved + 1), (char)(l - 1))); lastRemoved = r; } } //System.out.println("lastRem : " + (int)lastRemoved); if (NfaState.unicodeWarningGiven || Options.getJavaUnicodeEscape()) { if (lastRemoved < (char)0xffff) newDescriptors.add(new CharacterRange((char)(lastRemoved + 1), (char)0xffff)); } else { if (lastRemoved < (char)0xff) newDescriptors.add(new CharacterRange((char)(lastRemoved + 1), (char)0xff)); } descriptors = newDescriptors; negated_list = false; /* System.out.println("REM NEG After:"); for (i = 0; i < descriptors.size(); i++) { if (descriptors.get(i) instanceof SingleCharacter) { char c = ((SingleCharacter)descriptors.get(i)).ch; System.out.print((int)c + " "); } else { char l = ((CharacterRange)descriptors.get(i)).left; char r = ((CharacterRange)descriptors.get(i)).right; System.out.print((int)l + "-" + (int)r + " "); } } System.out.println(""); */ } RCharacterList() { } RCharacterList(char c) { descriptors = new ArrayList(); descriptors.add(new SingleCharacter(c)); negated_list = false; ordinal = Integer.MAX_VALUE; } public boolean CanMatchAnyChar() { // Return true only if it is ~[] return negated_list && (descriptors == null || descriptors.size() == 0); } } javacc-5.0.orig/src/org/javacc/parser/JavaCCErrors.java0000644000175000017500000001046411070513744021767 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Output error messages and keep track of totals. */ public final class JavaCCErrors { private static int parse_error_count = 0, semantic_error_count = 0, warning_count = 0; private JavaCCErrors() {} private static void printLocationInfo(Object node) { if (node instanceof NormalProduction) { NormalProduction n = (NormalProduction)node; System.err.print("Line " + n.getLine() + ", Column " + n.getColumn() + ": "); } else if (node instanceof TokenProduction) { TokenProduction n = (TokenProduction)node; System.err.print("Line " + n.getLine() + ", Column " + n.getColumn() + ": "); } else if (node instanceof Expansion) { Expansion n = (Expansion)node; System.err.print("Line " + n.getLine() + ", Column " + n.getColumn() + ": "); } else if (node instanceof CharacterRange) { CharacterRange n = (CharacterRange)node; System.err.print("Line " + n.getLine() + ", Column " + n.getColumn() + ": "); } else if (node instanceof SingleCharacter) { SingleCharacter n = (SingleCharacter)node; System.err.print("Line " + n.getLine() + ", Column " + n.getColumn() + ": "); } else if (node instanceof Token) { Token t = (Token)node; System.err.print("Line " + t.beginLine + ", Column " + t.beginColumn + ": "); } } public static void parse_error(Object node, String mess) { System.err.print("Error: "); printLocationInfo(node); System.err.println(mess); parse_error_count++; } public static void parse_error(String mess) { System.err.print("Error: "); System.err.println(mess); parse_error_count++; } public static int get_parse_error_count() { return parse_error_count; } public static void semantic_error(Object node, String mess) { System.err.print("Error: "); printLocationInfo(node); System.err.println(mess); semantic_error_count++; } public static void semantic_error(String mess) { System.err.print("Error: "); System.err.println(mess); semantic_error_count++; } public static int get_semantic_error_count() { return semantic_error_count; } public static void warning(Object node, String mess) { System.err.print("Warning: "); printLocationInfo(node); System.err.println(mess); warning_count++; } public static void warning(String mess) { System.err.print("Warning: "); System.err.println(mess); warning_count++; } public static int get_warning_count() { return warning_count; } public static int get_error_count() { return parse_error_count + semantic_error_count; } public static void reInit() { parse_error_count = 0; semantic_error_count = 0; warning_count = 0; } } javacc-5.0.orig/src/org/javacc/parser/RegularExpression.java0000644000175000017500000000714511070137746023172 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * Describes regular expressions. */ public abstract class RegularExpression extends Expansion { /** * The label of the regular expression (if any). If no label is * present, this is set to "". */ public String label = ""; /** * The ordinal value assigned to the regular expression. It is * used for internal processing and passing information between * the parser and the lexical analyzer. */ int ordinal; /** * The LHS to which the token value of the regular expression * is assigned. In case there is no LHS, then the list * remains empty. */ public List lhsTokens = new ArrayList(); /** * We now allow qualified access to token members. Store it here. */ public Token rhsToken; /** * This flag is set if the regular expression has a label prefixed * with the # symbol - this indicates that the purpose of the regular * expression is solely for defining other regular expressions. */ public boolean private_rexp = false; /** * If this is a top-level regular expression (nested directly * within a TokenProduction), then this field point to that * TokenProduction object. */ public TokenProduction tpContext = null; public abstract Nfa GenerateNfa(boolean ignoreCase); public boolean CanMatchAnyChar() { return false; } /** * The following variable is used to maintain state information for the * loop determination algorithm: It is initialized to 0, and * set to -1 if this node has been visited in a pre-order walk, and then * it is set to 1 if the pre-order walk of the whole graph from this * node has been traversed. i.e., -1 indicates partially processed, * and 1 indicates fully processed. */ int walkStatus = 0; public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = super.dump(indent, alreadyDumped); alreadyDumped.add(this); sb.append(' ').append(label); return sb; } } javacc-5.0.orig/src/org/javacc/parser/NormalProduction.java0000644000175000017500000001714111070513744023001 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * Describes JavaCC productions. */ public class NormalProduction { /** * The line and column number of the construct that corresponds * most closely to this node. */ private int column; private int line; /** * The NonTerminal nodes which refer to this production. */ private List parents = new ArrayList(); /** * The access modifier of this production. */ private String accessMod; /** * The name of the non-terminal of this production. */ private String lhs; /** * The tokens that make up the return type of this production. */ private List return_type_tokens = new ArrayList(); /** * The tokens that make up the parameters of this production. */ private List parameter_list_tokens = new ArrayList(); /** * Each entry in this list is a list of tokens that represents an * exception in the throws list of this production. This list does not * include ParseException which is always thrown. */ private List throws_list = new ArrayList(); /** * The RHS of this production. Not used for JavaCodeProduction. */ private Expansion expansion; /** * This boolean flag is true if this production can expand to empty. */ private boolean emptyPossible = false; /** * A list of all non-terminals that this one can expand to without * having to consume any tokens. Also an index that shows how many * pointers exist. */ private NormalProduction[] leftExpansions = new NormalProduction[10]; int leIndex = 0; /** * The following variable is used to maintain state information for the * left-recursion determination algorithm: It is initialized to 0, and * set to -1 if this node has been visited in a pre-order walk, and then * it is set to 1 if the pre-order walk of the whole graph from this * node has been traversed. i.e., -1 indicates partially processed, * and 1 indicates fully processed. */ private int walkStatus = 0; /** * The first and last tokens from the input stream that represent this * production. */ private Token lastToken; private Token firstToken; protected String eol = System.getProperty("line.separator", "\n"); protected StringBuffer dumpPrefix(int indent) { StringBuffer sb = new StringBuffer(128); for (int i = 0; i < indent; i++) sb.append(" "); return sb; } protected String getSimpleName() { String name = getClass().getName(); return name.substring(name.lastIndexOf(".")+1); // strip the package name } public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = dumpPrefix(indent).append(System.identityHashCode(this)).append(' ').append(getSimpleName()).append(' ').append(getLhs()); if (!alreadyDumped.contains(this)) { alreadyDumped.add(this); if (getExpansion() != null) { sb.append(eol).append(getExpansion().dump(indent + 1, alreadyDumped)); } } return sb; } /** * @param line the line to set */ public void setLine(int line) { this.line = line; } /** * @return the line */ public int getLine() { return line; } /** * @param column the column to set */ public void setColumn(int column) { this.column = column; } /** * @return the column */ public int getColumn() { return column; } /** * @param parents the parents to set */ void setParents(List parents) { this.parents = parents; } /** * @return the parents */ List getParents() { return parents; } /** * @param accessMod the accessMod to set */ public void setAccessMod(String accessMod) { this.accessMod = accessMod; } /** * @return the accessMod */ public String getAccessMod() { return accessMod; } /** * @param lhs the lhs to set */ public void setLhs(String lhs) { this.lhs = lhs; } /** * @return the lhs */ public String getLhs() { return lhs; } /** * @return the return_type_tokens */ public List getReturnTypeTokens() { return return_type_tokens; } /** * @return the parameter_list_tokens */ public List getParameterListTokens() { return parameter_list_tokens; } /** * @param throws_list the throws_list to set */ public void setThrowsList(List throws_list) { this.throws_list = throws_list; } /** * @return the throws_list */ public List getThrowsList() { return throws_list; } /** * @param expansion the expansion to set */ public void setExpansion(Expansion expansion) { this.expansion = expansion; } /** * @return the expansion */ public Expansion getExpansion() { return expansion; } /** * @param emptyPossible the emptyPossible to set */ boolean setEmptyPossible(boolean emptyPossible) { this.emptyPossible = emptyPossible; return emptyPossible; } /** * @return the emptyPossible */ boolean isEmptyPossible() { return emptyPossible; } /** * @param leftExpansions the leftExpansions to set */ void setLeftExpansions(NormalProduction[] leftExpansions) { this.leftExpansions = leftExpansions; } /** * @return the leftExpansions */ NormalProduction[] getLeftExpansions() { return leftExpansions; } /** * @param walkStatus the walkStatus to set */ void setWalkStatus(int walkStatus) { this.walkStatus = walkStatus; } /** * @return the walkStatus */ int getWalkStatus() { return walkStatus; } /** * @param firstToken the firstToken to set */ public Token setFirstToken(Token firstToken) { this.firstToken = firstToken; return firstToken; } /** * @return the firstToken */ public Token getFirstToken() { return firstToken; } /** * @param lastToken the lastToken to set */ public void setLastToken(Token lastToken) { this.lastToken = lastToken; } /** * @return the lastToken */ public Token getLastToken() { return lastToken; } } javacc-5.0.orig/src/org/javacc/parser/Choice.java0000644000175000017500000000560311070513743020673 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; /** * Describes expansions where one of many choices * is taken (c1|c2|...). */ public class Choice extends Expansion { /** * The list of choices of this expansion unit. Each * List component will narrow to ExpansionUnit. */ private List choices = new ArrayList(); public Choice() {} public Choice(Token token) { this.setLine(token.beginLine); this.setColumn(token.beginColumn); } public Choice(Expansion expansion) { this.setLine(expansion.getLine()); this.setColumn(expansion.getColumn()); this.getChoices().add(expansion); } /** * @param choices the choices to set */ public void setChoices(List choices) { this.choices = choices; } /** * @return the choices */ public List getChoices() { return choices; } public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = super.dump(indent, alreadyDumped); if (alreadyDumped.contains(this)) return sb; alreadyDumped.add(this); for (Iterator it = getChoices().iterator(); it.hasNext(); ) { Expansion next = (Expansion)it.next(); sb.append(eol).append(next.dump(indent + 1, alreadyDumped)); } return sb; } } javacc-5.0.orig/src/org/javacc/parser/ExpansionTreeWalker.java0000644000175000017500000001400711070513743023431 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.Iterator; /** * A set of routines that walk down the Expansion tree in * various ways. */ public final class ExpansionTreeWalker { private ExpansionTreeWalker() {} /** * Visits the nodes of the tree rooted at "node" in pre-order. * i.e., it executes opObj.action first and then visits the * children. */ static void preOrderWalk(Expansion node, TreeWalkerOp opObj) { opObj.action(node); if (opObj.goDeeper(node)) { if (node instanceof Choice) { for (Iterator it = ((Choice)node).getChoices().iterator(); it.hasNext();) { preOrderWalk((Expansion)it.next(), opObj); } } else if (node instanceof Sequence) { for (Iterator it = ((Sequence)node).units.iterator(); it.hasNext();) { preOrderWalk((Expansion)it.next(), opObj); } } else if (node instanceof OneOrMore) { preOrderWalk(((OneOrMore)node).expansion, opObj); } else if (node instanceof ZeroOrMore) { preOrderWalk(((ZeroOrMore)node).expansion, opObj); } else if (node instanceof ZeroOrOne) { preOrderWalk(((ZeroOrOne)node).expansion, opObj); } else if (node instanceof Lookahead) { Expansion nested_e = ((Lookahead)node).getLaExpansion(); if (!(nested_e instanceof Sequence && (Expansion)(((Sequence)nested_e).units.get(0)) == node)) { preOrderWalk(nested_e, opObj); } } else if (node instanceof TryBlock) { preOrderWalk(((TryBlock)node).exp, opObj); } else if (node instanceof RChoice) { for (Iterator it = ((RChoice)node).getChoices().iterator(); it.hasNext();) { preOrderWalk((Expansion)it.next(), opObj); } } else if (node instanceof RSequence) { for (Iterator it = ((RSequence)node).units.iterator(); it.hasNext();) { preOrderWalk((Expansion)it.next(), opObj); } } else if (node instanceof ROneOrMore) { preOrderWalk(((ROneOrMore)node).regexpr, opObj); } else if (node instanceof RZeroOrMore) { preOrderWalk(((RZeroOrMore)node).regexpr, opObj); } else if (node instanceof RZeroOrOne) { preOrderWalk(((RZeroOrOne)node).regexpr, opObj); } else if (node instanceof RRepetitionRange) { preOrderWalk(((RRepetitionRange)node).regexpr, opObj); } } } /** * Visits the nodes of the tree rooted at "node" in post-order. * i.e., it visits the children first and then executes * opObj.action. */ static void postOrderWalk(Expansion node, TreeWalkerOp opObj) { if (opObj.goDeeper(node)) { if (node instanceof Choice) { for (Iterator it = ((Choice)node).getChoices().iterator(); it.hasNext();) { postOrderWalk((Expansion)it.next(), opObj); } } else if (node instanceof Sequence) { for (Iterator it = ((Sequence)node).units.iterator(); it.hasNext();) { postOrderWalk((Expansion)it.next(), opObj); } } else if (node instanceof OneOrMore) { postOrderWalk(((OneOrMore)node).expansion, opObj); } else if (node instanceof ZeroOrMore) { postOrderWalk(((ZeroOrMore)node).expansion, opObj); } else if (node instanceof ZeroOrOne) { postOrderWalk(((ZeroOrOne)node).expansion, opObj); } else if (node instanceof Lookahead) { Expansion nested_e = ((Lookahead)node).getLaExpansion(); if (!(nested_e instanceof Sequence && (Expansion)(((Sequence)nested_e).units.get(0)) == node)) { postOrderWalk(nested_e, opObj); } } else if (node instanceof TryBlock) { postOrderWalk(((TryBlock)node).exp, opObj); } else if (node instanceof RChoice) { for (Iterator it = ((RChoice)node).getChoices().iterator(); it.hasNext();) { postOrderWalk((Expansion)it.next(), opObj); } } else if (node instanceof RSequence) { for (Iterator it = ((RSequence)node).units.iterator(); it.hasNext();) { postOrderWalk((Expansion)it.next(), opObj); } } else if (node instanceof ROneOrMore) { postOrderWalk(((ROneOrMore)node).regexpr, opObj); } else if (node instanceof RZeroOrMore) { postOrderWalk(((RZeroOrMore)node).regexpr, opObj); } else if (node instanceof RZeroOrOne) { postOrderWalk(((RZeroOrOne)node).regexpr, opObj); } else if (node instanceof RRepetitionRange) { postOrderWalk(((RRepetitionRange)node).regexpr, opObj); } } opObj.action(node); } } javacc-5.0.orig/src/org/javacc/parser/RChoice.java0000644000175000017500000001246711070513745021025 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; /** * Describes regular expressions which are choices from * from among included regular expressions. */ public class RChoice extends RegularExpression { /** * The list of choices of this regular expression. Each * list component will narrow to RegularExpression. */ private List choices = new ArrayList(); /** * @param choices the choices to set */ public void setChoices(List choices) { this.choices = choices; } /** * @return the choices */ public List getChoices() { return choices; } public Nfa GenerateNfa(boolean ignoreCase) { CompressCharLists(); if (getChoices().size() == 1) return ((RegularExpression)getChoices().get(0)).GenerateNfa(ignoreCase); Nfa retVal = new Nfa(); NfaState startState = retVal.start; NfaState finalState = retVal.end; for (int i = 0; i < getChoices().size(); i++) { Nfa temp; RegularExpression curRE = (RegularExpression)getChoices().get(i); temp = curRE.GenerateNfa(ignoreCase); startState.AddMove(temp.start); temp.end.AddMove(finalState); } return retVal; } void CompressCharLists() { CompressChoices(); // Unroll nested choices RegularExpression curRE; RCharacterList curCharList = null; for (int i = 0; i < getChoices().size(); i++) { curRE = (RegularExpression)getChoices().get(i); while (curRE instanceof RJustName) curRE = ((RJustName)curRE).regexpr; if (curRE instanceof RStringLiteral && ((RStringLiteral)curRE).image.length() == 1) getChoices().set(i, curRE = new RCharacterList( ((RStringLiteral)curRE).image.charAt(0))); if (curRE instanceof RCharacterList) { if (((RCharacterList)curRE).negated_list) ((RCharacterList)curRE).RemoveNegation(); List tmp = ((RCharacterList)curRE).descriptors; if (curCharList == null) getChoices().set(i, curRE = curCharList = new RCharacterList()); else getChoices().remove(i--); for (int j = tmp.size(); j-- > 0;) curCharList.descriptors.add(tmp.get(j)); } } } void CompressChoices() { RegularExpression curRE; for (int i = 0; i < getChoices().size(); i++) { curRE = (RegularExpression)getChoices().get(i); while (curRE instanceof RJustName) curRE = ((RJustName)curRE).regexpr; if (curRE instanceof RChoice) { getChoices().remove(i--); for (int j = ((RChoice)curRE).getChoices().size(); j-- > 0;) getChoices().add(((RChoice)curRE).getChoices().get(j)); } } } public void CheckUnmatchability() { RegularExpression curRE; int numStrings = 0; for (int i = 0; i < getChoices().size(); i++) { if (!(curRE = (RegularExpression)getChoices().get(i)).private_rexp && //curRE instanceof RJustName && curRE.ordinal > 0 && curRE.ordinal < ordinal && LexGen.lexStates[curRE.ordinal] == LexGen.lexStates[ordinal]) { if (label != null) JavaCCErrors.warning(this, "Regular Expression choice : " + curRE.label + " can never be matched as : " + label); else JavaCCErrors.warning(this, "Regular Expression choice : " + curRE.label + " can never be matched as token of kind : " + ordinal); } if (!curRE.private_rexp && curRE instanceof RStringLiteral) numStrings++; } } } javacc-5.0.orig/src/org/javacc/parser/OneOrMore.java0000644000175000017500000000452611070513744021352 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.Set; /** * Describes one-or-more expansions (e.g., foo+). */ public class OneOrMore extends Expansion { /** * The expansion which is repeated one or more times. */ public Expansion expansion; public OneOrMore() {} public OneOrMore(Token t, Expansion e) { this.setLine(t.beginLine); this.setColumn(t.beginColumn); this.expansion = e; expansion.parent = this; } public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = super.dump(indent, alreadyDumped); if (alreadyDumped.contains(this)) return sb; alreadyDumped.add(this); sb.append(eol).append(expansion.dump(indent + 1, alreadyDumped)); return sb; } } javacc-5.0.orig/src/org/javacc/parser/OtherFilesGen.java0000644000175000017500000001351511070137746022205 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; /** * Generates the Constants file. */ public class OtherFilesGen extends JavaCCGlobals implements JavaCCParserConstants { public static boolean keepLineCol; static public void start() throws MetaParseException { Token t = null; keepLineCol = Options.getKeepLineColumn(); if (JavaCCErrors.get_error_count() != 0) throw new MetaParseException(); JavaFiles.gen_TokenMgrError(); JavaFiles.gen_ParseException(); JavaFiles.gen_Token(); if (Options.getUserTokenManager()) { JavaFiles.gen_TokenManager(); } else if (Options.getUserCharStream()) { JavaFiles.gen_CharStream(); } else { if (Options.getJavaUnicodeEscape()) { JavaFiles.gen_JavaCharStream(); } else { JavaFiles.gen_SimpleCharStream(); } } try { ostr = new java.io.PrintWriter( new java.io.BufferedWriter( new java.io.FileWriter( new java.io.File(Options.getOutputDirectory(), cu_name + "Constants.java") ), 8192 ) ); } catch (java.io.IOException e) { JavaCCErrors.semantic_error("Could not open file " + cu_name + "Constants.java for writing."); throw new Error(); } List tn = new ArrayList(toolNames); tn.add(toolName); ostr.println("/* " + getIdString(tn, cu_name + "Constants.java") + " */"); if (cu_to_insertion_point_1.size() != 0 && ((Token)cu_to_insertion_point_1.get(0)).kind == PACKAGE ) { for (int i = 1; i < cu_to_insertion_point_1.size(); i++) { if (((Token)cu_to_insertion_point_1.get(i)).kind == SEMICOLON) { printTokenSetup((Token)(cu_to_insertion_point_1.get(0))); for (int j = 0; j <= i; j++) { t = (Token)(cu_to_insertion_point_1.get(j)); printToken(t, ostr); } printTrailingComments(t, ostr); ostr.println(""); ostr.println(""); break; } } } ostr.println(""); ostr.println("/**"); ostr.println(" * Token literal values and constants."); ostr.println(" * Generated by org.javacc.parser.OtherFilesGen#start()"); ostr.println(" */"); if(Options.getSupportClassVisibilityPublic()) { ostr.print("public "); } ostr.println("interface " + cu_name + "Constants {"); ostr.println(""); RegularExpression re; ostr.println(" /** End of File. */"); ostr.println(" int EOF = 0;"); for (java.util.Iterator it = ordered_named_tokens.iterator(); it.hasNext();) { re = (RegularExpression)it.next(); ostr.println(" /** RegularExpression Id. */"); ostr.println(" int " + re.label + " = " + re.ordinal + ";"); } ostr.println(""); if (!Options.getUserTokenManager() && Options.getBuildTokenManager()) { for (int i = 0; i < LexGen.lexStateName.length; i++) { ostr.println(" /** Lexical state. */"); ostr.println(" int " + LexGen.lexStateName[i] + " = " + i + ";"); } ostr.println(""); } ostr.println(" /** Literal token values. */"); ostr.println(" String[] tokenImage = {"); ostr.println(" \"\","); for (java.util.Iterator it = rexprlist.iterator(); it.hasNext();) { TokenProduction tp = (TokenProduction)(it.next()); List respecs = tp.respecs; for (java.util.Iterator it2 = respecs.iterator(); it2.hasNext();) { RegExprSpec res = (RegExprSpec)(it2.next()); re = res.rexp; if (re instanceof RStringLiteral) { ostr.println(" \"\\\"" + add_escapes(add_escapes(((RStringLiteral)re).image)) + "\\\"\","); } else if (!re.label.equals("")) { ostr.println(" \"<" + re.label + ">\","); } else { if (re.tpContext.kind == TokenProduction.TOKEN) { JavaCCErrors.warning(re, "Consider giving this non-string token a label for better error reporting."); } ostr.println(" \"\","); } } } ostr.println(" };"); ostr.println(""); ostr.println("}"); ostr.close(); } static private java.io.PrintWriter ostr; public static void reInit() { ostr = null; } } javacc-5.0.orig/src/org/javacc/parser/RJustName.java0000644000175000017500000000434611070513745021356 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Describes regular expressions which are referred to just by * their name. This means that a regular expression with this * name has been declared earlier. */ public class RJustName extends RegularExpression { /** * "regexpr" points to the regular expression denoted by the name. */ public RegularExpression regexpr; public Nfa GenerateNfa(boolean ignoreCase) { return regexpr.GenerateNfa(ignoreCase); } public RJustName() {} public RJustName(Token token, String image) { this.setLine(token.beginLine); this.setColumn(token.beginColumn); this.label = image; } } javacc-5.0.orig/src/org/javacc/parser/MatchInfo.java0000644000175000017500000000350710576210056021353 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Describes a match, within a given lookahead. */ public class MatchInfo { public static int laLimit; int[] match = new int[laLimit]; int firstFreeLoc; public static void reInit() { laLimit = 0; } } javacc-5.0.orig/src/org/javacc/parser/OutputFile.java0000644000175000017500000002502211226741736021606 0ustar mkochmkoch/* Copyright (c) 2007, Paul Cager. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.security.DigestOutputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import org.javacc.Version; /** * This class handles the creation and maintenance of the boiler-plate classes, * such as Token.java, JavaCharStream.java etc. * * It is responsible for: * *
    *
  • Writing the JavaCC header lines to the file.
  • *
  • Writing the checksum line.
  • *
  • Using the checksum to determine if an existing file has been changed by * the user (and so should be left alone).
  • *
  • Checking any existing file's version (if the file can not be * overwritten).
  • *
  • Checking any existing file's creation options (if the file can not be * overwritten).
  • *
  • *
* * @author Paul Cager * */ public class OutputFile { private static final String MD5_LINE_PART_1 = "/* JavaCC - OriginalChecksum="; private static final String MD5_LINE_PART_1q = "/\\* JavaCC - OriginalChecksum="; private static final String MD5_LINE_PART_2 = " (do not edit this line) */"; private static final String MD5_LINE_PART_2q = " \\(do not edit this line\\) \\*/"; TrapClosePrintWriter pw; DigestOutputStream dos; String toolName = JavaCCGlobals.toolName; final File file; final String compatibleVersion; final String[] options; /** * Create a new OutputFile. * * @param file * the file to write to. * @param compatibleVersion * the minimum compatible JavaCC version. * @param options * if the file already exists, and cannot be overwritten, this is * a list of options (such s STATIC=false) to check for changes. * @throws IOException */ public OutputFile(File file, String compatibleVersion, String[] options) throws IOException { this.file = file; this.compatibleVersion = compatibleVersion; this.options = options; if (file.exists()) { // Generate the checksum of the file, and compare with any value // stored // in the file. BufferedReader br = new BufferedReader(new FileReader(file)); MessageDigest digest; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw (IOException) (new IOException("No MD5 implementation") .initCause(e)); } DigestOutputStream digestStream = new DigestOutputStream( new NullOutputStream(), digest); PrintWriter pw = new PrintWriter(digestStream); String line; String existingMD5 = null; while ((line = br.readLine()) != null) { if (line.startsWith(MD5_LINE_PART_1)) { existingMD5 = line.replaceAll(MD5_LINE_PART_1q, "").replaceAll( MD5_LINE_PART_2q, ""); } else { pw.println(line); } } pw.close(); String calculatedDigest = toHexString(digestStream .getMessageDigest().digest()); if (existingMD5 == null || !existingMD5.equals(calculatedDigest)) { // No checksum in file, or checksum differs. needToWrite = false; if (compatibleVersion != null) { checkVersion(file, compatibleVersion); } if (options != null) { checkOptions(file, options); } } else { // The file has not been altered since JavaCC created it. // Rebuild it. System.out.println("File \"" + file.getName() + "\" is being rebuilt."); needToWrite = true; } } else { // File does not exist System.out.println("File \"" + file.getName() + "\" does not exist. Will create one."); needToWrite = true; } } public OutputFile(File file) throws IOException { this(file, null, null); } public boolean needToWrite = true; /** * Output a warning if the file was created with an incompatible version * of JavaCC. * @param fileName * @param versionId */ private void checkVersion(File file, String versionId) { String firstLine = "/* " + JavaCCGlobals.getIdString(toolName, file.getName()) + " Version "; try { BufferedReader reader = new BufferedReader(new FileReader(file)); String line; while ((line = reader.readLine()) != null) { if (line.startsWith(firstLine)) { String version = firstLine.replaceFirst(".* Version ", "").replaceAll(" \\*/", ""); if (version != versionId) { JavaCCErrors.warning(file.getName() + ": File is obsolete. Please rename or delete this file so" + " that a new one can be generated for you."); } return; } } // If no version line is found, do not output the warning. } catch (FileNotFoundException e1) { // This should never happen JavaCCErrors.semantic_error("Could not open file " + file.getName() + " for writing."); throw new Error(); } catch (IOException e2) { } } /** * Read the options line from the file and compare to the options currently in * use. Output a warning if they are different. * * @param fileName * @param options */ private void checkOptions(File file, String[] options) { try { BufferedReader reader = new BufferedReader(new FileReader(file)); String line; while ((line = reader.readLine()) != null) { if (line.startsWith("/* JavaCCOptions:")) { String currentOptions = Options.getOptionsString(options); if (line.indexOf(currentOptions) == -1) { JavaCCErrors .warning(file.getName() + ": Generated using incompatible options. Please rename or delete this file so" + " that a new one can be generated for you."); } return; } } } catch (FileNotFoundException e1) { // This should never happen JavaCCErrors.semantic_error("Could not open file " + file.getName() + " for writing."); throw new Error(); } catch (IOException e2) { } // Not found so cannot check } /** * Return a PrintWriter object that may be used to write to this file. Any * necessary header information is written by this method. * * @return * @throws IOException */ public PrintWriter getPrintWriter() throws IOException { if (pw == null) { MessageDigest digest; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw (IOException) (new IOException("No MD5 implementation") .initCause(e)); } dos = new DigestOutputStream(new BufferedOutputStream( new FileOutputStream(file)), digest); pw = new TrapClosePrintWriter(dos); // Write the headers.... String version = compatibleVersion == null ? Version.versionNumber : compatibleVersion; pw.println("/* " + JavaCCGlobals.getIdString(toolName, file.getName()) + " Version " + version + " */"); if (options != null) { pw.println("/* JavaCCOptions:" + Options.getOptionsString(options) + " */"); } } return pw; } /** * Close the OutputFile, writing any necessary trailer information * (such as a checksum). * @throws IOException */ public void close() throws IOException { // Write the trailer (checksum). // Possibly rename the .java.tmp to .java?? if (pw != null) { pw.println(MD5_LINE_PART_1 + getMD5sum() + MD5_LINE_PART_2); pw.closePrintWriter(); // file.renameTo(dest) } } private String getMD5sum() { pw.flush(); byte[] digest = dos.getMessageDigest().digest(); return toHexString(digest); } private final static char[] HEX_DIGITS = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; private static final String toHexString(byte[] bytes) { StringBuffer sb = new StringBuffer(32); for (int i = 0; i < bytes.length; i++) { byte b = bytes[i]; sb.append(HEX_DIGITS[(b & 0xF0) >> 4]).append(HEX_DIGITS[b & 0x0F]); } return sb.toString(); } private static class NullOutputStream extends OutputStream { public void write(byte[] arg0, int arg1, int arg2) throws IOException { } public void write(byte[] arg0) throws IOException { } public void write(int arg0) throws IOException { } } private class TrapClosePrintWriter extends PrintWriter { public TrapClosePrintWriter(OutputStream os) { super(os); } public void closePrintWriter() { super.close(); } public void close() { try { OutputFile.this.close(); } catch (IOException e) { System.err.println("Could not close " + file.getAbsolutePath()); } } } /** * @return the toolName */ public String getToolName() { return toolName; } /** * @param toolName * the toolName to set */ public void setToolName(String toolName) { this.toolName = toolName; } } javacc-5.0.orig/src/org/javacc/parser/ROneOrMore.java0000644000175000017500000000455011070513745021472 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Describes one-or-more regular expressions (). */ public class ROneOrMore extends RegularExpression { /** * The regular expression which is repeated one or more times. */ public RegularExpression regexpr; public Nfa GenerateNfa(boolean ignoreCase) { Nfa retVal = new Nfa(); NfaState startState = retVal.start; NfaState finalState = retVal.end; Nfa temp = regexpr.GenerateNfa(ignoreCase); startState.AddMove(temp.start); temp.end.AddMove(temp.start); temp.end.AddMove(finalState); return retVal; } public ROneOrMore() {} public ROneOrMore(Token t, RegularExpression re) { this.setLine(t.beginLine); this.setColumn(t.beginColumn); this.regexpr = re; } } javacc-5.0.orig/src/org/javacc/parser/LookaheadWalk.java0000644000175000017500000001741511070513744022214 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; public final class LookaheadWalk { public static boolean considerSemanticLA; public static ArrayList sizeLimitedMatches; private LookaheadWalk() {} private static void listAppend(List vToAppendTo, List vToAppend) { for (int i = 0; i < vToAppend.size(); i++) { vToAppendTo.add(vToAppend.get(i)); } } public static List genFirstSet(List partialMatches, Expansion exp) { if (exp instanceof RegularExpression) { List retval = new ArrayList(); for (int i = 0; i < partialMatches.size(); i++) { MatchInfo m = (MatchInfo)partialMatches.get(i); MatchInfo mnew = new MatchInfo(); for (int j = 0; j < m.firstFreeLoc; j++) { mnew.match[j] = m.match[j]; } mnew.firstFreeLoc = m.firstFreeLoc; mnew.match[mnew.firstFreeLoc++] = ((RegularExpression)exp).ordinal; if (mnew.firstFreeLoc == MatchInfo.laLimit) { sizeLimitedMatches.add(mnew); } else { retval.add(mnew); } } return retval; } else if (exp instanceof NonTerminal) { NormalProduction prod = ((NonTerminal)exp).getProd(); if (prod instanceof JavaCodeProduction) { return new ArrayList(); } else { return genFirstSet(partialMatches, prod.getExpansion()); } } else if (exp instanceof Choice) { List retval = new ArrayList(); Choice ch = (Choice)exp; for (int i = 0; i < ch.getChoices().size(); i++) { List v = genFirstSet(partialMatches, (Expansion)ch.getChoices().get(i)); listAppend(retval, v); } return retval; } else if (exp instanceof Sequence) { List v = partialMatches; Sequence seq = (Sequence)exp; for (int i = 0; i < seq.units.size(); i++) { v = genFirstSet(v, (Expansion)seq.units.get(i)); if (v.size() == 0) break; } return v; } else if (exp instanceof OneOrMore) { List retval = new ArrayList(); List v = partialMatches; OneOrMore om = (OneOrMore)exp; while (true) { v = genFirstSet(v, om.expansion); if (v.size() == 0) break; listAppend(retval, v); } return retval; } else if (exp instanceof ZeroOrMore) { List retval = new ArrayList(); listAppend(retval, partialMatches); List v = partialMatches; ZeroOrMore zm = (ZeroOrMore)exp; while (true) { v = genFirstSet(v, zm.expansion); if (v.size() == 0) break; listAppend(retval, v); } return retval; } else if (exp instanceof ZeroOrOne) { List retval = new ArrayList(); listAppend(retval, partialMatches); listAppend(retval, genFirstSet(partialMatches, ((ZeroOrOne)exp).expansion)); return retval; } else if (exp instanceof TryBlock) { return genFirstSet(partialMatches, ((TryBlock)exp).exp); } else if (considerSemanticLA && exp instanceof Lookahead && ((Lookahead)exp).getActionTokens().size() != 0 ) { return new ArrayList(); } else { List retval = new ArrayList(); listAppend(retval, partialMatches); return retval; } } private static void listSplit(List toSplit, List mask, List partInMask, List rest) { OuterLoop: for (int i = 0; i < toSplit.size(); i++) { for (int j = 0; j < mask.size(); j++) { if (toSplit.get(i) == mask.get(j)) { partInMask.add(toSplit.get(i)); continue OuterLoop; } } rest.add(toSplit.get(i)); } } public static List genFollowSet(List partialMatches, Expansion exp, long generation) { if (exp.myGeneration == generation) { return new ArrayList(); } //System.out.println("*** Parent: " + exp.parent); exp.myGeneration = generation; if (exp.parent == null) { List retval = new ArrayList(); listAppend(retval, partialMatches); return retval; } else if (exp.parent instanceof NormalProduction) { List parents = ((NormalProduction)exp.parent).getParents(); List retval = new ArrayList(); //System.out.println("1; gen: " + generation + "; exp: " + exp); for (int i = 0; i < parents.size(); i++) { List v = genFollowSet(partialMatches, (Expansion)parents.get(i), generation); listAppend(retval, v); } return retval; } else if (exp.parent instanceof Sequence) { Sequence seq = (Sequence)exp.parent; List v = partialMatches; for (int i = exp.ordinal+1; i < seq.units.size(); i++) { v = genFirstSet(v, (Expansion)seq.units.get(i)); if (v.size() == 0) return v; } List v1 = new ArrayList(); List v2 = new ArrayList(); listSplit(v, partialMatches, v1, v2); if (v1.size() != 0) { //System.out.println("2; gen: " + generation + "; exp: " + exp); v1 = genFollowSet(v1, seq, generation); } if (v2.size() != 0) { //System.out.println("3; gen: " + generation + "; exp: " + exp); v2 = genFollowSet(v2, seq, Expansion.nextGenerationIndex++); } listAppend(v2, v1); return v2; } else if (exp.parent instanceof OneOrMore || exp.parent instanceof ZeroOrMore) { List moreMatches = new ArrayList(); listAppend(moreMatches, partialMatches); List v = partialMatches; while (true) { v = genFirstSet(v, exp); if (v.size() == 0) break; listAppend(moreMatches, v); } List v1 = new ArrayList(); List v2 = new ArrayList(); listSplit(moreMatches, partialMatches, v1, v2); if (v1.size() != 0) { //System.out.println("4; gen: " + generation + "; exp: " + exp); v1 = genFollowSet(v1, (Expansion)exp.parent, generation); } if (v2.size() != 0) { //System.out.println("5; gen: " + generation + "; exp: " + exp); v2 = genFollowSet(v2, (Expansion)exp.parent, Expansion.nextGenerationIndex++); } listAppend(v2, v1); return v2; } else { //System.out.println("6; gen: " + generation + "; exp: " + exp); return genFollowSet(partialMatches, (Expansion)exp.parent, generation); } } public static void reInit() { considerSemanticLA = false; sizeLimitedMatches = null; } } javacc-5.0.orig/src/org/javacc/parser/Container.java0000644000175000017500000000336210574036600021423 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * An object container. Used to pass references to objects as parameter. */ public class Container { public Object member; } javacc-5.0.orig/src/org/javacc/parser/ParseGen.java0000644000175000017500000011144611134735202021205 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * Generate the parser. */ public class ParseGen extends JavaCCGlobals implements JavaCCParserConstants { static public void start() throws MetaParseException { Token t = null; if (JavaCCErrors.get_error_count() != 0) throw new MetaParseException(); if (Options.getBuildParser()) { try { ostr = new PrintWriter( new BufferedWriter( new FileWriter( new File(Options.getOutputDirectory(), cu_name + ".java") ), 8192 ) ); } catch (IOException e) { JavaCCErrors.semantic_error("Could not open file " + cu_name + ".java for writing."); throw new Error(); } List tn = new ArrayList(toolNames); tn.add(toolName); ostr.println("/* " + getIdString(tn, cu_name + ".java") + " */"); boolean implementsExists = false; if (cu_to_insertion_point_1.size() != 0) { printTokenSetup((Token)(cu_to_insertion_point_1.get(0))); ccol = 1; for (Iterator it = cu_to_insertion_point_1.iterator(); it.hasNext();) { t = (Token)it.next(); if (t.kind == IMPLEMENTS) { implementsExists = true; } else if (t.kind == CLASS) { implementsExists = false; } printToken(t, ostr); } } if (implementsExists) { ostr.print(", "); } else { ostr.print(" implements "); } ostr.print(cu_name + "Constants "); if (cu_to_insertion_point_2.size() != 0) { printTokenSetup((Token)(cu_to_insertion_point_2.get(0))); for (Iterator it = cu_to_insertion_point_2.iterator(); it.hasNext();) { t = (Token)it.next(); printToken(t, ostr); } } ostr.println(""); ostr.println(""); ParseEngine.build(ostr); if (Options.getStatic()) { ostr.println(" static private boolean jj_initialized_once = false;"); } if (Options.getUserTokenManager()) { ostr.println(" /** User defined Token Manager. */"); ostr.println(" " + staticOpt() + "public TokenManager token_source;"); } else { ostr.println(" /** Generated Token Manager. */"); ostr.println(" " + staticOpt() + "public " + cu_name + "TokenManager token_source;"); if (!Options.getUserCharStream()) { if (Options.getJavaUnicodeEscape()) { ostr.println(" " + staticOpt() + "JavaCharStream jj_input_stream;"); } else { ostr.println(" " + staticOpt() + "SimpleCharStream jj_input_stream;"); } } } ostr.println(" /** Current token. */"); ostr.println(" " + staticOpt() + "public Token token;"); ostr.println(" /** Next token. */"); ostr.println(" " + staticOpt() + "public Token jj_nt;"); if (!Options.getCacheTokens()) { ostr.println(" " + staticOpt() + "private int jj_ntk;"); } if (jj2index != 0) { ostr.println(" " + staticOpt() + "private Token jj_scanpos, jj_lastpos;"); ostr.println(" " + staticOpt() + "private int jj_la;"); if (lookaheadNeeded) { ostr.println(" /** Whether we are looking ahead. */"); ostr.println(" " + staticOpt() + "private boolean jj_lookingAhead = false;"); ostr.println(" " + staticOpt() + "private boolean jj_semLA;"); } } if (Options.getErrorReporting()) { ostr.println(" " + staticOpt() + "private int jj_gen;"); ostr.println(" " + staticOpt() + "final private int[] jj_la1 = new int[" + maskindex + "];"); int tokenMaskSize = (tokenCount-1)/32 + 1; for (int i = 0; i < tokenMaskSize; i++) ostr.println(" static private int[] jj_la1_" + i + ";"); ostr.println(" static {"); for (int i = 0; i < tokenMaskSize; i++) ostr.println(" jj_la1_init_" + i + "();"); ostr.println(" }"); for (int i = 0; i < tokenMaskSize; i++) { ostr.println(" private static void jj_la1_init_" + i + "() {"); ostr.print(" jj_la1_" + i + " = new int[] {"); for (Iterator it = maskVals.iterator(); it.hasNext();) { int[] tokenMask = (int[])(it.next()); ostr.print("0x" + Integer.toHexString(tokenMask[i]) + ","); } ostr.println("};"); ostr.println(" }"); } } if (jj2index != 0 && Options.getErrorReporting()) { ostr.println(" " + staticOpt() + "final private JJCalls[] jj_2_rtns = new JJCalls[" + jj2index + "];"); ostr.println(" " + staticOpt() + "private boolean jj_rescan = false;"); ostr.println(" " + staticOpt() + "private int jj_gc = 0;"); } ostr.println(""); if (!Options.getUserTokenManager()) { if (Options.getUserCharStream()) { ostr.println(" /** Constructor with user supplied CharStream. */"); ostr.println(" public " + cu_name + "(CharStream stream) {"); if (Options.getStatic()) { ostr.println(" if (jj_initialized_once) {"); ostr.println(" System.out.println(\"ERROR: Second call to constructor of static parser. \");"); ostr.println(" System.out.println(\" You must either use ReInit() " + "or set the JavaCC option STATIC to false\");"); ostr.println(" System.out.println(\" during parser generation.\");"); ostr.println(" throw new Error();"); ostr.println(" }"); ostr.println(" jj_initialized_once = true;"); } if(Options.getTokenManagerUsesParser() && !Options.getStatic()){ ostr.println(" token_source = new " + cu_name + "TokenManager(this, stream);"); } else { ostr.println(" token_source = new " + cu_name + "TokenManager(stream);"); } ostr.println(" token = new Token();"); if (Options.getCacheTokens()) { ostr.println(" token.next = jj_nt = token_source.getNextToken();"); } else { ostr.println(" jj_ntk = -1;"); } if (Options.getErrorReporting()) { ostr.println(" jj_gen = 0;"); ostr.println(" for (int i = 0; i < " + maskindex + "; i++) jj_la1[i] = -1;"); if (jj2index != 0) { ostr.println(" for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();"); } } ostr.println(" }"); ostr.println(""); ostr.println(" /** Reinitialise. */"); ostr.println(" " + staticOpt() + "public void ReInit(CharStream stream) {"); ostr.println(" token_source.ReInit(stream);"); ostr.println(" token = new Token();"); if (Options.getCacheTokens()) { ostr.println(" token.next = jj_nt = token_source.getNextToken();"); } else { ostr.println(" jj_ntk = -1;"); } if (lookaheadNeeded) { ostr.println(" jj_lookingAhead = false;"); } if (jjtreeGenerated) { ostr.println(" jjtree.reset();"); } if (Options.getErrorReporting()) { ostr.println(" jj_gen = 0;"); ostr.println(" for (int i = 0; i < " + maskindex + "; i++) jj_la1[i] = -1;"); if (jj2index != 0) { ostr.println(" for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();"); } } ostr.println(" }"); } else { ostr.println(" /** Constructor with InputStream. */"); ostr.println(" public " + cu_name + "(java.io.InputStream stream) {"); ostr.println(" this(stream, null);"); ostr.println(" }"); ostr.println(" /** Constructor with InputStream and supplied encoding */"); ostr.println(" public " + cu_name + "(java.io.InputStream stream, String encoding) {"); if (Options.getStatic()) { ostr.println(" if (jj_initialized_once) {"); ostr.println(" System.out.println(\"ERROR: Second call to constructor of static parser. \");"); ostr.println(" System.out.println(\" You must either use ReInit() or " + "set the JavaCC option STATIC to false\");"); ostr.println(" System.out.println(\" during parser generation.\");"); ostr.println(" throw new Error();"); ostr.println(" }"); ostr.println(" jj_initialized_once = true;"); } if (Options.getJavaUnicodeEscape()) { if (!Options.getGenerateChainedException()) { ostr.println(" try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } " + "catch(java.io.UnsupportedEncodingException e) {" + " throw new RuntimeException(e.getMessage()); }"); } else { ostr.println(" try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } " + "catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }"); } } else { if (!Options.getGenerateChainedException()) { ostr.println(" try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } " + "catch(java.io.UnsupportedEncodingException e) { " + "throw new RuntimeException(e.getMessage()); }"); } else { ostr.println(" try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } " + "catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }"); } } if(Options.getTokenManagerUsesParser() && !Options.getStatic()){ ostr.println(" token_source = new " + cu_name + "TokenManager(this, jj_input_stream);"); } else { ostr.println(" token_source = new " + cu_name + "TokenManager(jj_input_stream);"); } ostr.println(" token = new Token();"); if (Options.getCacheTokens()) { ostr.println(" token.next = jj_nt = token_source.getNextToken();"); } else { ostr.println(" jj_ntk = -1;"); } if (Options.getErrorReporting()) { ostr.println(" jj_gen = 0;"); ostr.println(" for (int i = 0; i < " + maskindex + "; i++) jj_la1[i] = -1;"); if (jj2index != 0) { ostr.println(" for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();"); } } ostr.println(" }"); ostr.println(""); ostr.println(" /** Reinitialise. */"); ostr.println(" " + staticOpt() + "public void ReInit(java.io.InputStream stream) {"); ostr.println(" ReInit(stream, null);"); ostr.println(" }"); ostr.println(" /** Reinitialise. */"); ostr.println(" " + staticOpt() + "public void ReInit(java.io.InputStream stream, String encoding) {"); if (!Options.getGenerateChainedException()) { ostr.println(" try { jj_input_stream.ReInit(stream, encoding, 1, 1); } " + "catch(java.io.UnsupportedEncodingException e) { " + "throw new RuntimeException(e.getMessage()); }"); } else { ostr.println(" try { jj_input_stream.ReInit(stream, encoding, 1, 1); } " + "catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }"); } ostr.println(" token_source.ReInit(jj_input_stream);"); ostr.println(" token = new Token();"); if (Options.getCacheTokens()) { ostr.println(" token.next = jj_nt = token_source.getNextToken();"); } else { ostr.println(" jj_ntk = -1;"); } if (jjtreeGenerated) { ostr.println(" jjtree.reset();"); } if (Options.getErrorReporting()) { ostr.println(" jj_gen = 0;"); ostr.println(" for (int i = 0; i < " + maskindex + "; i++) jj_la1[i] = -1;"); if (jj2index != 0) { ostr.println(" for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();"); } } ostr.println(" }"); ostr.println(""); ostr.println(" /** Constructor. */"); ostr.println(" public " + cu_name + "(java.io.Reader stream) {"); if (Options.getStatic()) { ostr.println(" if (jj_initialized_once) {"); ostr.println(" System.out.println(\"ERROR: Second call to constructor of static parser. \");"); ostr.println(" System.out.println(\" You must either use ReInit() or " + "set the JavaCC option STATIC to false\");"); ostr.println(" System.out.println(\" during parser generation.\");"); ostr.println(" throw new Error();"); ostr.println(" }"); ostr.println(" jj_initialized_once = true;"); } if (Options.getJavaUnicodeEscape()) { ostr.println(" jj_input_stream = new JavaCharStream(stream, 1, 1);"); } else { ostr.println(" jj_input_stream = new SimpleCharStream(stream, 1, 1);"); } if(Options.getTokenManagerUsesParser() && !Options.getStatic()){ ostr.println(" token_source = new " + cu_name + "TokenManager(this, jj_input_stream);"); } else { ostr.println(" token_source = new " + cu_name + "TokenManager(jj_input_stream);"); } ostr.println(" token = new Token();"); if (Options.getCacheTokens()) { ostr.println(" token.next = jj_nt = token_source.getNextToken();"); } else { ostr.println(" jj_ntk = -1;"); } if (Options.getErrorReporting()) { ostr.println(" jj_gen = 0;"); ostr.println(" for (int i = 0; i < " + maskindex + "; i++) jj_la1[i] = -1;"); if (jj2index != 0) { ostr.println(" for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();"); } } ostr.println(" }"); ostr.println(""); ostr.println(" /** Reinitialise. */"); ostr.println(" " + staticOpt() + "public void ReInit(java.io.Reader stream) {"); if (Options.getJavaUnicodeEscape()) { ostr.println(" jj_input_stream.ReInit(stream, 1, 1);"); } else { ostr.println(" jj_input_stream.ReInit(stream, 1, 1);"); } ostr.println(" token_source.ReInit(jj_input_stream);"); ostr.println(" token = new Token();"); if (Options.getCacheTokens()) { ostr.println(" token.next = jj_nt = token_source.getNextToken();"); } else { ostr.println(" jj_ntk = -1;"); } if (jjtreeGenerated) { ostr.println(" jjtree.reset();"); } if (Options.getErrorReporting()) { ostr.println(" jj_gen = 0;"); ostr.println(" for (int i = 0; i < " + maskindex + "; i++) jj_la1[i] = -1;"); if (jj2index != 0) { ostr.println(" for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();"); } } ostr.println(" }"); } } ostr.println(""); if (Options.getUserTokenManager()) { ostr.println(" /** Constructor with user supplied Token Manager. */"); ostr.println(" public " + cu_name + "(TokenManager tm) {"); } else { ostr.println(" /** Constructor with generated Token Manager. */"); ostr.println(" public " + cu_name + "(" + cu_name + "TokenManager tm) {"); } if (Options.getStatic()) { ostr.println(" if (jj_initialized_once) {"); ostr.println(" System.out.println(\"ERROR: Second call to constructor of static parser. \");"); ostr.println(" System.out.println(\" You must either use ReInit() or " + "set the JavaCC option STATIC to false\");"); ostr.println(" System.out.println(\" during parser generation.\");"); ostr.println(" throw new Error();"); ostr.println(" }"); ostr.println(" jj_initialized_once = true;"); } ostr.println(" token_source = tm;"); ostr.println(" token = new Token();"); if (Options.getCacheTokens()) { ostr.println(" token.next = jj_nt = token_source.getNextToken();"); } else { ostr.println(" jj_ntk = -1;"); } if (Options.getErrorReporting()) { ostr.println(" jj_gen = 0;"); ostr.println(" for (int i = 0; i < " + maskindex + "; i++) jj_la1[i] = -1;"); if (jj2index != 0) { ostr.println(" for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();"); } } ostr.println(" }"); ostr.println(""); if (Options.getUserTokenManager()) { ostr.println(" /** Reinitialise. */"); ostr.println(" public void ReInit(TokenManager tm) {"); } else { ostr.println(" /** Reinitialise. */"); ostr.println(" public void ReInit(" + cu_name + "TokenManager tm) {"); } ostr.println(" token_source = tm;"); ostr.println(" token = new Token();"); if (Options.getCacheTokens()) { ostr.println(" token.next = jj_nt = token_source.getNextToken();"); } else { ostr.println(" jj_ntk = -1;"); } if (jjtreeGenerated) { ostr.println(" jjtree.reset();"); } if (Options.getErrorReporting()) { ostr.println(" jj_gen = 0;"); ostr.println(" for (int i = 0; i < " + maskindex + "; i++) jj_la1[i] = -1;"); if (jj2index != 0) { ostr.println(" for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();"); } } ostr.println(" }"); ostr.println(""); ostr.println(" " + staticOpt() + "private Token jj_consume_token(int kind) throws ParseException {"); if (Options.getCacheTokens()) { ostr.println(" Token oldToken = token;"); ostr.println(" if ((token = jj_nt).next != null) jj_nt = jj_nt.next;"); ostr.println(" else jj_nt = jj_nt.next = token_source.getNextToken();"); } else { ostr.println(" Token oldToken;"); ostr.println(" if ((oldToken = token).next != null) token = token.next;"); ostr.println(" else token = token.next = token_source.getNextToken();"); ostr.println(" jj_ntk = -1;"); } ostr.println(" if (token.kind == kind) {"); if (Options.getErrorReporting()) { ostr.println(" jj_gen++;"); if (jj2index != 0) { ostr.println(" if (++jj_gc > 100) {"); ostr.println(" jj_gc = 0;"); ostr.println(" for (int i = 0; i < jj_2_rtns.length; i++) {"); ostr.println(" JJCalls c = jj_2_rtns[i];"); ostr.println(" while (c != null) {"); ostr.println(" if (c.gen < jj_gen) c.first = null;"); ostr.println(" c = c.next;"); ostr.println(" }"); ostr.println(" }"); ostr.println(" }"); } } if (Options.getDebugParser()) { ostr.println(" trace_token(token, \"\");"); } ostr.println(" return token;"); ostr.println(" }"); if (Options.getCacheTokens()) { ostr.println(" jj_nt = token;"); } ostr.println(" token = oldToken;"); if (Options.getErrorReporting()) { ostr.println(" jj_kind = kind;"); } ostr.println(" throw generateParseException();"); ostr.println(" }"); ostr.println(""); if (jj2index != 0) { ostr.println(" static private final class LookaheadSuccess extends java.lang.Error { }"); ostr.println(" " + staticOpt() + "final private LookaheadSuccess jj_ls = new LookaheadSuccess();"); ostr.println(" " + staticOpt() + "private boolean jj_scan_token(int kind) {"); ostr.println(" if (jj_scanpos == jj_lastpos) {"); ostr.println(" jj_la--;"); ostr.println(" if (jj_scanpos.next == null) {"); ostr.println(" jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();"); ostr.println(" } else {"); ostr.println(" jj_lastpos = jj_scanpos = jj_scanpos.next;"); ostr.println(" }"); ostr.println(" } else {"); ostr.println(" jj_scanpos = jj_scanpos.next;"); ostr.println(" }"); if (Options.getErrorReporting()) { ostr.println(" if (jj_rescan) {"); ostr.println(" int i = 0; Token tok = token;"); ostr.println(" while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }"); ostr.println(" if (tok != null) jj_add_error_token(kind, i);"); if (Options.getDebugLookahead()) { ostr.println(" } else {"); ostr.println(" trace_scan(jj_scanpos, kind);"); } ostr.println(" }"); } else if (Options.getDebugLookahead()) { ostr.println(" trace_scan(jj_scanpos, kind);"); } ostr.println(" if (jj_scanpos.kind != kind) return true;"); ostr.println(" if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;"); ostr.println(" return false;"); ostr.println(" }"); ostr.println(""); } ostr.println(""); ostr.println("/** Get the next Token. */"); ostr.println(" " + staticOpt() + "final public Token getNextToken() {"); if (Options.getCacheTokens()) { ostr.println(" if ((token = jj_nt).next != null) jj_nt = jj_nt.next;"); ostr.println(" else jj_nt = jj_nt.next = token_source.getNextToken();"); } else { ostr.println(" if (token.next != null) token = token.next;"); ostr.println(" else token = token.next = token_source.getNextToken();"); ostr.println(" jj_ntk = -1;"); } if (Options.getErrorReporting()) { ostr.println(" jj_gen++;"); } if (Options.getDebugParser()) { ostr.println(" trace_token(token, \" (in getNextToken)\");"); } ostr.println(" return token;"); ostr.println(" }"); ostr.println(""); ostr.println("/** Get the specific Token. */"); ostr.println(" " + staticOpt() + "final public Token getToken(int index) {"); if (lookaheadNeeded) { ostr.println(" Token t = jj_lookingAhead ? jj_scanpos : token;"); } else { ostr.println(" Token t = token;"); } ostr.println(" for (int i = 0; i < index; i++) {"); ostr.println(" if (t.next != null) t = t.next;"); ostr.println(" else t = t.next = token_source.getNextToken();"); ostr.println(" }"); ostr.println(" return t;"); ostr.println(" }"); ostr.println(""); if (!Options.getCacheTokens()) { ostr.println(" " + staticOpt() + "private int jj_ntk() {"); ostr.println(" if ((jj_nt=token.next) == null)"); ostr.println(" return (jj_ntk = (token.next=token_source.getNextToken()).kind);"); ostr.println(" else"); ostr.println(" return (jj_ntk = jj_nt.kind);"); ostr.println(" }"); ostr.println(""); } if (Options.getErrorReporting()) { if (!Options.getGenerateGenerics()) ostr.println(" " + staticOpt() + "private java.util.List jj_expentries = new java.util.ArrayList();"); else ostr.println(" " + staticOpt() + "private java.util.List jj_expentries = new java.util.ArrayList();"); ostr.println(" " + staticOpt() + "private int[] jj_expentry;"); ostr.println(" " + staticOpt() + "private int jj_kind = -1;"); if (jj2index != 0) { ostr.println(" " + staticOpt() + "private int[] jj_lasttokens = new int[100];"); ostr.println(" " + staticOpt() + "private int jj_endpos;"); ostr.println(""); ostr.println(" " + staticOpt() + "private void jj_add_error_token(int kind, int pos) {"); ostr.println(" if (pos >= 100) return;"); ostr.println(" if (pos == jj_endpos + 1) {"); ostr.println(" jj_lasttokens[jj_endpos++] = kind;"); ostr.println(" } else if (jj_endpos != 0) {"); ostr.println(" jj_expentry = new int[jj_endpos];"); ostr.println(" for (int i = 0; i < jj_endpos; i++) {"); ostr.println(" jj_expentry[i] = jj_lasttokens[i];"); ostr.println(" }"); if (!Options.getGenerateGenerics()) ostr.println(" jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) {"); else ostr.println(" jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) {"); ostr.println(" int[] oldentry = (int[])(it.next());"); ostr.println(" if (oldentry.length == jj_expentry.length) {"); ostr.println(" for (int i = 0; i < jj_expentry.length; i++) {"); ostr.println(" if (oldentry[i] != jj_expentry[i]) {"); ostr.println(" continue jj_entries_loop;"); ostr.println(" }"); ostr.println(" }"); ostr.println(" jj_expentries.add(jj_expentry);"); ostr.println(" break jj_entries_loop;"); ostr.println(" }"); ostr.println(" }"); ostr.println(" if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;"); ostr.println(" }"); ostr.println(" }"); } ostr.println(""); ostr.println(" /** Generate ParseException. */"); ostr.println(" " + staticOpt() + "public ParseException generateParseException() {"); ostr.println(" jj_expentries.clear();"); ostr.println(" boolean[] la1tokens = new boolean[" + tokenCount + "];"); ostr.println(" if (jj_kind >= 0) {"); ostr.println(" la1tokens[jj_kind] = true;"); ostr.println(" jj_kind = -1;"); ostr.println(" }"); ostr.println(" for (int i = 0; i < " + maskindex + "; i++) {"); ostr.println(" if (jj_la1[i] == jj_gen) {"); ostr.println(" for (int j = 0; j < 32; j++) {"); for (int i = 0; i < (tokenCount-1)/32 + 1; i++) { ostr.println(" if ((jj_la1_" + i + "[i] & (1<. " + "Encountered: \" + mess);"); ostr.println(" }"); } ostr.println(""); if (Options.getDebugParser()) { ostr.println(" " + staticOpt() + "private int trace_indent = 0;"); ostr.println(" " + staticOpt() + "private boolean trace_enabled = true;"); ostr.println(""); ostr.println("/** Enable tracing. */"); ostr.println(" " + staticOpt() + "final public void enable_tracing() {"); ostr.println(" trace_enabled = true;"); ostr.println(" }"); ostr.println(""); ostr.println("/** Disable tracing. */"); ostr.println(" " + staticOpt() + "final public void disable_tracing() {"); ostr.println(" trace_enabled = false;"); ostr.println(" }"); ostr.println(""); ostr.println(" " + staticOpt() + "private void trace_call(String s) {"); ostr.println(" if (trace_enabled) {"); ostr.println(" for (int i = 0; i < trace_indent; i++) { System.out.print(\" \"); }"); ostr.println(" System.out.println(\"Call: \" + s);"); ostr.println(" }"); ostr.println(" trace_indent = trace_indent + 2;"); ostr.println(" }"); ostr.println(""); ostr.println(" " + staticOpt() + "private void trace_return(String s) {"); ostr.println(" trace_indent = trace_indent - 2;"); ostr.println(" if (trace_enabled) {"); ostr.println(" for (int i = 0; i < trace_indent; i++) { System.out.print(\" \"); }"); ostr.println(" System.out.println(\"Return: \" + s);"); ostr.println(" }"); ostr.println(" }"); ostr.println(""); ostr.println(" " + staticOpt() + "private void trace_token(Token t, String where) {"); ostr.println(" if (trace_enabled) {"); ostr.println(" for (int i = 0; i < trace_indent; i++) { System.out.print(\" \"); }"); ostr.println(" System.out.print(\"Consumed token: <\" + tokenImage[t.kind]);"); ostr.println(" if (t.kind != 0 && !tokenImage[t.kind].equals(\"\\\"\" + t.image + \"\\\"\")) {"); ostr.println(" System.out.print(\": \\\"\" + t.image + \"\\\"\");"); ostr.println(" }"); ostr.println(" System.out.println(\" at line \" + t.beginLine + " + "\" column \" + t.beginColumn + \">\" + where);"); ostr.println(" }"); ostr.println(" }"); ostr.println(""); ostr.println(" " + staticOpt() + "private void trace_scan(Token t1, int t2) {"); ostr.println(" if (trace_enabled) {"); ostr.println(" for (int i = 0; i < trace_indent; i++) { System.out.print(\" \"); }"); ostr.println(" System.out.print(\"Visited token: <\" + tokenImage[t1.kind]);"); ostr.println(" if (t1.kind != 0 && !tokenImage[t1.kind].equals(\"\\\"\" + t1.image + \"\\\"\")) {"); ostr.println(" System.out.print(\": \\\"\" + t1.image + \"\\\"\");"); ostr.println(" }"); ostr.println(" System.out.println(\" at line \" + t1.beginLine + \"" + " column \" + t1.beginColumn + \">; Expected token: <\" + tokenImage[t2] + \">\");"); ostr.println(" }"); ostr.println(" }"); ostr.println(""); } else { ostr.println(" /** Enable tracing. */"); ostr.println(" " + staticOpt() + "final public void enable_tracing() {"); ostr.println(" }"); ostr.println(""); ostr.println(" /** Disable tracing. */"); ostr.println(" " + staticOpt() + "final public void disable_tracing() {"); ostr.println(" }"); ostr.println(""); } if (jj2index != 0 && Options.getErrorReporting()) { ostr.println(" " + staticOpt() + "private void jj_rescan_token() {"); ostr.println(" jj_rescan = true;"); ostr.println(" for (int i = 0; i < " + jj2index + "; i++) {"); ostr.println(" try {"); ostr.println(" JJCalls p = jj_2_rtns[i];"); ostr.println(" do {"); ostr.println(" if (p.gen > jj_gen) {"); ostr.println(" jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;"); ostr.println(" switch (i) {"); for (int i = 0; i < jj2index; i++) { ostr.println(" case " + i + ": jj_3_" + (i+1) + "(); break;"); } ostr.println(" }"); ostr.println(" }"); ostr.println(" p = p.next;"); ostr.println(" } while (p != null);"); ostr.println(" } catch(LookaheadSuccess ls) { }"); ostr.println(" }"); ostr.println(" jj_rescan = false;"); ostr.println(" }"); ostr.println(""); ostr.println(" " + staticOpt() + "private void jj_save(int index, int xla) {"); ostr.println(" JJCalls p = jj_2_rtns[index];"); ostr.println(" while (p.gen > jj_gen) {"); ostr.println(" if (p.next == null) { p = p.next = new JJCalls(); break; }"); ostr.println(" p = p.next;"); ostr.println(" }"); ostr.println(" p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;"); ostr.println(" }"); ostr.println(""); } if (jj2index != 0 && Options.getErrorReporting()) { ostr.println(" static final class JJCalls {"); ostr.println(" int gen;"); ostr.println(" Token first;"); ostr.println(" int arg;"); ostr.println(" JJCalls next;"); ostr.println(" }"); ostr.println(""); } if (cu_from_insertion_point_2.size() != 0) { printTokenSetup((Token)(cu_from_insertion_point_2.get(0))); ccol = 1; for (Iterator it = cu_from_insertion_point_2.iterator(); it.hasNext();) { t = (Token)it.next(); printToken(t, ostr); } printTrailingComments(t, ostr); } ostr.println(""); ostr.close(); } // matches "if (Options.getBuildParser())" } static private PrintWriter ostr; public static void reInit() { ostr = null; lookaheadNeeded = false; } } javacc-5.0.orig/src/org/javacc/parser/LookaheadCalc.java0000644000175000017500000002506711070513744022162 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; public class LookaheadCalc extends JavaCCGlobals { static MatchInfo overlap(List v1, List v2) { MatchInfo m1, m2, m3; int size; boolean diff; for (int i = 0; i < v1.size(); i++) { m1 = (MatchInfo)v1.get(i); for (int j = 0; j < v2.size(); j++) { m2 = (MatchInfo)v2.get(j); size = m1.firstFreeLoc; m3 = m1; if (size > m2.firstFreeLoc) { size = m2.firstFreeLoc; m3 = m2; } if (size == 0) return null; // we wish to ignore empty expansions and the JAVACODE stuff here. diff = false; for (int k = 0; k < size; k++) { if (m1.match[k] != m2.match[k]) { diff = true; break; } } if (!diff) return m3; } } return null; } static boolean javaCodeCheck(List v) { for (int i = 0; i < v.size(); i++) { if (((MatchInfo)v.get(i)).firstFreeLoc == 0) { return true; } } return false; } static String image(MatchInfo m) { String ret = ""; for (int i = 0; i < m.firstFreeLoc; i++) { if (m.match[i] == 0) { ret += " "; } else { RegularExpression re = (RegularExpression)rexps_of_tokens.get(new Integer(m.match[i])); if (re instanceof RStringLiteral) { ret += " \"" + add_escapes(((RStringLiteral)re).image) + "\""; } else if (re.label != null && !re.label.equals("")) { ret += " <" + re.label + ">"; } else { ret += " "; } } } if (m.firstFreeLoc == 0) { return ""; } else { return ret.substring(1); } } public static void choiceCalc(Choice ch) { int first = firstChoice(ch); // dbl[i] and dbr[i] are lists of size limited matches for choice i // of ch. dbl ignores matches with semantic lookaheads (when force_la_check // is false), while dbr ignores semantic lookahead. List[] dbl = new ArrayList[ch.getChoices().size()]; List[] dbr = new ArrayList[ch.getChoices().size()]; int[] minLA = new int[ch.getChoices().size()-1]; MatchInfo[] overlapInfo = new MatchInfo[ch.getChoices().size()-1]; int[] other = new int[ch.getChoices().size()-1]; MatchInfo m; List v; boolean overlapDetected; for (int la = 1; la <= Options.getChoiceAmbiguityCheck(); la++) { MatchInfo.laLimit = la; LookaheadWalk.considerSemanticLA = !Options.getForceLaCheck(); for (int i = first; i < ch.getChoices().size()-1; i++) { LookaheadWalk.sizeLimitedMatches = new ArrayList(); m = new MatchInfo(); m.firstFreeLoc = 0; v = new ArrayList(); v.add(m); LookaheadWalk.genFirstSet(v, (Expansion)ch.getChoices().get(i)); dbl[i] = LookaheadWalk.sizeLimitedMatches; } LookaheadWalk.considerSemanticLA = false; for (int i = first+1; i < ch.getChoices().size(); i++) { LookaheadWalk.sizeLimitedMatches = new ArrayList(); m = new MatchInfo(); m.firstFreeLoc = 0; v = new ArrayList(); v.add(m); LookaheadWalk.genFirstSet(v, (Expansion)ch.getChoices().get(i)); dbr[i] = LookaheadWalk.sizeLimitedMatches; } if (la == 1) { for (int i = first; i < ch.getChoices().size()-1; i++) { Expansion exp = (Expansion)ch.getChoices().get(i); if (Semanticize.emptyExpansionExists(exp)) { JavaCCErrors.warning(exp, "This choice can expand to the empty token sequence " + "and will therefore always be taken in favor of the choices appearing later."); break; } else if (javaCodeCheck(dbl[i])) { JavaCCErrors.warning(exp, "JAVACODE non-terminal will force this choice to be taken " + "in favor of the choices appearing later."); break; } } } overlapDetected = false; for (int i = first; i < ch.getChoices().size()-1; i++) { for (int j = i+1; j < ch.getChoices().size(); j++) { if ((m = overlap(dbl[i], dbr[j])) != null) { minLA[i] = la+1; overlapInfo[i] = m; other[i] = j; overlapDetected = true; break; } } } if (!overlapDetected) { break; } } for (int i = first; i < ch.getChoices().size()-1; i++) { if (explicitLA((Expansion)ch.getChoices().get(i)) && !Options.getForceLaCheck()) { continue; } if (minLA[i] > Options.getChoiceAmbiguityCheck()) { JavaCCErrors.warning("Choice conflict involving two expansions at"); System.err.print(" line " + ((Expansion)ch.getChoices().get(i)).getLine()); System.err.print(", column " + ((Expansion)ch.getChoices().get(i)).getColumn()); System.err.print(" and line " + ((Expansion)ch.getChoices().get(other[i])).getLine()); System.err.print(", column " + ((Expansion)ch.getChoices().get(other[i])).getColumn()); System.err.println(" respectively."); System.err.println(" A common prefix is: " + image(overlapInfo[i])); System.err.println(" Consider using a lookahead of " + minLA[i] + " or more for earlier expansion."); } else if (minLA[i] > 1) { JavaCCErrors.warning("Choice conflict involving two expansions at"); System.err.print(" line " + ((Expansion)ch.getChoices().get(i)).getLine()); System.err.print(", column " + ((Expansion)ch.getChoices().get(i)).getColumn()); System.err.print(" and line " + ((Expansion)ch.getChoices().get(other[i])).getLine()); System.err.print(", column " + ((Expansion)ch.getChoices().get(other[i])).getColumn()); System.err.println(" respectively."); System.err.println(" A common prefix is: " + image(overlapInfo[i])); System.err.println(" Consider using a lookahead of " + minLA[i] + " for earlier expansion."); } } } static boolean explicitLA(Expansion exp) { if (!(exp instanceof Sequence)) { return false; } Sequence seq = (Sequence)exp; Object obj = seq.units.get(0); if (!(obj instanceof Lookahead)) { return false; } Lookahead la = (Lookahead)obj; return la.isExplicit(); } static int firstChoice(Choice ch) { if (Options.getForceLaCheck()) { return 0; } for (int i = 0; i < ch.getChoices().size(); i++) { if (!explicitLA((Expansion)ch.getChoices().get(i))) { return i; } } return ch.getChoices().size(); } private static String image(Expansion exp) { if (exp instanceof OneOrMore) { return "(...)+"; } else if (exp instanceof ZeroOrMore) { return "(...)*"; } else /* if (exp instanceof ZeroOrOne) */ { return "[...]"; } } public static void ebnfCalc(Expansion exp, Expansion nested) { // exp is one of OneOrMore, ZeroOrMore, ZeroOrOne MatchInfo m, m1 = null; List v, first, follow; int la; for (la = 1; la <= Options.getOtherAmbiguityCheck(); la++) { MatchInfo.laLimit = la; LookaheadWalk.sizeLimitedMatches = new ArrayList(); m = new MatchInfo(); m.firstFreeLoc = 0; v = new ArrayList(); v.add(m); LookaheadWalk.considerSemanticLA = !Options.getForceLaCheck(); LookaheadWalk.genFirstSet(v, nested); first = LookaheadWalk.sizeLimitedMatches; LookaheadWalk.sizeLimitedMatches = new ArrayList(); LookaheadWalk.considerSemanticLA = false; LookaheadWalk.genFollowSet(v, exp, Expansion.nextGenerationIndex++); follow = LookaheadWalk.sizeLimitedMatches; if (la == 1) { if (javaCodeCheck(first)) { JavaCCErrors.warning(nested, "JAVACODE non-terminal within " + image(exp) + " construct will force this construct to be entered in favor of " + "expansions occurring after construct."); } } if ((m = overlap(first, follow)) == null) { break; } m1 = m; } if (la > Options.getOtherAmbiguityCheck()) { JavaCCErrors.warning("Choice conflict in " + image(exp) + " construct " + "at line " + exp.getLine() + ", column " + exp.getColumn() + "."); System.err.println(" Expansion nested within construct and expansion following construct"); System.err.println(" have common prefixes, one of which is: " + image(m1)); System.err.println(" Consider using a lookahead of " + la + " or more for nested expansion."); } else if (la > 1) { JavaCCErrors.warning("Choice conflict in " + image(exp) + " construct " + "at line " + exp.getLine() + ", column " + exp.getColumn() + "."); System.err.println(" Expansion nested within construct and expansion following construct"); System.err.println(" have common prefixes, one of which is: " + image(m1)); System.err.println(" Consider using a lookahead of " + la + " for nested expansion."); } } } javacc-5.0.orig/src/org/javacc/parser/Expansion.java0000644000175000017500000001171511070513743021446 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.Set; /** * Describes expansions - entities that may occur on the * right hand sides of productions. This is the base class of * a bunch of other more specific classes. */ public class Expansion { /** * The line and column number of the construct that corresponds * most closely to this node. */ private int line; private int column; /** * A reimplementing of Object.hashCode() to be deterministic. This uses * the line and column fields to generate an arbitrary number - we assume * that this method is called only after line and column are set to * their actual values. */ public int hashCode() { return getLine() + getColumn(); } /** * An internal name for this expansion. This is used to generate parser * routines. */ String internal_name = ""; /** * The parser routines are generated in three phases. The generation * of the second and third phase are on demand only, and the third phase * can be recursive. This variable is used to keep track of the * expansions for which phase 3 generations have been already added to * a list so that the recursion can be terminated. */ boolean phase3done = false; /** * The parent of this expansion node. In case this is the top level * expansion of the production it is a reference to the production node * otherwise it is a reference to another Expansion node. In case this * is the top level of a lookahead expansion,then the parent is null. */ public Object parent; /** * The ordinal of this node with respect to its parent. */ int ordinal; /** * To avoid right-recursive loops when calculating follow sets, we use * a generation number which indicates if this expansion was visited * by LookaheadWalk.genFollowSet in the same generation. New generations * are obtained by incrementing the static counter below, and the current * generation is stored in the non-static variable below. */ public static long nextGenerationIndex = 1; public long myGeneration = 0; /** * This flag is used for bookkeeping by the minimumSize method in class * ParseEngine. */ public boolean inMinimumSize = false; public static void reInit() { nextGenerationIndex = 1; } private String getSimpleName() { String name = getClass().getName(); return name.substring(name.lastIndexOf(".")+1); // strip the package name } public String toString() { return "[" + getLine() + "," + getColumn() + " " + System.identityHashCode(this) + " " + getSimpleName() + "]"; } protected static final String eol = System.getProperty("line.separator", "\n"); protected StringBuffer dumpPrefix(int indent) { StringBuffer sb = new StringBuffer(128); for (int i = 0; i < indent; i++) sb.append(" "); return sb; } public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer value = dumpPrefix(indent).append(System.identityHashCode(this)).append(" ").append(getSimpleName()); return value; } /** * @param column the column to set */ void setColumn(int column) { this.column = column; } /** * @return the column */ int getColumn() { return column; } /** * @param line the line to set */ void setLine(int line) { this.line = line; } /** * @return the line */ int getLine() { return line; } } javacc-5.0.orig/src/org/javacc/parser/ZeroOrOne.java0000644000175000017500000000452311070513745021365 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.Set; /** * Describes zero-or-one expansions (e.g., [foo], foo?). */ public class ZeroOrOne extends Expansion { /** * The expansion which is repeated zero or one times. */ public Expansion expansion; public ZeroOrOne() {} public ZeroOrOne(Token t, Expansion e) { this.setLine(t.beginLine); this.setColumn(t.beginColumn); this.expansion = e; e.parent = this; } public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = super.dump(indent, alreadyDumped); if (alreadyDumped.contains(this)) return sb; alreadyDumped.add(this); sb.append(eol).append(expansion.dump(indent + 1, alreadyDumped)); return sb; } } javacc-5.0.orig/src/org/javacc/parser/CharacterRange.java0000644000175000017500000000602011070513743022344 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Describes character range descriptors in a character list. */ public class CharacterRange { /** * The line and column number of the construct that corresponds * most closely to this node. */ private int column; private int line; /** * The leftmost and the rightmost characters in this character range. */ private char right; private char left; CharacterRange() { } CharacterRange(char l, char r) { if (l > r) JavaCCErrors.semantic_error(this, "Invalid range : \"" + (int)l + "\" - \"" + (int)r + "\". First character shoud be less than or equal to the second one in a range."); setLeft(l); setRight(r); } /** * @param line the line to set */ void setLine(int line) { this.line = line; } /** * @return the line */ int getLine() { return line; } /** * @param column the column to set */ void setColumn(int column) { this.column = column; } /** * @return the column */ int getColumn() { return column; } /** * @param left the left to set */ public void setLeft(char left) { this.left = left; } /** * @return the left */ public char getLeft() { return left; } /** * @param right the right to set */ public void setRight(char right) { this.right = right; } /** * @return the right */ public char getRight() { return right; } } javacc-5.0.orig/src/org/javacc/parser/RStringLiteral.java0000644000175000017500000013173211070513745022413 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.List; import java.util.Set; final class KindInfo { long[] validKinds; long[] finalKinds; int validKindCnt = 0; int finalKindCnt = 0; KindInfo(int maxKind) { validKinds = new long[maxKind / 64 + 1]; finalKinds = new long[maxKind / 64 + 1]; } public void InsertValidKind(int kind) { validKinds[kind / 64] |= (1L << (kind % 64)); validKindCnt++; } public void InsertFinalKind(int kind) { finalKinds[kind / 64] |= (1L << (kind % 64)); finalKindCnt++; } }; /** * Describes string literals. */ public class RStringLiteral extends RegularExpression { /** * The string image of the literal. */ public String image; public RStringLiteral() { } public RStringLiteral(Token t, String image) { this.setLine(t.beginLine); this.setColumn(t.beginColumn); this.image = image; } private static int maxStrKind = 0; private static int maxLen = 0; private static int charCnt = 0; private static List charPosKind = new ArrayList(); // Elements are hashtables // with single char keys; private static int[] maxLenForActive = new int[100]; // 6400 tokens public static String[] allImages; private static int[][] intermediateKinds; private static int[][] intermediateMatchedPos; private static int startStateCnt = 0; private static boolean subString[]; private static boolean subStringAtPos[]; private static Hashtable[] statesForPos; /** * Initialize all the static variables, so that there is no interference * between the various states of the lexer. * * Need to call this method after generating code for each lexical state. */ public static void ReInit() { maxStrKind = 0; maxLen = 0; charPosKind = new ArrayList(); maxLenForActive = new int[100]; // 6400 tokens intermediateKinds = null; intermediateMatchedPos = null; startStateCnt = 0; subString = null; subStringAtPos = null; statesForPos = null; } public static void DumpStrLiteralImages(java.io.PrintWriter ostr) { String image; int i; charCnt = 0; // Set to zero in reInit() but just to be sure ostr.println(""); ostr.println("/** Token literal values. */"); ostr.println("public static final String[] jjstrLiteralImages = {"); if (allImages == null || allImages.length == 0) { ostr.println("};"); return; } allImages[0] = ""; for (i = 0; i < allImages.length; i++) { if ((image = allImages[i]) == null || ((LexGen.toSkip[i / 64] & (1L << (i % 64))) == 0L && (LexGen.toMore[i / 64] & (1L << (i % 64))) == 0L && (LexGen.toToken[i / 64] & (1L << (i % 64))) == 0L) || (LexGen.toSkip[i / 64] & (1L << (i % 64))) != 0L || (LexGen.toMore[i / 64] & (1L << (i % 64))) != 0L || LexGen.canReachOnMore[LexGen.lexStates[i]] || ((Options.getIgnoreCase() || LexGen.ignoreCase[i]) && (!image.equals(image.toLowerCase()) || !image.equals(image.toUpperCase())))) { allImages[i] = null; if ((charCnt += 6) > 80) { ostr.println(""); charCnt = 0; } ostr.print("null, "); continue; } String toPrint = "\""; for (int j = 0; j < image.length(); j++) { if (image.charAt(j) <= 0xff) toPrint += ("\\" + Integer.toOctalString((int)image.charAt(j))); else { String hexVal = Integer.toHexString((int)image.charAt(j)); if (hexVal.length() == 3) hexVal = "0" + hexVal; toPrint += ("\\u" + hexVal); } } toPrint += ("\", "); if ((charCnt += toPrint.length()) >= 80) { ostr.println(""); charCnt = 0; } ostr.print(toPrint); } while (++i < LexGen.maxOrdinal) { if ((charCnt += 6) > 80) { ostr.println(""); charCnt = 0; } ostr.print("null, "); continue; } ostr.println("};"); } /** * Used for top level string literals. */ public void GenerateDfa(java.io.PrintWriter ostr, int kind) { String s; Hashtable temp; KindInfo info; int len; if (maxStrKind <= ordinal) maxStrKind = ordinal + 1; if ((len = image.length()) > maxLen) maxLen = len; char c; for (int i = 0; i < len; i++) { if (Options.getIgnoreCase()) s = ("" + (c = image.charAt(i))).toLowerCase(); else s = "" + (c = image.charAt(i)); if (!NfaState.unicodeWarningGiven && c > 0xff && !Options.getJavaUnicodeEscape() && !Options.getUserCharStream()) { NfaState.unicodeWarningGiven = true; JavaCCErrors.warning(LexGen.curRE, "Non-ASCII characters used in regular expression." + "Please make sure you use the correct Reader when you create the parser, " + "one that can handle your character set."); } if (i >= charPosKind.size()) // Kludge, but OK charPosKind.add(temp = new Hashtable()); else temp = (Hashtable)charPosKind.get(i); if ((info = (KindInfo)temp.get(s)) == null) temp.put(s, info = new KindInfo(LexGen.maxOrdinal)); if (i + 1 == len) info.InsertFinalKind(ordinal); else info.InsertValidKind(ordinal); if (!Options.getIgnoreCase() && LexGen.ignoreCase[ordinal] && c != Character.toLowerCase(c)) { s = ("" + image.charAt(i)).toLowerCase(); if (i >= charPosKind.size()) // Kludge, but OK charPosKind.add(temp = new Hashtable()); else temp = (Hashtable)charPosKind.get(i); if ((info = (KindInfo)temp.get(s)) == null) temp.put(s, info = new KindInfo(LexGen.maxOrdinal)); if (i + 1 == len) info.InsertFinalKind(ordinal); else info.InsertValidKind(ordinal); } if (!Options.getIgnoreCase() && LexGen.ignoreCase[ordinal] && c != Character.toUpperCase(c)) { s = ("" + image.charAt(i)).toUpperCase(); if (i >= charPosKind.size()) // Kludge, but OK charPosKind.add(temp = new Hashtable()); else temp = (Hashtable)charPosKind.get(i); if ((info = (KindInfo)temp.get(s)) == null) temp.put(s, info = new KindInfo(LexGen.maxOrdinal)); if (i + 1 == len) info.InsertFinalKind(ordinal); else info.InsertValidKind(ordinal); } } maxLenForActive[ordinal / 64] = Math.max(maxLenForActive[ordinal / 64], len -1); allImages[ordinal] = image; } public Nfa GenerateNfa(boolean ignoreCase) { if (image.length() == 1) { RCharacterList temp = new RCharacterList(image.charAt(0)); return temp.GenerateNfa(ignoreCase); } NfaState startState = new NfaState(); NfaState theStartState = startState; NfaState finalState = null; if (image.length() == 0) return new Nfa(theStartState, theStartState); int i; for (i = 0; i < image.length(); i++) { finalState = new NfaState(); startState.charMoves = new char[1]; startState.AddChar(image.charAt(i)); if (Options.getIgnoreCase() || ignoreCase) { startState.AddChar(Character.toLowerCase(image.charAt(i))); startState.AddChar(Character.toUpperCase(image.charAt(i))); } startState.next = finalState; startState = finalState; } return new Nfa(theStartState, finalState); } static void DumpNullStrLiterals(java.io.PrintWriter ostr) { ostr.println("{"); if (NfaState.generatedStates != 0) ostr.println(" return jjMoveNfa" + LexGen.lexStateSuffix + "(" + NfaState.InitStateName() + ", 0);"); else ostr.println(" return 1;"); ostr.println("}"); } private static int GetStateSetForKind(int pos, int kind) { if (LexGen.mixed[LexGen.lexStateIndex] || NfaState.generatedStates == 0) return -1; Hashtable allStateSets = statesForPos[pos]; if (allStateSets == null) return -1; Enumeration e = allStateSets.keys(); while (e.hasMoreElements()) { String s = (String)e.nextElement(); long[] actives = (long[])allStateSets.get(s); s = s.substring(s.indexOf(", ") + 2); s = s.substring(s.indexOf(", ") + 2); if (s.equals("null;")) continue; if (actives != null && (actives[kind / 64] & (1L << (kind % 64))) != 0L) { return NfaState.AddStartStateSet(s); } } return -1; } static String GetLabel(int kind) { RegularExpression re = LexGen.rexprs[kind]; if (re instanceof RStringLiteral) return " \"" + JavaCCGlobals.add_escapes(((RStringLiteral)re).image) + "\""; else if (!re.label.equals("")) return " <" + re.label + ">"; else return " "; } static int GetLine(int kind) { return LexGen.rexprs[kind].getLine(); } static int GetColumn(int kind) { return LexGen.rexprs[kind].getColumn(); } /** * Returns true if s1 starts with s2 (ignoring case for each character). */ static private boolean StartsWithIgnoreCase(String s1, String s2) { if (s1.length() < s2.length()) return false; for (int i = 0; i < s2.length(); i++) { char c1 = s1.charAt(i), c2 = s2.charAt(i); if (c1 != c2 && Character.toLowerCase(c2) != c1 && Character.toUpperCase(c2) != c1) return false; } return true; } static void FillSubString() { String image; subString = new boolean[maxStrKind + 1]; subStringAtPos = new boolean[maxLen]; for (int i = 0; i < maxStrKind; i++) { subString[i] = false; if ((image = allImages[i]) == null || LexGen.lexStates[i] != LexGen.lexStateIndex) continue; if (LexGen.mixed[LexGen.lexStateIndex]) { // We will not optimize for mixed case subString[i] = true; subStringAtPos[image.length() - 1] = true; continue; } for (int j = 0; j < maxStrKind; j++) { if (j != i && LexGen.lexStates[j] == LexGen.lexStateIndex && ((String)allImages[j]) != null) { if (((String)allImages[j]).indexOf(image) == 0) { subString[i] = true; subStringAtPos[image.length() - 1] = true; break; } else if (Options.getIgnoreCase() && StartsWithIgnoreCase((String)allImages[j], image)) { subString[i] = true; subStringAtPos[image.length() - 1] = true; break; } } } } } static void DumpStartWithStates(java.io.PrintWriter ostr) { ostr.println((Options.getStatic() ? "static " : "") + "private int " + "jjStartNfaWithStates" + LexGen.lexStateSuffix + "(int pos, int kind, int state)"); ostr.println("{"); ostr.println(" jjmatchedKind = kind;"); ostr.println(" jjmatchedPos = pos;"); if (Options.getDebugTokenManager()) { ostr.println(" debugStream.println(\" No more string literal token matches are possible.\");"); ostr.println(" debugStream.println(\" Currently matched the first \" " + "+ (jjmatchedPos + 1) + \" characters as a \" + tokenImage[jjmatchedKind] + \" token.\");"); } ostr.println(" try { curChar = input_stream.readChar(); }"); ostr.println(" catch(java.io.IOException e) { return pos + 1; }"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(" + (LexGen.maxLexStates > 1 ? "\"<\" + lexStateNames[curLexState] + \">\" + " : "") + "\"Current character : \" + " + "TokenMgrError.addEscapes(String.valueOf(curChar)) + \" (\" + (int)curChar + \") " + "at line \" + input_stream.getEndLine() + \" column \" + input_stream.getEndColumn());"); ostr.println(" return jjMoveNfa" + LexGen.lexStateSuffix + "(state, pos + 1);"); ostr.println("}"); } private static boolean boilerPlateDumped = false; static void DumpBoilerPlate(java.io.PrintWriter ostr) { ostr.println((Options.getStatic() ? "static " : "") + "private int " + "jjStopAtPos(int pos, int kind)"); ostr.println("{"); ostr.println(" jjmatchedKind = kind;"); ostr.println(" jjmatchedPos = pos;"); if (Options.getDebugTokenManager()) { ostr.println(" debugStream.println(\" No more string literal token matches are possible.\");"); ostr.println(" debugStream.println(\" Currently matched the first \" + (jjmatchedPos + 1) + " + "\" characters as a \" + tokenImage[jjmatchedKind] + \" token.\");"); } ostr.println(" return pos + 1;"); ostr.println("}"); } static String[] ReArrange(Hashtable tab) { String[] ret = new String[tab.size()]; Enumeration e = tab.keys(); int cnt = 0; while (e.hasMoreElements()) { int i = 0, j; String s; char c = (s = (String)e.nextElement()).charAt(0); while (i < cnt && ret[i].charAt(0) < c) i++; if (i < cnt) for (j = cnt - 1; j >= i; j--) ret[j + 1] = ret[j]; ret[i] = s; cnt++; } return ret; } static void DumpDfaCode(java.io.PrintWriter ostr) { Hashtable tab; String key; KindInfo info; int maxLongsReqd = maxStrKind / 64 + 1; int i, j, k; boolean ifGenerated; LexGen.maxLongsReqd[LexGen.lexStateIndex] = maxLongsReqd; if (maxLen == 0) { ostr.println((Options.getStatic() ? "static " : "") + "private int " + "jjMoveStringLiteralDfa0" + LexGen.lexStateSuffix + "()"); DumpNullStrLiterals(ostr); return; } if (!boilerPlateDumped) { DumpBoilerPlate(ostr); boilerPlateDumped = true; } boolean createStartNfa = false;; for (i = 0; i < maxLen; i++) { boolean atLeastOne = false; boolean startNfaNeeded = false; tab = (Hashtable)charPosKind.get(i); String[] keys = ReArrange(tab); ostr.print((Options.getStatic() ? "static " : "") + "private int " + "jjMoveStringLiteralDfa" + i + LexGen.lexStateSuffix + "("); if (i != 0) { if (i == 1) { for (j = 0; j < maxLongsReqd - 1; j++) if (i <= maxLenForActive[j]) { if (atLeastOne) ostr.print(", "); else atLeastOne = true; ostr.print("long active" + j); } if (i <= maxLenForActive[j]) { if (atLeastOne) ostr.print(", "); ostr.print("long active" + j); } } else { for (j = 0; j < maxLongsReqd - 1; j++) if (i <= maxLenForActive[j] + 1) { if (atLeastOne) ostr.print(", "); else atLeastOne = true; ostr.print("long old" + j + ", long active" + j); } if (i <= maxLenForActive[j] + 1) { if (atLeastOne) ostr.print(", "); ostr.print("long old" + j + ", long active" + j); } } } ostr.println(")"); ostr.println("{"); if (i != 0) { if (i > 1) { atLeastOne = false; ostr.print(" if (("); for (j = 0; j < maxLongsReqd - 1; j++) if (i <= maxLenForActive[j] + 1) { if (atLeastOne) ostr.print(" | "); else atLeastOne = true; ostr.print("(active" + j + " &= old" + j + ")"); } if (i <= maxLenForActive[j] + 1) { if (atLeastOne) ostr.print(" | "); ostr.print("(active" + j + " &= old" + j + ")"); } ostr.println(") == 0L)"); if (!LexGen.mixed[LexGen.lexStateIndex] && NfaState.generatedStates != 0) { ostr.print(" return jjStartNfa" + LexGen.lexStateSuffix + "(" + (i - 2) + ", "); for (j = 0; j < maxLongsReqd - 1; j++) if (i <= maxLenForActive[j] + 1) ostr.print("old" + j + ", "); else ostr.print("0L, "); if (i <= maxLenForActive[j] + 1) ostr.println("old" + j + ");"); else ostr.println("0L);"); } else if (NfaState.generatedStates != 0) ostr.println(" return jjMoveNfa" + LexGen.lexStateSuffix + "(" + NfaState.InitStateName() + ", " + (i - 1) + ");"); else ostr.println(" return " + i + ";"); } if (i != 0 && Options.getDebugTokenManager()) { ostr.println(" if (jjmatchedKind != 0 && jjmatchedKind != 0x" + Integer.toHexString(Integer.MAX_VALUE) + ")"); ostr.println(" debugStream.println(\" Currently matched the first \" + " + "(jjmatchedPos + 1) + \" characters as a \" + tokenImage[jjmatchedKind] + \" token.\");"); ostr.println(" debugStream.println(\" Possible string literal matches : { \""); for (int vecs = 0; vecs < maxStrKind / 64 + 1; vecs++) { if (i <= maxLenForActive[vecs]) { ostr.println(" +"); ostr.print(" jjKindsForBitVector(" + vecs + ", "); ostr.print("active" + vecs + ") "); } } ostr.println(" + \" } \");"); } ostr.println(" try { curChar = input_stream.readChar(); }"); ostr.println(" catch(java.io.IOException e) {"); if (!LexGen.mixed[LexGen.lexStateIndex] && NfaState.generatedStates != 0) { ostr.print(" jjStopStringLiteralDfa" + LexGen.lexStateSuffix + "(" + (i - 1) + ", "); for (k = 0; k < maxLongsReqd - 1; k++) if (i <= maxLenForActive[k]) ostr.print("active" + k + ", "); else ostr.print("0L, "); if (i <= maxLenForActive[k]) ostr.println("active" + k + ");"); else ostr.println("0L);"); if (i != 0 && Options.getDebugTokenManager()) { ostr.println(" if (jjmatchedKind != 0 && jjmatchedKind != 0x" + Integer.toHexString(Integer.MAX_VALUE) + ")"); ostr.println(" debugStream.println(\" Currently matched the first \" + " + "(jjmatchedPos + 1) + \" characters as a \" + tokenImage[jjmatchedKind] + \" token.\");"); } ostr.println(" return " + i + ";"); } else if (NfaState.generatedStates != 0) ostr.println(" return jjMoveNfa" + LexGen.lexStateSuffix + "(" + NfaState.InitStateName() + ", " + (i - 1) + ");"); else ostr.println(" return " + i + ";"); ostr.println(" }"); } if (i != 0 && Options.getDebugTokenManager()) ostr.println(" debugStream.println(" + (LexGen.maxLexStates > 1 ? "\"<\" + lexStateNames[curLexState] + \">\" + " : "") + "\"Current character : \" + " + "TokenMgrError.addEscapes(String.valueOf(curChar)) + \" (\" + (int)curChar + \") " + "at line \" + input_stream.getEndLine() + \" column \" + input_stream.getEndColumn());"); ostr.println(" switch(curChar)"); ostr.println(" {"); CaseLoop: for (int q = 0; q < keys.length; q++) { key = keys[q]; info = (KindInfo)tab.get(key); ifGenerated = false; char c = key.charAt(0); if (i == 0 && c < 128 && info.finalKindCnt != 0 && (NfaState.generatedStates == 0 || !NfaState.CanStartNfaUsingAscii(c))) { int kind; for (j = 0; j < maxLongsReqd; j++) if (info.finalKinds[j] != 0L) break; for (k = 0; k < 64; k++) if ((info.finalKinds[j] & (1L << k)) != 0L && !subString[kind = (j * 64 + k)]) { if ((intermediateKinds != null && intermediateKinds[(j * 64 + k)] != null && intermediateKinds[(j * 64 + k)][i] < (j * 64 + k) && intermediateMatchedPos != null && intermediateMatchedPos[(j * 64 + k)][i] == i) || (LexGen.canMatchAnyChar[LexGen.lexStateIndex] >= 0 && LexGen.canMatchAnyChar[LexGen.lexStateIndex] < (j * 64 + k))) break; else if ((LexGen.toSkip[kind / 64] & (1L << (kind % 64))) != 0L && (LexGen.toSpecial[kind / 64] & (1L << (kind % 64))) == 0L && LexGen.actions[kind] == null && LexGen.newLexState[kind] == null) { LexGen.AddCharToSkip(c, kind); if (Options.getIgnoreCase()) { if (c != Character.toUpperCase(c)) LexGen.AddCharToSkip(Character.toUpperCase(c), kind); if (c != Character.toLowerCase(c)) LexGen.AddCharToSkip(Character.toLowerCase(c), kind); } continue CaseLoop; } } } // Since we know key is a single character ... if (Options.getIgnoreCase()) { if (c != Character.toUpperCase(c)) ostr.println(" case " + (int)Character.toUpperCase(c) + ":"); if (c != Character.toLowerCase(c)) ostr.println(" case " + (int)Character.toLowerCase(c) + ":"); } ostr.println(" case " + (int)c + ":"); long matchedKind; String prefix = (i == 0) ? " " : " "; if (info.finalKindCnt != 0) { for (j = 0; j < maxLongsReqd; j++) { if ((matchedKind = info.finalKinds[j]) == 0L) continue; for (k = 0; k < 64; k++) { if ((matchedKind & (1L << k)) == 0L) continue; if (ifGenerated) { ostr.print(" else if "); } else if (i != 0) ostr.print(" if "); ifGenerated = true; int kindToPrint; if (i != 0) { ostr.println("((active" + j + " & 0x" + Long.toHexString(1L << k) + "L) != 0L)"); } if (intermediateKinds != null && intermediateKinds[(j * 64 + k)] != null && intermediateKinds[(j * 64 + k)][i] < (j * 64 + k) && intermediateMatchedPos != null && intermediateMatchedPos[(j * 64 + k)][i] == i) { JavaCCErrors.warning(" \"" + JavaCCGlobals.add_escapes(allImages[j * 64 + k]) + "\" cannot be matched as a string literal token " + "at line " + GetLine(j * 64 + k) + ", column " + GetColumn(j * 64 + k) + ". It will be matched as " + GetLabel(intermediateKinds[(j * 64 + k)][i]) + "."); kindToPrint = intermediateKinds[(j * 64 + k)][i]; } else if (i == 0 && LexGen.canMatchAnyChar[LexGen.lexStateIndex] >= 0 && LexGen.canMatchAnyChar[LexGen.lexStateIndex] < (j * 64 + k)) { JavaCCErrors.warning(" \"" + JavaCCGlobals.add_escapes(allImages[j * 64 + k]) + "\" cannot be matched as a string literal token " + "at line " + GetLine(j * 64 + k) + ", column " + GetColumn(j * 64 + k) + ". It will be matched as " + GetLabel(LexGen.canMatchAnyChar[LexGen.lexStateIndex]) + "."); kindToPrint = LexGen.canMatchAnyChar[LexGen.lexStateIndex]; } else kindToPrint = j * 64 + k; if (!subString[(j * 64 + k)]) { int stateSetName = GetStateSetForKind(i, j * 64 + k); if (stateSetName != -1) { createStartNfa = true; ostr.println(prefix + "return jjStartNfaWithStates" + LexGen.lexStateSuffix + "(" + i + ", " + kindToPrint + ", " + stateSetName + ");"); } else ostr.println(prefix + "return jjStopAtPos" + "(" + i + ", " + kindToPrint + ");"); } else { if ((LexGen.initMatch[LexGen.lexStateIndex] != 0 && LexGen.initMatch[LexGen.lexStateIndex] != Integer.MAX_VALUE) || i != 0) { ostr.println(" {"); ostr.println(prefix + "jjmatchedKind = " + kindToPrint + ";"); ostr.println(prefix + "jjmatchedPos = " + i + ";"); ostr.println(" }"); } else ostr.println(prefix + "jjmatchedKind = " + kindToPrint + ";"); } } } } if (info.validKindCnt != 0) { atLeastOne = false; if (i == 0) { ostr.print(" return "); ostr.print("jjMoveStringLiteralDfa" + (i + 1) + LexGen.lexStateSuffix + "("); for (j = 0; j < maxLongsReqd - 1; j++) if ((i + 1) <= maxLenForActive[j]) { if (atLeastOne) ostr.print(", "); else atLeastOne = true; ostr.print("0x" + Long.toHexString(info.validKinds[j]) + "L"); } if ((i + 1) <= maxLenForActive[j]) { if (atLeastOne) ostr.print(", "); ostr.print("0x" + Long.toHexString(info.validKinds[j]) + "L"); } ostr.println(");"); } else { ostr.print(" return "); ostr.print("jjMoveStringLiteralDfa" + (i + 1) + LexGen.lexStateSuffix + "("); for (j = 0; j < maxLongsReqd - 1; j++) if ((i + 1) <= maxLenForActive[j] + 1) { if (atLeastOne) ostr.print(", "); else atLeastOne = true; if (info.validKinds[j] != 0L) ostr.print("active" + j + ", 0x" + Long.toHexString(info.validKinds[j]) + "L"); else ostr.print("active" + j + ", 0L"); } if ((i + 1) <= maxLenForActive[j] + 1) { if (atLeastOne) ostr.print(", "); if (info.validKinds[j] != 0L) ostr.print("active" + j + ", 0x" + Long.toHexString(info.validKinds[j]) + "L"); else ostr.print("active" + j + ", 0L"); } ostr.println(");"); } } else { // A very special case. if (i == 0 && LexGen.mixed[LexGen.lexStateIndex]) { if (NfaState.generatedStates != 0) ostr.println(" return jjMoveNfa" + LexGen.lexStateSuffix + "(" + NfaState.InitStateName() + ", 0);"); else ostr.println(" return 1;"); } else if (i != 0) // No more str literals to look for { ostr.println(" break;"); startNfaNeeded = true; } } } /* default means that the current character is not in any of the strings at this position. */ ostr.println(" default :"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(\" No string literal matches possible.\");"); if (NfaState.generatedStates != 0) { if (i == 0) { /* This means no string literal is possible. Just move nfa with this guy and return. */ ostr.println(" return jjMoveNfa" + LexGen.lexStateSuffix + "(" + NfaState.InitStateName() + ", 0);"); } else { ostr.println(" break;"); startNfaNeeded = true; } } else { ostr.println(" return " + (i + 1) + ";"); } ostr.println(" }"); if (i != 0) { if (startNfaNeeded) { if (!LexGen.mixed[LexGen.lexStateIndex] && NfaState.generatedStates != 0) { /* Here, a string literal is successfully matched and no more string literals are possible. So set the kind and state set upto and including this position for the matched string. */ ostr.print(" return jjStartNfa" + LexGen.lexStateSuffix + "(" + (i - 1) + ", "); for (k = 0; k < maxLongsReqd - 1; k++) if (i <= maxLenForActive[k]) ostr.print("active" + k + ", "); else ostr.print("0L, "); if (i <= maxLenForActive[k]) ostr.println("active" + k + ");"); else ostr.println("0L);"); } else if (NfaState.generatedStates != 0) ostr.println(" return jjMoveNfa" + LexGen.lexStateSuffix + "(" + NfaState.InitStateName() + ", " + i + ");"); else ostr.println(" return " + (i + 1) + ";"); } } ostr.println("}"); } if (!LexGen.mixed[LexGen.lexStateIndex] && NfaState.generatedStates != 0 && createStartNfa) DumpStartWithStates(ostr); } static final int GetStrKind(String str) { for (int i = 0; i < maxStrKind; i++) { if (LexGen.lexStates[i] != LexGen.lexStateIndex) continue; String image = allImages[i]; if (image != null && image.equals(str)) return i; } return Integer.MAX_VALUE; } static void GenerateNfaStartStates(java.io.PrintWriter ostr, NfaState initialState) { boolean[] seen = new boolean[NfaState.generatedStates]; Hashtable stateSets = new Hashtable(); String stateSetString = ""; int i, j, kind, jjmatchedPos = 0; int maxKindsReqd = maxStrKind / 64 + 1; long[] actives; List newStates = new ArrayList(); List oldStates = null, jjtmpStates; statesForPos = new Hashtable[maxLen]; intermediateKinds = new int[maxStrKind + 1][]; intermediateMatchedPos = new int[maxStrKind + 1][]; for (i = 0; i < maxStrKind; i++) { if (LexGen.lexStates[i] != LexGen.lexStateIndex) continue; String image = allImages[i]; if (image == null || image.length() < 1) continue; try { if ((oldStates = (List)initialState.epsilonMoves.clone()) == null || oldStates.size() == 0) { DumpNfaStartStatesCode(statesForPos, ostr); return; } } catch(Exception e) { JavaCCErrors.semantic_error("Error cloning state vector"); } intermediateKinds[i] = new int[image.length()]; intermediateMatchedPos[i] = new int[image.length()]; jjmatchedPos = 0; kind = Integer.MAX_VALUE; for (j = 0; j < image.length(); j++) { if (oldStates == null || oldStates.size() <= 0) { // Here, j > 0 kind = intermediateKinds[i][j] = intermediateKinds[i][j - 1]; jjmatchedPos = intermediateMatchedPos[i][j] = intermediateMatchedPos[i][j - 1]; } else { kind = NfaState.MoveFromSet(image.charAt(j), oldStates, newStates); oldStates.clear(); if (j == 0 && kind != Integer.MAX_VALUE && LexGen.canMatchAnyChar[LexGen.lexStateIndex] != -1 && kind > LexGen.canMatchAnyChar[LexGen.lexStateIndex]) kind = LexGen.canMatchAnyChar[LexGen.lexStateIndex]; if (GetStrKind(image.substring(0, j + 1)) < kind) { intermediateKinds[i][j] = kind = Integer.MAX_VALUE; jjmatchedPos = 0; } else if (kind != Integer.MAX_VALUE) { intermediateKinds[i][j] = kind; jjmatchedPos = intermediateMatchedPos[i][j] = j; } else if (j == 0) kind = intermediateKinds[i][j] = Integer.MAX_VALUE; else { kind = intermediateKinds[i][j] = intermediateKinds[i][j - 1]; jjmatchedPos = intermediateMatchedPos[i][j] = intermediateMatchedPos[i][j - 1]; } stateSetString = NfaState.GetStateSetString(newStates); } if (kind == Integer.MAX_VALUE && (newStates == null || newStates.size() == 0)) continue; int p; if (stateSets.get(stateSetString) == null) { stateSets.put(stateSetString, stateSetString); for (p = 0; p < newStates.size(); p++) { if (seen[((NfaState)newStates.get(p)).stateName]) ((NfaState)newStates.get(p)).inNextOf++; else seen[((NfaState)newStates.get(p)).stateName] = true; } } else { for (p = 0; p < newStates.size(); p++) seen[((NfaState)newStates.get(p)).stateName] = true; } jjtmpStates = oldStates; oldStates = newStates; (newStates = jjtmpStates).clear(); if (statesForPos[j] == null) statesForPos[j] = new Hashtable(); if ((actives = ((long[])statesForPos[j].get(kind + ", " + jjmatchedPos + ", " + stateSetString))) == null) { actives = new long[maxKindsReqd]; statesForPos[j].put(kind + ", " + jjmatchedPos + ", " + stateSetString, actives); } actives[i / 64] |= 1L << (i % 64); //String name = NfaState.StoreStateSet(stateSetString); } } DumpNfaStartStatesCode(statesForPos, ostr); } static void DumpNfaStartStatesCode(Hashtable[] statesForPos, java.io.PrintWriter ostr) { if (maxStrKind == 0) { // No need to generate this function return; } int i, maxKindsReqd = maxStrKind / 64 + 1; boolean condGenerated = false; int ind = 0; ostr.print("private" + (Options.getStatic() ? " static" : "") + " final int jjStopStringLiteralDfa" + LexGen.lexStateSuffix + "(int pos, "); for (i = 0; i < maxKindsReqd - 1; i++) ostr.print("long active" + i + ", "); ostr.println("long active" + i + ")\n{"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(\" No more string literal token matches are possible.\");"); ostr.println(" switch (pos)\n {"); for (i = 0; i < maxLen - 1; i++) { if (statesForPos[i] == null) continue; ostr.println(" case " + i + ":"); Enumeration e = statesForPos[i].keys(); while (e.hasMoreElements()) { String stateSetString = (String)e.nextElement(); long[] actives = (long[])statesForPos[i].get(stateSetString); for (int j = 0; j < maxKindsReqd; j++) { if (actives[j] == 0L) continue; if (condGenerated) ostr.print(" || "); else ostr.print(" if ("); condGenerated = true; ostr.print("(active" + j + " & 0x" + Long.toHexString(actives[j]) + "L) != 0L"); } if (condGenerated) { ostr.println(")"); String kindStr = stateSetString.substring(0, ind = stateSetString.indexOf(", ")); String afterKind = stateSetString.substring(ind + 2); int jjmatchedPos = Integer.parseInt( afterKind.substring(0, afterKind.indexOf(", "))); if (!kindStr.equals(String.valueOf(Integer.MAX_VALUE))) ostr.println(" {"); if (!kindStr.equals(String.valueOf(Integer.MAX_VALUE))) { if (i == 0) { ostr.println(" jjmatchedKind = " + kindStr + ";"); if ((LexGen.initMatch[LexGen.lexStateIndex] != 0 && LexGen.initMatch[LexGen.lexStateIndex] != Integer.MAX_VALUE)) ostr.println(" jjmatchedPos = 0;"); } else if (i == jjmatchedPos) { if (subStringAtPos[i]) { ostr.println(" if (jjmatchedPos != " + i + ")"); ostr.println(" {"); ostr.println(" jjmatchedKind = " + kindStr + ";"); ostr.println(" jjmatchedPos = " + i + ";"); ostr.println(" }"); } else { ostr.println(" jjmatchedKind = " + kindStr + ";"); ostr.println(" jjmatchedPos = " + i + ";"); } } else { if (jjmatchedPos > 0) ostr.println(" if (jjmatchedPos < " + jjmatchedPos + ")"); else ostr.println(" if (jjmatchedPos == 0)"); ostr.println(" {"); ostr.println(" jjmatchedKind = " + kindStr + ";"); ostr.println(" jjmatchedPos = " + jjmatchedPos + ";"); ostr.println(" }"); } } kindStr = stateSetString.substring(0, ind = stateSetString.indexOf(", ")); afterKind = stateSetString.substring(ind + 2); stateSetString = afterKind.substring( afterKind.indexOf(", ") + 2); if (stateSetString.equals("null;")) ostr.println(" return -1;"); else ostr.println(" return " + NfaState.AddStartStateSet(stateSetString) + ";"); if (!kindStr.equals(String.valueOf(Integer.MAX_VALUE))) ostr.println(" }"); condGenerated = false; } } ostr.println(" return -1;"); } ostr.println(" default :"); ostr.println(" return -1;"); ostr.println(" }"); ostr.println("}"); ostr.print("private" + (Options.getStatic() ? " static" : "") + " final int jjStartNfa" + LexGen.lexStateSuffix + "(int pos, "); for (i = 0; i < maxKindsReqd - 1; i++) ostr.print("long active" + i + ", "); ostr.println("long active" + i + ")\n{"); if (LexGen.mixed[LexGen.lexStateIndex]) { if (NfaState.generatedStates != 0) ostr.println(" return jjMoveNfa" + LexGen.lexStateSuffix + "(" + NfaState.InitStateName() + ", pos + 1);"); else ostr.println(" return pos + 1;"); ostr.println("}"); return; } ostr.print(" return jjMoveNfa" + LexGen.lexStateSuffix + "(" + "jjStopStringLiteralDfa" + LexGen.lexStateSuffix + "(pos, "); for (i = 0; i < maxKindsReqd - 1; i++) ostr.print("active" + i + ", "); ostr.print("active" + i + ")"); ostr.println(", pos + 1);"); ostr.println("}"); } /** * Return to original state. */ public static void reInit() { ReInit(); charCnt = 0; allImages = null; boilerPlateDumped = false; } public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = super.dump(indent, alreadyDumped).append(' ').append(image); return sb; } public String toString() { return super.toString() + " - " + image; } } javacc-5.0.orig/src/org/javacc/parser/RZeroOrMore.java0000644000175000017500000000462111070513745021667 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Describes zero-or-more regular expressions (). */ public class RZeroOrMore extends RegularExpression { /** * The regular expression which is repeated zero or more times. */ public RegularExpression regexpr; public Nfa GenerateNfa(boolean ignoreCase) { Nfa retVal = new Nfa(); NfaState startState = retVal.start; NfaState finalState = retVal.end; Nfa temp = regexpr.GenerateNfa(ignoreCase); startState.AddMove(temp.start); startState.AddMove(finalState); temp.end.AddMove(finalState); temp.end.AddMove(temp.start); return retVal; } public RZeroOrMore() {} public RZeroOrMore(Token t, RegularExpression r) { this.setLine(t.beginLine); this.setColumn(t.beginColumn); this.regexpr = r; } } javacc-5.0.orig/src/org/javacc/parser/Main.java0000644000175000017500000002330211146612644020365 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Entry point. */ public final class Main { private Main() {} static void help_message() { System.out.println("Usage:"); System.out.println(" javacc option-settings inputfile"); System.out.println(""); System.out.println("\"option-settings\" is a sequence of settings separated by spaces."); System.out.println("Each option setting must be of one of the following forms:"); System.out.println(""); System.out.println(" -optionname=value (e.g., -STATIC=false)"); System.out.println(" -optionname:value (e.g., -STATIC:false)"); System.out.println(" -optionname (equivalent to -optionname=true. e.g., -STATIC)"); System.out.println(" -NOoptionname (equivalent to -optionname=false. e.g., -NOSTATIC)"); System.out.println(""); System.out.println("Option settings are not case-sensitive, so one can say \"-nOsTaTiC\" instead"); System.out.println("of \"-NOSTATIC\". Option values must be appropriate for the corresponding"); System.out.println("option, and must be either an integer, a boolean, or a string value."); System.out.println(""); System.out.println("The integer valued options are:"); System.out.println(""); System.out.println(" LOOKAHEAD (default 1)"); System.out.println(" CHOICE_AMBIGUITY_CHECK (default 2)"); System.out.println(" OTHER_AMBIGUITY_CHECK (default 1)"); System.out.println(""); System.out.println("The boolean valued options are:"); System.out.println(""); System.out.println(" STATIC (default true)"); System.out.println(" SUPPORT_CLASS_VISIBILITY_PUBLIC (default true)"); System.out.println(" DEBUG_PARSER (default false)"); System.out.println(" DEBUG_LOOKAHEAD (default false)"); System.out.println(" DEBUG_TOKEN_MANAGER (default false)"); System.out.println(" ERROR_REPORTING (default true)"); System.out.println(" JAVA_UNICODE_ESCAPE (default false)"); System.out.println(" UNICODE_INPUT (default false)"); System.out.println(" IGNORE_CASE (default false)"); System.out.println(" COMMON_TOKEN_ACTION (default false)"); System.out.println(" USER_TOKEN_MANAGER (default false)"); System.out.println(" USER_CHAR_STREAM (default false)"); System.out.println(" BUILD_PARSER (default true)"); System.out.println(" BUILD_TOKEN_MANAGER (default true)"); System.out.println(" TOKEN_MANAGER_USES_PARSER (default false)"); System.out.println(" SANITY_CHECK (default true)"); System.out.println(" FORCE_LA_CHECK (default false)"); System.out.println(" CACHE_TOKENS (default false)"); System.out.println(" KEEP_LINE_COLUMN (default true)"); System.out.println(""); System.out.println("The string valued options are:"); System.out.println(""); System.out.println(" OUTPUT_DIRECTORY (default Current Directory)"); System.out.println(" TOKEN_EXTENDS (default java.lang.Object)"); System.out.println(" TOKEN_FACTORY (default none)"); System.out.println(" JDK_VERSION (default 1.5)"); System.out.println(" GRAMMAR_ENCODING (defaults to platform file encoding)"); System.out.println(""); System.out.println("EXAMPLE:"); System.out.println(" javacc -STATIC=false -LOOKAHEAD:2 -debug_parser mygrammar.jj"); System.out.println(""); } /** * A main program that exercises the parser. */ public static void main(String args[]) throws Exception { int errorcode = mainProgram(args); System.exit(errorcode); } /** * The method to call to exercise the parser from other Java programs. * It returns an error code. See how the main program above uses * this method. */ public static int mainProgram(String args[]) throws Exception { // Initialize all static state reInitAll(); JavaCCGlobals.bannerLine("Parser Generator", ""); JavaCCParser parser = null; if (args.length == 0) { System.out.println(""); help_message(); return 1; } else { System.out.println("(type \"javacc\" with no arguments for help)"); } if (Options.isOption(args[args.length-1])) { System.out.println("Last argument \"" + args[args.length-1] + "\" is not a filename."); return 1; } for (int arg = 0; arg < args.length-1; arg++) { if (!Options.isOption(args[arg])) { System.out.println("Argument \"" + args[arg] + "\" must be an option setting."); return 1; } Options.setCmdLineOption(args[arg]); } try { java.io.File fp = new java.io.File(args[args.length-1]); if (!fp.exists()) { System.out.println("File " + args[args.length-1] + " not found."); return 1; } if (fp.isDirectory()) { System.out.println(args[args.length-1] + " is a directory. Please use a valid file name."); return 1; } parser = new JavaCCParser(new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(args[args.length-1]), Options.getGrammarEncoding()))); } catch (SecurityException se) { System.out.println("Security violation while trying to open " + args[args.length-1]); return 1; } catch (java.io.FileNotFoundException e) { System.out.println("File " + args[args.length-1] + " not found."); return 1; } try { System.out.println("Reading from file " + args[args.length-1] + " . . ."); JavaCCGlobals.fileName = JavaCCGlobals.origFileName = args[args.length-1]; JavaCCGlobals.jjtreeGenerated = JavaCCGlobals.isGeneratedBy("JJTree", args[args.length-1]); JavaCCGlobals.toolNames = JavaCCGlobals.getToolNames(args[args.length-1]); parser.javacc_input(); JavaCCGlobals.createOutputDir(Options.getOutputDirectory()); if (Options.getUnicodeInput()) { NfaState.unicodeWarningGiven = true; System.out.println("Note: UNICODE_INPUT option is specified. " + "Please make sure you create the parser/lexer using a Reader with the correct character encoding."); } Semanticize.start(); ParseGen.start(); LexGen.start(); OtherFilesGen.start(); if ((JavaCCErrors.get_error_count() == 0) && (Options.getBuildParser() || Options.getBuildTokenManager())) { if (JavaCCErrors.get_warning_count() == 0) { System.out.println("Parser generated successfully."); } else { System.out.println("Parser generated with 0 errors and " + JavaCCErrors.get_warning_count() + " warnings."); } return 0; } else { System.out.println("Detected " + JavaCCErrors.get_error_count() + " errors and " + JavaCCErrors.get_warning_count() + " warnings."); return (JavaCCErrors.get_error_count()==0)?0:1; } } catch (MetaParseException e) { System.out.println("Detected " + JavaCCErrors.get_error_count() + " errors and " + JavaCCErrors.get_warning_count() + " warnings."); return 1; } catch (ParseException e) { System.out.println(e.toString()); System.out.println("Detected " + (JavaCCErrors.get_error_count()+1) + " errors and " + JavaCCErrors.get_warning_count() + " warnings."); return 1; } } public static void reInitAll() { org.javacc.parser.Expansion.reInit(); org.javacc.parser.JavaCCErrors.reInit(); org.javacc.parser.JavaCCGlobals.reInit(); Options.init(); org.javacc.parser.JavaCCParserInternals.reInit(); org.javacc.parser.RStringLiteral.reInit(); org.javacc.parser.JavaFiles.reInit(); org.javacc.parser.LexGen.reInit(); org.javacc.parser.NfaState.reInit(); org.javacc.parser.MatchInfo.reInit(); org.javacc.parser.LookaheadWalk.reInit(); org.javacc.parser.Semanticize.reInit(); org.javacc.parser.ParseGen.reInit(); org.javacc.parser.OtherFilesGen.reInit(); org.javacc.parser.ParseEngine.reInit(); } } javacc-5.0.orig/src/org/javacc/parser/package.html0000644000175000017500000000062010575555142021121 0ustar mkochmkoch org.javacc.parser

A grammar and lexer generator.

javacc-5.0.orig/src/org/javacc/parser/TreeWalkerOp.java0000644000175000017500000000403010574036604022042 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Objects of this type are passed to the tree walker * routines in ExpansionTreeWalker. */ public interface TreeWalkerOp { /** * When called at a particular node, this specifies to the * tree walker if it should visit more nodes under this node. */ boolean goDeeper(Expansion e); /** * When a node is visited, this method is invoked with the * node as parameter. */ void action(Expansion e); } javacc-5.0.orig/src/org/javacc/parser/Token.java0000644000175000017500000001007710752436446020574 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */ /** * This file contains the code for JavaCCParser generated * by JavaCCParser itself. */ package org.javacc.parser; /** * Describes the input token stream. */ public class Token { /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument contructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use it in your lexical actions. */ public static final Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); case JavaCCParserConstants.RUNSIGNEDSHIFT: case JavaCCParserConstants.RSIGNEDSHIFT: case JavaCCParserConstants.GT: return new GTToken(ofKind, image); } } public static final Token newToken(int ofKind) { return newToken(ofKind, null); } /** * Greater than Token. */ public static class GTToken extends Token { public GTToken(int kind, String image) { super(kind, image); } int realKind = JavaCCParserConstants.GT; } } javacc-5.0.orig/src/org/javacc/parser/build.xml0000644000175000017500000000654611102170714020457 0ustar mkochmkoch javacc-5.0.orig/src/org/javacc/parser/RZeroOrOne.java0000644000175000017500000000425310574036603021510 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Describes zero-or-one regular expressions (). */ public class RZeroOrOne extends RegularExpression { /** * The regular expression which is repeated zero or one times. */ public RegularExpression regexpr; public Nfa GenerateNfa(boolean ignoreCase) { Nfa retVal = new Nfa(); NfaState startState = retVal.start; NfaState finalState = retVal.end; Nfa temp = regexpr.GenerateNfa(ignoreCase); startState.AddMove(temp.start); startState.AddMove(finalState); temp.end.AddMove(finalState); return retVal; } } javacc-5.0.orig/src/org/javacc/parser/Sequence.java0000644000175000017500000000531411070513745021252 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; /** * Describes expansions that are sequences of expansion * units. (c1 c2 ...) */ public class Sequence extends Expansion { /** * The list of units in this expansion sequence. Each * List component will narrow to Expansion. */ public List units = new ArrayList(); public Sequence() {} public Sequence(Token token, Lookahead lookahead) { this.setLine(token.beginLine); this.setColumn(token.beginColumn); this.units.add(lookahead); } public StringBuffer dump(int indent, Set alreadyDumped) { if (alreadyDumped.contains(this)) { return super.dump(0, alreadyDumped).insert(0, '[').append(']').insert(0, dumpPrefix(indent)); } alreadyDumped.add(this); final StringBuffer sb = super.dump(indent, alreadyDumped); for (Iterator it = units.iterator(); it.hasNext(); ) { Expansion next = (Expansion)it.next(); sb.append(eol).append(next.dump(indent + 1, alreadyDumped)); } return sb; } } javacc-5.0.orig/src/org/javacc/parser/LexGen.java0000644000175000017500000015571311070513744020674 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.io.File; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.List; /** * Generate lexer. */ public class LexGen extends JavaCCGlobals implements JavaCCParserConstants { static private java.io.PrintWriter ostr; static private String staticString; static private String tokMgrClassName; // Hashtable of vectors static Hashtable allTpsForState = new Hashtable(); public static int lexStateIndex = 0; static int[] kinds; public static int maxOrdinal = 1; public static String lexStateSuffix; static String[] newLexState; public static int[] lexStates; public static boolean[] ignoreCase; public static Action[] actions; public static Hashtable initStates = new Hashtable(); public static int stateSetSize; public static int maxLexStates; public static String[] lexStateName; static NfaState[] singlesToSkip; public static long[] toSkip; public static long[] toSpecial; public static long[] toMore; public static long[] toToken; public static int defaultLexState; public static RegularExpression[] rexprs; public static int[] maxLongsReqd; public static int[] initMatch; public static int[] canMatchAnyChar; public static boolean hasEmptyMatch; public static boolean[] canLoop; public static boolean[] stateHasActions; public static boolean hasLoop = false; public static boolean[] canReachOnMore; public static boolean[] hasNfa; public static boolean[] mixed; public static NfaState initialState; public static int curKind; static boolean hasSkipActions = false; static boolean hasMoreActions = false; static boolean hasTokenActions = false; static boolean hasSpecial = false; static boolean hasSkip = false; static boolean hasMore = false; public static RegularExpression curRE; public static boolean keepLineCol; static void PrintClassHead() { int i, j; try { File tmp = new File(Options.getOutputDirectory(), tokMgrClassName + ".java"); ostr = new java.io.PrintWriter( new java.io.BufferedWriter( new java.io.FileWriter(tmp), 8092 ) ); List tn = new ArrayList(toolNames); tn.add(toolName); ostr.println("/* " + getIdString(tn, tokMgrClassName + ".java") + " */"); int l = 0, kind; i = 1; for (;;) { if (cu_to_insertion_point_1.size() <= l) break; kind = ((Token)cu_to_insertion_point_1.get(l)).kind; if(kind == PACKAGE || kind == IMPORT) { for (; i < cu_to_insertion_point_1.size(); i++) { kind = ((Token)cu_to_insertion_point_1.get(i)).kind; if (kind == SEMICOLON || kind == ABSTRACT || kind == FINAL || kind == PUBLIC || kind == CLASS || kind == INTERFACE) { cline = ((Token)(cu_to_insertion_point_1.get(l))).beginLine; ccol = ((Token)(cu_to_insertion_point_1.get(l))).beginColumn; for (j = l; j < i; j++) { printToken((Token)(cu_to_insertion_point_1.get(j)), ostr); } if (kind == SEMICOLON) printToken((Token)(cu_to_insertion_point_1.get(j)), ostr); ostr.println(""); break; } } l = ++i; } else break; } ostr.println(""); ostr.println("/** Token Manager. */"); if(Options.getSupportClassVisibilityPublic()) { ostr.print("public "); } ostr.println("class " + tokMgrClassName + " implements " + cu_name + "Constants"); ostr.println("{"); // } } catch (java.io.IOException err) { JavaCCErrors.semantic_error("Could not create file : " + tokMgrClassName + ".java\n"); throw new Error(); } if (token_mgr_decls != null && token_mgr_decls.size() > 0) { Token t = (Token)token_mgr_decls.get(0); boolean commonTokenActionSeen = false; boolean commonTokenActionNeeded = Options.getCommonTokenAction(); printTokenSetup((Token)token_mgr_decls.get(0)); ccol = 1; for (j = 0; j < token_mgr_decls.size(); j++) { t = (Token)token_mgr_decls.get(j); if (t.kind == IDENTIFIER && commonTokenActionNeeded && !commonTokenActionSeen) commonTokenActionSeen = t.image.equals("CommonTokenAction"); printToken(t, ostr); } ostr.println(""); if (commonTokenActionNeeded && !commonTokenActionSeen) JavaCCErrors.warning("You have the COMMON_TOKEN_ACTION option set. " + "But it appears you have not defined the method :\n"+ " " + staticString + "void CommonTokenAction(Token t)\n" + "in your TOKEN_MGR_DECLS. The generated token manager will not compile."); } else if (Options.getCommonTokenAction()) { JavaCCErrors.warning("You have the COMMON_TOKEN_ACTION option set. " + "But you have not defined the method :\n"+ " " + staticString + "void CommonTokenAction(Token t)\n" + "in your TOKEN_MGR_DECLS. The generated token manager will not compile."); } ostr.println(""); ostr.println(" /** Debug output. */"); ostr.println(" public " + staticString + " java.io.PrintStream debugStream = System.out;"); ostr.println(" /** Set debug output. */"); ostr.println(" public " + staticString + " void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }"); if(Options.getTokenManagerUsesParser() && !Options.getStatic()){ ostr.println(""); ostr.println(" /** The parser. */"); ostr.println(" public " + cu_name + " parser = null;"); } } static void DumpDebugMethods() { ostr.println(" " + staticString + " int kindCnt = 0;"); ostr.println(" protected " + staticString + " final String jjKindsForBitVector(int i, long vec)"); ostr.println(" {"); ostr.println(" String retVal = \"\";"); ostr.println(" if (i == 0)"); ostr.println(" kindCnt = 0;"); ostr.println(" for (int j = 0; j < 64; j++)"); ostr.println(" {"); ostr.println(" if ((vec & (1L << j)) != 0L)"); ostr.println(" {"); ostr.println(" if (kindCnt++ > 0)"); ostr.println(" retVal += \", \";"); ostr.println(" if (kindCnt % 5 == 0)"); ostr.println(" retVal += \"\\n \";"); ostr.println(" retVal += tokenImage[i * 64 + j];"); ostr.println(" }"); ostr.println(" }"); ostr.println(" return retVal;"); ostr.println(" }"); ostr.println(""); ostr.println(" protected " + staticString + " final String jjKindsForStateVector(" + "int lexState, int[] vec, int start, int end)"); ostr.println(" {"); ostr.println(" boolean[] kindDone = new boolean[" + maxOrdinal + "];"); ostr.println(" String retVal = \"\";"); ostr.println(" int cnt = 0;"); ostr.println(" for (int i = start; i < end; i++)"); ostr.println(" {"); ostr.println(" if (vec[i] == -1)"); ostr.println(" continue;"); ostr.println(" int[] stateSet = statesForState[curLexState][vec[i]];"); ostr.println(" for (int j = 0; j < stateSet.length; j++)"); ostr.println(" {"); ostr.println(" int state = stateSet[j];"); ostr.println(" if (!kindDone[kindForState[lexState][state]])"); ostr.println(" {"); ostr.println(" kindDone[kindForState[lexState][state]] = true;"); ostr.println(" if (cnt++ > 0)"); ostr.println(" retVal += \", \";"); ostr.println(" if (cnt % 5 == 0)"); ostr.println(" retVal += \"\\n \";"); ostr.println(" retVal += tokenImage[kindForState[lexState][state]];"); ostr.println(" }"); ostr.println(" }"); ostr.println(" }"); ostr.println(" if (cnt == 0)"); ostr.println(" return \"{ }\";"); ostr.println(" else"); ostr.println(" return \"{ \" + retVal + \" }\";"); ostr.println(" }"); ostr.println(""); } static void BuildLexStatesTable() { Iterator it = rexprlist.iterator(); TokenProduction tp; int i; String[] tmpLexStateName = new String[lexstate_I2S.size()]; while (it.hasNext()) { tp = (TokenProduction)it.next(); List respecs = tp.respecs; List tps; for (i = 0; i < tp.lexStates.length; i++) { if ((tps = (List)allTpsForState.get(tp.lexStates[i])) == null) { tmpLexStateName[maxLexStates++] = tp.lexStates[i]; allTpsForState.put(tp.lexStates[i], tps = new ArrayList()); } tps.add(tp); } if (respecs == null || respecs.size() == 0) continue; RegularExpression re; for (i = 0; i < respecs.size(); i++) if (maxOrdinal <= (re = ((RegExprSpec)respecs.get(i)).rexp).ordinal) maxOrdinal = re.ordinal + 1; } kinds = new int[maxOrdinal]; toSkip = new long[maxOrdinal / 64 + 1]; toSpecial = new long[maxOrdinal / 64 + 1]; toMore = new long[maxOrdinal / 64 + 1]; toToken = new long[maxOrdinal / 64 + 1]; toToken[0] = 1L; actions = new Action[maxOrdinal]; actions[0] = actForEof; hasTokenActions = actForEof != null; initStates = new Hashtable(); canMatchAnyChar = new int[maxLexStates]; canLoop = new boolean[maxLexStates]; stateHasActions = new boolean[maxLexStates]; lexStateName = new String[maxLexStates]; singlesToSkip = new NfaState[maxLexStates]; System.arraycopy(tmpLexStateName, 0, lexStateName, 0, maxLexStates); for (i = 0; i < maxLexStates; i++) canMatchAnyChar[i] = -1; hasNfa = new boolean[maxLexStates]; mixed = new boolean[maxLexStates]; maxLongsReqd = new int[maxLexStates]; initMatch = new int[maxLexStates]; newLexState = new String[maxOrdinal]; newLexState[0] = nextStateForEof; hasEmptyMatch = false; lexStates = new int[maxOrdinal]; ignoreCase = new boolean[maxOrdinal]; rexprs = new RegularExpression[maxOrdinal]; RStringLiteral.allImages = new String[maxOrdinal]; canReachOnMore = new boolean[maxLexStates]; } static int GetIndex(String name) { for (int i = 0; i < lexStateName.length; i++) if (lexStateName[i] != null && lexStateName[i].equals(name)) return i; throw new Error(); // Should never come here } public static void AddCharToSkip(char c, int kind) { singlesToSkip[lexStateIndex].AddChar(c); singlesToSkip[lexStateIndex].kind = kind; } public static void start() { if (!Options.getBuildTokenManager() || Options.getUserTokenManager() || JavaCCErrors.get_error_count() > 0) return; keepLineCol = Options.getKeepLineColumn(); List choices = new ArrayList(); Enumeration e; TokenProduction tp; int i, j; staticString = (Options.getStatic() ? "static " : ""); tokMgrClassName = cu_name + "TokenManager"; PrintClassHead(); BuildLexStatesTable(); e = allTpsForState.keys(); boolean ignoring = false; while (e.hasMoreElements()) { NfaState.ReInit(); RStringLiteral.ReInit(); String key = (String)e.nextElement(); lexStateIndex = GetIndex(key); lexStateSuffix = "_" + lexStateIndex; List allTps = (List)allTpsForState.get(key); initStates.put(key, initialState = new NfaState()); ignoring = false; singlesToSkip[lexStateIndex] = new NfaState(); singlesToSkip[lexStateIndex].dummy = true; if (key.equals("DEFAULT")) defaultLexState = lexStateIndex; for (i = 0; i < allTps.size(); i++) { tp = (TokenProduction)allTps.get(i); int kind = tp.kind; boolean ignore = tp.ignoreCase; List rexps = tp.respecs; if (i == 0) ignoring = ignore; for (j = 0; j < rexps.size(); j++) { RegExprSpec respec = (RegExprSpec)rexps.get(j); curRE = respec.rexp; rexprs[curKind = curRE.ordinal] = curRE; lexStates[curRE.ordinal] = lexStateIndex; ignoreCase[curRE.ordinal] = ignore; if (curRE.private_rexp) { kinds[curRE.ordinal] = -1; continue; } if (curRE instanceof RStringLiteral && !((RStringLiteral)curRE).image.equals("")) { ((RStringLiteral)curRE).GenerateDfa(ostr, curRE.ordinal); if (i != 0 && !mixed[lexStateIndex] && ignoring != ignore) mixed[lexStateIndex] = true; } else if (curRE.CanMatchAnyChar()) { if (canMatchAnyChar[lexStateIndex] == -1 || canMatchAnyChar[lexStateIndex] > curRE.ordinal) canMatchAnyChar[lexStateIndex] = curRE.ordinal; } else { Nfa temp; if (curRE instanceof RChoice) choices.add(curRE); temp = curRE.GenerateNfa(ignore); temp.end.isFinal = true; temp.end.kind = curRE.ordinal; initialState.AddMove(temp.start); } if (kinds.length < curRE.ordinal) { int[] tmp = new int[curRE.ordinal + 1]; System.arraycopy(kinds, 0, tmp, 0, kinds.length); kinds = tmp; } //System.out.println(" ordina : " + curRE.ordinal); kinds[curRE.ordinal] = kind; if (respec.nextState != null && !respec.nextState.equals(lexStateName[lexStateIndex])) newLexState[curRE.ordinal] = respec.nextState; if (respec.act != null && respec.act.getActionTokens() != null && respec.act.getActionTokens().size() > 0) actions[curRE.ordinal] = respec.act; switch(kind) { case TokenProduction.SPECIAL : hasSkipActions |= (actions[curRE.ordinal] != null) || (newLexState[curRE.ordinal] != null); hasSpecial = true; toSpecial[curRE.ordinal / 64] |= 1L << (curRE.ordinal % 64); toSkip[curRE.ordinal / 64] |= 1L << (curRE.ordinal % 64); break; case TokenProduction.SKIP : hasSkipActions |= (actions[curRE.ordinal] != null); hasSkip = true; toSkip[curRE.ordinal / 64] |= 1L << (curRE.ordinal % 64); break; case TokenProduction.MORE : hasMoreActions |= (actions[curRE.ordinal] != null); hasMore = true; toMore[curRE.ordinal / 64] |= 1L << (curRE.ordinal % 64); if (newLexState[curRE.ordinal] != null) canReachOnMore[GetIndex(newLexState[curRE.ordinal])] = true; else canReachOnMore[lexStateIndex] = true; break; case TokenProduction.TOKEN : hasTokenActions |= (actions[curRE.ordinal] != null); toToken[curRE.ordinal / 64] |= 1L << (curRE.ordinal % 64); break; } } } // Generate a static block for initializing the nfa transitions NfaState.ComputeClosures(); for (i = 0; i < initialState.epsilonMoves.size(); i++) ((NfaState)initialState.epsilonMoves.elementAt(i)).GenerateCode(); if (hasNfa[lexStateIndex] = (NfaState.generatedStates != 0)) { initialState.GenerateCode(); initialState.GenerateInitMoves(ostr); } if (initialState.kind != Integer.MAX_VALUE && initialState.kind != 0) { if ((toSkip[initialState.kind / 64] & (1L << initialState.kind)) != 0L || (toSpecial[initialState.kind / 64] & (1L << initialState.kind)) != 0L) hasSkipActions = true; else if ((toMore[initialState.kind / 64] & (1L << initialState.kind)) != 0L) hasMoreActions = true; else hasTokenActions = true; if (initMatch[lexStateIndex] == 0 || initMatch[lexStateIndex] > initialState.kind) { initMatch[lexStateIndex] = initialState.kind; hasEmptyMatch = true; } } else if (initMatch[lexStateIndex] == 0) initMatch[lexStateIndex] = Integer.MAX_VALUE; RStringLiteral.FillSubString(); if (hasNfa[lexStateIndex] && !mixed[lexStateIndex]) RStringLiteral.GenerateNfaStartStates(ostr, initialState); RStringLiteral.DumpDfaCode(ostr); if (hasNfa[lexStateIndex]) NfaState.DumpMoveNfa(ostr); if (stateSetSize < NfaState.generatedStates) stateSetSize = NfaState.generatedStates; } for (i = 0; i < choices.size(); i++) ((RChoice)choices.get(i)).CheckUnmatchability(); NfaState.DumpStateSets(ostr); CheckEmptyStringMatch(); NfaState.DumpNonAsciiMoveMethods(ostr); RStringLiteral.DumpStrLiteralImages(ostr); DumpStaticVarDeclarations(); DumpFillToken(); DumpGetNextToken(); if (Options.getDebugTokenManager()) { NfaState.DumpStatesForKind(ostr); DumpDebugMethods(); } if (hasLoop) { ostr.println(staticString + "int[] jjemptyLineNo = new int[" + maxLexStates + "];"); ostr.println(staticString + "int[] jjemptyColNo = new int[" + maxLexStates + "];"); ostr.println(staticString + "boolean[] jjbeenHere = new boolean[" + maxLexStates + "];"); } if (hasSkipActions) DumpSkipActions(); if (hasMoreActions) DumpMoreActions(); if (hasTokenActions) DumpTokenActions(); NfaState.PrintBoilerPlate(ostr); ostr.println(/*{*/ "}"); ostr.close(); } static void CheckEmptyStringMatch() { int i, j, k, len; boolean[] seen = new boolean[maxLexStates]; boolean[] done = new boolean[maxLexStates]; String cycle; String reList; Outer: for (i = 0; i < maxLexStates; i++) { if (done[i] || initMatch[i] == 0 || initMatch[i] == Integer.MAX_VALUE || canMatchAnyChar[i] != -1) continue; done[i] = true; len = 0; cycle = ""; reList = ""; for (k = 0; k < maxLexStates; k++) seen[k] = false; j = i; seen[i] = true; cycle += lexStateName[j] + "-->"; while (newLexState[initMatch[j]] != null) { cycle += newLexState[initMatch[j]]; if (seen[j = GetIndex(newLexState[initMatch[j]])]) break; cycle += "-->"; done[j] = true; seen[j] = true; if (initMatch[j] == 0 || initMatch[j] == Integer.MAX_VALUE || canMatchAnyChar[j] != -1) continue Outer; if (len != 0) reList += "; "; reList += "line " + rexprs[initMatch[j]].getLine() + ", column " + rexprs[initMatch[j]].getColumn(); len++; } if (newLexState[initMatch[j]] == null) cycle += lexStateName[lexStates[initMatch[j]]]; for (k = 0; k < maxLexStates; k++) canLoop[k] |= seen[k]; hasLoop = true; if (len == 0) JavaCCErrors.warning(rexprs[initMatch[i]], "Regular expression" + ((rexprs[initMatch[i]].label.equals("")) ? "" : (" for " + rexprs[initMatch[i]].label)) + " can be matched by the empty string (\"\") in lexical state " + lexStateName[i] + ". This can result in an endless loop of " + "empty string matches."); else { JavaCCErrors.warning(rexprs[initMatch[i]], "Regular expression" + ((rexprs[initMatch[i]].label.equals("")) ? "" : (" for " + rexprs[initMatch[i]].label)) + " can be matched by the empty string (\"\") in lexical state " + lexStateName[i] + ". This regular expression along with the " + "regular expressions at " + reList + " forms the cycle \n " + cycle + "\ncontaining regular expressions with empty matches." + " This can result in an endless loop of empty string matches."); } } } static void PrintArrayInitializer(int noElems) { ostr.print("{"); for (int i = 0; i < noElems; i++) { if (i % 25 == 0) ostr.print("\n "); ostr.print("0, "); } ostr.println("\n};"); } static void DumpStaticVarDeclarations() { int i; String charStreamName; ostr.println(""); ostr.println("/** Lexer state names. */"); ostr.println("public static final String[] lexStateNames = {"); for (i = 0; i < maxLexStates; i++) ostr.println(" \"" + lexStateName[i] + "\","); ostr.println("};"); if (maxLexStates > 1) { ostr.println(""); ostr.println("/** Lex State array. */"); ostr.print("public static final int[] jjnewLexState = {"); for (i = 0; i < maxOrdinal; i++) { if (i % 25 == 0) ostr.print("\n "); if (newLexState[i] == null) ostr.print("-1, "); else ostr.print(GetIndex(newLexState[i]) + ", "); } ostr.println("\n};"); } if (hasSkip || hasMore || hasSpecial) { // Bit vector for TOKEN ostr.print("static final long[] jjtoToken = {"); for (i = 0; i < maxOrdinal / 64 + 1; i++) { if (i % 4 == 0) ostr.print("\n "); ostr.print("0x" + Long.toHexString(toToken[i]) + "L, "); } ostr.println("\n};"); } if (hasSkip || hasSpecial) { // Bit vector for SKIP ostr.print("static final long[] jjtoSkip = {"); for (i = 0; i < maxOrdinal / 64 + 1; i++) { if (i % 4 == 0) ostr.print("\n "); ostr.print("0x" + Long.toHexString(toSkip[i]) + "L, "); } ostr.println("\n};"); } if (hasSpecial) { // Bit vector for SPECIAL ostr.print("static final long[] jjtoSpecial = {"); for (i = 0; i < maxOrdinal / 64 + 1; i++) { if (i % 4 == 0) ostr.print("\n "); ostr.print("0x" + Long.toHexString(toSpecial[i]) + "L, "); } ostr.println("\n};"); } if (hasMore) { // Bit vector for MORE ostr.print("static final long[] jjtoMore = {"); for (i = 0; i < maxOrdinal / 64 + 1; i++) { if (i % 4 == 0) ostr.print("\n "); ostr.print("0x" + Long.toHexString(toMore[i]) + "L, "); } ostr.println("\n};"); } if (Options.getUserCharStream()) charStreamName = "CharStream"; else { if (Options.getJavaUnicodeEscape()) charStreamName = "JavaCharStream"; else charStreamName = "SimpleCharStream"; } ostr.println(staticString + "protected " + charStreamName + " input_stream;"); ostr.println(staticString + "private final int[] jjrounds = " + "new int[" + stateSetSize + "];"); ostr.println(staticString + "private final int[] jjstateSet = " + "new int[" + (2 * stateSetSize) + "];"); if (hasMoreActions || hasSkipActions || hasTokenActions) { ostr.println("private " + staticString + "final " + Options.stringBufOrBuild() + " jjimage = new " + Options.stringBufOrBuild() + "();"); ostr.println("private " + staticString + Options.stringBufOrBuild() + " image = jjimage;"); ostr.println("private " + staticString + "int jjimageLen;"); ostr.println("private " + staticString + "int lengthOfMatch;"); } ostr.println(staticString + "protected char curChar;"); if(Options.getTokenManagerUsesParser() && !Options.getStatic()){ ostr.println(""); ostr.println("/** Constructor with parser. */"); ostr.println("public " + tokMgrClassName + "(" + cu_name + " parserArg, " + charStreamName + " stream){"); ostr.println(" parser = parserArg;"); } else { ostr.println("/** Constructor. */"); ostr.println("public " + tokMgrClassName + "(" + charStreamName + " stream){"); } if (Options.getStatic() && !Options.getUserCharStream()) { ostr.println(" if (input_stream != null)"); ostr.println(" throw new TokenMgrError(\"ERROR: Second call to constructor of static lexer. " + "You must use ReInit() to initialize the static variables.\", TokenMgrError.STATIC_LEXER_ERROR);"); } else if (!Options.getUserCharStream()) { if (Options.getJavaUnicodeEscape()) ostr.println(" if (JavaCharStream.staticFlag)"); else ostr.println(" if (SimpleCharStream.staticFlag)"); ostr.println(" throw new Error(\"ERROR: Cannot use a static CharStream class with a " + "non-static lexical analyzer.\");"); } ostr.println(" input_stream = stream;"); ostr.println("}"); if(Options.getTokenManagerUsesParser() && !Options.getStatic()){ ostr.println(""); ostr.println("/** Constructor with parser. */"); ostr.println("public " + tokMgrClassName + "(" + cu_name + " parserArg, " + charStreamName + " stream, int lexState){"); ostr.println(" this(parserArg, stream);"); } else { ostr.println(""); ostr.println("/** Constructor. */"); ostr.println("public " + tokMgrClassName + "(" + charStreamName + " stream, int lexState){"); ostr.println(" this(stream);"); } ostr.println(" SwitchTo(lexState);"); ostr.println("}"); // Reinit method for reinitializing the parser (for static parsers). ostr.println(""); ostr.println("/** Reinitialise parser. */"); ostr.println(staticString + "public void ReInit(" + charStreamName + " stream)"); ostr.println("{"); ostr.println(" jjmatchedPos = jjnewStateCnt = 0;"); ostr.println(" curLexState = defaultLexState;"); ostr.println(" input_stream = stream;"); ostr.println(" ReInitRounds();"); ostr.println("}"); // Method to reinitialize the jjrounds array. ostr.println(staticString + "private void ReInitRounds()"); ostr.println("{"); ostr.println(" int i;"); ostr.println(" jjround = 0x" + Integer.toHexString(Integer.MIN_VALUE + 1)+ ";"); ostr.println(" for (i = " + stateSetSize + "; i-- > 0;)"); ostr.println(" jjrounds[i] = 0x" + Integer.toHexString(Integer.MIN_VALUE) + ";"); ostr.println("}"); // Reinit method for reinitializing the parser (for static parsers). ostr.println(""); ostr.println("/** Reinitialise parser. */"); ostr.println(staticString + "public void ReInit(" + charStreamName + " stream, int lexState)"); ostr.println("{"); ostr.println(" ReInit(stream);"); ostr.println(" SwitchTo(lexState);"); ostr.println("}"); ostr.println(""); ostr.println("/** Switch to specified lex state. */"); ostr.println(staticString + "public void SwitchTo(int lexState)"); ostr.println("{"); ostr.println(" if (lexState >= " + lexStateName.length + " || lexState < 0)"); ostr.println(" throw new TokenMgrError(\"Error: Ignoring invalid lexical state : \"" + " + lexState + \". State unchanged.\", TokenMgrError.INVALID_LEXICAL_STATE);"); ostr.println(" else"); ostr.println(" curLexState = lexState;"); ostr.println("}"); ostr.println(""); } // Assumes l != 0L static char MaxChar(long l) { for (int i = 64; i-- > 0; ) if ((l & (1L << i)) != 0L) return (char)i; return 0xffff; } static void DumpFillToken() { final double tokenVersion = JavaFiles.getVersion("Token.java"); final boolean hasBinaryNewToken = tokenVersion > 4.09; ostr.println(staticString + "protected Token jjFillToken()"); ostr.println("{"); ostr.println(" final Token t;"); ostr.println(" final String curTokenImage;"); if (keepLineCol) { ostr.println(" final int beginLine;"); ostr.println(" final int endLine;"); ostr.println(" final int beginColumn;"); ostr.println(" final int endColumn;"); } if (hasEmptyMatch) { ostr.println(" if (jjmatchedPos < 0)"); ostr.println(" {"); ostr.println(" if (image == null)"); ostr.println(" curTokenImage = \"\";"); ostr.println(" else"); ostr.println(" curTokenImage = image.toString();"); if (keepLineCol) { ostr.println(" beginLine = endLine = input_stream.getBeginLine();"); ostr.println(" beginColumn = endColumn = input_stream.getBeginColumn();"); } ostr.println(" }"); ostr.println(" else"); ostr.println(" {"); ostr.println(" String im = jjstrLiteralImages[jjmatchedKind];"); ostr.println(" curTokenImage = (im == null) ? input_stream.GetImage() : im;"); if (keepLineCol) { ostr.println(" beginLine = input_stream.getBeginLine();"); ostr.println(" beginColumn = input_stream.getBeginColumn();"); ostr.println(" endLine = input_stream.getEndLine();"); ostr.println(" endColumn = input_stream.getEndColumn();"); } ostr.println(" }"); } else { ostr.println(" String im = jjstrLiteralImages[jjmatchedKind];"); ostr.println(" curTokenImage = (im == null) ? input_stream.GetImage() : im;"); if (keepLineCol) { ostr.println(" beginLine = input_stream.getBeginLine();"); ostr.println(" beginColumn = input_stream.getBeginColumn();"); ostr.println(" endLine = input_stream.getEndLine();"); ostr.println(" endColumn = input_stream.getEndColumn();"); } } if (Options.getTokenFactory().length() > 0) { ostr.println(" t = " + Options.getTokenFactory() + ".newToken(jjmatchedKind, curTokenImage);"); } else if (hasBinaryNewToken) { ostr.println(" t = Token.newToken(jjmatchedKind, curTokenImage);"); } else { ostr.println(" t = Token.newToken(jjmatchedKind);"); ostr.println(" t.kind = jjmatchedKind;"); ostr.println(" t.image = curTokenImage;"); } if (keepLineCol) { ostr.println(""); ostr.println(" t.beginLine = beginLine;"); ostr.println(" t.endLine = endLine;"); ostr.println(" t.beginColumn = beginColumn;"); ostr.println(" t.endColumn = endColumn;"); } ostr.println(""); ostr.println(" return t;"); ostr.println("}"); } static void DumpGetNextToken() { int i; ostr.println(""); ostr.println(staticString + "int curLexState = " + defaultLexState + ";"); ostr.println(staticString + "int defaultLexState = " + defaultLexState + ";"); ostr.println(staticString + "int jjnewStateCnt;"); ostr.println(staticString + "int jjround;"); ostr.println(staticString + "int jjmatchedPos;"); ostr.println(staticString + "int jjmatchedKind;"); ostr.println(""); ostr.println("/** Get the next Token. */"); ostr.println("public " + staticString + "Token getNextToken()" + " "); ostr.println("{"); if (hasSpecial) { ostr.println(" Token specialToken = null;"); } ostr.println(" Token matchedToken;"); ostr.println(" int curPos = 0;"); ostr.println(""); ostr.println(" EOFLoop :\n for (;;)"); ostr.println(" {"); ostr.println(" try"); ostr.println(" {"); ostr.println(" curChar = input_stream.BeginToken();"); ostr.println(" }"); ostr.println(" catch(java.io.IOException e)"); ostr.println(" {"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(\"Returning the token.\");"); ostr.println(" jjmatchedKind = 0;"); ostr.println(" matchedToken = jjFillToken();"); if (hasSpecial) ostr.println(" matchedToken.specialToken = specialToken;"); if (nextStateForEof != null || actForEof != null) ostr.println(" TokenLexicalActions(matchedToken);"); if (Options.getCommonTokenAction()) ostr.println(" CommonTokenAction(matchedToken);"); ostr.println(" return matchedToken;"); ostr.println(" }"); if (hasMoreActions || hasSkipActions || hasTokenActions) { ostr.println(" image = jjimage;"); ostr.println(" image.setLength(0);"); ostr.println(" jjimageLen = 0;"); } ostr.println(""); String prefix = ""; if (hasMore) { ostr.println(" for (;;)"); ostr.println(" {"); prefix = " "; } String endSwitch = ""; String caseStr = ""; // this also sets up the start state of the nfa if (maxLexStates > 1) { ostr.println(prefix + " switch(curLexState)"); ostr.println(prefix + " {"); endSwitch = prefix + " }"; caseStr = prefix + " case "; prefix += " "; } prefix += " "; for(i = 0; i < maxLexStates; i++) { if (maxLexStates > 1) ostr.println(caseStr + i + ":"); if (singlesToSkip[i].HasTransitions()) { // added the backup(0) to make JIT happy ostr.println(prefix + "try { input_stream.backup(0);"); if (singlesToSkip[i].asciiMoves[0] != 0L && singlesToSkip[i].asciiMoves[1] != 0L) { ostr.println(prefix + " while ((curChar < 64" + " && (0x" + Long.toHexString(singlesToSkip[i].asciiMoves[0]) + "L & (1L << curChar)) != 0L) || \n" + prefix + " (curChar >> 6) == 1" + " && (0x" + Long.toHexString(singlesToSkip[i].asciiMoves[1]) + "L & (1L << (curChar & 077))) != 0L)"); } else if (singlesToSkip[i].asciiMoves[1] == 0L) { ostr.println(prefix + " while (curChar <= " + (int)MaxChar(singlesToSkip[i].asciiMoves[0]) + " && (0x" + Long.toHexString(singlesToSkip[i].asciiMoves[0]) + "L & (1L << curChar)) != 0L)"); } else if (singlesToSkip[i].asciiMoves[0] == 0L) { ostr.println(prefix + " while (curChar > 63 && curChar <= " + ((int)MaxChar(singlesToSkip[i].asciiMoves[1]) + 64) + " && (0x" + Long.toHexString(singlesToSkip[i].asciiMoves[1]) + "L & (1L << (curChar & 077))) != 0L)"); } if (Options.getDebugTokenManager()) { ostr.println(prefix + "{"); ostr.println(" debugStream.println(" + (maxLexStates > 1 ? "\"<\" + lexStateNames[curLexState] + \">\" + " : "") + "\"Skipping character : \" + " + "TokenMgrError.addEscapes(String.valueOf(curChar)) + \" (\" + (int)curChar + \")\");"); } ostr.println(prefix + " curChar = input_stream.BeginToken();"); if (Options.getDebugTokenManager()) ostr.println(prefix + "}"); ostr.println(prefix + "}"); ostr.println(prefix + "catch (java.io.IOException e1) { continue EOFLoop; }"); } if (initMatch[i] != Integer.MAX_VALUE && initMatch[i] != 0) { if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(\" Matched the empty string as \" + tokenImage[" + initMatch[i] + "] + \" token.\");"); ostr.println(prefix + "jjmatchedKind = " + initMatch[i] + ";"); ostr.println(prefix + "jjmatchedPos = -1;"); ostr.println(prefix + "curPos = 0;"); } else { ostr.println(prefix + "jjmatchedKind = 0x" + Integer.toHexString(Integer.MAX_VALUE) + ";"); ostr.println(prefix + "jjmatchedPos = 0;"); } if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(" + (maxLexStates > 1 ? "\"<\" + lexStateNames[curLexState] + \">\" + " : "") + "\"Current character : \" + " + "TokenMgrError.addEscapes(String.valueOf(curChar)) + \" (\" + (int)curChar + \") " + "at line \" + input_stream.getEndLine() + \" column \" + input_stream.getEndColumn());"); ostr.println(prefix + "curPos = jjMoveStringLiteralDfa0_" + i + "();"); if (canMatchAnyChar[i] != -1) { if (initMatch[i] != Integer.MAX_VALUE && initMatch[i] != 0) ostr.println(prefix + "if (jjmatchedPos < 0 || (jjmatchedPos == 0 && jjmatchedKind > " + canMatchAnyChar[i] + "))"); else ostr.println(prefix + "if (jjmatchedPos == 0 && jjmatchedKind > " + canMatchAnyChar[i] + ")"); ostr.println(prefix + "{"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(\" Current character matched as a \" + tokenImage[" + canMatchAnyChar[i] + "] + \" token.\");"); ostr.println(prefix + " jjmatchedKind = " + canMatchAnyChar[i] + ";"); if (initMatch[i] != Integer.MAX_VALUE && initMatch[i] != 0) ostr.println(prefix + " jjmatchedPos = 0;"); ostr.println(prefix + "}"); } if (maxLexStates > 1) ostr.println(prefix + "break;"); } if (maxLexStates > 1) ostr.println(endSwitch); else if (maxLexStates == 0) ostr.println(" jjmatchedKind = 0x" + Integer.toHexString(Integer.MAX_VALUE) + ";"); if (maxLexStates > 1) prefix = " "; else prefix = ""; if (maxLexStates > 0) { ostr.println(prefix + " if (jjmatchedKind != 0x" + Integer.toHexString(Integer.MAX_VALUE) + ")"); ostr.println(prefix + " {"); ostr.println(prefix + " if (jjmatchedPos + 1 < curPos)"); if (Options.getDebugTokenManager()) { ostr.println(prefix + " {"); ostr.println(prefix + " debugStream.println(" + "\" Putting back \" + (curPos - jjmatchedPos - 1) + \" characters into the input stream.\");"); } ostr.println(prefix + " input_stream.backup(curPos - jjmatchedPos - 1);"); if (Options.getDebugTokenManager()) ostr.println(prefix + " }"); if (Options.getDebugTokenManager()) { if (Options.getJavaUnicodeEscape() || Options.getUserCharStream()) ostr.println(" debugStream.println(" + "\"****** FOUND A \" + tokenImage[jjmatchedKind] + \" MATCH " + "(\" + TokenMgrError.addEscapes(new String(input_stream.GetSuffix(jjmatchedPos + 1))) + " + "\") ******\\n\");"); else ostr.println(" debugStream.println(" + "\"****** FOUND A \" + tokenImage[jjmatchedKind] + \" MATCH " + "(\" + TokenMgrError.addEscapes(new String(input_stream.GetSuffix(jjmatchedPos + 1))) + " + "\") ******\\n\");"); } if (hasSkip || hasMore || hasSpecial) { ostr.println(prefix + " if ((jjtoToken[jjmatchedKind >> 6] & " + "(1L << (jjmatchedKind & 077))) != 0L)"); ostr.println(prefix + " {"); } ostr.println(prefix + " matchedToken = jjFillToken();"); if (hasSpecial) ostr.println(prefix + " matchedToken.specialToken = specialToken;"); if (hasTokenActions) ostr.println(prefix + " TokenLexicalActions(matchedToken);"); if (maxLexStates > 1) { ostr.println(" if (jjnewLexState[jjmatchedKind] != -1)"); ostr.println(prefix + " curLexState = jjnewLexState[jjmatchedKind];"); } if (Options.getCommonTokenAction()) ostr.println(prefix + " CommonTokenAction(matchedToken);"); ostr.println(prefix + " return matchedToken;"); if (hasSkip || hasMore || hasSpecial) { ostr.println(prefix + " }"); if (hasSkip || hasSpecial) { if (hasMore) { ostr.println(prefix + " else if ((jjtoSkip[jjmatchedKind >> 6] & " + "(1L << (jjmatchedKind & 077))) != 0L)"); } else ostr.println(prefix + " else"); ostr.println(prefix + " {"); if (hasSpecial) { ostr.println(prefix + " if ((jjtoSpecial[jjmatchedKind >> 6] & " + "(1L << (jjmatchedKind & 077))) != 0L)"); ostr.println(prefix + " {"); ostr.println(prefix + " matchedToken = jjFillToken();"); ostr.println(prefix + " if (specialToken == null)"); ostr.println(prefix + " specialToken = matchedToken;"); ostr.println(prefix + " else"); ostr.println(prefix + " {"); ostr.println(prefix + " matchedToken.specialToken = specialToken;"); ostr.println(prefix + " specialToken = (specialToken.next = matchedToken);"); ostr.println(prefix + " }"); if (hasSkipActions) ostr.println(prefix + " SkipLexicalActions(matchedToken);"); ostr.println(prefix + " }"); if (hasSkipActions) { ostr.println(prefix + " else"); ostr.println(prefix + " SkipLexicalActions(null);"); } } else if (hasSkipActions) ostr.println(prefix + " SkipLexicalActions(null);"); if (maxLexStates > 1) { ostr.println(" if (jjnewLexState[jjmatchedKind] != -1)"); ostr.println(prefix + " curLexState = jjnewLexState[jjmatchedKind];"); } ostr.println(prefix + " continue EOFLoop;"); ostr.println(prefix + " }"); } if (hasMore) { if (hasMoreActions) ostr.println(prefix + " MoreLexicalActions();"); else if (hasSkipActions || hasTokenActions) ostr.println(prefix + " jjimageLen += jjmatchedPos + 1;"); if (maxLexStates > 1) { ostr.println(" if (jjnewLexState[jjmatchedKind] != -1)"); ostr.println(prefix + " curLexState = jjnewLexState[jjmatchedKind];"); } ostr.println(prefix + " curPos = 0;"); ostr.println(prefix + " jjmatchedKind = 0x" + Integer.toHexString(Integer.MAX_VALUE) + ";"); ostr.println(prefix + " try {"); ostr.println(prefix + " curChar = input_stream.readChar();"); if (Options.getDebugTokenManager()) ostr.println(" debugStream.println(" + (maxLexStates > 1 ? "\"<\" + lexStateNames[curLexState] + \">\" + " : "") + "\"Current character : \" + " + "TokenMgrError.addEscapes(String.valueOf(curChar)) + \" (\" + (int)curChar + \") " + "at line \" + input_stream.getEndLine() + \" column \" + input_stream.getEndColumn());"); ostr.println(prefix + " continue;"); ostr.println(prefix + " }"); ostr.println(prefix + " catch (java.io.IOException e1) { }"); } } ostr.println(prefix + " }"); ostr.println(prefix + " int error_line = input_stream.getEndLine();"); ostr.println(prefix + " int error_column = input_stream.getEndColumn();"); ostr.println(prefix + " String error_after = null;"); ostr.println(prefix + " boolean EOFSeen = false;"); ostr.println(prefix + " try { input_stream.readChar(); input_stream.backup(1); }"); ostr.println(prefix + " catch (java.io.IOException e1) {"); ostr.println(prefix + " EOFSeen = true;"); ostr.println(prefix + " error_after = curPos <= 1 ? \"\" : input_stream.GetImage();"); ostr.println(prefix + " if (curChar == '\\n' || curChar == '\\r') {"); ostr.println(prefix + " error_line++;"); ostr.println(prefix + " error_column = 0;"); ostr.println(prefix + " }"); ostr.println(prefix + " else"); ostr.println(prefix + " error_column++;"); ostr.println(prefix + " }"); ostr.println(prefix + " if (!EOFSeen) {"); ostr.println(prefix + " input_stream.backup(1);"); ostr.println(prefix + " error_after = curPos <= 1 ? \"\" : input_stream.GetImage();"); ostr.println(prefix + " }"); ostr.println(prefix + " throw new TokenMgrError(" + "EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);"); } if (hasMore) ostr.println(prefix + " }"); ostr.println(" }"); ostr.println("}"); ostr.println(""); } public static void DumpSkipActions() { Action act; ostr.println(staticString + "void SkipLexicalActions(Token matchedToken)"); ostr.println("{"); ostr.println(" switch(jjmatchedKind)"); ostr.println(" {"); Outer: for (int i = 0; i < maxOrdinal; i++) { if ((toSkip[i / 64] & (1L << (i % 64))) == 0L) continue; for (;;) { if (((act = (Action)actions[i]) == null || act.getActionTokens() == null || act.getActionTokens().size() == 0) && !canLoop[lexStates[i]]) continue Outer; ostr.println(" case " + i + " :"); if (initMatch[lexStates[i]] == i && canLoop[lexStates[i]]) { ostr.println(" if (jjmatchedPos == -1)"); ostr.println(" {"); ostr.println(" if (jjbeenHere[" + lexStates[i] + "] &&"); ostr.println(" jjemptyLineNo[" + lexStates[i] + "] == input_stream.getBeginLine() &&"); ostr.println(" jjemptyColNo[" + lexStates[i] + "] == input_stream.getBeginColumn())"); ostr.println(" throw new TokenMgrError(" + "(\"Error: Bailing out of infinite loop caused by repeated empty string matches " + "at line \" + input_stream.getBeginLine() + \", " + "column \" + input_stream.getBeginColumn() + \".\"), TokenMgrError.LOOP_DETECTED);"); ostr.println(" jjemptyLineNo[" + lexStates[i] + "] = input_stream.getBeginLine();"); ostr.println(" jjemptyColNo[" + lexStates[i] + "] = input_stream.getBeginColumn();"); ostr.println(" jjbeenHere[" + lexStates[i] + "] = true;"); ostr.println(" }"); } if ((act = (Action)actions[i]) == null || act.getActionTokens().size() == 0) break; ostr.print( " image.append"); if (RStringLiteral.allImages[i] != null) { ostr.println("(jjstrLiteralImages[" + i + "]);"); ostr.println(" lengthOfMatch = jjstrLiteralImages[" + i + "].length();"); } else { ostr.println("(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));"); } printTokenSetup((Token)act.getActionTokens().get(0)); ccol = 1; for (int j = 0; j < act.getActionTokens().size(); j++) printToken((Token)act.getActionTokens().get(j), ostr); ostr.println(""); break; } ostr.println(" break;"); } ostr.println(" default :"); ostr.println(" break;"); ostr.println(" }"); ostr.println("}"); } public static void DumpMoreActions() { Action act; ostr.println(staticString + "void MoreLexicalActions()"); ostr.println("{"); ostr.println(" jjimageLen += (lengthOfMatch = jjmatchedPos + 1);"); ostr.println(" switch(jjmatchedKind)"); ostr.println(" {"); Outer: for (int i = 0; i < maxOrdinal; i++) { if ((toMore[i / 64] & (1L << (i % 64))) == 0L) continue; for (;;) { if (((act = (Action)actions[i]) == null || act.getActionTokens() == null || act.getActionTokens().size() == 0) && !canLoop[lexStates[i]]) continue Outer; ostr.println(" case " + i + " :"); if (initMatch[lexStates[i]] == i && canLoop[lexStates[i]]) { ostr.println(" if (jjmatchedPos == -1)"); ostr.println(" {"); ostr.println(" if (jjbeenHere[" + lexStates[i] + "] &&"); ostr.println(" jjemptyLineNo[" + lexStates[i] + "] == input_stream.getBeginLine() &&"); ostr.println(" jjemptyColNo[" + lexStates[i] + "] == input_stream.getBeginColumn())"); ostr.println(" throw new TokenMgrError(" + "(\"Error: Bailing out of infinite loop caused by repeated empty string matches " + "at line \" + input_stream.getBeginLine() + \", " + "column \" + input_stream.getBeginColumn() + \".\"), TokenMgrError.LOOP_DETECTED);"); ostr.println(" jjemptyLineNo[" + lexStates[i] + "] = input_stream.getBeginLine();"); ostr.println(" jjemptyColNo[" + lexStates[i] + "] = input_stream.getBeginColumn();"); ostr.println(" jjbeenHere[" + lexStates[i] + "] = true;"); ostr.println(" }"); } if ((act = (Action)actions[i]) == null || act.getActionTokens().size() == 0) { break; } ostr.print( " image.append"); if (RStringLiteral.allImages[i] != null) ostr.println("(jjstrLiteralImages[" + i + "]);"); else ostr.println("(input_stream.GetSuffix(jjimageLen));"); ostr.println(" jjimageLen = 0;"); printTokenSetup((Token)act.getActionTokens().get(0)); ccol = 1; for (int j = 0; j < act.getActionTokens().size(); j++) printToken((Token)act.getActionTokens().get(j), ostr); ostr.println(""); break; } ostr.println(" break;"); } ostr.println(" default :"); ostr.println(" break;"); ostr.println(" }"); ostr.println("}"); } public static void DumpTokenActions() { Action act; int i; ostr.println(staticString + "void TokenLexicalActions(Token matchedToken)"); ostr.println("{"); ostr.println(" switch(jjmatchedKind)"); ostr.println(" {"); Outer: for (i = 0; i < maxOrdinal; i++) { if ((toToken[i / 64] & (1L << (i % 64))) == 0L) continue; for (;;) { if (((act = (Action)actions[i]) == null || act.getActionTokens() == null || act.getActionTokens().size() == 0) && !canLoop[lexStates[i]]) continue Outer; ostr.println(" case " + i + " :"); if (initMatch[lexStates[i]] == i && canLoop[lexStates[i]]) { ostr.println(" if (jjmatchedPos == -1)"); ostr.println(" {"); ostr.println(" if (jjbeenHere[" + lexStates[i] + "] &&"); ostr.println(" jjemptyLineNo[" + lexStates[i] + "] == input_stream.getBeginLine() &&"); ostr.println(" jjemptyColNo[" + lexStates[i] + "] == input_stream.getBeginColumn())"); ostr.println(" throw new TokenMgrError(" + "(\"Error: Bailing out of infinite loop caused by repeated empty string matches " + "at line \" + input_stream.getBeginLine() + \", " + "column \" + input_stream.getBeginColumn() + \".\"), TokenMgrError.LOOP_DETECTED);"); ostr.println(" jjemptyLineNo[" + lexStates[i] + "] = input_stream.getBeginLine();"); ostr.println(" jjemptyColNo[" + lexStates[i] + "] = input_stream.getBeginColumn();"); ostr.println(" jjbeenHere[" + lexStates[i] + "] = true;"); ostr.println(" }"); } if ((act = (Action)actions[i]) == null || act.getActionTokens().size() == 0) break; if (i == 0) { ostr.println(" image.setLength(0);"); // For EOF no image is there } else { ostr.print( " image.append"); if (RStringLiteral.allImages[i] != null) { ostr.println("(jjstrLiteralImages[" + i + "]);"); ostr.println(" lengthOfMatch = jjstrLiteralImages[" + i + "].length();"); } else { ostr.println("(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));"); } } printTokenSetup((Token)act.getActionTokens().get(0)); ccol = 1; for (int j = 0; j < act.getActionTokens().size(); j++) printToken((Token)act.getActionTokens().get(j), ostr); ostr.println(""); break; } ostr.println(" break;"); } ostr.println(" default :"); ostr.println(" break;"); ostr.println(" }"); ostr.println("}"); } public static void reInit() { ostr = null; staticString = null; tokMgrClassName = null; allTpsForState = new Hashtable(); lexStateIndex = 0; kinds = null; maxOrdinal = 1; lexStateSuffix = null; newLexState = null; lexStates = null; ignoreCase = null; actions = null; initStates = new Hashtable(); stateSetSize = 0; maxLexStates = 0; lexStateName = null; singlesToSkip = null; toSkip = null; toSpecial = null; toMore = null; toToken = null; defaultLexState = 0; rexprs = null; maxLongsReqd = null; initMatch = null; canMatchAnyChar = null; hasEmptyMatch = false; canLoop = null; stateHasActions = null; hasLoop = false; canReachOnMore = null; hasNfa = null; mixed = null; initialState = null; curKind = 0; hasSkipActions = false; hasMoreActions = false; hasTokenActions = false; hasSpecial = false; hasSkip = false; hasMore = false; curRE = null; } } javacc-5.0.orig/src/org/javacc/parser/JavaCCGlobals.java0000644000175000017500000004205711226741736022110 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.io.File; import java.util.ArrayList; import java.util.List; import org.javacc.Version; /** * This package contains data created as a result of parsing and semanticizing * a JavaCC input file. This data is what is used by the back-ends of JavaCC as * well as any other back-end of JavaCC related tools such as JJTree. */ public class JavaCCGlobals { /** * String that identifies the JavaCC generated files. */ protected static final String toolName = "JavaCC"; /** * The name of the grammar file being processed. */ static public String fileName; /** * The name of the original file (before processing by JJTree). * Currently this is the same as fileName. */ static public String origFileName; /** * Set to true if this file has been processed by JJTree. */ static public boolean jjtreeGenerated; /** * The list of tools that have participated in generating the * input grammar file. */ static public List toolNames; /** * This prints the banner line when the various tools are invoked. This * takes as argument the tool's full name and its version. */ static public void bannerLine(String fullName, String ver) { System.out.print("Java Compiler Compiler Version " + Version.versionNumber + " (" + fullName); if (!ver.equals("")) { System.out.print(" Version " + ver); } System.out.println(")"); } /** * The name of the parser class (what appears in PARSER_BEGIN and PARSER_END). */ static public String cu_name; /** * This is a list of tokens that appear after "PARSER_BEGIN(name)" all the * way until (but not including) the opening brace "{" of the class "name". */ static public java.util.List cu_to_insertion_point_1 = new java.util.ArrayList(); /** * This is the list of all tokens that appear after the tokens in * "cu_to_insertion_point_1" and until (but not including) the closing brace "}" * of the class "name". */ static public java.util.List cu_to_insertion_point_2 = new java.util.ArrayList(); /** * This is the list of all tokens that appear after the tokens in * "cu_to_insertion_point_2" and until "PARSER_END(name)". */ static public java.util.List cu_from_insertion_point_2 = new java.util.ArrayList(); /** * A list of all grammar productions - normal and JAVACODE - in the order * they appear in the input file. Each entry here will be a subclass of * "NormalProduction". */ static public java.util.List bnfproductions = new java.util.ArrayList(); /** * A symbol table of all grammar productions - normal and JAVACODE. The * symbol table is indexed by the name of the left hand side non-terminal. * Its contents are of type "NormalProduction". */ static public java.util.Map production_table = new java.util.HashMap(); /** * A mapping of lexical state strings to their integer internal representation. * Integers are stored as java.lang.Integer's. */ static public java.util.Hashtable lexstate_S2I = new java.util.Hashtable(); /** * A mapping of the internal integer representations of lexical states to * their strings. Integers are stored as java.lang.Integer's. */ static public java.util.Hashtable lexstate_I2S = new java.util.Hashtable(); /** * The declarations to be inserted into the TokenManager class. */ static public java.util.List token_mgr_decls; /** * The list of all TokenProductions from the input file. This list includes * implicit TokenProductions that are created for uses of regular expressions * within BNF productions. */ static public java.util.List rexprlist = new java.util.ArrayList(); /** * The total number of distinct tokens. This is therefore one more than the * largest assigned token ordinal. */ static public int tokenCount; /** * This is a symbol table that contains all named tokens (those that are * defined with a label). The index to the table is the image of the label * and the contents of the table are of type "RegularExpression". */ static public java.util.Map named_tokens_table = new java.util.HashMap(); /** * Contains the same entries as "named_tokens_table", but this is an ordered * list which is ordered by the order of appearance in the input file. */ static public java.util.List ordered_named_tokens = new java.util.ArrayList(); /** * A mapping of ordinal values (represented as objects of type "Integer") to * the corresponding labels (of type "String"). An entry exists for an ordinal * value only if there is a labeled token corresponding to this entry. * If there are multiple labels representing the same ordinal value, then * only one label is stored. */ static public java.util.Map names_of_tokens = new java.util.HashMap(); /** * A mapping of ordinal values (represented as objects of type "Integer") to * the corresponding RegularExpression's. */ static public java.util.Map rexps_of_tokens = new java.util.HashMap(); /** * This is a three-level symbol table that contains all simple tokens (those * that are defined using a single string (with or without a label). The index * to the first level table is a lexical state which maps to a second level * hashtable. The index to the second level hashtable is the string of the * simple token converted to upper case, and this maps to a third level hashtable. * This third level hashtable contains the actual string of the simple token * and maps it to its RegularExpression. */ static public java.util.Hashtable simple_tokens_table = new java.util.Hashtable(); /** * maskindex, jj2index, maskVals are variables that are shared between * ParseEngine and ParseGen. */ static protected int maskindex = 0; static protected int jj2index = 0; public static boolean lookaheadNeeded; static protected List maskVals = new ArrayList(); static Action actForEof; static String nextStateForEof; // Some general purpose utilities follow. /** * Returns the identifying string for the file name, given a toolname * used to generate it. */ public static String getIdString(String toolName, String fileName) { List toolNames = new ArrayList(); toolNames.add(toolName); return getIdString(toolNames, fileName); } /** * Returns the identifying string for the file name, given a set of tool * names that are used to generate it. */ public static String getIdString(List toolNames, String fileName) { int i; String toolNamePrefix = "Generated By:"; for (i = 0; i < toolNames.size() - 1; i++) toolNamePrefix += (String)toolNames.get(i) + "&"; toolNamePrefix += (String)toolNames.get(i) + ":"; if (toolNamePrefix.length() > 200) { System.out.println("Tool names too long."); throw new Error(); } return toolNamePrefix + " Do not edit this line. " + addUnicodeEscapes(fileName); } /** * Returns true if tool name passed is one of the tool names returned * by getToolNames(fileName). */ public static boolean isGeneratedBy(String toolName, String fileName) { List v = getToolNames(fileName); for (int i = 0; i < v.size(); i++) if (toolName.equals(v.get(i))) return true; return false; } private static List makeToolNameList(String str) { List retVal = new ArrayList(); int limit1 = str.indexOf('\n'); if (limit1 == -1) limit1 = 1000; int limit2 = str.indexOf('\r'); if (limit2 == -1) limit2 = 1000; int limit = (limit1 < limit2) ? limit1 : limit2; String tmp; if (limit == 1000) { tmp = str; } else { tmp = str.substring(0, limit); } if (tmp.indexOf(':') == -1) return retVal; tmp = tmp.substring(tmp.indexOf(':') + 1); if (tmp.indexOf(':') == -1) return retVal; tmp = tmp.substring(0, tmp.indexOf(':')); int i = 0, j = 0; while (j < tmp.length() && (i = tmp.indexOf('&', j)) != -1) { retVal.add(tmp.substring(j, i)); j = i + 1; } if (j < tmp.length()) retVal.add(tmp.substring(j)); return retVal; } /** * Returns a List of names of the tools that have been used to generate * the given file. */ public static List getToolNames(String fileName) { char[] buf = new char[256]; java.io.FileReader stream = null; int read, total = 0; try { stream = new java.io.FileReader(fileName); for (;;) if ((read = stream.read(buf, total, buf.length - total)) != -1) { if ((total += read) == buf.length) break; } else break; return makeToolNameList(new String(buf, 0, total)); } catch(java.io.FileNotFoundException e1) { } catch(java.io.IOException e2) { if (total > 0) return makeToolNameList(new String(buf, 0, total)); } finally { if (stream != null) try { stream.close(); } catch (Exception e3) { } } return new ArrayList(); } public static void createOutputDir(File outputDir) { if (!outputDir.exists()) { JavaCCErrors.warning("Output directory \"" + outputDir + "\" does not exist. Creating the directory."); if (!outputDir.mkdirs()) { JavaCCErrors.semantic_error("Cannot create the output directory : " + outputDir); return; } } if (!outputDir.isDirectory()) { JavaCCErrors.semantic_error("\"" + outputDir + " is not a valid output directory."); return; } if (!outputDir.canWrite()) { JavaCCErrors.semantic_error("Cannot write to the output output directory : \"" + outputDir + "\""); return; } } static public String staticOpt() { if (Options.getStatic()) { return "static "; } else { return ""; } } static public String add_escapes(String str) { String retval = ""; char ch; for (int i = 0; i < str.length(); i++) { ch = str.charAt(i); if (ch == '\b') { retval += "\\b"; } else if (ch == '\t') { retval += "\\t"; } else if (ch == '\n') { retval += "\\n"; } else if (ch == '\f') { retval += "\\f"; } else if (ch == '\r') { retval += "\\r"; } else if (ch == '\"') { retval += "\\\""; } else if (ch == '\'') { retval += "\\\'"; } else if (ch == '\\') { retval += "\\\\"; } else if (ch < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval += "\\u" + s.substring(s.length() - 4, s.length()); } else { retval += ch; } } return retval; } static public String addUnicodeEscapes(String str) { String retval = ""; char ch; for (int i = 0; i < str.length(); i++) { ch = str.charAt(i); if (ch < 0x20 || ch > 0x7e || ch == '\\') { String s = "0000" + Integer.toString(ch, 16); retval += "\\u" + s.substring(s.length() - 4, s.length()); } else { retval += ch; } } return retval; } static protected int cline, ccol; static protected void printTokenSetup(Token t) { Token tt = t; while (tt.specialToken != null) tt = tt.specialToken; cline = tt.beginLine; ccol = tt.beginColumn; } static protected void printTokenOnly(Token t, java.io.PrintWriter ostr) { for (; cline < t.beginLine; cline++) { ostr.println(""); ccol = 1; } for (; ccol < t.beginColumn; ccol++) { ostr.print(" "); } if (t.kind == JavaCCParserConstants.STRING_LITERAL || t.kind == JavaCCParserConstants.CHARACTER_LITERAL) ostr.print(addUnicodeEscapes(t.image)); else ostr.print(t.image); cline = t.endLine; ccol = t.endColumn+1; char last = t.image.charAt(t.image.length()-1); if (last == '\n' || last == '\r') { cline++; ccol = 1; } } static protected void printToken(Token t, java.io.PrintWriter ostr) { Token tt = t.specialToken; if (tt != null) { while (tt.specialToken != null) tt = tt.specialToken; while (tt != null) { printTokenOnly(tt, ostr); tt = tt.next; } } printTokenOnly(t, ostr); } static protected void printTokenList(List list, java.io.PrintWriter ostr) { Token t = null; for (java.util.Iterator it = list.iterator(); it.hasNext();) { t = (Token)it.next(); printToken(t, ostr); } if (t != null) printTrailingComments(t, ostr); } static protected void printLeadingComments(Token t, java.io.PrintWriter ostr) { if (t.specialToken == null) return; Token tt = t.specialToken; while (tt.specialToken != null) tt = tt.specialToken; while (tt != null) { printTokenOnly(tt, ostr); tt = tt.next; } if (ccol != 1 && cline != t.beginLine) { ostr.println(""); cline++; ccol = 1; } } static protected void printTrailingComments(Token t, java.io.PrintWriter ostr) { if (t.next == null) return; printLeadingComments(t.next); } static protected String printTokenOnly(Token t) { String retval = ""; for (; cline < t.beginLine; cline++) { retval += "\n"; ccol = 1; } for (; ccol < t.beginColumn; ccol++) { retval += " "; } if (t.kind == JavaCCParserConstants.STRING_LITERAL || t.kind == JavaCCParserConstants.CHARACTER_LITERAL) retval += addUnicodeEscapes(t.image); else retval += t.image; cline = t.endLine; ccol = t.endColumn+1; char last = t.image.charAt(t.image.length()-1); if (last == '\n' || last == '\r') { cline++; ccol = 1; } return retval; } static protected String printToken(Token t) { String retval = ""; Token tt = t.specialToken; if (tt != null) { while (tt.specialToken != null) tt = tt.specialToken; while (tt != null) { retval += printTokenOnly(tt); tt = tt.next; } } retval += printTokenOnly(t); return retval; } static protected String printLeadingComments(Token t) { String retval = ""; if (t.specialToken == null) return retval; Token tt = t.specialToken; while (tt.specialToken != null) tt = tt.specialToken; while (tt != null) { retval += printTokenOnly(tt); tt = tt.next; } if (ccol != 1 && cline != t.beginLine) { retval += "\n"; cline++; ccol = 1; } return retval; } static protected String printTrailingComments(Token t) { if (t.next == null) return ""; return printLeadingComments(t.next); } public static void reInit() { fileName = null; origFileName = null; jjtreeGenerated = false; toolNames = null; cu_name = null; cu_to_insertion_point_1 = new java.util.ArrayList(); cu_to_insertion_point_2 = new java.util.ArrayList(); cu_from_insertion_point_2 = new java.util.ArrayList(); bnfproductions = new java.util.ArrayList(); production_table = new java.util.HashMap(); lexstate_S2I = new java.util.Hashtable(); lexstate_I2S = new java.util.Hashtable(); token_mgr_decls = null; rexprlist = new java.util.ArrayList(); tokenCount = 0; named_tokens_table = new java.util.HashMap(); ordered_named_tokens = new java.util.ArrayList(); names_of_tokens = new java.util.HashMap(); rexps_of_tokens = new java.util.HashMap(); simple_tokens_table = new java.util.Hashtable(); maskindex = 0; jj2index = 0; maskVals = new ArrayList(); cline = 0; ccol = 0; actForEof = null; nextStateForEof = null; } } javacc-5.0.orig/src/org/javacc/parser/BNFProduction.java0000644000175000017500000000467411070513743022164 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; /** * Describes BNF productions. */ public class BNFProduction extends NormalProduction { /** * The declarations of this production. */ private List declaration_tokens = new ArrayList(); /** * This flag keeps track of whether or not return and throw * statements have been patched within this production's actions to * include a preceding "if (true)". */ private boolean jumpPatched; /** * @return the declaration_tokens */ public List getDeclarationTokens() { return declaration_tokens; } /** * @param jumpPatched the jumpPatched to set */ public void setJumpPatched(boolean jumpPatched) { this.jumpPatched = jumpPatched; } /** * @return the jumpPatched */ public boolean isJumpPatched() { return jumpPatched; } } javacc-5.0.orig/src/org/javacc/parser/JavaCodeProduction.java0000644000175000017500000000371411070513744023226 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Describes JAVACODE productions. */ public class JavaCodeProduction extends NormalProduction { /** * The tokens that implement this JAVACODE production. */ private java.util.List code_tokens = new java.util.ArrayList(); /** * @return the code_tokens */ public java.util.List getCodeTokens() { return code_tokens; } } javacc-5.0.orig/src/org/javacc/parser/RegExprSpec.java0000644000175000017500000000450510574036603021673 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * The object type of entries in the vector "respecs" of class * "TokenProduction". */ public class RegExprSpec { /** * The regular expression of this specification. */ public RegularExpression rexp; /** * The action corresponding to this specification. */ public Action act; /** * The next state corresponding to this specification. If no * next state has been specified, this field is set to "null". */ public String nextState; /** * If the next state specification was explicit in the previous * case, then this token is that of the identifier denoting * the next state. This is used for location information, etc. * in error reporting. */ public Token nsTok; } javacc-5.0.orig/src/org/javacc/parser/RRepetitionRange.java0000644000175000017500000000500511070137746022723 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; /** * Describes one-or-more regular expressions (). */ public class RRepetitionRange extends RegularExpression { /** * The regular expression which is repeated one or more times. */ public RegularExpression regexpr; public int min = 0; public int max = -1; public boolean hasMax; public Nfa GenerateNfa(boolean ignoreCase) { List units = new ArrayList(); RSequence seq; int i; for (i = 0; i < min; i++) { units.add(regexpr); } if (hasMax && max == -1) // Unlimited { RZeroOrMore zoo = new RZeroOrMore(); zoo.regexpr = regexpr; units.add(zoo); } while (i++ < max) { RZeroOrOne zoo = new RZeroOrOne(); zoo.regexpr = regexpr; units.add(zoo); } seq = new RSequence(units); return seq.GenerateNfa(ignoreCase); } } javacc-5.0.orig/src/org/javacc/parser/Semanticize.java0000644000175000017500000010540411070513745021756 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.List; public class Semanticize extends JavaCCGlobals { static List removeList = new ArrayList(); static List itemList = new ArrayList(); static void prepareToRemove(List vec, Object item) { removeList.add(vec); itemList.add(item); } static void removePreparedItems() { for (int i = 0; i < removeList.size(); i++) { List list = (List)(removeList.get(i)); list.remove(itemList.get(i)); } removeList.clear(); itemList.clear(); } static public void start() throws MetaParseException { if (JavaCCErrors.get_error_count() != 0) throw new MetaParseException(); if (Options.getLookahead() > 1 && !Options.getForceLaCheck() && Options.getSanityCheck()) { JavaCCErrors.warning("Lookahead adequacy checking not being performed since option LOOKAHEAD " + "is more than 1. Set option FORCE_LA_CHECK to true to force checking."); } /* * The following walks the entire parse tree to convert all LOOKAHEAD's * that are not at choice points (but at beginning of sequences) and converts * them to trivial choices. This way, their semantic lookahead specification * can be evaluated during other lookahead evaluations. */ for (Iterator it = bnfproductions.iterator(); it.hasNext();) { ExpansionTreeWalker.postOrderWalk(((NormalProduction)it.next()).getExpansion(), new LookaheadFixer()); } /* * The following loop populates "production_table" */ for (Iterator it = bnfproductions.iterator(); it.hasNext();) { NormalProduction p = (NormalProduction)it.next(); if (production_table.put(p.getLhs(), p) != null) { JavaCCErrors.semantic_error(p, p.getLhs() + " occurs on the left hand side of more than one production."); } } /* * The following walks the entire parse tree to make sure that all * non-terminals on RHS's are defined on the LHS. */ for (Iterator it = bnfproductions.iterator(); it.hasNext();) { ExpansionTreeWalker.preOrderWalk(((NormalProduction)it.next()).getExpansion(), new ProductionDefinedChecker()); } /* * The following loop ensures that all target lexical states are * defined. Also piggybacking on this loop is the detection of * and in token productions. After reporting an * error, these entries are removed. Also checked are definitions * on inline private regular expressions. * This loop works slightly differently when USER_TOKEN_MANAGER * is set to true. In this case, occurrences are OK, while * regular expression specs generate a warning. */ for (Iterator it = rexprlist.iterator(); it.hasNext();) { TokenProduction tp = (TokenProduction)(it.next()); List respecs = tp.respecs; for (Iterator it1 = respecs.iterator(); it1.hasNext();) { RegExprSpec res = (RegExprSpec)(it1.next()); if (res.nextState != null) { if (lexstate_S2I.get(res.nextState) == null) { JavaCCErrors.semantic_error(res.nsTok, "Lexical state \"" + res.nextState + "\" has not been defined."); } } if (res.rexp instanceof REndOfFile) { //JavaCCErrors.semantic_error(res.rexp, "Badly placed ."); if (tp.lexStates != null) JavaCCErrors.semantic_error(res.rexp, "EOF action/state change must be specified for all states, " + "i.e., <*>TOKEN:."); if (tp.kind != TokenProduction.TOKEN) JavaCCErrors.semantic_error(res.rexp, "EOF action/state change can be specified only in a " + "TOKEN specification."); if (nextStateForEof != null || actForEof != null) JavaCCErrors.semantic_error(res.rexp, "Duplicate action/state change specification for ."); actForEof = res.act; nextStateForEof = res.nextState; prepareToRemove(respecs, res); } else if (tp.isExplicit && Options.getUserTokenManager()) { JavaCCErrors.warning(res.rexp, "Ignoring regular expression specification since " + "option USER_TOKEN_MANAGER has been set to true."); } else if (tp.isExplicit && !Options.getUserTokenManager() && res.rexp instanceof RJustName) { JavaCCErrors.warning(res.rexp, "Ignoring free-standing regular expression reference. " + "If you really want this, you must give it a different label as >."); prepareToRemove(respecs, res); } else if (!tp.isExplicit && res.rexp.private_rexp) { JavaCCErrors.semantic_error(res.rexp, "Private (#) regular expression cannot be defined within " + "grammar productions."); } } } removePreparedItems(); /* * The following loop inserts all names of regular expressions into * "named_tokens_table" and "ordered_named_tokens". * Duplications are flagged as errors. */ for (Iterator it = rexprlist.iterator(); it.hasNext();) { TokenProduction tp = (TokenProduction)(it.next()); List respecs = tp.respecs; for (Iterator it1 = respecs.iterator(); it1.hasNext();) { RegExprSpec res = (RegExprSpec)(it1.next()); if (!(res.rexp instanceof RJustName) && !res.rexp.label.equals("")) { String s = res.rexp.label; Object obj = named_tokens_table.put(s, res.rexp); if (obj != null) { JavaCCErrors.semantic_error(res.rexp, "Multiply defined lexical token name \"" + s + "\"."); } else { ordered_named_tokens.add(res.rexp); } if (lexstate_S2I.get(s) != null) { JavaCCErrors.semantic_error(res.rexp, "Lexical token name \"" + s + "\" is the same as " + "that of a lexical state."); } } } } /* * The following code merges multiple uses of the same string in the same * lexical state and produces error messages when there are multiple * explicit occurrences (outside the BNF) of the string in the same * lexical state, or when within BNF occurrences of a string are duplicates * of those that occur as non-TOKEN's (SKIP, MORE, SPECIAL_TOKEN) or private * regular expressions. While doing this, this code also numbers all * regular expressions (by setting their ordinal values), and populates the * table "names_of_tokens". */ tokenCount = 1; for (Iterator it = rexprlist.iterator(); it.hasNext();) { TokenProduction tp = (TokenProduction)(it.next()); List respecs = tp.respecs; if (tp.lexStates == null) { tp.lexStates = new String[lexstate_I2S.size()]; int i = 0; for (Enumeration enum1 = lexstate_I2S.elements(); enum1.hasMoreElements();) { tp.lexStates[i++] = (String)(enum1.nextElement()); } } Hashtable table[] = new Hashtable[tp.lexStates.length]; for (int i = 0; i < tp.lexStates.length; i++) { table[i] = (Hashtable)simple_tokens_table.get(tp.lexStates[i]); } for (Iterator it1 = respecs.iterator(); it1.hasNext();) { RegExprSpec res = (RegExprSpec)(it1.next()); if (res.rexp instanceof RStringLiteral) { RStringLiteral sl = (RStringLiteral)res.rexp; // This loop performs the checks and actions with respect to each lexical state. for (int i = 0; i < table.length; i++) { // Get table of all case variants of "sl.image" into table2. Hashtable table2 = (Hashtable)(table[i].get(sl.image.toUpperCase())); if (table2 == null) { // There are no case variants of "sl.image" earlier than the current one. // So go ahead and insert this item. if (sl.ordinal == 0) { sl.ordinal = tokenCount++; } table2 = new Hashtable(); table2.put(sl.image, sl); table[i].put(sl.image.toUpperCase(), table2); } else if (hasIgnoreCase(table2, sl.image)) { // hasIgnoreCase sets "other" if it is found. // Since IGNORE_CASE version exists, current one is useless and bad. if (!sl.tpContext.isExplicit) { // inline BNF string is used earlier with an IGNORE_CASE. JavaCCErrors.semantic_error(sl, "String \"" + sl.image + "\" can never be matched " + "due to presence of more general (IGNORE_CASE) regular expression " + "at line " + other.getLine() + ", column " + other.getColumn() + "."); } else { // give the standard error message. JavaCCErrors.semantic_error(sl, "Duplicate definition of string token \"" + sl.image + "\" " + "can never be matched."); } } else if (sl.tpContext.ignoreCase) { // This has to be explicit. A warning needs to be given with respect // to all previous strings. String pos = ""; int count = 0; for (Enumeration enum2 = table2.elements(); enum2.hasMoreElements();) { RegularExpression rexp = (RegularExpression)(enum2.nextElement()); if (count != 0) pos += ","; pos += " line " + rexp.getLine(); count++; } if (count == 1) { JavaCCErrors.warning(sl, "String with IGNORE_CASE is partially superceded by string at" + pos + "."); } else { JavaCCErrors.warning(sl, "String with IGNORE_CASE is partially superceded by strings at" + pos + "."); } // This entry is legitimate. So insert it. if (sl.ordinal == 0) { sl.ordinal = tokenCount++; } table2.put(sl.image, sl); // The above "put" may override an existing entry (that is not IGNORE_CASE) and that's // the desired behavior. } else { // The rest of the cases do not involve IGNORE_CASE. RegularExpression re = (RegularExpression)table2.get(sl.image); if (re == null) { if (sl.ordinal == 0) { sl.ordinal = tokenCount++; } table2.put(sl.image, sl); } else if (tp.isExplicit) { // This is an error even if the first occurrence was implicit. if (tp.lexStates[i].equals("DEFAULT")) { JavaCCErrors.semantic_error(sl, "Duplicate definition of string token \"" + sl.image + "\"."); } else { JavaCCErrors.semantic_error(sl, "Duplicate definition of string token \"" + sl.image + "\" in lexical state \"" + tp.lexStates[i] + "\"."); } } else if (re.tpContext.kind != TokenProduction.TOKEN) { JavaCCErrors.semantic_error(sl, "String token \"" + sl.image + "\" has been defined as a \"" + TokenProduction.kindImage[re.tpContext.kind] + "\" token."); } else if (re.private_rexp) { JavaCCErrors.semantic_error(sl, "String token \"" + sl.image + "\" has been defined as a private regular expression."); } else { // This is now a legitimate reference to an existing RStringLiteral. // So we assign it a number and take it out of "rexprlist". // Therefore, if all is OK (no errors), then there will be only unequal // string literals in each lexical state. Note that the only way // this can be legal is if this is a string declared inline within the // BNF. Hence, it belongs to only one lexical state - namely "DEFAULT". sl.ordinal = re.ordinal; prepareToRemove(respecs, res); } } } } else if (!(res.rexp instanceof RJustName)) { res.rexp.ordinal = tokenCount++; } if (!(res.rexp instanceof RJustName) && !res.rexp.label.equals("")) { names_of_tokens.put(new Integer(res.rexp.ordinal), res.rexp.label); } if (!(res.rexp instanceof RJustName)) { rexps_of_tokens.put(new Integer(res.rexp.ordinal), res.rexp); } } } removePreparedItems(); /* * The following code performs a tree walk on all regular expressions * attaching links to "RJustName"s. Error messages are given if * undeclared names are used, or if "RJustNames" refer to private * regular expressions or to regular expressions of any kind other * than TOKEN. In addition, this loop also removes top level * "RJustName"s from "rexprlist". * This code is not executed if Options.getUserTokenManager() is set to * true. Instead the following block of code is executed. */ if (!Options.getUserTokenManager()) { FixRJustNames frjn = new FixRJustNames(); for (Iterator it = rexprlist.iterator(); it.hasNext();) { TokenProduction tp = (TokenProduction)(it.next()); List respecs = tp.respecs; for (Iterator it1 = respecs.iterator(); it1.hasNext();) { RegExprSpec res = (RegExprSpec)(it1.next()); frjn.root = res.rexp; ExpansionTreeWalker.preOrderWalk(res.rexp, frjn); if (res.rexp instanceof RJustName) { prepareToRemove(respecs, res); } } } } removePreparedItems(); /* * The following code is executed only if Options.getUserTokenManager() is * set to true. This code visits all top-level "RJustName"s (ignores * "RJustName"s nested within regular expressions). Since regular expressions * are optional in this case, "RJustName"s without corresponding regular * expressions are given ordinal values here. If "RJustName"s refer to * a named regular expression, their ordinal values are set to reflect this. * All but one "RJustName" node is removed from the lists by the end of * execution of this code. */ if (Options.getUserTokenManager()) { for (Iterator it = rexprlist.iterator(); it.hasNext();) { TokenProduction tp = (TokenProduction)(it.next()); List respecs = tp.respecs; for (Iterator it1 = respecs.iterator(); it1.hasNext();) { RegExprSpec res = (RegExprSpec)(it1.next()); if (res.rexp instanceof RJustName) { RJustName jn = (RJustName)res.rexp; RegularExpression rexp = (RegularExpression)named_tokens_table.get(jn.label); if (rexp == null) { jn.ordinal = tokenCount++; named_tokens_table.put(jn.label, jn); ordered_named_tokens.add(jn); names_of_tokens.put(new Integer(jn.ordinal), jn.label); } else { jn.ordinal = rexp.ordinal; prepareToRemove(respecs, res); } } } } } removePreparedItems(); /* * The following code is executed only if Options.getUserTokenManager() is * set to true. This loop labels any unlabeled regular expression and * prints a warning that it is doing so. These labels are added to * "ordered_named_tokens" so that they may be generated into the ...Constants * file. */ if (Options.getUserTokenManager()) { for (Iterator it = rexprlist.iterator(); it.hasNext();) { TokenProduction tp = (TokenProduction)(it.next()); List respecs = tp.respecs; for (Iterator it1 = respecs.iterator(); it1.hasNext();) { RegExprSpec res = (RegExprSpec)(it1.next()); Integer ii = new Integer(res.rexp.ordinal); if (names_of_tokens.get(ii) == null) { JavaCCErrors.warning(res.rexp, "Unlabeled regular expression cannot be referred to by " + "user generated token manager."); } } } } if (JavaCCErrors.get_error_count() != 0) throw new MetaParseException(); // The following code sets the value of the "emptyPossible" field of NormalProduction // nodes. This field is initialized to false, and then the entire list of // productions is processed. This is repeated as long as at least one item // got updated from false to true in the pass. boolean emptyUpdate = true; while (emptyUpdate) { emptyUpdate = false; for (Iterator it = bnfproductions.iterator(); it.hasNext();) { NormalProduction prod = (NormalProduction)it.next(); if (emptyExpansionExists(prod.getExpansion())) { if (!prod.isEmptyPossible()) { emptyUpdate = prod.setEmptyPossible(true); } } } } if (Options.getSanityCheck() && JavaCCErrors.get_error_count() == 0) { // The following code checks that all ZeroOrMore, ZeroOrOne, and OneOrMore nodes // do not contain expansions that can expand to the empty token list. for (Iterator it = bnfproductions.iterator(); it.hasNext();) { ExpansionTreeWalker.preOrderWalk(((NormalProduction)it.next()).getExpansion(), new EmptyChecker()); } // The following code goes through the productions and adds pointers to other // productions that it can expand to without consuming any tokens. Once this is // done, a left-recursion check can be performed. for (Iterator it = bnfproductions.iterator(); it.hasNext();) { NormalProduction prod = (NormalProduction)it.next(); addLeftMost(prod, prod.getExpansion()); } // Now the following loop calls a recursive walk routine that searches for // actual left recursions. The way the algorithm is coded, once a node has // been determined to participate in a left recursive loop, it is not tried // in any other loop. for (Iterator it = bnfproductions.iterator(); it.hasNext();) { NormalProduction prod = (NormalProduction)it.next(); if (prod.getWalkStatus() == 0) { prodWalk(prod); } } // Now we do a similar, but much simpler walk for the regular expression part of // the grammar. Here we are looking for any kind of loop, not just left recursions, // so we only need to do the equivalent of the above walk. // This is not done if option USER_TOKEN_MANAGER is set to true. if (!Options.getUserTokenManager()) { for (Iterator it = rexprlist.iterator(); it.hasNext();) { TokenProduction tp = (TokenProduction)(it.next()); List respecs = tp.respecs; for (Iterator it1 = respecs.iterator(); it1.hasNext();) { RegExprSpec res = (RegExprSpec)(it1.next()); RegularExpression rexp = res.rexp; if (rexp.walkStatus == 0) { rexp.walkStatus = -1; if (rexpWalk(rexp)) { loopString = "..." + rexp.label + "... --> " + loopString; JavaCCErrors.semantic_error(rexp, "Loop in regular expression detected: \"" + loopString + "\""); } rexp.walkStatus = 1; } } } } /* * The following code performs the lookahead ambiguity checking. */ if (JavaCCErrors.get_error_count() == 0) { for (Iterator it = bnfproductions.iterator(); it.hasNext();) { ExpansionTreeWalker.preOrderWalk(((NormalProduction)it.next()).getExpansion(), new LookaheadChecker()); } } } // matches "if (Options.getSanityCheck()) {" if (JavaCCErrors.get_error_count() != 0) throw new MetaParseException(); } public static RegularExpression other; // Checks to see if the "str" is superceded by another equal (except case) string // in table. public static boolean hasIgnoreCase(Hashtable table, String str) { RegularExpression rexp; rexp = (RegularExpression)(table.get(str)); if (rexp != null && !rexp.tpContext.ignoreCase) { return false; } for (Enumeration enumeration = table.elements(); enumeration.hasMoreElements();) { rexp = (RegularExpression)(enumeration.nextElement()); if (rexp.tpContext.ignoreCase) { other = rexp; return true; } } return false; } // returns true if "exp" can expand to the empty string, returns false otherwise. public static boolean emptyExpansionExists(Expansion exp) { if (exp instanceof NonTerminal) { return ((NonTerminal)exp).getProd().isEmptyPossible(); } else if (exp instanceof Action) { return true; } else if (exp instanceof RegularExpression) { return false; } else if (exp instanceof OneOrMore) { return emptyExpansionExists(((OneOrMore)exp).expansion); } else if (exp instanceof ZeroOrMore || exp instanceof ZeroOrOne) { return true; } else if (exp instanceof Lookahead) { return true; } else if (exp instanceof Choice) { for (Iterator it = ((Choice)exp).getChoices().iterator(); it.hasNext();) { if (emptyExpansionExists((Expansion)it.next())) { return true; } } return false; } else if (exp instanceof Sequence) { for (Iterator it = ((Sequence)exp).units.iterator(); it.hasNext();) { if (!emptyExpansionExists((Expansion)it.next())) { return false; } } return true; } else if (exp instanceof TryBlock) { return emptyExpansionExists(((TryBlock)exp).exp); } else { return false; // This should be dead code. } } // Updates prod.leftExpansions based on a walk of exp. static private void addLeftMost(NormalProduction prod, Expansion exp) { if (exp instanceof NonTerminal) { for (int i=0; i " + prod.getLeftExpansions()[i].getLhs() + "..."; if (prod.getWalkStatus() == -2) { prod.setWalkStatus(1); JavaCCErrors.semantic_error(prod, "Left recursion detected: \"" + loopString + "\""); return false; } else { prod.setWalkStatus(1); return true; } } else if (prod.getLeftExpansions()[i].getWalkStatus() == 0) { if (prodWalk(prod.getLeftExpansions()[i])) { loopString = prod.getLhs() + "... --> " + loopString; if (prod.getWalkStatus() == -2) { prod.setWalkStatus(1); JavaCCErrors.semantic_error(prod, "Left recursion detected: \"" + loopString + "\""); return false; } else { prod.setWalkStatus(1); return true; } } } } prod.setWalkStatus(1); return false; } // Returns true to indicate an unraveling of a detected loop, // and returns false otherwise. static private boolean rexpWalk(RegularExpression rexp) { if (rexp instanceof RJustName) { RJustName jn = (RJustName)rexp; if (jn.regexpr.walkStatus == -1) { jn.regexpr.walkStatus = -2; loopString = "..." + jn.regexpr.label + "..."; // Note: Only the regexpr's of RJustName nodes and the top leve // regexpr's can have labels. Hence it is only in these cases that // the labels are checked for to be added to the loopString. return true; } else if (jn.regexpr.walkStatus == 0) { jn.regexpr.walkStatus = -1; if (rexpWalk(jn.regexpr)) { loopString = "..." + jn.regexpr.label + "... --> " + loopString; if (jn.regexpr.walkStatus == -2) { jn.regexpr.walkStatus = 1; JavaCCErrors.semantic_error(jn.regexpr, "Loop in regular expression detected: \"" + loopString + "\""); return false; } else { jn.regexpr.walkStatus = 1; return true; } } else { jn.regexpr.walkStatus = 1; return false; } } } else if (rexp instanceof RChoice) { for (Iterator it = ((RChoice)rexp).getChoices().iterator(); it.hasNext();) { if (rexpWalk((RegularExpression)it.next())) { return true; } } return false; } else if (rexp instanceof RSequence) { for (Iterator it = ((RSequence)rexp).units.iterator(); it.hasNext();) { if (rexpWalk((RegularExpression)it.next())) { return true; } } return false; } else if (rexp instanceof ROneOrMore) { return rexpWalk(((ROneOrMore)rexp).regexpr); } else if (rexp instanceof RZeroOrMore) { return rexpWalk(((RZeroOrMore)rexp).regexpr); } else if (rexp instanceof RZeroOrOne) { return rexpWalk(((RZeroOrOne)rexp).regexpr); } else if (rexp instanceof RRepetitionRange) { return rexpWalk(((RRepetitionRange)rexp).regexpr); } return false; } /** * Objects of this class are created from class Semanticize to work on * references to regular expressions from RJustName's. */ static class FixRJustNames extends JavaCCGlobals implements TreeWalkerOp { public RegularExpression root; public boolean goDeeper(Expansion e) { return true; } public void action(Expansion e) { if (e instanceof RJustName) { RJustName jn = (RJustName)e; RegularExpression rexp = (RegularExpression)named_tokens_table.get(jn.label); if (rexp == null) { JavaCCErrors.semantic_error(e, "Undefined lexical token name \"" + jn.label + "\"."); } else if (jn == root && !jn.tpContext.isExplicit && rexp.private_rexp) { JavaCCErrors.semantic_error(e, "Token name \"" + jn.label + "\" refers to a private " + "(with a #) regular expression."); } else if (jn == root && !jn.tpContext.isExplicit && rexp.tpContext.kind != TokenProduction.TOKEN) { JavaCCErrors.semantic_error(e, "Token name \"" + jn.label + "\" refers to a non-token " + "(SKIP, MORE, IGNORE_IN_BNF) regular expression."); } else { jn.ordinal = rexp.ordinal; jn.regexpr = rexp; } } } } static class LookaheadFixer extends JavaCCGlobals implements TreeWalkerOp { public boolean goDeeper(Expansion e) { if (e instanceof RegularExpression) { return false; } else { return true; } } public void action(Expansion e) { if (e instanceof Sequence) { if (e.parent instanceof Choice || e.parent instanceof ZeroOrMore || e.parent instanceof OneOrMore || e.parent instanceof ZeroOrOne) { return; } Sequence seq = (Sequence)e; Lookahead la = (Lookahead)(seq.units.get(0)); if (!la.isExplicit()) { return; } // Create a singleton choice with an empty action. Choice ch = new Choice(); ch.setLine(la.getLine()); ch.setColumn(la.getColumn()); ch.parent = seq; Sequence seq1 = new Sequence(); seq1.setLine(la.getLine()); seq1.setColumn(la.getColumn()); seq1.parent = ch; seq1.units.add(la); la.parent = seq1; Action act = new Action(); act.setLine(la.getLine()); act.setColumn(la.getColumn()); act.parent = seq1; seq1.units.add(act); ch.getChoices().add(seq1); if (la.getAmount() != 0) { if (la.getActionTokens().size() != 0) { JavaCCErrors.warning(la, "Encountered LOOKAHEAD(...) at a non-choice location. " + "Only semantic lookahead will be considered here."); } else { JavaCCErrors.warning(la, "Encountered LOOKAHEAD(...) at a non-choice location. This will be ignored."); } } // Now we have moved the lookahead into the singleton choice. Now create // a new dummy lookahead node to replace this one at its original location. Lookahead la1 = new Lookahead(); la1.setExplicit(false); la1.setLine(la.getLine()); la1.setColumn(la.getColumn()); la1.parent = seq; // Now set the la_expansion field of la and la1 with a dummy expansion (we use EOF). la.setLaExpansion(new REndOfFile()); la1.setLaExpansion(new REndOfFile()); seq.units.set(0, la1); seq.units.add(1, ch); } } } static class ProductionDefinedChecker extends JavaCCGlobals implements TreeWalkerOp { public boolean goDeeper(Expansion e) { if (e instanceof RegularExpression) { return false; } else { return true; } } public void action(Expansion e) { if (e instanceof NonTerminal) { NonTerminal nt = (NonTerminal)e; if ((nt.setProd((NormalProduction)production_table.get(nt.getName()))) == null) { JavaCCErrors.semantic_error(e, "Non-terminal " + nt.getName() + " has not been defined."); } else { nt.getProd().getParents().add(nt); } } } } static class EmptyChecker extends JavaCCGlobals implements TreeWalkerOp { public boolean goDeeper(Expansion e) { if (e instanceof RegularExpression) { return false; } else { return true; } } public void action(Expansion e) { if (e instanceof OneOrMore) { if (Semanticize.emptyExpansionExists(((OneOrMore)e).expansion)) { JavaCCErrors.semantic_error(e, "Expansion within \"(...)+\" can be matched by empty string."); } } else if (e instanceof ZeroOrMore) { if (Semanticize.emptyExpansionExists(((ZeroOrMore)e).expansion)) { JavaCCErrors.semantic_error(e, "Expansion within \"(...)*\" can be matched by empty string."); } } else if (e instanceof ZeroOrOne) { if (Semanticize.emptyExpansionExists(((ZeroOrOne)e).expansion)) { JavaCCErrors.semantic_error(e, "Expansion within \"(...)?\" can be matched by empty string."); } } } } static class LookaheadChecker extends JavaCCGlobals implements TreeWalkerOp { public boolean goDeeper(Expansion e) { if (e instanceof RegularExpression) { return false; } else if (e instanceof Lookahead) { return false; } else { return true; } } public void action(Expansion e) { if (e instanceof Choice) { if (Options.getLookahead() == 1 || Options.getForceLaCheck()) { LookaheadCalc.choiceCalc((Choice)e); } } else if (e instanceof OneOrMore) { OneOrMore exp = (OneOrMore)e; if (Options.getForceLaCheck() || (implicitLA(exp.expansion) && Options.getLookahead() == 1)) { LookaheadCalc.ebnfCalc(exp, exp.expansion); } } else if (e instanceof ZeroOrMore) { ZeroOrMore exp = (ZeroOrMore)e; if (Options.getForceLaCheck() || (implicitLA(exp.expansion) && Options.getLookahead() == 1)) { LookaheadCalc.ebnfCalc(exp, exp.expansion); } } else if (e instanceof ZeroOrOne) { ZeroOrOne exp = (ZeroOrOne)e; if (Options.getForceLaCheck() || (implicitLA(exp.expansion) && Options.getLookahead() == 1)) { LookaheadCalc.ebnfCalc(exp, exp.expansion); } } } static boolean implicitLA(Expansion exp) { if (!(exp instanceof Sequence)) { return true; } Sequence seq = (Sequence)exp; Object obj = seq.units.get(0); if (!(obj instanceof Lookahead)) { return true; } Lookahead la = (Lookahead)obj; return !la.isExplicit(); } } public static void reInit() { removeList = new ArrayList(); itemList = new ArrayList(); other = null; loopString = null; } } javacc-5.0.orig/src/org/javacc/parser/RSequence.java0000644000175000017500000000545611070137746021406 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; /** * Describes regular expressions which are sequences of * other regular expressions. */ public class RSequence extends RegularExpression { /** * The list of units in this regular expression sequence. Each * list component will narrow to RegularExpression. */ public List units = new ArrayList(); public Nfa GenerateNfa(boolean ignoreCase) { if (units.size() == 1) return ((RegularExpression)units.get(0)).GenerateNfa(ignoreCase); Nfa retVal = new Nfa(); NfaState startState = retVal.start; NfaState finalState = retVal.end; Nfa temp1; Nfa temp2 = null; RegularExpression curRE; curRE = (RegularExpression)units.get(0); temp1 = curRE.GenerateNfa(ignoreCase); startState.AddMove(temp1.start); for (int i = 1; i < units.size(); i++) { curRE = (RegularExpression)units.get(i); temp2 = curRE.GenerateNfa(ignoreCase); temp1.end.AddMove(temp2.start); temp1 = temp2; } temp2.end.AddMove(finalState); return retVal; } RSequence() { } RSequence(List seq) { ordinal = Integer.MAX_VALUE; units = seq; } } javacc-5.0.orig/src/org/javacc/parser/Lookahead.java0000644000175000017500000001013711070513744021367 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * Describes lookahead rule for a particular expansion or expansion * sequence (See Sequence.java). In case this describes the lookahead * rule for a single expansion unit, then a sequence is created with * this node as the first element, and the expansion unit as the second * and last element. */ public class Lookahead extends Expansion { /** * Contains the list of tokens that make up the semantic lookahead * if any. If this node represents a different kind of lookahead (other * than semantic lookahead), then this list contains nothing. If * this list contains something, then it is the boolean expression * that forms the semantic lookahead. In this case, the following * fields "amount" and "la_expansion" are ignored. */ private List action_tokens = new ArrayList(); /** * The lookahead amount. Its default value essentially gives us * infinite lookahead. */ private int amount = Integer.MAX_VALUE; /** * The expansion used to determine whether or not to choose the * corresponding parse option. This expansion is parsed upto * "amount" tokens of lookahead or until a complete match for it * is found. Usually, this is the same as the expansion to be * parsed. */ private Expansion la_expansion; /** * Is set to true if this is an explicit lookahead specification. */ private boolean isExplicit; public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = super.dump(indent, alreadyDumped).append(isExplicit ? " explicit" : " implicit"); if (alreadyDumped.contains(this)) return sb; alreadyDumped.add(this); sb.append(eol).append(la_expansion.dump(indent + 1, alreadyDumped)); return sb; } /** * @return the action_tokens */ public List getActionTokens() { return action_tokens; } /** * @param amount the amount to set */ public void setAmount(int amount) { this.amount = amount; } /** * @return the amount */ public int getAmount() { return amount; } /** * @param la_expansion the la_expansion to set */ public void setLaExpansion(Expansion la_expansion) { this.la_expansion = la_expansion; } /** * @return the la_expansion */ public Expansion getLaExpansion() { return la_expansion; } /** * @param isExplicit the isExplicit to set */ public void setExplicit(boolean isExplicit) { this.isExplicit = isExplicit; } /** * @return the isExplicit */ public boolean isExplicit() { return isExplicit; } } javacc-5.0.orig/src/org/javacc/parser/MetaParseException.java0000644000175000017500000000334410576317057023253 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * Thrown when there is a mis-configuration or a bug. */ public class MetaParseException extends ParseException { } javacc-5.0.orig/src/org/javacc/parser/Nfa.java0000644000175000017500000000363610576210056020212 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; /** * A Non-deterministic Finite Automaton. */ public class Nfa { NfaState start; NfaState end; public Nfa() { start = new NfaState(); end = new NfaState(); } public Nfa(NfaState startGiven, NfaState finalGiven) { start = startGiven; end = finalGiven; } } javacc-5.0.orig/src/org/javacc/parser/NonTerminal.java0000644000175000017500000000633111070513744021727 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * Describes non terminals. */ public class NonTerminal extends Expansion { /** * The LHS to which the return value of the non-terminal * is assigned. In case there is no LHS, then the vector * remains empty. */ private List lhsTokens = new ArrayList(); /** * The name of the non-terminal. */ private String name; /** * The list of all tokens in the argument list. */ private List argument_tokens = new ArrayList(); /** * The production this non-terminal corresponds to. */ private NormalProduction prod; public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer value = super.dump(indent, alreadyDumped).append(' ').append(name); return value; } /** * @param lhsTokens the lhsTokens to set */ public void setLhsTokens(List lhsTokens) { this.lhsTokens = lhsTokens; } /** * @return the lhsTokens */ public List getLhsTokens() { return lhsTokens; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the name */ public String getName() { return name; } /** * @param argument_tokens the argument_tokens to set */ public void setArgumentTokens(List argument_tokens) { this.argument_tokens = argument_tokens; } /** * @return the argument_tokens */ public List getArgumentTokens() { return argument_tokens; } /** * @param prod the prod to set */ public NormalProduction setProd(NormalProduction prod) { return this.prod = prod; } /** * @return the prod */ public NormalProduction getProd() { return prod; } } javacc-5.0.orig/src/org/javacc/parser/Action.java0000644000175000017500000000454011070513743020715 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.util.ArrayList; import java.util.List; import java.util.Set; /** * Describes actions that may occur on the right hand side * of productions. */ public class Action extends Expansion { /** * Contains the list of tokens that make up the action. This * list does not include the surrounding braces. */ private List action_tokens = new ArrayList(); public StringBuffer dump(int indent, Set alreadyDumped) { StringBuffer sb = super.dump(indent, alreadyDumped); alreadyDumped.add(this); if (getActionTokens().size() > 0) { sb.append(' ').append(getActionTokens().get(0)); } return sb; } /** * @return the action_tokens */ public List getActionTokens() { return action_tokens; } } javacc-5.0.orig/src/org/javacc/parser/JavaFiles.java0000644000175000017500000003664411226741736021366 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import org.javacc.Version; import org.javacc.utils.JavaFileGenerator; /** * Generate CharStream, TokenManager and Exceptions. */ public class JavaFiles extends JavaCCGlobals implements JavaCCParserConstants { /** * ID of the latest version (of JavaCC) in which one of the CharStream classes * or the CharStream interface is modified. */ static final String charStreamVersion = "5.0"; /** * ID of the latest version (of JavaCC) in which the TokenManager interface is modified. */ static final String tokenManagerVersion = "5.0"; /** * ID of the latest version (of JavaCC) in which the Token class is modified. */ static final String tokenVersion = "5.0"; /** * ID of the latest version (of JavaCC) in which the ParseException class is * modified. */ static final String parseExceptionVersion = "5.0"; /** * ID of the latest version (of JavaCC) in which the TokenMgrError class is * modified. */ static final String tokenMgrErrorVersion = "5.0"; /** * Replaces all backslahes with double backslashes. */ static String replaceBackslash(String str) { StringBuffer b; int i = 0, len = str.length(); while (i < len && str.charAt(i++) != '\\') ; if (i == len) // No backslash found. return str; char c; b = new StringBuffer(); for (i = 0; i < len; i++) if ((c = str.charAt(i)) == '\\') b.append("\\\\"); else b.append(c); return b.toString(); } /** * Read the version from the comment in the specified file. * This method does not try to recover from invalid comment syntax, but * rather returns version 0.0 (which will always be taken to mean the file * is out of date). * @param fileName eg Token.java * @return The version as a double, eg 4.1 * @since 4.1 */ static double getVersion(String fileName) { final String commentHeader = "/* " + getIdString(toolName, fileName) + " Version "; File file = new File(Options.getOutputDirectory(), replaceBackslash(fileName)); if (!file.exists()) { // Has not yet been created, so it must be up to date. try { String majorVersion = Version.versionNumber.replaceAll("[^0-9.]+.*", ""); return Double.parseDouble(majorVersion); } catch (NumberFormatException e) { return 0.0; // Should never happen } } BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(file)); String str; double version = 0.0; // Although the version comment should be the first line, sometimes the // user might have put comments before it. while ( (str = reader.readLine()) != null) { if (str.startsWith(commentHeader)) { str = str.substring(commentHeader.length()); int pos = str.indexOf(' '); if (pos >= 0) str = str.substring(0, pos); if (str.length() > 0) { try { version = Double.parseDouble(str); } catch (NumberFormatException nfe) { // Ignore - leave version as 0.0 } } break; } } return version; } catch (IOException ioe) { return 0.0; } finally { if (reader != null) { try { reader.close(); } catch (IOException e) {} } } } public static void gen_JavaCharStream() { try { final File file = new File(Options.getOutputDirectory(), "JavaCharStream.java"); final OutputFile outputFile = new OutputFile(file, charStreamVersion, new String[] {"STATIC", "SUPPORT_CLASS_VISIBILITY_PUBLIC"}); if (!outputFile.needToWrite) { return; } final PrintWriter ostr = outputFile.getPrintWriter(); if (cu_to_insertion_point_1.size() != 0 && ((Token)cu_to_insertion_point_1.get(0)).kind == PACKAGE ) { for (int i = 1; i < cu_to_insertion_point_1.size(); i++) { if (((Token)cu_to_insertion_point_1.get(i)).kind == SEMICOLON) { cline = ((Token)(cu_to_insertion_point_1.get(0))).beginLine; ccol = ((Token)(cu_to_insertion_point_1.get(0))).beginColumn; for (int j = 0; j <= i; j++) { printToken((Token)(cu_to_insertion_point_1.get(j)), ostr); } ostr.println(""); ostr.println(""); break; } } } String prefix = (Options.getStatic() ? "static " : ""); Map options = new HashMap(Options.getOptions()); options.put("PREFIX", prefix); JavaFileGenerator generator = new JavaFileGenerator( "/templates/JavaCharStream.template", options); generator.generate(ostr); ostr.close(); } catch (IOException e) { System.err.println("Failed to create JavaCharStream " + e); JavaCCErrors.semantic_error("Could not open file JavaCharStream.java for writing."); throw new Error(); } } public static void gen_SimpleCharStream() { try { final File file = new File(Options.getOutputDirectory(), "SimpleCharStream.java"); final OutputFile outputFile = new OutputFile(file, charStreamVersion, new String[] {"STATIC", "SUPPORT_CLASS_VISIBILITY_PUBLIC"}); if (!outputFile.needToWrite) { return; } final PrintWriter ostr = outputFile.getPrintWriter(); if (cu_to_insertion_point_1.size() != 0 && ((Token)cu_to_insertion_point_1.get(0)).kind == PACKAGE ) { for (int i = 1; i < cu_to_insertion_point_1.size(); i++) { if (((Token)cu_to_insertion_point_1.get(i)).kind == SEMICOLON) { cline = ((Token)(cu_to_insertion_point_1.get(0))).beginLine; ccol = ((Token)(cu_to_insertion_point_1.get(0))).beginColumn; for (int j = 0; j <= i; j++) { printToken((Token)(cu_to_insertion_point_1.get(j)), ostr); } ostr.println(""); ostr.println(""); break; } } } String prefix = (Options.getStatic() ? "static " : ""); Map options = new HashMap(Options.getOptions()); options.put("PREFIX", prefix); JavaFileGenerator generator = new JavaFileGenerator( "/templates/SimpleCharStream.template", options); generator.generate(ostr); ostr.close(); } catch (IOException e) { System.err.println("Failed to create SimpleCharStream " + e); JavaCCErrors.semantic_error("Could not open file SimpleCharStream.java for writing."); throw new Error(); } } public static void gen_CharStream() { try { final File file = new File(Options.getOutputDirectory(), "CharStream.java"); final OutputFile outputFile = new OutputFile(file, charStreamVersion, new String[] {"STATIC", "SUPPORT_CLASS_VISIBILITY_PUBLIC"}); if (!outputFile.needToWrite) { return; } final PrintWriter ostr = outputFile.getPrintWriter(); if (cu_to_insertion_point_1.size() != 0 && ((Token)cu_to_insertion_point_1.get(0)).kind == PACKAGE ) { for (int i = 1; i < cu_to_insertion_point_1.size(); i++) { if (((Token)cu_to_insertion_point_1.get(i)).kind == SEMICOLON) { cline = ((Token)(cu_to_insertion_point_1.get(0))).beginLine; ccol = ((Token)(cu_to_insertion_point_1.get(0))).beginColumn; for (int j = 0; j <= i; j++) { printToken((Token)(cu_to_insertion_point_1.get(j)), ostr); } ostr.println(""); ostr.println(""); break; } } } JavaFileGenerator generator = new JavaFileGenerator( "/templates/CharStream.template", Options.getOptions()); generator.generate(ostr); ostr.close(); } catch (IOException e) { System.err.println("Failed to create CharStream " + e); JavaCCErrors.semantic_error("Could not open file CharStream.java for writing."); throw new Error(); } } public static void gen_ParseException() { try { final File file = new File(Options.getOutputDirectory(), "ParseException.java"); final OutputFile outputFile = new OutputFile(file, parseExceptionVersion, new String[] {"KEEP_LINE_COL"}); if (!outputFile.needToWrite) { return; } final PrintWriter ostr = outputFile.getPrintWriter(); if (cu_to_insertion_point_1.size() != 0 && ((Token)cu_to_insertion_point_1.get(0)).kind == PACKAGE ) { for (int i = 1; i < cu_to_insertion_point_1.size(); i++) { if (((Token)cu_to_insertion_point_1.get(i)).kind == SEMICOLON) { cline = ((Token)(cu_to_insertion_point_1.get(0))).beginLine; ccol = ((Token)(cu_to_insertion_point_1.get(0))).beginColumn; for (int j = 0; j <= i; j++) { printToken((Token)(cu_to_insertion_point_1.get(j)), ostr); } ostr.println(""); ostr.println(""); break; } } } JavaFileGenerator generator = new JavaFileGenerator( "/templates/ParseException.template", Options.getOptions()); generator.generate(ostr); ostr.close(); } catch (IOException e) { System.err.println("Failed to create ParseException " + e); JavaCCErrors.semantic_error("Could not open file ParseException.java for writing."); throw new Error(); } } public static void gen_TokenMgrError() { try { final File file = new File(Options.getOutputDirectory(), "TokenMgrError.java"); final OutputFile outputFile = new OutputFile(file, tokenMgrErrorVersion, new String[0]); if (!outputFile.needToWrite) { return; } final PrintWriter ostr = outputFile.getPrintWriter(); if (cu_to_insertion_point_1.size() != 0 && ((Token)cu_to_insertion_point_1.get(0)).kind == PACKAGE ) { for (int i = 1; i < cu_to_insertion_point_1.size(); i++) { if (((Token)cu_to_insertion_point_1.get(i)).kind == SEMICOLON) { cline = ((Token)(cu_to_insertion_point_1.get(0))).beginLine; ccol = ((Token)(cu_to_insertion_point_1.get(0))).beginColumn; for (int j = 0; j <= i; j++) { printToken((Token)(cu_to_insertion_point_1.get(j)), ostr); } ostr.println(""); ostr.println(""); break; } } } JavaFileGenerator generator = new JavaFileGenerator( "/templates/TokenMgrError.template", Options.getOptions()); generator.generate(ostr); ostr.close(); } catch (IOException e) { System.err.println("Failed to create TokenMgrError " + e); JavaCCErrors.semantic_error("Could not open file TokenMgrError.java for writing."); throw new Error(); } } public static void gen_Token() { try { final File file = new File(Options.getOutputDirectory(), "Token.java"); final OutputFile outputFile = new OutputFile(file, tokenVersion, new String[] {"TOKEN_EXTENDS", "KEEP_LINE_COL", "SUPPORT_CLASS_VISIBILITY_PUBLIC"}); if (!outputFile.needToWrite) { return; } final PrintWriter ostr = outputFile.getPrintWriter(); if (cu_to_insertion_point_1.size() != 0 && ((Token)cu_to_insertion_point_1.get(0)).kind == PACKAGE ) { for (int i = 1; i < cu_to_insertion_point_1.size(); i++) { if (((Token)cu_to_insertion_point_1.get(i)).kind == SEMICOLON) { cline = ((Token)(cu_to_insertion_point_1.get(0))).beginLine; ccol = ((Token)(cu_to_insertion_point_1.get(0))).beginColumn; for (int j = 0; j <= i; j++) { printToken((Token)(cu_to_insertion_point_1.get(j)), ostr); } ostr.println(""); ostr.println(""); break; } } } JavaFileGenerator generator = new JavaFileGenerator( "/templates/Token.template", Options.getOptions()); generator.generate(ostr); ostr.close(); } catch (IOException e) { System.err.println("Failed to create Token " + e); JavaCCErrors.semantic_error("Could not open file Token.java for writing."); throw new Error(); } } public static void gen_TokenManager() { try { final File file = new File(Options.getOutputDirectory(), "TokenManager.java"); final OutputFile outputFile = new OutputFile(file, tokenManagerVersion, new String[] {"SUPPORT_CLASS_VISIBILITY_PUBLIC"}); if (!outputFile.needToWrite) { return; } final PrintWriter ostr = outputFile.getPrintWriter(); if (cu_to_insertion_point_1.size() != 0 && ((Token)cu_to_insertion_point_1.get(0)).kind == PACKAGE ) { for (int i = 1; i < cu_to_insertion_point_1.size(); i++) { if (((Token)cu_to_insertion_point_1.get(i)).kind == SEMICOLON) { cline = ((Token)(cu_to_insertion_point_1.get(0))).beginLine; ccol = ((Token)(cu_to_insertion_point_1.get(0))).beginColumn; for (int j = 0; j <= i; j++) { printToken((Token)(cu_to_insertion_point_1.get(j)), ostr); } ostr.println(""); ostr.println(""); break; } } } JavaFileGenerator generator = new JavaFileGenerator( "/templates/TokenManager.template", Options.getOptions()); generator.generate(ostr); ostr.close(); } catch (IOException e) { System.err.println("Failed to create TokenManager " + e); JavaCCErrors.semantic_error("Could not open file TokenManager.java for writing."); throw new Error(); } } public static void reInit() { } } javacc-5.0.orig/src/org/javacc/parser/ExpansionTest.java0000644000175000017500000001070411070513743022303 0ustar mkochmkoch/* Copyright (c) 2007, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.parser; import junit.framework.TestCase; public final class ExpansionTest extends TestCase { private Token t; private Expansion e; public void setUp() { t = new Token(); t.beginColumn = 2; t.beginLine = 3; e = new Expansion(); e.setColumn(5); e.setLine(6); } public void testZeroOrOneConstructor() { ZeroOrOne zoo = new ZeroOrOne(t, e); assertEquals(t.beginColumn, zoo.getColumn()); assertEquals(t.beginLine, zoo.getLine()); assertEquals(e, zoo.expansion); assertSame(e.parent, zoo); } public void testZeroOrMoreConstructor() { ZeroOrMore zom = new ZeroOrMore(t, e); assertEquals(t.beginColumn, zom.getColumn()); assertEquals(t.beginLine, zom.getLine()); assertEquals(e, zom.expansion); assertEquals(e.parent, zom); } public void testRZeroOrMoreConstructor() { RegularExpression r = new RChoice(); RZeroOrMore rzom = new RZeroOrMore(t, r); assertEquals(t.beginColumn, rzom.getColumn()); assertEquals(t.beginLine, rzom.getLine()); assertEquals(r, rzom.regexpr); } public void testROneOrMoreConstructor() { RegularExpression r = new RChoice(); ROneOrMore room = new ROneOrMore(t, r); assertEquals(t.beginColumn, room.getColumn()); assertEquals(t.beginLine, room.getLine()); assertEquals(r, room.regexpr); } public void testOneOrMoreConstructor() { Expansion rce = new RChoice(); OneOrMore oom = new OneOrMore(t, rce); assertEquals(t.beginColumn, oom.getColumn()); assertEquals(t.beginLine, oom.getLine()); assertEquals(rce, oom.expansion); assertEquals(rce.parent, oom); } public void testRStringLiteralConstructor() { RStringLiteral r = new RStringLiteral(t, "hey"); assertEquals(t.beginColumn, r.getColumn()); assertEquals(t.beginLine, r.getLine()); assertEquals("hey", r.image); } public void testChoiceConstructor() { Choice c = new Choice(t); assertEquals(t.beginColumn, c.getColumn()); assertEquals(t.beginLine, c.getLine()); c = new Choice(e); assertEquals(e.getColumn(), c.getColumn()); assertEquals(e.getLine(), c.getLine()); assertEquals(e, c.getChoices().get(0)); } public void testRJustNameConstructor() { RJustName r = new RJustName(t, "hey"); assertEquals(t.beginColumn, r.getColumn()); assertEquals(t.beginLine, r.getLine()); assertEquals("hey", r.label); } public void testSequenceConstructor() { Lookahead la = new Lookahead(); Sequence s = new Sequence(t, la); assertEquals(t.beginColumn, s.getColumn()); assertEquals(t.beginLine, s.getLine()); assertSame(la, s.units.get(0)); } } javacc-5.0.orig/src/org/javacc/jjtree/0000755000175000017500000000000011247044053016620 5ustar mkochmkochjavacc-5.0.orig/src/org/javacc/jjtree/ASTBNF.java0000644000175000017500000000360011070137745020444 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTBNF extends ASTProduction { ASTBNF(int id) { super(id); throws_list.add("ParseException"); throws_list.add("RuntimeException"); } Token declBeginLoc; public String toString() { return super.toString() + ": " + name; } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTNodeDescriptor.java0000644000175000017500000001025211070137745022764 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.Vector; public class ASTNodeDescriptor extends JJTreeNode { ASTNodeDescriptor(int id) { super(id); } private boolean faked = false; static ASTNodeDescriptor indefinite(String s) { ASTNodeDescriptor nd = new ASTNodeDescriptor(JJTreeParserTreeConstants.JJTNODEDESCRIPTOR); nd.name = s; nd.setNodeIdValue(); nd.faked = true; return nd; } static List nodeIds = new ArrayList(); static List nodeNames = new ArrayList(); static Hashtable nodeSeen = new Hashtable(); static List getNodeIds() { return nodeIds; } static List getNodeNames() { return nodeNames; } void setNodeIdValue() { String k = getNodeId(); if (!nodeSeen.containsKey(k)) { nodeSeen.put(k, k); nodeNames.add(name); nodeIds.add(k); } } String getNodeId() { return "JJT" + name.toUpperCase().replace('.', '_'); } String name; boolean isGT; ASTNodeDescriptorExpression expression; boolean isVoid() { return name.equals("void"); } public String toString() { if (faked) { return "(faked) " + name; } else { return super.toString() + ": " + name; } } String getDescriptor() { if (expression == null) { return name; } else { return "#" + name + "(" + (isGT ? ">" : "") + expression_text() + ")"; } } String getNodeType() { if (JJTreeOptions.getMulti()) { return JJTreeOptions.getNodePrefix() + name; } else { return "SimpleNode"; } } String getNodeName() { return name; } String openNode(String nodeVar) { return "jjtree.openNodeScope(" + nodeVar + ");"; } private String expression_text() { if (expression.getFirstToken().image.equals(")") && expression.getLastToken().image.equals("(")) { return "true"; } String s = ""; Token t = expression.getFirstToken(); while (true) { s += " " + t.image; if (t == expression.getLastToken()) { break; } t = t.next; } return s; } String closeNode(String nodeVar) { if (expression == null) { return "jjtree.closeNodeScope(" + nodeVar + ", true);"; } else if (isGT) { return "jjtree.closeNodeScope(" + nodeVar + ", jjtree.nodeArity() >" + expression_text() + ");"; } else { return "jjtree.closeNodeScope(" + nodeVar + ", " + expression_text() + ");"; } } String translateImage(Token t) { return whiteOut(t); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTBNFDeclaration.java0000644000175000017500000000431410716132660022612 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTBNFDeclaration extends JJTreeNode { ASTBNFDeclaration(int id) { super(id); } NodeScope node_scope; public void print(IO io) { if (!node_scope.isVoid()) { String indent = ""; if (TokenUtils.hasTokens(this)) { for (int i = 1; i < getFirstToken().beginColumn; ++i) { indent += " "; } } else { indent = " "; } openJJTreeComment(io, node_scope.getNodeDescriptorText()); io.println(); node_scope.insertOpenNodeCode(io, indent); closeJJTreeComment(io); } super.print(io); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTLHS.java0000644000175000017500000000413110716132661020463 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTLHS extends JJTreeNode { ASTLHS(int id) { super(id); } public void print(IO io) { NodeScope ns = NodeScope.getEnclosingNodeScope(this); /* Print out all the tokens, converting all references to `jjtThis' into the current node variable. */ Token first = getFirstToken(); Token last = getLastToken(); for (Token t = first; t != last.next; t = t.next) { TokenUtils.print(t, io, "jjtThis", ns.getNodeVariable()); } } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/TokenUtils.java0000644000175000017500000001323510751636206021576 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import org.javacc.parser.JavaCCErrors; /** * Utilities for manipulating Tokens. */ public final class TokenUtils { private TokenUtils() {} static void print(Token t, IO io, String in, String out) { Token tt = t.specialToken; if (tt != null) { while (tt.specialToken != null) tt = tt.specialToken; while (tt != null) { io.print(addUnicodeEscapes(tt.image)); tt = tt.next; } } String i = t.image; if (in != null && i.equals(in)) { i = out; } io.print(addUnicodeEscapes(i)); } static void print(Token t, IO io) { print(t, io, null, null); } static String addUnicodeEscapes(String str) { StringBuffer buff = new StringBuffer(str.length()); char ch; for (int i = 0; i < str.length(); i++) { ch = str.charAt(i); if ((ch < 0x20 || ch > 0x7e) && ch != '\t' && ch != '\n' && ch != '\r' && ch != '\f') { String s = "0000" + Integer.toString(ch, 16); buff.append("\\u" + s.substring(s.length() - 4, s.length())); } else { buff.append(ch); } } return buff.toString(); } static boolean hasTokens(JJTreeNode n) { if (n.getLastToken().next == n.getFirstToken()) { return false; } else { return true; } } static String remove_escapes_and_quotes(Token t, String str) { String retval = ""; int index = 1; char ch, ch1; int ordinal; while (index < str.length()-1) { if (str.charAt(index) != '\\') { retval += str.charAt(index); index++; continue; } index++; ch = str.charAt(index); if (ch == 'b') { retval += '\b'; index++; continue; } if (ch == 't') { retval += '\t'; index++; continue; } if (ch == 'n') { retval += '\n'; index++; continue; } if (ch == 'f') { retval += '\f'; index++; continue; } if (ch == 'r') { retval += '\r'; index++; continue; } if (ch == '"') { retval += '\"'; index++; continue; } if (ch == '\'') { retval += '\''; index++; continue; } if (ch == '\\') { retval += '\\'; index++; continue; } if (ch >= '0' && ch <= '7') { ordinal = ((int)ch) - ((int)'0'); index++; ch1 = str.charAt(index); if (ch1 >= '0' && ch1 <= '7') { ordinal = ordinal*8 + ((int)ch1) - ((int)'0'); index++; ch1 = str.charAt(index); if (ch <= '3' && ch1 >= '0' && ch1 <= '7') { ordinal = ordinal*8 + ((int)ch1) - ((int)'0'); index++; } } retval += (char)ordinal; continue; } if (ch == 'u') { index++; ch = str.charAt(index); if (hexchar(ch)) { ordinal = hexval(ch); index++; ch = str.charAt(index); if (hexchar(ch)) { ordinal = ordinal*16 + hexval(ch); index++; ch = str.charAt(index); if (hexchar(ch)) { ordinal = ordinal*16 + hexval(ch); index++; ch = str.charAt(index); if (hexchar(ch)) { ordinal = ordinal*16 + hexval(ch); index++; continue; } } } } JavaCCErrors.parse_error(t, "Encountered non-hex character '" + ch + "' at position " + index + " of string - Unicode escape must have 4 hex digits after it."); return retval; } JavaCCErrors.parse_error(t, "Illegal escape sequence '\\" + ch + "' at position " + index + " of string."); return retval; } return retval; } private static boolean hexchar(char ch) { if (ch >= '0' && ch <= '9') return true; if (ch >= 'A' && ch <= 'F') return true; if (ch >= 'a' && ch <= 'f') return true; return false; } private static int hexval(char ch) { if (ch >= '0' && ch <= '9') return ((int)ch) - ((int)'0'); if (ch >= 'A' && ch <= 'F') return ((int)ch) - ((int)'A') + 10; return ((int)ch) - ((int)'a') + 10; } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/NodeScope.java0000644000175000017500000002247010751636206021355 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.util.Enumeration; import java.util.Hashtable; public class NodeScope { private ASTProduction production; private ASTNodeDescriptor node_descriptor; private String closedVar; private String exceptionVar; private String nodeVar; private int scopeNumber; NodeScope(ASTProduction p, ASTNodeDescriptor n) { production = p; if (n == null) { String nm = production.name; if (JJTreeOptions.getNodeDefaultVoid()) { nm = "void"; } node_descriptor = ASTNodeDescriptor.indefinite(nm); } else { node_descriptor = n; } scopeNumber = production.getNodeScopeNumber(this); nodeVar = constructVariable("n"); closedVar = constructVariable("c"); exceptionVar = constructVariable("e"); } boolean isVoid() { return node_descriptor.isVoid(); } ASTNodeDescriptor getNodeDescriptor() { return node_descriptor; } String getNodeDescriptorText() { return node_descriptor.getDescriptor(); } String getNodeVariable() { return nodeVar; } private String constructVariable(String id) { String s = "000" + scopeNumber; return "jjt" + id + s.substring(s.length() - 3, s.length()); } boolean usesCloseNodeVar() { return true; } void insertOpenNodeDeclaration(IO io, String indent) { insertOpenNodeCode(io, indent); } void insertOpenNodeCode(IO io, String indent) { String type = node_descriptor.getNodeType(); final String nodeClass; if (JJTreeOptions.getNodeClass().length() > 0 && !JJTreeOptions.getMulti()) { nodeClass = JJTreeOptions.getNodeClass(); } else { nodeClass = type; } /* Ensure that there is a template definition file for the node type. */ NodeFiles.ensure(io, type); io.print(indent + nodeClass + " " + nodeVar + " = "); String p = JJTreeOptions.getStatic() ? "null" : "this"; String parserArg = JJTreeOptions.getNodeUsesParser() ? (p + ", ") : ""; if (JJTreeOptions.getNodeFactory().equals("*")) { // Old-style multiple-implementations. io.println("(" + nodeClass + ")" + nodeClass + ".jjtCreate(" + parserArg + node_descriptor.getNodeId() +");"); } else if (JJTreeOptions.getNodeFactory().length() > 0) { io.println("(" + nodeClass + ")" + JJTreeOptions.getNodeFactory() + ".jjtCreate(" + parserArg + node_descriptor.getNodeId() +");"); } else { io.println("new " + nodeClass + "(" + parserArg + node_descriptor.getNodeId() + ");"); } if (usesCloseNodeVar()) { io.println(indent + "boolean " + closedVar + " = true;"); } io.println(indent + node_descriptor.openNode(nodeVar)); if (JJTreeOptions.getNodeScopeHook()) { io.println(indent + "jjtreeOpenNodeScope(" + nodeVar + ");"); } if (JJTreeOptions.getTrackTokens()) { io.println(indent + nodeVar + ".jjtSetFirstToken(getToken(1));"); } } void insertCloseNodeCode(IO io, String indent, boolean isFinal) { io.println(indent + node_descriptor.closeNode(nodeVar)); if (usesCloseNodeVar() && !isFinal) { io.println(indent + closedVar + " = false;"); } if (JJTreeOptions.getNodeScopeHook()) { io.println(indent + "jjtreeCloseNodeScope(" + nodeVar + ");"); } if (JJTreeOptions.getTrackTokens()) { io.println(indent + nodeVar + ".jjtSetLastToken(getToken(0));"); } } void insertOpenNodeAction(IO io, String indent) { io.println(indent + "{"); insertOpenNodeCode(io, indent + " "); io.println(indent + "}"); } void insertCloseNodeAction(IO io, String indent) { io.println(indent + "{"); insertCloseNodeCode(io, indent + " ", false); io.println(indent + "}"); } private void insertCatchBlocks(IO io, Enumeration thrown_names, String indent) { String thrown; if (thrown_names.hasMoreElements()) { io.println(indent + "} catch (Throwable " + exceptionVar + ") {"); if (usesCloseNodeVar()) { io.println(indent + " if (" + closedVar + ") {"); io.println(indent + " jjtree.clearNodeScope(" + nodeVar + ");"); io.println(indent + " " + closedVar + " = false;"); io.println(indent + " } else {"); io.println(indent + " jjtree.popNode();"); io.println(indent + " }"); } while (thrown_names.hasMoreElements()) { thrown = (String)thrown_names.nextElement(); io.println(indent + " if (" + exceptionVar + " instanceof " + thrown + ") {"); io.println(indent + " throw (" + thrown + ")" + exceptionVar + ";"); io.println(indent + " }"); } /* This is either an Error or an undeclared Exception. If it's an Error then the cast is good, otherwise we want to force the user to declare it by crashing on the bad cast. */ io.println(indent + " throw (Error)" + exceptionVar + ";"); } } void tryTokenSequence(IO io, String indent, Token first, Token last) { io.println(indent + "try {"); JJTreeNode.closeJJTreeComment(io); /* Print out all the tokens, converting all references to `jjtThis' into the current node variable. */ for (Token t = first; t != last.next; t = t.next) { TokenUtils.print(t, io, "jjtThis", nodeVar); } JJTreeNode.openJJTreeComment(io, null); io.println(); Enumeration thrown_names = production.throws_list.elements(); insertCatchBlocks(io, thrown_names, indent); io.println(indent + "} finally {"); if (usesCloseNodeVar()) { io.println(indent + " if (" + closedVar + ") {"); insertCloseNodeCode(io, indent + " ", true); io.println(indent + " }"); } io.println(indent + "}"); JJTreeNode.closeJJTreeComment(io); } private static void findThrown(Hashtable thrown_set, JJTreeNode expansion_unit) { if (expansion_unit instanceof ASTBNFNonTerminal) { /* Should really make the nonterminal explicitly maintain its name. */ String nt = expansion_unit.getFirstToken().image; ASTProduction prod = (ASTProduction)JJTreeGlobals.productions.get(nt); if (prod != null) { Enumeration e = prod.throws_list.elements(); while (e.hasMoreElements()) { String t = (String)e.nextElement(); thrown_set.put(t, t); } } } for (int i = 0; i < expansion_unit.jjtGetNumChildren(); ++i) { JJTreeNode n = (JJTreeNode)expansion_unit.jjtGetChild(i); findThrown(thrown_set, n); } } void tryExpansionUnit(IO io, String indent, JJTreeNode expansion_unit) { io.println(indent + "try {"); JJTreeNode.closeJJTreeComment(io); expansion_unit.print(io); JJTreeNode.openJJTreeComment(io, null); io.println(); Hashtable thrown_set = new Hashtable(); findThrown(thrown_set, expansion_unit); Enumeration thrown_names = thrown_set.elements(); insertCatchBlocks(io, thrown_names, indent); io.println(indent + "} finally {"); if (usesCloseNodeVar()) { io.println(indent + " if (" + closedVar + ") {"); insertCloseNodeCode(io, indent + " ", true); io.println(indent + " }"); } io.println(indent + "}"); JJTreeNode.closeJJTreeComment(io); } static NodeScope getEnclosingNodeScope(Node node) { if (node instanceof ASTBNFDeclaration) { return ((ASTBNFDeclaration)node).node_scope; } for (Node n = node.jjtGetParent(); n != null; n = n.jjtGetParent()) { if (n instanceof ASTBNFDeclaration) { return ((ASTBNFDeclaration)n).node_scope; } else if (n instanceof ASTBNFNodeScope) { return ((ASTBNFNodeScope)n).node_scope; } else if (n instanceof ASTExpansionNodeScope) { return ((ASTExpansionNodeScope)n).node_scope; } } return null; } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/NodeFiles.java0000644000175000017500000002111011220015314021313 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.javacc.parser.Options; import org.javacc.parser.OutputFile; import org.javacc.utils.JavaFileGenerator; final class NodeFiles { private NodeFiles() {} /** * ID of the latest version (of JJTree) in which one of the Node classes * was modified. */ static final String nodeVersion = "4.3"; static Set nodesGenerated = new HashSet(); static void ensure(IO io, String nodeType) { File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), nodeType + ".java"); if (nodeType.equals("Node")) { } else if (nodeType.equals("SimpleNode")) { ensure(io, "Node"); } else { ensure(io, "SimpleNode"); } /* Only build the node file if we're dealing with Node.java, or the NODE_BUILD_FILES option is set. */ if (!(nodeType.equals("Node") || JJTreeOptions.getBuildNodeFiles())) { return; } if (file.exists() && nodesGenerated.contains(file.getName())) { return; } try { String[] options = new String[] {"MULTI", "NODE_USES_PARSER", "VISITOR", "TRACK_TOKENS", "NODE_PREFIX", "NODE_EXTENDS", "NODE_FACTORY", "SUPPORT_CLASS_VISIBILITY_PUBLIC"}; OutputFile outputFile = new OutputFile(file, nodeVersion, options); outputFile.setToolName("JJTree"); nodesGenerated.add(file.getName()); if (!outputFile.needToWrite) { return; } if (nodeType.equals("Node")) { generateNode_java(outputFile); } else if (nodeType.equals("SimpleNode")) { generateSimpleNode_java(outputFile); } else { generateMULTINode_java(outputFile, nodeType); } outputFile.close(); } catch (IOException e) { throw new Error(e.toString()); } } static void generatePrologue(PrintWriter ostr) { // Output the node's package name. JJTreeGlobals.nodePackageName // will be the value of NODE_PACKAGE in OPTIONS; if that wasn't set it // will default to the parser's package name. // If the package names are different we will need to import classes // from the parser's package. if (!JJTreeGlobals.nodePackageName.equals("")) { ostr.println("package " + JJTreeGlobals.nodePackageName + ";"); ostr.println(); if (!JJTreeGlobals.nodePackageName.equals(JJTreeGlobals.packageName)) { ostr.println("import " + JJTreeGlobals.packageName + ".*;"); ostr.println(); } } } static String nodeConstants() { return JJTreeGlobals.parserName + "TreeConstants"; } static void generateTreeConstants_java() { String name = nodeConstants(); File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), name + ".java"); try { OutputFile outputFile = new OutputFile(file); PrintWriter ostr = outputFile.getPrintWriter(); List nodeIds = ASTNodeDescriptor.getNodeIds(); List nodeNames = ASTNodeDescriptor.getNodeNames(); generatePrologue(ostr); ostr.println("public interface " + name); ostr.println("{"); for (int i = 0; i < nodeIds.size(); ++i) { String n = (String)nodeIds.get(i); ostr.println(" public int " + n + " = " + i + ";"); } ostr.println(); ostr.println(); ostr.println(" public String[] jjtNodeName = {"); for (int i = 0; i < nodeNames.size(); ++i) { String n = (String)nodeNames.get(i); ostr.println(" \"" + n + "\","); } ostr.println(" };"); ostr.println("}"); ostr.close(); } catch (IOException e) { throw new Error(e.toString()); } } static String visitorClass() { return JJTreeGlobals.parserName + "Visitor"; } static void generateVisitor_java() { if (!JJTreeOptions.getVisitor()) { return; } String name = visitorClass(); File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), name + ".java"); try { OutputFile outputFile = new OutputFile(file); PrintWriter ostr = outputFile.getPrintWriter(); List nodeNames = ASTNodeDescriptor.getNodeNames(); generatePrologue(ostr); ostr.println("public interface " + name); ostr.println("{"); String ve = mergeVisitorException(); String argumentType = "Object"; if (!JJTreeOptions.getVisitorDataType().equals("")) { argumentType = JJTreeOptions.getVisitorDataType(); } ostr.println(" public " + JJTreeOptions.getVisitorReturnType() + " visit(SimpleNode node, " + argumentType + " data)" + ve + ";"); if (JJTreeOptions.getMulti()) { for (int i = 0; i < nodeNames.size(); ++i) { String n = (String)nodeNames.get(i); if (n.equals("void")) { continue; } String nodeType = JJTreeOptions.getNodePrefix() + n; ostr.println(" public " + JJTreeOptions.getVisitorReturnType() + " visit(" + nodeType + " node, " + argumentType + " data)" + ve + ";"); } } ostr.println("}"); ostr.close(); } catch (IOException e) { throw new Error(e.toString()); } } private static String mergeVisitorException() { String ve = JJTreeOptions.getVisitorException(); if (!"".equals(ve)) { ve = " throws " + ve; } return ve; } private static void generateNode_java(OutputFile outputFile) throws IOException { PrintWriter ostr = outputFile.getPrintWriter(); generatePrologue(ostr); Map options = new HashMap(Options.getOptions()); options.put("PARSER_NAME", JJTreeGlobals.parserName); JavaFileGenerator generator = new JavaFileGenerator( "/templates/Node.template", options); generator.generate(ostr); ostr.close(); } private static void generateSimpleNode_java(OutputFile outputFile) throws IOException { PrintWriter ostr = outputFile.getPrintWriter(); generatePrologue(ostr); Map options = new HashMap(Options.getOptions()); options.put("PARSER_NAME", JJTreeGlobals.parserName); options.put("VISITOR_RETURN_TYPE_VOID", Boolean.valueOf(JJTreeOptions.getVisitorReturnType().equals("void"))); JavaFileGenerator generator = new JavaFileGenerator( "/templates/SimpleNode.template", options); generator.generate(ostr); ostr.close(); } private static void generateMULTINode_java(OutputFile outputFile, String nodeType) throws IOException { PrintWriter ostr = outputFile.getPrintWriter(); generatePrologue(ostr); Map options = new HashMap(Options.getOptions()); options.put("PARSER_NAME", JJTreeGlobals.parserName); options.put("NODE_TYPE", nodeType); options.put("VISITOR_RETURN_TYPE_VOID", Boolean.valueOf(JJTreeOptions.getVisitorReturnType().equals("void"))); JavaFileGenerator generator = new JavaFileGenerator( "/templates/MultiNode.template", options); generator.generate(ostr); ostr.close(); } } javacc-5.0.orig/src/org/javacc/jjtree/IO.java0000644000175000017500000001150111146612643017774 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.io.Reader; import org.javacc.parser.JavaCCGlobals; final class IO { private String ifn; private String ofn; private Reader in; private PrintWriter out; private PrintStream msg; private PrintStream err; IO() { ifn = ""; msg = System.out; err = System.err; } String getInputFileName() { return ifn; } Reader getIn() { return in; } String getOutputFileName() { return ofn; } PrintWriter getOut() { return out; } PrintStream getMsg() { return msg; } PrintStream getErr() { return err; } void print(String s) { out.print(s); } void println(String s) { out.println(s); } void println() { out.println(); } void closeAll() { if (out != null) out.close(); if (msg != null) msg.flush(); if (err != null) err.flush(); } private String create_output_file_name(String i) { String o = JJTreeOptions.getOutputFile(); if (o.equals("")) { int s = i.lastIndexOf(File.separatorChar); if (s >= 0) { i = i.substring(s + 1); } int di = i.lastIndexOf('.'); if (di == -1) { o = i + ".jj"; } else { String suffix = i.substring(di); if (suffix.equals(".jj")) { o = i + ".jj"; } else { o = i.substring(0, di) + ".jj"; } } } return o; } void setInput(String fn) throws JJTreeIOException { try { File fp = new File(fn); if (!fp.exists()) { throw new JJTreeIOException("File " + fn + " not found."); } if (fp.isDirectory()) { throw new JJTreeIOException(fn + " is a directory. Please use a valid file name."); } if (org.javacc.parser.JavaCCGlobals.isGeneratedBy("JJTree", fn)) { throw new JJTreeIOException(fn + " was generated by jjtree. Cannot run jjtree again."); } ifn = fp.getPath(); in = new BufferedReader(new InputStreamReader(new FileInputStream(ifn), JJTreeOptions.getGrammarEncoding())); } catch (NullPointerException ne) { // Should never happen throw new JJTreeIOException(ne.toString()); } catch (SecurityException se) { throw new JJTreeIOException("Security violation while trying to open " + fn); } catch (FileNotFoundException e) { throw new JJTreeIOException("File " + fn + " not found."); } catch (IOException ioe) { throw new JJTreeIOException(ioe.toString()); } } void setOutput() throws JJTreeIOException { try { JavaCCGlobals.createOutputDir(JJTreeOptions.getJJTreeOutputDirectory()); File ofile = new File(JJTreeOptions.getJJTreeOutputDirectory(), create_output_file_name(ifn)); ofn = ofile.toString(); out = new PrintWriter(new FileWriter(ofile)); } catch (IOException ioe) { throw new JJTreeIOException("Can't create output file " + ofn); } } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/JJTreeOptionsTest.java0000644000175000017500000001003410747741575023041 0ustar mkochmkochpackage org.javacc.jjtree; import java.io.File; import org.javacc.parser.JavaCCErrors; import org.javacc.parser.Options; import junit.framework.TestCase; /** * Test the JJTree-specific options. * * @author Kees Jan Koster <kjkoster@kjkoster.org> */ public final class JJTreeOptionsTest extends TestCase { public void testOutputDirectory() { JJTreeOptions.init(); JavaCCErrors.reInit(); assertEquals(new File("."), JJTreeOptions.getOutputDirectory()); assertEquals(new File("."), JJTreeOptions.getJJTreeOutputDirectory()); Options.setInputFileOption(null, null, "OUTPUT_DIRECTORY", "test/output"); assertEquals(new File("test/output"), JJTreeOptions.getOutputDirectory()); assertEquals(new File("test/output"), JJTreeOptions.getJJTreeOutputDirectory()); Options.setInputFileOption(null, null, "JJTREE_OUTPUT_DIRECTORY", "test/jjtreeoutput"); assertEquals(new File("test/output"), JJTreeOptions.getOutputDirectory()); assertEquals(new File("test/jjtreeoutput"), JJTreeOptions.getJJTreeOutputDirectory()); assertEquals(0, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); assertEquals(0, JavaCCErrors.get_parse_error_count()); assertEquals(0, JavaCCErrors.get_semantic_error_count()); } public void testNodeFactory() { JJTreeOptions.init(); JavaCCErrors.reInit(); assertEquals(0, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); JJTreeOptions.setInputFileOption(null, null, "NODE_FACTORY", Boolean.FALSE); assertEquals(JJTreeOptions.getNodeFactory(), ""); JJTreeOptions.init(); JJTreeOptions.setInputFileOption(null, null, "NODE_FACTORY", Boolean.TRUE); assertEquals(JJTreeOptions.getNodeFactory(), "*"); JJTreeOptions.init(); JJTreeOptions.setInputFileOption(null, null, "NODE_FACTORY", "mypackage.MyNode"); assertEquals(JJTreeOptions.getNodeFactory(), "mypackage.MyNode"); assertEquals(0, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); assertEquals(0, JavaCCErrors.get_parse_error_count()); assertEquals(0, JavaCCErrors.get_semantic_error_count()); } public void testNodeClass() { JJTreeOptions.init(); JavaCCErrors.reInit(); assertEquals(0, JavaCCErrors.get_warning_count()); assertEquals(0, JavaCCErrors.get_error_count()); assertEquals("", JJTreeOptions.getNodeClass()); // Need some functional tests, as well. } public void testValidate() { JJTreeOptions.init(); JavaCCErrors.reInit(); JJTreeOptions.setCmdLineOption("VISITOR_DATA_TYPE=Object"); JJTreeOptions.validate(); assertEquals(1, JavaCCErrors.get_warning_count()); JJTreeOptions.init(); JavaCCErrors.reInit(); JJTreeOptions.setCmdLineOption("VISITOR_DATA_TYPE=Object"); JJTreeOptions.setCmdLineOption("VISITOR=true"); JJTreeOptions.validate(); assertEquals(0, JavaCCErrors.get_warning_count()); JJTreeOptions.init(); JavaCCErrors.reInit(); JJTreeOptions.setCmdLineOption("VISITOR_DATA_TYPE=Object"); JJTreeOptions.validate(); assertEquals(1, JavaCCErrors.get_warning_count()); } public void testValidateReturnType() { JJTreeOptions.init(); JavaCCErrors.reInit(); JJTreeOptions.setCmdLineOption("VISITOR_DATA_TYPE=String"); JJTreeOptions.validate(); assertEquals(1, JavaCCErrors.get_warning_count()); JJTreeOptions.init(); JavaCCErrors.reInit(); JJTreeOptions.setCmdLineOption("VISITOR_DATA_TYPE=String"); JJTreeOptions.setCmdLineOption("VISITOR=true"); JJTreeOptions.validate(); assertEquals(0, JavaCCErrors.get_warning_count()); JJTreeOptions.init(); JavaCCErrors.reInit(); JJTreeOptions.setCmdLineOption("VISITOR_DATA_TYPE=String"); JJTreeOptions.validate(); assertEquals(1, JavaCCErrors.get_warning_count()); } } javacc-5.0.orig/src/org/javacc/jjtree/JJTree.jjt0000644000175000017500000014332011134735202020455 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ options { MULTI = true; NODE_DEFAULT_VOID = true; NODE_SCOPE_HOOK=true; JAVA_UNICODE_ESCAPE = true; STATIC = false; NODE_CLASS = "JJTreeNode"; } PARSER_BEGIN(JJTreeParser) package org.javacc.jjtree; public class JJTreeParser { void jjtreeOpenNodeScope(Node n) { ((JJTreeNode)n).setFirstToken(getToken(1)); } void jjtreeCloseNodeScope(Node n) { ((JJTreeNode)n).setLastToken(getToken(0)); } /** * Returns true if the next token is not in the FOLLOW list of "expansion". * It is used to decide when the end of an "expansion" has been reached. */ private boolean notTailOfExpansionUnit() { Token t; t = getToken(1); if (t.kind == BIT_OR || t.kind == COMMA || t.kind == RPAREN || t.kind == RBRACE || t.kind == RBRACKET) return false; return true; } } PARSER_END(JJTreeParser) /********************************************** * THE JAVACC TOKEN SPECIFICATION STARTS HERE * **********************************************/ /* JAVACC RESERVED WORDS: These are the only tokens in JavaCC but not in Java */ TOKEN : { // Options is no longer a reserved word (Issue 126) // < _OPTIONS: "options" > < _LOOKAHEAD: "LOOKAHEAD" > | < _IGNORE_CASE: "IGNORE_CASE" > | < _PARSER_BEGIN: "PARSER_BEGIN" > | < _PARSER_END: "PARSER_END" > | < _JAVACODE: "JAVACODE" > | < _TOKEN: "TOKEN" > | < _SPECIAL_TOKEN: "SPECIAL_TOKEN" > | < _MORE: "MORE" > | < _SKIP: "SKIP" > | < _TOKEN_MGR_DECLS: "TOKEN_MGR_DECLS" > | < _EOF: "EOF" > } /* * The remainder of the tokens are exactly (except for the removal of tokens * containing ">>" and "<<") as in the Java grammar and must be diff equivalent * (again with the exceptions above) to it. */ /* WHITE SPACE */ SPECIAL_TOKEN : { " " | "\t" | "\n" | "\r" | "\f" } /* COMMENTS */ MORE : { "//" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | "/*" : IN_MULTI_LINE_COMMENT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } SPECIAL_TOKEN : { : DEFAULT } MORE : { < ~[] > } /* JAVA RESERVED WORDS AND LITERALS */ TOKEN : { < ABSTRACT: "abstract" > | < BOOLEAN: "boolean" > | < BREAK: "break" > | < BYTE: "byte" > | < CASE: "case" > | < CATCH: "catch" > | < CHAR: "char" > | < CLASS: "class" > | < CONST: "const" > | < CONTINUE: "continue" > | < _DEFAULT: "default" > | < DO: "do" > | < DOUBLE: "double" > | < ELSE: "else" > | < EXTENDS: "extends" > | < FALSE: "false" > | < FINAL: "final" > | < FINALLY: "finally" > | < FLOAT: "float" > | < FOR: "for" > | < GOTO: "goto" > | < IF: "if" > | < IMPLEMENTS: "implements" > | < IMPORT: "import" > | < INSTANCEOF: "instanceof" > | < INT: "int" > | < INTERFACE: "interface" > | < LONG: "long" > | < NATIVE: "native" > | < NEW: "new" > | < NULL: "null" > | < PACKAGE: "package"> | < PRIVATE: "private" > | < PROTECTED: "protected" > | < PUBLIC: "public" > | < RETURN: "return" > | < SHORT: "short" > | < STATIC: "static" > | < SUPER: "super" > | < SWITCH: "switch" > | < SYNCHRONIZED: "synchronized" > | < THIS: "this" > | < THROW: "throw" > | < THROWS: "throws" > | < TRANSIENT: "transient" > | < TRUE: "true" > | < TRY: "try" > | < VOID: "void" > | < VOLATILE: "volatile" > | < WHILE: "while" > } /* JAVA LITERALS */ TOKEN : { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > | < FLOATING_POINT_LITERAL: | > | < #DECIMAL_FLOATING_POINT_LITERAL: (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? | "." (["0"-"9"])+ ()? (["f","F","d","D"])? | (["0"-"9"])+ (["f","F","d","D"])? | (["0"-"9"])+ ()? ["f","F","d","D"] > | < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > | < #HEXADECIMAL_FLOATING_POINT_LITERAL: "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? (["f","F","d","D"])? | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ (["f","F","d","D"])? > | < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > | < CHARACTER_LITERAL: "'" ( (~["'","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) ) "'" > | < STRING_LITERAL: "\"" ( (~["\"","\\","\n","\r"]) | ("\\" ( ["n","t","b","r","f","\\","'","\""] | ["0"-"7"] ( ["0"-"7"] )? | ["0"-"3"] ["0"-"7"] ["0"-"7"] ) ) )* "\"" > } /* SEPARATORS */ TOKEN : { < LPAREN: "(" > | < RPAREN: ")" > | < LBRACE: "{" > | < RBRACE: "}" > | < LBRACKET: "[" > | < RBRACKET: "]" > | < SEMICOLON: ";" > | < COMMA: "," > | < DOT: "." > } /* OPERATORS */ TOKEN : { < ASSIGN: "=" > //| < GT: ">" > | < LT: "<" > | < BANG: "!" > | < TILDE: "~" > | < HOOK: "?" > | < COLON: ":" > | < EQ: "==" > | < LE: "<=" > | < GE: ">=" > | < NE: "!=" > | < SC_OR: "||" > | < SC_AND: "&&" > | < INCR: "++" > | < DECR: "--" > | < PLUS: "+" > | < MINUS: "-" > | < STAR: "*" > | < SLASH: "/" > | < BIT_AND: "&" > | < BIT_OR: "|" > | < XOR: "^" > | < REM: "%" > // | < LSHIFT: "<<" > // | < RSIGNEDSHIFT: ">>" > // | < RUNSIGNEDSHIFT: ">>>" > | < PLUSASSIGN: "+=" > | < MINUSASSIGN: "-=" > | < STARASSIGN: "*=" > | < SLASHASSIGN: "/=" > | < ANDASSIGN: "&=" > | < ORASSIGN: "|=" > | < XORASSIGN: "^=" > | < REMASSIGN: "%=" > // | < LSHIFTASSIGN: "<<=" > // | < RSIGNEDSHIFTASSIGN: ">>=" > // | < RUNSIGNEDSHIFTASSIGN: ">>>=" > } /* >'s need special attention due to generics syntax. */ TOKEN : { < RUNSIGNEDSHIFT: ">>>" > { matchedToken.kind = GT; ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; input_stream.backup(2); matchedToken.image = ">"; } | < RSIGNEDSHIFT: ">>" > { matchedToken.kind = GT; ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT; input_stream.backup(1); matchedToken.image = ">"; } | < GT: ">" > } /************************************************ * THE JAVACC GRAMMAR SPECIFICATION STARTS HERE * ************************************************/ void javacc_input() #Grammar : { Token t; } { javacc_options() ( "PARSER_BEGIN" "(" t=identifier() ")" { JJTreeGlobals.parserName = t.image; } CompilationUnit() "PARSER_END" "(" identifier() ")" { if (JJTreeOptions.getNodePackage().equals("")) { JJTreeGlobals.nodePackageName = JJTreeGlobals.packageName; } else { JJTreeGlobals.nodePackageName = JJTreeOptions.getNodePackage(); } } ) #CompilationUnit(true) ( ( production() )+ ) #Productions } void javacc_options() : { } { [ LOOKAHEAD( { getToken(1).image.equals("options") }) ( "{" ( option_binding() )* "}" ) #Options ] { JJTreeOptions.normalize(); } } void option_binding() #OptionBinding : { Token o, v; } { ( o= | o="LOOKAHEAD" | o="IGNORE_CASE" | o="static" ) "=" ( v=IntegerLiteral() { JJTreeOptions.setInputFileOption(o, v, o.image, new Integer(v.image)); jjtThis.initialize(o.image, v.image); } | v=BooleanLiteral() { JJTreeOptions.setInputFileOption(o, v, o.image, Boolean.valueOf(v.image)); jjtThis.initialize(o.image, v.image); } | v=StringLiteral() { String vs = TokenUtils.remove_escapes_and_quotes(v, v.image); JJTreeOptions.setInputFileOption(o, v, o.image, (Object)vs); jjtThis.initialize(o.image, vs); } ) ";" } void production() : { } { LOOKAHEAD(1) /* * Since JAVACODE is both a JavaCC reserved word and a Java identifier, * we need to give preference to "javacode_production" over * "bnf_production". */ javacode_production() | LOOKAHEAD(1) /* * Since SKIP, TOKEN, etc. are both JavaCC reserved words and Java * identifiers, we need to give preference to "regular_expression_production" * over "bnf_production". */ regular_expr_production() | LOOKAHEAD(1) /* * Since TOKEN_MGR_DECLS is both a JavaCC reserved word and a Java identifier, * we need to give preference to "token_manager_decls" over * "bnf_production". */ token_manager_decls() | bnf_production() } void javacode_production() #Javacode : { Token t1, t2; ASTJavacode prod; ASTNodeDescriptor nd = null; String n; } { { prod = jjtThis; } "JAVACODE" AccessModifier() ResultType() t1=identifier() FormalParameters() [ "throws" n=Name() { prod.throws_list.addElement(n); } ( "," n=Name() { prod.throws_list.addElement(n); } )* ] [ nd=node_descriptor() ] // This is really a Block() t2="{" { prod.name = t1.image; prod.stmBeginLoc = t2; } ( ( BlockStatement() )* { jjtThis.node_scope = new NodeScope(prod, nd); } ) #JavacodeBody "}" { JJTreeGlobals.productions.put(prod.name, prod); } } void bnf_production() #BNF : { Token t1, t2; ASTBNF prod; ASTNodeDescriptor nd = null; NodeScope ns; JJTreeNode eu; String n; } { { prod = jjtThis; } AccessModifier() ResultType() t1=identifier() FormalParameters() [ "throws" n=Name() { prod.throws_list.addElement(n); } ( "," n=Name() { prod.throws_list.addElement(n); } )* ] [ nd=node_descriptor() ] ":" // This is really a Block() t2="{" { prod.name = t1.image; prod.declBeginLoc = t2; ns = new NodeScope(prod, nd); } ( ( BlockStatement() )* { jjtThis.node_scope = ns; } ) #BNFDeclaration "}" "{" ( eu=expansion_choices(prod) { jjtThis.node_scope = ns; jjtThis.expansion_unit = eu; } ) #BNFNodeScope "}" { JJTreeGlobals.productions.put(prod.name, prod); } } void AccessModifier() : {} { ( "public" | "protected" | "private" )? } void regular_expr_production() #RE : { } { [ LOOKAHEAD(2) "<" "*" ">" | "<" ( "," )* ">" ] regexpr_kind() [ "[" "IGNORE_CASE" "]" ] ":" "{" regexpr_spec() ( "|" regexpr_spec() )* "}" } void token_manager_decls() #TokenDecls : { } { "TOKEN_MGR_DECLS" ":" ClassOrInterfaceBody() } void regexpr_kind() : { } { "TOKEN" | "SPECIAL_TOKEN" | "SKIP" | "MORE" } void regexpr_spec() #RESpec : {} { regular_expression() [ Block() ] [ ":" ] } JJTreeNode expansion_choices(ASTProduction p) #BNFChoice(>1) : { } { expansion(p) ( "|" expansion(p) )* { return (JJTreeNode)jjtree.peekNode(); } } void expansion(ASTProduction p) #BNFSequence(>1) : { JJTreeNode eu; ASTNodeDescriptor nd = null; } { ( LOOKAHEAD(1) ( "LOOKAHEAD" "(" local_lookahead(p) ")" ) #BNFLookahead )? ( LOOKAHEAD(0, { notTailOfExpansionUnit() } ) ( eu=expansion_unit(p) [ nd=node_descriptor() ] { if (jjtree.nodeCreated()) { jjtThis.node_scope = new NodeScope(p, nd); jjtThis.expansion_unit = eu; } } ) #ExpansionNodeScope(>1) )+ } void local_lookahead(ASTProduction p) : { boolean commaAtEnd = false, emptyLA = true; } { [ /* * The lookahead of 1 is to turn off the warning message that lets * us know that an expansion choice can also start with an integer * literal because a primary expression can do the same. But we * know that this is what we want. */ LOOKAHEAD(1) IntegerLiteral() { emptyLA = false; } ] [ LOOKAHEAD(0, { !emptyLA && (getToken(1).kind != RPAREN) } ) "," { commaAtEnd = true; } ] [ LOOKAHEAD(0, { getToken(1).kind != RPAREN && getToken(1).kind != LBRACE } ) expansion_choices(p) { emptyLA = false; commaAtEnd = false; } ] [ LOOKAHEAD(0, { !emptyLA && !commaAtEnd && (getToken(1).kind != RPAREN) } ) "," { commaAtEnd = true; } ] [ LOOKAHEAD(0, { emptyLA || commaAtEnd } ) "{" Expression() "}" ] } JJTreeNode expansion_unit(ASTProduction p) : { Token t; } { ( LOOKAHEAD(1) /* * We give this priority over primary expressions which use LOOKAHEAD as the * name of its identifier. */ ( "LOOKAHEAD" "(" local_lookahead(p) ")" ) #BNFLookahead | Block() #BNFAction | ( "[" expansion_choices(p) "]" ) #BNFZeroOrOne | ( "try" "{" expansion_choices(p) "}" ( "catch" "(" Name() ")" Block() )* [ "finally" Block() ] ) #BNFTryBlock | LOOKAHEAD( identifier() | StringLiteral() | "<" | PrimaryExpression() "=" ) ( [ LOOKAHEAD(PrimaryExpression() "=") PrimaryExpression() "=" ] ( regular_expression() [ "." t= ] | ( identifier() Arguments() ) #BNFNonTerminal ) ) #BNFAssignment(>1) | t="(" expansion_choices(p) ")" ( "+" #BNFOneOrMore(1) | "*" #BNFZeroOrMore(1) | "?" #BNFZeroOrOne(1) | {} #BNFParenthesized(1) ) { ((JJTreeNode)jjtree.peekNode()).setFirstToken(t); } ) { return (JJTreeNode)jjtree.peekNode(); } } void regular_expression() : { } { StringLiteral() #REStringLiteral | LOOKAHEAD(3) ( "<" [ [ "#" ] identifier() ":" ] complex_regular_expression_choices() ">" ) #RENamed | LOOKAHEAD(2) ( "<" identifier() ">" ) #REReference | ( "<" "EOF" ">" ) #REEOF } void complex_regular_expression_choices() #REChoice(>1) : {} { complex_regular_expression() ( "|" complex_regular_expression() )* } void complex_regular_expression() #RESequence(>1) : {} { ( complex_regular_expression_unit() )+ } void complex_regular_expression_unit() : { Token t; } { StringLiteral() #REStringLiteral | ( "<" identifier() ">" ) #REReference | character_list() | t="(" complex_regular_expression_choices() ")" ( "+" #REOneOrMore(1) | "*" #REZeroOrMore(1) | "?" #REZeroOrOne(1) | "{" IntegerLiteral() [ "," [ IntegerLiteral() ] ] "}" #RRepetitionRange(1) | {} #REParenthesized(1) ) { ((JJTreeNode)jjtree.peekNode()).setFirstToken(t); } } void character_list() #RECharList : {} { [ "~" ] "[" [ character_descriptor() ( "," character_descriptor() )* ] "]" } void character_descriptor() #CharDescriptor : {} { StringLiteral() [ "-" StringLiteral() ] } Token identifier() : { Token t; } { t= { return t; } } /********************************************** * THE JJTREE PRODUCTIONS START HERE * **********************************************/ ASTNodeDescriptor node_descriptor() #NodeDescriptor : { Token t = null; String s = null; } { "#" ( s=Name() { jjtThis.name = s; } | t= { jjtThis.name = t.image; } ) [ LOOKAHEAD(1) "(" [ ">" { jjtThis.isGT = true; } ] node_descriptor_expression() { jjtThis.expression = (ASTNodeDescriptorExpression)jjtree.peekNode(); } ")" ] { jjtThis.setNodeIdValue(); return jjtThis; } } JAVACODE void node_descriptor_expression() #NodeDescriptorExpression { Token tok; int nesting = 1; while (true) { tok = getToken(1); if (tok.kind == 0) { throw new ParseException(); } if (tok.kind == LPAREN) nesting++; if (tok.kind == RPAREN) { nesting--; if (nesting == 0) break; } tok = getNextToken(); } } /********************************************** * THE JAVA GRAMMAR SPECIFICATION STARTS HERE * **********************************************/ /* * The Java grammar is modified to use sequences of tokens * for the missing tokens - those that include "<<" and ">>". */ /* * The following production defines Java identifiers - it * includes the reserved words of JavaCC also. */ String JavaIdentifier() : {} { ( | "LOOKAHEAD" | "IGNORE_CASE" | "PARSER_BEGIN" | "PARSER_END" | "JAVACODE" | "TOKEN" | "SPECIAL_TOKEN" | "MORE" | "SKIP" | "TOKEN_MGR_DECLS" | "EOF" ) { return token.image; } } /* * Program structuring syntax follows. */ void CompilationUnit() : {} { [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ] { JJTreeGlobals.parserImports = getToken(1); } ( ImportDeclaration() )* ( TypeDeclaration() )* } void PackageDeclaration() : { String s; } { Modifiers() "package" s=Name() ";" { JJTreeGlobals.packageName = s; } } void ImportDeclaration() : {} { "import" [ "static" ] Name() [ "." "*" ] ";" } /* * Modifiers. We match all modifiers in a single rule to reduce the chances of * syntax errors for simple modifier mistakes. It will also enable us to give * better error messages. */ void Modifiers(): {} { ( LOOKAHEAD(2) ( "public" | "static" | "protected" | "private" | "final" | "abstract" | "synchronized" | "native" | "transient" | "volatile" | "strictfp" | Annotation() ) )* } /* * Declaration syntax follows. */ void TypeDeclaration(): { ; } { ";" | Modifiers() ( ClassOrInterfaceDeclaration() | EnumDeclaration() | AnnotationTypeDeclaration() ) } void ClassOrInterfaceDeclaration(): { Token t = null; String s; } { ( "class" | "interface" ) s=JavaIdentifier() [ TypeParameters() ] [ ExtendsList() ] [ { t = getToken(1); } ImplementsList() ] { if (s.equals(JJTreeGlobals.parserName)) { if (t != null) { JJTreeGlobals.parserImplements = t; } else { JJTreeGlobals.parserImplements = getToken(1); } JJTreeGlobals.parserClassBodyStart = getToken(1); } } ClassOrInterfaceBody() } void ExtendsList(): {} { "extends" ClassOrInterfaceType() ( "," ClassOrInterfaceType() )* } void ImplementsList(): {} { "implements" ClassOrInterfaceType() ( "," ClassOrInterfaceType() )* } void EnumDeclaration(): {} { "enum" JavaIdentifier() [ ImplementsList() ] EnumBody() } void EnumBody(): {} { "{" [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ] [ "," ] [ ";" ( ClassOrInterfaceBodyDeclaration() )* ] "}" } void EnumConstant(): {} { Modifiers() JavaIdentifier() [ Arguments() ] [ ClassOrInterfaceBody() ] } void TypeParameters(): {} { "<" TypeParameter() ( "," TypeParameter() )* ">" } void TypeParameter(): {} { JavaIdentifier() [ TypeBound() ] } void TypeBound(): {} { "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )* } void ClassOrInterfaceBody(): /* * Parsing this fills "tokens" with all tokens of the block * excluding the braces at each end. */ {} { "{" ( ClassOrInterfaceBodyDeclaration() )* "}" } void ClassOrInterfaceBodyDeclaration(): {} { LOOKAHEAD(2) Initializer() | Modifiers() // Just get all the modifiers out of the way. If you want to do // more checks, pass the modifiers down to the member ( ClassOrInterfaceDeclaration() | EnumDeclaration() | LOOKAHEAD( [ TypeParameters() ] JavaIdentifier() "(" ) ConstructorDeclaration() | LOOKAHEAD( Type() JavaIdentifier() ( "[" "]" )* ( "," | "=" | ";" ) ) FieldDeclaration() | MethodDeclaration() ) | ";" } void FieldDeclaration(): {} { // Modifiers are already matched in the caller Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" } void VariableDeclarator(): {} { VariableDeclaratorId() [ "=" VariableInitializer() ] } void VariableDeclaratorId(): {} { JavaIdentifier() ( "[" "]" )* } void VariableInitializer(): {} { ArrayInitializer() | Expression() } void ArrayInitializer(): {} { "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" } void MethodDeclaration(): {} { // Modifiers already matched in the caller! [ TypeParameters() ] ResultType() MethodDeclarator() [ "throws" NameList() ] ( Block() | ";" ) } void MethodDeclarator(): {} { JavaIdentifier() FormalParameters() ( "[" "]" )* } void FormalParameters() : /* * Parsing this fills "tokens" with all tokens of the formal * parameters excluding the parentheses at each end. */ {} { "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" } void FormalParameter(): {} { Modifiers() Type() [ "..." ] VariableDeclaratorId() } void ConstructorDeclaration(): {} { [ TypeParameters() ] // Modifiers matched in the caller JavaIdentifier() FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* "}" } void ExplicitConstructorInvocation(): {} { LOOKAHEAD("this" Arguments() ";") "this" Arguments() ";" | [ LOOKAHEAD(2) PrimaryExpression() "." ] "super" Arguments() ";" } void Initializer(): {} { [ "static" ] Block() } /* * Type, name and expression syntax follows. */ void Type(): {} { LOOKAHEAD(2) ReferenceType() | PrimitiveType() } void ReferenceType(): {} { PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+ | ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )* } void ClassOrInterfaceType(): {} { JavaIdentifier() [ LOOKAHEAD(2) TypeArguments() ] ( LOOKAHEAD(2) "." JavaIdentifier() [ LOOKAHEAD(2) TypeArguments() ] )* } void TypeArguments(): {} { "<" TypeArgument() ( "," TypeArgument() )* ">" } void TypeArgument(): {} { ReferenceType() | "?" [ WildcardBounds() ] } void WildcardBounds(): {} { "extends" ReferenceType() | "super" ReferenceType() } void PrimitiveType(): {} { "boolean" | "char" | "byte" | "short" | "int" | "long" | "float" | "double" } void ResultType() : {} { ( "void" | Type() ) } String Name() : /* * A lookahead of 2 is required below since "Name" can be followed * by a ".*" when used in the context of an "ImportDeclaration". */ { String s, ss; } { s=JavaIdentifier() ( LOOKAHEAD(2) "." ss=JavaIdentifier() { s += "." + ss; } )* { return s; } } void NameList(): {} { Name() ( "," Name() )* } /* * Expression syntax follows. */ void Expression() : /* * This expansion has been written this way instead of: * Assignment() | ConditionalExpression() * for performance reasons. * However, it is a weakening of the grammar for it allows the LHS of * assignments to be any conditional expression whereas it can only be * a primary expression. Consider adding a semantic predicate to work * around this. */ {} { ConditionalExpression() [ LOOKAHEAD(2) AssignmentOperator() Expression() ] } void AssignmentOperator(): {} { "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" } void ConditionalExpression(): {} { ConditionalOrExpression() [ "?" Expression() ":" Expression() ] } void ConditionalOrExpression(): {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() )* } void ConditionalAndExpression(): {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* } void InclusiveOrExpression(): {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* } void ExclusiveOrExpression(): {} { AndExpression() ( "^" AndExpression() )* } void AndExpression(): {} { EqualityExpression() ( "&" EqualityExpression() )* } void EqualityExpression(): {} { InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* } void InstanceOfExpression(): {} { RelationalExpression() [ "instanceof" Type() ] } void RelationalExpression(): {} { ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* } void ShiftExpression(): {} { AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )* } void AdditiveExpression(): {} { MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* } void MultiplicativeExpression(): {} { UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* } void UnaryExpression(): {} { ( "+" | "-" ) UnaryExpression() | PreIncrementExpression() | PreDecrementExpression() | UnaryExpressionNotPlusMinus() } void PreIncrementExpression(): {} { "++" PrimaryExpression() } void PreDecrementExpression(): {} { "--" PrimaryExpression() } void UnaryExpressionNotPlusMinus(): {} { ( "~" | "!" ) UnaryExpression() | LOOKAHEAD( CastLookahead() ) CastExpression() | PostfixExpression() } // This production is to determine lookahead only. The LOOKAHEAD specifications // below are not used, but they are there just to indicate that we know about // this. void CastLookahead(): {} { LOOKAHEAD(2) "(" PrimitiveType() | LOOKAHEAD("(" Type() "[") "(" Type() "[" "]" | "(" Type() ")" ( "~" | "!" | "(" | JavaIdentifier() | "this" | "super" | "new" | Literal() ) } void PostfixExpression(): {} { PrimaryExpression() [ "++" | "--" ] } void CastExpression(): {} { LOOKAHEAD("(" PrimitiveType()) "(" Type() ")" UnaryExpression() | "(" Type() ")" UnaryExpressionNotPlusMinus() } void PrimaryExpression() #PrimaryExpression: {} { PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* } void MemberSelector(): {} { "." TypeArguments() JavaIdentifier() } void PrimaryPrefix(): {} { Literal() | "this" | "super" "." JavaIdentifier() | "(" Expression() ")" | AllocationExpression() | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class" | Name() } void PrimarySuffix(): {} { LOOKAHEAD(2) "." "this" | LOOKAHEAD(2) "." AllocationExpression() | LOOKAHEAD(3) MemberSelector() | "[" Expression() "]" | "." JavaIdentifier() | Arguments() } void Literal(): {} { | | | | BooleanLiteral() | NullLiteral() } Token IntegerLiteral() : { Token t; } { t= { return t; } } Token BooleanLiteral() : { Token t; } { t="true" { return t; } | t="false" { return t; } } Token StringLiteral() : { Token t; } { t= { return t; } } void NullLiteral() : {} { "null" } void Arguments() : /* * Parsing this fills "tokens" with all tokens of the arguments * excluding the parentheses at each end. */ {} { "(" [ ArgumentList() ] ")" } void ArgumentList(): {} { Expression() ( "," Expression() )* } void AllocationExpression(): {} { LOOKAHEAD(2) "new" PrimitiveType() ArrayDimsAndInits() | "new" ClassOrInterfaceType() [ TypeArguments() ] ( ArrayDimsAndInits() | Arguments() [ ClassOrInterfaceBody() ] ) } /* * The third LOOKAHEAD specification below is to parse to PrimarySuffix * if there is an expression between the "[...]". */ void ArrayDimsAndInits(): {} { LOOKAHEAD(2) ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* | ( "[" "]" )+ ArrayInitializer() } /* * Statement syntax follows. */ void Statement(): {} { LOOKAHEAD(2) LabeledStatement() | AssertStatement() | Block() | EmptyStatement() | StatementExpression() ";" | SwitchStatement() | IfStatement() | WhileStatement() | DoStatement() | ForStatement() | BreakStatement() | ContinueStatement() | ReturnStatement() | ThrowStatement() | SynchronizedStatement() | TryStatement() } void AssertStatement(): {} { "assert" Expression() [ ":" Expression() ] ";" } void LabeledStatement(): {} { JavaIdentifier() ":" Statement() } void Block() : /* * Parsing this fills "tokens" with all tokens of the block * excluding the braces at each end. */ {} { "{" ( BlockStatement() )* "}" } void BlockStatement(): {} { LOOKAHEAD( Modifiers() Type() JavaIdentifier() ) LocalVariableDeclaration() ";" | Statement() | ClassOrInterfaceDeclaration( ) } void LocalVariableDeclaration(): {} { Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )* } void EmptyStatement(): {} { ";" } void StatementExpression(): /* * The last expansion of this production accepts more than the legal * Java expansions for StatementExpression. This expansion does not * use PostfixExpression for performance reasons. */ {} { PreIncrementExpression() | PreDecrementExpression() | PrimaryExpression() [ "++" | "--" | AssignmentOperator() Expression() ] } void SwitchStatement(): {} { "switch" "(" Expression() ")" "{" ( SwitchLabel() ( BlockStatement() )* )* "}" } void SwitchLabel(): {} { "case" Expression() ":" | "default" ":" } void IfStatement(): /* * The disambiguating algorithm of JavaCC automatically binds dangling * else's to the innermost if statement. The LOOKAHEAD specification * is to tell JavaCC that we know what we are doing. */ {} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement(): {} { "while" "(" Expression() ")" Statement() } void DoStatement(): {} { "do" Statement() "while" "(" Expression() ")" ";" } void ForStatement(): {} { "for" "(" ( LOOKAHEAD(Modifiers() Type() JavaIdentifier() ":") Modifiers() Type() JavaIdentifier() ":" Expression() | [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] ) ")" Statement() } void ForInit(): {} { LOOKAHEAD( Modifiers() Type() JavaIdentifier() ) LocalVariableDeclaration() | StatementExpressionList() } void StatementExpressionList(): {} { StatementExpression() ( "," StatementExpression() )* } void ForUpdate(): {} { StatementExpressionList() } void BreakStatement(): {} { "break" [ JavaIdentifier() ] ";" } void ContinueStatement(): {} { "continue" [ JavaIdentifier() ] ";" } void ReturnStatement() : {} { "return" [ Expression() ] ";" } void ThrowStatement() : {} { "throw" Expression() ";" } void SynchronizedStatement(): {} { "synchronized" "(" Expression() ")" Block() } void TryStatement(): /* * Semantic check required here to make sure that at least one * finally/catch is present. */ {} { "try" Block() ( "catch" "(" FormalParameter() ")" Block() )* [ "finally" Block() ] } /* We use productions to match >>>, >> and > so that we can keep the * type declaration syntax with generics clean */ void RUNSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) ">" ">" ">" ) } void RSIGNEDSHIFT(): {} { ( LOOKAHEAD({ getToken(1).kind == GT && ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} ) ">" ">" ) } /* Annotation syntax follows. */ void Annotation(): {} { LOOKAHEAD( "@" Name() "(" ( JavaIdentifier() "=" | ")" )) NormalAnnotation() | LOOKAHEAD( "@" Name() "(" ) SingleMemberAnnotation() | MarkerAnnotation() } void NormalAnnotation(): {} { "@" Name() "(" [ MemberValuePairs() ] ")" } void MarkerAnnotation(): {} { "@" Name() } void SingleMemberAnnotation(): {} { "@" Name() "(" MemberValue() ")" } void MemberValuePairs(): {} { MemberValuePair() ( "," MemberValuePair() )* } void MemberValuePair(): {} { JavaIdentifier() "=" MemberValue() } void MemberValue(): {} { Annotation() | MemberValueArrayInitializer() | ConditionalExpression() } void MemberValueArrayInitializer(): {} { "{" MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] "}" } /* Annotation Types. */ void AnnotationTypeDeclaration(): {} { "@" "interface" JavaIdentifier() AnnotationTypeBody() } void AnnotationTypeBody(): {} { "{" ( AnnotationTypeMemberDeclaration() )* "}" } void AnnotationTypeMemberDeclaration(): {} { Modifiers() ( LOOKAHEAD(Type() JavaIdentifier() "(") Type() JavaIdentifier() "(" ")" [ DefaultValue() ] ";" | ClassOrInterfaceDeclaration() | EnumDeclaration() | AnnotationTypeDeclaration() | FieldDeclaration() ) | ( ";" ) } void DefaultValue(): {} { "default" MemberValue() } /* IDENTIFIERS */ TOKEN : { < IDENTIFIER: ()* > | < #LETTER: [ // all chars for which Character.isIdentifierStart is true "$", "A"-"Z", "_", "a"-"z", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u064a", "\u0671"-"\u06d3", "\u06d5", "\u06e5"-"\u06e6", "\u06fa"-"\u06fc", "\u0710", "\u0712"-"\u072c", "\u0780"-"\u07a5", "\u0905"-"\u0939", "\u093d", "\u0950", "\u0958"-"\u0961", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09dc"-"\u09dd", "\u09df"-"\u09e1", "\u09f0"-"\u09f3", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a72"-"\u0a74", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abd", "\u0ad0", "\u0ae0", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3d", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c60"-"\u0c61", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cde", "\u0ce0"-"\u0ce1", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d60"-"\u0d61", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0e01"-"\u0e30", "\u0e32"-"\u0e33", "\u0e3f"-"\u0e46", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb0", "\u0eb2"-"\u0eb3", "\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0edc"-"\u0edd", "\u0f00", "\u0f40"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f88"-"\u0f8b", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u1050"-"\u1055", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17b3", "\u17db", "\u1820"-"\u1877", "\u1880"-"\u18a8", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u203f"-"\u2040", "\u207f", "\u20a0"-"\u20af", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u3029", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d", "\ufb1f"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\uff04", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6" ] > | < #PART_LETTER: [ // all chars for which Character.isIdentifierPart is true "\u0000"-"\u0008", "\u000e"-"\u001b", "$", "0"-"9", "A"-"Z", "_", "a"-"z", "\u007f"-"\u009f", "\u00a2"-"\u00a5", "\u00aa", "\u00b5", "\u00ba", "\u00c0"-"\u00d6", "\u00d8"-"\u00f6", "\u00f8"-"\u021f", "\u0222"-"\u0233", "\u0250"-"\u02ad", "\u02b0"-"\u02b8", "\u02bb"-"\u02c1", "\u02d0"-"\u02d1", "\u02e0"-"\u02e4", "\u02ee", "\u0300"-"\u034e", "\u0360"-"\u0362", "\u037a", "\u0386", "\u0388"-"\u038a", "\u038c", "\u038e"-"\u03a1", "\u03a3"-"\u03ce", "\u03d0"-"\u03d7", "\u03da"-"\u03f3", "\u0400"-"\u0481", "\u0483"-"\u0486", "\u048c"-"\u04c4", "\u04c7"-"\u04c8", "\u04cb"-"\u04cc", "\u04d0"-"\u04f5", "\u04f8"-"\u04f9", "\u0531"-"\u0556", "\u0559", "\u0561"-"\u0587", "\u0591"-"\u05a1", "\u05a3"-"\u05b9", "\u05bb"-"\u05bd", "\u05bf", "\u05c1"-"\u05c2", "\u05c4", "\u05d0"-"\u05ea", "\u05f0"-"\u05f2", "\u0621"-"\u063a", "\u0640"-"\u0655", "\u0660"-"\u0669", "\u0670"-"\u06d3", "\u06d5"-"\u06dc", "\u06df"-"\u06e8", "\u06ea"-"\u06ed", "\u06f0"-"\u06fc", "\u070f"-"\u072c", "\u0730"-"\u074a", "\u0780"-"\u07b0", "\u0901"-"\u0903", "\u0905"-"\u0939", "\u093c"-"\u094d", "\u0950"-"\u0954", "\u0958"-"\u0963", "\u0966"-"\u096f", "\u0981"-"\u0983", "\u0985"-"\u098c", "\u098f"-"\u0990", "\u0993"-"\u09a8", "\u09aa"-"\u09b0", "\u09b2", "\u09b6"-"\u09b9", "\u09bc", "\u09be"-"\u09c4", "\u09c7"-"\u09c8", "\u09cb"-"\u09cd", "\u09d7", "\u09dc"-"\u09dd", "\u09df"-"\u09e3", "\u09e6"-"\u09f3", "\u0a02", "\u0a05"-"\u0a0a", "\u0a0f"-"\u0a10", "\u0a13"-"\u0a28", "\u0a2a"-"\u0a30", "\u0a32"-"\u0a33", "\u0a35"-"\u0a36", "\u0a38"-"\u0a39", "\u0a3c", "\u0a3e"-"\u0a42", "\u0a47"-"\u0a48", "\u0a4b"-"\u0a4d", "\u0a59"-"\u0a5c", "\u0a5e", "\u0a66"-"\u0a74", "\u0a81"-"\u0a83", "\u0a85"-"\u0a8b", "\u0a8d", "\u0a8f"-"\u0a91", "\u0a93"-"\u0aa8", "\u0aaa"-"\u0ab0", "\u0ab2"-"\u0ab3", "\u0ab5"-"\u0ab9", "\u0abc"-"\u0ac5", "\u0ac7"-"\u0ac9", "\u0acb"-"\u0acd", "\u0ad0", "\u0ae0", "\u0ae6"-"\u0aef", "\u0b01"-"\u0b03", "\u0b05"-"\u0b0c", "\u0b0f"-"\u0b10", "\u0b13"-"\u0b28", "\u0b2a"-"\u0b30", "\u0b32"-"\u0b33", "\u0b36"-"\u0b39", "\u0b3c"-"\u0b43", "\u0b47"-"\u0b48", "\u0b4b"-"\u0b4d", "\u0b56"-"\u0b57", "\u0b5c"-"\u0b5d", "\u0b5f"-"\u0b61", "\u0b66"-"\u0b6f", "\u0b82"-"\u0b83", "\u0b85"-"\u0b8a", "\u0b8e"-"\u0b90", "\u0b92"-"\u0b95", "\u0b99"-"\u0b9a", "\u0b9c", "\u0b9e"-"\u0b9f", "\u0ba3"-"\u0ba4", "\u0ba8"-"\u0baa", "\u0bae"-"\u0bb5", "\u0bb7"-"\u0bb9", "\u0bbe"-"\u0bc2", "\u0bc6"-"\u0bc8", "\u0bca"-"\u0bcd", "\u0bd7", "\u0be7"-"\u0bef", "\u0c01"-"\u0c03", "\u0c05"-"\u0c0c", "\u0c0e"-"\u0c10", "\u0c12"-"\u0c28", "\u0c2a"-"\u0c33", "\u0c35"-"\u0c39", "\u0c3e"-"\u0c44", "\u0c46"-"\u0c48", "\u0c4a"-"\u0c4d", "\u0c55"-"\u0c56", "\u0c60"-"\u0c61", "\u0c66"-"\u0c6f", "\u0c82"-"\u0c83", "\u0c85"-"\u0c8c", "\u0c8e"-"\u0c90", "\u0c92"-"\u0ca8", "\u0caa"-"\u0cb3", "\u0cb5"-"\u0cb9", "\u0cbe"-"\u0cc4", "\u0cc6"-"\u0cc8", "\u0cca"-"\u0ccd", "\u0cd5"-"\u0cd6", "\u0cde", "\u0ce0"-"\u0ce1", "\u0ce6"-"\u0cef", "\u0d02"-"\u0d03", "\u0d05"-"\u0d0c", "\u0d0e"-"\u0d10", "\u0d12"-"\u0d28", "\u0d2a"-"\u0d39", "\u0d3e"-"\u0d43", "\u0d46"-"\u0d48", "\u0d4a"-"\u0d4d", "\u0d57", "\u0d60"-"\u0d61", "\u0d66"-"\u0d6f", "\u0d82"-"\u0d83", "\u0d85"-"\u0d96", "\u0d9a"-"\u0db1", "\u0db3"-"\u0dbb", "\u0dbd", "\u0dc0"-"\u0dc6", "\u0dca", "\u0dcf"-"\u0dd4", "\u0dd6", "\u0dd8"-"\u0ddf", "\u0df2"-"\u0df3", "\u0e01"-"\u0e3a", "\u0e3f"-"\u0e4e", "\u0e50"-"\u0e59", "\u0e81"-"\u0e82", "\u0e84", "\u0e87"-"\u0e88", "\u0e8a", "\u0e8d", "\u0e94"-"\u0e97", "\u0e99"-"\u0e9f", "\u0ea1"-"\u0ea3", "\u0ea5", "\u0ea7", "\u0eaa"-"\u0eab", "\u0ead"-"\u0eb9", "\u0ebb"-"\u0ebd", "\u0ec0"-"\u0ec4", "\u0ec6", "\u0ec8"-"\u0ecd", "\u0ed0"-"\u0ed9", "\u0edc"-"\u0edd", "\u0f00", "\u0f18"-"\u0f19", "\u0f20"-"\u0f29", "\u0f35", "\u0f37", "\u0f39", "\u0f3e"-"\u0f47", "\u0f49"-"\u0f6a", "\u0f71"-"\u0f84", "\u0f86"-"\u0f8b", "\u0f90"-"\u0f97", "\u0f99"-"\u0fbc", "\u0fc6", "\u1000"-"\u1021", "\u1023"-"\u1027", "\u1029"-"\u102a", "\u102c"-"\u1032", "\u1036"-"\u1039", "\u1040"-"\u1049", "\u1050"-"\u1059", "\u10a0"-"\u10c5", "\u10d0"-"\u10f6", "\u1100"-"\u1159", "\u115f"-"\u11a2", "\u11a8"-"\u11f9", "\u1200"-"\u1206", "\u1208"-"\u1246", "\u1248", "\u124a"-"\u124d", "\u1250"-"\u1256", "\u1258", "\u125a"-"\u125d", "\u1260"-"\u1286", "\u1288", "\u128a"-"\u128d", "\u1290"-"\u12ae", "\u12b0", "\u12b2"-"\u12b5", "\u12b8"-"\u12be", "\u12c0", "\u12c2"-"\u12c5", "\u12c8"-"\u12ce", "\u12d0"-"\u12d6", "\u12d8"-"\u12ee", "\u12f0"-"\u130e", "\u1310", "\u1312"-"\u1315", "\u1318"-"\u131e", "\u1320"-"\u1346", "\u1348"-"\u135a", "\u1369"-"\u1371", "\u13a0"-"\u13f4", "\u1401"-"\u166c", "\u166f"-"\u1676", "\u1681"-"\u169a", "\u16a0"-"\u16ea", "\u1780"-"\u17d3", "\u17db", "\u17e0"-"\u17e9", "\u180b"-"\u180e", "\u1810"-"\u1819", "\u1820"-"\u1877", "\u1880"-"\u18a9", "\u1e00"-"\u1e9b", "\u1ea0"-"\u1ef9", "\u1f00"-"\u1f15", "\u1f18"-"\u1f1d", "\u1f20"-"\u1f45", "\u1f48"-"\u1f4d", "\u1f50"-"\u1f57", "\u1f59", "\u1f5b", "\u1f5d", "\u1f5f"-"\u1f7d", "\u1f80"-"\u1fb4", "\u1fb6"-"\u1fbc", "\u1fbe", "\u1fc2"-"\u1fc4", "\u1fc6"-"\u1fcc", "\u1fd0"-"\u1fd3", "\u1fd6"-"\u1fdb", "\u1fe0"-"\u1fec", "\u1ff2"-"\u1ff4", "\u1ff6"-"\u1ffc", "\u200c"-"\u200f", "\u202a"-"\u202e", "\u203f"-"\u2040", "\u206a"-"\u206f", "\u207f", "\u20a0"-"\u20af", "\u20d0"-"\u20dc", "\u20e1", "\u2102", "\u2107", "\u210a"-"\u2113", "\u2115", "\u2119"-"\u211d", "\u2124", "\u2126", "\u2128", "\u212a"-"\u212d", "\u212f"-"\u2131", "\u2133"-"\u2139", "\u2160"-"\u2183", "\u3005"-"\u3007", "\u3021"-"\u302f", "\u3031"-"\u3035", "\u3038"-"\u303a", "\u3041"-"\u3094", "\u3099"-"\u309a", "\u309d"-"\u309e", "\u30a1"-"\u30fe", "\u3105"-"\u312c", "\u3131"-"\u318e", "\u31a0"-"\u31b7", "\u3400"-"\u4db5", "\u4e00"-"\u9fa5", "\ua000"-"\ua48c", "\uac00"-"\ud7a3", "\uf900"-"\ufa2d", "\ufb00"-"\ufb06", "\ufb13"-"\ufb17", "\ufb1d"-"\ufb28", "\ufb2a"-"\ufb36", "\ufb38"-"\ufb3c", "\ufb3e", "\ufb40"-"\ufb41", "\ufb43"-"\ufb44", "\ufb46"-"\ufbb1", "\ufbd3"-"\ufd3d", "\ufd50"-"\ufd8f", "\ufd92"-"\ufdc7", "\ufdf0"-"\ufdfb", "\ufe20"-"\ufe23", "\ufe33"-"\ufe34", "\ufe4d"-"\ufe4f", "\ufe69", "\ufe70"-"\ufe72", "\ufe74", "\ufe76"-"\ufefc", "\ufeff", "\uff04", "\uff10"-"\uff19", "\uff21"-"\uff3a", "\uff3f", "\uff41"-"\uff5a", "\uff65"-"\uffbe", "\uffc2"-"\uffc7", "\uffca"-"\uffcf", "\uffd2"-"\uffd7", "\uffda"-"\uffdc", "\uffe0"-"\uffe1", "\uffe5"-"\uffe6", "\ufff9"-"\ufffb" ] > } javacc-5.0.orig/src/org/javacc/jjtree/ASTGrammar.java0000644000175000017500000000377411067001633021431 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.io.File; import org.javacc.parser.JavaCCGlobals; public class ASTGrammar extends JJTreeNode { ASTGrammar(int id) { super(id); } void generate(IO io) { io.println("/*@bgen(jjtree) " + JavaCCGlobals.getIdString(JJTreeGlobals.toolList, new File(io.getOutputFileName()).getName()) + " */"); io.print("/*@egen*/"); print(io); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/JJTreeNode.java0000644000175000017500000001467010752436445021436 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class JJTreeNode extends SimpleNode { private int myOrdinal; public JJTreeNode(int id) { super(id); } public JJTreeNode(JJTreeParser p, int i) { this(i); } public static Node jjtCreate(int id) { return new JJTreeNode(id); } public void jjtAddChild(Node n, int i) { super.jjtAddChild(n, i); ((JJTreeNode)n).setOrdinal(i); } public int getOrdinal() { return myOrdinal; } public void setOrdinal(int o) { myOrdinal = o; } /***************************************************************** * * The following is added manually to enhance all tree nodes with * attributes that store the first and last tokens corresponding to * each node, as well as to print the tokens back to the specified * output stream. * *****************************************************************/ private Token first, last; public Token getFirstToken() { return first; } public void setFirstToken(Token t) { first = t; } public Token getLastToken() { return last; } public void setLastToken(Token t) { last = t; } /* This method prints the tokens corresponding to this node recursively calling the print methods of its children. Overriding this print method in appropriate nodes gives the output the added stuff not in the input. */ public void print(IO io) { /* Some productions do not consume any tokens. In that case their first and last tokens are a bit strange. */ if (getLastToken().next == getFirstToken()) { return; } Token t1 = getFirstToken(); Token t = new Token(); t.next = t1; JJTreeNode n; for (int ord = 0; ord < jjtGetNumChildren(); ord++) { n = (JJTreeNode)jjtGetChild(ord); while (true) { t = t.next; if (t == n.getFirstToken()) break; print(t, io); } n.print(io); t = n.getLastToken(); } while (t != getLastToken()) { t = t.next; print(t, io); } } String translateImage(Token t) { return t.image; } String whiteOut(Token t) { StringBuffer sb = new StringBuffer(t.image.length()); for (int i = 0; i < t.image.length(); ++i) { char ch = t.image.charAt(i); if (ch != '\t' && ch != '\n' && ch != '\r' && ch != '\f') { sb.append(' '); } else { sb.append(ch); } } return sb.toString(); } /* Indicates whether the token should be replaced by white space or replaced with the actual node variable. */ private boolean whitingOut = false; protected void print(Token t, IO io) { Token tt = t.specialToken; if (tt != null) { while (tt.specialToken != null) tt = tt.specialToken; while (tt != null) { io.print(TokenUtils.addUnicodeEscapes(translateImage(tt))); tt = tt.next; } } /* If we're within a node scope we modify the source in the following ways: 1) we rename all references to `jjtThis' to be references to the actual node variable. 2) we replace all calls to `jjtree.currentNode()' with references to the node variable. */ NodeScope s = NodeScope.getEnclosingNodeScope(this); if (s == null) { /* Not within a node scope so we don't need to modify the source. */ io.print(TokenUtils.addUnicodeEscapes(translateImage(t))); return; } if (t.image.equals("jjtThis")) { io.print(s.getNodeVariable()); return; } else if (t.image.equals("jjtree")) { if (t.next.image.equals(".")) { if (t.next.next.image.equals("currentNode")) { if (t.next.next.next.image.equals("(")) { if (t.next.next.next.next.image.equals(")")) { /* Found `jjtree.currentNode()' so go into white out mode. We'll stay in this mode until we find the closing parenthesis. */ whitingOut = true; } } } } } if (whitingOut) { if (t.image.equals("jjtree")) { io.print(s.getNodeVariable()); io.print(" "); } else if (t.image.equals(")")) { io.print(" "); whitingOut = false; } else { for (int i = 0; i < t.image.length(); ++i) { io.print(" "); } } return; } io.print(TokenUtils.addUnicodeEscapes(translateImage(t))); } static void openJJTreeComment(IO io, String arg) { if (arg != null) { io.print("/*@bgen(jjtree) " + arg + " */"); } else { io.print("/*@bgen(jjtree)*/"); } } static void closeJJTreeComment(IO io) { io.print("/*@egen*/"); } String getIndentation(JJTreeNode n) { return getIndentation(n, 0); } String getIndentation(JJTreeNode n, int offset) { String s = ""; for (int i = offset + 1; i < n.getFirstToken().beginColumn; ++i) { s += " "; } return s; } } javacc-5.0.orig/src/org/javacc/jjtree/JJTreeState.java0000644000175000017500000002333011066264372021617 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import org.javacc.parser.OutputFile; /** * Generate the State of a tree. */ final class JJTreeState { private JJTreeState() {} static void insertParserMembers(IO io) { String s; if (JJTreeOptions.getStatic()) { s = "static "; } else { s = ""; } io.println(); io.println(" protected " + s + nameState() + " jjtree = new " + nameState() + "();"); io.println(); } private static String nameState() { return "JJT" + JJTreeGlobals.parserName + "State"; } static void generateTreeState_java() { File file = new File(JJTreeOptions.getJJTreeOutputDirectory(), nameState() + ".java"); try { OutputFile outputFile = new OutputFile(file); PrintWriter ostr = outputFile.getPrintWriter(); NodeFiles.generatePrologue(ostr); insertState(ostr); outputFile.close(); } catch (IOException e) { throw new Error(e.toString()); } } private static void insertState(PrintWriter ostr) { ostr.println("public class " + nameState() + " {"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" private java.util.List nodes;"); else ostr.println(" private java.util.List nodes;"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" private java.util.List marks;"); else ostr.println(" private java.util.List marks;"); ostr.println(""); ostr.println(" private int sp; // number of nodes on stack"); ostr.println(" private int mk; // current mark"); ostr.println(" private boolean node_created;"); ostr.println(""); ostr.println(" public " + nameState() + "() {"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" nodes = new java.util.ArrayList();"); else ostr.println(" nodes = new java.util.ArrayList();"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" marks = new java.util.ArrayList();"); else ostr.println(" marks = new java.util.ArrayList();"); ostr.println(" sp = 0;"); ostr.println(" mk = 0;"); ostr.println(" }"); ostr.println(""); ostr.println(" /* Determines whether the current node was actually closed and"); ostr.println(" pushed. This should only be called in the final user action of a"); ostr.println(" node scope. */"); ostr.println(" public boolean nodeCreated() {"); ostr.println(" return node_created;"); ostr.println(" }"); ostr.println(""); ostr.println(" /* Call this to reinitialize the node stack. It is called"); ostr.println(" automatically by the parser's ReInit() method. */"); ostr.println(" public void reset() {"); ostr.println(" nodes.clear();"); ostr.println(" marks.clear();"); ostr.println(" sp = 0;"); ostr.println(" mk = 0;"); ostr.println(" }"); ostr.println(""); ostr.println(" /* Returns the root node of the AST. It only makes sense to call"); ostr.println(" this after a successful parse. */"); ostr.println(" public Node rootNode() {"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" return (Node)nodes.get(0);"); else ostr.println(" return nodes.get(0);"); ostr.println(" }"); ostr.println(""); ostr.println(" /* Pushes a node on to the stack. */"); ostr.println(" public void pushNode(Node n) {"); ostr.println(" nodes.add(n);"); ostr.println(" ++sp;"); ostr.println(" }"); ostr.println(""); ostr.println(" /* Returns the node on the top of the stack, and remove it from the"); ostr.println(" stack. */"); ostr.println(" public Node popNode() {"); ostr.println(" if (--sp < mk) {"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" mk = ((Integer)marks.remove(marks.size()-1)).intValue();"); else ostr.println(" mk = marks.remove(marks.size()-1);"); ostr.println(" }"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" return (Node)nodes.remove(nodes.size()-1);"); else ostr.println(" return nodes.remove(nodes.size()-1);"); ostr.println(" }"); ostr.println(""); ostr.println(" /* Returns the node currently on the top of the stack. */"); ostr.println(" public Node peekNode() {"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" return (Node)nodes.get(nodes.size()-1);"); else ostr.println(" return nodes.get(nodes.size()-1);"); ostr.println(" }"); ostr.println(""); ostr.println(" /* Returns the number of children on the stack in the current node"); ostr.println(" scope. */"); ostr.println(" public int nodeArity() {"); ostr.println(" return sp - mk;"); ostr.println(" }"); ostr.println(""); ostr.println(""); ostr.println(" public void clearNodeScope(Node n) {"); ostr.println(" while (sp > mk) {"); ostr.println(" popNode();"); ostr.println(" }"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" mk = ((Integer)marks.remove(marks.size()-1)).intValue();"); else ostr.println(" mk = marks.remove(marks.size()-1);"); ostr.println(" }"); ostr.println(""); ostr.println(""); ostr.println(" public void openNodeScope(Node n) {"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" marks.add(new Integer(mk));"); else ostr.println(" marks.add(mk);"); ostr.println(" mk = sp;"); ostr.println(" n.jjtOpen();"); ostr.println(" }"); ostr.println(""); ostr.println(""); ostr.println(" /* A definite node is constructed from a specified number of"); ostr.println(" children. That number of nodes are popped from the stack and"); ostr.println(" made the children of the definite node. Then the definite node"); ostr.println(" is pushed on to the stack. */"); ostr.println(" public void closeNodeScope(Node n, int num) {"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" mk = ((Integer)marks.remove(marks.size()-1)).intValue();"); else ostr.println(" mk = marks.remove(marks.size()-1);"); ostr.println(" while (num-- > 0) {"); ostr.println(" Node c = popNode();"); ostr.println(" c.jjtSetParent(n);"); ostr.println(" n.jjtAddChild(c, num);"); ostr.println(" }"); ostr.println(" n.jjtClose();"); ostr.println(" pushNode(n);"); ostr.println(" node_created = true;"); ostr.println(" }"); ostr.println(""); ostr.println(""); ostr.println(" /* A conditional node is constructed if its condition is true. All"); ostr.println(" the nodes that have been pushed since the node was opened are"); ostr.println(" made children of the conditional node, which is then pushed"); ostr.println(" on to the stack. If the condition is false the node is not"); ostr.println(" constructed and they are left on the stack. */"); ostr.println(" public void closeNodeScope(Node n, boolean condition) {"); ostr.println(" if (condition) {"); ostr.println(" int a = nodeArity();"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" mk = ((Integer)marks.remove(marks.size()-1)).intValue();"); else ostr.println(" mk = marks.remove(marks.size()-1);"); ostr.println(" while (a-- > 0) {"); ostr.println(" Node c = popNode();"); ostr.println(" c.jjtSetParent(n);"); ostr.println(" n.jjtAddChild(c, a);"); ostr.println(" }"); ostr.println(" n.jjtClose();"); ostr.println(" pushNode(n);"); ostr.println(" node_created = true;"); ostr.println(" } else {"); if (!JJTreeOptions.getGenerateGenerics()) ostr.println(" mk = ((Integer)marks.remove(marks.size()-1)).intValue();"); else ostr.println(" mk = marks.remove(marks.size()-1);"); ostr.println(" node_created = false;"); ostr.println(" }"); ostr.println(" }"); ostr.println("}"); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/JJTreeOptions.java0000644000175000017500000001742111165261215022167 0ustar mkochmkoch/* Copyright (c) 2005-2006, Kees Jan Koster kjkoster@kjkoster.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.io.File; import org.javacc.parser.JavaCCErrors; import org.javacc.parser.Options; /** * The JJTree-specific options. * * @author Kees Jan Koster <kjkoster@kjkoster.org> */ class JJTreeOptions extends Options { /** * Limit subclassing to derived classes. */ protected JJTreeOptions() { super(); } /** * Initialize the JJTree-specific options. */ public static void init() { Options.init(); Options.optionValues.put("JDK_VERSION", "1.5"); Options.optionValues.put("MULTI", Boolean.FALSE); Options.optionValues.put("NODE_DEFAULT_VOID", Boolean.FALSE); Options.optionValues.put("NODE_SCOPE_HOOK", Boolean.FALSE); Options.optionValues.put("NODE_USES_PARSER", Boolean.FALSE); Options.optionValues.put("BUILD_NODE_FILES", Boolean.TRUE); Options.optionValues.put("VISITOR", Boolean.FALSE); Options.optionValues.put("TRACK_TOKENS", Boolean.FALSE); Options.optionValues.put("NODE_PREFIX", "AST"); Options.optionValues.put("NODE_PACKAGE", ""); Options.optionValues.put("NODE_EXTENDS", ""); Options.optionValues.put("NODE_CLASS", ""); Options.optionValues.put("NODE_FACTORY", ""); Options.optionValues.put("OUTPUT_FILE", ""); Options.optionValues.put("VISITOR_DATA_TYPE", ""); Options.optionValues.put("VISITOR_RETURN_TYPE", "Object"); Options.optionValues.put("VISITOR_EXCEPTION", ""); Options.optionValues.put("JJTREE_OUTPUT_DIRECTORY", ""); } /** * Check options for consistency */ public static void validate() { if (!getVisitor()) { if (getVisitorDataType().length() > 0) { JavaCCErrors.warning("VISITOR_DATA_TYPE option will be ignored since VISITOR is false"); } if (getVisitorReturnType().length() > 0 && !getVisitorReturnType().equals("Object")) { JavaCCErrors.warning("VISITOR_RETURN_TYPE option will be ignored since VISITOR is false"); } if (getVisitorException().length() > 0) { JavaCCErrors.warning("VISITOR_EXCEPTION option will be ignored since VISITOR is false"); } } } /** * Find the JDK version. * * @return The specified JDK version. */ public static String getJdkVersion() { return stringValue("JDK_VERSION"); } /** * Find the multi value. * * @return The requested multi value. */ public static boolean getMulti() { return booleanValue("MULTI"); } /** * Find the node default void value. * * @return The requested node default void value. */ public static boolean getNodeDefaultVoid() { return booleanValue("NODE_DEFAULT_VOID"); } /** * Find the node scope hook value. * * @return The requested node scope hook value. */ public static boolean getNodeScopeHook() { return booleanValue("NODE_SCOPE_HOOK"); } /** * Find the node factory value. * * @return The requested node factory value. */ public static String getNodeFactory() { return stringValue("NODE_FACTORY"); } /** * Find the node uses parser value. * * @return The requested node uses parser value. */ public static boolean getNodeUsesParser() { return booleanValue("NODE_USES_PARSER"); } /** * Find the build node files value. * * @return The requested build node files value. */ public static boolean getBuildNodeFiles() { return booleanValue("BUILD_NODE_FILES"); } /** * Find the visitor value. * * @return The requested visitor value. */ public static boolean getVisitor() { return booleanValue("VISITOR"); } /** * Find the trackTokens value. * * @return The requested trackTokens value. */ public static boolean getTrackTokens() { return booleanValue("TRACK_TOKENS"); } /** * Find the node prefix value. * * @return The requested node prefix value. */ public static String getNodePrefix() { return stringValue("NODE_PREFIX"); } /** * Find the node super class name. * * @return The requested node super class */ public static String getNodeExtends() { return stringValue("NODE_EXTENDS"); } /** * Find the node class name. * * @return The requested node class */ public static String getNodeClass() { return stringValue("NODE_CLASS"); } /** * Find the node package value. * * @return The requested node package value. */ public static String getNodePackage() { return stringValue("NODE_PACKAGE"); } /** * Find the output file value. * * @return The requested output file value. */ public static String getOutputFile() { return stringValue("OUTPUT_FILE"); } /** * Find the visitor exception value * * @return The requested visitor exception value. */ public static String getVisitorException() { return stringValue("VISITOR_EXCEPTION"); } /** * Find the visitor data type value * * @return The requested visitor data type value. */ public static String getVisitorDataType() { return stringValue("VISITOR_DATA_TYPE"); } /** * Find the visitor return type value * * @return The requested visitor return type value. */ public static String getVisitorReturnType() { return stringValue("VISITOR_RETURN_TYPE"); } /** * Find the output directory to place the generated .jj files * into. If none is configured, use the value of * getOutputDirectory(). * * @return The requested JJTree output directory */ public static File getJJTreeOutputDirectory() { final String dirName = stringValue("JJTREE_OUTPUT_DIRECTORY"); File dir = null; if ("".equals(dirName)) { dir = getOutputDirectory(); } else { dir = new File(dirName); } return dir; } } javacc-5.0.orig/src/org/javacc/jjtree/ASTCompilationUnit.java0000644000175000017500000000610510751636206023161 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTCompilationUnit extends JJTreeNode { ASTCompilationUnit(int id) { super(id); } public void print(IO io) { Token t = getFirstToken(); while (true) { if (t == JJTreeGlobals.parserImports) { // If the parser and nodes are in separate packages (NODE_PACKAGE specified in // OPTIONS), then generate an import for the node package. if (!JJTreeGlobals.nodePackageName.equals("") && !JJTreeGlobals.nodePackageName.equals(JJTreeGlobals.packageName)) { io.getOut().println(""); io.getOut().println("import " + JJTreeGlobals.nodePackageName + ".*;"); } } if (t == JJTreeGlobals.parserImplements) { if (t.image.equals("implements")) { print(t, io); openJJTreeComment(io, null); io.getOut().print(" " + NodeFiles.nodeConstants() + ", "); closeJJTreeComment(io); } else { // t is pointing at the opening brace of the class body. openJJTreeComment(io, null); io.getOut().print("implements " + NodeFiles.nodeConstants()); closeJJTreeComment(io); print(t, io); } } else { print(t, io); } if (t == JJTreeGlobals.parserClassBodyStart) { openJJTreeComment(io, null); JJTreeState.insertParserMembers(io); closeJJTreeComment(io); } if (t == getLastToken()) { return; } t = t.next; } } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTBNFNodeScope.java0000644000175000017500000000411410716132661022243 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTBNFNodeScope extends JJTreeNode { ASTBNFNodeScope(int id) { super(id); } NodeScope node_scope; JJTreeNode expansion_unit; public void print(IO io) { if (node_scope.isVoid()) { super.print(io); return; } String indent = getIndentation(expansion_unit); openJJTreeComment(io, node_scope.getNodeDescriptor().getDescriptor()); io.println(); node_scope.tryExpansionUnit(io, indent, expansion_unit); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTOptionBinding.java0000644000175000017500000000442110751636206022605 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTOptionBinding extends JJTreeNode { ASTOptionBinding(int id) { super(id); } private boolean suppressed = false; private String name; void initialize(String n, String v) { name = n; // If an option is specific to JJTree it should not be written out // to the output file for JavaCC. if (JJTreeGlobals.isOptionJJTreeOnly(name)) { suppressed = true; } } boolean isSuppressed() { return suppressed; } void suppressOption(boolean s) { suppressed = s; } String translateImage(Token t) { if (suppressed) { return whiteOut(t); } else { return t.image; } } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/Main.java0000644000175000017500000000351510576213015020353 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; /** * Entry point. */ public final class Main { private Main() {} public static void main(String args[]) { JJTree jjtree = new JJTree(); int result = jjtree.main(args); System.exit(result); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/package.html0000644000175000017500000000060310575555141021110 0ustar mkochmkoch org.javacc.jjtree

A tree generator.

javacc-5.0.orig/src/org/javacc/jjtree/Token.java0000644000175000017500000001007710752436445020562 0ustar mkochmkoch/* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */ /** * This file contains the code for JavaCCParser generated * by JavaCCParser itself. */ package org.javacc.jjtree; /** * Describes the input token stream. */ public class Token { /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. */ public Object getValue() { return null; } /** * No-argument contructor */ public Token() {} /** * Constructs a new token for the specified Image. */ public Token(int kind) { this(kind, null); } /** * Constructs a new token for the specified Image and Kind. */ public Token(int kind, String image) { this.kind = kind; this.image = image; } /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use it in your lexical actions. */ public static final Token newToken(int ofKind, String image) { switch(ofKind) { default : return new Token(ofKind, image); case JJTreeParserConstants.RUNSIGNEDSHIFT: case JJTreeParserConstants.RSIGNEDSHIFT: case JJTreeParserConstants.GT: return new GTToken(ofKind, image); } } public static final Token newToken(int ofKind) { return newToken(ofKind, null); } /** * Greater than Token. */ public static class GTToken extends Token { public GTToken(int kind, String image) { super(kind, image); } int realKind = JJTreeParserConstants.GT; } } javacc-5.0.orig/src/org/javacc/jjtree/build.xml0000644000175000017500000001203011102170713020426 0ustar mkochmkoch javacc-5.0.orig/src/org/javacc/jjtree/ASTOptions.java0000644000175000017500000000331610716132661021474 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTOptions extends JJTreeNode { ASTOptions(int id) { super(id); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/JJTreeGlobals.java0000644000175000017500000001046411070137745022124 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Set; class JJTreeGlobals { static void initialize() { toolList = new ArrayList(); parserName = null; packageName = ""; parserImplements = null; parserClassBodyStart = null; parserImports = null; productions = new HashMap(); jjtreeOptions = new HashSet(); jjtreeOptions.add("JJTREE_OUTPUT_DIRECTORY"); jjtreeOptions.add("MULTI"); jjtreeOptions.add("NODE_PREFIX"); jjtreeOptions.add("NODE_PACKAGE"); jjtreeOptions.add("NODE_EXTENDS"); jjtreeOptions.add("NODE_CLASS"); jjtreeOptions.add("NODE_STACK_SIZE"); jjtreeOptions.add("NODE_DEFAULT_VOID"); jjtreeOptions.add("OUTPUT_FILE"); jjtreeOptions.add("CHECK_DEFINITE_NODE"); jjtreeOptions.add("NODE_SCOPE_HOOK"); jjtreeOptions.add("TRACK_TOKENS"); jjtreeOptions.add("NODE_FACTORY"); jjtreeOptions.add("NODE_USES_PARSER"); jjtreeOptions.add("BUILD_NODE_FILES"); jjtreeOptions.add("VISITOR"); jjtreeOptions.add("VISITOR_EXCEPTION"); jjtreeOptions.add("VISITOR_DATA_TYPE"); jjtreeOptions.add("VISITOR_RETURN_TYPE"); } static { initialize(); } /** * This set stores the JJTree-specific options that should not be * passed down to JavaCC */ private static Set jjtreeOptions; public static boolean isOptionJJTreeOnly(String optionName) { return jjtreeOptions.contains(optionName.toUpperCase()); } static List toolList = new ArrayList(); /** * Use this like className. **/ public static String parserName; /** * The package that the parser lives in. If the grammar doesn't * specify a package it is the empty string. **/ public static String packageName = ""; /** * The package the node files live in. If the NODE_PACKAGE option * is not set, then this defaults to packageName. **/ public static String nodePackageName = ""; /** The implements token of the parser class. If the * parser doesn't have one then it is the first "{" of the parser * class body. **/ public static Token parserImplements; /** The first token of the parser class body (the {). * The JJTree state is inserted after this token. **/ public static Token parserClassBodyStart; /** The first token of the import list, or the * position where such a list should be inserted. The import * for the Node Package is inserted after this token. **/ public static Token parserImports; /** * This is mapping from production names to ASTProduction objects. **/ static Map productions = new HashMap(); } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTJavacodeBody.java0000644000175000017500000000427010751636206022376 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTJavacodeBody extends JJTreeNode { ASTJavacodeBody(int id) { super(id); } NodeScope node_scope; public void print(IO io) { if (node_scope.isVoid()) { super.print(io); return; } Token first = getFirstToken(); String indent = ""; for (int i = 4; i < first.beginColumn; ++i) { indent += " "; } JJTreeNode.openJJTreeComment(io, node_scope.getNodeDescriptorText()); io.println(); node_scope.insertOpenNodeCode(io, indent); node_scope.tryTokenSequence(io, indent, first, getLastToken()); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTNodeDescriptorExpression.java0000644000175000017500000000346110716132661025046 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTNodeDescriptorExpression extends JJTreeNode { ASTNodeDescriptorExpression(int id) { super(id); } String translateImage(Token t) { return whiteOut(t); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/JJTree.java0000644000175000017500000001563311157571371020626 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.util.ArrayList; import java.util.Hashtable; import org.javacc.parser.JavaCCGlobals; public class JJTree { private IO io; private void p(String s) { io.getMsg().println(s); } private void help_message() { p("Usage:"); p(" jjtree option-settings inputfile"); p(""); p("\"option-settings\" is a sequence of settings separated by spaces."); p("Each option setting must be of one of the following forms:"); p(""); p(" -optionname=value (e.g., -STATIC=false)"); p(" -optionname:value (e.g., -STATIC:false)"); p(" -optionname (equivalent to -optionname=true. e.g., -STATIC)"); p(" -NOoptionname (equivalent to -optionname=false. e.g., -NOSTATIC)"); p(""); p("Option settings are not case-sensitive, so one can say \"-nOsTaTiC\" instead"); p("of \"-NOSTATIC\". Option values must be appropriate for the corresponding"); p("option, and must be either an integer or a string value."); p(""); p("The boolean valued options are:"); p(""); p(" STATIC (default true)"); p(" MULTI (default false)"); p(" NODE_DEFAULT_VOID (default false)"); p(" NODE_SCOPE_HOOK (default false)"); p(" NODE_USES_PARSER (default false)"); p(" BUILD_NODE_FILES (default true)"); p(" TRACK_TOKENS (default false)"); p(" VISITOR (default false)"); p(""); p("The string valued options are:"); p(""); p(" JDK_VERSION (default \"1.5\")"); p(" NODE_CLASS (default \"\")"); p(" NODE_PREFIX (default \"AST\")"); p(" NODE_PACKAGE (default \"\")"); p(" NODE_EXTENDS (default \"\")"); p(" NODE_FACTORY (default \"\")"); p(" OUTPUT_FILE (default remove input file suffix, add .jj)"); p(" OUTPUT_DIRECTORY (default \"\")"); p(" JJTREE_OUTPUT_DIRECTORY (default value of OUTPUT_DIRECTORY option)"); p(" VISITOR_DATA_TYPE (default \"\")"); p(" VISITOR_RETURN_TYPE (default \"Object\")"); p(" VISITOR_EXCEPTION (default \"\")"); p(""); p("JJTree also accepts JavaCC options, which it inserts into the generated file."); p(""); p("EXAMPLES:"); p(" jjtree -STATIC=false mygrammar.jjt"); p(""); p("ABOUT JJTree:"); p(" JJTree is a preprocessor for JavaCC that inserts actions into a"); p(" JavaCC grammar to build parse trees for the input."); p(""); p(" For more information, see the online JJTree documentation at "); p(" https://javacc.dev.java.net/doc/JJTree.html "); p(""); } /** * A main program that exercises the parser. */ public int main(String args[]) { // initialize static state for allowing repeat runs without exiting ASTNodeDescriptor.nodeIds = new ArrayList(); ASTNodeDescriptor.nodeNames = new ArrayList(); ASTNodeDescriptor.nodeSeen = new Hashtable(); org.javacc.parser.Main.reInitAll(); JavaCCGlobals.bannerLine("Tree Builder", ""); io = new IO(); try { initializeOptions(); if (args.length == 0) { p(""); help_message(); return 1; } else { p("(type \"jjtree\" with no arguments for help)"); } String fn = args[args.length - 1]; if (JJTreeOptions.isOption(fn)) { p("Last argument \"" + fn + "\" is not a filename"); return 1; } for (int arg = 0; arg < args.length - 1; arg++) { if (!JJTreeOptions.isOption(args[arg])) { p("Argument \"" + args[arg] + "\" must be an option setting."); return 1; } JJTreeOptions.setCmdLineOption(args[arg]); } JJTreeOptions.validate(); try { io.setInput(fn); } catch (JJTreeIOException ioe) { p("Error setting input: " + ioe.getMessage()); return 1; } p("Reading from file " + io.getInputFileName() + " . . ."); JJTreeGlobals.toolList = JavaCCGlobals.getToolNames(fn); JJTreeGlobals.toolList.add("JJTree"); try { JJTreeParser parser = new JJTreeParser(io.getIn()); parser.javacc_input(); ASTGrammar root = (ASTGrammar)parser.jjtree.rootNode(); if (Boolean.getBoolean("jjtree-dump")) { root.dump(" "); } try { io.setOutput(); } catch (JJTreeIOException ioe) { p("Error setting output: " + ioe.getMessage()); return 1; } root.generate(io); io.getOut().close(); NodeFiles.generateTreeConstants_java(); NodeFiles.generateVisitor_java(); JJTreeState.generateTreeState_java(); p("Annotated grammar generated successfully in " + io.getOutputFileName()); } catch (ParseException pe) { p("Error parsing input: " + pe.toString()); return 1; } catch (Exception e) { p("Error parsing input: " + e.toString()); e.printStackTrace(io.getMsg()); return 1; } return 0; } finally { io.closeAll(); } } /** * Initialize for JJTree */ private void initializeOptions() { JJTreeOptions.init(); JJTreeGlobals.initialize(); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTProduction.java0000644000175000017500000000414610716132661022171 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; import java.util.Hashtable; import java.util.Vector; public class ASTProduction extends JJTreeNode { ASTProduction(int id) { super(id); } String name; Vector throws_list = new Vector(); private Hashtable scopes = new Hashtable(); private int nextNodeScopeNumber = 0; int getNodeScopeNumber(NodeScope s) { Integer i = (Integer)scopes.get(s); if (i == null) { i = new Integer(nextNodeScopeNumber++); scopes.put(s, i); } return i.intValue(); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/JJTreeIOException.java0000644000175000017500000000347210576317057022736 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; /** * Thrown when ther is a problem reading or writing to the file system. */ class JJTreeIOException extends java.io.IOException { JJTreeIOException(String detail) { super(detail); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTExpansionNodeScope.java0000644000175000017500000000434610717117757023623 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTExpansionNodeScope extends JJTreeNode { ASTExpansionNodeScope(int id) { super(id); } NodeScope node_scope; JJTreeNode expansion_unit; public void print(IO io) { String indent = getIndentation(expansion_unit); openJJTreeComment(io, node_scope.getNodeDescriptor().getDescriptor()); io.println(); node_scope.insertOpenNodeAction(io, indent); node_scope.tryExpansionUnit(io, indent, expansion_unit); // Print the "whiteOut" equivalent of the Node descriptor to preserve // line numbers in the generated file. ((ASTNodeDescriptor)jjtGetChild(1)).print(io); } } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTJavacode.java0000644000175000017500000000335010574036575021564 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTJavacode extends ASTProduction { ASTJavacode(int id) { super(id); } Token stmBeginLoc; } /*end*/ javacc-5.0.orig/src/org/javacc/jjtree/ASTBNFAction.java0000644000175000017500000000705110716132660021603 0ustar mkochmkoch/* Copyright (c) 2006, Sun Microsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.jjtree; public class ASTBNFAction extends JJTreeNode { ASTBNFAction(int id) { super(id); } private Node getScopingParent(NodeScope ns) { for (Node n = this.jjtGetParent(); n != null; n = n.jjtGetParent()) { if (n instanceof ASTBNFNodeScope) { if (((ASTBNFNodeScope)n).node_scope == ns) { return n; } } else if (n instanceof ASTExpansionNodeScope) { if (((ASTExpansionNodeScope)n).node_scope == ns) { return n; } } } return null; } public void print(IO io) { /* Assume that this action requires an early node close, and then try to decide whether this assumption is false. Do this by looking outwards through the enclosing expansion units. If we ever find that we are enclosed in a unit which is not the final unit in a sequence we know that an early close is not required. */ NodeScope ns = NodeScope.getEnclosingNodeScope(this); if (ns != null && !ns.isVoid()) { boolean needClose = true; Node sp = getScopingParent(ns); JJTreeNode n = this; while (true) { Node p = n.jjtGetParent(); if (p instanceof ASTBNFSequence || p instanceof ASTBNFTryBlock) { if (n.getOrdinal() != p.jjtGetNumChildren() - 1) { /* We're not the final unit in the sequence. */ needClose = false; break; } } else if (p instanceof ASTBNFZeroOrOne || p instanceof ASTBNFZeroOrMore || p instanceof ASTBNFOneOrMore) { needClose = false; break; } if (p == sp) { /* No more parents to look at. */ break; } n = (JJTreeNode)p; } if (needClose) { openJJTreeComment(io, null); io.println(); ns.insertCloseNodeAction(io, getIndentation(this)); closeJJTreeComment(io); } } super.print(io); } } /*end*/ javacc-5.0.orig/src/org/javacc/utils/0000755000175000017500000000000011247044054016476 5ustar mkochmkochjavacc-5.0.orig/src/org/javacc/utils/JavaFileGenerator.java0000644000175000017500000001712211070005540022663 0ustar mkochmkoch/* Copyright (c) 2008, Paul Cager. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package org.javacc.utils; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; /** * Generates boiler-plate files from templates. Only very basic * template processing is supplied - if we need something more * sophisticated I suggest we use a third-party library. * * @author paulcager * @since 4.2 */ public class JavaFileGenerator { /** * @param templateName the name of the template. E.g. * "/templates/Token.template". * @param options the processing options in force, such * as "STATIC=yes" */ public JavaFileGenerator(String templateName, Map options) { this.templateName = templateName; this.options = options; } private final String templateName; private final Map options; private String currentLine; /** * Generate the output file. * @param out * @throws IOException */ public void generate(PrintWriter out) throws IOException { InputStream is = getClass().getResourceAsStream(templateName); if (is == null) throw new IOException("Invalid template name: " + templateName); BufferedReader in = new BufferedReader(new InputStreamReader(is)); process(in, out, false); } private String peekLine(BufferedReader in) throws IOException { if (currentLine == null) currentLine = in.readLine(); return currentLine; } private String getLine(BufferedReader in) throws IOException { String line = currentLine; currentLine = null; if (line == null) in.readLine(); return line; } private boolean evaluate(String condition) { condition = condition.trim(); Object obj = options.get(condition); if (obj == null) { return condition.equalsIgnoreCase("true") || condition.equalsIgnoreCase("yes"); } if (obj instanceof Boolean) { return ((Boolean)obj).booleanValue(); } else if (obj instanceof String) { String string = ((String)obj).trim(); return string.length() > 0 && !string.equalsIgnoreCase("false") && !string.equalsIgnoreCase("no"); } return false; } private String substitute(String text) throws IOException { int startPos; if ( (startPos = text.indexOf("${")) == -1) { return text; } // Find matching "}". int braceDepth = 1; int endPos = startPos + 2; while ( endPos < text.length() && braceDepth > 0) { if (text.charAt(endPos) == '{') braceDepth++; else if (text.charAt(endPos) == '}') braceDepth--; endPos++; } if (braceDepth != 0) throw new IOException("Mismatched \"{}\" in template string: " + text); final String variableExpression = text.substring(startPos + 2, endPos - 1); // Find the end of the variable name String value = null; for (int i = 0; i < variableExpression.length(); i++) { char ch = variableExpression.charAt(i); if (ch == ':' && i < variableExpression.length() - 1 && variableExpression.charAt(i+1) == '-' ) { value = substituteWithDefault(variableExpression.substring(0, i), variableExpression.substring(i + 2)); break; } else if (ch == '?') { value = substituteWithConditional(variableExpression.substring(0, i), variableExpression.substring(i + 1)); break; } else if (ch != '_' && !Character.isJavaIdentifierPart(ch)) { throw new IOException("Invalid variable in " + text); } } if (value == null) { value = substituteWithDefault(variableExpression, ""); } return text.substring(0, startPos) + value + text.substring(endPos); } /** * @param substring * @param defaultValue * @return * @throws IOException */ private String substituteWithConditional(String variableName, String values) throws IOException { // Split values into true and false values. int pos = values.indexOf(':'); if (pos == -1) throw new IOException("No ':' separator in " + values); if (evaluate(variableName)) return substitute(values.substring(0, pos)); else return substitute(values.substring(pos + 1)); } /** * @param variableName * @param defaultValue * @return */ private String substituteWithDefault(String variableName, String defaultValue) throws IOException { Object obj = options.get(variableName.trim()); if (obj == null || obj.toString().length() == 0) return substitute(defaultValue); return obj.toString(); } private void write(PrintWriter out, String text) throws IOException { while ( text.indexOf("${") != -1) { text = substitute(text); } out.println(text); } private void process(BufferedReader in, PrintWriter out, boolean ignoring) throws IOException { // out.println("*** process ignore=" + ignoring + " : " + peekLine(in)); while ( peekLine(in) != null) { if (peekLine(in).trim().startsWith("#if")) { String line = getLine(in).trim(); final boolean condition = evaluate(line.substring(3).trim()); process(in, out, ignoring || !condition); if (peekLine(in) != null && peekLine(in).trim().startsWith("#else")) { getLine(in); // Discard the #else line process(in, out, ignoring || condition); } line = getLine(in); if (line == null) throw new IOException("Missing \"#fi\""); if (!line.trim().startsWith("#fi")) throw new IOException("Expected \"#fi\", got: " + line); } else if (peekLine(in).trim().startsWith("#")) { break; } else { String line = getLine(in); if (!ignoring) write(out, line); } } out.flush(); } public static void main(String[] args) throws Exception { Map map = new HashMap(); map.put("falseArg", Boolean.FALSE); map.put("trueArg", Boolean.TRUE); map.put("stringValue", "someString"); new JavaFileGenerator(args[0], map).generate(new PrintWriter(args[1])); } } javacc-5.0.orig/src/org/javacc/package.html0000644000175000017500000000065510575555142017635 0ustar mkochmkoch org.javacc

A tree, grammar and lexer generator and a documentation generator.

javacc-5.0.orig/src/org/javacc/JavaCCTestCase.java0000644000175000017500000000154410751636205020734 0ustar mkochmkoch/** * */ package org.javacc; import junit.framework.TestCase; /** * An ancestor class to enable transition to a different directory structure. * * @author timp * @since 2 Nov 2007 * */ public abstract class JavaCCTestCase extends TestCase { /** * */ public JavaCCTestCase() { super(); } /** * @param name the test name */ public JavaCCTestCase(String name) { super(name); } /** * @return the documentation output directory name String relative to the root */ public String getJJDocOutputDirectory() { return "www/doc/"; //return "src/site/resources/"; } /** * Where the input jj files are located * @return the directory name String relative to the root */ public String getJJInputDirectory() { return "src/org/javacc/parser/"; //return "src/main/javacc/org/javacc/parser/"; } } javacc-5.0.orig/v5/0000755000175000017500000000000011247044055013064 5ustar mkochmkochjavacc-5.0.orig/v5/bin/0000755000175000017500000000000011247044055013634 5ustar mkochmkochjavacc-5.0.orig/v5/www/0000755000175000017500000000000011247044055013710 5ustar mkochmkochjavacc-5.0.orig/v5/lib/0000755000175000017500000000000011247044055013632 5ustar mkochmkochjavacc-5.0.orig/v5/bootstrap/0000755000175000017500000000000011247044055015101 5ustar mkochmkochjavacc-5.0.orig/v5/examples/0000755000175000017500000000000011247044055014702 5ustar mkochmkochjavacc-5.0.orig/v5/src/0000755000175000017500000000000011247044055013653 5ustar mkochmkoch