Skip to content

Commit

Permalink
Add logical not operator in walk operations
Browse files Browse the repository at this point in the history
Remove from input using the ! operator at the start of the expression.
Things are very messy, and syntax is in flux, but at least

  !/foo/bar

Will remove /foo/bar from the input

  !/foo/bar,baz

Will remove /foo/bar and foo/baz from the input

  !(/foo),(/bar/baz)

Will remove /foo and /bar/baz from the input.

This is highly experimental for now.

Signed-off-by: Pantelis Antoniou <[email protected]>
  • Loading branch information
pantoniou committed Jun 28, 2024
1 parent 13fc5ac commit 7d675e8
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 22 deletions.
4 changes: 3 additions & 1 deletion include/libfyaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -6271,10 +6271,12 @@ enum fy_token_type {

FYTT_PE_METHOD, /* path expr method (chained) */
FYTT_SE_METHOD, /* scalar expr method (non chained) */

FYTT_PE_BANG, /* ! */
};

/* The number of token types available */
#define FYTT_COUNT (FYTT_SE_METHOD+1)
#define FYTT_COUNT (FYTT_PE_BANG+1)

/**
* fy_token_type_is_valid() - Check token type validity
Expand Down
2 changes: 2 additions & 0 deletions src/lib/fy-dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ const char *fy_token_type_txt[FYTT_COUNT] = {

[FYTT_PE_METHOD] = "PE_METHOD",
[FYTT_SE_METHOD] = "SE_METHOD",

[FYTT_PE_BANG] = "PE_BANG",
};

char *fy_token_dump_format(struct fy_token *fyt, char *buf, size_t bufsz)
Expand Down
Loading

0 comments on commit 7d675e8

Please sign in to comment.