View | Details | Raw Unified | Return to bug 183164 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/bidi/advanced/ISTextExpert.java (-2 / +1 lines)
Lines 61-68 Link Here
61
 * code in order to obtain the <i>full</i>
61
 * code in order to obtain the <i>full</i>
62
 * text corresponding to the <i>lean</i> text of each line.
62
 * text corresponding to the <i>lean</i> text of each line.
63
 * <pre>
63
 * <pre>
64
 *   int[] state = new int[1];
64
 *   Object state = STextState.createState();
65
 *   state[0] = STextEngine.STATE_INITIAL;
66
 *   String leanText = "int i = 3; // first Java statement";
65
 *   String leanText = "int i = 3; // first Java statement";
67
 *   String fullText = STextEngine.leanToFullText(STextEngine.PROC_JAVA, null, leanText, state);
66
 *   String fullText = STextEngine.leanToFullText(STextEngine.PROC_JAVA, null, leanText, state);
68
 *   System.out.println("full text = " + fullText);
67
 *   System.out.println("full text = " + fullText);
(-)src/org/eclipse/equinox/bidi/advanced/ISTextExpertStateful.java (-2 / +2 lines)
Lines 12-20 Link Here
12
12
13
public interface ISTextExpertStateful extends ISTextExpert {
13
public interface ISTextExpertStateful extends ISTextExpert {
14
14
15
	public void setState(int state);
15
	public void setState(Object state);
16
16
17
	public int getState();
17
	public Object getState();
18
18
19
	/**
19
	/**
20
	 * Resets non-shared expert state to initial.
20
	 * Resets non-shared expert state to initial.
(-)src/org/eclipse/equinox/bidi/advanced/STextExpertFactory.java (-2 / +2 lines)
Lines 77-83 Link Here
77
	}
77
	}
78
78
79
	static public ISTextExpert getExpert(STextTypeHandler handler, STextEnvironment environment) {
79
	static public ISTextExpert getExpert(STextTypeHandler handler, STextEnvironment environment) {
80
		return new STextImpl(handler, environment, new int[1]);
80
		return new STextImpl(handler, environment, STextState.createState());
81
	}
81
	}
82
82
83
	static public ISTextExpertStateful getPrivateExpert(String type) {
83
	static public ISTextExpertStateful getPrivateExpert(String type) {
Lines 88-94 Link Here
88
		STextTypeHandler handler = STextTypeHandlerFactory.getHandler(type);
88
		STextTypeHandler handler = STextTypeHandlerFactory.getHandler(type);
89
		if (handler == null)
89
		if (handler == null)
90
			return null;
90
			return null;
91
		return new STextImpl(handler, environment, new int[1]);
91
		return new STextImpl(handler, environment, STextState.createState());
92
	}
92
	}
93
93
94
}
94
}
(-)src/org/eclipse/equinox/bidi/advanced/STextState.java (+37 lines)
Added Link Here
1
package org.eclipse.equinox.bidi.advanced;
2
3
public class STextState {
4
5
	private STextState() {
6
		// prevent instantiation
7
	}
8
9
	public static Object createState() {
10
		return new Object[1];
11
	}
12
13
	public static Object getValueAndReset(Object state) {
14
		if (state instanceof Object[]) {
15
			Object[] values = (Object[]) state;
16
			if (values.length > 0) {
17
				Object value = values[0];
18
				values[0] = null;
19
				return value;
20
			}
21
		}
22
		throw new IllegalArgumentException("Invalid state argument"); //$NON-NLS-1$
23
	}
24
25
	public static void setValue(Object state, Object value) {
26
		if (state == null)
27
			return;
28
		if (state instanceof Object[]) {
29
			Object[] values = (Object[]) state;
30
			if (values.length > 0)
31
				values[0] = value;
32
			return;
33
		}
34
		throw new IllegalArgumentException("Invalid state argument"); //$NON-NLS-1$
35
	}
36
37
}
(-)src/org/eclipse/equinox/bidi/custom/STextTypeHandler.java (-1 / +1 lines)
Lines 210-216 Link Here
210
	 * number of special cases is zero, which means that
210
	 * number of special cases is zero, which means that
211
	 * <code>processSpecial</code> should never be called for them.
211
	 * <code>processSpecial</code> should never be called for them.
212
	 */
212
	 */
213
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, int[] state, int caseNumber, int separLocation) {
213
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, Object state, int caseNumber, int separLocation) {
214
		// This method must be overridden by all subclasses with any special case.
214
		// This method must be overridden by all subclasses with any special case.
215
		throw new IllegalStateException("A handler with specialsCount > 0 must have a processSpecial() method."); //$NON-NLS-1$
215
		throw new IllegalStateException("A handler with specialsCount > 0 must have a processSpecial() method."); //$NON-NLS-1$
216
	}
216
	}
