~ubuntu-branches/ubuntu/vivid/drmips/vivid-backports

« back to all changes in this revision

Viewing changes to src/pc/DrMIPS/src/org/fife/ui/rsyntaxtextarea/modes/LatexTokenMaker.java

  • Committer: Package Import Robot
  • Author(s): Bruno Nova
  • Date: 2014-09-27 12:24:17 UTC
  • Revision ID: package-import@ubuntu.com-20140927122417-2gadkwt9k0u7j4zu
Tags: upstream-1.2.3
Import upstream version 1.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The following code was generated by JFlex 1.4.1 on 4/28/12 4:57 PM */
 
2
 
 
3
/*
 
4
 * 04/24/2012
 
5
 *
 
6
 * LatexTokenMaker.java - Scanner for LaTeX.
 
7
 * 
 
8
 * This library is distributed under a modified BSD license.  See the included
 
9
 * RSyntaxTextArea.License.txt file for details.
 
10
 */
 
11
package org.fife.ui.rsyntaxtextarea.modes;
 
12
 
 
13
import java.io.*;
 
14
import javax.swing.text.Segment;
 
15
 
 
16
import org.fife.ui.rsyntaxtextarea.*;
 
17
 
 
18
 
 
19
/**
 
20
 * Scanner for the LaTeX.<p>
 
21
 *
 
22
 * This implementation was created using
 
23
 * <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
 
24
 * was modified for performance.  Memory allocation needs to be almost
 
25
 * completely removed to be competitive with the handwritten lexers (subclasses
 
26
 * of <code>AbstractTokenMaker</code>, so this class has been modified so that
 
27
 * Strings are never allocated (via yytext()), and the scanner never has to
 
28
 * worry about refilling its buffer (needlessly copying chars around).
 
29
 * We can achieve this because RSTA always scans exactly 1 line of tokens at a
 
30
 * time, and hands the scanner this line as an array of characters (a Segment
 
31
 * really).  Since tokens contain pointers to char arrays instead of Strings
 
32
 * holding their contents, there is no need for allocating new memory for
 
33
 * Strings.<p>
 
34
 *
 
35
 * The actual algorithm generated for scanning has, of course, not been
 
36
 * modified.<p>
 
37
 *
 
38
 * If you wish to regenerate this file yourself, keep in mind the following:
 
39
 * <ul>
 
40
 *   <li>The generated LatexTokenMaker.java</code> file will contain two
 
41
 *       definitions of both <code>zzRefill</code> and <code>yyreset</code>.
 
42
 *       You should hand-delete the second of each definition (the ones
 
43
 *       generated by the lexer), as these generated methods modify the input
 
44
 *       buffer, which we'll never have to do.</li>
 
45
 *   <li>You should also change the declaration/definition of zzBuffer to NOT
 
46
 *       be initialized.  This is a needless memory allocation for us since we
 
47
 *       will be pointing the array somewhere else anyway.</li>
 
48
 *   <li>You should NOT call <code>yylex()</code> on the generated scanner
 
49
 *       directly; rather, you should use <code>getTokenList</code> as you would
 
50
 *       with any other <code>TokenMaker</code> instance.</li>
 
51
 * </ul>
 
52
 *
 
53
 * @author Robert Futrell
 
54
 * @version 0.5
 
55
 *
 
56
 */
 
