mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
781 B
24 lines
781 B
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 }') |
|
} |
|
} |
|
}); |
|
} |
|
} |