Thread: Re: [pure-lang-users] gedit pure.lang
Status: Beta
Brought to you by:
agraef
From: Eddie R. <er...@bm...> - 2008-08-29 11:23:26
|
On Thu 28/08/08 6:15 PM , Albert Graef Dr....@t-... sent: > Eddie Rucker wrote: > > This is the beginnings of a keyword highlight > file for gedit. I think> Libor wanted one of these? > > Cool. Mind you, there's a typo in that file: s/othrwise/otherwise/. I'll get that fixed when I get to work. > Does gedit support folding? I think that's one of the coolest features > of Kate's Pure highlighting. I can't get to their main site www.gnome.org/projects/gedit/ to verify, but I don't think it does. > > I ripped it off from Marco Barision > and> Emanuela Aina's Ada highlight package and made > the modifications for> pure. Is this legal? > > Well you gave them credit, and I don't think that anyone in their right > mind would want to claim copyright in a silly little list of keywords. I get nervous when it comes to copyright, trademark, and other legal matters. > I suppose that you don't mind if I include this in the Pure > distribution? Let me add in their blurb at the top of the syntax file and sure, do whatever you want with it. e.r. |
From: Eddie R. <er...@bm...> - 2008-08-30 16:41:45
|
On Sat 30/08/08 10:40 AM , Albert Graef Dr....@t-... sent: > Eddie Rucker wrote: > > 1. ? > > That might be a C speciality, I'm pretty sure that this is neither > Pascal nor Algol syntax. (Pure also allows this, but only if followed by > a scale factor, as in 1.e-7.) > > But .5 has been supported by every programming language that I remember > right now (except Lisp), back to the venerable Algol 60, so there must > be some reason for that. At least Pure is in good company there. > > Just for the record, Haskell allows neither .5 nor 5., even if followed > by a scale factor. > mzscheme does but I don't know about common lisp. > (* .4 .5) 0.2 One of these days, I'm going to try to program something with common lisp to see what it is like. Maybe then I can figure out why the common lisp folks and the scheme folks bicker and bite at each other all of the time. e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-30 18:34:51
|
Eddie Rucker wrote: > One of these days, I'm going to try to program something with common lisp to see what it is like. Maybe then I can figure out why the > common lisp folks and the scheme folks bicker and bite at each other all of the time. Well, CL hackers can follow their lineage back to the legendary days of the holy MacLisp, when men were men and computers were hulking giants. And Schemers can only look down in digust at the behemoth that CL is, with its unhygienic macros and all that legacy stuff. ;-) Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |
From: Eddie R. <er...@bm...> - 2008-08-30 17:14:27
|
On Sat 30/08/08 9:41 AM , John Cowan co...@cc... sent: > I suspect that ".5" got started in Fortran on the IBM keypunch > machines,where typing "0" was not only extra physical work just to push > down thekey, but made it that much more likely that you'd run off the end of > the card. I could not find anything about the history of leaving off the leading 0 but it would make sense for FORTRAN programmers to do that with punch cards. I lost my Web page (Dr. Math?) but I saw something about a company using leaving off 0s in front of the decimal point in probability to indicate that a probability can never be greater than one. All of my senior level probability and statistics books use leading zeros. Oh well. e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-30 18:26:17
|
Eddie Rucker wrote: > I could not find anything about the history of leaving off the leading 0 but it would make sense for FORTRAN programmers to do that > with punch cards. John may have a point there, but I've frequently seen seen it in handwriting by US people, too. It might also have something to do with the development of electronic calculators (although Fortran was earlier). But maybe there was some "prior art" which got picked up in the design of Fortran, too? I couldn't find anything definite on the web either, strange. Maybe we should ask someone from the Computer History Museum... Another related bit of trivia is that the Algol 60 design process nearly stalled at some point because of the fierce debate over the decimal separator. So flamewars over lexical issues have a really long tradition in computer science. ;-) Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |
From: Eddie R. <er...@bm...> - 2008-08-30 19:31:44
|
On Sat 30/08/08 1:28 PM , Albert Graef Dr....@t-... sent: > Another related bit of trivia is that the Algol 60 design process nearly > stalled at some point because of the fierce debate over the decimal > separator. So flamewars over lexical issues have a really long tradition > in computer science. ;-) Yes, I remember reading about that in a PLT course! e.r. |
From: Eddie R. <er...@bm...> - 2008-08-30 19:51:51
|
On Sat 30/08/08 1:36 PM , Albert Graef Dr....@t-... sent: > Well, CL hackers can follow their lineage back to the legendary days of > the holy MacLisp, when men were men and computers were hulking giants. > And Schemers can only look down in digust at the behemoth that CL is, > with its unhygienic macros and all that legacy stuff. ;-) :-O e.r. |
From: Eddie R. <er...@bm...> - 2008-08-29 13:19:46
Attachments:
pure.lang
|
On Fri, 2008-08-29 at 05:55 -0500, Eddie Rucker wrote: > On Thu 28/08/08 6:15 PM , Albert Graef Dr....@t-... sent: > > Cool. Mind you, there's a typo in that file: s/othrwise/otherwise/. Fixed. I also did some modifications to handle numbers better. I noticed gedit doesn't highlight an int index when I have something like (0..4). Kate doesn't handle it properly either (it highlights the ".") 0. is in Kate's floating point rules and I haven't fixed rules at all for this in gedit. I haven't figured out how to just highlight the 0 without also highlighting the .. I think I'll just leave it alone for right now as my work plate for today is full. e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-29 22:54:01
|
Eddie Rucker wrote: > On Fri, 2008-08-29 at 05:55 -0500, Eddie Rucker wrote: >> On Thu 28/08/08 6:15 PM , Albert Graef Dr....@t-... sent: >>> Cool. Mind you, there's a typo in that file: s/othrwise/otherwise/. > > Fixed. Thanks a bunch. It's in svn now. I added some remarks on usage to the top of the file, maybe you want to review and correct these. I also had to rename the file to gpure.lang, since there's already another pure.lang file for Simon's hightlight program. (That's the program I use to beautify the examples on the Pure website. Unfortunately, that program doesn't like it if the language definition file is named differently; Gedit doesn't seem to have a problem with that. Boy I hate it when programs like these use generic filename extensions like .lang or .xml, Kate is no better either.) > I noticed gedit doesn't highlight an int index when I have something > like (0..4). Kate doesn't handle it properly either (it highlights the > ".") 0. is in Kate's floating point rules and I haven't fixed rules at > all for this in gedit. I haven't figured out how to just highlight the 0 > without also highlighting the .. The following regex should properly describe Pure numbers, except for the case of a floating point number starting with a decimal point. That doesn't seem to be possible without breaking '..', since those highlighting engines don't seem to support left context; at least I couldn't figure it out. 0[xX][0-9a-fA-F]+L?|\d+L?|\d+(\.\d+)?([eE][\-\+]?\d+)?|\d+(\.\d*)?[eE][\-\+]?\d+ Unfortunately, that regex makes Kate go bonkers, don't know why, so I stick with Kate's predefined Int/Float highlighting rules for now. Maybe you have more luck with that. :) Thanks again for that gedit highlighting. I guess we support the most important non-Windows editors now. Cheers, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |
From: Eddie R. <er...@bm...> - 2008-08-29 23:14:21
|
On Sat, 2008-08-30 at 00:55 +0200, Albert Graef wrote: > Thanks a bunch. It's in svn now. I added some remarks on usage to the > top of the file, maybe you want to review and correct these. I also had Your welcome. Looks good to me. > The following regex should properly describe Pure numbers, except for > the case of a floating point number starting with a decimal point. That > doesn't seem to be possible without breaking '..', since those > highlighting engines don't seem to support left context; at least I > couldn't figure it out. I played with this a while but finally gave up because fixing one case breaks another. A space between a number and .. highlights fine. Although irritating, It isn't worth the time. We have Labor Day holiday this Monday so I guess it's time to get on the roof and fix those shingles. I hate heights! Have a good weekend! e.r. |
From: John C. <co...@cc...> - 2008-08-29 23:31:26
|
Albert Graef scripsit: > The following regex should properly describe Pure numbers, except for > the case of a floating point number starting with a decimal point. Supporting those is silly. a*.5? No, no. a*0.5 is far more readable. Just change the definition of a float. -- What is the sound of Perl? Is it not the John Cowan sound of a [Ww]all that people have stopped co...@cc... banging their head against? --Larry http://www.ccil.org/~cowan |
From: Eddie R. <er...@bm...> - 2008-08-30 03:56:47
|
On Fri, 2008-08-29 at 19:31 -0400, John Cowan wrote: > Albert Graef scripsit: > > > The following regex should properly describe Pure numbers, except for > > the case of a floating point number starting with a decimal point. > > Supporting those is silly. a*.5? No, no. a*0.5 is far more readable. > Just change the definition of a float. I agree absolutely! I had a Chemistry Professor that used to get red hot if students wrote numbers with a leading decimal point. Unfortunately some of the elementary statistics books I've had to use write numbers that way. It looks like they would know better? It makes it hard to get across to students not to write numbers when some of the books write them that way. Try writing on a pucked chalk board without a leading 0 ;-) e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-29 23:36:59
|
Eddie Rucker wrote: > We have Labor Day holiday this Monday so I guess it's time to get on the > roof and fix those shingles. I hate heights! Me too. Good luck with that, don't stumble! And a nice weekend and holiday! Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |
From: Eddie R. <er...@bm...> - 2008-08-30 03:59:20
|
On Sat, 2008-08-30 at 01:38 +0200, Albert Graef wrote: > Eddie Rucker wrote: > > We have Labor Day holiday this Monday so I guess it's time to get on the > > roof and fix those shingles. I hate heights! > > Me too. Good luck with that, don't stumble! And a nice weekend and holiday! Thanks! I have to append some boards on top of a latter and hang the latter over the roof top and climb down. The roof pitch is 45 degrees on the side with the missing shingles. Not my cup of tea :( Have a good weekend too. e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-29 23:41:17
|
John Cowan wrote: > Supporting those is silly. a*.5? No, no. a*0.5 is far more readable. > Just change the definition of a float. In good ol' Europe we never write .5, I guess it's a US thing. But it's supported in most programming languages, and it doesn't do any harm in the Pure syntax. Conversely, 1. is forbidden, to avoid issues with the .. operator. -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |
From: Eddie R. <er...@bm...> - 2008-08-30 04:06:22
|
On Sat, 2008-08-30 at 01:43 +0200, Albert Graef wrote: > John Cowan wrote: > > Supporting those is silly. a*.5? No, no. a*0.5 is far more readable. > > Just change the definition of a float. > > In good ol' Europe we never write .5, I guess it's a US thing. But it's > supported in most programming languages, and it doesn't do any harm in > the Pure syntax. Conversely, 1. is forbidden, to avoid issues with the > .. operator. I think this thing must have started with business folk or education folk. All the Mathematicians, Engineers, and Scientists I know frown on this sort of thing. e.r. |
From: John C. <co...@cc...> - 2008-08-30 14:40:59
|
Eddie Rucker scripsit: > I think this thing must have started with business folk or education > folk. All the Mathematicians, Engineers, and Scientists I know frown on > this sort of thing. I suspect that ".5" got started in Fortran on the IBM keypunch machines, where typing "0" was not only extra physical work just to push down the key, but made it that much more likely that you'd run off the end of the card. -- John Cowan http://ccil.org/~cowan co...@cc... 'My young friend, if you do not now, immediately and instantly, pull as hard as ever you can, it is my opinion that your acquaintance in the large-pattern leather ulster' (and by this he meant the Crocodile) 'will jerk you into yonder limpid stream before you can say Jack Robinson.' --the Bi-Coloured-Python-Rock-Snake |
From: Eddie R. <er...@bm...> - 2008-08-30 04:16:16
|
On Sat, 2008-08-30 at 01:43 +0200, Albert Graef wrote: > John Cowan wrote: > > Supporting those is silly. a*.5? No, no. a*0.5 is far more readable. > > Just change the definition of a float. > > In good ol' Europe we never write .5, I guess it's a US thing. But it's > supported in most programming languages, and it doesn't do any harm in > the Pure syntax. Conversely, 1. is forbidden, to avoid issues with the > .. operator. 1. ? #include <stdio.h> int main(void) { printf("%g\n", 3. * 0.2); return 0; } $ a.out 0.6 I guess you're right. That's weird. e.r. |
From: Albert G. <Dr....@t-...> - 2008-08-30 15:39:20
|
Eddie Rucker wrote: > 1. ? That might be a C speciality, I'm pretty sure that this is neither Pascal nor Algol syntax. (Pure also allows this, but only if followed by a scale factor, as in 1.e-7.) But .5 has been supported by every programming language that I remember right now (except Lisp), back to the venerable Algol 60, so there must be some reason for that. At least Pure is in good company there. Just for the record, Haskell allows neither .5 nor 5., even if followed by a scale factor. -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |