VOOZH about

URL: https://www.nuget.org/packages/War3Net.CodeAnalysis.Jass

⇱ NuGet Gallery | War3Net.CodeAnalysis.Jass 6.0.2




👁 Image
War3Net.CodeAnalysis.Jass 6.0.2

dotnet add package War3Net.CodeAnalysis.Jass --version 6.0.2
 
 
NuGet\Install-Package War3Net.CodeAnalysis.Jass -Version 6.0.2
 
 
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="War3Net.CodeAnalysis.Jass" Version="6.0.2" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="War3Net.CodeAnalysis.Jass" Version="6.0.2" />
 
Directory.Packages.props
<PackageReference Include="War3Net.CodeAnalysis.Jass" />
 
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 War3Net.CodeAnalysis.Jass --version 6.0.2
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: War3Net.CodeAnalysis.Jass, 6.0.2"
 
 
#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 War3Net.CodeAnalysis.Jass@6.0.2
 
 
#: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=War3Net.CodeAnalysis.Jass&version=6.0.2
 
Install as a Cake Addin
#tool nuget:?package=War3Net.CodeAnalysis.Jass&version=6.0.2
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

War3Net.CodeAnalysis.Jass

About

War3Net.CodeAnalysis.Jass is a .NET library for parsing, analyzing, and generating JASS (Just Another Scripting Syntax) source code. JASS is the scripting language used in Warcraft III for game logic and triggers. It is part of the War3Net modding library.

Key features

  • Parse JASS source code into a complete immutable syntax tree
  • Generate JASS source code from syntax nodes with formatting control
  • Syntax tree traversal and analysis with child/descendant node enumeration
  • Code transformation via the syntax rewriter pattern
  • Rename identifiers across a compilation unit with scope awareness
  • Normalize and pretty-print JASS code with configurable indentation
  • Support for all JASS language constructs including FourCC literals
  • Fluent builder API for constructing syntax trees programmatically

How to Use

Parse JASS source code

using War3Net.CodeAnalysis.Jass;
using War3Net.CodeAnalysis.Jass.Syntax;

// Parse a complete JASS file
string jassCode = @"
function HelloWorld takes nothing returns nothing
 call BJDebugMsg(""Hello, World!"")
endfunction
";

JassCompilationUnitSyntax compilationUnit = JassSyntaxFactory.ParseCompilationUnit(jassCode);

// Iterate over declarations
foreach (var declaration in compilationUnit.Declarations)
{
 if (declaration is JassFunctionDeclarationSyntax function)
 {
 string functionName = function.FunctionDeclarator.IdentifierName.Name;
 Console.WriteLine($"Found function: {functionName}");
 }
}

Parse with error handling

using War3Net.CodeAnalysis.Jass;

string expression = "x + y * 2";

if (JassSyntaxFactory.TryParseExpression(expression, out var result))
{
 Console.WriteLine("Parsed successfully!");
}
else
{
 Console.WriteLine("Parse failed.");
}

Generate JASS source code

using System.IO;
using War3Net.CodeAnalysis.Jass;
using War3Net.CodeAnalysis.Jass.Syntax;

// Parse and regenerate code
var unit = JassSyntaxFactory.ParseCompilationUnit(jassCode);

// Write to a TextWriter
using var writer = new StringWriter();
unit.WriteTo(writer);
string output = writer.ToString();

Generate JASS code with IndentedTextWriter

using System.IO;
using War3Net.CodeAnalysis;
using War3Net.CodeAnalysis.Jass.Extensions;

// Create a writer for generating formatted JASS code
using var stringWriter = new StringWriter();
using var writer = new IndentedTextWriter(stringWriter);

// Write a function with local variables and control flow
writer.WriteFunction("InitTrigger");
writer.WriteLocal("trigger", "t", "CreateTrigger()");
writer.WriteLocal("integer", "i");
writer.WriteCall("TriggerRegisterTimerEvent", "t", "1.0", "true");
writer.WriteSet("i", "0");

writer.WriteLoop();
writer.WriteExitWhen("i >= 10");
writer.WriteCall("BJDebugMsg", "I2S(i)");
writer.WriteSet("i", "i + 1");
writer.WriteEndLoop();

