Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javascript中的这种变量是什么?_Javascript_Variables - Fatal编程技术网

javascript中的这种变量是什么?

javascript中的这种变量是什么?,javascript,variables,Javascript,Variables,我试图破译一个javascript,我发现了这种变量。 有人能告诉我它是怎么工作的吗?在评判我问了这么一个愚蠢的问题而不是用谷歌搜索之前,我想指出,用谷歌搜索你甚至不知道的东西是相当困难的。我尝试了javascript变量类型,但没有成功: if (! this.sh_languages) { this.sh_languages = {}; } sh_languages['tcl'] = [ [ [ /#/g, 'sh_comment', 1

我试图破译一个javascript,我发现了这种变量。 有人能告诉我它是怎么工作的吗?在评判我问了这么一个愚蠢的问题而不是用谷歌搜索之前,我想指出,用谷歌搜索你甚至不知道的东西是相当困难的。我尝试了javascript变量类型,但没有成功:

if (! this.sh_languages) {
  this.sh_languages = {};
}
sh_languages['tcl'] = [
  [
    [
      /#/g,
      'sh_comment',
      1
    ],
    [
      /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,
      'sh_number',
      -1
    ],
    [
      /"/g,
      'sh_string',
      2
    ],
    [
      /'/g,
      'sh_string',
      3
    ],
    [
      /~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,
      'sh_symbol',
      -1
    ],
    [
      /\{|\}/g,
      'sh_cbracket',
      -1
    ],
    [
      /\b(?:proc|global|upvar|if|then|else|elseif|for|foreach|break|continue|while|set|eval|case|in|switch|default|exit|error|proc|return|uplevel|loop|for_array_keys|for_recursive_glob|for_file|unwind_protect|expr|catch|namespace|rename|variable|method|itcl_class|public|protected|append|binary|format|re_syntax|regexp|regsub|scan|string|subst|concat|join|lappend|lindex|list|llength|lrange|lreplace|lsearch|lset|lsort|split|expr|incr|close|eof|fblocked|fconfigure|fcopy|file|fileevent|flush|gets|open|puts|read|seek|socket|tell|load|loadTk|package|pgk::create|pgk_mkIndex|source|bgerror|history|info|interp|memory|unknown|enconding|http|msgcat|cd|clock|exec|exit|glob|pid|pwd|time|dde|registry|resource)\b/g,
      'sh_keyword',
      -1
    ],
    [
      /\$[A-Za-z0-9_]+/g,
      'sh_variable',
      -1
    ]
  ],
  [
    [
      /$/g,
      null,
      -2
    ]
  ],
  [
    [
      /"/g,
      'sh_string',
      -2
    ],
    [
      /\\./g,
      'sh_specialchar',
      -1
    ]
  ],
  [
    [
      /'/g,
      'sh_string',
      -2
    ],
    [
      /\\./g,
      'sh_specialchar',
      -1
    ]
  ]
];
起初我以为这是一本字典,但似乎不是这样

Chrome在尝试声明时抛出此错误:

未捕获的语法错误:意外标记[


正如错误消息所指出的,它不是任何类型的变量,而是语法错误

让我们把它分解一下:

var sh_languages声明了一个名为sh_languages的变量

sh_languages['tcl']访问存储在名为sh_languages的变量中的对象的名为tcl的属性

不能在同一语句中声明变量并访问该变量中对象的属性

[启动一个数组文本

[[启动一个数组文字,然后启动另一个数组文字,并将第二个数组放入第一个数组的第一个索引中

[[]第三个数组作为第二个数组的第一个索引。一路向下都是海龟

//g是正则表达式文字。它匹配字符并具有全局标志。正则表达式将是第三个数组的第一个索引

,逗号将第一个索引与第二个索引分开。

var sh_languages['tcl']=…无效。它必须是var后面的普通标识符,而不是表达式,甚至是引用指定类型的表达式

与所用表格保持一致的更正为:

var sh_languages = {};
sh_languages['tcl'] = ..;
或者,键可以作为对象文字本身的一部分写入:

var sh_languages = {
   tcl: ..
};

..stuff,与原版一样,是由各种文字数组、字符串、正则表达式等组成的表达式。在本例中,它是具有指定格式的树嵌套数组的某种形式;其中数据的使用取决于语义含义。

这是无效语法。我想您需要为其粘贴整个代码我们可以肯定地说,但是它看起来就像中间有一个正则表达式的一组嵌套数组。你的意思是:“RoMyJ看起来像它。或者至少类似的可能是相同的想法,尽管我没有看到那个代码中的OcthSupe。Var SHOLL语言[TCL ]。=…无效。它必须是var后面的普通标识符,而不是表达式,甚至是引用指定类型的表达式。