Skip to content

Commit

Permalink
add delete all (#2119)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoy-googly-moogly authored Feb 2, 2025
1 parent d658409 commit 0920799
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/malloy/src/lang/grammar/MalloyTag.g4
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tagSpec
| propName EQ DOTTY? properties # tagReplaceProperties
| propName properties # tagUpdateProperties
| MINUS? propName # tagDef
| MINUS_DOTTY # tagEmpty
;

string
Expand Down Expand Up @@ -63,6 +64,7 @@ reference: RF_BEG propName RF_END;
arrayValue: AR_BEG arrayElement (COMMA arrayElement)* COMMA? AR_END;
properties: PR_BEG (DOTTY | (tagSpec*)) PR_END;

MINUS_DOTTY: '-...';
DOTTY: '...';
DOT: '.';
MINUS: '-';
Expand Down
7 changes: 7 additions & 0 deletions packages/malloy/src/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
ReferenceContext,
StringContext,
TagDefContext,
TagEmptyContext,
TagEqContext,
TagLineContext,
TagReplacePropertiesContext,
Expand Down Expand Up @@ -639,4 +640,10 @@ class TaglineParser
}
return buildOn;
}

visitTagEmpty(ctx: TagEmptyContext): Tag {
const tagList = ctx['buildOn'] as Tag;
tagList.properties = {};
return tagList;
}
}
3 changes: 2 additions & 1 deletion test/src/core/tags.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,13 @@ describe('tagParse to Tag', () => {
},
},
],
['can remove.properties -...', {}],
];
test.each(tagTests)('tag %s', (expression: string, expected: TagDict) => {
expect(expression).tagsAre(expected);
});
test.skip('unskip to debug just one of the expressions', () => {
const x: TagTestTuple = ['x x.y', {x: {properties: {y: {}}}}];
const x: TagTestTuple = ['word -...', {}];
expect(x[0]).tagsAre(x[1]);
});
test('inherits can be over-ridden', () => {
Expand Down

0 comments on commit 0920799

Please sign in to comment.