GDShrapt.Reader 5.0.0

dotnet add package GDShrapt.Reader --version 5.0.0
                    
NuGet\Install-Package GDShrapt.Reader -Version 5.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GDShrapt.Reader" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GDShrapt.Reader" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="GDShrapt.Reader" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GDShrapt.Reader --version 5.0.0
                    
#r "nuget: GDShrapt.Reader, 5.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GDShrapt.Reader@5.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GDShrapt.Reader&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=GDShrapt.Reader&version=5.0.0
                    
Install as a Cake Tool

GDShrapt.Reader

A high-performance, object-oriented one-pass parser for GDScript 2.0 (Godot 4.x).

Features

  • Full GDScript 4.x support - Lambdas, await, typed arrays/dictionaries, pattern matching, all annotations
  • One-pass parsing - High-performance character-by-character parsing with no backtracking
  • Error recovery - Invalid syntax creates GDInvalidToken nodes instead of throwing exceptions
  • Format preservation - Comments and whitespace are preserved in the AST
  • Position tracking - All tokens have StartLine, EndLine, StartColumn, EndColumn properties
  • Cloning support - Clone entire syntax trees or individual nodes

Quick Start

using GDShrapt.Reader;

var reader = new GDScriptReader();
var code = @"
extends Node2D

@export var health: int = 100

func _ready():
    print(""Hello, Godot 4!"")
";

var classDecl = reader.ParseFileContent(code);

// Access class information
Console.WriteLine(classDecl.Extends?.Type);           // "Node2D"
Console.WriteLine(classDecl.Variables.First().Identifier); // "health"
Console.WriteLine(classDecl.Methods.First().Identifier);   // "_ready"

Parsing Methods

var reader = new GDScriptReader();

// Parse complete class files
var classDecl = reader.ParseFileContent(code);

// Parse single expression
var expr = reader.ParseExpression("10 + 20 * 3");

// Parse statements
var statements = reader.ParseStatements("var x = 10\nprint(x)");

Helper Classes

// Check annotation types
if (GDAnnotationHelper.IsExport(attr))
    Console.WriteLine("Exported variable");

// Check virtual method names
if (GDSpecialMethodHelper.IsReady(method))
    Console.WriteLine("This is _ready()");

// Analyze expressions
if (GDExpressionHelper.IsPreload(expr))
    Console.WriteLine("Preload call detected");
Package Description
GDShrapt.Builder Fluent API for code generation
GDShrapt.Validator Compiler-style AST validation
GDShrapt.Linter Style checking and naming conventions
GDShrapt.Formatter Code formatting with type inference

Documentation

Full documentation and examples: GitHub Repository

License

MIT License - see LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on GDShrapt.Reader:

Package Downloads
GDShrapt.Validator

GDShrapt.Validator provides compiler-style AST validation for GDScript 2.0 (Godot 4.x) with type inference. Diagnostic Categories: - Syntax (GD1xxx): Invalid tokens, missing brackets, unexpected tokens - Scope (GD2xxx): Undefined variables, duplicate declarations, forward references - Type (GD3xxx): Type mismatches, invalid operand types - Call (GD4xxx): Wrong argument counts for built-in functions - Control Flow (GD5xxx): break/continue outside loops, return outside functions - Indentation (GD6xxx): Mixed tabs/spaces, inconsistent indentation - Await (GD7xxx): Await expression structure issues Type Inference System: - IGDRuntimeProvider interface for custom type information (integrate with Godot) - GDDefaultRuntimeProvider with built-in GDScript types and global functions - GDCachingRuntimeProvider wrapper for performance optimization - GDTypeInferenceEngine for expression type inference - Two-pass validation with full forward reference support Usage: new GDValidator().Validate(tree, options) Requires: GDShrapt.Reader

GDShrapt.Builder

GDShrapt.Builder provides a fluent API for programmatic GDScript 2.0 (Godot 4.x) code generation. Key Features: - Fluent building API for creating complete GDScript AST nodes - Factory methods for all declarations, expressions, and statements - Three building styles: Short (GD.Class), Fluent (chained calls), Token-based (manual control) - Extension methods for AST manipulation and code generation - Full support for GDScript 4.x constructs: lambdas, annotations, typed arrays, enums Usage: GD.Declaration.Class(...), GD.Expression.Call(...), GD.Statement.If(...) Requires: GDShrapt.Reader

GDShrapt.Linter