(-)src/org/eclipse/equinox/bidi/internal/STextDelims.java (-1 / +1 lines)
Lines 58-64 Link Here
58
	 *  @return the position after the matching end delimiter, or the length
58
	 *  @return the position after the matching end delimiter, or the length
59
	 *          of <code>text</code> if no end delimiter is found.
59
	 *          of <code>text</code> if no end delimiter is found.
60
	 */
60
	 */
61
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, int[] state, int caseNumber, int separLocation) {
61
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, Object state, int caseNumber, int separLocation) {
62
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
62
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
63
		int loc = separLocation + 1;
63
		int loc = separLocation + 1;
64
		char delim = getDelimiters().charAt((caseNumber * 2) - 1);
64
		char delim = getDelimiters().charAt((caseNumber * 2) - 1);
(-)src/org/eclipse/equinox/bidi/internal/STextDelimsEsc.java (-1 / +1 lines)
Lines 49-55 Link Here
49
	 *  and skips until after the matching end delimiter,
49
	 *  and skips until after the matching end delimiter,
50
	 *  ignoring possibly escaped end delimiters.
50
	 *  ignoring possibly escaped end delimiters.
51
	 */
51
	 */
52
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, int[] state, int caseNumber, int separLocation) {
52
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, Object state, int caseNumber, int separLocation) {
53
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
53
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
54
		int location = separLocation + 1;
54
		int location = separLocation + 1;
55
		char delim = getDelimiters().charAt((caseNumber * 2) - 1);
55
		char delim = getDelimiters().charAt((caseNumber * 2) - 1);
(-)src/org/eclipse/equinox/bidi/internal/STextImpl.java (-22 / +22 lines)
Lines 46-58 Link Here
46
	static final int FIXES_LENGTH = PREFIX_LENGTH + SUFFIX_LENGTH;
46
	static final int FIXES_LENGTH = PREFIX_LENGTH + SUFFIX_LENGTH;
47
	static final int[] EMPTY_INT_ARRAY = new int[0];
47
	static final int[] EMPTY_INT_ARRAY = new int[0];
48
	static final STextEnvironment IGNORE_ENVIRONMENT = new STextEnvironment(null, false, STextEnvironment.ORIENT_IGNORE);
48
	static final STextEnvironment IGNORE_ENVIRONMENT = new STextEnvironment(null, false, STextEnvironment.ORIENT_IGNORE);
49
	static final int STATE_INITIAL = 0;
50
49
51
	protected STextTypeHandler structuredTextHandler;
50
	protected STextTypeHandler structuredTextHandler;
52
	protected STextEnvironment environment;
51
	protected STextEnvironment environment;
53
	protected int[] state;
52
	protected Object state;
54
53
55
	public STextImpl(STextTypeHandler structuredTextHandler, STextEnvironment environment, int[] state) {
54
	public STextImpl(STextTypeHandler structuredTextHandler, STextEnvironment environment, Object state) {
56
		this.structuredTextHandler = structuredTextHandler;
55
		this.structuredTextHandler = structuredTextHandler;
57
		this.environment = environment;
56
		this.environment = environment;
58
		this.state = state;
57
		this.state = state;
Lines 87-106 Link Here
87
	}
86
	}
88
87
89
	public void resetState() {
88
	public void resetState() {
90
		state[0] = STATE_INITIAL;
89
		STextState.setValue(state, null);
91
	}
90
	}
92
91
93
	public void setState(int newState) {
92
	public void setState(Object newState) {
94
		state[0] = newState;
93
		STextState.setValue(state, newState);
95
	}
94
	}
96
95
97
	public static void setState(int[] state, int newState) {
96
	public static void setState(Object state, Object newState) {
98
		if (state != null)
97
		STextState.setValue(state, newState);
99
			state[0] = newState;
100
	}
98
	}
101
99
102
	public int getState() {
100
	public Object getState() {
103
		return state[0];
101
		Object value = STextState.getValueAndReset(state);
102
		STextState.setValue(state, value);
103
		return value;
104
	}
104
	}
105
105
106
	static long computeNextLocation(STextTypeHandler handler, STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, int[] locations, int curPos) {
106
	static long computeNextLocation(STextTypeHandler handler, STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, int[] locations, int curPos) {
Lines 243-249 Link Here
243
	 *  <p>
243
	 *  <p>
244
	 *  @see ISTextExpert#leanToFullText STextEngine.leanToFullText
244
	 *  @see ISTextExpert#leanToFullText STextEngine.leanToFullText
245
	 */
245
	 */
246
	public static String leanToFullText(STextTypeHandler handler, STextEnvironment environment, String text, int[] state) {
246
	public static String leanToFullText(STextTypeHandler handler, STextEnvironment environment, String text, Object state) {
247
		int len = text.length();
247
		int len = text.length();
248
		if (len == 0)
248
		if (len == 0)
249
			return text;
249
			return text;
Lines 290-296 Link Here
290
		return new String(fullChars);
290
		return new String(fullChars);
291
	}
291
	}
292
292
293
	public static int[] leanToFullMap(STextTypeHandler handler, STextEnvironment environment, String text, int[] state) {
293
	public static int[] leanToFullMap(STextTypeHandler handler, STextEnvironment environment, String text, Object state) {
294
		int len = text.length();
294
		int len = text.length();
295
		if (len == 0)
295
		if (len == 0)
296
			return EMPTY_INT_ARRAY;
296
			return EMPTY_INT_ARRAY;
Lines 310-316 Link Here
310
		return map;
310
		return map;
311
	}
311
	}
312
312
313
	public static int[] leanBidiCharOffsets(STextTypeHandler handler, STextEnvironment environment, String text, int[] state) {
313
	public static int[] leanBidiCharOffsets(STextTypeHandler handler, STextEnvironment environment, String text, Object state) {
314
		int len = text.length();
314
		int len = text.length();
315
		if (len == 0)
315
		if (len == 0)
316
			return EMPTY_INT_ARRAY;
316
			return EMPTY_INT_ARRAY;
Lines 319-325 Link Here
319
		return offsets.getArray();
319
		return offsets.getArray();
320
	}
320
	}
321
321
322
	static STextOffsets leanToFullCommon(STextTypeHandler handler, STextEnvironment environment, String text, int[] state, STextCharTypes charTypes) {
322
	static STextOffsets leanToFullCommon(STextTypeHandler handler, STextEnvironment environment, String text, Object state, STextCharTypes charTypes) {
323
		if (environment == null)
323
		if (environment == null)
324
			environment = STextEnvironment.DEFAULT;
324
			environment = STextEnvironment.DEFAULT;
325
		int len = text.length();
325
		int len = text.length();
Lines 334-344 Link Here
334
			}
334
			}
335
			// current position
335
			// current position
336
			int curPos = 0;
336
			int curPos = 0;
337
			if (state != null && state[0] > STATE_INITIAL) {
337
			Object value;
338
			if (state != null && (value = STextState.getValueAndReset(state)) != null) {
339
				STextState.setValue(state, value); // restore the value
338
				offsets.ensureRoom();
340
				offsets.ensureRoom();
339
				int initState = state[0];
341
				curPos = handler.processSpecial(environment, text, charTypes, offsets, state, 0, -1);
340
				state[0] = STATE_INITIAL;
341
				curPos = handler.processSpecial(environment, text, charTypes, offsets, state, initState, -1);
342
			}
342
			}
343
			while (true) {
343
			while (true) {
344
				// location of next token to handle
344
				// location of next token to handle
Lines 379-385 Link Here
379
		return offsets;
379
		return offsets;
380
	}
380
	}
381
381
382
	public static String fullToLeanText(STextTypeHandler handler, STextEnvironment environment, String text, int[] state) {
382
	public static String fullToLeanText(STextTypeHandler handler, STextEnvironment environment, String text, Object state) {
383
		if (text.length() == 0)
383
		if (text.length() == 0)
384
			return text;
384
			return text;
385
		if (environment == null)
385
		if (environment == null)
Lines 467-473 Link Here
467
		return lean;
467
		return lean;
468
	}
468
	}
469
469
470
	public static int[] fullToLeanMap(STextTypeHandler handler, STextEnvironment environment, String full, int[] state) {
470
	public static int[] fullToLeanMap(STextTypeHandler handler, STextEnvironment environment, String full, Object state) {
471
		int lenFull = full.length();
471
		int lenFull = full.length();
472
		if (lenFull == 0)
472
		if (lenFull == 0)
473
			return EMPTY_INT_ARRAY;
473
			return EMPTY_INT_ARRAY;
Lines 498-504 Link Here
498
		return map;
498
		return map;
499
	}
499
	}
500
500
501
	public static int[] fullBidiCharOffsets(STextTypeHandler handler, STextEnvironment environment, String full, int[] state) {
501
	public static int[] fullBidiCharOffsets(STextTypeHandler handler, STextEnvironment environment, String full, Object state) {
502
		int lenFull = full.length();
502
		int lenFull = full.length();
503
		if (lenFull == 0)
503
		if (lenFull == 0)
504
			return EMPTY_INT_ARRAY;
504
			return EMPTY_INT_ARRAY;
(-)src/org/eclipse/equinox/bidi/internal/STextSingle.java (-1 / +1 lines)
Lines 50-56 Link Here
50
	 *
50
	 *
51
	 *  @return the length of <code>text</code>.
51
	 *  @return the length of <code>text</code>.
52
	 */
52
	 */
53
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, int[] state, int caseNumber, int separLocation) {
53
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, Object state, int caseNumber, int separLocation) {
54
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
54
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
55
		return text.length();
55
		return text.length();
56
	}
56
	}
(-)src/org/eclipse/equinox/bidi/internal/consumable/STextJava.java (-5 / +6 lines)
Lines 10-20 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.equinox.bidi.internal.consumable;
11
package org.eclipse.equinox.bidi.internal.consumable;
12
12
13
import org.eclipse.equinox.bidi.advanced.ISTextExpert;
13
import org.eclipse.equinox.bidi.advanced.*;
14
import org.eclipse.equinox.bidi.advanced.STextEnvironment;
15
import org.eclipse.equinox.bidi.custom.*;
14
import org.eclipse.equinox.bidi.custom.*;
16
import org.eclipse.equinox.bidi.internal.STextActivator;
15
import org.eclipse.equinox.bidi.internal.STextActivator;
17
import org.eclipse.equinox.bidi.internal.STextImpl;
18
16
19
/**
17
/**
20
 *  <code>STextJava</code> is a handler for structured text
18
 *  <code>STextJava</code> is a handler for structured text
Lines 38-43 Link Here
38
public class STextJava extends STextTypeHandler {
36
public class STextJava extends STextTypeHandler {
39
	private static final byte WS = Character.DIRECTIONALITY_WHITESPACE;
37
	private static final byte WS = Character.DIRECTIONALITY_WHITESPACE;
40
	static final String lineSep = STextActivator.getInstance().getProperty("line.separator"); //$NON-NLS-1$
38
	static final String lineSep = STextActivator.getInstance().getProperty("line.separator"); //$NON-NLS-1$
39
	private static final Integer INTEGER_3 = new Integer(3);
41
40
42
	public STextJava() {
41
	public STextJava() {
43
		super("[](){}.+-<>=~!&*/%^|?:,;\t"); //$NON-NLS-1$
42
		super("[](){}.+-<>=~!&*/%^|?:,;\t"); //$NON-NLS-1$
Lines 83-92 Link Here
83
	     *    <li>skip until after a line separator</li>
82
	     *    <li>skip until after a line separator</li>
84
	     *  </ol>
83
	     *  </ol>
85
	 */
84
	 */
86
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, int[] state, int caseNumber, int separLocation) {
85
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, Object state, int caseNumber, int separLocation) {
87
		int location, counter, i;
86
		int location, counter, i;
88
87
89
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
88
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
89
		if (separLocation < 0)
90
			caseNumber = ((Integer) STextState.getValueAndReset(state)).intValue();
90
		switch (caseNumber) {
91
		switch (caseNumber) {
91
			case 1 : /* space */
92
			case 1 : /* space */
92
				separLocation++;
93
				separLocation++;
Lines 115-121 Link Here
115
					location = separLocation + 2; // skip the opening slash-aster
116
					location = separLocation + 2; // skip the opening slash-aster
116
				location = text.indexOf("*/", location); //$NON-NLS-1$
117
				location = text.indexOf("*/", location); //$NON-NLS-1$
117
				if (location < 0) {
118
				if (location < 0) {
118
					STextImpl.setState(state, caseNumber);
119
					STextState.setValue(state, INTEGER_3);
119
					return text.length();
120
					return text.length();
120
				}
121
				}
121
				// we need to call processSeparator since text may follow the
122
				// we need to call processSeparator since text may follow the
(-)src/org/eclipse/equinox/bidi/internal/consumable/STextRegex.java (-6 / +8 lines)
Lines 11-20 Link Here
11
package org.eclipse.equinox.bidi.internal.consumable;
11
package org.eclipse.equinox.bidi.internal.consumable;
12
12
13
import org.eclipse.equinox.bidi.STextDirection;
13
import org.eclipse.equinox.bidi.STextDirection;
14
import org.eclipse.equinox.bidi.advanced.ISTextExpert;
14
import org.eclipse.equinox.bidi.advanced.*;
15
import org.eclipse.equinox.bidi.advanced.STextEnvironment;
16
import org.eclipse.equinox.bidi.custom.*;
15
import org.eclipse.equinox.bidi.custom.*;
17
import org.eclipse.equinox.bidi.internal.STextImpl;
18
16
19
/**
17
/**
20
 *  <code>STextRegex</code> is a handler for regular expressions.
18
 *  <code>STextRegex</code> is a handler for regular expressions.
Lines 64-69 Link Here
64
	static final byte AL = Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
62
	static final byte AL = Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
65
	static final byte AN = Character.DIRECTIONALITY_ARABIC_NUMBER;
63
	static final byte AN = Character.DIRECTIONALITY_ARABIC_NUMBER;
66
	static final byte EN = Character.DIRECTIONALITY_EUROPEAN_NUMBER;
64
	static final byte EN = Character.DIRECTIONALITY_EUROPEAN_NUMBER;
65
	private static final Integer INTEGER_1 = new Integer(1);
66
	private static final Integer INTEGER_17 = new Integer(17);
67
67
68
	/**
68
	/**
69
	 *  This method retrieves the number of special cases handled by this handler.
69
	 *  This method retrieves the number of special cases handled by this handler.
Lines 146-154 Link Here
146
	/**
146
	/**
147
	 *  This method process the special cases.
147
	 *  This method process the special cases.
148
	 */
148
	 */
149
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, int[] state, int caseNumber, int separLocation) {
149
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, Object state, int caseNumber, int separLocation) {
150
		int location;
150
		int location;
151
151
152
		if (separLocation < 0)
153
			caseNumber = ((Integer) STextState.getValueAndReset(state)).intValue();
152
		switch (caseNumber) {
154
		switch (caseNumber) {
153
			case 1 : /* comment (?#...) */
155
			case 1 : /* comment (?#...) */
154
				if (separLocation < 0) {
156
				if (separLocation < 0) {
Lines 161-167 Link Here
161
				}
163
				}
162
				location = text.indexOf(')', location);
164
				location = text.indexOf(')', location);
163
				if (location < 0) {
165
				if (location < 0) {
164
					STextImpl.setState(state, caseNumber);
166
					STextState.setValue(state, INTEGER_1);
165
					return text.length();
167
					return text.length();
166
				}
168
				}
167
				return location + 1;
169
				return location + 1;
Lines 201-207 Link Here
201
				}
203
				}
202
				location = text.indexOf("\\E", location); //$NON-NLS-1$
204
				location = text.indexOf("\\E", location); //$NON-NLS-1$
203
				if (location < 0) {
205
				if (location < 0) {
204
					STextImpl.setState(state, caseNumber);
206
					STextState.setValue(state, INTEGER_17);
205
					return text.length();
207
					return text.length();
206
				}
208
				}
207
				// set the charType for the "E" to L (Left to Right character)
209
				// set the charType for the "E" to L (Left to Right character)
(-)src/org/eclipse/equinox/bidi/internal/consumable/STextSql.java (-6 / +8 lines)
Lines 10-20 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.equinox.bidi.internal.consumable;
11
package org.eclipse.equinox.bidi.internal.consumable;
12
12
13
import org.eclipse.equinox.bidi.advanced.ISTextExpert;
13
import org.eclipse.equinox.bidi.advanced.*;
14
import org.eclipse.equinox.bidi.advanced.STextEnvironment;
15
import org.eclipse.equinox.bidi.custom.*;
14
import org.eclipse.equinox.bidi.custom.*;
16
import org.eclipse.equinox.bidi.internal.STextActivator;
15
import org.eclipse.equinox.bidi.internal.STextActivator;
17
import org.eclipse.equinox.bidi.internal.STextImpl;
18
16
19
/**
17
/**
20
 *  <code>STextSql</code> is a handler for structured text
18
 *  <code>STextSql</code> is a handler for structured text
Lines 38-43 Link Here
38
public class STextSql extends STextTypeHandler {
36
public class STextSql extends STextTypeHandler {
39
	private static final byte WS = Character.DIRECTIONALITY_WHITESPACE;
37
	private static final byte WS = Character.DIRECTIONALITY_WHITESPACE;
40
	static final String lineSep = STextActivator.getInstance().getProperty("line.separator"); //$NON-NLS-1$
38
	static final String lineSep = STextActivator.getInstance().getProperty("line.separator"); //$NON-NLS-1$
39
	private static final Integer INTEGER_2 = new Integer(2);
40
	private static final Integer INTEGER_4 = new Integer(4);
41
41
42
	public STextSql() {
42
	public STextSql() {
43
		super("\t!#%&()*+,-./:;<=>?|[]{}"); //$NON-NLS-1$
43
		super("\t!#%&()*+,-./:;<=>?|[]{}"); //$NON-NLS-1$
Lines 87-96 Link Here
87
	     *    <li>skip until after a line separator</li>
87
	     *    <li>skip until after a line separator</li>
88
	     *  </ol>
88
	     *  </ol>
89
	 */
89
	 */
90
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, int[] state, int caseNumber, int separLocation) {
90
	public int processSpecial(STextEnvironment environment, String text, STextCharTypes charTypes, STextOffsets offsets, Object state, int caseNumber, int separLocation) {
91
		int location;
91
		int location;
92
92
93
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
93
		STextTypeHandler.processSeparator(text, charTypes, offsets, separLocation);
94
		if (separLocation < 0)
95
			caseNumber = ((Integer) STextState.getValueAndReset(state)).intValue();
94
		switch (caseNumber) {
96
		switch (caseNumber) {
95
			case 1 : /* space */
97
			case 1 : /* space */
96
				separLocation++;
98
				separLocation++;
Lines 104-110 Link Here
104
				while (true) {
106
				while (true) {
105
					location = text.indexOf('\'', location);
107
					location = text.indexOf('\'', location);
106
					if (location < 0) {
108
					if (location < 0) {
107
						STextImpl.setState(state, caseNumber);
109
						STextState.setValue(state, INTEGER_2);
108
						return text.length();
110
						return text.length();
109
					}
111
					}
110
					if ((location + 1) < text.length() && text.charAt(location + 1) == '\'') {
112
					if ((location + 1) < text.length() && text.charAt(location + 1) == '\'') {
Lines 133-139 Link Here
133
					location = separLocation + 2; // skip the opening slash-aster
135
					location = separLocation + 2; // skip the opening slash-aster
134
				location = text.indexOf("*/", location); //$NON-NLS-1$
136
				location = text.indexOf("*/", location); //$NON-NLS-1$
135
				if (location < 0) {
137
				if (location < 0) {
136
					STextImpl.setState(state, caseNumber);
138
					STextState.setValue(state, INTEGER_4);
137
					return text.length();
139
					return text.length();
138
				}
140
				}
139
				// we need to call processSeparator since text may follow the
141
				// we need to call processSeparator since text may follow the

Return to bug 183164