diff --git a/examples/eslint.config.mjs b/examples/eslint.config.mjs index 37b3384be28..777155eb74e 100644 --- a/examples/eslint.config.mjs +++ b/examples/eslint.config.mjs @@ -22,7 +22,9 @@ export default [ 'assets/scripts/utils/area-light-lut-bin-gen.js', 'cache', 'dist', - 'src/lib' + 'src/lib', + 'src/app/monaco/languages', + 'src/app/monaco/tokenizer-rules.mjs' ] } ]; diff --git a/examples/src/app/monaco/languages/glsl.mjs b/examples/src/app/monaco/languages/glsl.mjs index d54a14eee8a..851a78349ab 100644 --- a/examples/src/app/monaco/languages/glsl.mjs +++ b/examples/src/app/monaco/languages/glsl.mjs @@ -15,7 +15,7 @@ export const conf = { { open: '[', close: ']' }, { open: '{', close: '}' }, { open: '(', close: ')' }, - { open: '\'', close: '\'', notIn: ['string', 'comment'] }, + { open: "'", close: "'", notIn: ['string', 'comment'] }, { open: '"', close: '"', notIn: ['string'] } ], surroundingPairs: [ @@ -23,7 +23,7 @@ export const conf = { { open: '[', close: ']' }, { open: '(', close: ')' }, { open: '"', close: '"' }, - { open: '\'', close: '\'' } + { open: "'", close: "'" } ] }; @@ -212,17 +212,17 @@ export const language = { '>>=', '>>>=' ], - symbols: /[=>^|_~]+/, + symbols: /[!%&*+\-\.\/:;<=>^|_~]+/, tokenizer: { root: [ @@ -402,7 +402,7 @@ export const language = { [/;:\./, 'delimiter'], [/,/, 'delimiter'], // Hack: Should be in previous rule - [/[{}()[\]]/, '@brackets'], + [/[{}()\[\]]/, '@brackets'], ['@', 'annotation', '@attribute'], [ /@symbols/, @@ -424,13 +424,13 @@ export const language = { blockComment: [ // Soak up uninteresting text: anything except * or / - [/[^/*]+/, 'comment'], + [/[^\/*]+/, 'comment'], // Recognize the start of a nested block comment. [/\/\*/, 'comment', '@push'], // Recognize the end of a nested block comment. [/\*\//, 'comment', '@pop'], // Recognize insignificant * and / - [/[/*]/, 'comment'] + [/[\/*]/, 'comment'] ], attribute: [ @@ -457,19 +457,19 @@ export const language = { // 0, with type-specifying suffix. [/0[fh]/, 'number.float'], // Other decimal integer, with type-specifying suffix. - [/[1-9]\d*[fh]/, 'number.float'], + [/[1-9][0-9]*[fh]/, 'number.float'], // Has decimal point, at least one digit after decimal. - [/\d*\.\d+([eE][+-]?\d+)?[fh]?/, 'number.float'], + [/[0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[fh]?/, 'number.float'], // Has decimal point, at least one digit before decimal. - [/\d+\.\d*([eE][+-]?\d+)?[fh]?/, 'number.float'], + [/[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?[fh]?/, 'number.float'], // Has at least one digit, and has an exponent. - [/\d+[eE][+-]?\d+[fh]?/, 'number.float'], + [/[0-9]+[eE][+-]?[0-9]+[fh]?/, 'number.float'], // Hex float literals // https://www.w3.org/TR/WGSL/#syntax-hex_float_literal - [/0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+(?:[pP][+-]?\d+[fh]?)?/, 'number.hex'], - [/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*(?:[pP][+-]?\d+[fh]?)?/, 'number.hex'], - [/0[xX][0-9a-fA-F]+[pP][+-]?\d+[fh]?/, 'number.hex'], + [/0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+(?:[pP][+-]?[0-9]+[fh]?)?/, 'number.hex'], + [/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*(?:[pP][+-]?[0-9]+[fh]?)?/, 'number.hex'], + [/0[xX][0-9a-fA-F]+[pP][+-]?[0-9]+[fh]?/, 'number.hex'], // Hexadecimal integer literals // https://www.w3.org/TR/WGSL/#syntax-hex_int_literal @@ -478,8 +478,8 @@ export const language = { // Decimal integer literals // https://www.w3.org/TR/WGSL/#syntax-decimal_int_literal // We need two rules here because 01 is not valid. - [/[1-9]\d*[iu]?/, 'number'], + [/[1-9][0-9]*[iu]?/, 'number'], [/0[iu]?/, 'number'] // Must match last ] } -}; +}; \ No newline at end of file diff --git a/examples/src/app/monaco/tokenizer-rules.mjs b/examples/src/app/monaco/tokenizer-rules.mjs index e6b8c6753fe..aaad7b5a9ab 100644 --- a/examples/src/app/monaco/tokenizer-rules.mjs +++ b/examples/src/app/monaco/tokenizer-rules.mjs @@ -7,9 +7,9 @@ export const jsRules = { [/./, 'comment.doc'] ], jsdocBrackets: [ - [/(@link)([^}]+)/, ['keyword', 'identifier']], + [/([@]link)(\s*[^\}]+)/, ['keyword', 'identifier']], [/\{/, 'comment.doc', '@push'], [/\}/, 'comment.doc', '@pop'], [/./, 'type.identifier'] ] -}; +}; \ No newline at end of file