|
|
i got gplex working with Parsley and it's a joy because I don't have to use gplex's grotty input files directly - they're ugly but flexible - a bit like perl is.
now I can generate them from my simple, elegant XBNF format. Not only that, my generated code extends gplex lexers to implement IEnumerable<token> so you can for each over them just like you can with Rolex lexers. That also means they'll work with the backtracking enumerator I posted. And I added in Rolex's "block end" feature that makes it super easy to match things like C block comments, SGML/HTML/XML markup comments and CDATA sections, etc - anything with static multicharacter termination sequences.
I really rocked today. I got this code off the ground, and in some ways what it does is more complicated than Rolex, so it was almost like making a whole new lexer/tokenizer generator.
Not only that I got a new (unicode enabled!) Slang tokenizer up powered by Gplex and i intend to add backtracking to Parsley so it can parse C# (i hope!)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
When do you write Parsnip?
|
|
|
|
|
Maybe my next one. I am given to coming up with silly names for my code.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Next, you need an Elvis Parsley
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Going through 400 code files and finding empty catch blocks and fixing them ....
Try {
// Number of code lines
}
Catch (Exception exception){
// Nothing here. Exception is swallowed.
}
Highly paid consultants probably enjoying a holiday season somewhere...
Zen and the art of software maintenance : rm -rf *
Maths is like love : a simple idea but it can get complicated.
|
|
|
|
|
Regular Expressions
|
|
|
|
|
Ha, great minds and all.
OTOH, fools seldom differ either.
|
|
|
|
|
virang_21 wrote: Try {
// Number of code lines
}
Catch (Exception exception){
// Nothing here. Exception is swallowed.
}
Assuming that the code not wildly different than this, you could start with a simple regex replace with a blank string (PHP style, just use notepad++):
Try.*?Catch[^,;]*?\}
Update: I greatly simplified the regex ^-^, and also fixed a bug (the previous regex will match and erase any catch block that starts with a comment, but this one won't).
What does it do?
- If a catch block contains at least one semi-colon, then it's considered as a catch block with some valid code. Therefore, the entire try-catch is left alone.
- If a catch block does not contain a semi-colon, the catch is erased, along with the try block that preceeds it (regardless of what's within the try).
Note: The regex will replace EVERY invalid try-catch block depending on the path and file extension selected in your replace in files dialog, so backing up your code beforehand might be a good idea!
It should be fairly simple to modify to suit your needs if there's any difference.
It replaced everything with an empty string except for the last block in my test cases:
Try {
do stuff
more stuff
blah
}
Catch (Exception exception){
}
Try {
}
Catch (Exception exception){
}
Try {
}
Catch (Exception exception){
}
Try {
}
Catch (Exception exception){
int d = 3;
}
modified 22-Dec-19 22:41pm.
|
|
|
|
|
|
|
That's the first one I downloaded. The trouble is, it will not build without an existing binary because it generates itself.
They didn't bootstrap the distro with the necessary source files (which would be regenerated anyway)
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Reverse recursion.
There's a fitting punishment for that.
|
|
|
|
|
I think in many cases, using your code generator to build your code generator is fine, but bootstrap the damned build so the first build doesn't need the binaries. All it involves is including the most recent generated source files!
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
A problem with that approach is when your code develops, and the first build can not be used anymore to build the last build. And then the first version is lost in a server crash.
I just wish I made this up.
|
|
|
|
|
First of all, if a server is bringing down your codebase, why aren't you using source control
second, just to be clear on my part, the most recent build is the one that builds the next build. And any time you modify a spec file it should trigger a rebuild. Those sources that are the result of that go into source control
once you set up the pre-build step it's cake.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Trust me, I use version control. This wasn't first person experience.l
|
|
|
|
|
Fair enough, and I didn't mean you specifically. But my point is that if you aren't using some kind of source control you can invite trouble just by glancing at something sideways. Hard drive failure, solar flares, bad hair day, anything you don't prepare for can disrupt your code. That's life.
So I wouldn't blame the technique for the issue. I use the technique in by Build Pack, which is kind of my latest meta project. It works great. And it's easy to build. And build again.
There is a locking issue due to a circular dependency in the build step so you have to build twice the first time, but whatever.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Add this to the list off offenders...
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
|
|
Christmas ads[^]
Sports commentary at it's best[^]
Frank Wilhoit: “Conservatism consists of exactly one proposition …There must be in-groups whom the law protects but does not bind, alongside out-groups whom the law binds but does not protect.”
We never have had a president* so completely deserving of scorn and yet so small in the office that it almost seems a waste of time and energy to summon the requisite contempt
|
|
|
|
|
|
This explains why chimps didn't evolve to live in glass houses.
/ravi
|
|
|
|
|
Hello!
I opened a old project and some source files with VS .
If the files was written with Windows characters eg. "Windows: Western"
an alert said that this file is now restored.
But the characters with codes above x7f are marked as unknown characters.
Do somebody know a tool to convert such files to Unicode without loss of the meaning of such characters?
Thank you
Erhy
|
|
|
|