未验证 提交 282af06c 编写于 作者: A Alexandru Dima 提交者: GitHub

Merge pull request #57439 from Geloosa/monarch-language-types

shorthand types for Monarch language action
......@@ -40,13 +40,15 @@ export interface IMonarchLanguage {
tokenPostfix?: string;
}
export type IShortMonarchLanguageRule1 = [RegExp, string | IMonarchLanguageAction];
export type IShortMonarchLanguageRule2 = [RegExp, string | IMonarchLanguageAction, string];
/**
* A rule is either a regular expression and an action
* shorthands: [reg,act] == { regex: reg, action: act}
* and : [reg,act,nxt] == { regex: reg, action: act{ next: nxt }}
*/
export type IShortMonarchLanguageRule1 = [RegExp, IMonarchLanguageAction];
export type IShortMonarchLanguageRule2 = [RegExp, IMonarchLanguageAction, string];
export interface IExpandedMonarchLanguageRule {
/**
* match tokens
......@@ -62,24 +64,27 @@ export interface IExpandedMonarchLanguageRule {
*/
include?: string;
}
export type IMonarchLanguageRule = IShortMonarchLanguageRule1 | IShortMonarchLanguageRule2 | IExpandedMonarchLanguageRule;
export type IMonarchLanguageRule = IShortMonarchLanguageRule1
| IShortMonarchLanguageRule2
| IExpandedMonarchLanguageRule;
/**
* An action is either an array of actions...
* ... or a case statement with guards...
* ... or a basic action with a token value.
*/
export interface IMonarchLanguageAction {
export type IShortMonarchLanguageAction = string;
export interface IExpandedMonarchLanguageAction {
/**
* array of actions for each parenthesized match group
*/
group?: IMonarchLanguageAction[];
/**
* map from string to ILanguageAction
*/
cases?: Object;
/**
* token class (ie. css class) (or "@brackets" or "@rematch")
*/
......@@ -110,6 +115,11 @@ export interface IMonarchLanguageAction {
log?: string;
}
export type IMonarchLanguageAction = IShortMonarchLanguageAction
| IExpandedMonarchLanguageAction
| IShortMonarchLanguageAction[]
| IExpandedMonarchLanguageAction[];
/**
* This interface can be shortened as an array, ie. ['{','}','delimiter.curly']
*/
......@@ -126,4 +136,4 @@ export interface IMonarchLanguageBracket {
* token class
*/
token: string;
}
}
\ No newline at end of file
......@@ -5398,15 +5398,15 @@ declare namespace monaco.languages {
tokenPostfix?: string;
}
export type IShortMonarchLanguageRule1 = [RegExp, string | IMonarchLanguageAction];
export type IShortMonarchLanguageRule2 = [RegExp, string | IMonarchLanguageAction, string];
/**
* A rule is either a regular expression and an action
* shorthands: [reg,act] == { regex: reg, action: act}
* and : [reg,act,nxt] == { regex: reg, action: act{ next: nxt }}
*/
export type IShortMonarchLanguageRule1 = [RegExp, IMonarchLanguageAction];
export type IShortMonarchLanguageRule2 = [RegExp, IMonarchLanguageAction, string];
export interface IExpandedMonarchLanguageRule {
/**
* match tokens
......@@ -5429,7 +5429,9 @@ declare namespace monaco.languages {
* ... or a case statement with guards...
* ... or a basic action with a token value.
*/
export interface IMonarchLanguageAction {
export type IShortMonarchLanguageAction = string;
export interface IExpandedMonarchLanguageAction {
/**
* array of actions for each parenthesized match group
*/
......@@ -5468,6 +5470,8 @@ declare namespace monaco.languages {
log?: string;
}
export type IMonarchLanguageAction = IShortMonarchLanguageAction | IExpandedMonarchLanguageAction | IShortMonarchLanguageAction[] | IExpandedMonarchLanguageAction[];
/**
* This interface can be shortened as an array, ie. ['{','}','delimiter.curly']
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册