CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
Literals and Characters

Functions

bool strscLit (strscan *sc, strref lit)
 
bool strscChar (strscan *sc, char ch)
 
bool strscTry (strscan *sc, strref lit)
 
bool strscTryChar (strscan *sc, char ch)
 
bool strscPeek (strscan *sc, strref lit)
 
uint8 strscPeekChar (strscan *sc)
 
bool strscWS (strscan *sc)
 
bool strscWS1 (strscan *sc)
 

Detailed Description

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.

Function Documentation

◆ strscChar()

bool strscChar ( strscan sc,
char  ch 
)

Matches a single byte and consumes it.

Parameters
scScanner to read from
chByte 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
scScanner to read from
litText 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
scScanner to read from
litText 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
scScanner to read from
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
scScanner to read from
litText 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
scScanner to read from
chByte to look for
Returns
true if it matched and was consumed

◆ strscWS()

bool strscWS ( strscan sc)

Skips any run of whitespace, including none at all.

Parameters
scScanner to advance
Returns
true unless the scan had already failed

◆ strscWS1()

bool strscWS1 ( strscan sc)

Requires and skips a run of at least one whitespace byte.

Parameters
scScanner to advance
Returns
true if there was whitespace to skip