5#include <unordered_map>
33[[nodiscard]]
bool isNewLine(std::string_view str);
61[[nodiscard]]
bool isNumber(std::string_view str);
128[[nodiscard]]
bool tryToEatChar(BufferStream& stream,
char c);
162 using std::runtime_error::runtime_error;
std::string_view readStringToBuffer(BufferStream &stream, BufferStream &backing, std::string_view start=DEFAULT_STRING_START, std::string_view end=DEFAULT_STRING_END, const EscapeSequenceMap &escapeSequences=DEFAULT_ESCAPE_SEQUENCES)
Read a string starting at the current stream position.
std::string_view readUnquotedStringToBuffer(BufferStream &stream, BufferStream &backing, const EscapeSequenceMap &escapeSequences=DEFAULT_ESCAPE_SEQUENCES)
Read a string starting at the current stream position.
std::string convertSpecialCharsToEscapes(std::string_view str, const EscapeSequenceMap &escapeSequences)
Convert special characters like \n to escaped special characters like \\n.
std::string convertEscapesToSpecialChars(std::string_view str, const EscapeSequenceMap &escapeSequences)
Convert escaped special characters like \\n to special characters like \n.
const EscapeSequenceMap NO_ESCAPE_SEQUENCES
std::unordered_map< char, char > EscapeSequenceMap
constexpr std::string_view DEFAULT_MULTI_LINE_COMMENT_END
void eatMultiLineComment(BufferStream &stream, std::string_view multiLineCommentEnd=DEFAULT_MULTI_LINE_COMMENT_END)
If a multi line comment is detected, eat its contents.
bool isNewLine(char c)
If a char is a newline character.
void eatSingleLineComment(BufferStream &stream)
If a single line comment is detected, eat its contents.
void eatWhitespaceAndSingleLineComments(BufferStream &stream, std::string_view singleLineCommentStart=DEFAULT_SINGLE_LINE_COMMENT_START)
Eat all whitespace and single line comments after the current stream position.
void eatWhitespace(BufferStream &stream)
Eat all whitespace after the current stream position.
const EscapeSequenceMap DEFAULT_ESCAPE_SEQUENCES
constexpr std::string_view DEFAULT_SINGLE_LINE_COMMENT_START
bool tryToEatChar(BufferStream &stream, char c)
If the given char exists at the current position, skip over it.
constexpr std::string_view DEFAULT_STRING_END
constexpr std::string_view DEFAULT_MULTI_LINE_COMMENT_START
constexpr std::string_view DEFAULT_STRING_START
void eatWhitespaceAndComments(BufferStream &stream, std::string_view singleLineCommentStart=DEFAULT_SINGLE_LINE_COMMENT_START, std::string_view multiLineCommentStart=DEFAULT_MULTI_LINE_COMMENT_START)
Eat all whitespace and comments after the current stream position.
bool isNumber(char c)
If a char is a numerical character (0-9).
void eatWhitespaceAndMultiLineComments(BufferStream &stream, std::string_view multiLineCommentStart=DEFAULT_MULTI_LINE_COMMENT_START)
Eat all whitespace and multi line comments after the current stream position.
bool isWhitespace(char c)
If a char is a whitespace character.