-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove special-casing for
group(_)
(#3981)
When we originally added `group(_)` to replace unstructured attributes, we treated it as syntactic sugar where `[group(foo1,...,fooN)]` expands internally into `[foo1,...,fooN]`. However, on a second look, this expansion is unnecessary - `group(_)` is only relevant in the `Context` object used by `KILtoKORE` which maps tags in syntax blocks to sets of corresponding `Production`s. In this PR, we then - Remove all the `ProcessGroupAttributes` logic and instead just parse `group(_)` when we build the `Context`. - Remove the special-cased `KeyType.UserGroup` - (Opinionated) Remove the mention of `group(_)` from the "unrecognized attributes" error message. - The hint was useful when we first disallowed unstructured attributes. However, now that `group(_)` and the whitelist are more established, it feels a bit odd to assume any unrecognized attribute is an attempt to create a group. As a side effect of this change, - `syntax` declarations can now only refer to productions by their klabel or group. Previously, any attribute was permitted, and the priority or associativity would apply to everything with that attribute. - Cell properties will no longer expand `<cell group="foo"> </cell>` - This should be disallowed entirely, but see #3982 - We no longer error if a group conflicts with a built-in attribute - Before, this error was required lest `[group(function)]` be treated the same as `[function]`
- Loading branch information
1 parent
67c8ba5
commit f7c33c0
Showing
20 changed files
with
128 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Copyright (c) Runtime Verification, Inc. All Rights Reserved. | ||
module TEST | ||
module CHECKGROUP | ||
syntax Int ::= r"[\\+-]?[0-9]+" [prefer, token, prec(2)] | ||
| Int "+" Int [group(function)] | ||
| Int "+" Int [group(fun,)] | ||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[Error] Compiler: User-defined group 'function' conflicts with a built-in attribute. | ||
[Error] Compiler: group(_) attribute expects a comma separated list of groups, each of which consists of a lower case letter followed by any number of alphanumeric or '-' characters. | ||
Source(checkGroup.k) | ||
Location(4,18,4,47) | ||
4 | | Int "+" Int [group(function)] | ||
. ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Location(4,18,4,43) | ||
4 | | Int "+" Int [group(fun,)] | ||
. ^~~~~~~~~~~~~~~~~~~~~~~~~ |
10 changes: 8 additions & 2 deletions
10
k-distribution/tests/regression-new/checks/checkModuleAtts.k.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
[Error] Compiler: Module cannot have the following attributes: [group] | ||
Source(checkModuleAtts.k) | ||
Location(2,1,3,10) | ||
. v~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
2 | module CHECKMODULEATTS [foo, group(bar), baz] | ||
3 | endmodule | ||
. ~~~~~~~~^ | ||
[Error] Compiler: Unrecognized attributes: [baz, foo] | ||
Hint: User-defined groups can be added with the group(_) attribute. | ||
Source(checkModuleAtts.k) | ||
Location(2,1,3,10) | ||
. v~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
2 | module CHECKMODULEATTS [foo, group(bar), baz] | ||
3 | endmodule | ||
. ~~~~~~~~^ | ||
[Error] Compiler: Had 1 structural errors. | ||
[Error] Compiler: Had 2 structural errors. |
2 changes: 0 additions & 2 deletions
2
k-distribution/tests/regression-new/pedanticAttributes/test.k.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
kernel/src/main/java/org/kframework/compile/ProcessGroupAttributes.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.