57
 
 
58
public class LatexTokenMaker extends AbstractJFlexTokenMaker {
 
59
 
 
60
  /** This character denotes the end of file */
 
61
  public static final int YYEOF = -1;
 
62
 
 
63
  /** lexical states */
 
64
  public static final int EOL_COMMENT = 1;
 
65
  public static final int YYINITIAL = 0;
 
66
 
 
67
  /** 
 
68
   * Translates characters to character classes
 
69
   */
 
70
  private static final String ZZ_CMAP_PACKED = 
 
71
    "\11\0\1\3\1\32\1\0\1\3\23\0\1\3\1\5\1\0\1\5"+
 
72
    "\1\7\1\4\7\5\1\2\1\22\1\6\12\1\1\20\1\5\1\0"+
 
73
    "\1\5\1\0\2\5\32\1\1\5\1\23\1\5\1\0\1\2\1\0"+
 
74
    "\1\1\1\25\1\1\1\31\1\17\1\14\1\26\1\10\1\15\2\1"+
 
75
    "\1\16\1\1\1\27\1\1\1\12\2\1\1\13\1\11\2\1\1\21"+
 
76
    "\3\1\1\30\1\0\1\24\1\5\uff81\0";
 
77
 
 
78
  /** 
 
79
   * Translates characters to character classes
 
80
   */
 
81
  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
 
82
 
 
83
  /** 
 
84
   * Translates DFA states to action switch labels.
 
85
   */
 
86
  private static final int [] ZZ_ACTION = zzUnpackAction();
 
87
 
 
88
  private static final String ZZ_ACTION_PACKED_0 =
 
89
    "\2\0\2\1\1\2\1\3\1\1\1\4\1\5\4\6"+
 
90
    "\1\7\3\10\4\0\2\10\4\0\2\10\2\0\1\11"+
 
91
    "\1\0\1\10\3\0\1\10\1\12\2\0\1\13";
 
92
 
 
93
  private static int [] zzUnpackAction() {
 
94
    int [] result = new int[42];
 
95
    int offset = 0;
 
96
    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
 
97
    return result;
 
98
  }
 
99
 
 
100
  private static int zzUnpackAction(String packed, int offset, int [] result) {
 
101
    int i = 0;       /* index in packed string  */
 
102
    int j = offset;  /* index in unpacked array */
 
103
    int l = packed.length();
 
104
    while (i < l) {
 
105
      int count = packed.charAt(i++);
 
106
      int value = packed.charAt(i++);
 
107
      do result[j++] = value; while (--count > 0);
 
108
    }
 
109
    return j;
 
110
  }
 
111
 
 
112
 
 
113
  /** 
 
114
   * Translates a state to a row index in the transition table
 
115
   */
 
116
  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
 
117
 
 
118
  private static final String ZZ_ROWMAP_PACKED_0 =
 
119
    "\0\0\0\33\0\66\0\121\0\66\0\66\0\154\0\66"+
 
120
    "\0\66\0\207\0\242\0\275\0\330\0\66\0\363\0\u010e"+
 
121
    "\0\u0129\0\u0144\0\u015f\0\u017a\0\u0195\0\u01b0\0\u01cb\0\u01e6"+
 
122
    "\0\u0201\0\u021c\0\u0237\0\u0252\0\u026d\0\u0288\0\u02a3\0\u02be"+
 
123
    "\0\u02d9\0\u02f4\0\u030f\0\u02be\0\u032a\0\u0345\0\66\0\u0360"+
 
124
    "\0\u037b\0\66";
 
125
 
 
126
  private static int [] zzUnpackRowMap() {
 
127
    int [] result = new int[42];
 
128
    int offset = 0;
 
129
    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
 
130
    return result;
 
131
  }
 
132
 
 
133
  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
 
134
    int i = 0;  /* index in packed string  */
 
135
    int j = offset;  /* index in unpacked array */
 
136
    int l = packed.length();
 
137
    while (i < l) {
 
138
      int high = packed.charAt(i++) << 16;
 
139
      result[j++] = high | packed.charAt(i++);
 
140
    }
 
141
    return j;
 
142
  }
 
143
 
 
144
  /** 
 
145
   * The transition table of the DFA
 
146
   */
 
147
  private static final int [] ZZ_TRANS = zzUnpackTrans();
 
148
 
 
149
  private static final String ZZ_TRANS_PACKED_0 =
 
150
    "\1\3\2\4\1\5\1\6\3\3\10\4\1\3\1\4"+
 
151
    "\1\3\1\7\1\10\3\4\1\10\1\4\1\11\10\12"+
 
152
    "\1\13\3\12\1\14\4\12\1\15\10\12\1\16\34\0"+
 
153
    "\2\4\5\0\10\4\1\0\1\4\3\0\3\4\1\0"+
 
154
    "\1\4\2\0\2\17\5\0\7\17\1\20\1\0\1\17"+
 
155
    "\3\0\1\21\2\17\1\0\1\17\1\0\10\12\1\0"+
 
156
    "\3\12\1\0\4\12\1\0\10\12\12\0\1\22\32\0"+
 
157
    "\1\23\3\0\1\24\36\0\1\25\12\0\2\17\5\0"+
 
158
    "\10\17\1\0\1\17\3\0\3\17\1\0\1\17\2\0"+
 
159
    "\2\17\5\0\10\17\1\0\1\17\3\0\2\17\1\26"+
 
