Skip to content

Commit

Permalink
Bit more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 19, 2013
1 parent a3de8a0 commit 89d5f32
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ public JsonToken nextToken()
boolean inObject = _parsingContext.inObject();
if (inObject) {
// First, field name itself:
String name = _parseFieldName(i);
String name = _parseName(i);
_parsingContext.setCurrentName(name);
_currToken = JsonToken.FIELD_NAME;
i = _skipWS();
Expand Down Expand Up @@ -664,7 +664,6 @@ public JsonToken nextToken()
case '7':
case '8':
case '9':

t = parseNumberText(i);
break;
default:
Expand Down Expand Up @@ -1157,10 +1156,10 @@ protected JsonToken _handleInvalidNumberStart(int ch, boolean negative)
/**********************************************************
*/

protected String _parseFieldName(int i) throws IOException
protected String _parseName(int i) throws IOException
{
if (i != INT_QUOTE) {
return _handleUnusualFieldName(i);
return _handleOddName(i);
}
/* First: let's try to see if we have a simple name: one that does
* not cross input buffer boundary, and does not contain escape
Expand Down Expand Up @@ -1255,11 +1254,11 @@ private String _parseFieldName2(int startPtr, int hash, int endChar) throws IOEx
* In standard mode will just throw an expection; but
* in non-standard modes may be able to parse name.
*/
protected String _handleUnusualFieldName(int i) throws IOException
protected String _handleOddName(int i) throws IOException
{
// [JACKSON-173]: allow single quotes
if (i == '\'' && isEnabled(Feature.ALLOW_SINGLE_QUOTES)) {
return _parseApostropheFieldName();
return _parseAposName();
}
// [JACKSON-69]: allow unquoted names if feature enabled:
if (!isEnabled(Feature.ALLOW_UNQUOTED_FIELD_NAMES)) {
Expand Down Expand Up @@ -1303,10 +1302,10 @@ protected String _handleUnusualFieldName(int i) throws IOException
}
int start = _inputPtr-1;
_inputPtr = ptr;
return _parseUnusualFieldName2(start, hash, codes);
return _handleOddName2(start, hash, codes);
}

protected String _parseApostropheFieldName() throws IOException
protected String _parseAposName() throws IOException
{
// Note: mostly copy of_parseFieldName
int ptr = _inputPtr;
Expand Down Expand Up @@ -1430,8 +1429,7 @@ protected JsonToken _handleApos() throws IOException
return JsonToken.VALUE_STRING;
}

private String _parseUnusualFieldName2(int startPtr, int hash, int[] codes)
throws IOException
private String _handleOddName2(int startPtr, int hash, int[] codes) throws IOException
{
_textBuffer.resetWithShared(_inputBuffer, startPtr, (_inputPtr - startPtr));
char[] outBuf = _textBuffer.getCurrentSegment();
Expand Down Expand Up @@ -1621,12 +1619,6 @@ protected void _skipCR() throws IOException
_currInputRowStart = _inputPtr;
}

protected void _skipLF() throws IOException
{
++_currInputRow;
_currInputRowStart = _inputPtr;
}

private int _skipWS() throws IOException
{
while (_inputPtr < _inputEnd || loadMore()) {
Expand All @@ -1638,7 +1630,8 @@ private int _skipWS() throws IOException
_skipComment();
} else if (i != INT_SPACE) {
if (i == INT_LF) {
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
} else if (i == INT_CR) {
_skipCR();
} else if (i != INT_TAB) {
Expand All @@ -1662,7 +1655,8 @@ private int _skipWSOrEnd() throws IOException
}
if (i != INT_SPACE) {
if (i == INT_LF) {
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
} else if (i == INT_CR) {
_skipCR();
} else if (i != INT_TAB) {
Expand Down Expand Up @@ -1713,7 +1707,8 @@ private void _skipCComment() throws IOException
}
if (i < INT_SPACE) {
if (i == INT_LF) {
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
} else if (i == INT_CR) {
_skipCR();
} else if (i != INT_TAB) {
Expand All @@ -1732,7 +1727,8 @@ private void _skipCppComment() throws IOException
int i = (int) _inputBuffer[_inputPtr++];
if (i < INT_SPACE) {
if (i == INT_LF) {
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
break;
} else if (i == INT_CR) {
_skipCR();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2497,7 +2497,8 @@ private final int _skipWS() throws IOException
_skipUtf8_4(i);
break;
case INT_LF:
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
break;
case INT_CR:
_skipCR();
Expand Down Expand Up @@ -2541,7 +2542,8 @@ private int _skipWSOrEnd() throws IOException
_skipUtf8_4(i);
break;
case INT_LF:
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
break;
case INT_CR:
_skipCR();
Expand Down Expand Up @@ -2600,7 +2602,8 @@ private int _skipColon() throws IOException
_skipCR();
break;
case INT_LF:
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
break;
case '/':
_skipComment();
Expand Down Expand Up @@ -2631,7 +2634,8 @@ private int _skipColon() throws IOException
_skipComment();
} else if (i != INT_SPACE) {
if (i == INT_LF) {
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
} else if (i == INT_CR) {
_skipCR();
} else if (i != INT_TAB) {
Expand Down Expand Up @@ -2683,7 +2687,8 @@ private void _skipCComment() throws IOException
}
break;
case INT_LF:
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
break;
case INT_CR:
_skipCR();
Expand Down Expand Up @@ -2716,7 +2721,8 @@ private void _skipCppComment() throws IOException
if (code != 0) {
switch (code) {
case INT_LF:
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
return;
case INT_CR:
_skipCR();
Expand Down Expand Up @@ -2754,7 +2760,8 @@ protected boolean _skipHashComment() throws IOException
if (code != 0) {
switch (code) {
case '\n':
_skipLF();
++_currInputRow;
_currInputRowStart = _inputPtr;
return true;
case '\r':
_skipCR();
Expand Down Expand Up @@ -3049,13 +3056,7 @@ protected void _skipCR() throws IOException
_currInputRowStart = _inputPtr;
}

protected void _skipLF() throws IOException
{
++_currInputRow;
_currInputRowStart = _inputPtr;
}

private int nextByte() throws IOException
private int nextByte() throws IOException
{
if (_inputPtr >= _inputEnd) {
loadMoreGuaranteed();
Expand Down

0 comments on commit 89d5f32

Please sign in to comment.