├── .idea
└── .idea.YukataScript
│ └── .idea
│ ├── .gitignore
│ ├── encodings.xml
│ ├── indexLayout.xml
│ └── inspectionProfiles
│ └── Project_Default.xml
├── Assembly-CSharp.csproj.DotSettings
├── Assets
├── Plugins.meta
├── Plugins
│ ├── System.Runtime.CompilerServices.Unsafe.dll
│ └── System.Runtime.CompilerServices.Unsafe.dll.meta
├── Scenes.meta
├── Scenes
│ ├── RuntimeUI.unity
│ ├── SampleScene.unity
│ └── SampleScene.unity.meta
├── Scripts.meta
├── Scripts
│ ├── DemoForBuild.cs
│ ├── DemoForBuild.cs.meta
│ ├── JsonTest.cs
│ ├── JsonTest.cs.meta
│ ├── MySettings.cs
│ ├── MySettings.cs.meta
│ ├── NewText.txt
│ ├── NewText.txt.meta
│ ├── UITest.cs
│ ├── UITest.cs.meta
│ ├── Variables.asset
│ ├── Variables.asset.meta
│ ├── VariablesObject.cs
│ ├── VariablesObject.cs.meta
│ ├── YSTest.cs
│ ├── YSTest.cs.meta
│ ├── conditions.ys.txt
│ └── forLoop.ys.txt
├── UI Toolkit
│ └── UnityThemes
│ │ └── UnityDefaultRuntimeTheme.tss
├── YS.Generated.meta
├── YS.Generated
│ ├── .editorconfig
│ ├── CodeGenData.cs
│ ├── CodeGenData.cs.meta
│ ├── InspectorVariables.cs
│ ├── InspectorVariables.cs.meta
│ ├── Modules.meta
│ ├── Modules
│ │ ├── .editorconfig
│ │ ├── Wrapper.System.Enum.cs
│ │ ├── Wrapper.System.Enum.cs.meta
│ │ ├── Wrapper.UnityEngine.AnimationCurve.cs
│ │ ├── Wrapper.UnityEngine.AnimationCurve.cs.meta
│ │ ├── Wrapper.UnityEngine.Behaviour.cs
│ │ ├── Wrapper.UnityEngine.Behaviour.cs.meta
│ │ ├── Wrapper.UnityEngine.Color.cs
│ │ ├── Wrapper.UnityEngine.Color.cs.meta
│ │ ├── Wrapper.UnityEngine.Component.cs
│ │ ├── Wrapper.UnityEngine.Component.cs.meta
│ │ ├── Wrapper.UnityEngine.GameObject.cs
│ │ ├── Wrapper.UnityEngine.GameObject.cs.meta
│ │ ├── Wrapper.UnityEngine.Mathf.cs
│ │ ├── Wrapper.UnityEngine.Mathf.cs.meta
│ │ ├── Wrapper.UnityEngine.MonoBehaviour.cs
│ │ ├── Wrapper.UnityEngine.MonoBehaviour.cs.meta
│ │ ├── Wrapper.UnityEngine.Object.cs
│ │ ├── Wrapper.UnityEngine.Object.cs.meta
│ │ ├── Wrapper.UnityEngine.Renderer.cs
│ │ ├── Wrapper.UnityEngine.Renderer.cs.meta
│ │ ├── Wrapper.UnityEngine.SpriteRenderer.cs
│ │ ├── Wrapper.UnityEngine.SpriteRenderer.cs.meta
│ │ ├── Wrapper.UnityEngine.Time.cs
│ │ ├── Wrapper.UnityEngine.Time.cs.meta
│ │ ├── Wrapper.UnityEngine.Transform.cs
│ │ ├── Wrapper.UnityEngine.Transform.cs.meta
│ │ ├── Wrapper.UnityEngine.Vector3.cs
│ │ ├── Wrapper.UnityEngine.Vector3.cs.meta
│ │ ├── Wrapper.YS.EasingType.cs
│ │ ├── Wrapper.YS.Timer.cs
│ │ ├── Wrapper.YS.Timer.cs.meta
│ │ ├── assembly_data.json
│ │ ├── assembly_data.json.meta
│ │ ├── type_data.json
│ │ └── type_data.json.meta
│ ├── Wrapper.RegisterModules.cs
│ ├── Wrapper.cs
│ └── Wrapper.cs.meta
├── YS.UI
│ ├── Fields.cs
│ ├── Fields.cs.meta
│ ├── I.cs
│ ├── I.cs.meta
│ ├── New Panel Settings.asset
│ ├── UITest.uxml
│ └── inputfield.uss
├── YS.meta
└── YS
│ ├── Editor.meta
│ ├── Editor
│ ├── CodeGeneration.meta
│ ├── CodeGeneration
│ │ ├── WrapperGenerator.cs
│ │ └── WrapperGenerator.cs.meta
│ ├── LibraryWindow.cs
│ ├── LibraryWindow.cs.meta
│ ├── NamedVariableDrawer.cs
│ ├── NamedVariableDrawer.cs.meta
│ ├── Resources.meta
│ ├── Resources
│ │ ├── GenericIcon.png
│ │ ├── GenericIcon.png.meta
│ │ ├── namespaceIcon.png
│ │ └── namespaceIcon.png.meta
│ ├── TreeDropDown.cs
│ ├── TreeDropDown.cs.meta
│ ├── VariableDrawer.cs
│ ├── VariableDrawer.cs.meta
│ ├── WrapperGenerationWindow.cs
│ ├── WrapperGenerationWindow.cs.meta
│ ├── YS.Editor.asmdef
│ └── YS.Editor.asmdef.meta
│ ├── Runtime.meta
│ └── Runtime
│ ├── AST.meta
│ ├── AST
│ ├── Expressions.meta
│ ├── Expressions
│ │ ├── AssignExpression.cs
│ │ ├── AssignExpression.cs.meta
│ │ ├── AwaitExpression.cs
│ │ ├── AwaitExpression.cs.meta
│ │ ├── BinaryExpression.cs
│ │ ├── BinaryExpression.cs.meta
│ │ ├── BooleanLiteral.cs
│ │ ├── BooleanLiteral.cs.meta
│ │ ├── CallExpression.cs
│ │ ├── CallExpression.cs.meta
│ │ ├── CastExpression.cs
│ │ ├── CastExpression.cs.meta
│ │ ├── ConditionalExpression.cs
│ │ ├── ConditionalExpression.cs.meta
│ │ ├── DefaultExpression.cs
│ │ ├── DefaultExpression.cs.meta
│ │ ├── Identifier.cs
│ │ ├── Identifier.cs.meta
│ │ ├── IndexerExpression.cs
│ │ ├── IndexerExpression.cs.meta
│ │ ├── KeywordIdentifier.cs
│ │ ├── KeywordIdentifier.cs.meta
│ │ ├── LinkedIdentifierExpression.cs
│ │ ├── LinkedIdentifierExpression.cs.meta
│ │ ├── ListedExpression.cs
│ │ ├── ListedExpression.cs.meta
│ │ ├── MemberExpression.cs
│ │ ├── MemberExpression.cs.meta
│ │ ├── NewExpression.cs
│ │ ├── NewExpression.cs.meta
│ │ ├── NullExpression.cs
│ │ ├── NullExpression.cs.meta
│ │ ├── NumericLiteral.cs
│ │ ├── NumericLiteral.cs.meta
│ │ ├── OutVarNameExpression.cs
│ │ ├── OutVarNameExpression.cs.meta
│ │ ├── PostIncrementDecrementExpression.cs
│ │ ├── PostIncrementDecrementExpression.cs.meta
│ │ ├── PreIncrementDecrementExpression.cs
│ │ ├── PreIncrementDecrementExpression.cs.meta
│ │ ├── RangeExpression.cs
│ │ ├── RangeExpression.cs.meta
│ │ ├── StringLiteral.cs
│ │ ├── StringLiteral.cs.meta
│ │ ├── TypeOfExpression.cs
│ │ ├── TypeOfExpression.cs.meta
│ │ ├── UnaryExpression.cs
│ │ └── UnaryExpression.cs.meta
│ ├── IExpression.cs
│ ├── IExpression.cs.meta
│ ├── IStatement.cs
│ ├── IStatement.cs.meta
│ ├── LiteralType.cs
│ ├── LiteralType.cs.meta
│ ├── Root.cs
│ ├── Root.cs.meta
│ ├── Statements.meta
│ ├── Statements
│ │ ├── AsyncStatement.cs
│ │ ├── AsyncStatement.cs.meta
│ │ ├── BlockStatement.cs
│ │ ├── BlockStatement.cs.meta
│ │ ├── BreakStatement.cs
│ │ ├── BreakStatement.cs.meta
│ │ ├── ConstStatement.cs
│ │ ├── ConstStatement.cs.meta
│ │ ├── ContinueStatement.cs
│ │ ├── ContinueStatement.cs.meta
│ │ ├── ExpressionStatement.cs
│ │ ├── ExpressionStatement.cs.meta
│ │ ├── ForEachStatement.cs
│ │ ├── ForEachStatement.cs.meta
│ │ ├── FunctionStatement.cs
│ │ ├── FunctionStatement.cs.meta
│ │ ├── IfStatement.cs
│ │ ├── IfStatement.cs.meta
│ │ ├── ReturnStatement.cs
│ │ ├── ReturnStatement.cs.meta
│ │ ├── UsingStatement.cs
│ │ ├── UsingStatement.cs.meta
│ │ ├── VarStatement.cs
│ │ ├── VarStatement.cs.meta
│ │ ├── WhileStatement.cs
│ │ └── WhileStatement.cs.meta
│ ├── Validator.cs
│ └── Validator.cs.meta
│ ├── Async.meta
│ ├── Async
│ ├── ILoopItem.cs
│ ├── ILoopItem.cs.meta
│ ├── IPoolableCorutine.cs
│ ├── IPoolableCorutine.cs.meta
│ ├── LoopRunner.cs
│ ├── LoopRunner.cs.meta
│ ├── PlayerLoop.cs
│ ├── PlayerLoop.cs.meta
│ ├── ProcessHandler.cs
│ └── ProcessHandler.cs.meta
│ ├── Attributes.meta
│ ├── Attributes
│ ├── YSMethodAttribute.cs
│ └── YSMethodAttribute.cs.meta
│ ├── CodeGenerationType.cs
│ ├── CodeGenerationType.cs.meta
│ ├── Collections.meta
│ ├── Collections
│ ├── AddableSpan.cs
│ ├── AddableSpan.cs.meta
│ ├── ArrayWrapper.cs
│ ├── ArrayWrapper.cs.meta
│ ├── CollectionsUtility.cs
│ ├── CollectionsUtility.cs.meta
│ ├── FixedArray.cs
│ ├── FixedArray.cs.meta
│ ├── FixedDictionary.cs
│ ├── FixedDictionary.cs.meta
│ ├── LinkedPool.cs
│ ├── LinkedPool.cs.meta
│ ├── ListLike.cs
│ ├── ListLike.cs.meta
│ ├── RentSpan.cs
│ ├── RentSpan.cs.meta
│ ├── ReversedSpan.cs
│ ├── ReversedSpan.cs.meta
│ ├── SimpleList.cs
│ ├── SimpleList.cs.meta
│ ├── StringDictionary`1.cs
│ ├── StringDictionary`1.cs.meta
│ ├── StringHashSet.cs
│ ├── StringHashSet.cs.meta
│ ├── TypeKeyAddOnlyDictionary.cs
│ ├── TypeKeyAddOnlyDictionary.cs.meta
│ ├── UshortDictionary`1.cs
│ ├── UshortDictionary`1.cs.meta
│ ├── UshortSet.cs
│ ├── UshortSet.cs.meta
│ ├── ValueList.cs
│ └── ValueList.cs.meta
│ ├── Constants.cs
│ ├── Constants.cs.meta
│ ├── Easing.cs
│ ├── ElapsedTimeLogger.cs
│ ├── ElapsedTimeLogger.cs.meta
│ ├── Extension.cs
│ ├── Fields.meta
│ ├── Fields
│ ├── NameSpaceTree.cs
│ ├── NameSpaceTree.cs.meta
│ ├── NameSplitTree.cs
│ ├── NameSplitTree.cs.meta
│ ├── NamedVariable.cs
│ └── NamedVariable.cs.meta
│ ├── Frame.cs
│ ├── Frame.cs.meta
│ ├── Instructions.meta
│ ├── Instructions
│ ├── Async.cs
│ ├── Async.cs.meta
│ ├── CastAndCopy.cs
│ ├── CastAndCopy.cs.meta
│ ├── ControlStatements.cs
│ ├── ControlStatements.cs.meta
│ ├── Delegates.cs
│ ├── Delegates.cs.meta
│ ├── IInstruction.cs
│ ├── IInstruction.cs.meta
│ ├── IntrinsicFunction.cs
│ ├── IntrinsicFunction.cs.meta
│ ├── MethodInfoInvoker.cs
│ └── MethodInfoInvoker.cs.meta
│ ├── Lexer.meta
│ ├── Lexer
│ ├── Lexer.cs
│ ├── Lexer.cs.meta
│ ├── Token.cs
│ └── Token.cs.meta
│ ├── Modules.meta
│ ├── Modules
│ ├── GlobalModule.cs
│ ├── GlobalModule.cs.meta
│ ├── MethodData.cs
│ ├── MethodData.cs.meta
│ ├── ModuleLibrary.cs
│ ├── ModuleLibrary.cs.meta
│ ├── TypeModule.cs
│ ├── TypeModule.cs.meta
│ ├── TypeSignature.cs
│ └── TypeSignature.cs.meta
│ ├── Parser.meta
│ ├── Parser
│ ├── NumericParser.cs
│ ├── NumericParser.cs.meta
│ ├── Parser.cs
│ ├── Parser.cs.meta
│ ├── ParserException.cs
│ └── ParserException.cs.meta
│ ├── Ranges.cs
│ ├── Ranges.cs.meta
│ ├── Text.meta
│ ├── Text
│ ├── ReadOnlySpanSegments.cs
│ ├── ReadOnlySpanSegments.cs.meta
│ ├── ReadOnlyStringSegmentSpan.cs
│ ├── ReadOnlyStringSegmentSpan.cs.meta
│ ├── StringEx.cs
│ ├── StringEx.cs.meta
│ ├── StringSegment.cs
│ ├── StringSegment.cs.meta
│ ├── StringSegmentList.cs
│ └── StringSegmentList.cs.meta
│ ├── Timer.cs
│ ├── Timer.cs.meta
│ ├── UniTime.cs
│ ├── UniTime.cs.meta
│ ├── Util.cs
│ ├── Util.cs.meta
│ ├── VM.meta
│ ├── VM
│ ├── Compiler.cs
│ ├── Compiler.cs.meta
│ ├── CompilingContext.cs
│ ├── CompilingContext.cs.meta
│ ├── DelegateLibrary.cs
│ ├── DelegateLibrary.cs.meta
│ ├── IntegratedEngine.cs
│ ├── IntegratedEngine.cs.meta
│ ├── ProcessState.cs
│ ├── ProcessState.cs.meta
│ ├── VirtualMachine.Execution.cs
│ ├── VirtualMachine.Execution.cs.meta
│ ├── VirtualMachine.Instructions.Aync.cs
│ ├── VirtualMachine.Instructions.Aync.cs.meta
│ ├── VirtualMachine.Instructions.Cast.cs
│ ├── VirtualMachine.Instructions.Cast.cs.meta
│ ├── VirtualMachine.Instructions.Control.cs
│ ├── VirtualMachine.Instructions.Control.cs.meta
│ ├── VirtualMachine.Instructions.Copy.cs
│ ├── VirtualMachine.Instructions.Copy.cs.meta
│ ├── VirtualMachine.Instructions.Delegate.cs
│ ├── VirtualMachine.Instructions.Delegate.cs.meta
│ ├── VirtualMachine.Instructions.IntrinsicFunctions.cs
│ ├── VirtualMachine.Instructions.IntrinsicFunctions.cs.meta
│ ├── VirtualMachine.Instructions.MethodInfoInvoke.cs
│ ├── VirtualMachine.Instructions.MethodInfoInvoke.cs.meta
│ ├── VirtualMachine.Instructions.cs
│ ├── VirtualMachine.Instructions.cs.meta
│ ├── VirtualMachine.cs
│ ├── VirtualMachine.cs.meta
│ ├── YSAwaiter.cs
│ ├── YSAwaiter.cs.meta
│ ├── YSEnumerator.cs
│ └── YSEnumerator.cs.meta
│ ├── ValueStopwatch.cs
│ ├── ValueStopwatch.cs.meta
│ ├── Variable.cs
│ ├── Variable.cs.meta
│ ├── YS.Runtime.asmdef
│ └── YS.Runtime.asmdef.meta
├── Images
├── Reflection.png
├── YSAsync.gif
├── YSFieldTypeSelect.gif
├── YSJson.gif
├── YSPerformance.gif
└── YSTypeSelect.gif
├── LICENSE
├── Packages
├── manifest.json
└── packages-lock.json
├── ProjectSettings
├── AudioManager.asset
├── ClusterInputManager.asset
├── DynamicsManager.asset
├── EditorBuildSettings.asset
├── EditorSettings.asset
├── GraphicsSettings.asset
├── InputManager.asset
├── MemorySettings.asset
├── NavMeshAreas.asset
├── PackageManagerSettings.asset
├── Packages
│ └── com.unity.testtools.codecoverage
│ │ └── Settings.json
├── Physics2DSettings.asset
├── PresetManager.asset
├── ProjectSettings.asset
├── ProjectVersion.txt
├── QualitySettings.asset
├── SceneTemplateSettings.json
├── TagManager.asset
├── TimeManager.asset
├── TimelineSettings.asset
├── UnityConnectSettings.asset
├── VFXManager.asset
├── VersionControlSettings.asset
├── VisualScriptingSettings.asset
├── XRSettings.asset
└── boot.config
├── README.md
├── Third Party Notices.md
├── UserSettings
├── EditorUserSettings.asset
├── Layouts
│ ├── CurrentMaximizeLayout.dwlt
│ └── default-2021.dwlt
└── Search.settings
├── YS.csproj.DotSettings
└── docs
├── Build
├── docs.data
├── docs.framework.js
├── docs.loader.js
└── docs.wasm
├── StreamingAssets
└── UnityServicesProjectConfiguration.json
├── TemplateData
├── favicon.ico
├── fullscreen-button.png
├── progress-bar-empty-dark.png
├── progress-bar-empty-light.png
├── progress-bar-full-dark.png
├── progress-bar-full-light.png
├── style.css
├── unity-logo-dark.png
├── unity-logo-light.png
└── webgl-logo.png
└── index.html
/.idea/.idea.YukataScript/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Rider ignored files
5 | /contentModel.xml
6 | /.idea.YukataScript.iml
7 | /projectSettingsUpdater.xml
8 | /modules.xml
9 | # Editor-based HTTP Client requests
10 | /httpRequests/
11 | # Datasource local storage ignored files
12 | /dataSources/
13 | /dataSources.local.xml
14 |
--------------------------------------------------------------------------------
/.idea/.idea.YukataScript/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/.idea.YukataScript/.idea/indexLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/.idea.YukataScript/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Assembly-CSharp.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/Assets/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ef3a7d4d91b8fbc43bb6c51704fb3ba2
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Akeit0/YukataScript/bb06c77046e3f67169cfa28ab24953538c3c692f/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll
--------------------------------------------------------------------------------
/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7f5fd6900c4f48345b2d2b4dc2029425
3 | PluginImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | iconMap: {}
7 | executionOrder: {}
8 | defineConstraints: []
9 | isPreloaded: 0
10 | isOverridable: 0
11 | isExplicitlyReferenced: 0
12 | validateReferences: 1
13 | platformData:
14 | - first:
15 | Any:
16 | second:
17 | enabled: 1
18 | settings: {}
19 | - first:
20 | Editor: Editor
21 | second:
22 | enabled: 0
23 | settings:
24 | DefaultValueInitialized: true
25 | - first:
26 | Windows Store Apps: WindowsStoreApps
27 | second:
28 | enabled: 0
29 | settings:
30 | CPU: AnyCPU
31 | userData:
32 | assetBundleName:
33 | assetBundleVariant:
34 |
--------------------------------------------------------------------------------
/Assets/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6ea315d0fd7389c41b19996891e99ae3
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scenes/SampleScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9fc0d4010bbf28b4594072e72b8655ab
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 955fb868e04438941ab3fa84660827af
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scripts/DemoForBuild.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e1efb2b320314dbeb9a31d861a55f76f
3 | timeCreated: 1676714416
--------------------------------------------------------------------------------
/Assets/Scripts/JsonTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Buffers;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using NaughtyAttributes;
6 | using UnityEngine;
7 | using YS;
8 | using YS.Fields;
9 | using YS.Modules;
10 |
11 | namespace DefaultNamespace {
12 | public class JsonTest :MonoBehaviour {
13 | public List Fields;
14 | [TextArea(3,20)]
15 | public string Json;
16 | StringBuilder _builder = new StringBuilder();
17 |
18 |
19 | static Dictionary _dictionary = new Dictionary();
20 |
21 | [Button()]
22 | public void ToJson () {
23 |
24 | _builder.AppendLine("{");
25 | for (var i = 0; i < Fields.Count; i++) {
26 | var namedVariable = Fields[i];
27 | _builder.Append('"');
28 | _builder.Append(namedVariable.Name);
29 | _builder.Append("\":");
30 | ModuleLibrary.ToJson(namedVariable.Variable, _builder);
31 | if(i+1 json, List list) {
47 | list.Clear();
48 | if (json.Length < 9) return;
49 | int start = 0;
50 | while (true) {
51 | while (json[start++] != '"') { }
52 | int end = start;
53 | while (json[++end] != '"') { }
54 | string name = json.Slice(start, end - start).ToString();
55 | start = end + 1;
56 | var variable = ModuleLibrary.FromJson(json[start..], out var count);
57 | list.Add(new NameVariablePair(name,variable));
58 | start +=count;
59 | while (true) {
60 | var c = json[start++];
61 | if (c == ',') {
62 | break;
63 | }
64 | if (c == '}') return;
65 | }
66 | }
67 |
68 |
69 | }
70 | }
71 |
72 | }
--------------------------------------------------------------------------------
/Assets/Scripts/JsonTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 88e98cecffd74582996b9bd6d0573b86
3 | timeCreated: 1675228160
--------------------------------------------------------------------------------
/Assets/Scripts/MySettings.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class MySettings : MonoBehaviour {
6 | // Start is called before the first frame update
7 | void Start() {
8 | Application.targetFrameRate = 60;
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/Assets/Scripts/MySettings.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ec255996ac013b845a8548bcd3e8296d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/Scripts/NewText.txt:
--------------------------------------------------------------------------------
1 | using UnityEngine
2 | print("Start")
3 | for i in ..100{
4 | await 30.ms()
5 | transform.position+=new Vector3(f,0,0)
6 | }
--------------------------------------------------------------------------------
/Assets/Scripts/NewText.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c3ea19c53bfdc644e928789941fd362a
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/Scripts/UITest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using System.Linq;
6 | using System.Runtime.CompilerServices;
7 | using NaughtyAttributes;
8 | using UnityEngine;
9 | using UnityEngine.UIElements;
10 | using YS;
11 | using YS.Fields;
12 | using YS.UI;
13 |
14 | namespace DefaultNamespace {
15 | [RequireComponent(typeof(UIDocument))]
16 | public class UITest : MonoBehaviour {
17 | VisualElement root;
18 | public Variable FloatVariable;
19 | public VariableVector3Variable;
20 | public VariableColorVariable;
21 | public VariableTransformVariable;
22 |
23 | VariableField _floatField;
24 | VariableField _vector3Field;
25 | VariableField _colorField;
26 | VariableField _transformField;
27 | public void Start() {
28 | Application.targetFrameRate = 60;
29 |
30 |
31 | root = GetComponent().rootVisualElement;
32 | var inputRoot=root.Q();
33 |
34 | VariableField.VariableView = inputRoot;
35 | var holder = inputRoot.Q("Variables");
36 | var _ = new I(holder) {
37 | (_floatField = VariableField.Create(FloatVariable)),
38 | (_vector3Field = VariableField.Create(Vector3Variable)),
39 | (_colorField = VariableField.Create(ColorVariable)),
40 | (_transformField = VariableField.Create(TransformVariable)),
41 | };
42 | var button = new Button(() => holder.Insert(holder.childCount-1,new SelfRemoveElement(new SelectableField()))) {
43 | text = "+",
44 | style = {
45 | unityTextAlign = TextAnchor.MiddleCenter
46 | }
47 | };
48 | holder.Add(button);
49 |
50 | }
51 |
52 | public void Update() {
53 | if (Input.GetKeyDown(KeyCode.F12)||Input.GetKeyDown(KeyCode.Escape)) {
54 | root.visible = !root.visible;
55 | }
56 | _floatField.Validate();
57 | _vector3Field.Validate();
58 | _colorField.Validate();
59 | _transformField.Validate();
60 |
61 | }
62 | }
63 |
64 | public class SelfRemoveElement : VisualElement {
65 | public SelfRemoveElement(VisualElement element) {
66 | style.flexDirection = FlexDirection.Row;
67 | element.style.flexGrow = 1;
68 | Add(element);
69 | Add(new Button(()=>parent.Remove(this)){style={unityTextAlign = TextAnchor.UpperCenter,width=20,height = new Length(100,LengthUnit.Percent)},text = "-"});
70 | }
71 |
72 | }
73 | }
--------------------------------------------------------------------------------
/Assets/Scripts/UITest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ba0f75cfdbd94340bb2b17a835eecfe0
3 | timeCreated: 1676713649
--------------------------------------------------------------------------------
/Assets/Scripts/Variables.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: f8bc664981804022806608ec2b34fdfa, type: 3}
13 | m_Name: Variables
14 | m_EditorClassIdentifier:
15 | Fields:
16 | - Name: f
17 | Variable:
18 | rid: 9208754235765161990
19 | - Name: text
20 | Variable:
21 | rid: 9208754304739966979
22 | - Name: color
23 | Variable:
24 | rid: 9208754304739966978
25 | - Name: v3
26 | Variable:
27 | rid: 9208754235765161993
28 | - Name: obj
29 | Variable:
30 | rid: 9208754304739966980
31 | references:
32 | version: 2
33 | RefIds:
34 | - rid: 9208754235765161990
35 | type: {class: floatVariable, ns: YS.Generated, asm: Assembly-CSharp}
36 | data:
37 | value: 4.95
38 | - rid: 9208754235765161993
39 | type: {class: UnityEngine_Vector3Variable, ns: YS.Generated, asm: Assembly-CSharp}
40 | data:
41 | value: {x: 0, y: 0, z: 0}
42 | - rid: 9208754304739966978
43 | type: {class: UnityEngine_ColorVariable, ns: YS.Generated, asm: Assembly-CSharp}
44 | data:
45 | value: {r: 0.4552704, g: 1, b: 0, a: 1}
46 | - rid: 9208754304739966979
47 | type: {class: stringVariable, ns: YS.Generated, asm: Assembly-CSharp}
48 | data:
49 | value: HelloWorld!!
50 | - rid: 9208754304739966980
51 | type: {class: UnityEngine_ObjectVariable, ns: YS.Generated, asm: Assembly-CSharp}
52 | data:
53 | value: {fileID: 0}
54 |
--------------------------------------------------------------------------------
/Assets/Scripts/Variables.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ed46673786c458a4782d0a8c023e9c9b
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 11400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/Scripts/VariablesObject.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using YS.Fields;
3 |
4 | namespace DefaultNamespace {
5 | [CreateAssetMenu(fileName = "Variables", menuName = "ScriptableObjects/VariablesObject")]
6 | public class VariablesObject :ScriptableObject {
7 | public NamedVariable[] Fields;
8 | }
9 | }
--------------------------------------------------------------------------------
/Assets/Scripts/VariablesObject.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f8bc664981804022806608ec2b34fdfa
3 | timeCreated: 1675228922
--------------------------------------------------------------------------------
/Assets/Scripts/YSTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ba27cbf03b404bcba3a3999823aeccbe
3 | timeCreated: 1673088435
--------------------------------------------------------------------------------
/Assets/Scripts/conditions.ys.txt:
--------------------------------------------------------------------------------
1 | var ok = true
2 | isZero := 1 + 1 == 0;
3 | if ok && isZero{
4 | print("a")
5 | }
6 | if (not isZero){
7 | print("b")
8 | }
--------------------------------------------------------------------------------
/Assets/Scripts/forLoop.ys.txt:
--------------------------------------------------------------------------------
1 | for i in 1..10{
2 | if( i<3){
3 | continue;
4 | }
5 | if i>=7{
6 | break;
7 | }
8 | else{
9 | print(i)
10 | }
11 | }
--------------------------------------------------------------------------------
/Assets/UI Toolkit/UnityThemes/UnityDefaultRuntimeTheme.tss:
--------------------------------------------------------------------------------
1 | @import url("unity-theme://default");
--------------------------------------------------------------------------------
/Assets/YS.Generated.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 93b509df4bdf41b18f154252645ac703
3 | timeCreated: 1675352343
--------------------------------------------------------------------------------
/Assets/YS.Generated/.editorconfig:
--------------------------------------------------------------------------------
1 | [*Wrapper.RegisterModules.cs]
2 | generated_code = true
--------------------------------------------------------------------------------
/Assets/YS.Generated/CodeGenData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using static YS.CodeGenerationType;
4 | namespace YS.Generated {
5 | public static class CodeGenData {
6 | [CodeGenAssembly]
7 | public static List AssemblyNameList=new List() {
8 | "mscorlib",
9 | "UnityEngine.CoreModule"
10 | };
11 | [CodeGenTypes]
12 | public static List<(CodeGenerationType,Type)> TypeList=new List<(CodeGenerationType, Type)>() {
13 | (InspectorOnly,typeof(int)),
14 | (InspectorOnly,typeof(float)),
15 | };
16 | }
17 | }
--------------------------------------------------------------------------------
/Assets/YS.Generated/CodeGenData.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 838a58d1830c407eb78f48c0251c87f1
3 | timeCreated: 1675929730
--------------------------------------------------------------------------------
/Assets/YS.Generated/InspectorVariables.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace YS.Generated {
3 | public class boolVariable:Variable{}
4 | public class intVariable:Variable{}
5 | public class doubleVariable:Variable{}
6 | public class floatVariable:Variable{}
7 | public class stringVariable:Variable{}
8 | public class UnityEngine_MonoBehaviourVariable:Variable{}
9 | public class UnityEngine_BehaviourVariable:Variable{}
10 | public class UnityEngine_ComponentVariable:Variable{}
11 | public class UnityEngine_ObjectVariable:Variable{}
12 | public class UnityEngine_Vector3Variable:Variable{}
13 | public class UnityEngine_TransformVariable:Variable{}
14 | public class UnityEngine_GameObjectVariable:Variable{}
15 | public class UnityEngine_ColorVariable:Variable{}
16 | public class UnityEngine_AnimationCurveVariable:Variable{}
17 | public class UnityEngine_SpriteRendererVariable:Variable{}
18 | public class UnityEngine_RendererVariable:Variable{}
19 | public class YS_EasingTypeVariable:Variable{}
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/InspectorVariables.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9a6f8ef52168499eb95c192c8f7fce29
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6a0eb0c500304ad99072c805af070893
3 | timeCreated: 1675352679
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/.editorconfig:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Akeit0/YukataScript/bb06c77046e3f67169cfa28ab24953538c3c692f/Assets/YS.Generated/Modules/.editorconfig
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.System.Enum.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4846969481644574c9206a61e2105273
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.AnimationCurve.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 185a0dd9939ac3a4489991f5a639ed06
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Behaviour.cs:
--------------------------------------------------------------------------------
1 | #if !UNITY_EDITOR&&ENABLE_IL2CPP
2 | #define AOT
3 | #endif
4 | using Behaviour = UnityEngine.Behaviour;
5 | using _Behaviour = YS.Variable;
6 | using _bool = YS.Variable;
7 |
8 | using static System.Runtime.CompilerServices.Unsafe;
9 | using __V = YS.Variable;
10 | namespace YS.Generated {
11 | public static partial class Wrapper {
12 | static void UnityEngine_Behaviour_ctor(__V res) => As<_Behaviour>(res).value = new Behaviour();
13 | static void UnityEngine_Behaviour_get_enabled(__V res, __V i1) => As<_bool>(res).value=As<_Behaviour>(i1).value.enabled;
14 | static void UnityEngine_Behaviour_set_enabled(__V i1, __V i2) => As<_Behaviour>(i1).value.enabled = As<_bool>(i2).value;
15 | static void UnityEngine_Behaviour_get_isActiveAndEnabled(__V res, __V i1) => As<_bool>(res).value=As<_Behaviour>(i1).value.isActiveAndEnabled;
16 | #if !AOT
17 |
18 | static TypeModule Create_UnityEngine_BehaviourModule(global::System.Type baseType=null) {
19 | var module = new TypeModule(typeof(Behaviour));
20 | module.RegisterConstructor(UnityEngine_Behaviour_ctor);
21 | module.RegisterPropertyGetter("enabled", UnityEngine_Behaviour_get_enabled);
22 | module.RegisterPropertySetter("enabled", UnityEngine_Behaviour_set_enabled);
23 | module.RegisterPropertyGetter("isActiveAndEnabled", UnityEngine_Behaviour_get_isActiveAndEnabled);
24 | #else
25 | static unsafe TypeModule Create_UnityEngine_BehaviourModule(global::System.Type baseType=null) {
26 | var module = new TypeModule(typeof(Behaviour));
27 | module.RegisterConstructor(&UnityEngine_Behaviour_ctor);
28 | module.RegisterPropertyGetter("enabled", &UnityEngine_Behaviour_get_enabled);
29 | module.RegisterPropertySetter("enabled",& UnityEngine_Behaviour_set_enabled);
30 | module.RegisterPropertyGetter("isActiveAndEnabled", &UnityEngine_Behaviour_get_isActiveAndEnabled);
31 | #endif
32 | module.ClearTempMembers();
33 | if (baseType != null) module.BaseModule = baseType.GetModule();
34 | return module;
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Behaviour.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7530bbf6ba1e76b449bf44d8be066197
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Color.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fe071572682ae374da08df8c797e2f92
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Component.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2f256eef80257c846a15bfb4a74e2694
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.GameObject.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b8577a53ce4c3a44c98dd69290acefea
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Mathf.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b1a418a9f30265649a2b0f8a567b65bf
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.MonoBehaviour.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6514ed592bafc494fb27347e03ba43e8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Object.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fddef61ac3be5284284ab2a89c6c9912
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Renderer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f8549e360a6595f47bea44717adb00ed
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.SpriteRenderer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 083f99bed471e794582bfa3b1c6be66a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Time.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 18082e6bd41484844b42fffbfec1ae07
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Transform.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6f8c9483a0541db478f90fb1eee9728c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.UnityEngine.Vector3.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ece187e6441f6e04b97c686920b3216f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/Wrapper.YS.Timer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 609d069e1b397ea43964501756ac2973
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/assembly_data.json:
--------------------------------------------------------------------------------
1 | {
2 | "value": [
3 | "mscorlib",
4 | "UnityEngine.CoreModule",
5 | "YS.Runtime",
6 | "UnityEngine.UI"
7 | ]
8 | }
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/assembly_data.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b236e2dd7ff6bc84a907ec6538dbcf36
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/type_data.json:
--------------------------------------------------------------------------------
1 | {
2 | "value": [
3 | {
4 | "Name": "bool",
5 | "CodeGenerationType": 1
6 | },
7 | {
8 | "Name": "int",
9 | "CodeGenerationType": 1
10 | },
11 | {
12 | "Name": "double",
13 | "CodeGenerationType": 1
14 | },
15 | {
16 | "Name": "float",
17 | "CodeGenerationType": 1
18 | },
19 | {
20 | "Name": "string",
21 | "CodeGenerationType": 1
22 | },
23 | {
24 | "Name": "UnityEngine.MonoBehaviour",
25 | "CodeGenerationType": 2
26 | },
27 | {
28 | "Name": "UnityEngine.Behaviour",
29 | "CodeGenerationType": 2
30 | },
31 | {
32 | "Name": "UnityEngine.Component",
33 | "CodeGenerationType": 2
34 | },
35 | {
36 | "Name": "UnityEngine.Object",
37 | "CodeGenerationType": 2
38 | },
39 | {
40 | "Name": "UnityEngine.Vector3",
41 | "CodeGenerationType": 2
42 | },
43 | {
44 | "Name": "UnityEngine.Mathf",
45 | "CodeGenerationType": 0
46 | },
47 | {
48 | "Name": "UnityEngine.Transform",
49 | "CodeGenerationType": 2
50 | },
51 | {
52 | "Name": "UnityEngine.GameObject",
53 | "CodeGenerationType": 2
54 | },
55 | {
56 | "Name": "System.Enum",
57 | "CodeGenerationType": 0
58 | },
59 | {
60 | "Name": "UnityEngine.Color",
61 | "CodeGenerationType": 2
62 | },
63 | {
64 | "Name": "UnityEngine.AnimationCurve",
65 | "CodeGenerationType": 2
66 | },
67 | {
68 | "Name": "YS.Timer",
69 | "CodeGenerationType": 0
70 | },
71 | {
72 | "Name": "UnityEngine.Time",
73 | "CodeGenerationType": 0
74 | },
75 | {
76 | "Name": "UnityEngine.SpriteRenderer",
77 | "CodeGenerationType": 2
78 | },
79 | {
80 | "Name": "UnityEngine.Renderer",
81 | "CodeGenerationType": 2
82 | },
83 | {
84 | "Name": "YS.EasingType",
85 | "CodeGenerationType": 2
86 | }
87 | ]
88 | }
--------------------------------------------------------------------------------
/Assets/YS.Generated/Modules/type_data.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8e9117bcef8712b43a4845d6f9a49a41
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Wrapper.RegisterModules.cs:
--------------------------------------------------------------------------------
1 | using static YS.Modules.ModuleLibrary;
2 | namespace YS.Generated {
3 | public static partial class Wrapper {
4 | static void RegisterModules() {
5 | Register(new Variable(),()=>Create_UnityEngine_MonoBehaviourModule(typeof(UnityEngine.Behaviour)));
6 | Register(new Variable(),()=>Create_UnityEngine_BehaviourModule(typeof(UnityEngine.Component)));
7 | Register(new Variable(),()=>Create_UnityEngine_ComponentModule(typeof(UnityEngine.Object)));
8 | Register(new Variable(),()=>Create_UnityEngine_ObjectModule());
9 | Register(new Variable(),()=>Create_UnityEngine_Vector3Module());
10 | Register(new Variable(),()=>Create_UnityEngine_MathfModule());
11 | Register(new Variable(),()=>Create_UnityEngine_TransformModule(typeof(UnityEngine.Component)));
12 | Register(new Variable(),()=>Create_UnityEngine_GameObjectModule(typeof(UnityEngine.Object)));
13 | Register(new Variable(),()=>Create_System_EnumModule());
14 | Register(new Variable(),()=>Create_UnityEngine_ColorModule());
15 | Register(new Variable(),()=>Create_UnityEngine_AnimationCurveModule());
16 | Register(new Variable(),()=>Create_YS_TimerModule());
17 | Register(new Variable(),()=>Create_UnityEngine_TimeModule());
18 | Register(new Variable(),()=>Create_UnityEngine_SpriteRendererModule(typeof(UnityEngine.Renderer)));
19 | Register(new Variable(),()=>Create_UnityEngine_RendererModule(typeof(UnityEngine.Component)));
20 | Register(new Variable(),()=>Create_YS_EasingTypeModule(typeof(System.Enum)));
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Assets/YS.Generated/Wrapper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using UnityEngine.Scripting;
4 | using YS.Modules;
5 |
6 | namespace YS.Generated {
7 | [Preserve]
8 | public static partial class Wrapper {
9 | [RuntimeInitializeOnLoadMethod]
10 | public static void Init(){}
11 |
12 | public static bool Registered;
13 |
14 | static Wrapper() {
15 | RegisterModules();
16 | Registered = true;
17 | }
18 | static Type[] Types() => Util.Types();
19 | static Type[] Types(Type arg1) => Util.Types(arg1);
20 | static Type[] Types(Type arg1, Type arg2) => Util.Types(arg1, arg2);
21 | static Type[] Types(Type arg1,Type arg2,Type arg3) => Util.Types(arg1, arg2,arg3);
22 | static Type[] Types(Type arg1,Type arg2,Type arg3,Type arg4)=> Util.Types(arg1, arg2,arg3,arg4);
23 | static Type[] Types(Type arg1,Type arg2,Type arg3,Type arg4,Type arg5)=> Util.Types(arg1, arg2,arg3,arg4,arg5);
24 | static Type[] Types(Type arg1,Type arg2,Type arg3,Type arg4,Type arg5,Type arg6)=> Util.Types(arg1, arg2,arg3,arg4,arg5, arg6);
25 |
26 | static TypeModule GetModule(this Type type) => ModuleLibrary.GetModule(type);
27 |
28 | }
29 | }
--------------------------------------------------------------------------------
/Assets/YS.Generated/Wrapper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 98f6ea0380ee41f2a3b1bb3eff3c4cef
3 | timeCreated: 1710124929
--------------------------------------------------------------------------------
/Assets/YS.UI/Fields.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6d5d176844794e598991c0617c02f2aa
3 | timeCreated: 1676713510
--------------------------------------------------------------------------------
/Assets/YS.UI/I.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Globalization;
5 | using System.Linq;
6 | using UnityEngine;
7 | using UnityEngine.UIElements;
8 | namespace YS.UI {
9 | public readonly struct I:IEnumerable {
10 | public readonly VisualElement self;
11 | public I(VisualElement element) => self = element;
12 | public I(I element) => self = element.self;
13 |
14 | public IStyle style => self.style;
15 | public void Add(VisualElement child) => self.Add(child);
16 | public IEnumerator GetEnumerator() {
17 | return self.Children().GetEnumerator();
18 | }
19 |
20 | IEnumerator IEnumerable.GetEnumerator() {
21 | return GetEnumerator();
22 | }
23 |
24 |
25 | }
26 | public readonly struct I:IEnumerable where T:VisualElement{
27 | public readonly T self;
28 | public I(T element) => self = element;
29 | public I(I element) => self = element.self;
30 | public IStyle style => self.style;
31 |
32 | public void Add(VisualElement child) => self.Add(child);
33 | public IEnumerator GetEnumerator() {
34 | return self.Children().GetEnumerator();
35 | }
36 |
37 | IEnumerator IEnumerable.GetEnumerator() {
38 | return GetEnumerator();
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/Assets/YS.UI/I.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0a1c61c92f3a436b8667285d02aa7988
3 | timeCreated: 1676713561
--------------------------------------------------------------------------------
/Assets/YS.UI/New Panel Settings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 19101, guid: 0000000000000000e000000000000000, type: 0}
13 | m_Name: New Panel Settings
14 | m_EditorClassIdentifier:
15 | themeUss: {fileID: -4733365628477956816, guid: f222d765f69d43947b9092935982f177, type: 3}
16 | m_TargetTexture: {fileID: 0}
17 | m_ScaleMode: 1
18 | m_Scale: 1
19 | m_ReferenceDpi: 96
20 | m_FallbackDpi: 96
21 | m_ReferenceResolution: {x: 1200, y: 800}
22 | m_ScreenMatchMode: 0
23 | m_Match: 0
24 | m_SortingOrder: 0
25 | m_TargetDisplay: 0
26 | m_ClearDepthStencil: 1
27 | m_ClearColor: 0
28 | m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
29 | m_DynamicAtlasSettings:
30 | m_MinAtlasSize: 64
31 | m_MaxAtlasSize: 4096
32 | m_MaxSubTextureSize: 64
33 | m_ActiveFilters: 31
34 | m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
35 | m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
36 | m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}
37 | textSettings: {fileID: 0}
38 |
--------------------------------------------------------------------------------
/Assets/YS.UI/UITest.uxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Assets/YS.UI/inputfield.uss:
--------------------------------------------------------------------------------
1 | TextField > TextInput, DropdownField>VisualElement {
2 | background-color: rgb(65, 65, 65);
3 | font-size: 14px;
4 | color: rgb(255, 255, 255);
5 | -unity-font-style: normal;
6 | -unity-text-align: upper-left;
7 | --unity-cursor-color: rgb(180, 180, 180);
8 | padding: 0 0 0 2px;
9 | }
10 |
11 | TextField > Label ,DropdownField>Label{
12 | font-size: 14px;
13 | color: rgb(255, 255, 255);
14 | -unity-font-style: normal;
15 | -unity-text-align: upper-left;
16 | padding: 0 0 0 2px;
17 | max-width: 100px;
18 | min-width: 10px;
19 | margin-top: -1px;
20 | }
21 | #Variables >TextField ,DropdownField {
22 | height: 18px;
23 | }
24 | Button{
25 | background-color: rgb(100, 100, 100);
26 | font-size: 14px;
27 | color: rgb(255, 255, 255);
28 | -unity-font-style: normal;
29 | -unity-text-align: upper-left;
30 | --unity-cursor-color: rgb(180, 180, 180);
31 | padding: 0 0 0 2px;
32 | height: 18px;
33 | }
--------------------------------------------------------------------------------
/Assets/YS.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 55e77fbd97c8d0e4585f737875eac5cf
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/YS/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9af0a68b9f204cec83c5c5372b2448b4
3 | timeCreated: 1673744327
--------------------------------------------------------------------------------
/Assets/YS/Editor/CodeGeneration.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6aeca159578c425293e698bacd4a420a
3 | timeCreated: 1674049766
--------------------------------------------------------------------------------
/Assets/YS/Editor/CodeGeneration/WrapperGenerator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 607f119568c74d8696e5e03de3bd172e
3 | timeCreated: 1674049836
--------------------------------------------------------------------------------
/Assets/YS/Editor/LibraryWindow.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using System;
6 | using System.Collections;
7 | using System.IO;
8 | using System.Reflection;
9 | using UnityEditor;
10 | using UnityEditor.IMGUI.Controls;
11 | using UnityEngine;
12 | using UnityEngine.UIElements;
13 | using YS.Collections;
14 | using YS.Editor.CodeGeneration;
15 | using YS.Modules;
16 | using YS.VM;
17 |
18 | namespace YS.Editor {
19 |
20 |
21 |
22 | public class LibraryWindow: EditorWindow {
23 | [MenuItem("YS/Library")]
24 | public static void OpenWindow()
25 | {
26 | _window = GetWindow();
27 | _window.titleContent = new GUIContent("Library");
28 | // Limit size of the window
29 | _window.minSize = new Vector2(450, 200);
30 | _window.maxSize = new Vector2(1920, 720);
31 | }
32 | static LibraryWindow _window;
33 |
34 |
35 | public void CreateGUI() {
36 | // GlobalModule.Activate();
37 | // var list = new ListView {
38 | // makeItem = () => new ListedButton(),
39 | // bindItem = (item, index) => {
40 | // var button = (ListedButton) item;
41 | // button.Button.text = DelegateLibrary.Delegates[index].Data.MethodName;
42 | // button.Action =()=> DelegateLibrary.Delegates[index].Action();
43 | // },
44 | // itemsSource = new object[DelegateLibrary.ActionCount]
45 | // };
46 | // rootVisualElement.Add(list);
47 | }
48 |
49 | }
50 | public class ListedButton : VisualElement {
51 | public Button Button;
52 | public int Index;
53 | public Action Action;
54 | public ListedButton( ) {
55 | Button = new Button(() => this.Action?.Invoke());
56 | Add(Button);
57 |
58 | }
59 | }
60 | }
61 | #endif
--------------------------------------------------------------------------------
/Assets/YS/Editor/LibraryWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 78bbd6b3ff0b447c86f48b39e4350861
3 | timeCreated: 1676079965
--------------------------------------------------------------------------------
/Assets/YS/Editor/NamedVariableDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c6d7c0ef27824980a993d1854e3191ca
3 | timeCreated: 1675134725
--------------------------------------------------------------------------------
/Assets/YS/Editor/Resources.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0f4d6588f2a04652877cfc21bd7ee084
3 | timeCreated: 1675155096
--------------------------------------------------------------------------------
/Assets/YS/Editor/Resources/GenericIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Akeit0/YukataScript/bb06c77046e3f67169cfa28ab24953538c3c692f/Assets/YS/Editor/Resources/GenericIcon.png
--------------------------------------------------------------------------------
/Assets/YS/Editor/Resources/namespaceIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Akeit0/YukataScript/bb06c77046e3f67169cfa28ab24953538c3c692f/Assets/YS/Editor/Resources/namespaceIcon.png
--------------------------------------------------------------------------------
/Assets/YS/Editor/TreeDropDown.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8aab79040e8a4738a5fe67db728e4303
3 | timeCreated: 1675307065
--------------------------------------------------------------------------------
/Assets/YS/Editor/VariableDrawer.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | using UnityEditor;
4 | using UnityEngine;
5 | #if UNITY_EDITOR
6 | namespace YS.Editor {
7 | [CustomPropertyDrawer(typeof(Variable), true)]
8 | public class VariableDrawer : PropertyDrawer {
9 | public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label) {
10 | property = property.serializedObject.FindProperty(property.propertyPath).FindPropertyRelative ("value");
11 | if(property!=null)
12 | EditorGUI.PropertyField(rect, property, new GUIContent(label.text));
13 | }
14 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label){
15 | property = property.serializedObject.FindProperty(property.propertyPath).FindPropertyRelative ("value");
16 | if(property==null)return EditorGUIUtility.singleLineHeight;
17 | return EditorGUI.GetPropertyHeight(property, true);
18 | }
19 | }
20 | }
21 | #endif
--------------------------------------------------------------------------------
/Assets/YS/Editor/VariableDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 10f08e2c3d684108bd6e04295cdecd4c
3 | timeCreated: 1673744341
--------------------------------------------------------------------------------
/Assets/YS/Editor/WrapperGenerationWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8fbd9b12ccc54e1ca407e716618b2185
3 | timeCreated: 1675755439
--------------------------------------------------------------------------------
/Assets/YS/Editor/YS.Editor.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "YS.Editor",
3 | "rootNamespace": "",
4 | "references": [
5 | "GUID:8c25f68c99c25604c9943fbce95dec76"
6 | ],
7 | "includePlatforms": [],
8 | "excludePlatforms": [],
9 | "allowUnsafeCode": false,
10 | "overrideReferences": false,
11 | "precompiledReferences": [],
12 | "autoReferenced": true,
13 | "defineConstraints": [],
14 | "versionDefines": [],
15 | "noEngineReferences": false
16 | }
--------------------------------------------------------------------------------
/Assets/YS/Editor/YS.Editor.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 439e92c0793a75b4592074f1f3f8d781
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 93c92ea70c6f48cca3b6612089b4c16e
3 | timeCreated: 1675921469
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7216fb9a0244275ae596818c92c1f99
3 | timeCreated: 1672974770
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 723ab564dca2418286168eb5471fe3b0
3 | timeCreated: 1672974930
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/AssignExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aae63d85ff593ad4d9a7193b0e6e0b52
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/AwaitExpression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using UnityEngine;
4 | using YS.AST.Expressions;
5 | using YS.Async;
6 | using YS.Lexer;
7 | using YS.Instructions;
8 | using YS.Modules;
9 | using YS.VM;
10 |
11 | namespace YS.AST.Expressions {
12 | public class AwaitExpression : IExpression {
13 | public IExpression Right { get; set; }
14 |
15 | public void ToCode(StringBuilder builder) {
16 | builder.Append("await");
17 | builder.Append(' ');
18 | Right.ToCode(builder);
19 | }
20 |
21 | public void Compile((ushort id,Variable variable) target, CompilingContext context) {
22 | var (t,variable) = Right.Compile(context).Cast();
23 | var variableType = variable.type;
24 | if (DelegateLibrary.AwaiterIdDictionary.TryGetValue(variableType, out var id)) {
25 | context.EmitData(id, target.id, t);
26 | context.Emit(VM.Instructions.CustomAwaiter);
27 | return;
28 | }
29 |
30 | if (ModuleLibrary.TryGetMember(variable,"GetAwaiter", out var o)) {
31 | var getAwaiter = (MethodData) o;
32 | var awaiter = context.AddVariable(getAwaiter.ReturnType);
33 | if (ModuleLibrary.TryGetModule(awaiter.variable, out var module)) {
34 | var isCompletedFunction = (MethodData) module.GetMember("IsCompleted");
35 | var onCompletedFunction = (MethodData) module.GetMember("OnCompleted");
36 | var getResultFunction = (MethodData) module.GetMember("GetResult");
37 | var isCompleted = context.AddVariable();
38 | context.Emit(VM.Instructions.AwaitableVoidPattern);
39 | context.EmitData(getAwaiter.Index);
40 | context.EmitData(awaiter.id,t);
41 | context.EmitData(isCompletedFunction.Index);
42 | context.EmitData(isCompleted.id);
43 | context.EmitData(getResultFunction.Index);
44 | context.EmitData(onCompletedFunction.Index);
45 | return;
46 | }
47 | }
48 |
49 |
50 | throw new Exception();
51 | }
52 |
53 | public (ushort id,object obj) Compile( CompilingContext context){
54 | var (t,variable) = Right.Compile(context).Cast();
55 | var variableType = variable.type;
56 | if (DelegateLibrary.AwaiterIdDictionary.TryGetValue(variableType, out var id)) {
57 | var awaiter = DelegateLibrary.Awaiters[id];
58 | var result = context.AddVariable(awaiter.ResultType);
59 | context.EmitData(id, result.id, t);
60 | context.Emit(VM.Instructions.CustomAwaiter);
61 | return result;
62 | }
63 | throw new Exception();
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/AwaitExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9dbdccd273774089a8ee82fd68d77223
3 | timeCreated: 1672977504
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/BinaryExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e51b2e2b9f7fbdf47965d7b8c6945fa5
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/BooleanLiteral.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Text;
4 | using YS.Lexer;
5 | using YS.VM;
6 |
7 | namespace YS.AST.Expressions {
8 | public class BooleanLiteral : IExpression {
9 | public bool Value { get; set; }
10 | public static readonly string T = "true";
11 | public static readonly string F = "false";
12 |
13 | public static BooleanLiteral True = new BooleanLiteral() {Value = true};
14 | public static BooleanLiteral False = new BooleanLiteral() {Value = false};
15 | public void ToCode(StringBuilder builder) {
16 | builder.Append(Value?T:F);
17 | }
18 |
19 | public void Compile((ushort id,Variable variable) target, CompilingContext context){
20 | if (target.variable is Variable) {
21 | var v= context.AddVariable(Value?Constants.True:Constants.False);
22 | context.EmitCopy(target.id,v);
23 | return;
24 | }
25 |
26 | throw new Exception("not bool");
27 | }
28 | public (ushort id,object obj) Compile( CompilingContext context) {
29 | var variable = Value ? Constants.True : Constants.False;
30 | return (context.AddVariable(variable),variable);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/BooleanLiteral.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 831e5f2a4334c5440b0a6df4d0597826
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/CallExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dd3cb774a632661449f030ed9a36c71b
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/CastExpression.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using YS.Lexer;
3 | using YS.VM;
4 |
5 | namespace YS.AST.Expressions {
6 | public class CastExpression : IExpression
7 | {
8 | public object Type { get; set; }
9 | public IExpression Value { get; set; }
10 |
11 | public CastExpression(object type, IExpression arg) {
12 | Type = type;
13 | Value = arg;
14 | }
15 |
16 |
17 | public void ToCode(StringBuilder builder) {
18 | builder.Append('(');
19 | if (Type is string str) {
20 | builder.Append(str);
21 |
22 | }else if (Type is IExpression expression) {
23 | expression.ToCode(builder);
24 | }
25 | builder.Append(')');
26 | Value.ToCode(builder);
27 | }
28 |
29 | public void Compile((ushort id,Variable variable) target, CompilingContext context) {
30 | throw new System.NotImplementedException();
31 | }
32 |
33 | public (ushort id,object obj) Compile( CompilingContext context) {
34 | throw new System.NotImplementedException();
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/CastExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3498a93566594b72bc994ca1fa5d206a
3 | timeCreated: 1672977739
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/ConditionalExpression.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using YS.Instructions;
3 | using YS.VM;
4 |
5 | namespace YS.AST.Expressions {
6 | public class ConditionalExpression:IExpression {
7 | public IExpression Condition;
8 | public IExpression Consequent;
9 | public IExpression Alternative;
10 | public void ToCode(StringBuilder builder) {
11 | Condition.ToCode(builder);
12 | builder.Append('?');
13 | Consequent.ToCode(builder);
14 | builder.Append(':');
15 | Alternative.ToCode(builder);
16 | }
17 |
18 | public void Compile((ushort id,Variable variable) target, CompilingContext context){
19 | var (b,_) = Condition.Compile(context);
20 | context.EmitData((ushort) 1);
21 | context.EmitData(b);
22 |
23 | context.Emit(VM.Instructions.IfElse);
24 |
25 | var d = context.EnterToScope();
26 | Consequent.Compile(target,context);
27 | context.ExitFromScope(d);
28 |
29 | context.Emit(VM.Instructions.Else);
30 | d = context.EnterToScope();
31 | Alternative.Compile(target,context);
32 | context.ExitFromScope(d);
33 |
34 | }
35 |
36 | public (ushort id,object obj) Compile( CompilingContext context){
37 | var (b,_) =Condition.Compile(context);
38 | context.EmitData((ushort)1);
39 | context.EmitData(b);
40 |
41 | context.Emit(VM.Instructions.IfElse);
42 |
43 | var d = context.EnterToScope();
44 | var first=Consequent.Compile(context);
45 | context.ExitFromScope(d);
46 |
47 | context.Emit(VM.Instructions.Else);
48 | d = context.EnterToScope();
49 | Alternative.Compile(context);
50 | context.ExitFromScope(d);
51 | return first;
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/ConditionalExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ede769137082463f87e6736fb15cc58b
3 | timeCreated: 1672977442
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/DefaultExpression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using YS.Lexer;
4 | using YS.VM;
5 |
6 | namespace YS.AST.Expressions {
7 | public class DefaultExpression:IExpression {
8 | public static DefaultExpression Instance=new ();
9 | public void ToCode(StringBuilder builder) {
10 | builder.Append("default");
11 | }
12 |
13 | public void Compile((ushort id,Variable variable) target, CompilingContext context) {
14 | context.EmitCopy(target.id,1);
15 | }
16 |
17 | public (ushort id,object obj) Compile( CompilingContext context) {
18 | return (1, context.GetVariable(1));
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/DefaultExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 091e17e72d184973893dd49333d4220f
3 | timeCreated: 1672977205
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/Identifier.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using System.Text;
4 | using YS.Collections;
5 | using YS.Lexer;
6 | using YS.Modules;
7 | using YS.VM;
8 | using YS.Text;
9 | namespace YS.AST.Expressions {
10 | public interface IIdentifier : IExpression {
11 | public (ushort id ,Variable variable) AddTypeVariable(CompilingContext context);
12 | }
13 |
14 | public class IdentifierLiteral : IIdentifier {
15 | public StringSegment Name { get; }
16 |
17 | public IdentifierLiteral(StringSegment value)
18 | {
19 | Name = value;
20 | }
21 | public void ToCode(StringBuilder builder) {
22 | builder.Append(Name.AsSpan());
23 | }
24 |
25 | public void Compile((ushort id,Variable variable) target, CompilingContext context){
26 | var src = context.Get(Name);
27 | Validator.ValidateAssignment(target, src,context);
28 |
29 | }
30 |
31 | public (ushort id,object obj) Compile( CompilingContext context) {
32 | var nameSpan = Name.AsSpan();
33 | var hash = Name.GetHashCode();
34 | if (context.TryGetSomething(hash, nameSpan, out var something)) {
35 | return something;
36 | }
37 | // if (context.TryGet(hash,nameSpan, out var id)) {
38 | // return (id, context.GetVariable(id));
39 | // }
40 | // if (context.TryGetFunctions(hash,nameSpan, out var functions)) {
41 | // return (0, functions);
42 | // }
43 | // if (context.TryGetType(hash,nameSpan, out var type)) {
44 | // return (0, type);
45 | // }
46 | throw new KeyNotFoundException(nameSpan.ToString());
47 | }
48 |
49 |
50 | public (ushort,Variable) AddTypeVariable(CompilingContext context) {
51 | return context.AddVariable(context.GetType(Name));
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/Identifier.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 949bb49edffff324da3b5ffe0d0e4298
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/IndexerExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e16bb0dea3884879a3d5df63795d725a
3 | timeCreated: 1672977313
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/KeywordIdentifier.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using YS.Lexer;
3 | using YS.Modules;
4 | using YS.VM;
5 |
6 | namespace YS.AST.Expressions {
7 | public class KeywordIdentifier:IIdentifier {
8 | public TokenType TokenType { get; set; }
9 |
10 |
11 | public KeywordIdentifier(TokenType type) {
12 | TokenType = type;
13 | }
14 | public void ToCode(StringBuilder builder) {
15 | builder.Append(TokenInfo.ToString(TokenType));
16 | }
17 |
18 | public void Compile((ushort id,Variable variable) target, CompilingContext context){
19 | throw new System.NotImplementedException();
20 | }
21 |
22 | public (ushort id,object obj) Compile( CompilingContext context){
23 | if (TokenType.TryGetType(out var type)) {
24 | return (0, type);
25 | }
26 |
27 | return default;
28 | }
29 |
30 | public (ushort,Variable) AddTypeVariable(CompilingContext context) {
31 | return context.AddVariable(context.GetType(TokenInfo.ToString(TokenType)));
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/KeywordIdentifier.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6e96c24b280544da9580e0c98b00a3ca
3 | timeCreated: 1672976451
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/LinkedIdentifierExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eb8c36b49cf041f4b9b077edf6c5088c
3 | timeCreated: 1675569795
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/ListedExpression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using YS.Collections;
6 | using YS.Modules;
7 | using YS.VM;
8 |
9 | namespace YS.AST.Expressions {
10 | public class ListedExpression :IExpression ,IEnumerable<(PassType,IExpression)> {
11 | private (PassType,IExpression)[] _array;
12 | public int Count => _count;
13 | private int _count;
14 |
15 | public ListedExpression() {
16 | _array = new (PassType,IExpression)[4];
17 | _count = 0;
18 | }
19 |
20 | public void Add((PassType,IExpression) param) {
21 | CollectionsUtility.Add(ref _array,ref _count, param);
22 | }
23 |
24 |
25 | public void Clear() {
26 | _array.AsSpan().Clear();
27 | _count = 0;
28 | }
29 |
30 | public void ToCode(StringBuilder builder) {
31 | for (var index = 0; index < Count; index++) {
32 | var args = _array[index];
33 | switch (args.Item1) {
34 | case PassType.Ref: builder.Append("ref ");
35 | break;
36 | case PassType.Out: builder.Append("out ");
37 | break;
38 | case PassType.In: builder.Append("in ");
39 | break;
40 | }
41 | args.Item2.ToCode(builder);
42 | if (index != Count - 1) {
43 | builder.Append(',');
44 | }
45 | }
46 | }
47 |
48 | public void Compile((ushort id,Variable variable) target, CompilingContext context) {
49 | throw new NotImplementedException();
50 | }
51 |
52 | public Span<(PassType,IExpression)>.Enumerator GetEnumerator() {
53 | return _array.AsSpan(0, _count).GetEnumerator();
54 | }
55 | IEnumerator<(PassType,IExpression)> IEnumerable<(PassType,IExpression)>.GetEnumerator() {
56 | throw new NotImplementedException();
57 | }
58 |
59 | IEnumerator IEnumerable.GetEnumerator() {
60 | throw new NotImplementedException();
61 | }
62 |
63 | public (ushort id,object obj) Compile( CompilingContext context) {
64 | throw new NotImplementedException();
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/ListedExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 16823800d6b1fa7489672c9293f04c8a
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/MemberExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 86e069c7cf5c474a8428be6b3c7bbcc4
3 | timeCreated: 1672977379
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/NewExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1b82aea64d722bb43bac24de741738ac
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/NullExpression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using YS.Lexer;
4 | using YS.Modules;
5 | using YS.VM;
6 |
7 | namespace YS.AST.Expressions {
8 | public class NullExpression:IExpression {
9 | public static NullExpression Instance=new ();
10 | public void ToCode(StringBuilder builder) {
11 | builder.Append("null");
12 | }
13 |
14 | public void Compile((ushort id,Variable variable) target, CompilingContext context) {
15 | if (!target.variable.type.IsValueType) {
16 | context.EmitCopyObject(target.id,1);
17 |
18 | }
19 | else {
20 | throw new Exception(target.variable.type.Build() + " cannot be null");
21 | }
22 | }
23 | public (ushort id,object obj) Compile( CompilingContext context) {
24 | throw new Exception("null");
25 |
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/NullExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ed017fcb635271f45b1e2fcb27d04736
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/NumericLiteral.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9cd97b40032b3b840b0371a2c1fb95f2
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/OutVarNameExpression.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using YS.VM;
3 |
4 | namespace YS.AST.Expressions {
5 | public class OutVarNameExpression :IExpression {
6 | public string Name;
7 |
8 | public OutVarNameExpression(string name) {
9 | Name = name;
10 | }
11 | public void ToCode(StringBuilder builder) {
12 | throw new System.NotImplementedException();
13 | }
14 |
15 | public void Compile((ushort id,Variable variable) target, CompilingContext context){
16 | throw new System.NotImplementedException();
17 | }
18 |
19 | public (ushort id,object obj) Compile( CompilingContext context) {
20 | throw new System.NotImplementedException();
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/OutVarNameExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9ac244c5427049c5ac13d793f85b5c7e
3 | timeCreated: 1674718882
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/PostIncrementDecrementExpression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using YS.Collections;
4 | using YS.Modules;
5 | using YS.Instructions;
6 | using YS.VM;
7 | using YS.Text;
8 | namespace YS.AST.Expressions {
9 | public class PostIncrementDecrementExpression:IExpression {
10 | public bool IsIncrement;
11 | public StringSegment Identifier;
12 |
13 | public PostIncrementDecrementExpression(bool isIncrement,StringSegment identifier) {
14 | IsIncrement = isIncrement;
15 | Identifier = identifier;
16 | }
17 | public void ToCode(StringBuilder builder) {
18 | builder.Append('(');
19 | builder.Append(Identifier.AsSpan());
20 | builder.Append(IsIncrement ? "++" : "--");
21 | builder.Append(')');
22 | }
23 |
24 | public void Compile((ushort id,Variable variable) target, CompilingContext context){
25 | var (rightId,rightVariable) = context.Get(Identifier);
26 | var (targetId, targetVariable) = target;
27 | if ( context.IsConst(rightId)) throw new Exception();
28 | MethodData function= (MethodData) ModuleLibrary.FindFunctions(rightVariable, IsIncrement?"op_PostIncrement":"op_PostDecrement");
29 | if(targetId==0) {
30 | context.EmitData(function.Index,targetId,rightId);
31 | context.Emit(function.InstructionId);
32 | return;
33 | }
34 | Span span = stackalloc ArgumentData[1];
35 | span[0] = new ArgumentData(rightId,ArgumentType.Ref);
36 | Validator.ValidateReturnAssignment(target, function,span,context);
37 | }
38 |
39 | public (ushort id,object obj) Compile( CompilingContext context) {
40 | var (rightId,rightVariable) = context.Get(Identifier);
41 | if ( context.IsConst(rightId)) throw new Exception();
42 | MethodData function= (MethodData) ModuleLibrary.FindFunctions(rightVariable, IsIncrement?"op_PostIncrement":"op_PostDecrement");
43 | Span span = stackalloc ArgumentData[1];
44 | span[0] = new ArgumentData(rightId,ArgumentType.Ref);
45 | return Validator.GetReturnId(function,span,context);
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/PostIncrementDecrementExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: decf56479a584b2d80c88f76491b7d62
3 | timeCreated: 1674776262
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/PreIncrementDecrementExpression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using YS.Collections;
4 | using YS.Lexer;
5 | using YS.Modules;
6 | using YS.Instructions;
7 | using YS.VM;
8 | using YS.Text;
9 | namespace YS.AST.Expressions {
10 | public class PreIncrementDecrementExpression:IExpression {
11 | public bool IsIncrement;
12 | public StringSegment Identifier;
13 |
14 | public PreIncrementDecrementExpression(bool isIncrement,StringSegment identifier) {
15 | IsIncrement = isIncrement;
16 | Identifier = identifier;
17 | }
18 | public void ToCode(StringBuilder builder) {
19 | builder.Append('(');
20 | builder.Append(IsIncrement ? "++" : "--");
21 | builder.Append(Identifier.AsSpan());
22 | builder.Append(')');
23 | }
24 |
25 | public void Compile((ushort id,Variable variable) target, CompilingContext context) {
26 | var (rightId,rightVariable) = context.Get(Identifier);
27 | var (targetId, targetVariable) = target;
28 | if ( context.IsConst(rightId)) throw new Exception();
29 | MethodData function= (MethodData) ModuleLibrary.FindFunctions(rightVariable, IsIncrement?"op_Increment":"op_Decrement");
30 | if(targetId==0) {
31 | context.EmitData(function.Index,targetId,rightId);
32 | context.Emit(function.InstructionId);
33 | return;
34 | }
35 | Span span = stackalloc ArgumentData[1];
36 | span[0] = new ArgumentData(rightId,ArgumentType.Ref);
37 | Validator.ValidateReturnAssignment(target, function,span,context);
38 | }
39 |
40 | public (ushort id,object obj) Compile( CompilingContext context) {
41 | var (rightId,rightVariable) = context.Get(Identifier);
42 | if ( context.IsConst(rightId)) throw new Exception();
43 | MethodData function= (MethodData) ModuleLibrary.FindFunctions(rightVariable, IsIncrement?"op_Increment":"op_Decrement");
44 | Span span = stackalloc ArgumentData[1];
45 | span[0] = new ArgumentData(rightId,ArgumentType.Ref);
46 | return Validator.GetReturnId(function,span,context);
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/PreIncrementDecrementExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d6d277e47a8f4800a0c4a7f4d9d31119
3 | timeCreated: 1674778725
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/RangeExpression.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fe1484605e9e54d498c6faf1bcece077
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/StringLiteral.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using System.Text.RegularExpressions;
3 | using YS.Lexer;
4 | using YS.VM;
5 |
6 | namespace YS.AST.Expressions {
7 | public class StringLiteral: IExpression {
8 | public string Value { get; set; }
9 |
10 | public StringLiteral(string value) {
11 | Value = value;
12 | }
13 | public void ToCode(StringBuilder builder) {
14 | builder.Append('"');
15 | builder.Append(Value);
16 | builder.Append('"');
17 | }
18 |
19 | public void Compile((ushort id,Variable variable) target, CompilingContext context){
20 | var (targetId, targetVariable) = target;
21 | if (targetVariable is Variable) {
22 | var src=context.AddVariable(new Variable(Value));
23 | context.EmitCopyObject(targetId,src);
24 | }else
25 | throw new System.NotImplementedException();
26 | }
27 |
28 | public (ushort id,object obj) Compile( CompilingContext context) {
29 | var variable = Value.Contains('\\')
30 | ? new Variable(Regex.Unescape(Value))
31 | : new Variable(Value);
32 | return (context.AddVariable(variable),variable);
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/StringLiteral.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a3547a9b9c97def4397ab3c35541b80c
3 | MonoImRefer:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Assets/YS/Runtime/AST/Expressions/TypeOfExpression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using YS.VM;
4 |
5 | namespace YS.AST.Expressions {
6 | public class TypeOfExpression:IExpression {
7 |
8 | public IType Type;
9 |
10 | public TypeOfExpression(IType type) {
11 | Type = type;
12 | }
13 | public void ToCode(StringBuilder builder) {
14 | builder.Append("typeof(");
15 | builder.Append(Type.ToString());
16 | builder.Append(")");
17 | }
18 |
19 | public void Compile((ushort id, Variable variable) target, CompilingContext context) {
20 | if (target.variable is Variable or Variable