diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-11-09 23:19:53 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-11-09 23:19:53 +0100 |
| commit | 1566b6faa8534118c3566188181367cd0868468f (patch) | |
| tree | 1de8d4b369efb5e592685a31088f798a6b63ffa1 /examples/dte/compiler.h | |
| parent | 349991bf6efe473ab9a5cbdae0a8114d72b997e3 (diff) | |
| download | crep-1566b6faa8534118c3566188181367cd0868468f.tar.gz | |
Added partial matching and introduced threads
Diffstat (limited to 'examples/dte/compiler.h')
| -rw-r--r-- | examples/dte/compiler.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/examples/dte/compiler.h b/examples/dte/compiler.h new file mode 100644 index 0000000..c1b0de6 --- /dev/null +++ b/examples/dte/compiler.h @@ -0,0 +1,49 @@ +#ifndef COMPILER_H +#define COMPILER_H + +#include <regex.h> +#include <stdbool.h> +#include <stdint.h> +#include "util/hashmap.h" +#include "util/macros.h" +#include "util/ptr-array.h" +#include "util/string.h" + +enum { + ERRORFMT_CAPTURE_MAX = 16 +}; + +enum { + ERRFMT_FILE, + ERRFMT_LINE, + ERRFMT_COLUMN, + ERRFMT_MESSAGE, +}; + +typedef struct { + int8_t capture_index[4]; + bool ignore; + const char *pattern; // Original pattern string (interned) + regex_t re; // Compiled pattern +} ErrorFormat; + +typedef struct { + PointerArray error_formats; +} Compiler; + +Compiler *find_compiler(const HashMap *compilers, const char *name) NONNULL_ARGS; +void remove_compiler(HashMap *compilers, const char *name) NONNULL_ARGS; +void free_compiler(Compiler *c) NONNULL_ARGS; +void collect_errorfmt_capture_names(PointerArray *a, const char *prefix) NONNULL_ARGS; +void dump_compiler(const Compiler *c, const char *name, String *s) NONNULL_ARGS; + +NONNULL_ARGS WARN_UNUSED_RESULT +bool add_error_fmt ( + HashMap *compilers, + const char *name, + bool ignore, + const char *format, + char **desc +); + +#endif |
