Skip to content

Commit

Permalink
Fix for #9: C-style comments
Browse files Browse the repository at this point in the history
  • Loading branch information
maziac committed Nov 21, 2020
1 parent cbc2b53 commit bf6a808
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.0.2
- Allowed for "//" C-style comments (fix by oxidaan)

## 1.0.1
- Added donate button.

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "z80-instruction-set",
"displayName": "Z80 Instruction Set",
"version": "1.0.1",
"version": "1.0.2",
"publisher": "maziac",
"description": "Provides documentation of the Z80 instructions on hovering.",
"author": {
Expand Down
13 changes: 10 additions & 3 deletions src/HoverUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ export function extractInstruction(line: string, index: number): string {
pos++;
let rightString = line.substr(pos);

// Now find end of instruction, i.e. until ";" or ":"
let len = 0;
// Now find end of instruction, i.e. until ";", "//" or ":"
let len=0;
let prev='';
for (const ch of rightString) {
if (ch == ';' || ch == ':')
if (ch==';' || ch==':')
break;
if (ch=='/' && prev=='/') {
// C-style comment "//" // // is c++ style comment
len--;
break;
}
prev=ch;
len++;
}
let rawInstruction = rightString.substr(0, len).trim().toUpperCase();
Expand Down

0 comments on commit bf6a808

Please sign in to comment.