Skip to content

Commit

Permalink
feat: skip space compatible with multiple line
Browse files Browse the repository at this point in the history
  • Loading branch information
Sway007 committed Jan 8, 2025
1 parent 3748049 commit 6cd03dd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/shader-lab/src/common/BaseScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,18 @@ export default class BaseScanner {
}

skipSpace(includeLineBreak: boolean): void {
const chars = this.peek(2);
let curChar = chars[0];
let curChar: string;

while (includeLineBreak) {
const chars = this.peek(2);
curChar = chars[0];

if (includeLineBreak) {
if (chars === "\r\n") {
this.advance(2);

Check warning on line 111 in packages/shader-lab/src/common/BaseScanner.ts

View check run for this annotation

Codecov / codecov/patch

packages/shader-lab/src/common/BaseScanner.ts#L111

Added line #L111 was not covered by tests
} else if (curChar === "\n" || curChar === "\r") {
this.advance(1);
} else {
break;
}
}

Expand Down

0 comments on commit 6cd03dd

Please sign in to comment.