![]() |
VOOZH | about |
dotnet add package War3Net.CodeAnalysis.Jass --version 6.0.2
NuGet\Install-Package War3Net.CodeAnalysis.Jass -Version 6.0.2
<PackageReference Include="War3Net.CodeAnalysis.Jass" Version="6.0.2" />
<PackageVersion Include="War3Net.CodeAnalysis.Jass" Version="6.0.2" />Directory.Packages.props
<PackageReference Include="War3Net.CodeAnalysis.Jass" />Project file
paket add War3Net.CodeAnalysis.Jass --version 6.0.2
#r "nuget: War3Net.CodeAnalysis.Jass, 6.0.2"
#:package War3Net.CodeAnalysis.Jass@6.0.2
#addin nuget:?package=War3Net.CodeAnalysis.Jass&version=6.0.2Install as a Cake Addin
#tool nuget:?package=War3Net.CodeAnalysis.Jass&version=6.0.2Install as a Cake Tool
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.
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}");
}
}
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.");
}
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();
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
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");
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);
The main types provided by this library are:
War3Net.CodeAnalysis.Jass.JassSyntaxFactory - Parse JASS source strings into syntax treesWar3Net.CodeAnalysis.Jass.JassRenamer - Rename function and variable identifiers with scope trackingWar3Net.CodeAnalysis.Jass.JassSyntaxFacts - Character and identifier validation utilitiesWar3Net.CodeAnalysis.Jass.JassLiteral - Create literal value expressions (int, real, string, FourCC)War3Net.CodeAnalysis.Jass.JassExpression - Helper methods for creating compound expressionsWar3Net.CodeAnalysis.Jass.Syntax.JassCompilationUnitSyntax - Root syntax node containing all declarationsWar3Net.CodeAnalysis.Jass.Syntax.JassFunctionDeclarationSyntax - Function declaration syntax nodeWar3Net.CodeAnalysis.Jass.Syntax.JassGlobalsDeclarationSyntax - Global variable block syntax nodeWar3Net.CodeAnalysis.Jass.Syntax.JassSyntaxNode - Abstract base class for all syntax nodesWar3Net.CodeAnalysis.Jass is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
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. |
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. |
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 |