Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2276d38
Vala
DmitrySharabin May 27, 2025
96a1366
Firestore security rules
DmitrySharabin May 27, 2025
6ffb7dc
Xeora
DmitrySharabin May 28, 2025
117848b
Flow
DmitrySharabin May 28, 2025
b4d3186
Wiki
DmitrySharabin May 28, 2025
b9268b0
V
DmitrySharabin May 28, 2025
763e2a1
Velocity
DmitrySharabin May 28, 2025
fbee503
glsl
DmitrySharabin May 28, 2025
7111d97
gml
DmitrySharabin May 28, 2025
3563429
Go
DmitrySharabin May 28, 2025
9887b42
gradle
DmitrySharabin May 28, 2025
58b3f9a
groovy
DmitrySharabin May 28, 2025
f93c836
haxe
DmitrySharabin May 28, 2025
ca7729a
kotlin
DmitrySharabin May 28, 2025
ae16a15
javadoc
DmitrySharabin May 28, 2025
cf50ee3
squirrel
DmitrySharabin May 28, 2025
3e76dc8
hlsl
DmitrySharabin May 28, 2025
6e83d98
idris
DmitrySharabin May 28, 2025
ed773b5
json5
DmitrySharabin May 28, 2025
abf2d62
jsonp
DmitrySharabin May 28, 2025
9a87359
less
DmitrySharabin May 28, 2025
42ba110
n4js
DmitrySharabin May 28, 2025
08ebab7
objectivec
DmitrySharabin May 28, 2025
e52c094
opencl
DmitrySharabin May 28, 2025
7d60552
sqf
DmitrySharabin May 28, 2025
6047ce6
sparql
DmitrySharabin May 28, 2025
c383134
solidity
DmitrySharabin May 28, 2025
222481b
scala
DmitrySharabin May 28, 2025
5183bbc
reason
DmitrySharabin May 28, 2025
ccb3d6a
racket
DmitrySharabin May 28, 2025
427dca0
qore
DmitrySharabin May 28, 2025
4f0f2a2
purescript
DmitrySharabin May 28, 2025
190307e
purebasic
DmitrySharabin May 28, 2025
d2ccfb0
protobuf
DmitrySharabin May 28, 2025
cbd86e2
processing
DmitrySharabin May 28, 2025
cdb1819
plsql
DmitrySharabin May 28, 2025
1b597a2
phpdoc
DmitrySharabin May 28, 2025
67658e6
mongodb
DmitrySharabin May 28, 2025
28c19b6
jolie
DmitrySharabin May 28, 2025
e062955
latte
DmitrySharabin May 28, 2025
c995387
parser
DmitrySharabin May 28, 2025
9f5ae15
textile
DmitrySharabin May 28, 2025
7900d65
qsharp
DmitrySharabin May 28, 2025
b53c26d
ruby
DmitrySharabin May 28, 2025
9f99a67
sass
DmitrySharabin May 28, 2025
f4e27b3
scss
DmitrySharabin May 28, 2025
bdb73f0
xquery
DmitrySharabin May 28, 2025
47abee3
http
DmitrySharabin May 28, 2025
c0d0421
haml
DmitrySharabin May 28, 2025
fdf22de
rescript
DmitrySharabin May 28, 2025
3c8263d
Address feedback: use `$insert`–`$before` syntactic sugar
DmitrySharabin May 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 31 additions & 34 deletions src/languages/firestore-security-rules.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
import { insertBefore } from '../util/insert';
import clike from './clike';
import type { LanguageProto } from '../types';
import type { Grammar, LanguageProto } from '../types';

