001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 1998-2005 Julian Hyde
008// Copyright (C) 2005-2005 Pentaho and others
009// All Rights Reserved.
010*/
011package mondrian.olap;
012
013/**
014 * Lexical analyzer whose input is a string.
015 *
016 * @author jhyde, 20 January, 1999
017 */
018public class StringScanner extends Scanner {
019    private final String s;
020    private int i;
021
022    public StringScanner(String s, boolean debug) {
023        super(debug);
024        this.s = s;
025        i = 0;
026    }
027
028    // Override Scanner.getChar().
029    protected int getChar() {
030        return (i >= s.length())
031            ? -1
032            : s.charAt(i++);
033    }
034}
035
036// End StringScanner.java