From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../javax/swing/text/rtf/ControlWordToken.java | 86 ++++++ .../javax/swing/text/rtf/RTFEditorKit.java | 114 ++++++++ .../javax/swing/text/rtf/RTFParseException.java | 65 +++++ .../classpath/javax/swing/text/rtf/RTFParser.java | 203 ++++++++++++++ .../classpath/javax/swing/text/rtf/RTFScanner.java | 294 +++++++++++++++++++++ .../classpath/javax/swing/text/rtf/TextToken.java | 65 +++++ libjava/classpath/javax/swing/text/rtf/Token.java | 91 +++++++ .../classpath/javax/swing/text/rtf/package.html | 48 ++++ 8 files changed, 966 insertions(+) create mode 100644 libjava/classpath/javax/swing/text/rtf/ControlWordToken.java create mode 100644 libjava/classpath/javax/swing/text/rtf/RTFEditorKit.java create mode 100644 libjava/classpath/javax/swing/text/rtf/RTFParseException.java create mode 100644 libjava/classpath/javax/swing/text/rtf/RTFParser.java create mode 100644 libjava/classpath/javax/swing/text/rtf/RTFScanner.java create mode 100644 libjava/classpath/javax/swing/text/rtf/TextToken.java create mode 100644 libjava/classpath/javax/swing/text/rtf/Token.java create mode 100644 libjava/classpath/javax/swing/text/rtf/package.html (limited to 'libjava/classpath/javax/swing/text/rtf') diff --git a/libjava/classpath/javax/swing/text/rtf/ControlWordToken.java b/libjava/classpath/javax/swing/text/rtf/ControlWordToken.java new file mode 100644 index 000000000..7008f0fd4 --- /dev/null +++ b/libjava/classpath/javax/swing/text/rtf/ControlWordToken.java @@ -0,0 +1,86 @@ +/* ControlWordToken.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * A special {@link Token} that represents a control word in RTF like + * '\deff0' where 'deff' is the name of the control word and '0' is an + * optional parameter. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class ControlWordToken extends Token +{ + + /** + * The name of the control word. + */ + public String name; + + /** + * The optional parameter of the control word. Absence of a parameter is + * expressed through Integer.MIN_VALUE. + */ + public int param; + + /** + * Constructs a new ControlWordToken with the specified name and without + * a parameter. + * + * @param name the name of the control word + */ + public ControlWordToken(String name) + { + this(name, Integer.MIN_VALUE); + } + + + /** + * Constructs a new ControlWordToken with the specified name and parameter. + * + * @param name the name of the control word + */ + public ControlWordToken(String name, int param) + { + super(Token.CONTROL_WORD); + this.name = name; + this.param = param; + } + +} diff --git a/libjava/classpath/javax/swing/text/rtf/RTFEditorKit.java b/libjava/classpath/javax/swing/text/rtf/RTFEditorKit.java new file mode 100644 index 000000000..b2ebe3dd1 --- /dev/null +++ b/libjava/classpath/javax/swing/text/rtf/RTFEditorKit.java @@ -0,0 +1,114 @@ +/* RTFEditorKit.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; + +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import javax.swing.text.StyledEditorKit; + +/** + * Provides support for RTF data for use in + * {@link javax.swing.JEditorPane}s. + * + * @author Roman Kennke (roman@ontographics.com) + */ +public class RTFEditorKit + extends StyledEditorKit +{ + + /** + * Constructs a new RTFEditorKit. + */ + public RTFEditorKit() + { + super(); + } + + /** + * Returns the MIME content type. In the case of RTFEditorKit this is + * 'text/rtf' + * + * @return the MIME content type for RTFEditorKit + */ + public String getContentType() + { + return "text/rtf"; + } + + /** + * Reads RTF data from stream into doc at the + * specified position pos. + * + * @param stream the {@link InputStream} from where we read RTF data + * @param doc the {@link Document} into which we read the RTF data + * @param pos the position where to start + * + * @throws IOException if an IO error occurs + * @throws BadLocationException if the position is not valid + */ + public void read(InputStream stream, Document doc, int pos) + throws IOException, BadLocationException + { + RTFParser parser = new RTFParser(stream, doc, pos); + parser.parse(); + } + + + /** + * Reads RTF data from reader into doc at the + * specified position pos. + * + * @param reader the {@link Reader} from where we read RTF data + * @param doc the {@link Document} into which we read the RTF data + * @param pos the position where to start + * + * @throws IOException if an IO error occurs + * @throws BadLocationException if the position is not valid + */ + public void read(Reader reader, Document doc, int pos) + throws IOException, BadLocationException + { + RTFParser parser = new RTFParser(reader, doc, pos); + parser.parse(); + } +} diff --git a/libjava/classpath/javax/swing/text/rtf/RTFParseException.java b/libjava/classpath/javax/swing/text/rtf/RTFParseException.java new file mode 100644 index 000000000..2a9c64f05 --- /dev/null +++ b/libjava/classpath/javax/swing/text/rtf/RTFParseException.java @@ -0,0 +1,65 @@ +/* RTFParseException.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * Indicates a parsing error during RTF processing. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class RTFParseException + extends RuntimeException +{ + /** + * Constructs a new RTFParseException without message. + */ + public RTFParseException() + { + super(); + } + + /** + * Constructs a new RTFParseException with the specified message. + */ + public RTFParseException(String message) + { + super(message); + } + +} diff --git a/libjava/classpath/javax/swing/text/rtf/RTFParser.java b/libjava/classpath/javax/swing/text/rtf/RTFParser.java new file mode 100644 index 000000000..3306056ff --- /dev/null +++ b/libjava/classpath/javax/swing/text/rtf/RTFParser.java @@ -0,0 +1,203 @@ +/* RTFParser.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; + +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; + +/** + * Parses an RTF file into a {@link Document}. The parser utilizes + * {@link RTFScanner}. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class RTFParser +{ + + /** + * Our scanner. + */ + private RTFScanner scanner; + + /** + * The document into which we parse. + */ + private Document doc; + + /** + * The current position. + */ + private int pos; + + /** + * Constructs a new RTFParser for the specified document and position, + * without initializing the scanner. This is only used internally. + * + * @param doc the {@link Document} into which we should parse + * @param pos the position to start + */ + private RTFParser(Document doc, int pos) + { + this.doc = doc; + this.pos = pos; + } + + /** + * Constructs a new RTFParser for the specified stream. + * + * @param stream the stream from which we parse + * @param doc the {@link Document} into which we should parse + * @param pos the position to start + */ + public RTFParser(InputStream stream, Document doc, int pos) + { + this(doc, pos); + scanner = new RTFScanner(stream); + } + + /** + * Constructs a new RTFParser for the specified reader. + * + * @param reader the reader from which we parse + * @param doc the {@link Document} into which we should parse + * @param pos the position to start + */ + public RTFParser(Reader reader, Document doc, int pos) + { + this(doc, pos); + scanner = new RTFScanner(reader); + } + + /** + * Returns the {@link Document} in which we parsed the RTF data. + * + * @return the {@link Document} in which we parsed the RTF data + */ + public Document getDocument() + { + return doc; + } + + /** + * Starts the parsing process. + */ + public void parse() + throws IOException, BadLocationException + { + parseFile(); + } + + /** + * The parse rules for <file>. + */ + private void parseFile() + throws IOException, BadLocationException + { + Token t1 = scanner.readToken(); + if (t1.type != Token.LCURLY) + throw new RTFParseException("expected left curly braces"); + + parseHeader(); + parseDocument(); + + Token t2 = scanner.peekToken(); + if (t2.type == Token.RCURLY) + { + // Eat the token. + scanner.readToken(); + } + else + { + // Ignore this for maximum robustness when file is broken. + System.err.println("RTF warning: expected right curly braces"); + } + + } + + /** + * The parse rules for <header>. + * + * TODO: implement this properly + */ + private void parseHeader() + //throws IOException, BadLocationException + { + // TODO add parse rules here + } + + + /** + * The parse rules for <document>. + * + * TODO: implement this properly + */ + private void parseDocument() + throws IOException, BadLocationException + { + // !!! TODO !!! + // This simply emits every TEXT Token as text to the document + // which is plain stupid + + boolean eof = false; + + do { + Token token = scanner.readToken(); + switch (token.type) + { + case Token.TEXT: + TextToken textToken = (TextToken) token; + doc.insertString(pos, textToken.text, null); + pos += textToken.text.length(); + break; + case Token.EOF: + eof = true; + break; + default: + // FIXME + break; + } + } while (!eof); + + } + +} diff --git a/libjava/classpath/javax/swing/text/rtf/RTFScanner.java b/libjava/classpath/javax/swing/text/rtf/RTFScanner.java new file mode 100644 index 000000000..2eca159c4 --- /dev/null +++ b/libjava/classpath/javax/swing/text/rtf/RTFScanner.java @@ -0,0 +1,294 @@ +/* RTFScanner.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; + +/** + * Provides a scanner that scans an {@link InputStream} for tokens of the + * RTF syntax. + * + * This scanner is based upon the RTF specification 1.6 + * available at: + * + * + * RTF specification at MSDN + * + * @author Roman Kennke (roman@ontographics.com) + */ +class RTFScanner +{ + + /** + * The reader from which we read the RTF data. + */ + private Reader in; + + /** + * This is used to constuct strings from the read in chars. + */ + private StringBuffer buffer; + + /** + * Lookahead token. + */ + private Token lastToken; + + /** + * Constructs a new RTFScanner without initializing the {@link Reader}. + */ + private RTFScanner() + { + buffer = new StringBuffer(); + } + + /** + * Constructs a new RTFScanner for the given {@link InputStream}. + * The stream is wrapped into an {@link InputStreamReader} and if it's + * not yet buffered then the Reader is wrapped in a {@link BufferedReader} + * + * @param stream the {@link InputStream} to read RTF data from + */ + public RTFScanner(InputStream stream) + { + this(); + InputStreamReader reader = new InputStreamReader(stream); + in = new BufferedReader(reader); + } + + /** + * Constructs a new RTFScanner for the given {@link Reader}. + * + * If the reader is not an instance of {@link BufferedReader} then it + * is wrapped into a BufferedReader. + * + * @param reader the {@link BufferedReader} to read RTF data from + */ + public RTFScanner(Reader reader) + { + this(); + if (reader instanceof BufferedReader) + { + in = reader; + } + else + { + in = new BufferedReader(reader); + } + } + + /** + * Reads in the next {@link Token} from the stream. + * + * @return the read {@link Token} + * + * @throws IOException if the underlying stream has problems + */ + private Token readTokenImpl() + throws IOException + { + Token token = null; + + int c = in.read(); + switch(c) + { + case -1: + token = new Token(Token.EOF); + break; + + case '{': + token = new Token(Token.LCURLY); + break; + + case '}': + token = new Token(Token.RCURLY); + break; + + case '\\': + buffer.delete(0, buffer.length()); + buffer.append((char) c); + token = readControlWord(); + break; + + default: + buffer.delete(0, buffer.length()); + buffer.append((char) c); + token = readText(); + break; + } + + return token; + } + + Token peekToken() + throws IOException + { + lastToken = readTokenImpl(); + return lastToken; + } + + Token readToken() + throws IOException + { + Token token; + if (lastToken != null) + { + token = lastToken; + lastToken = null; + } + else + token = readTokenImpl(); + return token; + } + + /** + * Reads in a control word and optional parameter. + * + * @return the read in control word as {@link ControlWordToken} + * + * @throws IOException if the underlying stream has problems + */ + private Token readControlWord() + throws IOException + { + // this flag indicates if we are still reading the name or are already + // in the parameter + boolean readingName = true; + String name = null; + String param = null; + + while (true) + { + in.mark(1); + int c = in.read(); + + // check for 'a'..'z' + if (readingName && (c >= 'a') && (c <= 'z')) + { + buffer.append((char) c); + } + else if ((c >= '0') && (c <= '9')) + { + // if the last char was in the name, then finish reading the name + if (readingName) + { + name = buffer.toString(); + buffer.delete(0, buffer.length()); + readingName = false; + } + buffer.append((char) c); + } + else + { + // if we were in the name, then finish this + if (readingName) + { + name = buffer.toString(); + } + // otherwise finish the parameter + else + { + param = buffer.toString(); + } + + // clear up + buffer.delete(0, buffer.length()); + // reset input buffer to last char + in.reset(); + // break while loop + break; + } + } + + ControlWordToken token = null; + + if (param == null) + token = new ControlWordToken(name); + else + token =new ControlWordToken(name, Integer.parseInt(param)); + + return token; + + } + + /** + * Reads in a block of text. + * + * @return the token for the text + */ + private Token readText() + throws IOException + { + + boolean readingText = true; + while (readingText) + { + in.mark(1); + int c = in.read(); + switch(c) + { + case '\\': + case '{': + case '}': + case -1: + readingText = false; + in.reset(); + break; + + default: + buffer.append((char) c); + break; + } + + } + + String text = buffer.toString(); + Token token = new TextToken(text); + + buffer.delete(0, buffer.length()); + + return token; + + } +} diff --git a/libjava/classpath/javax/swing/text/rtf/TextToken.java b/libjava/classpath/javax/swing/text/rtf/TextToken.java new file mode 100644 index 000000000..2d6d527d1 --- /dev/null +++ b/libjava/classpath/javax/swing/text/rtf/TextToken.java @@ -0,0 +1,65 @@ +/* TextToken.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * A special {@link Token} that represents a piece of text in RTF. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class TextToken extends Token +{ + + /** + * The text. + */ + public String text; + + /** + * Constructs a new TextToken with the specified textual data. + * + * @param text the text for this token + */ + public TextToken(String text) + { + super(Token.TEXT); + this.text = text; + } + +} diff --git a/libjava/classpath/javax/swing/text/rtf/Token.java b/libjava/classpath/javax/swing/text/rtf/Token.java new file mode 100644 index 000000000..7d5adaaf0 --- /dev/null +++ b/libjava/classpath/javax/swing/text/rtf/Token.java @@ -0,0 +1,91 @@ +/* Token.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * Represents a simple token that the RTFScanner can read. A simple + * only has a type (like LCURLY or RCURLY). More complex tokens may + * attach data to the token. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class Token +{ + + /** + * This special type inidicates the end of the input stream. + */ + public static final int EOF = -1; + + /** + * A left curly brace '{'. + */ + public static final int LCURLY = 1; + + /** + * A right curly brace '}'. + */ + public static final int RCURLY = 2; + + /** + * A control word like '\rtf1'. Tokens with this type are represented + * through the subclass {@link ControlWordToken}. + */ + public static final int CONTROL_WORD = 3; + + /** + * A token that contains text. This is represented through the subclass + * {@link TextToken}. + */ + public static final int TEXT = 4; + + + /** The token type. */ + public int type; + + /** + * Constructs a new Token with the specified type. + * + * @param type the Token type + */ + public Token(int type) + { + this.type = type; + } +} diff --git a/libjava/classpath/javax/swing/text/rtf/package.html b/libjava/classpath/javax/swing/text/rtf/package.html new file mode 100644 index 000000000..c695aef6c --- /dev/null +++ b/libjava/classpath/javax/swing/text/rtf/package.html @@ -0,0 +1,48 @@ + + + + +GNU Classpath - javax.swing.text.rtf + + +

Provides support for Rich Text Format (RTF) data to be used with the +{@link JEditorPane} component. +

+ + + -- cgit v1.2.3