160
    "\1\0\1\17\2\0\2\17\5\0\7\17\1\27\1\0"+
 
161
    "\1\17\3\0\3\17\1\0\1\17\12\0\1\30\33\0"+
 
162
    "\1\31\36\0\1\32\35\0\1\33\12\0\2\17\5\0"+
 
163
    "\10\17\1\0\1\17\3\0\3\17\1\0\1\34\2\0"+
 
164
    "\2\17\5\0\10\17\1\0\1\17\3\0\1\17\1\35"+
 
165
    "\1\17\1\0\1\17\13\0\1\36\40\0\1\37\31\0"+
 
166
    "\1\31\35\0\1\40\11\0\2\17\5\0\10\17\1\0"+
 
167
    "\1\17\3\0\3\17\1\41\1\17\2\0\2\17\5\0"+
 
168
    "\5\17\1\42\2\17\1\0\1\17\3\0\3\17\1\0"+
 
169
    "\1\17\14\0\1\31\4\0\1\37\20\0\1\43\25\0"+
 
170
    "\1\40\1\44\1\0\2\44\12\40\1\44\1\40\1\44"+
 
171
    "\2\0\3\40\1\0\1\40\2\0\2\45\5\0\10\45"+
 
172
    "\1\0\1\45\3\0\3\45\1\0\1\45\2\0\2\17"+
 
173
    "\5\0\10\17\1\0\1\17\3\0\2\17\1\46\1\0"+
 
174
    "\1\17\7\0\1\40\25\0\2\45\5\0\10\45\1\0"+
 
175
    "\1\45\2\0\1\47\3\45\1\0\1\45\2\0\2\17"+
 
176
    "\5\0\10\17\1\0\1\17\3\0\3\17\1\50\1\17"+
 
177
    "\2\0\2\51\5\0\10\51\1\0\1\51\3\0\3\51"+
 
178
    "\1\0\1\51\2\0\2\51\5\0\10\51\1\0\1\51"+
 
179
    "\2\0\1\52\3\51\1\0\1\51\1\0";
 
180
 
 
181
  private static int [] zzUnpackTrans() {
 
182
    int [] result = new int[918];
 
183
    int offset = 0;
 
184
    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
 
185
    return result;
 
186
  }
 
187
 
 
188
  private static int zzUnpackTrans(String packed, int offset, int [] result) {
 
189
    int i = 0;       /* index in packed string  */
 
190
    int j = offset;  /* index in unpacked array */
 
191
    int l = packed.length();
 
192
    while (i < l) {
 
193
      int count = packed.charAt(i++);
 
194
      int value = packed.charAt(i++);
 
195
      value--;
 
196
      do result[j++] = value; while (--count > 0);
 
197
    }
 
198
    return j;
 
199
  }
 
200
 
 
201
 
 
202
  /* error codes */
 
203
  private static final int ZZ_UNKNOWN_ERROR = 0;
 
204
  private static final int ZZ_NO_MATCH = 1;
 
205
  private static final int ZZ_PUSHBACK_2BIG = 2;
 
206
 
 
207
  /* error messages for the codes above */
 
208
  private static final String ZZ_ERROR_MSG[] = {
 
209
    "Unkown internal scanner error",
 
210
    "Error: could not match input",
 
211
    "Error: pushback value was too large"
 
212
  };
 
213
 
 
214
  /**
 
215
   * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
 
216
   */
 
217
  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
 
218
 
 
219
  private static final String ZZ_ATTRIBUTE_PACKED_0 =
 
220
    "\2\0\1\11\1\1\2\11\1\1\2\11\4\1\1\11"+
 
221
    "\3\1\4\0\2\1\4\0\2\1\2\0\1\1\1\0"+
 
222
    "\1\1\3\0\1\1\1\11\2\0\1\11";
 
223
 
 
224
  private static int [] zzUnpackAttribute() {
 
225
    int [] result = new int[42];
 
226
    int offset = 0;
 
227
    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
 
228
    return result;
 
229
  }
 
230
 
 
231
  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
 
232
    int i = 0;       /* index in packed string  */
 
233
    int j = offset;  /* index in unpacked array */
 
234
    int l = packed.length();
 
235
    while (i < l) {
 
236
      int count = packed.charAt(i++);
 
237
      int value = packed.charAt(i++);
 
238
      do result[j++] = value; while (--count > 0);
 
239
    }
 
