Skip to content

VoxelPrismatic/tree-sitter-b

 
 

Repository files navigation

tree-sitter-b

B grammar for tree-sitter

Tsoding 🅱️ grammar for tree-sitter

Note

The provided queries only work for Neovim, thanks to the #has-ancestor? directive

linking

since B has very little standard library, and the B compiler automatically links with stdlib when possible, i have added the // -*- link: stdlib -*- comment. after this comment, lots of standard functions will be highlighted as a builtin. this is especially handy for smaller platforms, like uxn, which has various functions in its stdlib that other languages don't have.

if a link is found, it'll show up in the @diff.plus highlight group. otherwise, it remains @diff.minus

link with stdlib.h link with stdio.h
image image

(look at malloc and fprintf)

implemented links:

(eg // -*- link: assert.h -*-)

  • c libraries
    • assert.h
    • ctype.h
    • langinfo.h
    • locale.h
    • math.h
    • nl_types.h
    • regex.h
    • setjmp.h
    • signal.h
    • stdarg.h
    • stdio.h
    • stdlib.h
    • string.h
    • strings.h
    • time.h
    • wchar.h
    • wctype.h
  • uxn: uxn

implemented features

  • __asm__(...) highlighting
    • fasm/gas assembly by default
    • use the // -*- link: uxn -*- directive to highlight asm in uxntal

About

B grammar for tree-sitter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 50.0%
  • Scheme 38.5%
  • Tree-sitter Query 9.1%
  • Limbo 1.7%
  • Shell 0.7%