Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case 'true':
case 'false':
return 'BooleanValue';
case 'null':
return 'NullValue';
}
return null;
}
},
NumberValue: [t('Number', 'number')],
StringValue: [t('String', 'string')],
BooleanValue: [t('Keyword', 'builtin')],
NullValue: [t('Keyword', 'keyword')],
ListValue: [p('['), list('Value', opt(p(','))), p(']')],
ObjectValue: [p('{'), list('ObjectField', opt(p(','))), p('}')],
ObjectField: [namedKey('attribute'), p(':'), 'Value'],
};
// A namedKey Token which will decorate the state with a `name`
function namedKey(style) {
return {
style,
match: token => token.kind === 'String',
update(state, token) {
state.name = token.value.slice(1, -1); // Remove quotes.
},
};
}