diff options
Diffstat (limited to 'include/lex.h')
| -rw-r--r-- | include/lex.h | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/include/lex.h b/include/lex.h index 129b9940618f..20be6efa9cde 100644 --- a/include/lex.h +++ b/include/lex.h @@ -84,8 +84,8 @@ ((c) == '.' && !(pt) && !(int_only))) /// An enum of lex token types. -typedef enum BcLexType { - +typedef enum BcLexType +{ /// End of file. BC_LEX_EOF, @@ -462,10 +462,10 @@ struct BcLex; typedef void (*BcLexNext)(struct BcLex* l); /// The lexer. -typedef struct BcLex { - +typedef struct BcLex +{ /// A pointer to the text to lex. - const char *buf; + const char* buf; /// The current index into buf. size_t i; @@ -502,7 +502,8 @@ typedef struct BcLex { * Initializes a lexer. * @param l The lexer to initialize. */ -void bc_lex_init(BcLex *l); +void +bc_lex_init(BcLex* l); /** * Frees a lexer. This is not guarded by #ifndef NDEBUG because a separate @@ -510,14 +511,16 @@ void bc_lex_init(BcLex *l); * that parser needs a lexer. * @param l The lexer to free. */ -void bc_lex_free(BcLex *l); +void +bc_lex_free(BcLex* l); /** * Sets the filename that the lexer will be lexing. * @param l The lexer. * @param file The filename that the lexer will lex. */ -void bc_lex_file(BcLex *l, const char *file); +void +bc_lex_file(BcLex* l, const char* file); /** * Sets the text the lexer will lex. @@ -527,32 +530,37 @@ void bc_lex_file(BcLex *l, const char *file); * @param is_exprs True if the text is from command-line expressions, false * otherwise. */ -void bc_lex_text(BcLex *l, const char *text, bool is_stdin, bool is_exprs); +void +bc_lex_text(BcLex* l, const char* text, bool is_stdin, bool is_exprs); /** * Generic next function for the parser to call. It takes care of calling the * correct @a BcLexNext function and consuming whitespace. * @param l The lexer. */ -void bc_lex_next(BcLex *l); +void +bc_lex_next(BcLex* l); /** * Lexes a line comment (one beginning with '#' and going to a newline). * @param l The lexer. */ -void bc_lex_lineComment(BcLex *l); +void +bc_lex_lineComment(BcLex* l); /** * Lexes a general comment (C-style comment). * @param l The lexer. */ -void bc_lex_comment(BcLex *l); +void +bc_lex_comment(BcLex* l); /** * Lexes whitespace, finding as much as possible. * @param l The lexer. */ -void bc_lex_whitespace(BcLex *l); +void +bc_lex_whitespace(BcLex* l); /** * Lexes a number that begins with char @a start. This takes care of parsing @@ -562,32 +570,37 @@ void bc_lex_whitespace(BcLex *l); * this function, the lexer had to eat the first char. It fixes * that by passing it in. */ -void bc_lex_number(BcLex *l, char start); +void +bc_lex_number(BcLex* l, char start); /** * Lexes a name/identifier. * @param l The lexer. */ -void bc_lex_name(BcLex *l); +void +bc_lex_name(BcLex* l); /** * Lexes common whitespace characters. * @param l The lexer. * @param c The character to lex. */ -void bc_lex_commonTokens(BcLex *l, char c); +void +bc_lex_commonTokens(BcLex* l, char c); /** * Throws a parse error because char @a c was invalid. * @param l The lexer. * @param c The problem character. */ -void bc_lex_invalidChar(BcLex *l, char c); +void +bc_lex_invalidChar(BcLex* l, char c); /** * Reads a line from stdin and puts it into the lexer's buffer. * @param l The lexer. */ -bool bc_lex_readLine(BcLex *l); +bool +bc_lex_readLine(BcLex* l); #endif // BC_LEX_H |
