1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +00:00

LibSyntax: Add Language-from-String/Path functions

These are taken from HackStudio, but slightly rearranged to be more
alphabetical, and returning an empty Optional instead of "Unknown".
This commit is contained in:
Sam Atkins 2023-03-10 12:14:23 +00:00 committed by Sam Atkins
parent 82f58b8af0
commit ffce6cc977
2 changed files with 69 additions and 0 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/Forward.h>
#include <AK/StringView.h>
namespace Syntax {
@ -27,5 +28,7 @@ enum class Language {
StringView language_to_string(Language);
StringView common_language_extension(Language);
Optional<Language> language_from_name(StringView);
Optional<Language> language_from_filename(LexicalPath const&);
}