Ill keep updates on progress here.
Currently trying to create an overlay which is needed to expand on the basic navigator functionality.
Lack of detailed information on some of this stuff is making it hard to do
Printable View
Ill keep updates on progress here.
Currently trying to create an overlay which is needed to expand on the basic navigator functionality.
Lack of detailed information on some of this stuff is making it hard to do
Maybe yo ushould contact someone who has done a FF extention before to see how they did it and what resources they used.
TG
Yeah I have..gotten so useful info too.
:D
Well this is on hold until they get this stuff stable. The newest package I made for testing purposes for no good reason has made Firefox un-openable. Not even re-isntalls help and there is no information on exactly where this stuff gets stored when a package is installed, so screw it for now until they get some proper information circulating.
:(
Ain't they installed in the FF root by default?
Apparently not.
here, try these:
http://www.mozilla.org/projects/fire...structure.html
http://www.mozilla.org/projects/firefox/extensions/
Or have you already gone spellinking through there?
TG
That might be helpful. Its not completely dead in the water, the project, im just waiting for a little more about the changes to come out and make sure they dont make any more huge changes real soon wit hthe problems they are having with the .9 versions.
I have worked on the python thingy for a long time now. And suddenly I realised it is a bug in the code and not my RegEx. Everytime the setLanguage(...) function fires, the "key" array has to be emptied. If not there will be a problem.
I.E, you first heighlight something with C++, then try to heilight something with Java, then the Java will be heilighted with C++ heighlighting.
I am not sure what the right way to empty an array is. But as a work around I have now added an extra keys = new Array(); inside the setLanguage function before the switch. Do anyone know about a better way? Or if this is OK JS?
ØØ
Maybe setting it to null?
Will test that right away. But when I have you here. Isn't look behind supported in JS version of RegEx. I tried to do this:
Code:keys.push({style:{color:"#CC0000", bold:false, italic:false, name:"functions"}, start:/(?<=def\s)[\w\d_]*(?=\()/mg});
And then NOTHING works...
Setting it too null didn't work..:(
I have tried a lot of things the last two hours to be able to check where the function declarations are. They look like this:
def main():
so I have to search for def, but not include it, and ( but not include it. And a valid RegEx for this is:
(?<=def\s)\w+(?=\()
but JS won't listen. So I wil ahve a look at it again next week. Except taht everything is working for Python heiglighting too now. And fixed a couple of small buggs here and there. but still not sure about the easiest and safest way to reset an array.
So this is the current version of the extension. Nothing Neb has done the two last days are in it. So hope you can add it to this version. All the files are on the server too.
ØØ
I'll try to look at this weekend if possible. But right nowits Friday and I don't want to type any code. :o
OK...I think I have a solution. But I need some help from you. Because the function:
function colorCode(f,language)
is a bit messy..:D...
If I use a regular expression to fetch:
def main
Then I guess I can later on strip out "def ", can't I? But if so how? Where is the fetch actualy stored? And is it an index that is stored? Or the actual text? I guess it is an index. But I can't get that to work...hmmmm...any insight help.
BTW RegEx to feth "def main":
start:/[\s](?:def\s)\w+(?=\()/mg});
OMG, it was a spelling error..:D..I guess I make spelling errors in programming after all...:D
Will wrap it up and post it again, and put it on the server.
[Edit] Nope I will not. I forgot a rule. "If you fix one problem, you will get a new one"
ØØ
I think my problem is that I don't understand the keys structure you have made. Can you elaborte a bit on it.
Is it something like this.
- keys (array of structs?)
member variables:
- color
- bold
- italic
- name
but where is the actual information stored? And is it stored as an index or the word it self. I need to manipulate it. But I fail too see how it stores it.
Ø
Well, I still can't see if you are actualy declearing keys anywhere, or if you even have to do that in JS, but I managed to make it work anyway...:D..this brings a new feauture to the color heiglighting. We now have the code and the RegEx to heiglight funciton declerations..::D....just look how pretty it is...:D
Code:#Hello mother
def _ma5in_():
if len(sys.argv) < 1:
usage() #Yeah thats your mother all right
else:
kek_number_list = tidy_up_file(sys.argv[1])
if kek_number_list != -1:
download_pdf(kek_number_list)
#Poo is a country
Here is the new and updated XPI.
BTW Cander, what editor are you using. I am in my appartment now, and now the code looks much better then in Emacs. But I still think you should be kicked in the ass for writing lines like this:
and this too...:DCode:for (var i = 0; i != keys.length; ++i) keys[i].startPos = -1;
What did the first for loop do again?Code:for (var i = 1; i < keys.length; ++i) // find first matching key
if (keys[i].startPos < keys[match].startPos) match = i;
if (keys[match].end != undefined) { // end must be found
var end = new RegExp(keys[match].end.source + "|" + keys[match].neglect.source, "mg");
end.lastIndex = keys[match].endPos;
while (keys[match].endPos != s.length)
:D
ToDo list:
- Delphi
- CSS
- Text size
- Text differer
- add common notes to Canders editor (or something like that)
- Fix the console output with my new version, or is it Nebs output version now...:)
- add the new smilies
- ?Tabs for the smilies? (Do we need it?)
- List |list||list=1||list=a| (using canders editor again?)
Correct me if I'm wrong people, but I guess this is the updated TODO list from NoteMe. Just wanna remind.
Version 0.2.6 is now on the server. Use FTP or IE to download it.
As a note. If we are going to get tabs on smilies I guess we have to put the menu toolbars that we are using now on TOP of a window or something, and then add tabs to the windows rather then the menu toolbar it self.
ØØ
I am using textpad.
And yes, remember the top of the vbf.js file saying TODO: clean this up because it is ugly as ****?
I just never got around to it. I was never really expecting anyone else to be working on the code. :p
You hoped, but never expected..:)..thats nice..:)
BTW I can't belive it is soooo hard for different text editors to make the indent look the same in them. It ticks me off that they are not working the same way.
Well, at least we have come a long way though. Even if we havn't cleaned up much..:)...I don't have any time to work on it today, and probably not tomorrow either. But there is still some things to do, so I'll be back..:)
ØØ
I'll be gone a couple days myself if you need me. Getting Wisdom teeth cut out. :o
Hehehe....are they so big that you need a couple of days off...well well. But just before you go. Can you tell me a bit about the Keys array?
Is it an array of Objects/structs? Is it declared somewhere at all? Or don't you have to do that in JS? I am so confused by what actualy happens when you use pop on that array (stack)...:)
Look harder . :p
keys = new Array();
http://www.w3schools.com/js/js_obj_array.asp
But that doesn't say anything about how it is laied out. For me it looks like you have one struckt in the array for name, colour, bold and so on, and then I guess there is something more to it. Becasuse the regular expression has to store something to, but how/where/what...hmmm
And it also seems to me that each regular expression only uses ONE "cell" in the array. So does that make it two dimensional, or how is the results for the regex stored?
ØØ
think of it as CSS where you define a class and its properties (in the case of style being the class and color, bold, etc are the properties. But it placed into an array.
Get it?
Like, go to this page:
http://www.w3schools.com/js/tryit.as...s_array_length
Then add this code to the left window:
What do I have to edit where I have heiglighted now to get what is inside the array if you look away from the color, bold, name, italic? What does the regular expression store, and where..:DCode:<html>
<body>
var codeme = "#Hello mother def _ma5in_(): if len(sys.argv) < 1: usage() #Yeah thats your mother all right else: kek_number_list = tidy_up_file(sys.argv[1]) if kek_number_list != -1: download_pdf(kek_number_list) #Poo is a country"
<script type="text/javascript">
var keys = new Array()
keys.push({style:{color:"#CC0000", bold:true, italic:false, name:"pythondef"}, start:/\bdef\s\w+(?=\()/mg});
keys.push({style:{color:"#FF6666", bold:false, italic:false, name:"functions2"}, start:/\b\w+(?=\()/mg, neglect:/\sdef\s\w+(?=\()/mg});
keys.push({style:{color:"#009900", bold:false, italic:true, name:"comment"}, start:/\s*\#/mg, end:/\n/mg, neglect:/\\|\?\?\//mg}); //start:/\#[\w\s]*\n/mg});
keys.push({style:{color:"#009900", bold:false, italic:false, name:"comment"}, start:/\s*?^\s*(?:#|\?\?=|%:)/mg, end:/\n/m, neglect:/\\[\s\S]|\?\?\/[\s\S]/m});
keys.push({style:{color:"#3333FF", bold:false, italic:false, name:"keyword"}, start:/\s*\b(?:__name__|def|elif|else|except|file|for|if|import|in|len|open|print|return|str|try)\b/mg});
keys.push({style:{color:"#000000", bold:true, italic:false, name:"operator"}, start:/:/mg});
keys.push({style:{color:"#CC9933", bold:false, italic:false, name:"string"}, start:/\s*(?:\bL)?"/mg, end:/"/m, neglect:/\\[\s\S]|\?\?\/[\s\S]/m});
keys.push({style:{color:"#CC9933", bold:false, italic:false, name:"char"}, start:/\s*(?:\bL)?'/mg, end:/'/m, neglect:/\\[\s\S]|\?\?\/[\s\S]/m});
keys.push({style:{color:"#993399", bold:false, italic:false, name:"int"}, start:/\s*\b(?:0[0-7]*|[1-9]\d*|0x[\dA-F]+)(?:UL?|LU?)?\b/mgi});
for (i=0; i<famname.length; i++)
{
document.write(keys[i] + "<br>")
}
</script>
</body>
</html>
Quote:
Originally Posted by Cander
Yeah I get that. But is what the RegEx returned also a property? If so what is it called? How do I get it out..:D
I really don't understand what you are asking.
Ohhh...I might start to understand now..:D..it often helps to ask stupid questions for me..:D
The RegEx isn't executed on that line? Is that it? Ahha...it only STORES the reg ex on that line. The actual reg ex is called in that other function? And then it stores the startPos then. That has NOTHING to do with that line at all...grrrr....*smacks my head in the wall*..:D...
Right. They keys is just an Array. nothing more.
Now smack your head some more. lol
I really thought it was executing the RegEx THERE, since it is not in the {color, bold, italic, name} array at all, but outside it..:)
Ok, last question about it. On lines like this (I can't say how much I hate one line braching though..:D):
the before "property", that is a property right? I can't find any method called that. but the werid thing is that there was no property called that when you started the array. So I guess you can add properties too then? Like Before/After/StartPos?Code:if (keys[i].style.bold) keys[i].before += "[b]";
So I also guess that the array in JS is not actualy an array, but some advanced List that can expand over time? :confused: ?
Just answer this, and I will go home from work and do nothing else then smack my head for the rest of the day..:)
ØØØ
Hash Table is the correct term here. Yes, you can just have those custom properties just thrown in.
OK. I totaly got it now. I can even see why my python thingy worked now in the end..:)..It wasn't weird I used a lot of time to try to move the startPos 4 places forward when I thought it was executed in the big Case test function.
Well I have a vague idea on how to colour import modules for python too now. Not sure if it is nessesary for other languages. People seldom need it in C++, except if they insist to write the whole name for namespaces and so on.
std::cout
Will try one day when I have the time. Guess I need an other array to remember the import modules, and then color every occourence of them in some way.
Thanks for your help. Your code doesn't look THAT sloppy now...:)
Greg Snooks law:
Note: For every coder, there is a coder that doesn't like his coding style.