From 476044b4947632ba2b03bc368a513cba55cb1103 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Thu, 2 May 2024 21:04:36 +0100 Subject: Makefile: Add support for generating compile_flags.txt This helps tools like clangd understand where the header files are such that they can be used to navigate the codebase quickly and easily. --- include/stem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/stem.h b/include/stem.h index f4aff54..06f7351 100644 --- a/include/stem.h +++ b/include/stem.h @@ -55,7 +55,7 @@ typedef struct PARSER_STRUCT { /*! @brief Index of current character */ int i; /*! @brief The current character */ - char c; + int c; } parser_t; /*! @brief This structure is to be used in singly linked lists that hold -- cgit From c4ee664d0b2f4e118106fdd49eb50d9fb3eaeee3 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Thu, 2 May 2024 21:08:11 +0100 Subject: Don't check parser_t.c against EOF parser_t.c is a char which may be unsigned on some platforms and therefore incapable of holding EOF. This field is only ever set from parser_t.source which is a char array, which only ever originates from {main,strquote,include} -> parser_pp -> {init_parser,parser_reset} which all assign it from char arrays. This means it should never be EOF, so the check can be dropped. Also update the documentation so it matches. --- include/stem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/stem.h b/include/stem.h index 06f7351..c467286 100644 --- a/include/stem.h +++ b/include/stem.h @@ -48,7 +48,7 @@ struct VALUE_STRUCT { /*! @brief Parser implementation directly parses without lexer */ /*! the parser data structure parses a string of valid stem code and - * returns a value until it reaches EOF or end of string. */ + * returns a value until it reaches end of string. */ typedef struct PARSER_STRUCT { /*! @brief The string that contains valid stem code. */ char *source; @@ -181,7 +181,7 @@ value_t *parse_word(parser_t *p); /*! Error in parsing strings can occur if wrong escape code. */ void parser_error(parser_t *p); -/*! Gets the next value_t from the string, returns NULL if EOF. */ +/*! Gets the next value_t from the string, returns NULL if end of string. */ value_t *parser_get_next(parser_t *p); /*! Allocates memory for new node struct. */ -- cgit