Files
artloglaby/java/org/artisanlogiciel/lua/CharProvider.java
philippe lhardy 6c9800047c load .we with layers
- and fix some bug : max is within range ( perhaps not as many as those added ...)
- quick hack in CharProvider to skip spaces ... ( bad it applies to strings too ...)
2020-11-05 21:31:28 +01:00

41 lines
733 B
Java

package org.artisanlogiciel.lua;
public class CharProvider {
String input;
int current;
int last;
public CharProvider(String input) {
this.input = input;
current = 0;
}
public char getNextchar()
{
int i = current;
int max = input.length();
if ( max > current) {
char c = 0;
last = current;
while ( ( max > i ) && ( c = input.charAt(i) ) == ' ' )
{
i++;
}
current = i + 1;
return c;
}
else
{
return 0;
}
}
public void pushBackChar(char c)
{
System.out.print('*');
current = last;
}
}