Game Development Reference
In-Depth Information
chapter 22
Flexible Command
Line Tokenizer
Always design a thing by considering it in its next larger context—a chair
in a room, a room in a house, a house in an environment, an environment in
a city plan.
Eliel Saarinen—“Time,” July 2, 1956
Command line utilities have always been a favorite among tools developers,
generally because of how quick they are to make. Command line utilities do not
require that code and time be spent on a graphical user interface, which dramati-
cally reduces development time. These tools can also have complex configuration
options that are hidden from the user unless explicitly specified, making the tool
easier to learn and operate. The one disadvantage that command line utilities have
is that they must parse the command line parameters and act on them according-
ly. This can be quite a nuisance, especially when the only input validation is done
by the user before the parameters are parsed by the utility. It can be difficult to cor-
rectly parse a parameter string, including fault tolerance for data input errors.
A tokenizer is code that extracts tokens (substrings) from a given string. The
tokens in the string can be separated by one or more character delimiters. This
chapter discusses a reusable and flexible command line tokenizer that can break an
arbitrary parameter string into name-value pairs.
Search Nedrilad ::

Custom Search