MCPcopy Index your code
hub / github.com/reactjs/react-rails / parsePrimaryExpression

Function parsePrimaryExpression

lib/assets/javascripts/JSXTransformer.js:5800–5882  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5798 // 11.1 Primary Expressions
5799
5800 function parsePrimaryExpression() {
5801 var marker, type, token, expr;
5802
5803 type = lookahead.type;
5804
5805 if (type === Token.Identifier) {
5806 marker = markerCreate();
5807 return markerApply(marker, delegate.createIdentifier(lex().value));
5808 }
5809
5810 if (type === Token.StringLiteral || type === Token.NumericLiteral) {
5811 if (strict && lookahead.octal) {
5812 throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);
5813 }
5814 marker = markerCreate();
5815 return markerApply(marker, delegate.createLiteral(lex()));
5816 }
5817
5818 if (type === Token.Keyword) {
5819 if (matchKeyword('this')) {
5820 marker = markerCreate();
5821 lex();
5822 return markerApply(marker, delegate.createThisExpression());
5823 }
5824
5825 if (matchKeyword('function')) {
5826 return parseFunctionExpression();
5827 }
5828
5829 if (matchKeyword('class')) {
5830 return parseClassExpression();
5831 }
5832
5833 if (matchKeyword('super')) {
5834 marker = markerCreate();
5835 lex();
5836 return markerApply(marker, delegate.createIdentifier('super'));
5837 }
5838 }
5839
5840 if (type === Token.BooleanLiteral) {
5841 marker = markerCreate();
5842 token = lex();
5843 token.value = (token.value === 'true');
5844 return markerApply(marker, delegate.createLiteral(token));
5845 }
5846
5847 if (type === Token.NullLiteral) {
5848 marker = markerCreate();
5849 token = lex();
5850 token.value = null;
5851 return markerApply(marker, delegate.createLiteral(token));
5852 }
5853
5854 if (match('[')) {
5855 return parseArrayInitialiser();
5856 }
5857

Calls 15

markerCreateFunction · 0.85
markerApplyFunction · 0.85
lexFunction · 0.85
throwErrorTolerantFunction · 0.85
matchKeywordFunction · 0.85
parseFunctionExpressionFunction · 0.85
parseClassExpressionFunction · 0.85
matchFunction · 0.85
parseArrayInitialiserFunction · 0.85
parseObjectInitialiserFunction · 0.85
parseGroupExpressionFunction · 0.85
scanRegExpFunction · 0.85

Tested by

no test coverage detected