Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
95ec604
feat: integrate component and board variables
Zanzavar Aug 2, 2026
0e69c0e
ci: fix TypeScript and Windows C++ workflows
Zanzavar Aug 2, 2026
814897b
ci: pin C++ Windows runner
Zanzavar Aug 2, 2026
ba9d49d
ci: configure Java for ANTLR generation
Zanzavar Aug 2, 2026
a52e150
fix: tighten TypeScript variable scope validation
Zanzavar Aug 9, 2026
8eee475
ci: upload C++ build artifacts
Zanzavar Aug 10, 2026
59299dd
ci: build release native artifacts
Zanzavar Aug 10, 2026
1450a93
fix(cpp): allow release test builds without PDB
Zanzavar Aug 10, 2026
14ce339
chore: remove dead code from interpreter.ts
panayotisk Aug 19, 2026
cc7dd0d
chore: simplify replaceVariables
panayotisk Aug 19, 2026
d0ccccc
fix: do not allow Interpreter instantiation without a state
panayotisk Aug 19, 2026
bab17e9
fix: restore public API for Interpreter
panayotisk Aug 19, 2026
c1d36ff
refactor: abstract lexer creation
panayotisk Aug 19, 2026
bb61353
refactor: abstract replacement logic
panayotisk Aug 19, 2026
f29a43f
refactor: simplify replaceVariables
panayotisk Aug 19, 2026
a1f492a
refactor: remove global state in runScript
panayotisk Aug 19, 2026
027fa7b
chore: Intepreter property clean ups
panayotisk Aug 19, 2026
b03d5b6
chore: re-arrange methods by visibility
panayotisk Aug 19, 2026
02ff1c4
chore: privatize replaceScopes()
panayotisk Aug 19, 2026
ca805ab
fix: readme stale links
panayotisk Aug 19, 2026
11e11d2
chore: update typescript readme
panayotisk Aug 19, 2026
dc0a5f9
chore: roll() cleanup
panayotisk Aug 20, 2026
4eea1fa
fix: harden visits()
panayotisk Aug 20, 2026
48c6106
fix: add escaped backslash support in show()
panayotisk Aug 20, 2026
3b6fb64
fix: make reset atomic
panayotisk Aug 20, 2026
827b18b
refactor: simplify number assertions
panayotisk Aug 20, 2026
a6a684c
chore: extract mention validation
panayotisk Aug 20, 2026
2b04a4b
chore: use a Set in resetAll
panayotisk Aug 20, 2026
94c0517
chore: tighten immutability and exports
panayotisk Aug 20, 2026
a9bc8d6
chore: remove stale comments
panayotisk Aug 20, 2026
7bd6586
chore: state - readonly and private members
panayotisk Aug 20, 2026
536d852
refactor: create functions to access state members
panayotisk Aug 20, 2026
cc92fe9
refactor: decompose ArcscriptState output handling
panayotisk Aug 20, 2026
d72b5ae
chore: privatize initialize variables
panayotisk Aug 20, 2026
89fff70
fix: harden ArcscriptState variable records
panayotisk Aug 20, 2026
8c620af
refactor: simplify ArcscriptState output metadata
panayotisk Aug 20, 2026
a1efa26
refactor: make ArcscriptVariable identity immutable
panayotisk Aug 20, 2026
68c531b
refactor: privatize variable value
panayotisk Aug 20, 2026
8faf0e4
chore: Remove the duplicated ArcscriptVariableParams type
panayotisk Aug 20, 2026
4443d76
refactor: Remove the unused runtime type field
panayotisk Aug 20, 2026
32b7730
fix: add return types to methods
panayotisk Aug 20, 2026
a8b24f5
fix: Implemented boolean coercion for multiplicative expressions
panayotisk Aug 20, 2026
f979579
refactor: implement typed dispatch for arcscript functions
panayotisk Aug 20, 2026
b3f2ff4
chore: privatize member properties in ArcscriptVisitor
panayotisk Aug 20, 2026
a2cee79
fix: Remove redundant instanceof ArcscriptVariable checks
panayotisk Aug 20, 2026
59107d3
fix: update c++ tests
panayotisk Aug 20, 2026
8929402
fix: update c++ readme on build
panayotisk Aug 20, 2026
13bd405
chore: add contributing and license section in C++ interpreter readme
panayotisk Aug 20, 2026
8a10577
chore: add c# readme
panayotisk Aug 20, 2026
cdf777b
chore: align licenses
panayotisk Aug 20, 2026
3b9ccd8
fix: C# report scripts as conditions
panayotisk Aug 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/TypeScript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- run: corepack enable
- uses: pnpm/action-setup@v4
with:
version: 10.12.2

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache-dependency-path: ./TypeScript/pnpm-lock.yaml
cache: "pnpm"

