linguist icon indicating copy to clipboard operation
linguist copied to clipboard

Add QuickBASIC

Open DecimalTurn opened this issue 1 year ago • 4 comments

Description

This PR adds QuickBASIC (QB) as a langauge for the .bas extension.

Note that there exists a modern version of QuickBASIC known as QB64 that is still compatible with Classic QB. Since Classic QB and QB64 haven't reached the popularity threshold by their own at the moment, I've kept them combined, but we could separate them in the future if popularity justifies it.

The grammar used is the one for QB64, since it is also compatible with Classic QB.

Regarding heuristics, due to the similarities between FreeBASIC and QuickBASIC, this PR improves FreeBASIC's heuristics as well as adding new rules for QuickBASIC to make sure they are distinguished properly. Note that heuristics for QuickBASIC should always appear after FreeBASIC to work correctly.

  • FreeBASIC:

    • The previous rule was improved by adding the pragma keyword.
    • DataType-Pointer declaration
    • Declaration with inverted order (dim as name1 DataType instead of dim name1 as DataType)
    • Return keyword without the presence of GOSUB. The keyword is not unique to FreeBASIC, but if there is no instances of GOSUB, it's automatically FreeBASIC. Note that a second entry was needed to implement this rule.
  • QuickBASIC:

    • See comments in named pattern for more details

Checklist:

  • [x] I am adding a new language.
    • [x] The extension of the new language is used in hundreds of repositories on GitHub.com.
    • [x] I have included a real-world usage sample for all extensions added in this PR:
      • Sample source(s):
        • QuickBASIC samples:
          • https://github.com/skeeto/scratch/blob/master/sp4/sponge4.bas (Unlicense license)
          • https://github.com/DualBrain/QuickPakPro/blob/main/QB64/FGETRT.BAS (MIT)
          • https://github.com/DualBrain/QuickPakPro/blob/main/QB64/VLONG.BAS (MIT)
        • Extra BASIC samples (to help classifier):
          • https://github.com/yantrabuddhi/bwbasic3/blob/a062bd4a05fb9459d6e8188c4185638ccad04df7/NBS2/P180.BAS (GPL 2)
    • [x] I have included a syntax highlighting grammar: https://github.com/QB64Official/vscode
    • [x] I have added a color
      • Hex value: #008080
      • Rationale: Based on the green at the bottom of the QuickBASIC IDE.
    • [x] I have updated the heuristics to distinguish my language from others using the same extension.

DecimalTurn avatar Oct 06 '24 19:10 DecimalTurn

Related issue: https://github.com/github-linguist/linguist/issues/3216

DecimalTurn avatar Oct 07 '24 18:10 DecimalTurn

@lildude due to the potential interactions between my 2 other open PRs, would it be OK if I rebase them onto one another such that this one is at the top (while still being separate PRs)? This would be better for testing while this PR is being worked on and it should avoid any conflicts at merge time.

DecimalTurn avatar Oct 08 '24 14:10 DecimalTurn

Due to the similarities between QuickBASIC and FreeBASIC, I'm going to need to improve FreeBASIC's heuristics as well. I have a few improvements ready to be committed, but I should rebase on https://github.com/github-linguist/linguist/pull/7072 since it also make changes for FreeBASIC.

DecimalTurn avatar Oct 16 '24 13:10 DecimalTurn

@lildude due to the potential interactions between my 2 other open PRs, would it be OK if I rebase them onto one another such that this one is at the top (while still being separate PRs)? This would be better for testing while this PR is being worked on and it should avoid any conflicts at merge time.

Possibly. I'm not sure how well it'll work with the merge queue that we use.

lildude avatar Oct 16 '24 13:10 lildude

Possibly. I'm not sure how well it'll work with the merge queue that we use.

Not well it seems. Can you please address the conflicts.

lildude avatar Nov 25 '24 15:11 lildude

Not well it seems. Can you please address the conflicts.

Done.

DecimalTurn avatar Nov 26 '24 00:11 DecimalTurn

@jalbam @vwbusguy since you participated in the related issue (https://github.com/github-linguist/linguist/issues/3216), I just wanted to let you know that the changes are now live and if you push any changes to a QB repo, it should recalculate the language stats and show your repo as a QB repo.

Also, if you see some incorrect detection, feel free to mention it here or create a new issue and tag me in it. (Also note that the search is not updated yet, so it won't work correctly at the moment.)

DecimalTurn avatar Dec 05 '24 15:12 DecimalTurn