GDShrapt.Linter provides configurable style checking for GDScript 2.0 (Godot 4.x) with gdtoolkit-compatible suppression. Rule Categories: - Naming: PascalCase, snake_case, SCREAMING_SNAKE_CASE for classes/functions/variables/constants/signals/enums - Style: Line length limits, member ordering, private member prefix (_underscore) - Best Practices: Unused variables/parameters/signals, empty functions, type hint suggestions - Strict Typing (GDL215): Per-element configurable severity for required type hints Key Features: - Comment-based rule suppression (gdtoolkit compatible): gdlint:ignore, gdlint:disable/enable - Configurable severity per rule and per element type - Presets: Default, Strict, Minimal - Support for both rule IDs (GDL001) and names (variable-name) in suppressions Usage: new GDLinter(options).Lint(tree) or LintCode(code) Requires: GDShrapt.Reader

GDShrapt.Formatter

GDShrapt.Formatter provides configurable code formatting for GDScript 2.0 (Godot 4.x) with auto type inference. Format Rules: - Indentation (GDF001): Tabs or spaces with configurable size - Blank Lines (GDF002): Between functions, after class declaration, between member types - Spacing (GDF003): Around operators, after commas/colons, inside brackets - Trailing Whitespace (GDF004): Remove trailing spaces, ensure EOF newline - Line Endings (GDF005): Normalize to LF, CRLF, or Platform - Line Wrapping (GDF006): Automatic wrapping for long lines - Auto Type Hints (GDF007): Automatically add inferred type hints (opt-in) - Code Reorder (GDF008): Reorder class members by type (opt-in) Key Features: - Style extraction from sample code ("format by example") - LSP compatible options (tabSize, insertSpaces, trimTrailingWhitespace, etc.) - Uses GDTypeInferenceEngine for automatic type hints - Presets: Default, GDScriptStyleGuide, Minimal Usage: new GDFormatter(options).FormatCode(code) Requires: GDShrapt.Reader, GDShrapt.Validator

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on GDShrapt.Reader:

Repository Stars
chinese-liliths-throne/BDCCChineseLocalization
Version Downloads Last Updated
5.0.0 6,960 1/2/2026
4.4.0-alpha 7,739 5/19/2025
4.3.2-alpha 176 3/29/2025
4.3.1-alpha 187 10/26/2024
4.3.0-alpha 1,321 5/5/2024 4.3.0-alpha is deprecated because it is no longer maintained and has critical bugs.
4.2.0-alpha 224 1/31/2024 4.2.0-alpha is deprecated because it is no longer maintained and has critical bugs.
4.1.5-alpha 195 1/27/2024 4.1.5-alpha is deprecated because it is no longer maintained and has critical bugs.
4.1.4-alpha 196 1/26/2024 4.1.4-alpha is deprecated because it is no longer maintained and has critical bugs.
4.1.3-alpha 220 1/20/2024 4.1.3-alpha is deprecated because it is no longer maintained and has critical bugs.
4.1.2-alpha 198 1/19/2024 4.1.2-alpha is deprecated because it is no longer maintained and has critical bugs.
4.1.1-alpha 205 1/17/2024 4.1.1-alpha is deprecated because it is no longer maintained and has critical bugs.
4.1.0-alpha 208 1/12/2024 4.1.0-alpha is deprecated because it is no longer maintained and has critical bugs.
4.0.1-alpha 257 12/23/2023 4.0.1-alpha is deprecated because it is no longer maintained and has critical bugs.
4.0.0-alpha 214 12/20/2023 4.0.0-alpha is deprecated because it is no longer maintained and has critical bugs.
3.1.2-alpha 341 11/24/2022 3.1.2-alpha is deprecated because it is no longer maintained and has critical bugs.
3.1.1-alpha 371 11/22/2022 3.1.1-alpha is deprecated because it is no longer maintained and has critical bugs.
3.1.0-alpha 376 11/17/2022 3.1.0-alpha is deprecated because it is no longer maintained and has critical bugs.
3.0.0-alpha 649 7/29/2021 3.0.0-alpha is deprecated because it is no longer maintained and has critical bugs.
2.1.0-alpha 605 6/26/2021 2.1.0-alpha is deprecated because it is no longer maintained and has critical bugs.
2.0.0-alpha 559 6/22/2021 2.0.0-alpha is deprecated because it is no longer maintained and has critical bugs.
Loading failed

Version 5.0.0:
- BREAKING: Split into multiple packages for modularity
 - GDShrapt.Reader - Core parsing and AST (this package)
 - GDShrapt.Builder - Fluent code generation API
 - GDShrapt.Validator - Compiler-style AST validation with type inference
 - GDShrapt.Linter - Style checking with comment suppression
 - GDShrapt.Formatter - Code formatting with auto type hints
- Full GDScript 4.x support including typed dictionaries (Godot 4.4)
- Helper classes: GDAnnotationHelper, GDSpecialMethodHelper, GDExpressionHelper
- Fixed property get/set parsing (Issues #10, #11)
- Comprehensive test coverage (1052 tests across all packages)