Skip to content
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

Add a new Fortran grammar #533

Closed
uncenter opened this issue Oct 27, 2023 · 5 comments
Closed

Add a new Fortran grammar #533

uncenter opened this issue Oct 27, 2023 · 5 comments

Comments

@uncenter
Copy link
Contributor

uncenter commented Oct 27, 2023

Looks like the Fortran grammar was removed a few years ago (#111) (because the repository was deleted and grammar removed) but we could use grammars from https://github.com/fortran-lang/vscode-fortran-support/tree/main/syntaxes instead?

@uncenter
Copy link
Contributor Author

uncenter commented Oct 28, 2023

Trying to make a PR for this but I have a dilemma for sorts... there are two grammars for Fortran, the fixed form grammar and the free form grammar. Fixed form is for older versions of fortran, and free form for the modern versions.

This is what I have right now, with the free form grammar:

export const githubGrammarSources = {
  // ...
  ['fortran', 'https://github.com/fortran-lang/vscode-fortran-support/blob/main/syntaxes/fortran_free-form.tmLanguage.json'],
}
export const languageAliases = {
  // ...
  fortran: ['f90', 'f95', 'f03', 'f08', 'f18', 'fpp'],
}

But I'm wondering if I should (also) do something like this for the fixed form:

export const githubGrammarSources = {
  // ...
  ['fortran-fixed', 'https://github.com/fortran-lang/vscode-fortran-support/blob/main/syntaxes/fortran_fixed-form.tmLanguage.json'],
}
export const languageAliases = {
  // ...
  'fortran-fixed': ['f', 'f77', 'for'],
}

@uncenter
Copy link
Contributor Author

I gave it a shot a while back and I couldn't get it to properly syntax highlight. I would appreciate if someone else could take a look!

@GitMensch
Copy link

Like with COBOL it would be good to have separate grammars. If I remember correct a grammar can include/extend another one, which then would be a reasonable thing to do here.

@antfu
Copy link
Member

antfu commented Jan 26, 2024

Hey, thanks for your contribution! With the recent rewrite of v1.0, we have moved the grammars out of this repository. We generally suggest you loading the grammar locally to move forward. If you believe this is the language that is widely used, you can send an issue or PR to this repo: https://github.com/shikijs/textmate-grammars-themes

Thank you!

@antfu antfu closed this as completed Jan 26, 2024
@uncenter
Copy link
Contributor Author

I've added it in shikijs/textmate-grammars-themes#18 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants