Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Jul 17, 2019
1 parent 73be390 commit 34014c2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/net/sf/jsqlparser/parser/SimpleCharStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SimpleCharStream {
protected boolean prevCharIsLF = false;

protected Provider inputStream;
private boolean externalBuffer;
private boolean isStringProvider;

protected char[] buffer;
protected int maxNextCharInd = 0;
Expand Down Expand Up @@ -98,7 +98,7 @@ protected void ExpandBuff(boolean wrapAround) {
}

protected void FillBuff() throws java.io.IOException {
if (!externalBuffer && maxNextCharInd == available) {
if (!isStringProvider && maxNextCharInd == available) {
if (available == bufsize) {
if (tokenBegin > 2048) {
bufpos = maxNextCharInd = 0;
Expand Down Expand Up @@ -288,11 +288,11 @@ public void backup(int amount) {
public SimpleCharStream(Provider dstream, int startline,
int startcolumn, int buffersize) {
inputStream = dstream;
externalBuffer = dstream instanceof StringProvider;
isStringProvider = dstream instanceof StringProvider;
line = startline;
column = startcolumn - 1;

if (externalBuffer) {
if (isStringProvider) {
int bs = ((StringProvider) inputStream)._string.length();
available = bufsize = bs;
bufline = new int[bs];
Expand Down Expand Up @@ -326,10 +326,10 @@ public SimpleCharStream(Provider dstream) {
public void ReInit(Provider dstream, int startline,
int startcolumn, int buffersize) {
inputStream = dstream;
externalBuffer = dstream instanceof StringProvider;
isStringProvider = dstream instanceof StringProvider;
line = startline;
column = startcolumn - 1;
if (externalBuffer) {
if (isStringProvider) {
int bs = ((StringProvider) inputStream)._string.length();
available = bufsize = bs;
bufline = new int[bs];
Expand Down Expand Up @@ -366,7 +366,7 @@ public void ReInit(Provider dstream) {
* Get token literal value.
*/
public String GetImage() {
if (externalBuffer) {
if (isStringProvider) {
String data = ((StringProvider) inputStream)._string;
if (bufpos >= tokenBegin) {
return data.substring(tokenBegin, bufpos + 1);
Expand Down

0 comments on commit 34014c2

Please sign in to comment.