240
    return j;
 
241
  }
 
242
 
 
243
  /** the input device */
 
244
  private java.io.Reader zzReader;
 
245
 
 
246
  /** the current state of the DFA */
 
247
  private int zzState;
 
248
 
 
249
  /** the current lexical state */
 
250
  private int zzLexicalState = YYINITIAL;
 
251
 
 
252
  /** this buffer contains the current text to be matched and is
 
253
      the source of the yytext() string */
 
254
  private char zzBuffer[];
 
255
 
 
256
  /** the textposition at the last accepting state */
 
257
  private int zzMarkedPos;
 
258
 
 
259
  /** the current text position in the buffer */
 
260
  private int zzCurrentPos;
 
261
 
 
262
  /** startRead marks the beginning of the yytext() string in the buffer */
 
263
  private int zzStartRead;
 
264
 
 
265
  /** endRead marks the last character in the buffer, that has been read
 
266
      from input */
 
267
  private int zzEndRead;
 
268
 
 
269
  /** zzAtEOF == true <=> the scanner is at the EOF */
 
270
  private boolean zzAtEOF;
 
271
 
 
272
  /* user code: */
 
273
 
 
274
 
 
275
        /**
 
276
         * Constructor.  This must be here because JFlex does not generate a
 
277
         * no-parameter constructor.
 
278
         */
 
279
        public LatexTokenMaker() {
 
280
        }
 
281
 
 
282
 
 
283
        /**
 
284
         * Adds the token specified to the current linked list of tokens.
 
285
         *
 
286
         * @param tokenType The token's type.
 
287
         * @see #addToken(int, int, int)
 
288
         */
 
289
        private void addHyperlinkToken(int start, int end, int tokenType) {
 
290
                int so = start + offsetShift;
 
291
                addToken(zzBuffer, start,end, tokenType, so, true);
 
292
        }
 
293
 
 
294
 
 
295
        /**
 
296
         * Adds the token specified to the current linked list of tokens.
 
297
         *
 
298
         * @param tokenType The token's type.
 
299
         */
 
300
        private void addToken(int tokenType) {
 
301
                addToken(zzStartRead, zzMarkedPos-1, tokenType);
 
302
        }
 
303
 
 
304
 
 
305
        /**
 
306
         * Adds the token specified to the current linked list of tokens.
 
307
         *
 
308
         * @param tokenType The token's type.
 
309
         * @see #addHyperlinkToken(int, int, int)
 
310
         */
 
311
        private void addToken(int start, int end, int tokenType) {
 
312
                int so = start + offsetShift;
 
313
                addToken(zzBuffer, start,end, tokenType, so, false);
 
314
        }
 
315
 
 
316
 
 
317
        /**
 
318
         * Adds the token specified to the current linked list of tokens.
 
319
         *
 
320
         * @param array The character array.
 
321
         * @param start The starting offset in the array.
 
322
         * @param end The ending offset in the array.
 
323
         * @param tokenType The token's type.
 
324
         * @param startOffset The offset in the document at which this token
 
325
         *                    occurs.
 
326
         * @param hyperlink Whether this token is a hyperlink.
 
327
         */
 
328
        @Override
 
329
        public void addToken(char[] array, int start, int end, int tokenType,
 
330
                                                int startOffset, boolean hyperlink) {
 
331
                super.addToken(array, start,end, tokenType, startOffset, hyperlink);
 
332
                zzStartRead = zzMarkedPos;
 
333
        }
 
334
 
 
335
 
 
336
        /**
 
337
         * ${inheritDoc}
 
338
         */
 
339
        @Override
 
340
        public String[] getLineCommentStartAndEnd() {
 
341
                return new String[] { "%", null };
 
342
        }
 
343
 
 
344
 
 
345
        /**
 
346
         * Returns the first token in the linked list of tokens generated
 
347
         * from <code>text</code>.  This method must be implemented by
 
348
         * subclasses so they can correctly implement syntax highlighting.
 
349
         *
 
350
         * @param text The text from which to get tokens.
 
351
         * @param initialTokenType The token type we should start with.
 
352
         * @param startOffset The offset into the document at which
 
353
         *        <code>text</code> starts.
 
354
         * @return The first <code>Token</code> in a linked list representing
 
355
         *         the syntax highlighted text.
 
356
         */
 
357
        public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
 
