Skip to content

Commit 474a7b8

Browse files
committed
many parsing fixes
1 parent 6d97ca5 commit 474a7b8

File tree

8 files changed

+714
-1111
lines changed

8 files changed

+714
-1111
lines changed

CHANGELOG.md

Lines changed: 19 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,61 +8,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
## [Unreleased]
1010
### Breaking Changes
11-
- Spaces is not allowed in hex numbers anymore but undorscores are.
12-
It caused problems since 0xAA B could not be unambiguously parsed (e.g. it can be 0xAAB or 0xAA bytes, so make it explicit by writing 0xAA_B).
11+
- Spaces are not allowed in hex numbers anymore but undorscores are.
12+
It caused problems since 0xAA B could not be unambiguously parsed (e.g. it can be 0xAAB or 0xAA B, where 'B' is a unit for 'bytes', so make it explicit by writing 0xAA_B).
1313
### Features
14-
- Dark Theme
14+
- Dark Theme ![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/1e4fbe68e3e3e0f2b369b29d853881df/D10nAPmBHz.gif)
1515
- Render command optimizations, reducing render command count by around 40%
16-
(gutters, line number- and result abckround now
17-
are rendered only once as a big rectangle and not line by line).
16+
(gutters, line number- and result backround
17+
are now rendered only once as a big rectangle and not line by line).
1818
- Active references (variables and line refs in the cursor's row) are now just underlined
1919
and the referenced lines are not highlighted fully only their left and right gutter.
20-
[gif](https://twitter.com/bodidev/status/1337363000261554182)
20+
(Look at the image below)
21+
- Results where a denominator is a unit (e.g. 5 / year) are now rendered in a more user-friendly way (e.g. instead of `5 year^-1` it is `5 / year`)
22+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/b22cf68c1bb85d890bf1363e55e94435/0.0.3_unit_denom.png)
2123
- Automatic closing parenthesis/braces insertion when the opening one is typed
2224
- Automatic closing parenthesis/braces deletion when the opening one is deleted
25+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/a2b3699e56eb91dd74909091aa903098/0.0.3_parens.gif)
2326
- Automatic parenthesis/braces wrapping around selected text if opening one is typed while
2427
a text is selected
25-
[gif](https://twitter.com/bodidev/status/1338427762831470592)
28+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/a4f947f869a4d4537043cc962551da8f/0.0.3_wrap.gif)
29+
- Matching parenthesis are highlighted if the cursor is inside them
30+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/9efb7959ddc5fde61f395f79f2027d9c/0.0.3_paren_hilight.gif)
2631
- The note can be saved with ``ctrl-s`` (Though it is still saved automatically when there is no user interaction)
27-
- Results where a denominator is a unit (e.g. 5 / year) are now rendered in a moe user-friendly way (e.g. instead of `5 year^-1` it is `5 / year`)
2832
- It is possible to apply units directly on Line References or Variables, e.g.
2933
```
3034
var = 12
3135
var km
3236
```
3337
The result of the second line will be ``12 km``
3438
- Parsing improvement: Now the parser are smarter in deciding what is an operator (e.g. 'in' in `12 m in cm`),
35-
a unit (`12 in` which is 12 inch), or a simple string (`12 GB in 3 seconds`).
39+
a unit (`12 in` which is 12 inch), or a simple string (`I downloaded 12 GB in 3 seconds`).
3640
Now it is even possible to evaluate this string `12 in in in`, which is equivalent of `12 inch in inch`
41+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/1f851d6b80e265dec9b6d055e2ae90b0/0.0.3_smar_parsing.png)
3742
- Percentage calculations
38-
```
39-
## Find the rate when the base and result are known █
40-
20 is what percent of 60 █ 33.3333 %
41-
220 is what percent of 200 █ 110 %
42-
43-
## Find the base when the result and rate are known █
44-
5 is 25% of what █ 20
45-
12 is 12% of what █ 100
46-
47-
## Find the base when the result and increase/decrease are known █
48-
5 is 25% on what █ 4
49-
or in other forms: █
50-
25% on what is 5 █ 4
51-
what plus 25% is 5 █ 4
52-
53-
5 is 25% off what █ 6.6667
54-
or in other forms: █
55-
what minus 25% is 5 █ 6.6667
56-
25% off what is 5 █ 6.6667
57-
58-
## Find the increase/decrease when the base and he result are known █
59-
44 is what % on 40 █ 10 %
60-
24 0 is what % off 300 █ 20 %
61-
```
43+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/7941d87348496a4c9d3841a18a03431f/0.0.3_percentages.png)
6244
- Max row count was increased from 128 to 256
63-
- Matching parenthesis are highlighted if the cursor is inside them
6445
- e (Euler's Number) was added, currently as a function (`e()`)
65-
- new functions:
46+
- Invalid argument types for functions are highlighted as errors (See image below)
47+
- new functions:
48+
![img](https://trello-attachments.s3.amazonaws.com/558a94779b3b3c5d89efeaa6/5fe0ae9f0b9791732fdf6901/e36e81db4efafb92695d8eb7f833a526/0.0.3_functions.png)
6649
- abs(num)
6750
- ln(num)
6851
- lg(num)
@@ -73,7 +56,6 @@ a text is selected
7356
- asin(num) -> angle
7457
- acos(num) -> angle
7558
- atan(num) -> angle
76-
- Invalid argument types for functions are highlighted as errors
7759

7860
### Changed
7961
- When opening a not empty note, the result panel now tries
@@ -91,6 +73,7 @@ to be able to place the cursor at the right place, since the text rendering
9173
- Parenthesis have different color than operators.
9274
- Remove `Vec` and dynamic allocation from unit parsing and operations.
9375
- Replaced all unit `RefCells` to `Rc`, it was a mistake to use `RefCells` in the first place.
76+
- Matrices cannot be deleted anymore by `DEL` or `BACKSPACE`, ctrl is needed
9477

9578
### Fixed
9679
- Dead characters (e.g. '^' on a hungarian keyboard) were not possible to type
@@ -109,7 +92,6 @@ were outside of the editor area
10992
tax B = 50 000/year
11093
(tax A + tax B) * (1 year)
11194
```
112-
- Matrices cannot be deleted anymore by `DEL` or `BACKSPACE`, ctrl is needed
11395
- u64 values can be parsed correctly (e.g. 0xFFFFFFFFFFFFFFFF)
11496
- Bitwise operations now work on u64 values
11597
- Negative numbers can be presented in binary and hex form

assets/fuzz.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ let chance_tab = 0;
2424
let chance_insert_lineref = 0;
2525

2626
let event_history = [];
27+
let sim_time = 0;
2728

2829
function random_float(min, max) {
2930
return Math.random() * (max - min) + min;
@@ -54,7 +55,6 @@ function init() {
5455
chance_undo = rnd_eql();
5556
chance_tab = rnd_eql();
5657
chance_insert_lineref = rnd_eql();
57-
5858
}
5959

6060
function toggle_fuzzing() {
@@ -217,6 +217,9 @@ function simulate_input() {
217217
return false;
218218
}
219219
content_before_event = null;
220+
221+
sim_time += 100;
222+
wasm_bindgen.handle_time(app_ptr, sim_time);
220223
if (event_history.length > 1000) {
221224
console.log("FUZZING RESTART");
222225
// remove the tab

0 commit comments

Comments
 (0)