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 ...)
This commit is contained in:
philippe lhardy
2020-11-05 21:31:28 +01:00
parent bf918333bf
commit 6c9800047c
5 changed files with 63 additions and 36 deletions

View File

@@ -4,6 +4,7 @@ public class CharProvider {
String input;
int current;
int last;
public CharProvider(String input) {
this.input = input;
@@ -13,9 +14,16 @@ public class CharProvider {
public char getNextchar()
{
int i = current;
if ( input.length() > current) {
current++;
return input.charAt(i);
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
{
@@ -26,7 +34,7 @@ public class CharProvider {
public void pushBackChar(char c)
{
System.out.print('*');
current--;
current = last;
}
}