Skip to content

Commit

Permalink
fix(tokenizer): harden WGSL detection (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Nov 8, 2023
1 parent 3f5e959 commit 8898b39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export interface Token<T = TokenType, V = string> {
value: V
}

// Checks for WGSL-specific `fn foo(`, `var bar =`, and `let baz =`
const isWGSL = RegExp.prototype.test.bind(/\bfn\s+\w+\s*\(|\b(var|let)\s+\w+\s*[:=]/)
// Checks for WGSL-specific `fn foo(`, `var bar =`, `let baz =`, `const qux =`
const isWGSL = RegExp.prototype.test.bind(/\bfn\s+\w+\s*\(|\b(var|let|const)\s+\w+\s*[:=]/)

const isFloat = RegExp.prototype.test.bind(/^(\d+\.\d*|\d*\.\d+)([eEpP][-+]?\d+)?[fFhH]?$/)
const isInt = RegExp.prototype.test.bind(/^(0[xX][\w\d]+|\d+)[iIuU]?$/)
Expand Down

0 comments on commit 8898b39

Please sign in to comment.