Documentation
¶
Overview ¶
Package cgo implements the production CGo tree-sitter backend (Option A) for the parser.Parser interface, covering the two spike-partner languages (D-05): Go (LANG-01) and Python (carries a real external C scanner). If the Plan 01-07 spike selects Option A, this is the single documented CGo exception feeding DIST-05.
Index ¶
- Variables
- type CGoParser
- func NewCParser() (*CGoParser, error)
- func NewCSharpParser() (*CGoParser, error)
- func NewCppParser() (*CGoParser, error)
- func NewGoParser() (*CGoParser, error)
- func NewJavaParser() (*CGoParser, error)
- func NewJavaScriptParser() (*CGoParser, error)
- func NewKotlinParser() (*CGoParser, error)
- func NewPHPParser() (*CGoParser, error)
- func NewPythonParser() (*CGoParser, error)
- func NewRubyParser() (*CGoParser, error)
- func NewRustParser() (*CGoParser, error)
- func NewSwiftParser() (*CGoParser, error)
- func NewTSXParser() (*CGoParser, error)
- func NewTypeScriptParser() (*CGoParser, error)
Constants ¶
This section is empty.
Variables ¶
var ErrParseFailed = errors.New("cgo: tree-sitter parse returned no tree")
ErrParseFailed is returned when the underlying tree-sitter C call returns no tree (a NULL *TSTree), so callers never receive a non-nil *parser.Tree wrapping a nil native tree.
Functions ¶
This section is empty.
Types ¶
type CGoParser ¶
type CGoParser struct {
// contains filtered or unexported fields
}
CGoParser implements parser.Parser using the CGo tree-sitter bindings for a single language grammar.
func NewCParser ¶
NewCParser returns a CGoParser configured for the C grammar (mainstream-tier, LANG-06). Carries no external C scanner.
func NewCSharpParser ¶
NewCSharpParser returns a CGoParser configured for the C# grammar (priority-4, LANG-03). C#'s grammar carries an external C scanner — see parser.Parser's crash-isolation contract.
func NewCppParser ¶
NewCppParser returns a CGoParser configured for the C++ grammar (mainstream-tier, LANG-06). Carries an external C scanner.
func NewGoParser ¶
NewGoParser returns a CGoParser configured for the Go grammar.
func NewJavaParser ¶
NewJavaParser returns a CGoParser configured for the Java grammar (priority-4, LANG-02). Java's grammar carries no external C scanner.
func NewJavaScriptParser ¶
NewJavaScriptParser returns a CGoParser configured for the JavaScript grammar (priority-4, LANG-05). Carries an external C scanner.
func NewKotlinParser ¶
NewKotlinParser returns a CGoParser configured for the Kotlin grammar (mainstream-tier, LANG-06). This is a [SUS] community-maintained grammar (T-05-SC), pinned at the tree-sitter-grammars/tree-sitter-kotlin v1.1.0 proper semver tag (root module, not a bindings/go subpath) after human-verify approval — replaces the originally-approved fwcd source, which does not build. Carries an external C scanner.
func NewPHPParser ¶
NewPHPParser returns a CGoParser configured for the PHP grammar (mainstream-tier, LANG-06). Uses the `php/src` grammar accessor (LanguagePHP), not the sibling `php_only/src` grammar (LanguagePHPOnly) — the tree-sitter-php module ships both in the same bindings/go package. Carries an external C scanner (PHP tag-switching).
func NewPythonParser ¶
NewPythonParser returns a CGoParser configured for the Python grammar. Python exercises the external C scanner path (its INDENT/DEDENT tokenizer), the crash-isolation dimension the Plan 01-07 spike measures.
func NewRubyParser ¶
NewRubyParser returns a CGoParser configured for the Ruby grammar (mainstream-tier, LANG-06). Carries an external C scanner (heredocs).
func NewRustParser ¶
NewRustParser returns a CGoParser configured for the Rust grammar (mainstream-tier, LANG-06). Carries an external C scanner (raw strings).
func NewSwiftParser ¶
NewSwiftParser returns a CGoParser configured for the Swift grammar (mainstream-tier, LANG-06). This is a [SUS] community-maintained grammar (T-05-SC) pinned by exact commit pseudo-version after human-verify approval — never @latest. Carries an external C scanner.
func NewTSXParser ¶
NewTSXParser returns a CGoParser configured for the TSX grammar (priority-4, LANG-05) — the JSX-aware sibling of NewTypeScriptParser, both bindings shipped by the same tree-sitter-typescript module.
func NewTypeScriptParser ¶
NewTypeScriptParser returns a CGoParser configured for the TypeScript grammar (priority-4, LANG-05). Carries an external C scanner. The tree-sitter-typescript module ships two grammars in one repo (typescript/ and tsx/ subdirs) — this constructor uses the typescript accessor; see NewTSXParser for the sibling .tsx grammar.
func (*CGoParser) Close ¶
Close frees the underlying C parser's allocations. Safe to call once or concurrently; repeat calls are a no-op.