writer.WriteIf("i == 10");
writer.WriteCall("BJDebugMsg", "\"Done!\"");
writer.WriteElse();
writer.WriteCall("BJDebugMsg", "\"Error\"");
writer.WriteEndIf();

writer.EndFunction();

string jassCode = stringWriter.ToString();
// Output:
// function InitTrigger takes nothing returns nothing
// local trigger t = CreateTrigger()
// local integer i
// call TriggerRegisterTimerEvent( t, 1.0, true )
// set i = 0
// loop
// exitwhen i >= 10
// call BJDebugMsg( I2S(i) )
// set i = i + 1
// endloop
// if i == 10 then
// call BJDebugMsg( "Done!" )
// else
// call BJDebugMsg( "Error" )
// endif
// endfunction

Build expressions programmatically

using War3Net.CodeAnalysis.Jass;

// Create literal expressions
var intLiteral = JassLiteral.Int(42);
var realLiteral = JassLiteral.Real(3.14f);
var stringLiteral = JassLiteral.String("Hello");
var fourccLiteral = JassLiteral.FourCC("hpea"); // Warcraft 3 unit rawcode

// Create compound expressions
var andExpr = JassExpression.And("conditionA", "conditionB");
var notExpr = JassExpression.Not("isEnabled");

Rename identifiers

using War3Net.CodeAnalysis.Jass;

var functionRenames = new Dictionary<string, string>
{
 { "OldFunctionName", "NewFunctionName" }
};

var globalRenames = new Dictionary<string, string>
{
 { "udg_OldVariable", "udg_NewVariable" }
};

var renamer = new JassRenamer(functionRenames, globalRenames);
var renamedUnit = renamer.Rename(compilationUnit);

Main Types

The main types provided by this library are:

  • War3Net.CodeAnalysis.Jass.JassSyntaxFactory - Parse JASS source strings into syntax trees
  • War3Net.CodeAnalysis.Jass.JassRenamer - Rename function and variable identifiers with scope tracking
  • War3Net.CodeAnalysis.Jass.JassSyntaxFacts - Character and identifier validation utilities
  • War3Net.CodeAnalysis.Jass.JassLiteral - Create literal value expressions (int, real, string, FourCC)
  • War3Net.CodeAnalysis.Jass.JassExpression - Helper methods for creating compound expressions
  • War3Net.CodeAnalysis.Jass.Syntax.JassCompilationUnitSyntax - Root syntax node containing all declarations
  • War3Net.CodeAnalysis.Jass.Syntax.JassFunctionDeclarationSyntax - Function declaration syntax node
  • War3Net.CodeAnalysis.Jass.Syntax.JassGlobalsDeclarationSyntax - Global variable block syntax node
  • War3Net.CodeAnalysis.Jass.Syntax.JassSyntaxNode - Abstract base class for all syntax nodes

Related Packages

Feedback and contributing

War3Net.CodeAnalysis.Jass is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Disclaimer

This README was generated with the assistance of AI and may contain inaccuracies. Please verify the information and consult the source code for authoritative details.

Product Versions Compatible and additional computed target framework versions.
.NET net6.0 net6.0 is compatible.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on War3Net.CodeAnalysis.Jass:

Package Downloads
War3Net.Build.Core

Parsers and serializers for war3map files.

War3Net.CodeAnalysis.Transpilers

Transpile JASS to C# or Lua.

War3Net.CodeAnalysis.Decompilers

Regenerate war3map files from a Warcraft III map script.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.0.2 339 3/1/2026
6.0.1 402 2/1/2026
6.0.0 327 1/25/2026
5.8.0 2,249 9/6/2025
5.6.1 7,684 1/7/2023
5.6.0 1,190 12/20/2022
5.5.5 3,096 11/13/2022
5.5.3 1,440 10/29/2022
5.5.2 1,300 10/25/2022
5.5.0 2,454 8/20/2022
5.4.5 1,659 5/27/2022
5.4.1 3,638 2/13/2022
5.4.0 1,654 2/13/2022
5.3.1 714 1/19/2022
5.3.0 1,534 1/16/2022
5.2.2 3,490 2/16/2021
5.2.1 1,246 2/14/2021
5.2.0 823 1/24/2021
5.1.0 1,027 12/22/2020
5.0.0 844 12/14/2020
Loading failed