fix(parser): building + clang format -- UNSTABLE

This commit is contained in:
matteo 2026-01-23 19:43:54 +01:00
parent 32e182bd50
commit 9f22aa59b6
4 changed files with 21 additions and 17 deletions

View file

@ -2,7 +2,9 @@ lib_LIBRARIES = libparser.a
libparser_a_SOURCES = \ libparser_a_SOURCES = \
parser.c \ parser.c \
parsing_utils.c grammar.c \
grammar_basic.c \
grammar_advanced.c
libparser_a_CPPFLAGS = -I$(top_srcdir)/src libparser_a_CPPFLAGS = -I$(top_srcdir)/src

View file

@ -25,18 +25,19 @@
// === Structures // === Structures
enum rule { enum rule
RULE_NULL, {
RULE_INPUT, RULE_NULL,
RULE_LIST, RULE_INPUT,
RULE_AND_OR, RULE_LIST,
RULE_PIPELINE, RULE_AND_OR,
RULE_COMMAND, RULE_PIPELINE,
RULE_SIMPLE_COMMAND, RULE_COMMAND,
RULE_SHELL_COMMAND, RULE_SIMPLE_COMMAND,
RULE_IF, RULE_SHELL_COMMAND,
RULE_COMPOUND_LIST, RULE_IF,
RULE_ELSE_CLAUSE RULE_COMPOUND_LIST,
RULE_ELSE_CLAUSE
}; };
// === Functions // === Functions
@ -45,12 +46,12 @@ enum rule {
* @return PARSER_INIT_SUCCESS on success PARSER_INIT_ERROR on error * @return PARSER_INIT_SUCCESS on success PARSER_INIT_ERROR on error
* @warning Do not use outside the parser * @warning Do not use outside the parser
*/ */
bool grammar_init(void); bool grammar_init(void);
/* @brief Closes the grammar submodule /* @brief Closes the grammar submodule
* @warning Do not use outside the parser * @warning Do not use outside the parser
*/ */
void grammar_close(void); void grammar_close(void);
/* @brief Acts as the entry point of the parser, calls parse_list /* @brief Acts as the entry point of the parser, calls parse_list
* *

View file

@ -1,8 +1,8 @@
#ifndef GRAMMAR_BASIC_H #ifndef GRAMMAR_BASIC_H
#define GRAMMAR_BASIC_H #define GRAMMAR_BASIC_H
#include "../utils/ast/ast.h"
#include "../lexer/lexer.h" #include "../lexer/lexer.h"
#include "../utils/ast/ast.h"
// === Functions // === Functions

View file

@ -6,7 +6,8 @@
#include "../lexer/lexer.h" #include "../lexer/lexer.h"
#include "../utils/ast/ast.h" #include "../utils/ast/ast.h"
enum parser_state { enum parser_state
{
PARSER_STATE_NOT_INITIALIZED = 0, PARSER_STATE_NOT_INITIALIZED = 0,
PARSER_STATE_READY, PARSER_STATE_READY,
PARSER_STATE_CLOSED PARSER_STATE_CLOSED