-
Notifications
You must be signed in to change notification settings - Fork 7
Parser
Since version 1.6.10 xWarp is using a new parser to read the command from a player. Before it simply splits the text at the spaces, but with the new parser you could prevent that it split the command at a space.
The following chapters describes the functionality of this feature. To show the spaces directly a “␣” was placed instead of the space directly.
The difference is only, that there is a possibility to prevent interpreting the following sign. This is commonly known by Escape character. In many languages this character is the backslash (“\”) and forces the parser to ignore the following character.
So to add a space into a word you simple place a escape character right before the space: Hello\␣World The parser will return one segment here (“Hello␣World”). If the space delimits two values don't escape them: Hello␣World There xWarp will read two segments: “Hello” and “World”.
If you want to use interpreted characters this character also can be used right in front of it. The interpreted/forbidden characters are:
- Spaces (␣)
- Quotes (")
- Escape characters ()
So if you want to write the text “Hello "you"” you simply escape the quotes: Hello\␣"you"
The parser is error tolerant as every character that is escaped will be ignored. It is not relevant if the escaped character has a function.
The other way to prevent interpreting the space is, that you quote the space/value. The easiest way is to quote the complete value: "Hello␣World" This will return one segment (“Hello␣World”). This technique has the advantage that you don't have to escape every space and only have to place two quotes.
| Input | Output |
|---|---|
| Hello␣World | { Hello, World } |
| "Hello␣World" | { Hello␣World } |
| Hello\␣World | { Hello␣World } |
| \"Hello␣World\" | { "Hello, World" } |
| "Hello␣World␣\"Bukkit\"" | { Hello␣World␣"Bukkit" } |
| Hello␣World\␣\"Bukkit\" | { Hello␣World␣"Bukkit" } |
| \T\o\l\e\r\a\n\t\␣\e\s\c\a\p\i\n\g | { Tolerant␣escaping } |
| Escape\␣escapes:\␣\\ | { Escape␣escapes:␣\ } |