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 C# language support #276

Merged
merged 2 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@
[submodule "tree-sitter-ql/vendor/tree-sitter-ql"]
path = tree-sitter-ql/vendor/tree-sitter-ql
url = https://github.com/tree-sitter/tree-sitter-ql
[submodule "tree-sitter-c-sharp/vendor/tree-sitter-c-sharp"]
path = tree-sitter-c-sharp/vendor/tree-sitter-c-sharp
url = https://github.com/tree-sitter/tree-sitter-c-sharp
3 changes: 3 additions & 0 deletions tree-sitter-c-sharp/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# v0.1.0.0

* add tree-sitter-c-sharp parser
2 changes: 2 additions & 0 deletions tree-sitter-c-sharp/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
17 changes: 17 additions & 0 deletions tree-sitter-c-sharp/TreeSitter/CSharp.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module TreeSitter.CSharp
( tree_sitter_c_sharp
, getNodeTypesPath
, getTestCorpusDir
) where

import Foreign.Ptr
import TreeSitter.Language
import Paths_tree_sitter_c_sharp

foreign import ccall unsafe "vendor/tree-sitter-c-sharp/src/parser.c tree_sitter_c_sharp" tree_sitter_c_sharp :: Ptr Language

getNodeTypesPath :: IO FilePath
getNodeTypesPath = getDataFileName "vendor/tree-sitter-c-sharp/src/node-types.json"

getTestCorpusDir :: IO FilePath
getTestCorpusDir = getDataFileName "vendor/tree-sitter-c-sharp/corpus"
49 changes: 49 additions & 0 deletions tree-sitter-c-sharp/tree-sitter-c-sharp.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
cabal-version: 2.4
name: tree-sitter-c-sharp
version: 0.1.0.0
synopsis: Tree-sitter grammar/parser for C#
description: This package provides a parser for C# suitable for use with the tree-sitter package.
license: BSD-3-Clause
homepage: https://github.com/tree-sitter/haskell-tree-sitter/tree/master/tree-sitter-c-sharp
author: Max Brunsfeld, Tim Clem, Rob Rix, Josh Vera, Rick Winfrey, Ayman Nadeem, Patrick Thomson, Damien Guard
maintainer: damieng@gmail.com
copyright: 2020 GitHub
category: Tree-sitter, CSharp, C#
build-type: Simple
data-files: vendor/tree-sitter-c-sharp/src/node-types.json
, vendor/tree-sitter-c-sharp/corpus/*.txt
extra-source-files: ChangeLog.md

common common
default-language: Haskell2010
ghc-options:
-Weverything
-Wno-all-missed-specialisations
-Wno-implicit-prelude
-Wno-missed-specialisations
-Wno-missing-import-lists
-Wno-missing-local-signatures
-Wno-monomorphism-restriction
-Wno-name-shadowing
-Wno-safe
-Wno-unsafe
if (impl(ghc >= 8.6))
ghc-options: -Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies

library
import: common
exposed-modules: TreeSitter.CSharp
autogen-modules: Paths_tree_sitter_c_sharp
other-modules: Paths_tree_sitter_c_sharp
build-depends: base >= 4.12 && <4.14
, tree-sitter ^>= 0.9.0.0
Include-dirs: vendor/tree-sitter-c-sharp/src
install-includes: tree_sitter/parser.h
c-sources: vendor/tree-sitter-c-sharp/src/parser.c
extra-libraries: stdc++

source-repository head
type: git
location: https://github.com/tree-sitter/haskell-tree-sitter
1 change: 1 addition & 0 deletions tree-sitter-c-sharp/vendor/tree-sitter-c-sharp
Submodule tree-sitter-c-sharp added at df2095