Package Torello.CSS

Class BadURL

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.CharSequence, java.lang.Comparable<java.lang.CharSequence>

    public class BadURL
    extends CSSToken
    implements java.lang.CharSequence, java.io.Serializable, java.lang.Comparable<java.lang.CharSequence>
    This is a Token Data-Class. It is a descendant of the root CSSToken-Class: CSSToken. Instances of the class are usually are produced by the CSSTokenizer class. Many (but not all) of these subclasses maintain a static-method for building instances of this class named 'build'. Any CSSToken-subclass that is neither a singleton-instance, nor an "Error-Subtype" should have such a builder. Singeton instances do not need builders, and the two Error-Subtype Classes can only be generated by the tokenizer.

    All CSSToken subclasses have a CSSToken.str field which contains the exact character data that was extracted and used to construct instances of this class. All sub-casses also have several "Loop Optimization" methods. These are methods that may or may not be useful in light of some of the newer additions to JDK 17 & 21 including the 'instanceof varName' conditional-expression variable-naming features.

    The algorithms used to write this tokenizer were generated based solely on the CSS Working-Group's Syntax-Documentation. This document may be viewed here: CSS Working-Group CSS-Syntax. There is an external site that maintain all thing CSS located at drafts.csswg.org
    It has been patently decided that neither 'BadStr' nor 'BadURL' will have constructors.
    See Also:
    Serialized Form


    • Field Detail

      • serialVersionUID

        🡇     🗕  🗗  🗖
        protected static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         protected static final long serialVersionUID = 1;
        
    • Method Detail

      • isBadURL

        🡅  🡇     🗕  🗗  🗖
        public final boolean isBadURL()
        Description copied from class: CSSToken
        Loop Optimization: This method only returns TRUE if this is an actual instance of BadURL.
        Overrides:
        isBadURL in class CSSToken
        Returns:
        This method returns FALSE for all instances of CSSToken, except when 'this' instance is actually the BadURL Subclass.

        That class has overridden this method, and returns TRUE.
        See Also:
        isBadURL()
      • ifBadURL

        🡅  🡇     🗕  🗗  🗖
        public final BadURL ifBadURL()
        Description copied from class: CSSToken
        Loop Optimization: When this method is invoked on an instance of sub-class BadURL this method produces 'this' instance.
        Overrides:
        ifBadURL in class CSSToken
        Returns:
        This method shall return null, always, except when 'this' is an actual instance of BadURL. When so, this method simply returns 'this'. All other sub-classes of (abstract) class CSSToken inherit this method, and therefore return null.
        See Also:
        ifBadURL()
      • consume

        🡅     🗕  🗗  🗖
        protected static void consume​
                    (int[] css,
                     ByRef<java.lang.Integer> POS,
                     java.util.function.Consumer<CSSToken> returnParsedToken,
                     int sPos)
        
        This is a tokenizer method which "consumes" the next BadURL-Token from the input Code-Point Array.

        Tokenizer: BadURL-Token Consume Method, Pseudo-Code

        Making use of the CSS Parser DOES NOT require any knowledge of how the underlying Pass 1 Tokenizer actually works. Browser-War people are usually pretty convincing that parsing CSS is a "Moving Target" type of operation, not to be engaged by mere mortals.

        Below is the CSS Working Group's BadURL-Token Pseudo-Code. You may review it if you are at wit's end, and have nothing better to do. There is no need to actually invoke this method, it is here solely for informational purposes.

        These Parsing Pseudo-Code Instructions and Rail-Road Diagrams have been copied from the CSS-Working-Group Web-Site:
        https://drafts.csswg.org/css-syntax/#consume-the-remnants-of-a-bad-url

        Consume the remnants of a bad url

        This section describes how to consume the remnants of a bad url from a stream of code points, "cleaning up" after the tokenizer realizes that it’s in the middle of a <bad-url-token> rather than a <url-token>. It returns nothing; its sole use is to consume enough of the input stream to reach a recovery point where normal tokenizing can resume.

        Repeatedly consume the next input code point from the stream:

        U+0029 RIGHT PARENTHESIS ())
        EOF
        Return.
        the input stream starts with a valid escape
        Consume an escaped code point. This allows an escaped right parenthesis ("\)") to be encountered without ending the <bad-url-token>. This is otherwise identical to the "anything else" clause.
        anything else
        Do nothing.