1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
package Torello.CSS;

import Torello.Java.Additional.ByRef;
import java.util.function.Consumer;

/** The root abstract-parent class for all CSSToken Sub-Classes. */
public abstract class CSSToken
    implements CharSequence, java.io.Serializable, Comparable<CharSequence>
{
    /** <EMBED CLASS='external-html' DATA-FILE-ID=SVUID> */
    protected static final long serialVersionUID = 1;


    // ********************************************************************************************
    // ********************************************************************************************
    // Public & Final Fields
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * The "Reconstituted Character Data" (re-built from the input Code-Points array) that comprise
     * this {@code CSSToken}.
     */
    public final String str;


    // ********************************************************************************************
    // ********************************************************************************************
    // Private Constructor
    // ********************************************************************************************
    // ********************************************************************************************


    CSSToken(int[] cssCodePoints, int sPos, int ePos)
    { this.str = new String(cssCodePoints, sPos, ePos - sPos); }

    // This is used by Punct, CDO, CDC and Delimiter **ONLY**
    CSSToken(String str)
    { this.str = str; }


    // ********************************************************************************************
    // ********************************************************************************************
    // java.lang.CharSequence
    // ********************************************************************************************
    // ********************************************************************************************


    public final char charAt(int index)
    { return str.charAt(index); }

    public final int length()
    { return str.length(); }

    public final String subSequence(int start, int end)
    { return str.substring(start, end); }

    public final String toString()
    { return str; }


    // ********************************************************************************************
    // ********************************************************************************************
    // java.lang.Object, java.lang.Comparable
    // ********************************************************************************************
    // ********************************************************************************************


    public final int compareTo(CharSequence other)
    { return str.compareTo(other.toString()); }

    public final boolean equals(Object other)
    {
        if (this == other) return true;

        if (! other.getClass().equals(this.getClass()))return false;

        return ((CSSToken) other).str.equals(this.str);
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // User's Constructor: Static "build" Method (and associated Helper-Interfaces)
    // ********************************************************************************************
    // ********************************************************************************************


    /*
    // These Package-Private Methods (for internal use only) are for creating a CSSToken instance
    // using a User-Provided String - RATHER THAN A STRING THAT HAS BEEN EXTRACTED BY THE TOKENIZER
    // This whole process is a little tricky because, generally, a constructor makes a lot more
    // sense to the End-User.
    // 
    // However, there are two major stipulations behind the Java-HTML CSS-Tokenizer:
    // 
    //      * First, as with the Java-HTML HTML-Parser:the sum of all CSSTokens must be identical
    //        to the Origina-File.
    // 
    //      * The tokenizer must implement the CSS Working-Group Website's "Pass-1 CSS-Tokenizer"
    //        EXACTLY, as specified.  Because all of that Web-Site's Algorithm's 'consume' methods
    //        make invocations to each other, using Constructors would make the code next to
    //        unreadable.
    //
    // Futhermore, since it wasn't until JDK-22's release that "Statements before this() and
    // super()" inside of a constructor were even legal, and since this code is currently living in
    // "Java 11" - since the JavaDoc-Upgrader's "Upgrade to JDK-21" is a few more months away - it
    // is simply not possible to avoid "Static-Builder's" rather than constructors.
    //
    // TLDR ==>  Constructor's are usually much easier to read, and explaining things is usually
    //           much more direct.  Howeveer since that isn't possible, static build-methods are
    //           provided instead.
    //
    // Because the Token-Classes in Torello.CSS were all written using the CSS-WG Site, the
    // "consume" methods are all intended to be used by the parser-tokenizer "Main Tokenize Loop".
    //
    // It is some work (but only a few lines) to convert the CSSToken class' "consume" methods into
    // "build" methods that are suitable for an "End-User" to build their own Tokens.
    */

    // Please don't ask...  This cute little thing is not that hard.  It's just a function-pointer
    @FunctionalInterface
    static interface TokenConsumer4
    {
        public void consume(
            final int[]                     css,
            final ByRef<Integer>            POS,
            final Consumer<CSSToken>        returnParsedToken,
            final Consumer<TokenizeError>   errorEncountered
        );
    }

    // Function-Pointer for "consme" methods that take 3-arguments (no error-out), instead of 4
    @FunctionalInterface
    static interface TokenConsumer3
    {
        public void consume(
            final int[]                     css,
            final ByRef<Integer>            POS,
            final Consumer<CSSToken>        returnParsedToken
        );
    }

    // Each Sub-Class has a "Check for Errors" Function-Pointer that throws "TokenizeException"
    @FunctionalInterface
    interface InputChecker { public void check(int[] css); }


    // This Build Method is for CSSToken classes whose consume-method accepts 3 parameters
    //
    // The 'TokenConsumer4' accepts:
    //      int[] css                               ==> The CSS-as-a-String (of Code-Points)
    //      ByRef<Integer> pos                      ==> Pointer to the next location in the array
    //                                                  to be processed.  
    //      Consumer<CSSToken> returnParsedToken    ==> This is the "Convoluted-Way" for returning
    //                                                  the CSS-Token to the "build" method
    //      Consumer<TokenizeError> errorEncountered==> If an error occurs, this is also the
    //                                                  "Convoluted-Way" for returning the error
    //
    // NOTE: These "Convoluted" (Consumer) things are a very simple and straight-foward way to add
    //       newly constructed tokens to the output-vector - FROM THE PERSPECTIVE OF THE TOKENIZE
    //       algorithm.
    //
    // FROM THE PERSPECTIVE OF A "BUILD" METHOD, THEY MAY (PERHAPS) SEEM A LITTLE BACKWARDS.
    // Main Point Being: The individual CSSToken Classes "Consume" method can be used by EITHER the
    // Tokenizer or a User's String input.

    static CSSToken build(
            final String            inputStr,   // The User's Input-String which he-or-she would 
                                                // like to convert into a CSSToken instance
            final InputChecker      inputChecker,
            final TokenConsumer4    tokenConsumer   // "4" ==> css, pos, output, error-output
        )
    {
        if (inputStr.length() == 0) throw new TokenizeException();

        final int[] css = inputStr.codePoints().toArray();

        inputChecker.check(css);

        final ByRef<CSSToken> R = new ByRef<>(null);

        // All this is doing is calling the relevant/pertinent "consume" method (which was passed 
        // by the 'tokenConsumer' function-pointer).  

        tokenConsumer.consume(
            css,
            new ByRef<>(0),
            (CSSToken t) -> R.f = t,
            (TokenizeError te) -> te.throwException()
        );

        // Need to guarantee that the entire String was consumed in the process of tokenizing the
        // input String.  'TokenzeException' has a nicely worded Esception-Message to explain what
        // has occured here.

        if (inputStr.length() != R.f.str.length()) throw new TokenizeException(inputStr, R.f.str);

        return R.f;
    }

    // SAME AS ABOVE - EXCEPT THIS METHOD CAN BE INVOKED BY CSSToken Classes whose "consume" method
    // only acdepts three parameters.  Just to be aware the fourth parameter that is left out is
    // one that accepts "TokenizeError" instances.
    //
    // Many of the CSSToken classes do need to check for input-error.  This is primarily becuase
    // in as-many-cases-as-possible, the tokenizer will check for validity before attempting to
    // invoke a token's "consume" method.

    static CSSToken build(
            final String            inputStr,       // The User's Input-String which he-or-she 
                                                    // would like to convert into a CSSToken
            final InputChecker      inputChecker,
            final TokenConsumer3    tokenConsumer   // "3" ==> css, pos, output
        )
    {
        if (inputStr.length() == 0) throw new TokenizeException();

        final int[] css = inputStr.codePoints().toArray();

        inputChecker.check(css);

        final ByRef<CSSToken> R = new ByRef<>(null);

        tokenConsumer.consume(
            css,
            new ByRef<>(0),
            (CSSToken t) -> R.f = t
        );

        // Need to guarantee that the entire String was consumed in the process of tokenizing the
        // input String.  'TokenzeException' has a nicely worded Esception-Message to explain what
        // has occured here.

        if (inputStr.length() != R.f.str.length()) throw new TokenizeException(inputStr, R.f.str);

        return R.f;
    }


    // ********************************************************************************************
    // ********************************************************************************************
    // "is"
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * <EMBED CLASS=defs DATA-TOK=AtKeyword>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see AtKeyword#isAtKeyword()
     */
    public boolean isAtKeyword() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=BadStr>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see BadStr#isBadStr()
     */
    public boolean isBadStr() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=BadURL>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see BadURL#isBadURL()
     */
    public boolean isBadURL() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=CDC>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see CDC#isCDC()
     */
    public boolean isCDC() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=CDO>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see CDO#isCDO()
     */
    public boolean isCDO() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Comment>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Comment#isComment()
     */
    public boolean isComment() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Delimiter>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Delimiter#isDelimiter()
     */
    public boolean isDelimiter() { return false; }

    /**
     * Checks whether {@code 'this'} instance is a {@code Delimiter} instance.
     * @param c Any Java {@code char}.
     * @return {@code TRUE} if {@code 'this'} is a delimiter containing {@code 'c'}.
     */
    public boolean isDelimiter(char c)
    { return this.isDelimiter() && (((Delimiter) this).c == c); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Dimension>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Dimension#isDimension()
     */
    public boolean isDimension() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Func>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Func#isFunc()
     */
    public boolean isFunc() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Hash>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Hash#isHash()
     */
    public boolean isHash() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Identifier>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Identifier#isIdentifier()
     */
    public boolean isIdentifier() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Num>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Num#isNum()
     */
    public boolean isNum() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Percentage>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Percentage#isPercentage()
     */
    public boolean isPercentage() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Punct>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Punct#isPunct()
     */
    public boolean isPunct() { return false; }

    /**
     * Checks whether {@code 'this'} instance is a punctuation character
     * @param c Any Java {@code char}.
     * @return {@code TRUE} if {@code 'this'} is a punctuation of {@code 'c'}.
     */
    public final boolean isPunct(char c)
    { return isPunct() && (((Punct) this).c == c); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Str>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Str#isStr()
     */
    public boolean isStr() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=UnicodeRange>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see UnicodeRange#isUnicodeRange()
     */
    public boolean isUnicodeRange() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=URLToken>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see URLToken#isURL()
     */
    public boolean isURL() { return false; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Whitespace>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IS_RETURNS>
     * @see Whitespace#isWhitespace()
     */
    public boolean isWhitespace() { return false; }


    // ********************************************************************************************
    // ********************************************************************************************
    // "as"
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * <EMBED CLASS=defs DATA-TOK=AtKeyword>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final AtKeyword asAtKeyword() { return AtKeyword.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=BadStr>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final BadStr asBadStr() { return BadStr.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=BadURL>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final BadURL asBadURL() { return BadURL.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=CDC>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final CDC asCDC() { return CDC.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=CDO>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final CDO asCDO() { return CDO.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Comment>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Comment asComment() { return Comment.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Delimiter>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Delimiter asDelimiter() { return Delimiter.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Dimension>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Dimension asDimension() { return Dimension.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Func>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Func asFunc() { return Func.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Hash>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Hash asHash() { return Hash.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Identifier>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Identifier asIdentifier() { return Identifier.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Num>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Num asNum() { return Num.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Percentage>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Percentage asPercentage() { return Percentage.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Punct>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Punct asPunct() { return Punct.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Str>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Str asStr() { return Str.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=UnicodeRange>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final UnicodeRange asUnicodeRange() { return UnicodeRange.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=URLToken>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final URLToken asURL() { return URLToken.class.cast(this); }

    /**
     * <EMBED CLASS=defs DATA-TOK=Whitespace>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_AS_RETURNS>
     * @throws <EMBED CLASS='external-html' DATA-FILE-ID=CCST_AS_CCEX>
     */
    public final Whitespace asWhitespace() { return Whitespace.class.cast(this); }


    // ********************************************************************************************
    // ********************************************************************************************
    // "if"
    // ********************************************************************************************
    // ********************************************************************************************


    /**
     * <EMBED CLASS=defs DATA-TOK=AtKeyword>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see AtKeyword#ifAtKeyword()
     */
    public AtKeyword ifAtKeyword() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=BadStr>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see BadStr#ifBadStr()
     */
    public BadStr ifBadStr() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=BadURL>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see BadURL#ifBadURL()
     */
    public BadURL ifBadURL() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=CDC>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see CDC#ifCDC()
     */
    public CDC ifCDC() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=CDO>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see CDO#ifCDO()
     */
    public CDO ifCDO() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Comment>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Comment#ifComment()
     */
    public Comment ifComment() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Delimiter>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Delimiter#ifDelimiter()
     */
    public Delimiter ifDelimiter() { return null; }

    /**
     * This one actually does this cute little dance, and then and goes and makes funny
     * faces at your mother.
     * 
     * @param c The Delimiter Character.
     * 
     * @return {@code TRUE} if and only {@code 'this'} is an instance of {@link Delimiter}, and one
     * whose {@link Delimiter#c} matches parameter {@code 'c'}.
     * 
     * @see Delimiter#isDelimiter()
     */
    public final Delimiter ifDelimiter(char c)
    { return isDelimiter() && (((Delimiter) this).c == c) ? Delimiter.class.cast(this) : null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Dimension>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Dimension#ifDimension()
     */
    public Dimension ifDimension() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Func>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Func#ifFunc()
     */
    public Func ifFunc() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Hash>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Hash#ifHash()
     */
    public Hash ifHash() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Identifier>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Identifier#ifIdentifier()
     */
    public Identifier ifIdentifier() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Num>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Num#ifNum()
     */
    public Num ifNum() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Percentage>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Percentage#ifPercentage()
     */
    public Percentage ifPercentage() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Punct>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Punct#ifPunct()
     */
    public Punct ifPunct() { return null; }

    /**
     * This one actually does this cute little dance, and then and goes and makes funny
     * faces at your mother.
     * 
     * @param c The Punctuation Character.
     * 
     * @return {@code TRUE} if and only {@code 'this'} is an instance of {@link Punct}, and one
     * whose {@link Punct#c c field} matches parameter {@code 'c'}.
     * 
     * @see Punct#isPunct()
     */
    public final Punct ifPunct(char c)
    { return this.isPunct() && (((Punct) this).c == c) ? Punct.class.cast(this) : null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Str>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Str#ifStr()
     */
    public Str ifStr() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=UnicodeRange>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see UnicodeRange#ifUnicodeRange()
     */
    public UnicodeRange ifUnicodeRange() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=URLToken>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see URLToken#ifURL()
     */
    public URLToken ifURL() { return null; }

    /**
     * <EMBED CLASS=defs DATA-TOK=Whitespace>
     * <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_DESCRIPTION>
     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CSST_IF_RETURNS>
     * @see Whitespace#ifWhitespace()
     */
    public Whitespace ifWhitespace() { return null; }

}