aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/select/simple/Parser.java
blob: 84b40ff6f26b58f90b66e5c4c5fad1369ce29571 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.select.simple;

/**
 * @author baldersheim
 */
public abstract class Parser {
    public abstract boolean parse(CharSequence s);
    public CharSequence getRemaining() { return remaining; }
    protected void setRemaining(CharSequence r) { remaining = r; }
    private CharSequence remaining;
    protected int eatWhite(CharSequence s) {
        int pos = 0;
        for (;pos < s.length() && Character.isSpaceChar(s.charAt(pos)); pos++);
        return pos;
    }
    protected boolean icmp(char c, char l) {
        return Character.toLowerCase(c) == l;
    }
}