Skip to content

Commit a515186

Browse files
committed
Update all files generated from .jj and .jjt using the new 7.0.9 javacc
1 parent 2835647 commit a515186

24 files changed

+1276
-1085
lines changed

src/edu/stanford/nlp/ling/tokensregex/parser/ParseException.java

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 6.0 */
2-
/* JavaCCOptions:KEEP_LINE_COL=null */
1+
/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */
2+
/* JavaCCOptions:KEEP_LINE_COLUMN=true */
33
package edu.stanford.nlp.ling.tokensregex.parser;
44

55
/**
@@ -20,6 +20,11 @@ public class ParseException extends Exception {
2020
*/
2121
private static final long serialVersionUID = 1L;
2222

23+
/**
24+
* The end of line string for this machine.
25+
*/
26+
protected static String EOL = System.getProperty("line.separator", "\n");
27+
2328
/**
2429
* This constructor is used by the method "generateParseException"
2530
* in the generated parser. Calling this constructor generates
@@ -60,7 +65,7 @@ public ParseException(String message) {
6065
/**
6166
* This is the last token that has been consumed successfully. If
6267
* this object has been created due to a parse error, the token
63-
* followng this token will (therefore) be the first error token.
68+
* following this token will (therefore) be the first error token.
6469
*/
6570
public Token currentToken;
6671

