3,047 questions
0 votes
2 answers
79 views
How to reliably map glibc dynamic symbols (e.g., open@glibc) to kernel syscalls (e.g., openat)?
I am trying to build a mapping between the dynamic symbols in ELF files (from glibc) and the actual kernel syscalls they invoke. My environment is x86_64 Ubuntu 22.04. What I've Tried Parsing man 2 ...
0 votes
1 answer
83 views
How do I rewrite paths in an AST's import tree?
I'm writing a program that will update a Rust project's imports to be from their new locations after a breaking change in a library. In this instance, I'd like to flatten all imports from vexide::...
1 vote
0 answers
26 views
Conditionally create nodes using JAVACC and JJTREE
I am having difficulty figuring out the best way to conditionally create nodes using javacc and jjtree. In my grammar there are literals, variables, operators and functions. Variables can have the ...
1 vote
1 answer
67 views
Different results using AST directly on ScriptBlock or using the Parser
Why do I get different result when using a Find directly on a ScriptBlock AST (Abstract Syntax Tree) or when using the Parser: $ScriptBlock = { function Write-Hello { Param ($name) ...
1 vote
1 answer
88 views
How to represent a potentially infinite list of computation as an algebraic datatype
Let's say I want to define a potentially infinite list of computation as a data type. So that the computation could be fun a -> a' = Just a' || fun (a -> a') || fun (a -> b) &...
0 votes
0 answers
61 views
How can I programmatically detect template errors like "property does not exist"?
I have a simple Angular app: import { Component } from '@angular/core'; import { bootstrapApplication } from '@angular/platform-browser'; @Component({ selector: 'app-root', template: ` <...
2 votes
0 answers
44 views
Get comments inside ast.CompositeLit node in golang.org/x/tools
I want to parse some ast.CompositeLit nodes and do some reordering of the fields instantiated in a struct. So, for example, imagine that I have the following struct: _ = Person{ // the name Name: &...
2 votes
2 answers
74 views
Match types defined in a header for switch statements with Clang AST
I'm trying to match switch statements that operate on enum types defined in certain header files. I'm running clang-query on source that looks like the following: enum class E { ONE, TWO }; ...
0 votes
0 answers
54 views
opa ast library unable to unmarshal my json ast
Iam trying to unMarshal AST json to ast.Module structure of OPA. policy.rego: package example.authz import rego.v1 allow if { some i input.users[i].role == "admin" } use command ...
0 votes
1 answer
140 views
Java Annotation Processor - how to modify AST (access com.sun.tools.javac.tree package)?
I am writting an annotation processor as a Proof Of Concept (implemented as a maven project). It detects classes annotated with my custom @FunnyBooleans which swaps all trues to falses and vice versa. ...
2 votes
1 answer
94 views
How to resolve command name and parameters from a CommandAst
With writing custom PSSA rules and just parsing PowerShell scripts, I find myself often in the same use case where I would like to resolve command name (which is not that difficult) and the parameters ...
2 votes
0 answers
145 views
Simplify a prime factorization-like expression with optimal performance
I am working with a situation in which I need to turn an arithmetic string expression (e.g. (3/2) * (3**4 / (20 * 4))**(-1/4)) into the following prime factorization form: $\prod_{p:\text{prime}}p_i^{...
1 vote
1 answer
124 views
ast-grep `files` and `ignores` configuration not filtering properly in pattern detector
I'm using ast-grep to detect patterns in Java files, but the files and ignores filter configuration isn't working as expected. According to the documentation, we can apply pattern matching to specific ...
0 votes
1 answer
107 views
PSScriptAnalyzer file based custom rule
I am trying to create a (PowerShell based) PSScriptAnalyzer rule that does basically the opposite of the native usebomforunicodeencodedfile rule knowing that we do not allow any Unicode characters in ...
0 votes
0 answers
36 views
astor, ast, astunparse do not preserve lineno, astmonkey puts \ (backslash) everywhere
Here is the output run on a very simple urls.py from a test Django project: from django.contrib import admin from django.urls import path urlpatterns = [\ path('test_path1/', views.test_view1, ...