diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-12 22:22:38 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-12 22:22:38 -0800 |
| commit | 2d109f974b6a03a79db3dd8a5ffe5c2aff76659e (patch) | |
| tree | 082415222af72e0ac17eac9260a5e5a1ce59221a /compiler.c | |
| parent | 5811ff4554da3d980ff32a83efa35ea1a4512484 (diff) | |
Some general cleanup, adding comments, adding more __attribute__s where
applicable
Diffstat (limited to 'compiler.c')
| -rw-r--r-- | compiler.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -12,10 +12,13 @@ #define file_err(f, ...) do { fprint_line(stderr, f, __VA_ARGS__); _exit(1); } while(0) -__attribute__((nonnull)) static vm_op_t *expand_chain(file_t *f, vm_op_t *first); -__attribute__((nonnull)) static vm_op_t *expand_choices(file_t *f, vm_op_t *first); +__attribute__((nonnull)) +static vm_op_t *expand_chain(file_t *f, vm_op_t *first); +__attribute__((nonnull)) +static vm_op_t *expand_choices(file_t *f, vm_op_t *first); static vm_op_t *chain_together(vm_op_t *first, vm_op_t *second); -__attribute__((nonnull(1,4))) static void set_range(vm_op_t *op, ssize_t min, ssize_t max, vm_op_t *pat, vm_op_t *sep); +__attribute__((nonnull(1,4))) +static void set_range(vm_op_t *op, ssize_t min, ssize_t max, vm_op_t *pat, vm_op_t *sep); // // Helper function to initialize a range object. @@ -113,6 +116,10 @@ static vm_op_t *expand_choices(file_t *f, vm_op_t *first) return choice; } +// +// Given two patterns, return a new opcode for the first pattern followed by +// the second. If either pattern is NULL, return the other. +// static vm_op_t *chain_together(vm_op_t *first, vm_op_t *second) { if (first == NULL) return second; |
