From dc677a43384e834aaa701b2fbab019af4fff89a8 Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Wed, 4 Dec 2002 01:45:52 +0000 Subject: [PATCH] Jitterbug 2103: API docs, @stable, @draft, etc. added. X-SVN-Rev: 10471 --- icu4j/src/com/ibm/icu/text/BreakIterator.java | 44 +++++++++++++-- .../text/DictionaryBasedBreakIterator.java | 28 +++++++--- .../ibm/icu/text/RuleBasedBreakIterator.java | 55 +++++++++++++++++-- 3 files changed, 109 insertions(+), 18 deletions(-) diff --git a/icu4j/src/com/ibm/icu/text/BreakIterator.java b/icu4j/src/com/ibm/icu/text/BreakIterator.java index 147562572d1..c2f065e6229 100755 --- a/icu4j/src/com/ibm/icu/text/BreakIterator.java +++ b/icu4j/src/com/ibm/icu/text/BreakIterator.java @@ -4,9 +4,9 @@ * others. All Rights Reserved. * ******************************************************************************* * - * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/BreakIterator.java,v $ - * $Date: 2002/11/15 23:44:10 $ - * $Revision: 1.11 $ + * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/BreakIterator.java,v $ + * $Date: 2002/12/04 01:45:52 $ + * $Revision: 1.12 $ * ***************************************************************************************** */ @@ -211,6 +211,7 @@ import java.util.Vector; * * * @see CharacterIterator + * @stable * */ @@ -219,6 +220,7 @@ public abstract class BreakIterator implements Cloneable /** * Default constructor. There is no state that is carried by this abstract * base class. + * @stable */ protected BreakIterator() { @@ -228,6 +230,7 @@ public abstract class BreakIterator implements Cloneable * Clone method. Creates another BreakIterator with the same behavior and * current state as this one. * @return The clone. + * @stable */ public Object clone() { @@ -242,6 +245,7 @@ public abstract class BreakIterator implements Cloneable /** * DONE is returned by previous() and next() after all valid * boundaries have been returned. + * @stable */ public static final int DONE = -1; @@ -253,6 +257,7 @@ public abstract class BreakIterator implements Cloneable * to point to the beginning of the text. * @return The character offset of the beginning of the stretch of text * being broken. + * @stable */ public abstract int first(); @@ -264,6 +269,7 @@ public abstract class BreakIterator implements Cloneable * iteration position to point to the end of the text. * @return The character offset of the end of the stretch of text * being broken. + * @stable */ public abstract int last(); @@ -279,6 +285,7 @@ public abstract class BreakIterator implements Cloneable * @return The position of the boundary n boundaries from the current * iteration position, or DONE if moving n boundaries causes the iterator * to advance off either end of the text. + * @stable */ public abstract int next(int n); @@ -291,6 +298,7 @@ public abstract class BreakIterator implements Cloneable * DONE. * @return The position of the first boundary position following the * iteration position. + * @stable */ public abstract int next(); @@ -303,6 +311,7 @@ public abstract class BreakIterator implements Cloneable * DONE. * @return The position of the last boundary position preceding the * iteration position. + * @stable */ public abstract int previous(); @@ -317,6 +326,7 @@ public abstract class BreakIterator implements Cloneable * @return The position of the first boundary position following * "offset" (whether or not "offset" itself is a boundary position), * or DONE if "offset" is the past-the-end offset. + * @stable */ public abstract int following(int offset); @@ -331,6 +341,7 @@ public abstract class BreakIterator implements Cloneable * @return The position of the last boundary position preceding * "offset" (whether of not "offset" itself is a boundary position), * or DONE if "offset" is the starting offset of the iterator. + * @stable */ public int preceding(int offset) { // NOTE: This implementation is here solely because we can't add new @@ -349,6 +360,7 @@ public abstract class BreakIterator implements Cloneable * iteration position is set as though following() had been called. * @param offset the offset to check. * @return True if "offset" is a boundary position. + * @stable */ public boolean isBoundary(int offset) { // Again, this is the default implementation, which is provided solely because @@ -364,6 +376,7 @@ public abstract class BreakIterator implements Cloneable /** * Return the iterator's current position. * @return The iterator's current position. + * @stable */ public abstract int current(); @@ -376,6 +389,7 @@ public abstract class BreakIterator implements Cloneable * of this iterator when it is returned. If you need to move that * position to examine the text, clone this function's return value first. * @return A CharacterIterator over the text being analyzed. + * @stable */ public abstract CharacterIterator getText(); @@ -386,6 +400,7 @@ public abstract class BreakIterator implements Cloneable * (The old text is dropped.) * @param newText A String containing the text to analyze with * this BreakIterator. + * @stable */ public void setText(String newText) { @@ -401,13 +416,19 @@ public abstract class BreakIterator implements Cloneable * @param newText A CharacterIterator referring to the text * to analyze with this BreakIterator (the iterator's current * position is ignored, but its other state is significant). + * @stable */ public abstract void setText(CharacterIterator newText); + /** @stable */ public static final int KIND_CHARACTER = 0; + /** @stable */ public static final int KIND_WORD = 1; + /** @stable */ public static final int KIND_LINE = 2; + /** @stable */ public static final int KIND_SENTENCE = 3; + /** @stable */ public static final int KIND_TITLE = 4; /* private static final int CHARACTER_INDEX = 0; @@ -416,6 +437,7 @@ public abstract class BreakIterator implements Cloneable private static final int SENTENCE_INDEX = 3; private static final int TITLE_INDEX = 4; */ + /** @internal */ private static final SoftReference[] iterCache = new SoftReference[5]; /** @@ -423,6 +445,7 @@ public abstract class BreakIterator implements Cloneable * This function assumes that the text being analyzed is in the default * locale's language. * @return An instance of BreakIterator that locates word boundaries. + * @stable */ public static BreakIterator getWordInstance() { @@ -434,6 +457,7 @@ public abstract class BreakIterator implements Cloneable * @param where A locale specifying the language of the text to be * analyzed. * @return An instance of BreakIterator that locates word boundaries. + * @stable */ public static BreakIterator getWordInstance(Locale where) { @@ -446,6 +470,7 @@ public abstract class BreakIterator implements Cloneable * is in the default locale's language. * @return A new instance of BreakIterator that locates legal * line-wrapping positions. + * @stable */ public static BreakIterator getLineInstance() { @@ -458,6 +483,7 @@ public abstract class BreakIterator implements Cloneable * @param where A Locale specifying the language of the text being broken. * @return A new instance of BreakIterator that locates legal * line-wrapping positions. + * @stable */ public static BreakIterator getLineInstance(Locale where) { @@ -470,6 +496,7 @@ public abstract class BreakIterator implements Cloneable * in the default locale's language. * @return A new instance of BreakIterator that locates logical-character * boundaries. + * @stable */ public static BreakIterator getCharacterInstance() { @@ -482,6 +509,7 @@ public abstract class BreakIterator implements Cloneable * @param where A Locale specifying the language of the text being analyzed. * @return A new instance of BreakIterator that locates logical-character * boundaries. + * @stable */ public static BreakIterator getCharacterInstance(Locale where) { @@ -493,6 +521,7 @@ public abstract class BreakIterator implements Cloneable * This function assumes the text being analyzed is in the default locale's * language. * @return A new instance of BreakIterator that locates sentence boundaries. + * @stable */ public static BreakIterator getSentenceInstance() { @@ -503,6 +532,7 @@ public abstract class BreakIterator implements Cloneable * Returns a new instance of BreakIterator that locates sentence boundaries. * @param where A Locale specifying the language of the text being analyzed. * @return A new instance of BreakIterator that locates sentence boundaries. + * @stable */ public static BreakIterator getSentenceInstance(Locale where) { @@ -514,6 +544,7 @@ public abstract class BreakIterator implements Cloneable * This function assumes the text being analyzed is in the default locale's * language. * @return A new instance of BreakIterator that locates sentence boundaries. + * @stable */ public static BreakIterator getTitleInstance() { @@ -524,6 +555,7 @@ public abstract class BreakIterator implements Cloneable * Returns a new instance of BreakIterator that locates sentence boundaries. * @param where A Locale specifying the language of the text being analyzed. * @return A new instance of BreakIterator that locates sentence boundaries. + * @stable */ public static BreakIterator getTitleInstance(Locale where) { @@ -591,8 +623,8 @@ public abstract class BreakIterator implements Cloneable private static BreakIterator createBreakInstance(Locale locale, int kind) { String prefix = KIND_NAMES[kind]; - return createBreakInstance(locale, - kind, + return createBreakInstance(locale, + kind, prefix + "BreakRules", prefix + "BreakDictionary"); } @@ -627,7 +659,7 @@ public abstract class BreakIterator implements Cloneable String[] classNames = bundle.getStringArray("BreakIteratorClasses"); String rules = bundle.getString(rulesName); - + if (classNames[kind].equals("RuleBasedBreakIterator")) { return new RuleBasedBreakIterator(rules); } diff --git a/icu4j/src/com/ibm/icu/text/DictionaryBasedBreakIterator.java b/icu4j/src/com/ibm/icu/text/DictionaryBasedBreakIterator.java index b70335ca271..47092d5248f 100755 --- a/icu4j/src/com/ibm/icu/text/DictionaryBasedBreakIterator.java +++ b/icu4j/src/com/ibm/icu/text/DictionaryBasedBreakIterator.java @@ -4,9 +4,9 @@ * others. All Rights Reserved. * ******************************************************************************* * - * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/DictionaryBasedBreakIterator.java,v $ - * $Date: 2002/02/16 03:06:07 $ - * $Revision: 1.9 $ + * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/DictionaryBasedBreakIterator.java,v $ + * $Date: 2002/12/04 01:45:51 $ + * $Revision: 1.10 $ * ***************************************************************************************** */ @@ -44,6 +44,8 @@ import java.io.*; * dictionary file is in a serialized binary format. We have a very primitive (and * slow) BuildDictionaryFile utility for creating dictionary files, but aren't * currently making it public. Contact us for help. + * + * @stable */ public class DictionaryBasedBreakIterator extends RuleBasedBreakIterator { @@ -91,6 +93,7 @@ public class DictionaryBasedBreakIterator extends RuleBasedBreakIterator { * except for the special meaning of DICTIONARY_VAR. This parameter is just * passed through to RuleBasedBreakIterator's constructor. * @param dictionaryFilename The filename of the dictionary file to use + * @stable */ public DictionaryBasedBreakIterator(String description, InputStream dictionaryStream) throws IOException { @@ -102,11 +105,13 @@ public class DictionaryBasedBreakIterator extends RuleBasedBreakIterator { * Returns a Builder that is customized to build a DictionaryBasedBreakIterator. * This is the same as RuleBasedBreakIterator.Builder, except for the extra code * to handle the DICTIONARY_VAR tag. + * @internal */ protected RuleBasedBreakIterator.Builder makeBuilder() { return new Builder(); } +/** @internal */ public void writeTablesToFile(FileOutputStream file, boolean littleEndian) throws IOException { super.writeTablesToFile(file, littleEndian); @@ -125,7 +130,8 @@ switch (categoryFlags.length % 4) { default: break; } } - + + /** @stable */ public void setText(CharacterIterator newText) { super.setText(newText); cachedBreakPositions = null; @@ -137,6 +143,7 @@ switch (categoryFlags.length % 4) { * Sets the current iteration position to the beginning of the text. * (i.e., the CharacterIterator's starting offset). * @return The offset of the beginning of the text. + * @stable */ public int first() { cachedBreakPositions = null; @@ -149,6 +156,7 @@ switch (categoryFlags.length % 4) { * Sets the current iteration position to the end of the text. * (i.e., the CharacterIterator's ending offset). * @return The text's past-the-end offset. + * @stable */ public int last() { cachedBreakPositions = null; @@ -161,6 +169,7 @@ switch (categoryFlags.length % 4) { * Advances the iterator one step backwards. * @return The position of the last boundary position before the * current iteration position + * @stable */ public int previous() { CharacterIterator text = getText(); @@ -190,6 +199,7 @@ switch (categoryFlags.length % 4) { * before the specified position. * @param offset The position to begin searching from * @return The position of the last boundary before "offset" + * @stable */ public int preceding(int offset) { CharacterIterator text = getText(); @@ -224,6 +234,7 @@ switch (categoryFlags.length % 4) { * the specified position. * @param offset The position to begin searching forward from * @return The position of the first boundary after "offset" + * @stable */ public int following(int offset) { CharacterIterator text = getText(); @@ -254,6 +265,7 @@ switch (categoryFlags.length % 4) { /** * This is the implementation function for next(). + * @internal */ protected int handleNext() { CharacterIterator text = getText(); @@ -298,6 +310,7 @@ switch (categoryFlags.length % 4) { /** * Looks up a character category for a character. + * @internal */ protected int lookupCategory(char c) { // this override of lookupCategory() exists only to keep track of whether we've @@ -420,7 +433,7 @@ switch (categoryFlags.length % 4) { possibleBreakPositions.peek())) { possibleBreakPositions.pop(); } - + // if we've used up all possible break-position combinations, there's // an error or an unknown word in the text. In this case, we start // over, treating the farthest character we've reached as the beginning @@ -508,7 +521,8 @@ switch (categoryFlags.length % 4) { /** * The Builder class for DictionaryBasedBreakIterator inherits almost all of * its functionality from the Builder class for RuleBasedBreakIterator, but - * extends it with extra logic to handle the DICTIIONARY_VAR token + * extends it with extra logic to handle the DICTIONARY_VAR token + * @internal */ protected class Builder extends RuleBasedBreakIterator.Builder { @@ -555,7 +569,7 @@ switch (categoryFlags.length % 4) { categoryFlags = new boolean[categories.size()]; for (int i = 0; i < categories.size(); i++) { UnicodeSet cs = (UnicodeSet)categories.elementAt(i); - + cs.retainAll(dictionaryChars); if (!cs.isEmpty()) { categoryFlags[i] = true; diff --git a/icu4j/src/com/ibm/icu/text/RuleBasedBreakIterator.java b/icu4j/src/com/ibm/icu/text/RuleBasedBreakIterator.java index a4dfe8eb724..19b64dc0e47 100755 --- a/icu4j/src/com/ibm/icu/text/RuleBasedBreakIterator.java +++ b/icu4j/src/com/ibm/icu/text/RuleBasedBreakIterator.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/RuleBasedBreakIterator.java,v $ - * $Date: 2002/08/10 00:32:30 $ - * $Revision: 1.21 $ + * $Date: 2002/12/04 01:45:51 $ + * $Revision: 1.22 $ * ***************************************************************************************** */ @@ -229,17 +229,20 @@ import java.io.*; *   For examples, see the resource data (which is annotated).

* * @author Richard Gillam - * $RCSfile: RuleBasedBreakIterator.java,v $ $Revision: 1.21 $ $Date: 2002/08/10 00:32:30 $ + * @stable + * $RCSfile: RuleBasedBreakIterator.java,v $ $Revision: 1.22 $ $Date: 2002/12/04 01:45:51 $ */ public class RuleBasedBreakIterator extends BreakIterator { /** * A token used as a character-category value to identify ignore characters + * @stable */ protected static final byte IGNORE = -1; /** * Special variable used to define ignore characters + * @stable */ private static final String IGNORE_VAR = "_ignore_"; @@ -309,6 +312,7 @@ public class RuleBasedBreakIterator extends BreakIterator { * on BreakIterator to create one indirectly from a description * in the framework's resource files. You'd use this when you want * special behavior not provided by the built-in iterators. + * @stable */ public RuleBasedBreakIterator(String description) { //System.out.println(">>>RBBI constructor"); @@ -322,6 +326,7 @@ public class RuleBasedBreakIterator extends BreakIterator { /** * Creates a Builder. + * @stable */ protected Builder makeBuilder() { return new Builder(); @@ -334,6 +339,7 @@ public class RuleBasedBreakIterator extends BreakIterator { * Clones this iterator. * @return A newly-constructed RuleBasedBreakIterator with the same * behavior as this one. + * @stable */ public Object clone() { @@ -347,6 +353,7 @@ public class RuleBasedBreakIterator extends BreakIterator { /** * Returns true if both BreakIterators are of the same class, have the same * rules, and iterate over the same text. + * @stable */ public boolean equals(Object that) { try { @@ -368,6 +375,7 @@ public class RuleBasedBreakIterator extends BreakIterator { /** * Returns the description used to create this iterator + * @stable */ public String toString() { return description; @@ -376,6 +384,7 @@ public class RuleBasedBreakIterator extends BreakIterator { /** * Compute a hashcode for this BreakIterator * @return A hash code + * @stable */ public int hashCode() { @@ -625,6 +634,7 @@ throws IOException { * Sets the current iteration position to the beginning of the text. * (i.e., the CharacterIterator's starting offset). * @return The offset of the beginning of the text. + * @stable */ public int first() { CharacterIterator t = getText(); @@ -637,6 +647,7 @@ throws IOException { * Sets the current iteration position to the end of the text. * (i.e., the CharacterIterator's ending offset). * @return The text's past-the-end offset. + * @stable */ public int last() { CharacterIterator t = getText(); @@ -655,6 +666,7 @@ throws IOException { * (negative is backwards, and positive is forwards). * @return The character offset of the boundary position n boundaries away from * the current one. + * @stable */ public int next(int n) { int result = current(); @@ -672,6 +684,7 @@ throws IOException { /** * Advances the iterator to the next boundary position. * @return The position of the first boundary after this one. + * @stable */ public int next() { return handleNext(); @@ -680,6 +693,7 @@ throws IOException { /** * Advances the iterator backwards, to the last boundary preceding this one. * @return The position of the last boundary position preceding this one. + * @stable */ public int previous() { // if we're already sitting at the beginning of the text, return DONE @@ -714,6 +728,7 @@ throws IOException { /** * Throw IllegalArgumentException unless begin <= offset < end. + * @stable */ protected static final void checkOffset(int offset, CharacterIterator text) { if (offset < text.getBeginIndex() || offset > text.getEndIndex()) { @@ -726,6 +741,7 @@ throws IOException { * the specified position. * @param offset The position from which to begin searching for a break position. * @return The position of the first break after the current position. + * @stable */ public int following(int offset) { // if the offset passed in is already past the end of the text, @@ -763,6 +779,7 @@ throws IOException { * specified position. * @param offset The position to begin searching for a break from. * @return The position of the last boundary before the starting position. + * @stable */ public int preceding(int offset) { // if we start by updating the current iteration position to the @@ -780,6 +797,7 @@ throws IOException { * or after "offset". * @param offset the offset to check. * @return True if "offset" is a boundary position. + * @stable */ public boolean isBoundary(int offset) { CharacterIterator text = getText(); @@ -799,6 +817,7 @@ throws IOException { /** * Returns the current iteration position. * @return The current iteration position. + * @stable */ public int current() { return getText().getIndex(); @@ -810,6 +829,7 @@ throws IOException { * Changing the state of this iterator can have undefined consequences. If * you need to change it, clone it first. * @return An iterator over the text being analyzed. + * @stable */ public CharacterIterator getText() { // The iterator is initialized pointing to no text at all, so if this @@ -825,6 +845,7 @@ throws IOException { * Set the iterator to analyze a new piece of text. This function resets * the current iteration position to the beginning of the text. * @param newText An iterator over the text to analyze. + * @stable */ public void setText(CharacterIterator newText) { // Test text to see if we need to wrap it in a SafeCharIterator: @@ -851,6 +872,7 @@ throws IOException { * and advances through the text character by character until we reach the end * of the text or the state machine transitions to state 0. We update our return * value every time the state machine passes through a possible end state. + * @stable */ protected int handleNext() { // if we're already at the end of the text, return DONE. @@ -958,6 +980,7 @@ throws IOException { * The various calling methods then iterate forward from this safe position to * the appropriate position to return. (For more information, see the description * of buildBackwardsStateTable() in RuleBasedBreakIterator.Builder.) + * @stable */ protected int handlePrevious() { CharacterIterator text = getText(); @@ -1074,27 +1097,32 @@ visitedChars = 0; * to RuleBasedBreakIterator's private members, which saves us from having to * provide some kind of "back door" to the Builder class that could then also be * used by other classes. + * @internal */ protected class Builder { /** * A temporary holding place used for calculating the character categories. * This object contains UnicodeSet objects. + * @internal */ protected Vector categories = null; /** * A table used to map parts of regexp text to lists of character categories, * rather than having to figure them out from scratch each time + * @internal */ protected Hashtable expressions = null; /** * A temporary holding place for the list of ignore characters + * @internal */ protected UnicodeSet ignoreChars = null; /** * A temporary holding place where the forward state table is built + * @internal */ protected Vector tempStateTable = null; @@ -1102,17 +1130,20 @@ visitedChars = 0; * A list of all the states that have to be filled in with transitions to the * next state that is created. Used when building the state table from the * regular expressions. + * @internal */ protected Vector decisionPointList = null; /** * A stack for holding decision point lists. This is used to handle nested * parentheses and braces in regexps. + * @internal */ protected Stack decisionPointStack = null; /** * A list of states that loop back on themselves. Used to handle .*? + * @internal */ protected Vector loopingStates = null; @@ -1120,6 +1151,7 @@ visitedChars = 0; * Looping states actually have to be backfilled later in the process * than everything else. This is where a the list of states to backfill * is accumulated. This is also used to handle .*? + * @internal */ protected Vector statesToBackfill = null; @@ -1128,42 +1160,49 @@ visitedChars = 0; * to the state number of the state representing their combination. Used * in the process of making the state table deterministic to prevent * infinite recursion. + * @internal */ protected Vector mergeList = null; /** * A flag that is used to indicate when the list of looping states can * be reset. + * @internal */ protected boolean clearLoopingStates = false; /** * A bit mask used to indicate a bit in the table's flags column that marks a * state as an accepting state. + * @internal */ protected static final int END_STATE_FLAG = 0x8000; /** * A bit mask used to indicate a bit in the table's flags column that marks a * state as one the builder shouldn't loop to any looping states + * @internal */ protected static final int DONT_LOOP_FLAG = 0x4000; /** * A bit mask used to indicate a bit in the table's flags column that marks a * state as a lookahead state. + * @internal */ protected static final int LOOKAHEAD_STATE_FLAG = 0x2000; /** * A bit mask representing the union of the mask values listed above. * Used for clearing or masking off the flag bits. + * @internal */ protected static final int ALL_FLAGS = END_STATE_FLAG | LOOKAHEAD_STATE_FLAG | DONT_LOOP_FLAG; /** * No special construction is required for the Builder. + * @internal */ public Builder() { } @@ -1171,6 +1210,7 @@ visitedChars = 0; /** * This is the main function for setting up the BreakIterator's tables. It * just vectors different parts of the job off to other functions. + * @internal */ public void buildBreakIterator() { Vector tempRuleList = buildRuleList(description); @@ -1434,6 +1474,7 @@ visitedChars = 0; * then goes through the remainder of the description and does a simple * find-and-replace of the variable name with its text. (The variable text * must be enclosed in either [] or () for this to work.) + * @internal */ protected String processSubstitution(String substitutionRule, String description, int startPos) { @@ -1498,6 +1539,7 @@ visitedChars = 0; * function to add more. Any special processing that has to go on beyond * that which is done by the normal substitution-processing code is done * here. + * @internal */ protected void handleSpecialSubstitution(String replace, String replaceWith, int startPos, String description) { @@ -1520,6 +1562,7 @@ visitedChars = 0; * character category table, and tempRuleList's rules have been munged to contain * character category numbers everywhere a literal character or a [] expression * originally occurred. + * @internal */ protected void buildCharCategories(Vector tempRuleList) { int bracketLevel = 0; @@ -1699,12 +1742,12 @@ visitedChars = 0; // go through the character ranges in the category one by one... for (int j = 0; j < n; ++j) { int rangeStart = chars.getRangeStart(j); - + // (ignore anything above the BMP for now...) if (rangeStart >= 0x10000) { break; } - + // and set the corresponding elements in the CompactArray accordingly if (i != 0) { charCategoryTable.setElementAt((char)rangeStart, @@ -1729,6 +1772,7 @@ visitedChars = 0; numCategories = categories.size(); } + /** @internal */ protected void mungeExpressionList(Hashtable expressions) { // empty in the parent class. This function provides a hook for subclasses // to mess with the character category table. @@ -2973,6 +3017,7 @@ System.out.println(); * @param position The position in the description where the problem was * discovered * @param context The string containing the error + * @internal */ protected void error(String message, int position, String context) { throw new IllegalArgumentException("Parse error: " + message + "\n" +