Skip to content

Commit a4ea404

Browse files
committed
Add all fixes.
1 parent 9313a56 commit a4ea404

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
- Updated [Robot](examples/robot.sudo) to improve command dispatching success rate and give the robot a more human-like personality and emotes.
1313

14+
### Deprecated
15+
16+
- The `cup` and `cap` operators are deprecated in favor of `union` and `intersection` due to instability in Claude 3.5. The new `union` and `intersection` keywords were tested in GPT-4o, Claude 3.5, and Llama 3.1 with 100% accuracy.
17+
1418
## SudoLang v1.0.9 -> v1.0.10
1519

1620
### Added

src/extension.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import {
1010
DiagnosticCollection
1111
} from 'vscode';
1212

13-
const disallowedKeywords = ['class', 'inherits', 'extends', 'super'];
13+
const disallowedKeywords = ['class', 'inherits', 'extends', 'super', 'cap', 'cup'];
1414
const warningMessage = "Class inheritance is not a recommended code reuse pattern due to the fragile base class and gorilla banana problems. Prefer interfaces, modules, functions, factory functions, or composition to avoid duplication by necessity.";
15+
const capWarningMessage = "The keyword 'cap' is deprecated in favor of 'intersection' due to instability in Claude 3.5.";
16+
const cupWarningMessage = "The keyword 'cup' is deprecated in favor of 'union' due to instability in Claude 3.5.";
1517

1618
export function activate(context: ExtensionContext) {
1719
const diagnosticCollection = languages.createDiagnosticCollection('sudolang');
@@ -29,9 +31,15 @@ import {
2931
while ((startIndex = line.text.indexOf(keyword, startIndex)) >= 0) {
3032
const range = new Range(lineIndex, startIndex, lineIndex, startIndex + keyword.length);
3133
if (document.getWordRangeAtPosition(range.start, /\b\w+\b/)?.isEqual(range)) {
34+
let message = `The keyword '${keyword}' is discouraged in SudoLang. ${warningMessage}`;
35+
if (keyword === 'cap') {
36+
message = capWarningMessage;
37+
} else if (keyword === 'cup') {
38+
message = cupWarningMessage;
39+
}
3240
const diagnostic = new Diagnostic(
3341
range,
34-
`The keyword '${keyword}' is discouraged in SudoLang. ${warningMessage}`,
42+
message,
3543
DiagnosticSeverity.Warning
3644
);
3745
diagnostics.push(diagnostic);
@@ -52,4 +60,4 @@ import {
5260
}
5361
}
5462

55-
export function deactivate() {}
63+
export function deactivate() {}

sudolang.sudo.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ access = if (age >= 18 && isMember) "granted" else "denied"
6868

6969
All common math operators are supported, including the following:
7070

71-
`+`, `-`, `*`, `/`, `^` (exponent), `%` (remainder), `cap` (``) and `cup` (``)
71+
`+`, `-`, `*`, `/`, `^` (exponent), `%` (remainder), `union` and `intersection`
72+
73+
> Note: The `cup` and `cap` operators are deprecated in favor of `union` and `intersection` due to instability in Claude 3.5.
74+
7275

7376
### Commands
7477

syntaxes/sudolang.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"patterns": [
3131
{
3232
"name": "keyword.control.sudolang",
33-
"match": "\\b(ask|case|concat|convert|constraint|constraints|contains|continue|count|default|defaults|describe|else|emit|empty|error|escape|every|exists|explain|filter|find|first|flatMap|flatten|for each|function|fn|groupBy|if|in|includes|interface|interpolate|join|list|log|loop|map|match|max|merge|min|normalize|orderBy|otherwise|pick|pluck|range|replace|require|requirements|reverse|revise|select|skip|slice|some|sort|sortBy|split|take|takeLast|takeLatest|takeUntil|takeWhile|throw|transpile|trim|unique|warn|warnings|where|while|wrap|zip)\\b"
33+
"match": "\\b(ask|case|concat|constraint|constraints|contains|continue|convert|count|default|defaults|describe|else|emit|empty|error|escape|every|exists|explain|filter|find|first|flatMap|flatten|fn|for each|function|groupBy|if|in|includes|interface|interpolate|intersection|join|list|log|loop|map|match|max|merge|min|normalize|orderBy|otherwise|pick|pluck|range|replace|require|requirements|reverse|revise|select|skip|slice|some|sort|sortBy|split|take|takeLast|takeLatest|takeUntil|takeWhile|throw|transpile|trim|union|unique|warn|warnings|where|while|wrap|zip)\\b"
3434
},
3535
{
3636
"name": "keyword.commands.sudolang",

syntaxes/syntax-test.sudo

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,11 @@ remainder = 17 % 5
144144
result = ((10 + 5) * 3 - (20 / 4)) ^ 2 % 7
145145

146146
// Set Operators
147-
commonFruits = tropicalFruits cap localFruits
148-
allFruits = tropicalFruits cup localFruits
147+
commonFruits = tropicalFruits intersection localFruits
148+
allFruits = tropicalFruits union localFruits
149+
150+
// Note: The `cup` and `cap` operators are deprecated in favor of `union` and `intersection` due to instability in Claude 3.5.
151+
149152

150153
// Combining different operators
151154
finalScore = (baseScore + bonusPoints) * difficultyMultiplier

0 commit comments

Comments
 (0)