-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
447 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
<Project Sdk="Microsoft.Build.Traversal"> | ||
<ItemGroup> | ||
<ProjectReference Include="**\*.cproj" /> | ||
<ProjectReference Include="tree-sitter\tree-sitter.cproj" /> | ||
<ProjectReference Include="tree-sitter-c\tree-sitter-c.cproj" /> | ||
<ProjectReference Include="tree-sitter-cpp\tree-sitter-cpp.cproj" /> | ||
<ProjectReference Include="tree-sitter-lua\tree-sitter-lua.cproj" /> | ||
<ProjectReference Include="tree-sitter-json\tree-sitter-json.cproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Runtime.InteropServices; | ||
using TreeSitterSharp.Native; | ||
|
||
namespace TreeSitterSharp.Cpp; | ||
|
||
[LanguageName("Cpp")] | ||
internal class CppLanguageProvider : ILanguageProvider | ||
{ | ||
[DllImport("tree-sitter-cpp", EntryPoint = "tree_sitter_cpp", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] | ||
private static extern unsafe TsLanguage* tree_sitter_cpp(); | ||
public static unsafe Language GetLanguage() | ||
{ | ||
return new Language(tree_sitter_cpp()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Text; | ||
using TreeSitterSharp.Cpp; | ||
using TreeSitterSharp.Native; | ||
|
||
namespace TreeSitterSharp.Cpp; | ||
|
||
public unsafe class CppParser : Parser<CppSyntaxTree, CppSyntaxNode, CppParser> | ||
{ | ||
public CppParser() : base(CppLanguageProvider.GetLanguage()) | ||
{ | ||
|
||
} | ||
|
||
public override CppSyntaxTree Parse(Span<byte> code) => new(ParseCore(code)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TreeSitterSharp.Native; | ||
|
||
namespace TreeSitterSharp.Cpp; | ||
|
||
public partial class CppSyntaxNode : SyntaxNode<CppSyntaxTree, CppSyntaxNode>, ISyntaxNodeCreation<CppSyntaxTree, CppSyntaxNode> | ||
{ | ||
protected internal CppSyntaxNode(TsNode node) : base(node) | ||
{ | ||
} | ||
|
||
|
||
public static partial CppSyntaxNode Create(TsNode node); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Xml.Linq; | ||
using Microsoft.CodeAnalysis; | ||
using TreeSitterSharp.Native; | ||
|
||
namespace TreeSitterSharp.Cpp; | ||
public unsafe class CppSyntaxTree : SyntaxTree<CppSyntaxNode, CppSyntaxTree>, ISyntaxTreeCreation<CppSyntaxNode, CppSyntaxTree> | ||
{ | ||
protected internal CppSyntaxTree(TsTree* tree) : base(tree) | ||
{ | ||
} | ||
public override CppSyntaxNode Root => new(Ts.tree_root_node(_tree)); | ||
public override CppSyntaxTree Copy() => new(Ts.tree_copy(_tree)); | ||
public static CppSyntaxTree Create(TsTree* tree) => new(tree); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Runtime.InteropServices; | ||
using TreeSitterSharp.Native; | ||
using TreeSitterSharp; | ||
|
||
namespace TreeSitterSharp.Lua; | ||
|
||
[LanguageName("Lua")] | ||
internal class LuaLanguageProvider : ILanguageProvider | ||
{ | ||
[DllImport("tree-sitter-lua", EntryPoint = "tree_sitter_lua", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] | ||
private static extern unsafe TsLanguage* tree_sitter_lua(); | ||
public static unsafe Language GetLanguage() | ||
{ | ||
return new Language(tree_sitter_lua()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Text; | ||
using TreeSitterSharp.Native; | ||
|
||
namespace TreeSitterSharp.Lua; | ||
|
||
public unsafe class LuaParser : Parser<LuaSyntaxTree, LuaSyntaxNode, LuaParser> | ||
{ | ||
public LuaParser() : base(LuaLanguageProvider.GetLanguage()) | ||
{ | ||
|
||
} | ||
|
||
public override LuaSyntaxTree Parse(Span<byte> code) => new(ParseCore(code)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TreeSitterSharp.Native; | ||
|
||
namespace TreeSitterSharp.Lua; | ||
|
||
public partial class LuaSyntaxNode : SyntaxNode<LuaSyntaxTree, LuaSyntaxNode>, ISyntaxNodeCreation<LuaSyntaxTree, LuaSyntaxNode> | ||
{ | ||
protected internal LuaSyntaxNode(TsNode node) : base(node) | ||
{ | ||
} | ||
|
||
|
||
public static partial LuaSyntaxNode Create(TsNode node); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Xml.Linq; | ||
using Microsoft.CodeAnalysis; | ||
using TreeSitterSharp.Native; | ||
|
||
namespace TreeSitterSharp.Lua; | ||
public unsafe class LuaSyntaxTree : SyntaxTree<LuaSyntaxNode, LuaSyntaxTree>, ISyntaxTreeCreation<LuaSyntaxNode, LuaSyntaxTree> | ||
{ | ||
protected internal LuaSyntaxTree(TsTree* tree) : base(tree) | ||
{ | ||
} | ||
public override LuaSyntaxNode Root => new(Ts.tree_root_node(_tree)); | ||
public override LuaSyntaxTree Copy() => new(Ts.tree_copy(_tree)); | ||
public static LuaSyntaxTree Create(TsTree* tree) => new(tree); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.