36 lines
697 B
C#
36 lines
697 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Text.RegularExpressions;
|
|
using System.Text;
|
|
|
|
using System.Globalization;
|
|
using Godot;
|
|
using System;
|
|
|
|
namespace Rokojori;
|
|
|
|
|
|
public class ASTWalker:TreeWalker<ASTNode>
|
|
{
|
|
public static readonly ASTWalker instance = new ASTWalker();
|
|
|
|
public override ASTNode Parent( ASTNode node )
|
|
{
|
|
return node?.parent;
|
|
}
|
|
|
|
public override ASTNode ChildAt( ASTNode node, int index )
|
|
{
|
|
if ( node == null || index < 0 || index >= node.children.Count )
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return node.children[ index ];
|
|
}
|
|
|
|
public override int NumChildren( ASTNode node )
|
|
{
|
|
return node?.children.Count ?? 0;
|
|
}
|
|
} |