dosper7 / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

[PATCH] (unstructured) BASIC and Turbo Pascal Syntax Highlighting #137

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Last year, when I felt a bit retro, I posted some BASIC v2 (unstructured) and 
old Turbo Pascal sources. To have proper highlighting, I created extensions for 
google-code-prettify. Maybe you feel like adding it. I also added test cases in 
the test html page.

Cheers, Peter

Original issue reported on code.google.com by peter.codecop.kofler on 16 Jan 2011 at 9:10

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the patch.

How does your basic mode compare to the VB mode : 
http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vb.js
 ?

Original comment by mikesamuel@gmail.com on 18 Jan 2011 at 4:45

GoogleCodeExporter commented 8 years ago
VB Basic is much more advanced. Main differences are

 * Basic Comment = REM vs. VB Comment = '
 * Basic has other keywords: DATA, DEF FN, GOTO, etc. are not in VB
 * plain/identifiers are only 1 or 2 letters with trailing % or $. I'm not sure if identifiers in VB allow % at the end.
 * Literals are only numbers and 0.0E+0 notation
 * Other stuff is only more restrictive, like whitespace, but the VB stuff should work, too

It's really very "retro", early 80ties. The reserved words are CBM Basic v2 
(Commodore 64 BASIC). I'm not sure if it's reasonable to add it to the trunk, 
but wanted to share it anyway.

Original comment by peter.codecop.kofler on 20 Jan 2011 at 7:03

GoogleCodeExporter commented 8 years ago

Original comment by mikesamuel@gmail.com on 4 Apr 2011 at 5:52

GoogleCodeExporter commented 8 years ago
Thanks for the patch.  Do you mind if I slap an Apache 2 license header on the 
lang-* files?

> Basic Comment = REM vs. VB Comment = '

VB allows REM according to 
http://msdn.microsoft.com/en-us/library/aa711643(v=VS.71).aspx

CommentMarker ::= SingleQuoteCharacter | REM

Interestingly, SingleQuoteCharacter can be a smart quote -- you know, for those 
who develop in MS Word.

> Basic has other keywords: DATA, DEF FN, GOTO, etc. are not in VB

I saw GOSUB in your testcase and had a C64 flashback.

> plain/identifiers are only 1 or 2 letters with trailing % or $. I'm not sure 
if identifiers in VB allow % at the end.

According to http://msdn.microsoft.com/en-us/library/s9cz43ek.aspx they allow 
an optional run of type characters at the end : \[[%&@!#$]+\]

> Literals are only numbers and 0.0E+0 notation
> Other stuff is only more restrictive, like whitespace, but the VB stuff 
should work, too

Original comment by mikesamuel@gmail.com on 5 Apr 2011 at 3:19

GoogleCodeExporter commented 8 years ago
>Thanks for the patch.
Thank **you** for maintaining prettify

>Apache 2 license
I'm not surem what licence I put into the header if any. Usually I use New BSD 
License. Sure, go ahead with the Apache licence. I agree.

>keywords
not sure about it but maybe it's more reasonable to add the few missing 
reserved words to your VB, so the number of files does not explode. On the 
other hand, a VB variable might be called gosub?

Original comment by peter.codecop.kofler on 15 Apr 2011 at 7:27

GoogleCodeExporter commented 8 years ago
Regarding the Pascal highlighting:

I would suggest adding a few more keywords to the Pascal mode to make it 
compatible with what is nowadays considered Pascal code (most if not all of 
today's Pascal development (and Pascal projects hosted on Google Code) are done 
with today's Object Pascal like it is implemented in Delphi or FPC and not so 
much in the ancient early 1980's Borland dialects (don't get me wrong, nothing 
against TurboPascal, I have spent many years with many versions of it but these 
days are over, nowadays many of us old TurboPascal veterans spend most of our 
time with Free Pascal or Delphi).

Here is a list of keywords:
http://www.freepascal.org/docs-html/ref/refse3.html#x11-100001.3

It should contain all the keywords from sections
1.3.1 
1.3.2 
1.3.3

I am not sure how the prettify parser is capable of parsing the modifiers (from 
section 1.3.4) that have a special meaning only when they occur in certain 
places, if it doesn't highlight all of them it is not so important.

At least such *essential* words like try, finally, except, class, strict, 
private, protected, public, published, overload, override, reintroduce, 
virtual, abstract, initialization, finalization and many more that are found in 
almost every Pascal source file nowadays should be highlighted.

Original comment by prof7...@gmail.com on 19 Jul 2011 at 6:04

GoogleCodeExporter commented 8 years ago
I committed this in change 244 which will make it into the next release.

Would you like committer access in case you find yourself feeling retro again 
or making adjustements to this?

Original comment by mikesamuel@gmail.com on 9 Feb 2013 at 10:29

GoogleCodeExporter commented 8 years ago
Mike that is nice of you to ask. I see from the long list of open issues that 
you could use some help. And who knows, some of my next blog posts might use 
another unusual language. But honestly, I do not work with Javascript much and 
really can not promise you any help here beside coming up with new languages 
(if at all). 

Original comment by peter.codecop.kofler on 13 Feb 2013 at 5:21

GoogleCodeExporter commented 8 years ago
Cool.  You know where to drop any new languages.

Original comment by mikesamuel@gmail.com on 13 Feb 2013 at 7:09