Added mecha-style comment docs to a bunch of headers

This commit is contained in:
2023-07-20 19:44:40 +10:00
parent 3d7d1179c9
commit cdfe17ad53
20 changed files with 1175 additions and 69 deletions

View File

@@ -1,5 +1,11 @@
#pragma once
/*!
# toy_lexer.h
This header defines the lexer and token structures, which can be bound to a piece of source code, and used to tokenize it within a parser.
!*/
#include "toy_common.h"
#include "toy_token_types.h"
@@ -20,10 +26,40 @@ typedef struct {
int line;
} Toy_Token;
/*!
## Defined Functions
!*/
/*!
### void Toy_initLexer(Toy_Lexer* lexer, const char* source)
This function initializes a lexer, binding it to the `source` parameter; the lexer is now ready to be passed to the parser.
!*/
TOY_API void Toy_initLexer(Toy_Lexer* lexer, const char* source);
/*!
### Toy_Token Toy_private_scanLexer(Toy_Lexer* lexer)
This function "scans" the lexer, returning a token to the parser.
Private functions are not intended for general use.
!*/
TOY_API Toy_Token Toy_private_scanLexer(Toy_Lexer* lexer);
//for debugging
/*!
### void Toy_private_printToken(Toy_Token* token)
This function prints a given token to stdout.
Private functions are not intended for general use.
!*/
TOY_API void Toy_private_printToken(Toy_Token* token);
/*!
### void Toy_private_setComments(Toy_Lexer* lexer, bool enabled)
This function sets whether comments are allowed within source code. By default, comments are allowed, and are only disabled in the repl.
Private functions are not intended for general use.
!*/
TOY_API void Toy_private_setComments(Toy_Lexer* lexer, bool enabled);