Game Development Reference
In-Depth Information
Formatting Styles
When parsing command line parameters, developers generally come up with
unique ways to express parameter syntax. This has led to some confusion about
consistency and has brought forth the emergence of a number of formatting styles
from the UNIX and Windows worlds.
In order to build a tokenizer that favors a variety of standards, a number of for-
matting styles have been merged into a common syntax for parsing.
The tokenizer syntax supports three styles of prefixes to signify a parameter. A
parameter can be prefixed with a forward slash ( /) ,a hyphen ( -) , or a double
hypen ( —) .
Some examples include:
/name
-value
—screenMode
Parameters typically have values associated with them, but if they do not then true
is used as a default value just to show that a particular parameter was specified.
Parameter values come after the parameter token and can be prefixed with a space
( ), an equals sign (=), or a colon (:).
Some examples include:
/name Graham
-value=54
—screenMode:normal
Parameter values can also be surrounded by either single or double quotes to pre-
serve white space.
/name “Graham Wihlidal”
—screenMode = 'normal'
Visualizing a generic syntax expression for the above styles results in the following:
{-,/,—}param{ ,=,:}((“,')value(“,'))
Using the above syntax expression will allow us to parse a variety of formatting
styles.
Search Nedrilad ::




Custom Search