export default {
id: 'firestore-security-rules',
require: clike,
grammar ({ extend }) {
const fsr = extend('clike', {
base: clike,
grammar (): Grammar {
return {
'comment': /\/\/.*/,
'keyword': /\b(?:allow|function|if|match|null|return|rules_version|service)\b/,
'operator': /&&|\|\||[<>!=]=?|[-+*/%]|\b(?:in|is)\b/,
});

delete fsr['class-name'];

insertBefore(fsr, 'keyword', {
'path': {
pattern:
/(^|[\s(),])(?:\/(?:[\w\xA0-\uFFFF]+|\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)))+/,
lookbehind: true,
greedy: true,
inside: {
'variable': {
pattern: /\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)/,
$insertBefore: {
'keyword': {
'path': {
pattern:
/(^|[\s(),])(?:\/(?:[\w\xA0-\uFFFF]+|\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)))+/,
lookbehind: true,
greedy: true,
inside: {
'operator': /=/,
'keyword': /\*\*/,
'punctuation': /[.$(){}]/,
'variable': {
pattern: /\{[\w\xA0-\uFFFF]+(?:=\*\*)?\}|\$\([\w\xA0-\uFFFF.]+\)/,
inside: {
'operator': /=/,
'keyword': /\*\*/,
'punctuation': /[.$(){}]/,
},
},
'punctuation': /\//,
},
},
'method': {
// to make the pattern shorter, the actual method names are omitted
pattern: /(\ballow\s+)[a-z]+(?:\s*,\s*[a-z]+)*(?=\s*[:;])/,
lookbehind: true,
alias: 'builtin',
inside: {
'punctuation': /,/,
},
},
'punctuation': /\//,
},
},
'method': {
// to make the pattern shorter, the actual method names are omitted
pattern: /(\ballow\s+)[a-z]+(?:\s*,\s*[a-z]+)*(?=\s*[:;])/,
lookbehind: true,
alias: 'builtin',
inside: {
'punctuation': /,/,
},
},
});

return fsr;
$delete: ['class-name'],
};
},
} as LanguageProto<'firestore-security-rules'>;
55 changes: 26 additions & 29 deletions src/languages/flow.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { insertBefore } from '../util/insert';
import { toArray } from '../util/iterables';
import javascript from './javascript';
import type { GrammarToken, LanguageProto } from '../types';
import type { Grammar, LanguageProto } from '../types';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me point you to the languages I'd love you to review.

The first in this one—Flow. The reason: I used base and $merge here.


export default {
id: 'flow',
require: javascript,
grammar ({ extend, getLanguage }) {
const javascript = getLanguage('javascript');
const flow = extend('javascript', {
base: javascript,
grammar ({ base }) {
return {
'keyword': [
{
pattern: /(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,
Expand All @@ -19,31 +17,30 @@ export default {
/(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,
lookbehind: true,
},
...toArray(javascript['keyword']),
...toArray(base!['keyword']),
],
});

insertBefore(flow, 'keyword', {
'type': {
pattern:
/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,
alias: 'class-name',
$insertBefore: {
'operator': {
'flow-punctuation': {
pattern: /\{\||\|\}/,
alias: 'punctuation',
},
},
'keyword': {
'type': {
pattern:
/\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|[Ss]ymbol|any|mixed|null|void)\b/,
alias: 'class-name',
},
},
},
});

insertBefore(flow, 'operator', {
'flow-punctuation': {
pattern: /\{\||\|\}/,
alias: 'punctuation',
$merge: {
'function-variable': {
pattern:
/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i,
},
},
});

const fnVariable = flow['function-variable'] as GrammarToken;
fnVariable.pattern =
/(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i;

delete flow['parameter'];

return flow;
$delete: ['parameter'],
} as unknown as Grammar;
},
} as LanguageProto<'flow'>;
8 changes: 4 additions & 4 deletions src/languages/glsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import type { LanguageProto } from '../types';

export default {
id: 'glsl',
require: c,
grammar ({ extend }) {
return extend('c', {
base: c,
grammar () {
return {
'keyword':
/\b(?:active|asm|atomic_uint|attribute|bool|break|buffer|[ibdu]?vec[234]|case|cast|centroid|class|coherent|common|const|continue|default|discard|d?mat[234](?:x[234])?|do|double|else|enum|extern|external|false|filter|fixed|flat|float|for|fvec[234]|goto|half|highp|hvec[234]|if|[iu]?image[123]D|[iu]?image[12]DArray|[iu]?image2DMS(?:Array)?|[iu]?image2DRect|[iu]?imageBuffer|[iu]?imageCube|[iu]?imageCubeArray|in|inline|inout|input|int|interface|invariant|[iu]?sampler[123]D|[iu]?sampler[12]DArray|[iu]?sampler2DMS(?:Array)?|[iu]?sampler2DRect|[iu]?samplerBuffer|[iu]?samplerCube|[iu]?samplerCubeArray|layout|long|lowp|mediump|namespace|noinline|noperspective|out|output|partition|patch|precise|precision|public|readonly|resource|restrict|return|sample|sampler[12]DArrayShadow|sampler[12]DShadow|sampler2DRectShadow|sampler3DRect|samplerCubeArrayShadow|samplerCubeShadow|shared|short|sizeof|smooth|static|struct|subroutine|superp|switch|template|this|true|typedef|uint|uniform|union|unsigned|using|varying|void|volatile|while|writeonly)\b/,
});
};
},
} as LanguageProto<'glsl'>;
8 changes: 4 additions & 4 deletions src/languages/gml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import type { LanguageProto } from '../types';

export default {
id: 'gml',
require: clike,
base: clike,
alias: 'gamemakerlanguage',
grammar ({ extend }) {
return extend('clike', {
grammar () {
return {
'keyword':
/\b(?:break|case|continue|default|do|else|enum|exit|for|globalvar|if|repeat|return|switch|until|var|while)\b/,
'number': /(?:\b0x[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ulf]{0,4}/i,
Expand All @@ -16,6 +16,6 @@ export default {
/\b(?:GM_build_date|GM_version|action_(?:continue|restart|reverse|stop)|all|gamespeed_(?:fps|microseconds)|global|local|noone|other|pi|pointer_(?:invalid|null)|self|timezone_(?:local|utc)|undefined|ev_(?:alarm|animation_end|boundary|collision|create|destroy|draw|draw_(?:begin|end|post|pre)|end_of_path|game_end|game_start|global_(?:left|middle|right)_button|global_(?:left|middle|right)_press|global_(?:left|middle|right)_release|joystick(?:1|2)_(?:button1|button2|button3|button4|button5|button6|button7|button8|down|left|right|up)|keyboard|keypress|keyrelease|(?:left|middle|no|right)_button|(?:left|middle|right)_press|(?:left|middle|right)_release|mouse|mouse_(?:enter|leave|wheel_down|wheel_up)|no_more_health|no_more_lives|other|outside|room_end|room_start|step|trigger|user\d|gui|gui_begin|gui_end|step_(?:begin|end|normal))|vk_(?:alt|anykey|backspace|control|delete|down|end|enter|escape|home|insert|left|nokey|pagedown|pageup|pause|printscreen|return|right|shift|space|tab|up|f\d|numpad\d|add|decimal|divide|lalt|lcontrol|lshift|multiply|ralt|rcontrol|rshift|subtract)|achievement_(?:filter_(?:all_players|favorites_only|friends_only)|friends_info|info|leaderboard_info|our_info|pic_loaded|show_(?:achievement|bank|friend_picker|leaderboard|profile|purchase_prompt|ui)|type_challenge|type_score_challenge)|asset_(?:font|object|path|room|script|shader|sound|sprite|tiles|timeline|unknown)|audio_(?:3d|falloff_(?:exponent_distance|exponent_distance_clamped|inverse_distance|inverse_distance_clamped|linear_distance|linear_distance_clamped|none)|mono|new_system|old_system|stereo)|bm_(?:add|complex|dest_alpha|dest_color|dest_colour|inv_dest_alpha|inv_dest_color|inv_dest_colour|inv_src_alpha|inv_src_color|inv_src_colour|max|normal|one|src_alpha|src_alpha_sat|src_color|src_colour|subtract|zero)|browser_(?:chrome|firefox|ie|ie_mobile|not_a_browser|opera|safari|safari_mobile|tizen|unknown|windows_store)|buffer_(?:bool|f16|f32|f64|fast|fixed|generalerror|grow|invalidtype|network|outofbounds|outofspace|s16|s32|s8|seek_end|seek_relative|seek_start|string|text|u16|u32|u64|u8|vbuffer|wrap)|c_(?:aqua|black|blue|dkgray|fuchsia|gray|green|lime|ltgray|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)|cmpfunc_(?:always|equal|greater|greaterequal|less|lessequal|never|notequal)|cr_(?:appstart|arrow|beam|cross|default|drag|handpoint|hourglass|none|size_all|size_nesw|size_ns|size_nwse|size_we|uparrow)|cull_(?:clockwise|counterclockwise|noculling)|device_(?:emulator|tablet)|device_ios_(?:ipad|ipad_retina|iphone|iphone5|iphone6|iphone6plus|iphone_retina|unknown)|display_(?:landscape|landscape_flipped|portrait|portrait_flipped)|dll_(?:cdecl|cdel|stdcall)|ds_type_(?:grid|list|map|priority|queue|stack)|ef_(?:cloud|ellipse|explosion|firework|flare|rain|ring|smoke|smokeup|snow|spark|star)|fa_(?:archive|bottom|center|directory|hidden|left|middle|readonly|right|sysfile|top|volumeid)|fb_login_(?:default|fallback_to_webview|forcing_safari|forcing_webview|no_fallback_to_webview|use_system_account)|iap_(?:available|canceled|ev_consume|ev_product|ev_purchase|ev_restore|ev_storeload|failed|purchased|refunded|status_available|status_loading|status_processing|status_restoring|status_unavailable|status_uninitialised|storeload_failed|storeload_ok|unavailable)|leaderboard_type_(?:number|time_mins_secs)|lighttype_(?:dir|point)|matrix_(?:projection|view|world)|mb_(?:any|left|middle|none|right)|network_(?:config_(?:connect_timeout|disable_reliable_udp|enable_reliable_udp|use_non_blocking_socket)|socket_(?:bluetooth|tcp|udp)|type_(?:connect|data|disconnect|non_blocking_connect))|of_challenge_(?:lose|tie|win)|os_(?:android|ios|linux|macosx|ps3|ps4|psvita|unknown|uwp|win32|win8native|windows|winphone|xboxone)|phy_debug_render_(?:aabb|collision_pairs|coms|core_shapes|joints|obb|shapes)|phy_joint_(?:anchor_1_x|anchor_1_y|anchor_2_x|anchor_2_y|angle|angle_limits|damping_ratio|frequency|length_1|length_2|lower_angle_limit|max_force|max_length|max_motor_force|max_motor_torque|max_torque|motor_force|motor_speed|motor_torque|reaction_force_x|reaction_force_y|reaction_torque|speed|translation|upper_angle_limit)|phy_particle_data_flag_(?:category|color|colour|position|typeflags|velocity)|phy_particle_flag_(?:colormixing|colourmixing|elastic|powder|spring|tensile|viscous|wall|water|zombie)|phy_particle_group_flag_(?:rigid|solid)|pr_(?:linelist|linestrip|pointlist|trianglefan|trianglelist|trianglestrip)|ps_(?:distr|shape)_(?:diamond|ellipse|gaussian|invgaussian|line|linear|rectangle)|pt_shape_(?:circle|cloud|disk|explosion|flare|line|pixel|ring|smoke|snow|spark|sphere|square|star)|ty_(?:real|string)|gp_(?:face\d|axislh|axislv|axisrh|axisrv|padd|padl|padr|padu|select|shoulderl|shoulderlb|shoulderr|shoulderrb|start|stickl|stickr)|lb_disp_(?:none|numeric|time_ms|time_sec)|lb_sort_(?:ascending|descending|none)|ov_(?:achievements|community|friends|gamegroup|players|settings)|ugc_(?:filetype_(?:community|microtrans)|list_(?:Favorited|Followed|Published|Subscribed|UsedOrPlayed|VotedDown|VotedOn|VotedUp|WillVoteLater)|match_(?:AllGuides|Artwork|Collections|ControllerBindings|IntegratedGuides|Items|Items_Mtx|Items_ReadyToUse|Screenshots|UsableInGame|Videos|WebGuides)|query_(?:AcceptedForGameRankedByAcceptanceDate|CreatedByFriendsRankedByPublicationDate|FavoritedByFriendsRankedByPublicationDate|NotYetRated)|query_RankedBy(?:NumTimesReported|PublicationDate|TextSearch|TotalVotesAsc|Trend|Vote|VotesUp)|result_success|sortorder_CreationOrder(?:Asc|Desc)|sortorder_(?:ForModeration|LastUpdatedDesc|SubscriptionDateDesc|TitleAsc|VoteScoreDesc)|visibility_(?:friends_only|private|public))|vertex_usage_(?:binormal|blendindices|blendweight|color|colour|depth|fog|normal|position|psize|sample|tangent|texcoord|textcoord)|vertex_type_(?:float\d|color|colour|ubyte4)|input_type|layerelementtype_(?:background|instance|oldtilemap|particlesystem|sprite|tile|tilemap|undefined)|se_(?:chorus|compressor|echo|equalizer|flanger|gargle|none|reverb)|text_type|tile_(?:flip|index_mask|mirror|rotate)|(?:obj|rm|scr|spr)\w+)\b/,
'variable':
/\b(?:alarm|application_surface|async_load|background_(?:alpha|blend|color|colour|foreground|height|hspeed|htiled|index|showcolor|showcolour|visible|vspeed|vtiled|width|x|xscale|y|yscale)|bbox_(?:bottom|left|right|top)|browser_(?:height|width)|caption_(?:health|lives|score)|current_(?:day|hour|minute|month|second|time|weekday|year)|cursor_sprite|debug_mode|delta_time|direction|display_aa|error_(?:last|occurred)|event_(?:action|number|object|type)|fps|fps_real|friction|game_(?:display|project|save)_(?:id|name)|gamemaker_(?:pro|registered|version)|gravity|gravity_direction|health|(?:h|v)speed|iap_data|id|image_(?:alpha|angle|blend|depth|index|number|speed|xscale|yscale)|instance_(?:count|id)|keyboard_(?:key|lastchar|lastkey|string)|layer|lives|mask_index|mouse_(?:button|lastbutton|x|y)|object_index|os_(?:browser|device|type|version)|path_(?:endaction|index|orientation|position|positionprevious|scale|speed)|persistent|phy_(?:active|angular_(?:damping|velocity)|bullet|(?:col_normal|collision|com|linear_velocity|position|speed)_(?:x|y)|collision_points|dynamic|fixed_rotation|inertia|kinematic|linear_damping|mass|position_(?:x|y)previous|rotation|sleeping|speed)|pointer_(?:invalid|null)|room|room_(?:caption|first|height|last|persistent|speed|width)|score|secure_mode|show_(?:health|lives|score)|solid|speed|sprite_(?:height|index|width|xoffset|yoffset)|temp_directory|timeline_(?:index|loop|position|running|speed)|transition_(?:color|kind|steps)|undefined|view_(?:angle|current|enabled|(?:h|v)(?:border|speed)|(?:h|w|x|y)port|(?:h|w|x|y)view|object|surface_id|visible)|visible|webgl_enabled|working_directory|x|(?:x|y)(?:previous|start)|y|argument(?:_relitive|_count|\d)|argument|global|local|other|self)\b/,
});
};
},
} as LanguageProto<'gml'>;
28 changes: 12 additions & 16 deletions src/languages/go.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { insertBefore } from '../util/insert';
import clike from './clike';
import type { LanguageProto } from '../types';
import type { Grammar, LanguageProto } from '../types';

export default {
id: 'go',
require: clike,
grammar ({ extend }) {
const go = extend('clike', {
base: clike,
grammar () {
return {
'string': {
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
lookbehind: true,
Expand All @@ -27,17 +26,14 @@ export default {
/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
'builtin':
/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|imag|u?int(?:8|16|32|64)?|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/,
});

insertBefore(go, 'string', {
'char': {
pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
greedy: true,
$insert: {
'char': {
$before: 'string',
pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
greedy: true,
},
},
});

delete go['class-name'];

return go;
$delete: ['class-name'],
} as unknown as Grammar;
},
} as LanguageProto<'go'>;
62 changes: 29 additions & 33 deletions src/languages/gradle.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { insertBefore } from '../util/insert';
import clike from './clike';
import type { LanguageProto } from '../types';

export default {
id: 'gradle',
require: clike,
grammar ({ extend }) {
grammar () {
const interpolation = {
pattern: /((?:^|[^\\$])(?:\\{2})*)\$(?:\w+|\{[^{}]*\})/,
lookbehind: true,
Expand All @@ -21,7 +20,7 @@ export default {
},
};

const gradle = extend('clike', {
return {
'string': {
pattern: /'''(?:[^\\]|\\[\s\S])*?'''|'(?:\\.|[^\\'\r\n])*'/,
greedy: true,
Expand All @@ -36,37 +35,34 @@ export default {
lookbehind: true,
},
'punctuation': /\.+|[{}[\];(),:$]/,
});

insertBefore(gradle, 'string', {
'shebang': {
pattern: /#!.+/,
alias: 'comment',
greedy: true,
},
'interpolation-string': {
pattern:
/"""(?:[^\\]|\\[\s\S])*?"""|(["/])(?:\\.|(?!\1)[^\\\r\n])*\1|\$\/(?:[^/$]|\$(?:[/$]|(?![/$]))|\/(?!\$))*\/\$/,
greedy: true,
inside: {
'interpolation': interpolation,
'string': /[\s\S]+/,
$insertBefore: {
'string': {
'shebang': {
pattern: /#!.+/,
alias: 'comment',
greedy: true,
},
'interpolation-string': {
pattern:
/"""(?:[^\\]|\\[\s\S])*?"""|(["/])(?:\\.|(?!\1)[^\\\r\n])*\1|\$\/(?:[^/$]|\$(?:[/$]|(?![/$]))|\/(?!\$))*\/\$/,
greedy: true,
inside: {
'interpolation': interpolation,
'string': /[\s\S]+/,
},
},
},
'punctuation': {
'spock-block': /\b(?:and|cleanup|expect|given|setup|then|when|where):/,
},
'function': {
'annotation': {
pattern: /(^|[^.])@\w+/,
lookbehind: true,
alias: 'punctuation',
},
},
},
});

insertBefore(gradle, 'punctuation', {
'spock-block': /\b(?:and|cleanup|expect|given|setup|then|when|where):/,
});

insertBefore(gradle, 'function', {
'annotation': {
pattern: /(^|[^.])@\w+/,
lookbehind: true,
alias: 'punctuation',
},
});

return gradle;
};
},
} as LanguageProto<'gradle'>;
Loading