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

Function scanPunctuator

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

Source from the content-addressed store, hash-verified

3076 // 7.7 Punctuators
3077
3078 function scanPunctuator() {
3079 var start = index,
3080 code = source.charCodeAt(index),
3081 code2,
3082 ch1 = source[index],
3083 ch2,
3084 ch3,
3085 ch4;
3086
3087 if (state.inJSXTag || state.inJSXChild) {
3088 // Don't need to check for '{' and '}' as it's already handled
3089 // correctly by default.
3090 switch (code) {
3091 case 60: // <
3092 case 62: // >
3093 ++index;
3094 return {
3095 type: Token.Punctuator,
3096 value: String.fromCharCode(code),
3097 lineNumber: lineNumber,
3098 lineStart: lineStart,
3099 range: [start, index]
3100 };
3101 }
3102 }
3103
3104 switch (code) {
3105 // Check for most common single-character punctuators.
3106 case 40: // ( open bracket
3107 case 41: // ) close bracket
3108 case 59: // ; semicolon
3109 case 44: // , comma
3110 case 123: // { open curly brace
3111 case 125: // } close curly brace
3112 case 91: // [
3113 case 93: // ]
3114 case 58: // :
3115 case 63: // ?
3116 case 126: // ~
3117 ++index;
3118 if (extra.tokenize) {
3119 if (code === 40) {
3120 extra.openParenToken = extra.tokens.length;
3121 } else if (code === 123) {
3122 extra.openCurlyToken = extra.tokens.length;
3123 }
3124 }
3125 return {
3126 type: Token.Punctuator,
3127 value: String.fromCharCode(code),
3128 lineNumber: lineNumber,
3129 lineStart: lineStart,
3130 range: [start, index]
3131 };
3132
3133 default:
3134 code2 = source.charCodeAt(index + 1);
3135

Callers 3

advanceSlashFunction · 0.85
advanceFunction · 0.85
advanceJSXChildFunction · 0.85

Calls 1

throwErrorFunction · 0.85

Tested by

no test coverage detected