UP-Viagg-io/Viagg-io/Assets/Packages/MyBT/BT/Compiler/Tokenizer/TokenLocation.cs

37 lines
1.0 KiB
C#

//============= Copyright (c) Ludic GmbH, All rights reserved. ==============
//
// Purpose: Part of the My Behaviour Tree Code
//
//=============================================================================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MyBT {
public class TokenLocation : ScriptableObject {
[SerializeField]
public int line, col;
[SerializeField]
public string code;
[SerializeField]
public UnityEngine.TextAsset source;
public string location {
get {
return $"<line:{line},col:{col}>";
}
}
public void Init (UnityEngine.TextAsset _source, int _start, int _length, int _line, int _col) {
source = _source;
line = _line;
col = _col;
code = _source.text.Substring(_start, _length);
code = code.Replace("\r","").Replace("\n","").Replace("\t", "");
}
}
}