Package apg
Class UdtLib.WhiteSpace
- java.lang.Object
-
- apg.Parser.UdtCallback
-
- apg.UdtLib.WhiteSpace
-
- Enclosing class:
- UdtLib
public static class UdtLib.WhiteSpace extends Parser.UdtCallback
UDT for any of several choices for white space characters.
-
-
Field Summary
-
Fields inherited from class apg.Parser.UdtCallback
callbackData
-
-
Constructor Summary
Constructors Constructor Description WhiteSpace(Parser parser)
Default constructor.WhiteSpace(Parser parser, boolean optional, UdtLib.Comment comment, UdtLib.LineEnd foldingLineEnd)
General constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
callback(int offset)
The UDT function.
-
-
-
Constructor Detail
-
WhiteSpace
public WhiteSpace(Parser parser)
Default constructor. White space is an optional string of space (x20
) or horizontal tab (x09
) characters.- Parameters:
parser
- the Parser object this UDT is attached to.
-
WhiteSpace
public WhiteSpace(Parser parser, boolean optional, UdtLib.Comment comment, UdtLib.LineEnd foldingLineEnd)
General constructor. White space always includes the standard white space characters space(x20
) or horizontal tab(x09
). Optionally white space additionally may include line comments and/or folding white space. Folding white space, found in many Internet standards, is a line end followed by one standard white space character.- Parameters:
parser
- the Parser object this UDT is attached to.optional
- if true, the white space is optional, if false at least one white space character or entity is required.comment
- if null, comments are not considered white space, otherwise comment is a Comment class object or any Comment extension object.foldingLineEnd
- if null, folding white space is not allowed. Otherwise folding white space is allowed and foldingLineEnd is a LineEnd class object or any LineEnd extension object.
-
-
Method Detail
-
callback
public int callback(int offset)
Description copied from class:Parser.UdtCallback
The UDT function.- Specified by:
callback
in classParser.UdtCallback
- Parameters:
offset
- offset into the input string to the first character of the parsed phrase.- Returns:
- the matched phrase length,
L
, or-1
if no phrase was matched. The phrase length must be in the range0 <= L <=(n-1)
, wheren
is the remaining number of characters in the input string.
-
-