Giter Site home page Giter Site logo

amaanq / tree-sitter-foam Goto Github PK

View Code? Open in Web Editor NEW

This project forked from foamscience/tree-sitter-foam

0.0 1.0 0.0 348 KB

OpenFOAM grammar for Tree-Sitter

Shell 0.76% JavaScript 2.42% C++ 0.26% Scheme 0.69% Python 0.12% C 94.35% Rust 0.93% Makefile 0.47%

tree-sitter-foam's Introduction

OpenFOAM grammar for Tree-Sitter

This project is in early phases of development; expect things to change considerably

DISCLAIMER: This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks.

OpenFOAM dictionary syntax highlighting

This is a generic fail-tolerant parser for OpenFOAM case dictionaries. The goal is to reach a state that is "good enough" for syntax highlighting and feasible symbols extraction.

Features

  • Semantic understanding of OpenFOAM IO entries (Dictionaries, key-value pairs, ... etc)
  • Syntax highlighting (Targeting nvim-treesitter mainly)
  • Highlighting of C++ code blocks and regular expressions, so if your client does not install those parsers automatically, you might have to install them manually
  • Scope-awareness is there (Per-dictionary) although not used yet
  • Text-objects for dictionaries and key-value pairs to use with TreeSitter textobjects plugin for NeoVim
  • Text-subjects to use with TreeSitter textsubjects plugin for NeoVim
  • Expression-based folding

Running tests

  • Unit tests for both parsing and highlighting (Highlighting is not consistent between tree-sitter highlight and nvim-treesitter) are executed with tree-sitter test (Check the test folder)
  • testOFFiles.sh $FOAM_TUTORIALS parses all OpenFOAM dictionaries in the tutorials directory
    • Currently, the parser works on almost all OpenFOAM 8 and Foam-Extend 4 tutorial files (Well, some files are faulty from source!)

Contributing

  • Pull requests are welcome!
  • And, no I'm not going to support specific keyword highlighting (eg. scalarField will never be treated in a special way) unless I find an "unattended" way to do that.

tree-sitter-foam's People

Contributors

foamscience avatar 414owen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.