github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
11.96k stars 4.14k forks source link

ASH scripts misidentified as AGS #5022

Open midgleyc opened 3 years ago

midgleyc commented 3 years ago

ASH is a currently unrecognised language used for scripting KoLMafia, a program for playing the online game "Kingdom of Loathing". There is documentation available at the KoLMafia wiki. It seems quite popular throughout GitHub -- here's a search for a commonly used global function, "get_property".

All ASH scripts have the ".ash" extension, currently owned by AGS Scripts.

Preliminary Steps

Please confirm you have...

Problem Description

I'd like ASH to be added. I think it meets the "hundreds of repositories" requirement. Limiting the extension to ".ash" and comparing a search for "get_property" (I assume 100% ASH) to "int" (I assume a mix of ASH and AGS, and also that I've got most of the AGS .ash files) I think about a third of "AGS" scripts with the .ash extension are actually ASH. I don't think there's an existing TextMate grammar -- is there a simpler file structure I could provide, given that it won't be used for TextMate, only this?

There is a difficulty in that there are many valid AGS script files with a .ash extension. One heuristic could be to search for various common global functions in ASH: "set_property", "get_property", "cli_execute" and "visit_url"; or the keyword "notify". Alternatively, I think .ash in AGS is header file-esque, so if any functions are defined it's ASH.

The current syntax highlighting poses a problem for some ASH files, mostly where it interprets a ' in the middle of an $items[] (or $strings[], or $effects[]) construct as starting a new string, and formats the rest of the file accordingly. An example with "$item[FantasyRealm Warrior's Helm]".

URL of the affected repository:

Both https://github.com/Ezandora/Guide and https://github.com/Aenimus/newDG have free licenses (Unlicense and MIT respectively) and are recognised as AGS Script where they should be ASH.

Last modified on:

Expected language:

ASH

Detected language:

AGS Script

smola commented 3 years ago

@midgleyc ASH might be a bit confusing (ash as in Almquist shell might be better known than KoLMafia). Do you think KoLMafia ASH would be a good name for the language?

midgleyc commented 3 years ago

@smola Sounds good to me, nice and descriptive.

smola commented 3 years ago

By the way, I didn't get proper stats, but this is common enough that the vast majority of .ash files retrieved by my sample harvesting scripts were ASH, not AGS Script.