Skip to content

Commit 45146ee

Browse files
committed
Fixed a bunch of issues with the extension
1 parent c8e6b77 commit 45146ee

5 files changed

Lines changed: 55 additions & 12 deletions

File tree

ext/andy-cpp/CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
# Change Log
22

3-
## [v0.0.6] (2024-10-11)
3+
## [v0.1.0] (2024-12-30)
4+
5+
This release probably still has bugs but it seems to display all 2024 Advent of Code puzzles correctly,
6+
which is the point of the 0.1.0 release.
7+
8+
- Fixed detection of lots of operators like `<` and `>`
9+
- `%=` and `%%=` are detected correctly
10+
- Identify variables and punctuation like `,` and `:`
11+
12+
## [v0.0.6] (2024-12-11)
413

514
- Fixed some issues with arbitrary base literals not getting parsed correctly
615
- Correctly detect augmented assignment operators like `++=`
716
- Detect `<>` and `++` as special non arithmetic operators
817

9-
## [v0.0.5] (2024-10-11)
18+
## [v0.0.5] (2024-12-11)
1019

1120
- Fixed an issue with `.` operator's capture groups incorrectly parsing methods as operators
1221

ext/andy-cpp/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#!/bin/fish
22

3-
43
docker run -v (pwd):/build -w /build -it timfennis/vsce package

ext/andy-cpp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/timfennis/andy-cpp.git"
88
},
99
"publisher": "TimFennis",
10-
"version": "0.0.6",
10+
"version": "0.1.0",
1111
"engines": {
1212
"vscode": "^1.85.0"
1313
},

ext/andy-cpp/syntaxes/andy-cpp.tmLanguage.json

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
{
3737
"include": "#keywords"
3838
},
39+
{
40+
"include": "#variables"
41+
},
42+
{
43+
"include": "#punctuation"
44+
},
3945
{
4046
"include": "#comment"
4147
}
@@ -133,6 +139,11 @@
133139
"match": "\\b([0-9][0-9_]*)\\b",
134140
"name": "constant.numeric.decimal.andy-cpp"
135141
},
142+
{
143+
"comment": "Infinity",
144+
"match": "\\bInf\\b",
145+
"name": "constant.numeric.infinity.andy-cpp"
146+
},
136147
{
137148
"comment": "booleans",
138149
"name": "constant.language.bool.andy-cpp",
@@ -216,7 +227,7 @@
216227
{
217228
"comment": "augmented assignment operators",
218229
"name": "keyword.operator.assignment.andy-cpp",
219-
"match": "((\\+\\+?|-|\\*|/|\\|\\^|&|\\||<<|>>|~|<>)=)"
230+
"match": "((\\+\\+?|-|\\*|/|\\|\\^|&|\\||%%?|<<|>>|~|<>)=)"
220231
},
221232
{
222233
"comment": "function augmented assignment opreators",
@@ -229,20 +240,20 @@
229240
"match": "(?<![<>])=(?!=|>)"
230241
},
231242
{
232-
"comment": "comparison operators",
233-
"name": "keyword.operator.comparison.andy-cpp",
234-
"match": "(>=<|<=>|=(=)?(?!>)|!=|<=|(?<!=)>=)"
235-
},
236-
{
237-
"comment": "math operators",
243+
"comment": "concatenation operators",
238244
"name": "keyword.operator.other.andy-cpp",
239245
"match": "(\\+\\+|<>)"
240246
},
241247
{
242-
"comment": "math operators",
248+
"comment": "binary operators",
243249
"name": "keyword.operator.arithmetic.andy-cpp",
244250
"match": "(\\+|\\-|\\*|/(?!\\/)|\\\\|\\^|\\%%?|>>|<<|&(?!&)|\\|(?!\\|)|~)"
245251
},
252+
{
253+
"comment": "comparison operators",
254+
"name": "keyword.operator.comparison.andy-cpp",
255+
"match": "(>=<|<=>|=(=)?(?!>)|!=|<=|(?<!=)>=|>|<)"
256+
},
246257
{
247258
"name": "punctuation.semicolon.andy-cpp",
248259
"match": ";"
@@ -282,6 +293,11 @@
282293
}
283294
},
284295
"patterns": [
296+
{
297+
"comment": "Key value separator",
298+
"name": "punctuation.separator.dictionary.andy-cpp",
299+
"match": ":"
300+
},
285301
{
286302
"include": "#expression"
287303
}
@@ -345,6 +361,24 @@
345361
"name": "constant.character.escape.andy-cpp"
346362
}
347363
}
364+
},
365+
"variables": {
366+
"patterns": [
367+
{
368+
"comment": "variables",
369+
"name": "variable.other.andy-cpp",
370+
"match": "\\b[a-z_][a-z0-9_]*\\b"
371+
}
372+
]
373+
},
374+
"punctuation": {
375+
"patterns": [
376+
{
377+
"comment": "comma",
378+
"name": "punctuation.comma.andy-cpp",
379+
"match": ","
380+
}
381+
]
348382
}
349383
},
350384
"scopeName": "source.andy-cpp"

src/interpreter/evaluate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ pub(crate) fn evaluate_expression(
590590
lhs_expr.span.merge(index_expr.span),
591591
)?;
592592

593+
// TODO: This borrow_mut can fail, handle it better!!
593594
dict.borrow_mut().insert(key, default_value.clone());
594595

595596
Ok(default_value)

0 commit comments

Comments
 (0)