成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

我在GitHub上又找到一個堪稱神器的命令行工具

開發 開發工具
GitHub上的實用工具還是挺多的,這不,又讓我找到了一個堪稱神器的支持多語言的命令行工具——Semantic,Semantic是一個解析,分析和比較多種語言源代碼的命令行工具,也是一個Haskell庫。

GitHub上的實用工具還是挺多的,這不,又讓我找到了一個堪稱神器的支持多語言的命令行工具——Semantic,Semantic是一個解析,分析和比較多種語言源代碼的命令行工具,也是一個Haskell庫。

[[399817]]

平常解析源代碼也算是程序員的家常便飯了,如果有個工具幫你一把那是最好不過的了,Semantic具體如何使用,猿妹下面一說你就明白了:

首先呢,運行semantic --help獲取最新的完整選項列表:

解析

  1. Usage: semantic parse ([--sexpression] | [--json] | [--json-graph] | [--symbols] 
  2.                       | [--dot] | [--show] | [--quiet]) [FILES...] 
  3.   Generate parse trees for path(s) 
  4.  
  5. Available options: 
  6.   --sexpression            Output s-expression parse trees (default) 
  7.   --json                   Output JSON parse trees 
  8.   --json-graph             Output JSON adjacency list 
  9.   --symbols                Output JSON symbol list 
  10.   --dot                    Output DOT graph parse trees 
  11.   --show                   Output using the Show instance (debug only, format 
  12.                            subject to change without notice) 
  13.   --quiet                  Don't produce output, but show timing stats 

Semantic使用樹形圖來生成解析樹,現在我們拿一個簡單的程序來解析你會看的更明了,打開test.A.py文件,粘貼如下:

  1. def Foo(x): 
  2.     return x 
  3. print Foo("hi") 

現在,讓我們生成一個抽象語法樹(AST)

  1. $ semantic parse test.A.py 
  2. (Statements 
  3.   (Annotation 
  4.     (Function 
  5.       (Identifier) 
  6.       (Identifier) 
  7.       (Return 
  8.         (Identifier))) 
  9.     (Empty)) 
  10.   (Call 
  11.     (Identifier) 
  12.     (Call 
  13.       (Identifier) 
  14.       (TextElement) 
  15.       (Empty)) 
  16.     (Empty))) 

默認的s-expression輸出是一種很好的格式,可以快速可視化代碼結構。我們可以看到有一個聲明的函數,然后有一個調用表達式,嵌套在另一個調用表達式中,它與函數調用print和Foo。你還可以使用其他的輸出格式。

DIFF(比較)

  1. Usage: semantic diff ([--sexpression] | [--json] | [--json-graph] | [--toc] | 
  2.                      [--dot] | [--show]) [FILE_A] [FILE_B] 
  3.   Compute changes between paths 
  4.  
  5. Available options: 
  6.   --sexpression            Output s-expression diff tree (default) 
  7.   --json                   Output JSON diff trees 
  8.   --json-graph             Output JSON diff trees 
  9.   --toc                    Output JSON table of contents diff summary 
  10.   --dot                    Output the diff as a DOT graph 
  11.   --show                   Output using the Show instance (debug only, format 
  12.                            subject to change without notice) 

Graph(圖)

  1. Usage: semantic graph ([--imports] | [--calls]) [--packages] ([--dot] | [--json] 
  2.                       | [--show]) ([--root DIR] [--exclude-dir DIR] 
  3.                       DIR:LANGUAGE | FILE | --language ARG (FILES... | --stdin)) 
  4.   Compute a graph for a directory or from a top-level entry point module 
  5.  
  6. Available options: 
  7.   --imports                Compute an import graph (default) 
  8.   --calls                  Compute a call graph 
  9.   --packages               Include a vertex for the package, with edges from it 
  10.                            to each module 
  11.   --dot                    Output in DOT graph format (default) 
  12.   --json                   Output JSON graph 
  13.   --show                   Output using the Show instance (debug only, format 
  14.                            subject to change without notice) 
  15.   --root DIR               Root directory of project. Optional, defaults to 
  16.                            entry file/directory. 
  17.   --exclude-dir DIR        Exclude a directory (e.g. vendor) 
  18.   --language ARG           The language for the analysis. 
  19.   --stdin                  Read a list of newline-separated paths to analyze 
  20.                            from stdin. 

語言支持

多語言支持是Semantic的一大優勢,目前支持Ruby、JavaScript、typescript、Python、Go、PHP、Java等主流編程語言都支持

Semantic最低要求GHC 8.6.4和Cabal 2.4,建議使用ghcup沙箱GHC版本,為通過操作系統的軟件包管理器安裝的GHC軟件包可能無法安裝靜態鏈接版本的GHC啟動庫。

  1. git clone git@github.com:github/semantic.git 
  2. cd semantic 
  3. script/bootstrap 
  4. cabal new-build 
  5. cabal new-test 
  6. cabal new-run semantic -- --help 

創建者使用cabal的Nix風格的本地版本進行開發。要快速入門,可以按照以上操作。

目前,semantic已經在GitHub上獲得 8000 個Star,450 個Fork,感興趣的可以到GitHub上查閱更多詳情

(GitHub地址:https://github.com/github/semantic)。

 

責任編輯:趙寧寧 來源: 開源最前線
相關推薦

2020-12-08 10:33:56

DDoS攻擊開源安全安全工具

2021-02-04 11:11:08

開發技能工具

2021-02-04 11:46:49

GithubSQL工具Franchise

2011-06-17 16:49:05

Cocoa蘋果

2022-01-26 18:59:08

Python工具

2021-06-03 10:34:43

GitHub停車系統項目

2022-01-11 09:05:07

工具Python 命令行

2016-08-10 12:41:00

Linux工具bcShell

2019-09-09 15:43:29

UnixLinux命令行

2019-06-10 15:00:27

node命令行前端

2019-02-27 09:24:48

命令行文件Linux

2023-03-08 15:38:56

Linux命令dict

2012-07-11 13:35:25

UnixLinux

2014-06-17 09:49:07

Ngxtop實時監控Nginx

2019-05-30 10:40:04

ddgrLinuxDuckDuckGo

2022-02-17 18:21:47

工具HTTPie客戶端

2020-12-08 08:46:07

GoJava工具

2017-05-27 14:45:04

Linux命令進程

2015-07-13 11:05:31

Linuxlolcat

2016-09-23 20:16:23

TaskwarriorLinux命令行工具
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 久久伊人一区 | 国产精品久久国产精品 | 超碰在线网站 | 亚洲欧洲一区二区 | 亚洲一区中文 | 亚洲精品国产第一综合99久久 | av网站在线免费观看 | 国产精品1区 | 日本不卡一区二区三区 | 91精品国产综合久久久久 | 丝袜 亚洲 欧美 日韩 综合 | 日韩黄a | 97国产精品视频 | 久久免费国产 | 日韩久久精品 | 毛片a区 | 爱草视频 | 久久久久国产精品一区二区 | 亚洲 中文 欧美 日韩 在线观看 | 欧美日韩一区二区在线播放 | 欧美.com | 99riav国产一区二区三区 | 一区二区高清 | 一区二区免费看 | 国产在线一区二区三区 | 一区二区三区国产精品 | 日韩一区二区三区在线观看 | 日韩中文字幕一区二区三区 | 日韩精品区 | 天天综合久久 | 日韩在线观看网站 | 精品一区国产 | 精品福利在线 | 99久久久99久久国产片鸭王 | 一级全黄少妇性色生活免费看 | 毛片网在线观看 | 天天看天天操 | 精品久久久久久久久久久下田 | 国产午夜在线 | 日本高清精品 | 美女天天干天天操 |