|
|
|
@ -16,7 +16,6 @@ export const circomLanguageConfig = (monaco) => ({ |
|
|
|
|
|
|
|
|
|
onEnterRules: [ |
|
|
|
|
{ |
|
|
|
|
// e.g. /** | */
|
|
|
|
|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, |
|
|
|
|
afterText: /^\s*\*\/$/, |
|
|
|
|
action: { |
|
|
|
@ -25,7 +24,6 @@ export const circomLanguageConfig = (monaco) => ({ |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
// e.g. /** ...|
|
|
|
|
|
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, |
|
|
|
|
action: { |
|
|
|
|
indentAction: monaco.languages.IndentAction.None, |
|
|
|
@ -33,7 +31,6 @@ export const circomLanguageConfig = (monaco) => ({ |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
// e.g. * ...|
|
|
|
|
|
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/, |
|
|
|
|
action: { |
|
|
|
|
indentAction: monaco.languages.IndentAction.None, |
|
|
|
@ -41,7 +38,6 @@ export const circomLanguageConfig = (monaco) => ({ |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
// e.g. */|
|
|
|
|
|
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/, |
|
|
|
|
action: { |
|
|
|
|
indentAction: monaco.languages.IndentAction.None, |
|
|
|
@ -126,18 +122,12 @@ export const circomTokensProvider = { |
|
|
|
|
"<==", |
|
|
|
|
], |
|
|
|
|
|
|
|
|
|
// we include these common regular expressions
|
|
|
|
|
// symbols: /[=><!~?:&|+\-*\/\^%]+/,
|
|
|
|
|
|
|
|
|
|
// C# style strings
|
|
|
|
|
escapes: |
|
|
|
|
/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, |
|
|
|
|
|
|
|
|
|
// The main tokenizer for our languages
|
|
|
|
|
|
|
|
|
|
tokenizer: { |
|
|
|
|
root: [ |
|
|
|
|
// identifiers and keywords
|
|
|
|
|
[ |
|
|
|
|
/[a-z_$][\w$]*/, |
|
|
|
|
{ |
|
|
|
@ -148,41 +138,26 @@ export const circomTokensProvider = { |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
[/[A-Z][\w\$]*/, "type.identifier"], // to show class names nicely
|
|
|
|
|
[/[A-Z][\w\$]*/, "type.identifier"], |
|
|
|
|
|
|
|
|
|
// whitespace
|
|
|
|
|
{ include: "@whitespace" }, |
|
|
|
|
|
|
|
|
|
// delimiters and operators
|
|
|
|
|
[/[{}()\[\]]/, "@brackets"], |
|
|
|
|
|
|
|
|
|
// [/[<>](?!@symbols)/, "@brackets"],
|
|
|
|
|
// [
|
|
|
|
|
// /@symbols/,
|
|
|
|
|
// { cases: { "@operators": "operator", "@default": "" } },
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
|
|
// @ annotations.
|
|
|
|
|
// As an example, we emit a debugging log message on these tokens.
|
|
|
|
|
// Note: message are supressed during the first load -- change some lines to see them.
|
|
|
|
|
[ |
|
|
|
|
/@\s*[a-zA-Z_\$][\w\$]*/, |
|
|
|
|
{ token: "annotation", log: "annotation token: $0" }, |
|
|
|
|
], |
|
|
|
|
|
|
|
|
|
// numbers
|
|
|
|
|
[/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], |
|
|
|
|
[/0[xX][0-9a-fA-F]+/, "number.hex"], |
|
|
|
|
[/\d+/, "number"], |
|
|
|
|
|
|
|
|
|
// delimiter: after number because of .\d floats
|
|
|
|
|
[/[;,.]/, "delimiter"], |
|
|
|
|
|
|
|
|
|
// strings
|
|
|
|
|
[/"([^"\\]|\\.)*$/, "string.invalid"], // non-teminated string
|
|
|
|
|
[/"([^"\\]|\\.)*$/, "string.invalid"], |
|
|
|
|
[/"/, { token: "string.quote", bracket: "@open", next: "@string" }], |
|
|
|
|
|
|
|
|
|
// characters
|
|
|
|
|
[/'[^\\']'/, "string"], |
|
|
|
|
[/(')(@escapes)(')/, ["string", "string.escape", "string"]], |
|
|
|
|
[/'/, "string.invalid"], |
|
|
|
@ -190,7 +165,7 @@ export const circomTokensProvider = { |
|
|
|
|
|
|
|
|
|
comment: [ |
|
|
|
|
[/[^\/*]+/, "comment"], |
|
|
|
|
[/\/\*/, "comment", "@push"], // nested comment
|
|
|
|
|
[/\/\*/, "comment", "@push"], |
|
|
|
|
["\\*/", "comment", "@pop"], |
|
|
|
|
[/[\/*]/, "comment"], |
|
|
|
|
], |
|
|
|
|