-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds language files for QB64 (vanilla and $NOPREFIX mode) #133
base: master
Are you sure you want to change the base?
Conversation
Oh dang... whitespace at EOL. Hold on. |
Looking through the language file it looks good so far. There are some issues commonly popping up, that are usually easy to fix. Let's dig in:
The first warning is a note about the first keyword group, which is currently empty. Traditionally this keyword group contains control flow statements and other structural keywords (like SUB, FUNCTION, RETURN). Having that group empty is a waste of resources, as this takes up extra cycles without doing any highlighting work. The notice below is a hint regarding one of the keywords listed in the second keyword group. GeSHi differentiates between keywords (mostly letters) and operators/symbols (usually no letters) as keywords are matched with additional boundary conditions. The entry Which brings up another point I noticed with that first language file: Some keywords begin with The second language file basically complains about the same first two issues. The other issues reported are keywords that appear more than once in the language file and thus may cause ambiguity when highlighting. Also at times this can cause problems with the URL linking feature if keywords in one (later) group match on URLs generated for keywords in an earlier group. I hope this helps so far. |
Will work on those. |
Adds coloring for $metacommands group.
Oh, finally 👍 |
CHANGELOG
Outdated
@@ -17,6 +17,7 @@ Version 1.0.9.1 | |||
* OpenSSH config (Kevin Ernst) | |||
* roff (Artur Iwicki) | |||
* Wolfram (Mysterious Light) | |||
* QB64 (changes to Nigel McNie's work on qbasic.php made by Fellippe Heitor/QB64 Team) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just your name here is fine; list is alphabetical.
Should also start a new block for Version 1.0.9.2 (1.0.9.1 has been released already).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, will change it.
src/geshi/qb64.php
Outdated
* Author: Nigel McNie (nigel@geshi.org) | ||
* Copyright: (c) 2004 Nigel McNie (http://qbnz.com/highlighter/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add your name here in that list. Usually there's no extra mod by line - everybody who considers himself to have contributed enough to feel the need to be mentioned may add himself as (co)author)..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
src/geshi/qb64.php
Outdated
* Original file: qbasic.php | ||
* Author: Nigel McNie (nigel@geshi.org) | ||
* Copyright: (c) 2004 Nigel McNie (http://qbnz.com/highlighter/) | ||
* Release Version: 1.0.9.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.0.9.2 (although this will be updated automagically when I prepare updates).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aight.
src/geshi/qb64.php
Outdated
* Release Version: 1.0.9.0 | ||
* Date Started: 2004/06/20 | ||
* | ||
* QBasic/QuickBASIC language file for GeSHi. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QB64 langauge file … I presume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah :-)
src/geshi/qb64.php
Outdated
* ------------------------- | ||
* * Make sure all possible combinations of keywords with | ||
* a space in them (EXIT FOR, END SELECT) are added | ||
* to the first keyword group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that there's a special PARSER_CONTROL (cf. vbscript language or bash:
Line 471 in fd22ab7
'SPACE_AS_WHITESPACE' => false |
EXIT FOR
will still match if there was more than one tab or space to separate those keywords.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check what's been done to the vbscript parser, thanks.
src/geshi/qb64.php
Outdated
'COMMENT_MULTI' => array(), | ||
'COMMENT_REGEXP' => array( | ||
//Single-Line Comments using REM command | ||
2 => "/\bREM.*?$/i", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note sure here, but does REMOTE at the begin of a line really start a comment too? Or should it be /\bREM\b.*?$/i
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex is beyond me, but REM does require at least one space before comment starts. I trust that's what your proposed fix does, so I'll be adding it and testing it to see if it goes as intended. Thanks!
src/geshi/qb64.php
Outdated
GESHI_NUMBER_FLT_NONSCI_F | GESHI_NUMBER_FLT_SCI_SHORT | | ||
GESHI_NUMBER_FLT_SCI_ZERO, | ||
'KEYWORDS' => array( | ||
3 => array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a hard requirement, but keyword groups should be indexed starting at 1. Many generic stylesheets somewhat rely on that to provide reasonable highlighting even for new languages.
NB: Commonly grouping is roughly based on: kw1-> reserved words/control flow, kw2->built-in functions, kw3->common other stuff usually used (like system-provided variables), kw4…->all the other stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, because of the typical grouping convention I felt I should skip block 1 since for QBasic-based languages it's all keywords really, regardless of being control flow keywords (Nigel skipped block 1 for the original qbasic.php
, leaving it blank - which caused issues with the CI and brought considerable confusion to me) but I'll reassign the proper sequential number to those starting at 1.
src/geshi/qb64np.php
Outdated
* qb64np.php | ||
* Mod by: Fellippe Heitor (fellippe@qb64.org) | ||
* ---------- | ||
* Original file: qbasic.php | ||
* Author: Nigel McNie (nigel@geshi.org) | ||
* Copyright: (c) 2004 Nigel McNie (http://qbnz.com/highlighter/) | ||
* Release Version: 1.0.9.0 | ||
* Date Started: 2004/06/20 | ||
* | ||
* QBasic/QuickBASIC language file for GeSHi. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cf. notes on the other file.
BTW: What's the diff between qb64 and qb64np?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With v1.4 QB64 introduced a metacommand ($NOPREFIX) that allows both _TITLE and TITLE to be used, reducing typing. File qb64np.php includes both prefixed and non-prefixed keywords, so users can highlight their code properly in the forum:
Is it possible to use $NOPREFIX as a trigger to allow a certain keyword group to be toggled? I thought that might have been too much to ask, hence the pair of language files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GeSHi 1.0 branch does not allow for much of contextual highlighting (parser limitation), while the GeSHi 1.1 branch (other repo) even allows for nesting languages and other crazy things. So splitting those two use-cases is fine.
If all keywords of a group should be matched with and without a certain prefix you might even play with the PARSER_CONTROL -> KEYWORDS -> BEFORE setting matching the usual boundary followed by an optional _?
. Keywords themselves would be without the underscore in the keyword list only. But that's probably best for some separate PR.
src/geshi/qb64np.php
Outdated
3 => 'http://www.qb64.org/wiki/index.php/{FNAMEU}', | ||
4 => 'http://www.qb64.org/wiki/index.php/{FNAMEU}', | ||
5 => 'http://www.qb64.org/wiki/index.php/{FNAMEU}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please link HTTPS if you provide proper TLS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
src/geshi/qb64.php
Outdated
3 => 'http://www.qb64.org/wiki/index.php/{FNAMEU}', | ||
4 => 'http://www.qb64.org/wiki/index.php/{FNAMEU}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please link to the HTTPS version as you provide TLS on your site.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Sorry for the late feedback.
No description provided.