This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* lang_cpp/parsing/parse_cpp.ml: Use Parse_info.tokenize_all_and_adju…
…st_pos This will help semgrep/semgrep#1925 The helper tokenize_all_and_adjust_pos correctly intercept Lexical_error and adjust the file position of the token inside the Lexical_error. When I introduced this helper function, I forgot to use it for the C/C++ parser (not sure why, maybe because the code was also handling ExpandedTok). test plan: $ semgrep -l c -e 'FOO' /tmp/foo.c ran 1 rules on 1 files: 0 findings 1 files could not be analyzed; run with --verbose for details or run with --strict to exit non-zero if any file cannot be analyzed does not generate Python backtrace anymore. Same with $ /home/pad/semgrep/_build/default/cli/Main.exe -dump_ast /tmp/foo.c /tmp/foo.c:3:0: Lexical error: unrecognised symbol, in token rule:# Raised at file "parsing/Parse_code.ml", line 144, characters 24-27 Called from file "parsing/Parse_code.ml", line 236, characters 18-48 Called from file "cli/Main.ml", line 855, characters 6-72 Called from file "pfff/h_program-lang/Error_code.ml", line 388, characters 4-8 no more "NO FILE INFO YET" exn.
- Loading branch information