Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
najmiter authored Jan 16, 2024
1 parent 640f1e5 commit ffcc56d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ const is_space = (char) => char === ' ' || char === '\t';

const notation_ok = (token) => {
token = token.toLowerCase();
return (
(!isNaN(token.charAt(token.length - 1)) && !isNaN(token)) || // because then all of it should be digits
token.endsWith("d") ||
token.endsWith("b") ||
token.endsWith("h")
);
const rest = token.substring(0, token.length - 1);

if (token.endsWith("h")) {
token = `0x${rest}`;
} else if (token.endsWith("b")) {
token = `0b${rest}`;
} else if (token.endsWith("d")) {
token = rest;
}
return !isNaN(token);
};

const razor = (line) => {
Expand Down

0 comments on commit ffcc56d

Please sign in to comment.