mirror of https://github.com/nocodb/nocodb
Wing-Kam Wong
3 years ago
10 changed files with 147 additions and 73 deletions
@ -0,0 +1,24 @@
|
||||
const OCURLY_CODE = 123; // {
|
||||
const CCURLY_CODE = 125; // }
|
||||
|
||||
export default { |
||||
name: 'curly', |
||||
init(jsep) { |
||||
jsep.hooks.add('gobble-token', function gobbleCurlyLiteral(env) { |
||||
const { context } = env |
||||
if (!jsep.isIdentifierStart(context.code) && context.code === OCURLY_CODE) { |
||||
context.index += 1 |
||||
let nodes = context.gobbleExpressions(CCURLY_CODE) |
||||
if (context.code === CCURLY_CODE) { |
||||
context.index += 1 |
||||
if (nodes.length > 0) { |
||||
env.node = nodes[0] |
||||
} |
||||
return env.node |
||||
} else { |
||||
context.throwError('Unclosed }') |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
} |
Loading…
Reference in new issue