Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/WingedSeal/jmc
Browse files Browse the repository at this point in the history
  • Loading branch information
WingedSeal committed Aug 1, 2023
2 parents 597c076 + f5813e0 commit f109185
Show file tree
Hide file tree
Showing 9 changed files with 719 additions and 36 deletions.
9 changes: 5 additions & 4 deletions src/jmc/compile/command/builtin_function/execute_excluded.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ def _hardcode_parse(calc_pos: int, string: str, token: Token,
elif char == ")":
count -= 1

if char not in {"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "+", "-", "*", "/", " ", "\t", "\n", "(", ")"}:
if char not in {"0", "1", "2", "3", "4", "5", "6", "7",
"8", "9", "+", "-", "*", "/", "\\", "%",
" ", "\t", "\n", "(", ")"}:
raise JMCSyntaxException(
f"Invalid charater({char}) in Hardcode.calc", token, tokenizer, display_col_length=False)
f"Invalid character({char}) in Hardcode.calc", token, tokenizer, display_col_length=False)

expression += char
if count == 0:
Expand All @@ -35,7 +36,7 @@ def _hardcode_parse(calc_pos: int, string: str, token: Token,
raise JMCSyntaxException(
"Invalid syntax in Hardcode.calc", token, tokenizer, display_col_length=False)

return string[:calc_pos] + eval_expr(expression) + string[index + 13:]
return string[:calc_pos] + eval_expr(expression.replace("\\", "//")) + string[index + 13:]


def _hardcode_process(string: str, index_string: str,
Expand Down
Loading

0 comments on commit f109185

Please sign in to comment.