Expand Down
42 changes: 26 additions & 16 deletions .github/workflows/cpp-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,61 @@ on:
paths:
- "Cpp/**"
- "grammar/*.g4"
- ".github/workflows/cpp-build-test.yml"
pull_request:
branches: [main]
paths:
- "Cpp/**"
- "grammar/*.g4"
- ".github/workflows/cpp-build-test.yml"

jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
os: [macos-latest, windows-2022]
fail-fast: false
env:
DEMO_DIR: demo/${{ matrix.os == 'windows-latest' && 'Win32/Debug' || 'Mac' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.x"

- name: Generate ANTLR4 files (Windows)
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2022'
run: .\generate.ps1

- name: Generate ANTLR4 files (macOS)
if: matrix.os == 'macos-latest'
run: sh ./generate.sh
shell: bash

- name: Configure CMake
run: |
mkdir -p Cpp/build
cd Cpp/build
cmake .. -DWITH_TEST=true
- name: Configure CMake (Windows)
if: matrix.os == 'windows-2022'
run: cmake -S Cpp -B Cpp/build -G "Visual Studio 17 2022" -A x64 -DWITH_TEST=true

- name: Configure CMake (macOS)
if: matrix.os == 'macos-latest'
run: cmake -S Cpp -B Cpp/build -DCMAKE_BUILD_TYPE=Release -DWITH_TEST=true

- name: Build
run: |
cd Cpp/build
cmake --build .
run: cmake --build Cpp/build --config Release

- name: Run tests
run: |
cd Cpp/build/${{ env.DEMO_DIR }}
ls
./ArcscriptTest
run: ctest --test-dir Cpp/build --build-config Release --output-on-failure

- name: Upload native library artifact
uses: actions/upload-artifact@v4
with:
name: arcscript-cpp-${{ matrix.os }}-${{ github.sha }}
path: Cpp/build/lib/**
if-no-files-found: error
retention-days: 14
6 changes: 4 additions & 2 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- run: corepack enable
- uses: pnpm/action-setup@v4
with:
version: 10.12.2

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache-dependency-path: ./TypeScript/pnpm-lock.yaml
cache: "pnpm"

Expand Down
10 changes: 5 additions & 5 deletions CSharp/Interpreter/ArcscriptFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ public object Reset(IList<object> args) {
}

public object ResetAll(IList<object> args) {
List<string> variableNames = new List<string>();
HashSet<string> variableIds = new HashSet<string>();
foreach ( IVariable argument in args ) {
variableNames.Add(argument.Name);
variableIds.Add(argument.Id);
}
foreach ( IVariable variable in this._project.Variables ) {
if ( !variableNames.Contains(variable.Name) ) {
foreach ( IVariable variable in this._project.GetAllVariables() ) {
if ( !variableIds.Contains(variable.Id) ) {
state.SetVarValue(variable, variable.DefaultValue);
}
}
Expand Down Expand Up @@ -212,4 +212,4 @@ public object ResetVisits(IList<object> args) {
return null;
}
}
}
}
16 changes: 5 additions & 11 deletions CSharp/Interpreter/ArcscriptParserBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,11 @@ public ArcscriptParserBase(ITokenStream input, TextWriter output, TextWriter err

public void SetProject(IProject project) {
this.Project = project;
foreach (var projectVariable in project.Variables)
foreach (var projectVariable in project.GetAllVariables())
{
VariableNames.Add(projectVariable.Name);
}
foreach (var projectBoard in project.Boards)
{
if (projectBoard.Variables == null) continue;
foreach (var projectBoardVariable in projectBoard.Variables)
{
VariableNames.Add(projectBoard.CustomId + "." + projectBoardVariable.Name);
}
VariableNames.Add(projectVariable.Parent == null
? projectVariable.Name
: projectVariable.Parent.CustomId + "." + projectVariable.Name);
}
}

Expand Down Expand Up @@ -126,4 +120,4 @@ internal void setLineStart(IToken token)
}
}

}
}
17 changes: 6 additions & 11 deletions CSharp/Interpreter/ArcscriptState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,8 @@ public ArcscriptState(string elementId, IProject project, System.Action<string>?
this.currentElement = elementId;
this.project = project;

this.Variables = project.Variables.ToDictionary(variable => variable.Id, variable => variable);
foreach (var projectBoard in project.Boards)
{
if (projectBoard.Variables == null) continue;
foreach (var projectBoardVariable in projectBoard.Variables)
{
Variables.Add(projectBoardVariable.Id, projectBoardVariable);
}
}
this.Variables = project.GetAllVariables()
.ToDictionary(variable => variable.Id, variable => variable);

if (emit != null)
{
Expand All @@ -50,7 +43,9 @@ public ArcscriptState(string elementId, IProject project, System.Action<string>?
{
if (scope != null)
{
return variable.Name == name && scope == variable.Parent.CustomId;
return variable.Name == name &&
variable.Parent != null &&
scope == variable.Parent.CustomId;
}

return variable.Name == name && variable.Parent == null;
Expand Down Expand Up @@ -109,4 +104,4 @@ public void ResetVisits()
_emit("resetVisits");
}
}
}
}
4 changes: 2 additions & 2 deletions CSharp/Interpreter/ArcscriptTranspiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public TranspilerOutput RunScript(string code)
// List<string> outputs = visitor.state.outputs;
var outputResult = visitor.state.Outputs.GetText();

var isCondition = tree.script() != null;
var isCondition = tree.condition() != null;

return new TranspilerOutput(outputResult, visitor.state.VariableChanges, result, isCondition);
}
Expand Down Expand Up @@ -112,4 +112,4 @@ public TranspilerOutput(string output, Dictionary<string, object> changes, objec
}
}
}
}
}
20 changes: 12 additions & 8 deletions CSharp/Interpreter/INodes/IAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ public interface IAttribute
{
public enum DataType
{
Undefined,
StringPlainText,
StringRichText,
ComponentList,
AssetList,
Undefined = 0,
StringPlainText = 1,
StringRichText = 2,
ComponentList = 3,
AssetList = 4,
Boolean = 5,
Integer = 6,
Float = 7,
}

public enum ContainerType
{
Undefined,
Component,
Element,
Undefined = 0,
Component = 1,
Element = 2,
Board = 3,
}

public string Name { get; }
Expand Down
2 changes: 1 addition & 1 deletion CSharp/Interpreter/INodes/IBoard.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Arcweave.Interpreter.INodes
{
public interface IBoard : IHasVariables
public interface IBoard : IHasVariables, IHasAttributes
{
}
}
2 changes: 1 addition & 1 deletion CSharp/Interpreter/INodes/IComponent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Arcweave.Interpreter.INodes
{
public interface IComponent : IHasAttributes
public interface IComponent : IHasAttributes, IHasVariables
{
}
}
3 changes: 3 additions & 0 deletions CSharp/Interpreter/INodes/IProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ public interface IProject
#if GODOT
public Array<Arcweave.Project.Variable> Variables { get; }
public Dictionary<string, Arcweave.Project.Board> Boards { get; }
public Dictionary<string, Arcweave.Project.Component> Components { get; }
#else
public List<Arcweave.Project.Variable> Variables { get; }
public List<Arcweave.Project.Board> Boards { get; }
public List<Arcweave.Project.Component> Components { get; }
#endif
public System.Collections.Generic.IEnumerable<Arcweave.Project.Variable> GetAllVariables();
public Arcweave.Project.Element ElementWithId(string id);

public Arcweave.Project.Variable GetVariable(string name, string scope = null);
Expand Down
10 changes: 9 additions & 1 deletion CSharp/Project/Board.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ public partial class Board
#else
public List<INode> Nodes { get; private set; }
public List<Variable> Variables { get; private set; }
public List<Attribute> Attributes { get; private set; }
#endif
public Board(string id, List<INode> nodes, string customId = null)
{
Id = id;
Nodes = nodes;
CustomId = customId;
Variables = new List<Variable>();
Attributes = new List<Attribute>();
}

public Board(string id, List<INode> nodes, List<Variable> variables, string customId = null)
Expand All @@ -32,6 +34,7 @@ public Board(string id, List<INode> nodes, List<Variable> variables, string cust
}
Variables = variables;
CustomId = customId;
Attributes = new List<Attribute>();
}

public T NodeWithID<T>(string id) where T : INode => Nodes.OfType<T>().FirstOrDefault(x => x.Id == id);
Expand All @@ -41,5 +44,10 @@ public void AddVariable(Variable variable)
variable.Parent = this;
Variables.Add(variable);
}

public void AddAttribute(Attribute attribute)
{
Attributes.Add(attribute);
}
}
}
}
19 changes: 17 additions & 2 deletions CSharp/Project/Component.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,26 @@ namespace Arcweave.Project
{
public partial class Component
{
public string CustomId { get; }
public List<Attribute> Attributes { get; }
public List<Variable> Variables { get; }

public Component(string customId = null)
{
CustomId = customId;
Attributes = new List<Attribute>();
Variables = new List<Variable>();
}

public void AddAttribute(Attribute attribute)
{
throw new NotImplementedException();
Attributes.Add(attribute);
}

public void AddVariable(Variable variable)
{
variable.Parent = this;
Variables.Add(variable);
}
}
}

21 changes: 13 additions & 8 deletions CSharp/Project/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ public partial class Project
{
public List<Variable> Variables { get; }
public List<Board> Boards { get; }
public Project(List<Board> boards, List<Variable> variables)
public List<Component> Components { get; }
public Project(List<Board> boards, List<Variable> variables, List<Component> components = null)
{
Variables = variables;
Boards = boards;
Components = components ?? new List<Component>();
}
public Element ElementWithId(string id) => GetNodeWithID<Element>(id);

Expand All @@ -21,13 +23,17 @@ public Variable GetVariable(string name, string scope = null)
{
return Variables.FirstOrDefault(variable => variable.Name == name);
}
var board = Boards.FirstOrDefault(board => board.Id == scope);
if (board != null)
{
return board.Variables.FirstOrDefault(variable => variable.Name == name);
}
return null;
var container = Boards.Cast<IHasVariables>()
.Concat(Components)
.FirstOrDefault(container => container.CustomId == scope);
return container?.Variables.FirstOrDefault(variable => variable.Name == name);
}

public IEnumerable<Variable> GetAllVariables() => Variables
.Concat(Boards.SelectMany(board =>
board.Variables ?? Enumerable.Empty<Variable>()))
.Concat(Components.SelectMany(component =>
component.Variables ?? Enumerable.Empty<Variable>()));

public T GetNodeWithID<T>(string id) where T : INode {
T result = default(T);
Expand All @@ -39,4 +45,3 @@ public T GetNodeWithID<T>(string id) where T : INode {
}
}
}

Loading
Loading