Questions tagged [code-transformation]
8 questions
5
votes
0 answers
How to add a new statement on the same line using JavaParser
I know that JavaParser operates on the AST, yet I was curious if it was possible to add new statements on the same line as another one.
Let me give an example on what I would like to achieve.
Example input X.java (do not mind the "logic"):
public…

Markus Weninger
- 11,931
- 7
- 64
- 137
4
votes
0 answers
Track line number changes in JavaParser
I currently try to use JavaParser to slightly modify existing source code. I now would like to able to track line number changes introduced by theses modifications.
As an example, assume that we have a ModifierVisitor that adds one line to the body…

Markus Weninger
- 11,931
- 7
- 64
- 137
2
votes
1 answer
How are expressions allowed inside Haskell do blocks
In the following code, line 4, I have an expression sandwiched between two IO actions in a do block:
1 doubleX :: (Show x, Num x) => x -> IO () …

northlane
- 293
- 1
- 9
1
vote
0 answers
Do-expression expansion in Haskell
I have a fragment of code from the Get Programming with Haskell book which looks as follows:
listToSTUArray :: [Int] -> ST s (STUArray s Int Int)
listToSTUArray vals = do
let end = length vals - 1
myArray <- newArray (0,end) 0
forM_ [0…

A. G
- 187
- 7
0
votes
0 answers
How does text for HLLs appear on the screen? What translates the letters into pixels? Which hardware knows how to use the patterns for them?
And if you didn't have C or another human language, how would you tell a system to generate text on a screen after working out the specifics of the language you want to create without the help of another?
If someone wanted to write a compiler for a…
0
votes
1 answer
Trying to get generic sed multi-line pattern match and substitution script to work
There is a generic approach to solving the problem presented by this poster which is presented on linuxtopia here, in section 4.23.3 . It appears to offer a method for handling any complex content pattern for matching target, then replacing that…

Eric Marceau
- 1,601
- 1
- 8
- 11
0
votes
0 answers
How can I ignore whitespaces in queries when using comby?
I refer to the comby tool which can be found on https://comby.dev/ and https://github.com/comby-tools/comby.
If I have a file with contents:
void f();
void g( );
And I want to refactor both expressions from ; to {} (I know I would be faster…

Frank Schwidom
- 47
- 5
-3
votes
1 answer
is there any way to convert this python code into php
what i need to accomplish is to reach a way in which i can convert the basics on any python code into php functions and conditions and so on
def BitmapHoles(strArr):
bitmap = {}
for i in range(len(strArr)):
for j in…

ibrahim khalaf
- 21
- 1
- 5