358
 
 
359
                resetTokenList();
 
360
                this.offsetShift = -text.offset + startOffset;
 
361
 
 
362
                // Start off in the proper state.
 
363
                int state = Token.NULL;
 
364
 
 
365
                s = text;
 
366
                try {
 
367
                        yyreset(zzReader);
 
368
                        yybegin(state);
 
369
                        return yylex();
 
370
                } catch (IOException ioe) {
 
371
                        ioe.printStackTrace();
 
372
                        return new TokenImpl();
 
373
                }
 
374
 
 
375
        }
 
376
 
 
377
 
 
378
        /**
 
379
         * Refills the input buffer.
 
380
         *
 
381
         * @return      <code>true</code> if EOF was reached, otherwise
 
382
         *              <code>false</code>.
 
383
         * @exception   IOException  if any I/O-Error occurs.
 
384
         */
 
385
        private boolean zzRefill() {
 
386
                return zzCurrentPos>=s.offset+s.count;
 
387
        }
 
388
 
 
389
 
 
390
        /**
 
391
         * Resets the scanner to read from a new input stream.
 
392
         * Does not close the old reader.
 
393
         *
 
394
         * All internal variables are reset, the old input stream 
 
395
         * <b>cannot</b> be reused (internal buffer is discarded and lost).
 
396
         * Lexical state is set to <tt>YY_INITIAL</tt>.
 
397
         *
 
398
         * @param reader   the new input stream 
 
399
         */
 
400
        public final void yyreset(java.io.Reader reader) {
 
401
                // 's' has been updated.
 
402
                zzBuffer = s.array;
 
403
                /*
 
404
                 * We replaced the line below with the two below it because zzRefill
 
405
                 * no longer "refills" the buffer (since the way we do it, it's always
 
406
                 * "full" the first time through, since it points to the segment's
 
407
                 * array).  So, we assign zzEndRead here.
 
408
                 */
 
409
                //zzStartRead = zzEndRead = s.offset;
 
410
                zzStartRead = s.offset;
 
411
                zzEndRead = zzStartRead + s.count - 1;
 
412
                zzCurrentPos = zzMarkedPos = s.offset;
 
413
                zzLexicalState = YYINITIAL;
 
414
                zzReader = reader;
 
415
                zzAtEOF  = false;
 
416
        }
 
417
 
 
418
 
 
419
 
 
420
 
 
421
  /**
 
422
   * Creates a new scanner
 
423
   * There is also a java.io.InputStream version of this constructor.
 
424
   *
 
425
   * @param   in  the java.io.Reader to read input from.
 
426
   */
 
427
  public LatexTokenMaker(java.io.Reader in) {
 
428
    this.zzReader = in;
 
429
  }
 
430
 
 
431
  /**
 
432
   * Creates a new scanner.
 
433
   * There is also java.io.Reader version of this constructor.
 
434
   *
 
435
   * @param   in  the java.io.Inputstream to read input from.
 
436
   */
 
437
  public LatexTokenMaker(java.io.InputStream in) {
 
438
    this(new java.io.InputStreamReader(in));
 
439
  }
 
440
 
 
441
  /** 
 
442
   * Unpacks the compressed character translation table.
 
443
   *
 
444
   * @param packed   the packed character translation table
 
445
   * @return         the unpacked character translation table
 
446
   */
 
447
  private static char [] zzUnpackCMap(String packed) {
 
448
    char [] map = new char[0x10000];
 
449
    int i = 0;  /* index in packed string  */
 
450
    int j = 0;  /* index in unpacked array */
 
451
    while (i < 112) {
 
452
      int  count = packed.charAt(i++);
 
453
      char value = packed.charAt(i++);
 
454
      do map[j++] = value; while (--count > 0);
 
455
    }
 
456
    return map;
 
457
  }
 
458
 
 
459
 
 
460
  /**
 
461
   * Closes the input stream.
 
462
   */
 
463
  public final void yyclose() throws java.io.IOException {
 
464
    zzAtEOF = true;            /* indicate end of file */
 
465
    zzEndRead = zzStartRead;  /* invalidate buffer    */
 
466
 
 
467
    if (zzReader != null)
 
468
      zzReader.close();
 
469
  }
 
470
 
 
471
 
 
472
  /**
 
473
   * Returns the current lexical state.
 
474
   */
 
475
  public final int yystate() {
 
476
    return zzLexicalState;
 
477
  }
 
478
 
 
479
 
 
480
  /**
 
481
   * Enters a new lexical state
 
482
   *
 
483
   * @param newState the new lexical state
 
484
   */
 
485
  @Override
 
486
public final void yybegin(int newState) {
 
487
    zzLexicalState = newState;
 
488
  }
 
489
 
 
490
 
 
491
  /**
 
492
   * Returns the text matched by the current regular expression.
 
493
   */
 
494
  public final String yytext() {
 
495
    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
 
496
  }
 
497
 
 
498
 
 
499
  /**
 
500
   * Returns the character at position <tt>pos</tt> from the 
 
501
   * matched text. 
 
502
   * 
 
503
   * It is equivalent to yytext().charAt(pos), but faster
 
504
   *
 
505
   * @param pos the position of the character to fetch. 
 
506
   *            A value from 0 to yylength()-1.
 
507
   *
 
508
   * @return the character at position pos
 
509
   */
 
510
  public final char yycharat(int pos) {
 
511
    return zzBuffer[zzStartRead+pos];
 
512
  }
 
513
 
 
514
 
 
515
  /**
 
516
   * Returns the length of the matched text region.
 
517
   */
 
518
  public final int yylength() {
 
519
    return zzMarkedPos-zzStartRead;
 
520
  }
 
521
 
 
522
 
 
523
  /**
 
524
   * Reports an error that occured while scanning.
 
525
   *
 
526
   * In a wellformed scanner (no or only correct usage of 
 
527
   * yypushback(int) and a match-all fallback rule) this method 
 
528
   * will only be called with things that "Can't Possibly Happen".
 
529
   * If this method is called, something is seriously wrong
 
530
   * (e.g. a JFlex bug producing a faulty scanner etc.).
 
531
   *
 
532
   * Usual syntax/scanner level error handling should be done
 
533
   * in error fallback rules.
 
534
   *
 
535
   * @param   errorCode  the code of the errormessage to display
 
536
   */
 
537
  private void zzScanError(int errorCode) {
 
538
    String message;
 
539
    try {
 
540
      message = ZZ_ERROR_MSG[errorCode];
 
541
    }
 
542
    catch (ArrayIndexOutOfBoundsException e) {
 
543
      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
 
544
    }
 
545
 
 
546
    throw new Error(message);
 
547
  } 
 
548
 
 
549
 
 
550
  /**
 
551
   * Pushes the specified amount of characters back into the input stream.
 
552
   *
 
553
   * They will be read again by then next call of the scanning method
 
554
   *
 
555
   * @param number  the number of characters to be read again.
 
556
   *                This number must not be greater than yylength()!
 
557
   */
 
558
  public void yypushback(int number)  {
 
559
    if ( number > yylength() )
 
560
      zzScanError(ZZ_PUSHBACK_2BIG);
 
561
 
 
562
    zzMarkedPos -= number;
 
563
  }
 
564
 
 
565
 
 
566
  /**
 
567
   * Resumes scanning until the next regular expression is matched,
 
568
   * the end of input is encountered or an I/O-Error occurs.
 
569
   *
 
570
   * @return      the next token
 
571
   * @exception   java.io.IOException  if any I/O-Error occurs
 
572
   */
 
573
  public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
 
574
    int zzInput;
 
575
    int zzAction;
 
576
 
 
577
    // cached fields:
 
578
    int zzCurrentPosL;
 
579
    int zzMarkedPosL;
 
580
    int zzEndReadL = zzEndRead;
 
581
    char [] zzBufferL = zzBuffer;
 
582
    char [] zzCMapL = ZZ_CMAP;
 
583
 
 
584
    int [] zzTransL = ZZ_TRANS;
 
585
    int [] zzRowMapL = ZZ_ROWMAP;
 
586
    int [] zzAttrL = ZZ_ATTRIBUTE;
 
