In notepad++, there is a lot of helpful syntax highlighting for various programming languages, and I was wondering how it does some of it. I want to know how it can tell the different scopes of functions.
For example, how would it differentiate between the inside and the outside function?:
function myFunction(arguments){
function functionInsideMyFunction(arguments){
return 0;
}
}
I’m sure it’s very simple, but I’m new to regex and still have a bit of trouble understanding it.
Say, for example, I wanted a regex to only match functions that aren’t in other functions. I would want to get myFunction, but not functionInsideMyFunction.
Does not Use RegEx, Uses something called a lexer. The lexer for Jedit is http://jflex.de lexers are confusing to me, but you can learn if you want. If you use java, you can futz with the internals of classes with the YourClass.class.whatev, and you can even manipulate that with http://Commons.apache.org/bcel. NotePad++ uses something similar. RegEx simply isn’t expansive enough beyond basic line & String parsing