Skip to content

Add BIRD2 language#7513

Open
Alice39s wants to merge 22 commits intogithub-linguist:mainfrom
Alice39s:add-bird2-language
Open

Add BIRD2 language#7513
Alice39s wants to merge 22 commits intogithub-linguist:mainfrom
Alice39s:add-bird2-language

Conversation

@Alice39s
Copy link

@Alice39s Alice39s commented Aug 2, 2025

Summary

This PR introduces syntax highlighting support for the BIRD2 configuration language via .conf files used by the BIRD Internet Routing Daemon.

Unlike simpler configuration models (e.g., INI or Nginx), BIRD employs a uniquely intricate paradigm with distinct implementation challenges. We address this by adding a textmate grammar with precise scoping for:

  • Protocol definitions
  • Filter functions
  • Route maps
  • Other core BIRD2 constructs

Motivation

BIRD2 powers critical Internet infrastructure at scale, including:

  • AMS-IX – 870+ ASNs, 14Tb/s traffic (ref)
  • LINX – 1,000+ BGP sessions on v2.13 (ref)
  • Cloudflare – Anycast routing across all edge PoPs (ref)

Despite its critical role in major Internet infrastructure, editors like VSCode and Shiki lack native grammar support for BIRD2 configurations. This PR aims to fill that gap.

References

License

Checklist:

@Alice39s Alice39s requested a review from a team as a code owner August 2, 2025 20:09
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comment. Please also follow the instructions for adding the grammar in CONTRIBUTING.md.

@Alice39s Alice39s requested a review from lildude August 3, 2025 19:16
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove the two missing grammar licences. I'm trying to get the author to restore the repos.

@Alice39s
Copy link
Author

Alice39s commented Aug 4, 2025

You're right — thanks for pointing that out.

I ran script/add-grammar and didn’t realize it would remove those entries automatically. That wasn’t my intention, and I’d be happy to fix it — though I’m not entirely sure what the best way is to restore them manually.

If you could point me in the right direction, I’d really appreciate it 🙏!

Apologies again for the unintended change.

@lildude
Copy link
Member

lildude commented Aug 4, 2025

The easiest would be to revert your previous commit and then re-apply just your changes.

@Alice39s Alice39s requested a review from lildude August 4, 2025 19:23
@Alice39s
Copy link
Author

Alice39s commented Aug 6, 2025

Hi @lildude 👋

Gentle ping on this — updates done per your feedback (extensions & licenses) - Could you take a look when you have a moment?

Thanks for your time!

@Alhadis Alhadis changed the title Add bird2 language Add BIRD2 language Aug 7, 2025
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments. Additionally, as you're adding support only for filenames, the samples need to match those filenames. None of your samples do so they need to be replaced with real examples of those you're adding support for.

Copy link
Author

@Alice39s Alice39s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alice39s Alice39s requested a review from lildude August 12, 2025 15:57
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Samples can not be in subdirectories. Please move them to a level.

Please also update the PR template to provide individual links to the search results for each of the filenames you're adding and fix the information about the samples' sources and licences.

- Move all BIRD2 sample configuration files from subdirectories to the top-level directory ().
@Alice39s
Copy link
Author

Samples can not be in subdirectories. Please move them to a level.

Please also update the PR template to provide individual links to the search results for each of the filenames you're adding and fix the information about the samples' sources and licences.

@lildude Thanks for the feedback and detailed explanation!

I've made the following changes based on your suggestions:

  1. I've moved all the sample configuration files from subdirectories to the top level. They are now all located in the samples/BIRD2 directory.
  2. I've updated the PR template to provide individual search result links for each new filename.
  3. I've corrected the information regarding the samples' sources and licenses.

Please take another look, and let me know if there are any further changes required.

Copy link
Author

@Alice39s Alice39s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alice39s Alice39s requested a review from lildude August 19, 2025 07:11
@Alice39s
Copy link
Author

Hi @lildude, could you take a look at this when you have a chance? 🙂

Updates are in place, and I really appreciate your help!

@Alice39s
Copy link
Author

Alice39s commented Sep 3, 2025

Hi @lildude 👋

Hope you’re doing well! Just wanted to gently follow up on this PR when you have a moment. I believe all the requested changes have been addressed, and it’s currently awaiting your review.

Please let me know if there’s anything else you’d like me to adjust. Really appreciate your time and guidance on this!

Thanks in advance 🙏

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test failure is because samples/BIRD2/bird.conf is in the wrong place. It needs to be at samples/BIRD2/filenames/bird.conf

@Alice39s Alice39s requested a review from lildude September 9, 2025 17:35
@Alice39s
Copy link
Author

Alice39s commented Sep 9, 2025

The test failure is because samples/BIRD2/bird.conf is in the wrong place. It needs to be at samples/BIRD2/filenames/bird.conf

Thanks for catching that! 🙏 I've moved the sample config to samples/BIRD2/filenames/bird.conf as suggested.

Please let me know if there’s anything else you'd like me to adjust.

@RedCMD
Copy link

RedCMD commented Sep 23, 2025

@pppwaw
Copy link

pppwaw commented Sep 25, 2025

a bunch of the regexes have extra erroneous backslashes

https://github.com/bird-chinese-community/BIRD-tm-language-grammar/blob/c39653d00f6337f9fe4ba9c75f403c29dbec3907/grammars/bird2.tmLanguage.json#L558

image

Hi, I I’ve just fixed the issue in the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants