Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Tools for code analysis, visualizations, or style-preserving source transformation.
branch: master

[pfff][lexer fix]

Summary:
This seems to fix the issue of dealing with complex expressions
directly following `...` in a function call (see testcase); looks like
the special token isn't really needed.

Test Plan:
make tests # succeeds 124, 2 skipped

in `flib`:

  $ find . -name '*.php' -exec bash -c ">&2 ~/pfff/pfff.opt -dump_php {} && echo \"0 {}\" || echo \"1 {}\"" \; > out.txt

  $ grep '^[^0]' ./out.txt
  1 ./thrift/lib/fbcode/adsatlas/api/extif/atlas_api.thrift/atlas_api_types.php
  1 ./third-party/php-openid/Auth/OpenID/Server.php
  1 ./third-party/php-openid/Auth/OpenID/TrustRoot.php

Reviewers: michalburger1, eletuchy

Reviewed By: eletuchy

Subscribers: dominik, jezng

Differential Revision: https://phabricator.fb.com/D1869317

Signature: t1:1869317:1424897321:945d693f4afdf783875bf9d85ea345f4f5aa56b7
latest commit 8e7f6b4a8d
phooji phooji authored
Failed to load latest commit information.
.arc * .arc/default-relative-commit:
code_graph port to 4.02 (disabled lang_cmt/ for now in configure), fixed
code_map port to 4.02 (disabled lang_cmt/ for now in configure), fixed
commons [pfff] move commons_graph to a separate directory
data [pfff] remove `rm` for nonexistant files
demos CEs on commons/lib-json/ -> external/jsonwheel and also removed
docs * data/cpp_stdlib/macros.h: cleanup, and introduced pfff_macros.h loc…
editors/emacs * editors/emacs/sgrep.el:
external [pfff] add json_out to exported symbols for jsonwheel
globals * globals/config_pfff.ml.in: bump
graph_code [pfff] move commons_graph to a separate directory
h_files-format push2 -> push
h_program-lang [pfff] export pretty_print_code
h_program-visual * h_program-visual/main_program_visual.ml: delete
h_version-control [pfff] export findlib target for h_version-control
h_visualization * h_visualization/Treemap.tex.nw: syncweb
lang_bytecode * h_program-lang/prolog_code.ml: new, extracted from graph_code_pro.og
lang_c * lang_c/analyze/graph_code_c.ml: better handle hidden dupes
lang_clang * h_program-lang/errors_code.ml: misc
lang_cmt * Makefile: remove CLANG_HACK
lang_cpp misc
lang_csharp CEs on highlight_code and entity_code factorization
lang_css * lang_css/parsing/ast_css.ml: remove dead type
lang_erlang CEs on highlight_code and entity_code factorization
lang_haskell CEs on highlight_code and entity_code factorization
lang_html CEs on highlight_code and entity_code factorization
lang_java CEs on highlight_code and entity_code factorization
lang_js CEs on highlight_code and entity_code factorization
lang_lisp CEs on highlight_code and entity_code factorization
lang_ml CEs on highlight_code and entity_code factorization
lang_nw CEs on highlight_code and entity_code factorization
lang_opa CEs on highlight_code and entity_code factorization
lang_php [pfff][lexer fix]
lang_python CEs on highlight_code and entity_code factorization
lang_rust CEs on highlight_code and entity_code factorization
lang_sql/parsing * lang_sql/parsing/grammar.txt: rename
lang_text CEs on commons/lib-json/ -> external/jsonwheel and also removed
lang_web CEs on commons/lib-json/ -> external/jsonwheel and also removed
matcher * matcher/fuzzy_vs_fuzzy.ml: fix test regressions
mini * mini/readme.txt:
opa * opa/pfff_logger.opa:
scripts clean lang_js/ remove avik's code, remove NotParsedCorrectly, FinalDef
tests [pfff][lexer fix]
web [pfff] move commons_graph to a separate directory
.arcconfig * .arcconfig: new file
.gitignore * .gitignore:
.travis.yml * .travis.yml: send email to gmail too
META * META:
Makefile [pfff] move commons_graph to a separate directory
Makefile.common * Makefile.common:
README.md [pfff] add travis CI badge to readme
architecture.txt * architecture.txt:
authors.txt * authors.txt: update
bugs.txt misc
changes.txt * changes.txt:
configure port to 4.02 (disabled lang_cmt/ for now in configure), fixed
copyright.txt * configure: new option --nocmt
credits.txt * credits.txt: adding john whaley
env.csh initial import into fresh git repo.
env.sh [pfff] switch to 4.01
find_source.ml * lang_lisp/analyze/graph_code_lisp.ml: first version, module only deps
find_source.mli factorize more skip_code stuff
gtkrc-2.0 * gtkrc-2.0: example of config
install.txt port to 4.02 (disabled lang_cmt/ for now in configure), fixed
install_linux.txt * install_linux.txt:
install_macos.txt Fix MacOSX install instructions
license.txt initial import into fresh git repo.
main.ml * main_codeslicer.ml: new file! moved lpizer here too
main_codegraph.ml * main_codegraph.ml: -class_analysis parameter
main_codemap.ml * main_codemap.ml: todo
main_codequery.ml * main_codequery.ml: use facts.db, not prolog_compiled_db
main_codeslicer.ml * main_codeslicer.ml: misc
main_db.ml * main_db.ml: handle -o for -db_of_graph_code and generate json by de…
main_scheck.ml * main_scheck.ml: use the default generic checker for php, not the sp…
main_sgrep.ml * main_sgrep.ml: adding -lang c
main_spatch.ml * main_spatch.ml: related work
main_stags.ml [pfff] optionally include hack (.hhi) files when searching for php files
main_test.ml * main_test.ml: -relatavitze symlink
project.el * project.el: update
skip_list.txt * skip_list.txt:
syncweb.txt * syncweb.txt:
travis-ci.sh * travis-ci.sh:

README.md

                          pfff

Build Status

pfff is a set of tools and APIs to perform static analysis, code visualizations, code navigations, or style-preserving source-to-source transformations such as refactorings on source code. There is good support for C, Java, Javascript and PHP. There is also preliminary support for other languages such as C++, Rust, C#, Html, CSS, Erlang, Lisp, Haskell, Python, OPA and SQL. There is also very good support for OCaml code so that the framework can be used on the code of pfff itself.

For each languages there are mainly 2 libraries, for instance parsing_php.cma and analysis_php.cma, that you can embed in your own application if you need to process PHP code. See the demos/ directory for example of use of the pfff API. See also docs/manual/Parsing_xxx.pdf and docs/manual/Analyzis_xxx.pdf for more documentation on how to use or extend pfff.

pfff is also made of few tools:

  • pfff, which allows to test the different parsers on a single file
  • scheck, a bug finder
  • stags, an Emacs tag generator
  • sgrep, a syntactical grep
  • spatch, a syntactical patch
  • codemap, which is a gtk and cairo based source code visualizer/navigator/searcher leveraging the information computed previously by pfff_db and codegraph.
  • codegraph, a source code indexer and package/module/class dependency visualizer
  • codequery, an interactive tool a la SQL to query information about the structure of a codebase using Prolog as the query engine
  • pfff_db, which does some global analysis on a set of source files and store the data in a marshalled form in a file somewhere (e.g. /tmp/db.json)

For more information, look at the pfff wiki here: http://github.com/facebook/pfff/wiki/Main as well as the docs/manual/ directory.

Usage for pfff:

$ ./pfff -parse_php demos/foo.php

or

$ ./pfff -dump_php demos/foo.php

You can also look at ./pfff --help

Usage for pfff_db:

$ ./pfff_db -lang ml -o /tmp/pfff.json ~/pfff

to analyze all the .ml and .mli files under ~/pfff and store metadata information (the database) in /tmp/pfff.json

Usage for codemap:

$ ./codemap ~/pfff

This should launch a gtk-based GUI that allows you to visualize source code and perform some code search.

Usage for codegraph:

$ ./codegraph -lang cmt -build ~/pfff

to generate a graph_code.marshall file in ~/pfff containing all dependency information about the pfff codebase using the typed bytecode .cmt files generated during the compilation of pfff.

$ ./codegraph ~/pfff

This should launch a gtk-based GUI that allows you to visualize source code dependencies.

More information

Look at the pfff wiki here: http://github.com/facebook/pfff/wiki/Main

Something went wrong with that request. Please try again.