strscLit/strscChar require a match and fail the scan if they do not get one. strscTry/strscTryChar consume a match if there is one and report back without failing. strscPeek/strscPeekChar look without consuming.
◆ strscChar()
| bool strscChar |
( |
strscan * |
sc, |
|
|
char |
ch |
|
) |
| |
Matches a single byte and consumes it.
- Parameters
-
| sc | Scanner to read from |
| ch | Byte that must appear at the cursor |
- Returns
- true if it matched
◆ strscLit()
| bool strscLit |
( |
strscan * |
sc, |
|
|
strref |
lit |
|
) |
| |
Matches a literal and consumes it.
- Parameters
-
| sc | Scanner to read from |
| lit | Text that must appear at the cursor |
- Returns
- true if it matched
◆ strscPeek()
| bool strscPeek |
( |
strscan * |
sc, |
|
|
strref |
lit |
|
) |
| |
Tests for a literal at the cursor without consuming anything.
- Parameters
-
| sc | Scanner to read from |
| lit | Text to look for |
- Returns
- true if it is at the cursor
◆ strscPeekChar()
| uint8 strscPeekChar |
( |
strscan * |
sc | ) |
|
Returns the byte at the cursor without consuming it.
- Parameters
-
- Returns
- The byte, or 0 at the end of the string or after a failure
◆ strscTry()
| bool strscTry |
( |
strscan * |
sc, |
|
|
strref |
lit |
|
) |
| |
Consumes a literal if it is there, without failing the scan if it is not.
- Parameters
-
| sc | Scanner to read from |
| lit | Text to look for |
- Returns
- true if it matched and was consumed
◆ strscTryChar()
| bool strscTryChar |
( |
strscan * |
sc, |
|
|
char |
ch |
|
) |
| |
Consumes a single byte if it is there, without failing the scan if it is not.
- Parameters
-
| sc | Scanner to read from |
| ch | Byte to look for |
- Returns
- true if it matched and was consumed
◆ strscWS()
Skips any run of whitespace, including none at all.
- Parameters
-
- Returns
- true unless the scan had already failed
◆ strscWS1()
Requires and skips a run of at least one whitespace byte.
- Parameters
-
- Returns
- true if there was whitespace to skip