587
 
 
588
    while (true) {
 
589
      zzMarkedPosL = zzMarkedPos;
 
590
 
 
591
      zzAction = -1;
 
592
 
 
593
      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
 
594
  
 
595
      zzState = zzLexicalState;
 
596
 
 
597
 
 
598
      zzForAction: {
 
599
        while (true) {
 
600
    
 
601
          if (zzCurrentPosL < zzEndReadL)
 
602
            zzInput = zzBufferL[zzCurrentPosL++];
 
603
          else if (zzAtEOF) {
 
604
            zzInput = YYEOF;
 
605
            break zzForAction;
 
606
          }
 
607
          else {
 
608
            // store back cached positions
 
609
            zzCurrentPos  = zzCurrentPosL;
 
610
            zzMarkedPos   = zzMarkedPosL;
 
611
            boolean eof = zzRefill();
 
612
            // get translated positions and possibly new buffer
 
613
            zzCurrentPosL  = zzCurrentPos;
 
614
            zzMarkedPosL   = zzMarkedPos;
 
615
            zzBufferL      = zzBuffer;
 
616
            zzEndReadL     = zzEndRead;
 
617
            if (eof) {
 
618
              zzInput = YYEOF;
 
619
              break zzForAction;
 
620
            }
 
621
            else {
 
622
              zzInput = zzBufferL[zzCurrentPosL++];
 
623
            }
 
624
          }
 
625
          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
 
626
          if (zzNext == -1) break zzForAction;
 
627
          zzState = zzNext;
 
628
 
 
629
          int zzAttributes = zzAttrL[zzState];
 
630
          if ( (zzAttributes & 1) == 1 ) {
 
631
            zzAction = zzState;
 
632
            zzMarkedPosL = zzCurrentPosL;
 
633
            if ( (zzAttributes & 8) == 8 ) break zzForAction;
 
634
          }
 
635
 
 
636
        }
 
637
      }
 
638
 
 
639
      // store back cached position
 
640
      zzMarkedPos = zzMarkedPosL;
 
641
 
 
642
      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
 
643
        case 1: 
 
644
          { addToken(Token.IDENTIFIER);
 
645
          }
 
646
        case 12: break;
 
647
        case 8: 
 
648
          { addToken(Token.FUNCTION);
 
649
          }
 
650
        case 13: break;
 
651
        case 2: 
 
652
          { addToken(Token.WHITESPACE);
 
653
          }
 
654
        case 14: break;
 
655
        case 9: 
 
656
          { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos;
 
657
          }
 
658
        case 15: break;
 
659
        case 3: 
 
660
          { start = zzMarkedPos-1; yybegin(EOL_COMMENT);
 
661
          }
 
662
        case 16: break;
 
663
        case 5: 
 
664
          { addNullToken(); return firstToken;
 
665
          }
 
666
        case 17: break;
 
667
        case 7: 
 
668
          { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken;
 
669
          }
 
670
        case 18: break;
 
671
        case 10: 
 
672
          { int temp = zzStartRead;
 
673
                                                        addToken(temp, temp+3, Token.RESERVED_WORD);
 
674
                                                        addToken(temp+4, temp+4, Token.SEPARATOR);
 
675
                                                        addToken(temp+5, zzMarkedPos-2, Token.RESERVED_WORD);
 
676
                                                        addToken(zzMarkedPos-1, zzMarkedPos-1, Token.SEPARATOR);
 
677
          }
 
678
        case 19: break;
 
679
        case 11: 
 
680
          { int temp = zzStartRead;
 
681
                                                        addToken(temp, temp+5, Token.RESERVED_WORD);
 
682
                                                        addToken(temp+6, temp+6, Token.SEPARATOR);
 
683
                                                        addToken(temp+7, zzMarkedPos-2, Token.RESERVED_WORD);
 
684
                                                        addToken(zzMarkedPos-1, zzMarkedPos-1, Token.SEPARATOR);
 
685
          }
 
686
        case 20: break;
 
687
        case 6: 
 
688
          { 
 
689
          }
 
690
        case 21: break;
 
691
        case 4: 
 
692
          { addToken(Token.SEPARATOR);
 
693
          }
 
694
        case 22: break;
 
695
        default: 
 
696
          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
 
697
            zzAtEOF = true;
 
698
            switch (zzLexicalState) {
 
699
            case EOL_COMMENT: {
 
700
              addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken;
 
701
            }
 
702
            case 43: break;
 
703
            case YYINITIAL: {
 
704
              addNullToken(); return firstToken;
 
705
            }
 
706
            case 44: break;
 
707
            default:
 
708
            return null;
 
709
            }
 
710
          } 
 
711
          else {
 
712
            zzScanError(ZZ_NO_MATCH);
 
713
          }
 
714
      }
 
715
    }
 
716
  }
 
717
 
 
718
 
 
719
}