Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

BIG refactoring, add far more tokens in the different ASTs and AST ge… #17

Merged
merged 1 commit into from
Feb 4, 2020

Conversation

aryx
Copy link
Collaborator

@aryx aryx commented Feb 4, 2020

…neric

Description: sgrep sometimes fails with an OCaml exception about an empty
list of tokens (either FakeTok error or min_max_ii error) because
a metavariable may match something (an expr or stmt) that does not contain
any token information. This in turns mean we can not display location
information for this matched thing.
This diff should help fix
semgrep/semgrep#73
and
semgrep/semgrep#52

because it adds lots of token information in the different ASTs.
I originally skipped those tokens because I wanted an AST, not a CST,
but in the ends it bites back and we want many of those tokens
(at least enough token so we never get the error above).

See ast_generic.ml for the rational.

test plan:
make test

…neric

Description: sgrep sometimes fails with an OCaml exception about an empty
list of tokens (either FakeTok error or min_max_ii error) because
a metavariable may match something (an expr or stmt) that does not contain
any token information. This in turns mean we can not display location
information for this matched thing.
This diff should help fix
semgrep/semgrep#73
and
semgrep/semgrep#52

because it adds lots of token information in the different ASTs.
I originally skipped those tokens because I wanted an AST, not a CST,
but in the ends it bites back and we want many of those tokens
(at least enough token so we never get the error above).

See ast_generic.ml for the rational.

test plan:
make test
@aryx aryx requested review from ievans and ulziibay February 4, 2020 17:24
Comment on lines +404 to +407
| Return of tok * expr option
(* less: switch to label? but PHP accept integers no? *)
| Continue of tok * expr option
| Break of tok * expr option
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do believe this is the important line! DId you want to add specific test for this or do the existing test cover this ?

Copy link

@ulziibay ulziibay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much rubber stamping and reading at this point.

@aryx aryx merged commit 3c19b6d into master Feb 4, 2020
@aryx aryx deleted the big_refactoring_token branch September 7, 2020 14:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants