mirror of
https://github.com/safishamsi/graphify.git
synced 2026-09-17 11:06:09 +00:00
This commit adds full VB.NET language support to graphify, raising the supported language count from 25 to 26. The implementation follows the established LanguageConfig pattern used by all other tree-sitter-backed extractors. New dependency: - Adds optional extra [vbnet] backed by tree-sitter-vbnet (published to PyPI at https://pypi.org/project/tree-sitter-vbnet/0.1.0/). Install with: pip install graphifyy[vbnet] graphify/detect.py: - Added .vb to CODE_EXTENSIONS so VB.NET files are discovered during corpus ingestion and file-system watching. graphify/extract.py: - _import_vbnet(): import handler for imports_statement nodes; emits imports edges using the namespace_name child text. - _vbnet_extra_walk(): extra-walk hook that intercepts namespace_block nodes, emits a namespace node, and recurses. - _VBNET_CONFIG: full LanguageConfig covering class_block / module_block / structure_block / interface_block as class types; method_declaration / constructor_declaration / property_declaration as function types; invocation call nodes with target/member_access fields. - VB.NET-specific branches in _extract_generic: * Class body: VB.NET has no wrapper body node; inherits and implements are named fields directly on the class_block. Emits separate inherits and implements edges for each base type, stripping generic arguments. * Constructor name: constructor_declaration carries no name field in the grammar; always resolves to New. * Function body: uses the declaration node itself as body sentinel so the call-graph pass can find invocations inside methods. - extract_vbnet(path): public wrapper that delegates to _extract_generic. - _DISPATCH['.vb']: routes .vb files to extract_vbnet. pyproject.toml: - Added vbnet = ['tree-sitter-vbnet'] optional dependency group. - Added 'tree-sitter-vbnet' to the all extra. tests/fixtures/sample.vb: - New fixture file exercising: Imports statements, Namespace block, Interface, Class with Inherits + Implements, Module, Structure, Sub/Function/Property methods, and method calls. tests/test_languages.py: - Added 13 tests covering: no-error, class/interface/module/structure detection, method detection, imports relation, inherits edge, implements edge, and no-dangling-edges invariant. README.md: - Updated language count 25 to 26. - Added VB.NET to language list and file-extension table.
60 lines
1.4 KiB
VB.net
60 lines
1.4 KiB
VB.net
Imports System
|
|
Imports System.Collections.Generic
|
|
Imports System.Net.Http
|
|
|
|
Namespace GraphifyDemo
|
|
|
|
Public Interface IProcessor
|
|
Function Process(items As List(Of String)) As List(Of String)
|
|
End Interface
|
|
|
|
Public Class DataProcessor
|
|
Inherits BaseProcessor
|
|
Implements IProcessor
|
|
|
|
Private ReadOnly _client As HttpClient
|
|
|
|
Public Sub New()
|
|
_client = New HttpClient()
|
|
End Sub
|
|
|
|
Public Function Process(items As List(Of String)) As List(Of String)
|
|
Return Validate(items)
|
|
End Function
|
|
|
|
Private Function Validate(items As List(Of String)) As List(Of String)
|
|
Dim result As New List(Of String)
|
|
For Each item In items
|
|
If Not String.IsNullOrEmpty(item) Then
|
|
result.Add(item.Trim())
|
|
End If
|
|
Next
|
|
Return result
|
|
End Function
|
|
|
|
End Class
|
|
|
|
Public Module AppHelper
|
|
|
|
Public Sub Run(processor As IProcessor)
|
|
Dim data As New List(Of String)
|
|
data.Add("hello")
|
|
processor.Process(data)
|
|
End Sub
|
|
|
|
End Module
|
|
|
|
Public Structure Point
|
|
Implements IComparable
|
|
|
|
Public X As Double
|
|
Public Y As Double
|
|
|
|
Public Function CompareTo(obj As Object) As Integer
|
|
Return 0
|
|
End Function
|
|
|
|
End Structure
|
|
|
|
End Namespace
|