
eu.interedition.text.lisp.Token Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of text-core Show documentation
Show all versions of text-core Show documentation
Stand-off Markup/Annotation Text Model
The newest version!
/*
* S-Expression Parser in Java.
*
* Copyright (C) 2012 Joel F. Klein
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package eu.interedition.text.lisp;
import java.io.StreamTokenizer;
/**
* @author Joel F. Klein
*/
public class Token {
public int type;
public String text;
public int line;
public Token(StreamTokenizer tokenizer) {
this.type = tokenizer.ttype;
this.text = tokenizer.sval;
this.line = tokenizer.lineno();
}
public String toString() {
switch (this.type) {
case StreamTokenizer.TT_WORD:
case '"':
return this.text;
default:
return String.valueOf((char) this.type);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy