Skip to content

Commit

Permalink
fix #561
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltrt committed Aug 1, 2023
1 parent 70f2cc1 commit ddb122e
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ def write_query(self, node: Node, depth=0, prefix="", simplify=False):

# if the node is an identifier, add it to eq constraints
if visited == 0:
self.query_ctrs.append(
f"(#eq? {node_name} \"{node.text.decode('utf8')}\")"
)
text = node.text.decode("utf8").replace("\n", " ")
self.query_ctrs.append(f'(#eq? {node_name} "{text}")')
s_exp += f")"

self.capture_groups[node_name] = node
Expand Down

7 comments on commit ddb122e

@alexbit-codemod
Copy link

Choose a reason for hiding this comment

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

this didnt fix anything for me. am i doing something wrong?

Could not parse the query : "((method_declaration\n type: (void_type ) @tag2n\n name: (identifier ) @tag3n\n parameters: (formal_parameters \n (formal_parameter \n type: (type_identifier ) @tag6n\n name: (identifier ) @tag7n) @tag5n) @tag4n\n body: (block ) @tag8n) @tag1n\n(#eq? @tag2n \"void\")\n(#eq? @tag3n \"someMethod\")\n(#eq? @tag6n \"String\")\n(#eq? @tag7n \"arg\")\n(#eq? @tag8n \"{\n\n }\"))" Some(QueryError { row: 12, column: 13, offset: 346, message: "(#eq? @tag8n \"{\n ^", kind: Syntax })

i just ran
pip install polyglot-piranha-playground
again to hopefully get the latest update here.
@danieltrt

@alexbit-codemod
Copy link

Choose a reason for hiding this comment

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

maybe you have not pushed it to main yet?

@danieltrt
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We didnt do a release. you'd need to run the version from master

@danieltrt
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should work now

@alexbit-codemod
Copy link

Choose a reason for hiding this comment

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

so i installed agent again, grabbed the java snippets in the doc, tried to infer the rule, but again when i apply the rule on the before snippet, it throws error.

@danieltrt
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interesting. It's working on my personal laptop with latest release of piranha 0.3.16, and the playground 0.0.3.

Can you share which versions you-re using, as well as the code snippets you are trying to infer from?

@alexbit-codemod
Copy link

Choose a reason for hiding this comment

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

tried but couldnt get the version of piranha and playground.
i used the before/after here https://github.com/uber/piranha/tree/master/experimental

Please sign in to comment.