15,911,530 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by HishamMohammedA (Top 12 by date)
HishamMohammedA
21-Oct-20 13:30pm
View
I tired regex but you are right I must know the part that I have to handle it, so maybe I will ask the user to put a mark or something before the part I want to take to make it easier since the string will change each time.
Thank you Richard for helping me.
HishamMohammedA
21-Oct-20 12:21pm
View
sorry for separating the two comments but it refuses to put the full string.
In indexOf, I can put the letter "c" and it will cut what comes after but as you can see in this case I already know the example but what if cout is changed then I can't rely on the letter "c" so I want to use if condition regex so it will cut what comes after it and save it in a new string
HishamMohammedA
21-Oct-20 12:18pm
View
for example, if I have a String like this, String str ="if(i=1)cout<
HishamMohammedA
21-Oct-20 12:09pm
View
Thank you for your replay @Richard, but my main issue is that as I mention my text will be different each time and I am only looking for the text that I want to extract by using regex as a parameter but I believe the indexOf can't receive regex as a parameter.
HishamMohammedA
21-Oct-20 9:14am
View
I knew how to use IndexOf to find the index number of the text, but in that case, how do I save it the text that I extracted in another String?
HishamMohammedA
20-Oct-20 17:35pm
View
can you provide an example
HishamMohammedA
20-Oct-20 16:16pm
View
the string is not constant which means it will be different each time, so I don't know the index or substring of it because it can be different each time.
HishamMohammedA
6-Oct-20 16:22pm
View
I am sorry Richard, excuse my English maybe my explanation wasn't good enough.
let's say I have this statement:
a[i] = b[i] + c[i];
now I have split them into two-parts
the left side part -> a[i]
and the right side part -> b[i] + c[i]
I know when I compare between them it will be false, but I don't know how to split the second part of the string (right side) into two string like:
b[i]
c[i]
I am trying to do dependency analysis and in dependency analysis
if we have statement like this:a[i] = b[i] + c[i] there is no dependency so the test return true here but in this example:
a[i] = b[i] + a[i+1]; the dependency analysis should return false, why, because when we compare
a[i] with b[i] no depencency but when we compare a[i] with a[i+1] there is loop carried depencency
HishamMohammedA
6-Oct-20 15:50pm
View
Can you elaborate please, because I didn't understand
HishamMohammedA
6-Oct-20 15:33pm
View
it is still the same question, nothing change but all I was saying is that I already take the strings using antlr and I don't know how to fully utilize it that's why I am trying with strings now.
HishamMohammedA
6-Oct-20 15:23pm
View
I already receive the string using antlr getText() method but I was facing a problem when I tried to take each node because I don't know how to go deep in the tree.
HishamMohammedA
6-Oct-20 14:20pm
View
okay, I was able to locate for loop but now I have a problem of recognizing the nested loop when I use visitor.
I am using this peace of grammar,
iterationstatement
: While '(' condition ')' statement #WhileStatement
| Do statement While '(' expression ')' ';' #DoWhileStatemen
| For '(' forinitstatement condition? ';' expression? ')' statement #ClassicForStatement
;
to visit for loop and write above it, after doing some analysis on the string forStr.
public T visitClassicForStatement(GrammarParser.ClassicForStatementContext ctx) {
String forStr =ctx.statement().compoundstatement().statementseq().statement().getText();
this string supposes to be statements inside the for loop, but I am facing a problem that when I put nested loop and when I receive this text I receive the for loop with it.
the problem is:
when I am receiving a statement like this:
for(){statements}
my analysis work on statements just fine but when I receive it like this:
for(){for(){statments}}
I have a problem because the inner loop comes with statements and this makes a problem for my way to analyze.
How I can ignore the inner for loop and take only statements like the way I take it when I have only a single loop, and write only above the outer loop.
this is the grammar that I use:
https://gofile.io/d/CLRikA
Show More