6
我們有我們自己使用的腳本語言。這個語言很簡單,但它有一個'獨佔'的東西:字符串是用'['和']'定義的(所以「test」將會是[test]),並且這些大括號可以在彼此之內:Ace編輯器中的遞歸塊
lateinit([concat([test], [blah])])
另外,還有沒有轉義字符。 如何將此塊解析爲一個字符串(從而突出顯示[concat([test], [blah])]
塊)? 我目前得到了以下規則:
{ token: 'punctuation.definition.string.begin.vcl',
regex: '\\[',
push:
[
{ token: 'punctuation.definition.string.end.vcl',
regex: '\\]',
next: 'pop' },
{ defaultToken: 'string.quoted.other.vcl' } ],
},
但是,正如你可能已經猜到,這將在括號停留在試驗結束:「[ CONCAT([測試],[等等] )」 ......
其他例子是:
setexpratt(1, [if(comparetext([yes], [no]), msg([test expression]))]);
terminator([confirm([Are you sure you want to exit?])]);
registerfunction([testfunction], 1, 3, [], [msg(concat([Argument 1: ], p(1), [, Argument 2: ], p(2), [, Argument 3: ], p(3)))]);
嵌套它們的目的是什麼? –
@ExplosionPills這是語法;沒有逃脫的角色......我給出的例子執行了一個對象加載後給出的代碼。因此''concat([test],[blah])'被再次解析,然後運行。 – Diamondo25
該json的東西的任何條件? –