@repometry/language-csharp 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repometry/language-csharp",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "C# for the Repometry tree-sitter plugin, with its grammar",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "prepack": "npm run build"
39
39
  },
40
40
  "dependencies": {
41
- "@repometry/core": "0.6.0",
42
- "@repometry/tree-sitter": "0.5.0"
41
+ "@repometry/core": "0.7.0",
42
+ "@repometry/tree-sitter": "0.5.1"
43
43
  }
44
44
  }
@@ -0,0 +1,2 @@
1
+ import type { LanguageSyntax } from '@repometry/core';
2
+ export declare const csharpSyntax: LanguageSyntax;
@@ -0,0 +1,18 @@
1
+ export const csharpSyntax = {
2
+ lineComments: ['//'],
3
+ blockComments: [['/*', '*/']],
4
+ strings: [
5
+ { quote: '@"', end: '"', multiline: true, raw: true, doubleEnd: true },
6
+ { quote: '"""', multiline: true, raw: true },
7
+ { quote: '"' },
8
+ { quote: "'" },
9
+ ],
10
+ stringPrefixes: ['$'],
11
+ keywords: ['abstract', 'as', 'base', 'bool', 'break', 'byte', 'case', 'catch', 'char', 'checked', 'class', 'const',
12
+ 'continue', 'decimal', 'default', 'delegate', 'do', 'double', 'else', 'enum', 'event', 'explicit', 'extern', 'false',
13
+ 'finally', 'fixed', 'float', 'for', 'foreach', 'goto', 'if', 'implicit', 'in', 'int', 'interface', 'internal',
14
+ 'is', 'lock', 'long', 'namespace', 'new', 'null', 'object', 'operator', 'out', 'override', 'params', 'private',
15
+ 'protected', 'public', 'readonly', 'ref', 'return', 'sbyte', 'sealed', 'short', 'sizeof', 'stackalloc', 'static',
16
+ 'string', 'struct', 'switch', 'this', 'throw', 'true', 'try', 'typeof', 'uint', 'ulong', 'unchecked', 'unsafe',
17
+ 'ushort', 'using', 'virtual', 'void', 'volatile', 'while'],
18
+ };
@@ -1,5 +1,6 @@
1
1
  import { measures } from '@repometry/tree-sitter';
2
2
  import manifest from '../resources/grammar.json' with { type: 'json' };
3
+ import { csharpSyntax } from './csharp-syntax.js';
3
4
  const classTypes = ['class_declaration', 'struct_declaration', 'interface_declaration', 'enum_declaration', 'record_declaration'];
4
5
  const functionTypes = [
5
6
  'method_declaration', 'constructor_declaration', 'destructor_declaration', 'local_function_statement',
@@ -105,7 +106,7 @@ const tokens = {
105
106
  ]),
106
107
  };
107
108
  export const csharp = {
108
- language: { id: 'csharp', label: 'C#', color: '#178600', extensions: ['.cs'], measures: [...measures, 'classes'] },
109
+ language: { id: 'csharp', label: 'C#', color: '#178600', extensions: ['.cs'], measures: [...measures, 'classes'], syntax: csharpSyntax },
109
110
  tool: { package: manifest.package, version: manifest.version },
110
111
  asset: new URL('../resources/tree-sitter.wasm', import.meta.url),
111
112
  prepareSource: text => text,