从这个意义上说,深度是什么意思?

时间:2019-06-12 09:35:45

标签: json vb.net winwrap

在我的程序中,我正在使用Format()-具有' SymbolInfo '功能,并以JSON字符串形式返回符号信息:

Dim json_text = Format(file_name & "|Global+Tokens", "SymbolInfo")

所以json_text看起来像

{"target":"*sr:\\test",
 "symbol_kind":"Global+Tokens",
 "module_kind":"Macro",
 "module_name":"*sr:\\test",
 "user_defined":true,
 "last_read_error":"",
 "known":true,
 "language":0,
 "loaded":false,
 "revision":1,
 "hidden_len":0,
 "hidden_lines":0,
 "visible_len":125,
 "visible_lines":10,
 "tokens":[
 {"token":"...","at":[first,line,column,length,depth,back,count]},...]

现在我想了解深度的含义。不幸的是,我没有SymbolInfo方法等的任何代码。

我已经尝试了以下简单示例:

'#Language "WWB.NET"

Sub Main()

    Analyze "*sr:\test" 

End Sub

Private Sub Analyze(file_name As String)
    'Get the json containing the tokens information
    Dim json_text = Format(file_name & "|Global+Tokens", "SymbolInfo")

    Debug.Print json_text
End Sub

文件sr:\ test

True = True

Class abc
    True = True
End Class
Function test1
    True = True
        True = True
            True = True
End Function

Debug.Print json_text

{"target":"*sr:\\test",
 "symbol_kind":"Global+Tokens",
 "module_kind":"Macro",
 "module_name":"*sr:\\test",
 "user_defined":true,
 "last_read_error":"",
 "known":true,
 "language":0,
 "loaded":false,
 "revision":1,
 "hidden_len":0,
 "hidden_lines":0,
 "visible_len":125,
 "visible_lines":10,
 "tokens":[
  {"token":"True",
   "at":[0,1,0,4,6,0,4]},
  {"token":"=",
   "at":[5,1,5,1,6,-1,4]},
  {"token":"True",
   "at":[7,1,7,4,6,-2,4]},
  {"token":"~eol",
   "at":[11,1,11,0,6,-3,4]},
  {"token":"~eol",
   "at":[13,2,0,0,4,-4,31]},
  {"token":"Class",
   "at":[15,3,0,5,5,0,9]},
  {"token":"~id",
   "at":[21,3,6,3,6,0,1]},
  {"token":"~eol",
   "at":[24,3,9,0,5,-2,9]},
  {"token":"True",
   "at":[27,4,1,4,7,0,4]},
  {"token":"=",
   "at":[32,4,6,1,7,-1,4]},
  {"token":"True",
   "at":[34,4,8,4,7,-2,4]},
  {"token":"~eol",
   "at":[38,4,12,0,7,-3,4]},
  {"token":"End Class",
   "at":[40,5,0,3,5,-7,9]},
  {"token":"~eol",
   "at":[49,5,9,0,5,-8,9]},
  {"token":"Function",
   "at":[51,6,0,8,5,0,17]},
  {"token":"~id",
   "at":[60,6,9,4,6,0,1]},
  {"token":"~eol",
   "at":[64,6,13,0,5,-2,17]},
  {"token":"True",
   "at":[67,7,1,4,12,0,1]},
  {"token":"=",
   "at":[72,7,6,1,9,-1,3]},
  {"token":"True",
   "at":[74,7,8,4,14,0,1]},
  {"token":"~eol",
   "at":[78,7,12,0,7,-3,4]},
  {"token":"True",
   "at":[82,8,2,4,12,0,1]},
  {"token":"=",
   "at":[87,8,7,1,9,-1,3]},
  {"token":"True",
   "at":[89,8,9,4,14,0,1]},
  {"token":"~eol",
   "at":[93,8,13,0,7,-3,4]},
  {"token":"True",
   "at":[98,9,3,4,12,0,1]},
  {"token":"=",
   "at":[103,9,8,1,9,-1,3]},
  {"token":"True",
   "at":[105,9,10,4,14,0,1]},
  {"token":"~eol",
   "at":[109,9,14,0,7,-3,4]},
  {"token":"End Function",
   "at":[111,10,0,3,5,-15,17]},
  {"token":"~eol",
   "at":[123,10,12,0,5,-16,17]}]}

例如,我很困惑,因为如果看True=True,我得到的结果是不同的(不一致?):

如果'True = True'在'Class-End Class'/'Function-End Function'之外->深度:6-6-6

如果“ True = True”位于“类-结束类”内部->深度:7-7-7

如果'True = True'位于'功能-结束功能'->深度:12-9-14

0 个答案:

没有答案