@codingame/monaco-vscode-editor-api 20.1.1 → 20.2.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.
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Create a syntax highighter with a fully declarative JSON style lexer description
3
+ * using regular expressions.
4
+ */
1
5
  import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
6
  import * as languages from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages";
3
7
  import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
@@ -1,16 +1,52 @@
1
+ /**
2
+ * A Monarch language definition
3
+ */
1
4
  export interface IMonarchLanguage {
5
+ /**
6
+ * map from string to ILanguageRule[]
7
+ */
2
8
  tokenizer: {
3
9
  [name: string]: IMonarchLanguageRule[];
4
10
  };
11
+ /**
12
+ * is the language case insensitive?
13
+ */
5
14
  ignoreCase?: boolean;
15
+ /**
16
+ * is the language unicode-aware? (i.e., /\u{1D306}/)
17
+ */
6
18
  unicode?: boolean;
19
+ /**
20
+ * if no match in the tokenizer assign this token class (default 'source')
21
+ */
7
22
  defaultToken?: string;
23
+ /**
24
+ * for example [['{','}','delimiter.curly']]
25
+ */
8
26
  brackets?: IMonarchLanguageBracket[];
27
+ /**
28
+ * start symbol in the tokenizer (by default the first entry is used)
29
+ */
9
30
  start?: string;
31
+ /**
32
+ * attach this to every token class (by default '.' + name)
33
+ */
10
34
  tokenPostfix?: string;
35
+ /**
36
+ * include line feeds (in the form of a \n character) at the end of lines
37
+ * Defaults to false
38
+ */
11
39
  includeLF?: boolean;
40
+ /**
41
+ * Other keys that can be referred to by the tokenizer.
42
+ */
12
43
  [key: string]: any;
13
44
  }
45
+ /**
46
+ * A rule is either a regular expression and an action
47
+ * shorthands: [reg,act] == { regex: reg, action: act}
48
+ * and : [reg,act,nxt] == { regex: reg, action: act{ next: nxt }}
49
+ */
14
50
  export type IShortMonarchLanguageRule1 = [
15
51
  string | RegExp,
16
52
  IMonarchLanguageAction
@@ -21,26 +57,79 @@ export type IShortMonarchLanguageRule2 = [
21
57
  string
22
58
  ];
23
59
  export interface IExpandedMonarchLanguageRule {
60
+ /**
61
+ * match tokens
62
+ */
24
63
  regex?: string | RegExp;
64
+ /**
65
+ * action to take on match
66
+ */
25
67
  action?: IMonarchLanguageAction;
68
+ /**
69
+ * or an include rule. include all rules from the included state
70
+ */
26
71
  include?: string;
27
72
  }
28
73
  export type IMonarchLanguageRule = IShortMonarchLanguageRule1 | IShortMonarchLanguageRule2 | IExpandedMonarchLanguageRule;
74
+ /**
75
+ * An action is either an array of actions...
76
+ * ... or a case statement with guards...
77
+ * ... or a basic action with a token value.
78
+ */
29
79
  export type IShortMonarchLanguageAction = string;
30
80
  export interface IExpandedMonarchLanguageAction {
81
+ /**
82
+ * array of actions for each parenthesized match group
83
+ */
31
84
  group?: IMonarchLanguageAction[];
85
+ /**
86
+ * map from string to ILanguageAction
87
+ */
32
88
  cases?: Object;
89
+ /**
90
+ * token class (ie. css class) (or "@brackets" or "@rematch")
91
+ */
33
92
  token?: string;
93
+ /**
94
+ * the next state to push, or "@push", "@pop", "@popall"
95
+ */
34
96
  next?: string;
97
+ /**
98
+ * switch to this state
99
+ */
35
100
  switchTo?: string;
101
+ /**
102
+ * go back n characters in the stream
103
+ */
36
104
  goBack?: number;
105
+ /**
106
+ * @open or @close
107
+ */
37
108
  bracket?: string;
109
+ /**
110
+ * switch to embedded language (using the mimetype) or get out using "@pop"
111
+ */
38
112
  nextEmbedded?: string;
113
+ /**
114
+ * log a message to the browser console window
115
+ */
39
116
  log?: string;
40
117
  }
41
118
  export type IMonarchLanguageAction = IShortMonarchLanguageAction | IExpandedMonarchLanguageAction | (IShortMonarchLanguageAction | IExpandedMonarchLanguageAction)[];
119
+ /**
120
+ * This interface can be shortened as an array, ie. ['{','}','delimiter.curly']
121
+ */
42
122
  export interface IMonarchLanguageBracket {
123
+ /**
124
+ * open bracket
125
+ */
43
126
  open: string;
127
+ /**
128
+ * closing bracket
129
+ */
44
130
  close: string;
131
+ /**
132
+ * token class
133
+ */
45
134
  token: string;
46
135
  }