String View¶
This is mostly an internal utility.
The ArgumentView is mostly used by the internal command parser to parse arguments. While you will be able to use this yourself, its very unlikely that you'll ever actually need it.
This is a work in progress.
The string view does a lot of complicated maths and logic to determine arguments. It's not as simple as just splitting the string on every whitespace and calling it an argument, the ArgumentView parser has to check for quotes, escape characters, and more.
Due to the complexity of the parser, it's very likely that there are still bugs in the parser. Fixes welcome!
ArgumentView ¶
A parser designed to allow for multi-word arguments and quotes
For example, the arguments 1 "2 3" 4
would result in three items in the internal list:
1
, 2 3
, and 4
This is most useful when parsing arguments from a command, as it allows for multi-word arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str
|
The string to parse |
required |
eof
property
¶
eof: bool
Returns whether the parser has reached the end of the string
Returns:
Type | Description |
---|---|
bool
|
Whether the parser has reached the end of the string (cursor is greater than or equal to the length of the string) |
add_arg ¶
add_arg(argument: str) -> None
Adds an argument to the argument list
Parameters:
Name | Type | Description | Default |
---|---|---|---|
argument
|
str
|
The argument to add |
required |
Returns:
Type | Description |
---|---|
None
|
none |
parse_arguments ¶
parse_arguments() -> ArgumentView