@@ -88,8 +93,8 @@ public ParseException(String message) {
8893
private static String initialise(Token currentToken,
8994
int[][] expectedTokenSequences,
9095
String[] tokenImage) {
91-
String eol = System.getProperty("line.separator", "\n");
92-
StringBuffer expected = new StringBuffer();
96+
97+
StringBuilder expected = new StringBuilder();
9398
int maxSize = 0;
9499
for (int i = 0; i < expectedTokenSequences.length; i++) {
95100
if (maxSize < expectedTokenSequences[i].length) {
@@ -101,7 +106,7 @@ private static String initialise(Token currentToken,
101106
if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
102107
expected.append("...");
103108
}
104-
expected.append(eol).append(" ");
109+
expected.append(EOL).append(" ");
105110
}
106111
String retval = "Encountered \"";
107112
Token tok = currentToken.next;
@@ -118,34 +123,35 @@ private static String initialise(Token currentToken,
118123
tok = tok.next;
119124
}
120125
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
121-
retval += "." + eol;
122-
if (expectedTokenSequences.length == 1) {
123-
retval += "Was expecting:" + eol + " ";
126+
retval += "." + EOL;
127+
128+
129+
if (expectedTokenSequences.length == 0) {
130+
// Nothing to add here
124131
} else {
125-
retval += "Was expecting one of:" + eol + " ";
132+
if (expectedTokenSequences.length == 1) {
133+
retval += "Was expecting:" + EOL + " ";
134+
} else {
135+
retval += "Was expecting one of:" + EOL + " ";
136+
}
137+
retval += expected.toString();
126138
}
127-
retval += expected.toString();
139+
128140
return retval;
129141
}
130142

131-
/**
132-
* The end of line string for this machine.
133-
*/
134-
protected String eol = System.getProperty("line.separator", "\n");
135143

136144
/**
137145
* Used to convert raw characters to their escaped version
138146
* when these raw version cannot be used as part of an ASCII
139147
* string literal.
140148
*/
141149
static String add_escapes(String str) {
142-
StringBuffer retval = new StringBuffer();
150+
StringBuilder retval = new StringBuilder();
143151
char ch;
144152
for (int i = 0; i < str.length(); i++) {
145153
switch (str.charAt(i))
146154
{
147-
case 0 :
148-
continue;
149155
case '\b':
150156
retval.append("\\b");
151157
continue;
@@ -184,4 +190,4 @@ static String add_escapes(String str) {
184190
}
185191

186192
}
187-
/* JavaCC - OriginalChecksum=7de12d662d6967006458e1754f0d9ddb (do not edit this line) */
193+
/* JavaCC - OriginalChecksum=d277886056e6d15189c1d037f9778d23 (do not edit this line) */

src/edu/stanford/nlp/ling/tokensregex/parser/SimpleCharStream.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 6.0 */
1+
/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 7.0 */
22
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=false */
33
package edu.stanford.nlp.ling.tokensregex.parser;
44

@@ -30,13 +30,14 @@ class SimpleCharStream
3030
protected char[] buffer;
3131
protected int maxNextCharInd = 0;
3232
protected int inBuf = 0;
33-
protected int tabSize = 8;
33+
protected int tabSize = 1;
3434
protected boolean trackLineColumn = true;
3535

3636
public void setTabSize(int i) { tabSize = i; }
3737
public int getTabSize() { return tabSize; }
3838

3939

40+
4041
protected void ExpandBuff(boolean wrapAround)
4142
{
4243
char[] newbuffer = new char[bufsize + 2048];
@@ -467,8 +468,7 @@ public void adjustBeginLineColumn(int newLine, int newCol)
467468
line = bufline[j];
468469
column = bufcolumn[j];
469470
}
470-
471471
boolean getTrackLineColumn() { return trackLineColumn; }
472472
void setTrackLineColumn(boolean tlc) { trackLineColumn = tlc; }
473473
}
474-
/* JavaCC - OriginalChecksum=8311b848ae23f77795798d787d1d2e1c (do not edit this line) */
474+
/* JavaCC - OriginalChecksum=68842fc9a795f1e48f66a6b9680b63f2 (do not edit this line) */

src/edu/stanford/nlp/ling/tokensregex/parser/Token.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* Generated By:JavaCC: Do not edit this line. Token.java Version 6.0 */
2-
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=false */
1+
/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */
2+
/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=false */
33
package edu.stanford.nlp.ling.tokensregex.parser;
44

55
/**
@@ -97,6 +97,7 @@ public Token(int kind, String image)
9797
/**
9898
* Returns the image.
9999
*/
100+
@Override
100101
public String toString()
101102
{
102103
return image;
@@ -128,4 +129,4 @@ public static Token newToken(int ofKind)
128129
}
129130

130131
}
131-
/* JavaCC - OriginalChecksum=d77ebefb408ce2b6cb99e8547d927296 (do not edit this line) */
132+
/* JavaCC - OriginalChecksum=358d77ba2ff772d656ab271a8fa9a74f (do not edit this line) */

src/edu/stanford/nlp/ling/tokensregex/parser/TokenMgrError.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 6.0 */
1+
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */
22
/* JavaCCOptions: */
33
package edu.stanford.nlp.ling.tokensregex.parser;
44

@@ -20,22 +20,22 @@ class TokenMgrError extends Error
2020
/**
2121
* Lexical error occurred.
2222
*/
23-
static final int LEXICAL_ERROR = 0;
23+
public static final int LEXICAL_ERROR = 0;
2424

2525
/**
2626
* An attempt was made to create a second instance of a static token manager.
2727
*/
28-
static final int STATIC_LEXER_ERROR = 1;
28+
public static final int STATIC_LEXER_ERROR = 1;
2929

3030
/**
3131
* Tried to change to an invalid lexical state.
3232
*/
33-
static final int INVALID_LEXICAL_STATE = 2;
33+
public static final int INVALID_LEXICAL_STATE = 2;
3434

3535
/**
3636
* Detected (and bailed out of) an infinite loop in the token manager.
3737
*/
38-
static final int LOOP_DETECTED = 3;
38+
public static final int LOOP_DETECTED = 3;
3939

4040
/**
4141
* Indicates the reason why the exception is thrown. It will have
@@ -48,13 +48,11 @@ class TokenMgrError extends Error
4848
* equivalents in the given string
4949
*/
5050
protected static final String addEscapes(String str) {
51-
StringBuffer retval = new StringBuffer();
51+
StringBuilder retval = new StringBuilder();
5252
char ch;
5353
for (int i = 0; i < str.length(); i++) {
5454
switch (str.charAt(i))
5555
{
56-
case 0 :
57-
continue;
5856
case '\b':
5957
retval.append("\\b");
6058
continue;
@@ -104,11 +102,12 @@ protected static final String addEscapes(String str) {
104102
* curchar : the offending character
105103
* Note: You can customize the lexical error message by modifying this method.
106104
*/
107-
protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
105+
protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) {
106+
char curChar1 = (char)curChar;
108107
return("Lexical error at line " +
109108
errorLine + ", column " +
110109
errorColumn + ". Encountered: " +
111-
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
110+
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar1)) + "\"") + " (" + curChar + "), ") +
112111
"after : \"" + addEscapes(errorAfter) + "\"");
113112
}
114113

@@ -121,6 +120,7 @@ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLin
121120
*
122121
* from this method for such cases in the release version of your parser.
123122
*/
123+
@Override
124124
public String getMessage() {
125125
return super.getMessage();
126126
}
@@ -140,8 +140,8 @@ public TokenMgrError(String message, int reason) {
140140
}
141141

142142
/** Full Constructor. */
143-
public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
144-
this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
143+
public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) {
144+
this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
145145
}
146146
}
147-
/* JavaCC - OriginalChecksum=c67915be06a7fb9cc762633c14924df8 (do not edit this line) */
147+
/* JavaCC - OriginalChecksum=97f34515b99910283b9130a6599cb64d (do not edit this line) */

0 commit comments

Comments
 (0)