Skip to content

Commit

Permalink
fix(math-parser): add hex functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ThornWalli committed Jun 5, 2022
1 parent f2672e1 commit c0a0e76
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/web-workbench/classes/MathParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class MathParser {
});
this.#memory.addSub('INT', (a) => {
invalidArgs(a);
return this.parse(a).then(a => parseInt(a));
return this.parse(cleanString(a)).then(a => parseInt(a));
});
this.#memory.addSub('SPC', (a) => {
invalidArgs(a);
Expand Down Expand Up @@ -93,8 +93,15 @@ export default class MathParser {
return Promise.resolve(Date.now());
});

// TODO Hier muss noch!
this.#memory.addSub('HEX$', (a) => {
this.#memory.addSub('HEX_ENC$', (a) => {
invalidArgs(a);
a = Number(cleanString(a)).toString(16);
return Promise.resolve(a);
});

this.#memory.addSub('HEX_DEC$', (a) => {
invalidArgs(a);
a = parseInt(cleanString(a), 16);
return Promise.resolve(a);
});
}
Expand Down

0 comments on commit c0a0e76

Please sign in to comment.