Skip to content

OfflineAssembler: Avoid accidental toString operation #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions RexBench/OfflineAssembler/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ function isInteger(token)

function isString(token)
{
return /^".*"/.test(token);
return /^".*"/.test(token.string);
}


Expand Down Expand Up @@ -426,7 +426,7 @@ class Parser
{
let result;
if (isRegister(this.tokens[this.idx])) {
if (fprPattern.test(this.tokens[this.idx]))
if (fprPattern.test(this.tokens[this.idx].string))
result = FPRegisterID.forName(this.tokens[this.idx].codeOrigin, this.tokens[this.idx].string);
else
result = RegisterID.forName(this.tokens[this.idx].codeOrigin, this.tokens[this.idx].string);
Expand Down Expand Up @@ -813,7 +813,7 @@ class Parser
let codeOrigin = this.tokens[this.idx].codeOrigin;
let name = this.tokens[this.idx].string;
this.idx++;
if ((!final && this.idx == this.tokens.size) || (final && final.test(this.tokens[this.idx]))) {
if ((!final && this.idx == this.tokens.size) || (final && final.test(this.tokens[this.idx].string))) {
// Zero operand instruction, and it's the last one.
list.push(new Instruction(codeOrigin, name, [], this.annotation));
this.annotation = null;
Expand Down Expand Up @@ -935,7 +935,7 @@ class Parser
let fileList = [];
fileList.push(this.tokens[this.idx].codeOrigin.fileName);
while (true) {
if ((this.idx == this.tokens.length && !final) || (final && final.test(this.tokens[this.idx])))
if ((this.idx == this.tokens.length && !final) || (final && final.test(this.tokens[this.idx].string)))
break;
else if (this.tokens[this.idx].isEqualTo("include")) {
this.idx++;
Expand Down