daily update on 20240202 by nitload youmu, keep on writing xpreeess compiler

This commit is contained in:
Nitload
2025-02-02 23:59:05 +08:00
parent e687473132
commit 4ee675669f
483 changed files with 86314 additions and 2712 deletions
@@ -0,0 +1,74 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="AbstractSyntaxTree.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Collections;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script
{
public class AbstractSyntaxTree<TToken> where TToken: IExpressionToken
{
private bool _cacheAvailable;
private HashSet<TToken> _allToken = new();
private TToken _root;
public int Count
{
get
{
if( !_cacheAvailable ) {
MakeCache();
}
return _allToken.Count;
}
}
public TToken Root => _root;
public bool Contains( TToken node )
{
if( !_cacheAvailable ) {
MakeCache();
}
return _allToken.Contains( node );
}
public void MakeCache()
{
Root.TryGetNextLevel(out var nextLevel);
foreach( TToken node in nextLevel ) { }
}
}
}
@@ -0,0 +1,54 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="BuiltinType.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public sealed class ExpBuiltinType : ExpTypeSource
{
private Type _marshalType;
internal ExpBuiltinType( string name, Type origin )
: base( name, null! )
{
_marshalType = origin;
}
public override void Analyse()
{
return;
}
}
}
@@ -0,0 +1,177 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpCollection.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StgSharp.Script.Express
{
public abstract class ExpCollectionBase : IExpElementSource, IEnumerable<ExpElementInstanceBase>
{
protected internal string _accurateType;
protected ExpCollectionBase(
string accurateType )
{
_accurateType = accurateType;
}
public string MemberType
{
get => _accurateType;
}
public abstract int Count { get; }
public ExpElementType ElementType => ExpElementType.Collection;
IScriptSourceProvider IExpElementSource.SourceProvider => null!;
public abstract string Name { get; }
public void Analyse()
{
return;
}
public abstract IEnumerator<ExpElementInstanceBase> GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
public class ExpArray : ExpCollectionBase
{
private ExpElementInstanceBase[] _collection;
public ExpArray( string accurateType )
: base( accurateType ) { }
public ExpElementInstanceBase this[ int index ]
{
get { return _collection[ index ]; }
set
{
if( value.TypeName != MemberType ) {
throw new ExpInvalidCollectionMemberTypeException(
value, this );
}
_collection[ index ] = value;
}
}
public override int Count => _collection.Length;
public override string Name => ExpCompile.AddOrGetString("ARRAY");
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
{
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
.GetEnumerator( );
}
}
public class ExpBag : ExpCollectionBase
{
private ConcurrentBag<ExpElementInstanceBase> _collection = new ConcurrentBag<ExpElementInstanceBase>(
);
public ExpBag( string accurateType )
: base( accurateType ) { }
public override int Count => _collection.Count;
public override string Name => ExpCompile.AddOrGetString("BAG");
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
{
return _collection.GetEnumerator();
}
}
public sealed class ExpList : ExpCollectionBase
{
public ExpList(string accurateType ):base(accurateType)
{
}
private List<ExpElementInstanceBase> _collection = new List<ExpElementInstanceBase>();
public override int Count => _collection.Count;
public override string Name => ExpCompile.AddOrGetString("LIST");
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
{
return _collection.GetEnumerator();
}
}
public class ExpSet : ExpCollectionBase
{
private HashSet<ExpElementInstanceBase> _collection = new();
public ExpSet( string accurateType )
: base( accurateType ) { }
public void Add( ExpElementInstanceBase token )
{
if( token.TypeName != MemberType ) {
throw new ExpInvalidCollectionMemberTypeException( token,
this );
}
_collection.Add( token );
}
public override int Count => _collection.Count;
public override string Name => ExpCompile.AddOrGetString("SET");
public override sealed IEnumerator<ExpElementInstanceBase> GetEnumerator()
{
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
.GetEnumerator( );
}
}
}
@@ -0,0 +1,124 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpCollectionInstance.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public abstract class ExpCollectionInstanceBase : ExpToken
{
protected internal (int min, int max) _range;
protected internal ExpElementType _memberType;
protected ExpCollectionInstanceBase( string name, ExpSchema context )
: base( name, context ) { }
public abstract ExpCollectionBase CollectionValue
{
get;
}
public ExpElementType MemberType
{
get => _memberType;
}
public int MinCapacity => _range.min;
public int MaxCapacity => _range.max;
}
public sealed class ExpSetInstance : ExpCollectionInstanceBase
{
private ExpSet _collection;
public ExpSetInstance( string name, ExpSet set, ExpSchema context )
: base( name, context )
{
_collection = set;
}
public override ExpCollectionBase CollectionValue => _collection;
}
public sealed class ExpBagInstance : ExpCollectionInstanceBase
{
private ExpBag _collection;
public ExpBagInstance( string name, ExpBag bag, ExpSchema context )
: base( name, context )
{
_collection = bag;
}
public override ExpCollectionBase CollectionValue => _collection;
}
public sealed class ExpListInstance : ExpCollectionInstanceBase
{
private ExpList _collection;
public ExpListInstance( string name, ExpList list, ExpSchema context )
: base( name, context )
{
_collection = list;
}
public override ExpCollectionBase CollectionValue => _collection;
}
public sealed class ExpArrayInstance : ExpCollectionInstanceBase
{
private ExpArray _collection;
public ExpArrayInstance(
string name,
ExpArray array,
ExpSchema context )
: base( name, context )
{
_collection = array;
}
public override ExpCollectionBase CollectionValue => _collection;
}
}
@@ -0,0 +1,52 @@
using StgSharp.Script.Express;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public sealed class ExpIfToken : ExpToken
{
private ExpToken _rule;
private List<ExpToken> _trueOp;
private List<ExpToken> _falseOp;
public ExpIfToken(string name, ExpSchema context, ExpToken rule,
IEnumerable<ExpToken> operationIfTrue,
IEnumerable<ExpToken> operationIfFalse):
base(name,context)
{
_rule = rule;
if (operationIfFalse == null)
{
_trueOp = new List<ExpToken>();
}
else
{
_trueOp = new List<ExpToken>(operationIfFalse);
}
if (operationIfFalse == null)
{
_falseOp = new List<ExpToken>();
}
else
{
_falseOp = new List<ExpToken>(operationIfFalse);
}
}
public void AddTrueOperation(ExpToken expressionRoot)
{
AssertSchemaInclude(expressionRoot);
_trueOp.Add(expressionRoot);
}
public void AddFalseOperation(ExpToken expressionRoot)
{
AssertSchemaInclude(expressionRoot);
_falseOp.Add(expressionRoot);
}
}
}
@@ -0,0 +1,97 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpLiteralToken.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpLiteralToken<T> : ExpElementInstanceBase
{
private readonly ExpBuiltinType _type;
private readonly T _value;
public ExpLiteralToken( string name, ExpSchema context, T value )
: base( name, context )
{
_value = value;
switch( value ) {
case float f:
ExpCompile.TryGetBuiltinType(
ExpCompile.KeyWord.Real, out ExpTypeSource? type );
_type = ( type as ExpBuiltinType )!;
_tokenType = ExpTokenFlag.BuiltinType_Float | ExpTokenFlag.Element_Const;
break;
case int i:
ExpCompile.TryGetBuiltinType(
ExpCompile.KeyWord.Int, out type );
_type = ( type as ExpBuiltinType )!;
_tokenType = ExpTokenFlag.BuiltinType_Int | ExpTokenFlag.Element_Const;
break;
case BitArray b:
ExpCompile.TryGetBuiltinType(
ExpCompile.KeyWord.Binary, out type );
_type = ( type as ExpBuiltinType )!;
_tokenType = ExpTokenFlag.BuiltinType_Binary | ExpTokenFlag.Element_Const;
break;
case string s:
ExpCompile.TryGetBuiltinType(
ExpCompile.KeyWord.String, out type );
_type = ( type as ExpBuiltinType )!;
_tokenType = ExpTokenFlag.BuiltinType_Int | ExpTokenFlag.Element_Const;
break;
case Logic l:
ExpCompile.TryGetBuiltinType(
ExpCompile.KeyWord.Logic, out type );
_type = ( type as ExpBuiltinType )!;
_tokenType = ExpTokenFlag.BuiltinType_Int | ExpTokenFlag.Element_Const;
break;
default:
throw new ExpInvalidTypeException(
"Builtin Type", value!.GetType().Name );
}
}
public T value => _value;
public override string TypeName => _type.Name;
public override bool TryGetNextLevel(
out ICollection<IExpressionToken> nextLevel )
{
nextLevel = null!;
return false;
}
}
}
@@ -0,0 +1,97 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpRepeat.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpRepeat : ExpToken
{
public ExpRepeat( string name, ExpSchema context )
: base( name, context ) { }
}
public class ExpRepeatRule : ExpToken
{
private List<ExpToken> _token = new List<ExpToken>();
private ExpElementInstanceBase _variable, _begin, _end, _increment;
public ExpRepeatRule(
string name,
ExpSchema context,
IEnumerable<ExpToken> operation,
ExpElementInstanceBase variable,
ExpElementInstanceBase begin,
ExpElementInstanceBase end,
ExpElementInstanceBase increment )
: base( name, context )
{
if( variable.TokenTypeCode != begin.TokenTypeCode || begin.TokenTypeCode !=
end.TokenTypeCode || ( increment != null && end.TokenTypeCode !=
increment.TokenTypeCode ) ) {
throw new InvalidCastException();
}
if( increment == null ) {
switch( ( ExpTokenFlag )variable.TokenTypeCode | ExpTokenFlag.BuiltinType_Any ) {
case ExpTokenFlag.BuiltinType_Float:
increment = new ExpLiteralToken<float>(
$"{name}_defaultincrement", context, 1.0f );
break;
case ExpTokenFlag.BuiltinType_Int:
increment = new ExpLiteralToken<int>(
$"{name}_defaultincrement", context, 1 );
break;
default:
throw new ExpInvalidTypeException(
"Int or Real", "otherwise" );
}
}
_begin = begin;
_variable = variable;
_end = end;
_increment = increment;
_tokenType = ExpTokenFlag.Branch_Repeat;
}
public override bool TryGetNextLevel(
out ICollection<IExpressionToken> nextLevel )
{
nextLevel = ( _token.ToList() as ICollection<IExpressionToken> )!;
return true;
}
}
}
@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpSwitchToken : ExpToken
{
private ExpToken _target;
private List<ExpToken> _default;
private Dictionary<ExpToken, List<ExpToken>> _cases;
public List<ExpToken> this[ExpToken index]
{
get
{
if (_cases.TryGetValue(index, out var ret))
{
return ret;
}
return _default;
}
}
public ExpSwitchToken(string name, ExpSchema context,
ExpToken target, IEnumerable<ExpToken> @default ,
params (ExpToken label, IEnumerable<ExpToken> op)[] cases
) : base(name, context)
{
_target = target;
if (@default == null)
{
_default = new List<ExpToken>();
}
else
{
_default = new List<ExpToken>(@default);
}
_cases = new Dictionary<ExpToken, List<ExpToken>>();
foreach (var item in cases)
{
if (item.op == null)
{
_cases.Add(item.label, new List<ExpToken>());
}
else
{
_cases.Add(item.label, new List<ExpToken>(item.op));
}
}
}
public bool ContainsCase(ExpToken token)
{
return _cases.ContainsKey(token);
}
/// <summary>
/// Adds an expression to certain <see langword="case"/>.
/// The added expression will be run at last.
/// </summary>
/// <param name="label">Label of case to add operation</param>
/// <param name="expressionRoot">Root token of the expression to be added.</param>
/// <exception cref="ExpCaseNotFoundException">Cannot fine the case label in current witch expression.</exception>
public void AddOperationToCase(ExpToken label, ExpToken expressionRoot)
{
AssertSchemaInclude(expressionRoot);
if (_cases.TryGetValue(label,out var op))
{
op.Add(expressionRoot);
}
else
{
throw new ExpCaseNotFoundException(this, label);
}
}
public void AddOperationToDefault(ExpToken expressionRoot)
{
if (expressionRoot != null)
{
_default.Add(expressionRoot);
}
}
}
}
@@ -0,0 +1,81 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpConst.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpConstantCollectionSource : IExpImmutableElement
{
private IScriptSourceProvider _sourceProvider;
private string _name;
private Dictionary<string, ExpElementInstanceBase> _constants;
public ExpConstantCollectionSource(
string name,
IScriptSourceProvider sourceProvider )
{
_name = name;
_sourceProvider = sourceProvider;
_constants = new Dictionary<string, ExpElementInstanceBase>(
ExpCompile.Multiplexer);
}
internal void AddConstant(string name, ExpElementInstanceBase value)
{
_constants.Add(name, value);
}
public ExpElementType ElementType => ExpElementType.Const;
public IScriptSourceProvider SourceProvider => _sourceProvider;
public static Dictionary<string, ExpConstantCollectionSource> BuiltinConst => ExpCompile.BuiltinConst;
public string Name
{
get => _name;
}
public virtual void Analyse()
{
throw new NotImplementedException();
}
public ExpToken MakeReference(params object[] options)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,76 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpEntity.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpEntity : ExpToken
{
public ExpEntity( string name ,ExpSchema context):
base(name, context)
{
}
}
public class ExpEntitySource : IExpInstantiableElement
{
private ExpExpressionTree _expressionTree;
private ScriptSourceTransmitter _source;
private string _name;
public ExpEntitySource( string name, ScriptSourceTransmitter provider )
{
_name = name;
_source = provider;
}
public ExpElementType ElementType => ExpElementType.Entity;
public IScriptSourceProvider SourceProvider => _source;
public string Name => _name;
public void Analyse()
{
throw new NotImplementedException();
}
public ExpToken CreateInstanceToken()
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,83 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpFunction.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpFunction : ExpToken
{
private ExpFunctionSource _source;
private readonly ExpToken _return;
private readonly List<KeyValuePair<string, ExpToken>> _parameterList
= new List<KeyValuePair<string, ExpToken>>();
public ExpFunction(string name, ExpSchema context) : base(name, context)
{ }
public ExpElementType ElementType => ExpElementType.Function;
public void CallThisFunction( params ExpToken[] parameters ) { }
}
public class ExpFunctionSource : IExpImmutableElement
{
private ScriptSourceTransmitter _transmitter;
private string _name;
public ExpFunctionSource(
string name,
ScriptSourceTransmitter transmitter )
{
_name = name;
_transmitter = transmitter;
}
public ExpElementType ElementType => ExpElementType.Function;
public IScriptSourceProvider SourceProvider => _transmitter;
public string Name => _name;
public void Analyse()
{
throw new NotImplementedException();
}
public ExpToken MakeReference(params object[] options)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,79 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpRule.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpRule : ExpElementInstanceBase
{
private ExpRuleSource _source;
public ExpRule(string name, ExpSchema context) : base(name,context)
{
}
public object? value => throw new NotImplementedException();
public override string TypeName => _source.Name;
}
public class ExpRuleSource : IExpImmutableElement
{
private ScriptSourceTransmitter _transmitter;
private string _name;
public ExpRuleSource( string name, ScriptSourceTransmitter transmitter )
{
_name = name;
_transmitter = transmitter;
}
public ExpElementType ElementType => ExpElementType.Rule;
public IScriptSourceProvider SourceProvider => _transmitter;
public string Name => _name;
public void Analyse()
{
throw new NotImplementedException();
}
public ExpToken MakeReference(params object[] options)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,74 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpType.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the ¡°Software¡±), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED ¡°AS IS¡±,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Script;
using System;
using System.Collections.Generic;
namespace StgSharp.Script.Express
{
public class ExpType : ExpElementInstanceBase
{
public override string TypeName => throw new NotImplementedException();
public ExpType(string name, ExpSchema context) : base(name, context)
{
}
}
public class ExpTypeSource : IExpElementSource
{
private ScriptSourceTransmitter _transmitter;
private string _name;
public ExpTypeSource( string name, ScriptSourceTransmitter transmitter )
{
_name = name;
_transmitter = transmitter;
}
public ExpElementType ElementType => ExpElementType.Type;
public IScriptSourceProvider SourceProvider => _transmitter;
public string Name => _name;
public virtual void Analyse()
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,116 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Exceptions.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpCompileNotInitializedException : InvalidOperationException
{
public ExpCompileNotInitializedException()
: base(
"Attempt to compile an EXPRESS script before the init of compiler." ) { }
}
public class ExpInvalidTypeDeclareEndingExceptions : Exception
{
public ExpInvalidTypeDeclareEndingExceptions(
string declaredName,
string endedName )
: base(
$"The datatype is declared with name {declaredName} " +
$"but ended with {endedName}" ) { }
}
public class ExpInvalidElementNameException : Exception
{
public ExpInvalidElementNameException(
string elementName,
ExpSchema schema )
: base(
$"Cannot find any element named {elementName} in {schema.Name}" ) { }
}
public class ExpInvalidTypeException : InvalidCastException
{
public ExpInvalidTypeException( string required, string provided )
: base(
$"Type {required} is required at position, but a {provided} instance is provided." ) { }
}
public class ExpInvalidCollectionMemberTypeException : InvalidCastException
{
public ExpInvalidCollectionMemberTypeException(
ExpElementInstanceBase elementInstance,
ExpCollectionBase collection )
: base(
$"Attempt to add or remove an element of type: {elementInstance.ElementType} " + $"from a collection collects {collection.MemberType}" ) { }
}
public class ExpInvalidSchemaIncludeException : InvalidOperationException
{
public ExpInvalidSchemaIncludeException(
ExpSchema context,
ExpSchema source )
: base(
$"Attempted to reference an EXPRESS language expression in the current schema context '{context.Name}', " + $"but this expression comes from another schema '{source.Name}' that has not been included." ) { }
}
public class ExpCaseNotFoundException : ArgumentOutOfRangeException
{
public ExpCaseNotFoundException( ExpSwitchToken token, ExpToken label )
: base(
$"Attempt to read or write the label {label.Name} not exist in " + $"SWITCH expression {token.Name}" ) { }
}
public class ExpTypeNotFoundException : Exception
{
public ExpTypeNotFoundException( string typeName, ExpSchema context )
: base(
$"Cannot find the type {typeName} in schema {context.Name} and " + $"its included schemas" ) { }
}
}
@@ -0,0 +1,121 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpInit.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using CommunityToolkit.HighPerformance.Buffers;
using StgSharp.Collections;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
namespace StgSharp.Script.Express
{
public static partial class ExpCompile
{
private static ConcurrentStringHashMultiplexer _multiplexer;
private static Dictionary<string, ExpConstantCollectionSource> _builtinConst;
private static Dictionary<string, ExpTypeSource> _builtinType;
private static StringPool _compileStringCache;
public static Dictionary<string, ExpConstantCollectionSource> BuiltinConst => _builtinConst;
public static string AddOrGetString( string str )
{
return _compileStringCache.GetOrAdd( str );
}
public static void ClearStringCache()
{
_compileStringCache.Reset();
}
public static bool TryGetBuiltinType(string typename, out ExpTypeSource typeSource)
{
return _builtinType.TryGetValue( typename, out typeSource );
}
public static bool TryGetBuiltinConst(string constName, out ExpConstantCollectionSource source)
{
return _builtinConst.TryGetValue(constName, out source);
}
internal static ConcurrentStringHashMultiplexer Multiplexer
{
get
{
if (_multiplexer == null)
{
throw new ExpCompileNotInitializedException();
}
return _multiplexer;
}
}
public static void InitCompile()
{
_compileStringCache = new StringPool();
_multiplexer = new ConcurrentStringHashMultiplexer();
_builtinConst = new Dictionary<string, ExpConstantCollectionSource>(_multiplexer){
{ AddOrGetString( "PI" ), new ExpBuiltinConst<float>(
AddOrGetString( "PI" ), MathF.PI ) },
{ AddOrGetString( "E" ), new ExpBuiltinConst<float>(
AddOrGetString( "E" ), MathF.E ) },
};
//TODO keep on here
_builtinType = new Dictionary<string, ExpTypeSource>(_multiplexer){
{ AddOrGetString( KeyWord.Int ), new ExpBuiltinType(
AddOrGetString( KeyWord.Int ), typeof( int ) ) },
{ AddOrGetString( KeyWord.Real ), new ExpBuiltinType(
AddOrGetString( KeyWord.Real ), typeof( float ) ) },
{ AddOrGetString( KeyWord.Bool ), new ExpBuiltinType(
AddOrGetString( KeyWord.Bool ), typeof( bool ) ) },
{ AddOrGetString( KeyWord.Binary ), new ExpBuiltinType(
AddOrGetString( KeyWord.Binary ), typeof( bool ) ) },
{ AddOrGetString( KeyWord.String ), new ExpBuiltinType(
AddOrGetString( KeyWord.String ), typeof( string ) ) },
{ AddOrGetString(KeyWord.Logic),new ExpBuiltinType(
AddOrGetString(KeyWord.Logic), typeof(Logic)) }
};
}
public static class KeyWord
{
public const string Int = "INTAGER",
Real = "REAL",
Bool = "BOOLEAN",
String = "STRING",
Logic = "LOGIC",
Binary = "BINARY";
}
}
}
@@ -0,0 +1,106 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpElementInstanceBase.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace StgSharp.Script.Express
{
[Flags]
public enum ExpElementType : int
{
Const = 0,
Entity = 1,
Type = 2,
Function = 4,
Section = 8,
Expression = 16,
Rule = 32,
Procedure = 64,
Collection = 128 | Type,
}
public abstract class ExpElementInstanceBase : ExpToken
{
protected ExpElementInstanceBase( string name, ExpSchema context )
: base( name, context ) { }
public ExpElementType ElementType
{
get;
}
public abstract string TypeName
{
get;
}
}
public interface IExpElementSource
{
public ExpElementType ElementType
{
get;
}
IScriptSourceProvider SourceProvider
{
get;
}
string Name
{
get;
}
public void Analyse();
}
public interface IExpInstantiableElement : IExpElementSource
{
public abstract ExpToken CreateInstanceToken();
}
public interface IExpImmutableElement : IExpElementSource
{
public abstract ExpToken MakeReference(params object[] options);
}
}
@@ -0,0 +1,44 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpExpressionTree.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpExpressionTree : AbstractSyntaxTree<ExpToken>
{
public ExpToken RootToken { get; private set; }
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public enum Logic
{
Unknown = 0,
False = 1,
True = 2,
}
}
@@ -0,0 +1,111 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpReader.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.MemoryMappedFiles;
using System.Text;
using System.Threading;
namespace StgSharp.Script.Express
{
public class ExpFileReader : IDisposable, IScriptSourceProvider
{
private bool disposedValue;
private FileStream _expFileStream;
private int _location;
private MemoryMappedFile _expMemoryMappedFile;
private MemoryMappedViewStream _expMemoryMappedStream;
private SemaphoreSlim readLineSemaphore = new SemaphoreSlim( 1, 1 );
private StreamReader _memoryReader;
public ExpFileReader( string path )
{
if( !File.Exists( path ) ) {
throw new FileNotFoundException();
}
_expFileStream = new FileStream(
path, FileMode.Open, FileAccess.Read );
_expMemoryMappedFile = MemoryMappedFile.CreateFromFile(
_expFileStream, null, 0, MemoryMappedFileAccess.Read,
HandleInheritability.None, true );
_expMemoryMappedStream = _expMemoryMappedFile.CreateViewStream(
offset: 0, size: 0, access: MemoryMappedFileAccess.Read );
_memoryReader = new StreamReader( _expMemoryMappedStream );
}
public int Location => _location;
// ~ExpFileReader()
// {
// Dispose(disposing: false);
// }
public void Dispose()
{
Dispose( disposing: true );
GC.SuppressFinalize( this );
}
public string ReadLine()
{
readLineSemaphore.Wait();
string line = _memoryReader.ReadLine();
_location++;
readLineSemaphore.Release();
return line;
}
public void ResetToBegin()
{
readLineSemaphore.Wait();
_expMemoryMappedStream.Seek( 0, SeekOrigin.Begin );
_location = 0;
readLineSemaphore.Release();
}
protected virtual void Dispose( bool disposing )
{
if( !disposedValue ) {
if( disposing ) {
_expFileStream.Dispose();
_expMemoryMappedFile.Dispose();
_expMemoryMappedStream.Dispose();
_memoryReader.Dispose();
}
disposedValue = true;
}
}
}
}
@@ -0,0 +1,105 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpSchema.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Collections;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
public class ExpSchema
{
private readonly ConcurrentStringHashMultiplexer _multiplexer = ExpCompile.Multiplexer;
private Dictionary<string, ExpConstantCollectionSource> _constDict;
private Dictionary<string, ExpEntitySource> _entityDict;
private Dictionary<string, ExpFunctionSource> _functionDict;
private Dictionary<string, ExpRuleSource> _ruleDict;
private Dictionary<string, ExpSchema> _schemaInclude;
private Dictionary<string, ExpTypeSource> _typeDict;
public ExpSchema()
{
_constDict = new Dictionary<string, ExpConstantCollectionSource>(ExpCompile.Multiplexer);
_entityDict = new Dictionary<string, ExpEntitySource>(ExpCompile.Multiplexer);
_functionDict = new Dictionary<string, ExpFunctionSource>(ExpCompile.Multiplexer);
_ruleDict = new Dictionary<string, ExpRuleSource>(ExpCompile.Multiplexer);
_schemaInclude = new Dictionary<string, ExpSchema>(ExpCompile.Multiplexer);
_typeDict = new Dictionary<string, ExpTypeSource>(ExpCompile.Multiplexer);
}
public string Name
{
get;
internal set;
}
public ExpTypeSource GetExpType( string typeName )
{
if( ExpCompile.TryGetBuiltinType(
typeName, out ExpTypeSource? ret ) ) {
return ret;
}
if( _typeDict.TryGetValue( typeName, out ret ) ) {
return ret;
}
foreach( ExpSchema item in _schemaInclude.Values ) {
if( item._typeDict.TryGetValue( typeName, out ret ) ) {
return ret;
}
}
throw new ExpTypeNotFoundException( typeName, this );
}
public bool HasSchemaInclude( ExpSchema schema )
{
return _schemaInclude.ContainsKey( schema.Name );
}
public bool TryGetConst(string name, out ExpElementInstanceBase constInstance)
{
if (ExpCompile.BuiltinConst.TryGetValue(name, out constInstance))
{
}
}
public ExpToken SearchConstDeclare( string typeName )
{
ExpToken constant;
foreach (var item in ExpCompile.BuiltinConst.Values)
{
}
throw new KeyNotFoundException();
}
}
}
@@ -0,0 +1,320 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpSchema.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Collections;
using StgSharp.Graphics.OpenGL;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Tracing;
using System.Text;
using System.Text.RegularExpressions;
namespace StgSharp.Script.Express
{
public class ExpSchemaSource
{
private static Regex
_constDefineBegin = new Regex(
@"\s*CONSTANT", RegexOptions.Compiled ),
_constDefineEnd = new Regex(
@"\s*END_CONSTANT;", RegexOptions.Compiled ),
_schemaBegin = new Regex(
@"\s*SCHEMA\s*(?<namespace>[A-Za-z0-9_]+)\s?;",
RegexOptions.Compiled ),
_schemaEnd = new Regex(
@"END_SCHEMA;\s*--\s*(?<namespace>[A-Za-z0-9_]+)",
RegexOptions.Compiled ),
_entityDefineBegin = new Regex(
@"\s*ENTITY\s*(?<TypeName>[A-Za-z0-9_]+)\s*", RegexOptions.Compiled ),
_entityDefineEnd = new Regex(
@"\s*END_ENTITY;\s*--\s*(?<TypeName>[A-Za-z0-9_]+)\s*",
RegexOptions.Compiled ),
_typeDefineBegin = new Regex(
@"\s*TYPE\s+(?<TypeName>[A-Za-z0-9_]+)\s*=\s*(?<Remaining>[A-Z]+)",
RegexOptions.Compiled ),
_typeDefineEnd = new Regex(
@"\s*END_TYPE\s*;\s*--\s*(?<TypeName>[a-zA-Z0-9_]+)",
RegexOptions.Compiled ),
_functionDefineBegin = new Regex(
@"\s*FUNCTION\s*\s*(?<FunctionName>[a-zA-Z0-9_]+)\s*(?<Remaining>.*)",
RegexOptions.Compiled ),
_functionDefineEnd = new Regex(
@"\s*END_FUNCTION\s*;\s*--\s*(?<FunctionName>[a-zA-Z0-9_]+)",
RegexOptions.Compiled ),
_ruleDefineBegin = new Regex(
@"\s*RULE\s*(?<RuleName>[a-zA-Z0-9_]+)\s*FOR\s*\((?<Target>[a-zA-Z0-9_]*(\s*\)\s*;)?)",
RegexOptions.Compiled ),
_ruleDefineEnd = new Regex(
@"\s*END_RULE\s*;\s*--\s*(?<RuleName>[A-Za-z0-9_]+)",
RegexOptions.Compiled );
private Dictionary<string, IExpElementSource> _sourceCache = new();
private readonly ExpSchema _compileResult = new ExpSchema();
private string name;
public string Name
{
get => _compileResult.Name;
internal set => _compileResult.Name = value;
}
public ExpSchemaSource() { }
public void ReadSchema( ExpFileReader reader )
{
string line = reader.ReadLine();
while( !_schemaBegin.IsMatch( line ) ) {
line = reader.ReadLine();
}
name = _schemaBegin.Match( line ).Groups[ "namespace" ].Value;
while( !_schemaEnd.IsMatch( line ) ) {
if( TryReadConst( line, reader,
out IExpElementSource source ) ) {
_sourceCache.Add( source.Name, source );
} else if( TryReadType( line, reader, out source ) ) {
_sourceCache.Add( source.Name, source );
} else if( TryReadEntity( line, reader, out source ) ) {
_sourceCache.Add( source.Name, source );
} else if( TryReadRule( line, reader, out source ) ) {
_sourceCache.Add( source.Name, source );
} else if( TryReadFunction( line, reader, out source ) ) {
_sourceCache.Add( source.Name, source );
}
line = reader.ReadLine();
}
}
public static bool TryReadSchema(
string firstLine,
ExpFileReader reader,
out ExpSchemaSource source )
{
if( !_schemaBegin.IsMatch( firstLine ) ) {
source = null!;
return false;
}
ExpSchemaSource _source = new ExpSchemaSource();
_source.name = _schemaBegin.Match( firstLine ).Groups[ "namespace" ].Value;
while( !_schemaEnd.IsMatch( firstLine ) ) {
if( _source.TryReadConst(
firstLine, reader,
out IExpElementSource _elementSource ) ) {
_source._sourceCache
.Add( _elementSource.Name, _elementSource );
} else if( _source.TryReadType(
firstLine, reader, out _elementSource ) ) {
_source._sourceCache
.Add( _elementSource.Name, _elementSource );
} else if( _source.TryReadEntity(
firstLine, reader, out _elementSource ) ) {
_source._sourceCache
.Add( _elementSource.Name, _elementSource );
} else if( _source.TryReadRule(
firstLine, reader, out _elementSource ) ) {
_source._sourceCache
.Add( _elementSource.Name, _elementSource );
} else if( _source.TryReadFunction(
firstLine, reader, out _elementSource ) ) {
_source._sourceCache
.Add( _elementSource.Name, _elementSource );
}
firstLine = reader.ReadLine();
}
source = _source;
return true;
}
private bool TryReadConst(
string firstLine,
ExpFileReader reader,
out IExpElementSource source )
{
Match match = _constDefineBegin.Match( firstLine );
if( match.Success ) {
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
"END_CONSTANT" );
ExpConstantCollectionSource _source = new ExpConstantCollectionSource(
"Constant", transmitter );
string line = reader.ReadLine();
while( !_constDefineEnd.IsMatch( line ) ) {
transmitter.WriteLine( line );
line = reader.ReadLine();
}
transmitter.WriteLine( "END_CONSTANT" );
source = _source;
return true;
}
source = null!;
return false;
}
private bool TryReadEntity(
string firstLine,
ExpFileReader reader,
out IExpElementSource source )
{
Match match = _entityDefineBegin.Match( firstLine );
if( match.Success ) {
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
"END_ENTITY" );
ExpEntitySource _source = new ExpEntitySource(
match.Groups[ "TypeName" ].ToString(), transmitter );
string line = reader.ReadLine();
match = _entityDefineEnd.Match( line );
while( !match.Success ) {
transmitter.WriteLine( line );
line = reader.ReadLine();
match = _entityDefineEnd.Match( line );
}
string endedName = match.Groups[ "TypeName" ].ToString();
if( !string.Equals( endedName, _source.Name ) ) {
throw new ExpInvalidTypeDeclareEndingExceptions(
_source.Name, endedName );
}
transmitter.WriteLine( "END_ENTITY" );
source = _source;
return true;
}
source = null!;
return false;
}
private bool TryReadFunction(
string firstLine,
ExpFileReader reader,
out IExpElementSource source )
{
Match match = _functionDefineBegin.Match( firstLine );
if( match.Success ) {
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
"END_FUNCTION" );
ExpFunctionSource _source = new ExpFunctionSource(
match.Groups[ "FunctionName" ].ToString(), transmitter );
transmitter.WriteLine( match.Groups[ "Remaining" ].ToString() );
string line = reader.ReadLine();
match = _functionDefineEnd.Match( line );
while( !match.Success ) {
transmitter.WriteLine( line );
line = reader.ReadLine();
match = _functionDefineEnd.Match( line );
}
string endedName = match.Groups[ "FunctionName" ].ToString();
if( !string.Equals( endedName, _source.Name ) ) {
throw new ExpInvalidTypeDeclareEndingExceptions(
_source.Name, endedName );
}
transmitter.WriteLine( "END_FUNCTION" );
source = _source;
return true;
}
source = null!;
return false;
}
private bool TryReadRule(
string firstLine,
ExpFileReader reader,
out IExpElementSource source )
{
Match match = _ruleDefineBegin.Match( firstLine );
if( match.Success ) {
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
"END_RULE" );
ExpRuleSource _source = new ExpRuleSource(
match.Groups[ "RuleName" ].ToString(), transmitter );
string target = match.Groups[ "Target" ].ToString();
if( !string.IsNullOrEmpty( target ) ) {
transmitter.WriteLine( target );
}
string line = reader.ReadLine();
match = _ruleDefineEnd.Match( line );
while( !match.Success ) {
transmitter.WriteLine( line );
line = reader.ReadLine();
match = _ruleDefineEnd.Match( line );
}
string endedName = match.Groups[ "RuleName" ].ToString();
if( !string.Equals( endedName, _source.Name ) ) {
throw new ExpInvalidTypeDeclareEndingExceptions(
_source.Name, endedName );
}
transmitter.WriteLine( "END_RULE" );
source = _source;
return true;
}
source = null!;
return false;
}
private bool TryReadType(
string firstLine,
ExpFileReader reader,
out IExpElementSource source )
{
Match match = _typeDefineBegin.Match( firstLine );
if( match.Success ) {
ScriptSourceTransmitter transmitter = new ScriptSourceTransmitter(
"END_ENTITY" );
ExpTypeSource _source = new ExpTypeSource(
match.Groups[ "TypeName" ].ToString(), transmitter );
transmitter.WriteLine( match.Groups[ "Remaining" ].ToString() );
string line = reader.ReadLine();
match = _typeDefineEnd.Match( line );
while( !match.Success ) {
transmitter.WriteLine( line );
line = reader.ReadLine();
match = _typeDefineEnd.Match( line );
}
string endedName = match.Groups[ "TypeName" ].ToString();
if( !string.Equals( endedName, _source.Name ) ) {
throw new ExpInvalidTypeDeclareEndingExceptions(
_source.Name, endedName );
}
transmitter.WriteLine( "END_ENTITY" );
source = _source;
return true;
}
source = null!;
return false;
}
}
}
@@ -0,0 +1,112 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ExpToken.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using CommunityToolkit.HighPerformance.Buffers;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script.Express
{
[Flags]
public enum ExpTokenFlag : long
{
None = 0,
Name_Element = 1,
Name_Param = 2,
Name_Block=4,
Name_Keyword=8,
Name_Any = Name_Block | Name_Element | Name_Keyword | Name_Param,
Collection_Set=16,
Collection_Bag=32,
Collection_Array=64,
Collection_List=128,
Collection_Any = Collection_Set | Collection_Bag | Collection_Array | Collection_List,
Element_Const=256,
Element_Entity=512,
Element_type=1024,
Element_Rule=2048,
Element_Function=4096,
Element_Any = Element_Entity | Element_Const | Element_Function | Element_Rule | Element_type,
BuiltinType_Int=8192,
BuiltinType_Float=16384,
BuiltinType_String=32768,
BuiltinType_Boolean=65536,
BuiltinType_Binary=0x2000,
BuiltinType_Logic=0x4000,
BuiltinType_Any = BuiltinType_Int | BuiltinType_Float | BuiltinType_String | BuiltinType_Boolean | BuiltinType_Binary | BuiltinType_Logic,
Branch_If = 0x8000,
Branch_Switch = 0x1_0000,
Branch_Repeat = 0x2_0000,
}
public abstract class ExpToken : IExpressionToken
{
protected internal ExpToken _previousToken;
protected internal ExpTokenFlag _tokenType;
protected internal List<ExpToken> _nextLevelTokens = new List<ExpToken>(
);
protected internal string _name;
protected ExpToken( string name, ExpSchema context )
{
_name = name;
Context = context;
}
public virtual bool TryGetNextLevel(out ICollection<IExpressionToken> nextLevel)
{
nextLevel = (_nextLevelTokens as ICollection<IExpressionToken>)!;
return true;
}
public long TokenTypeCode => ( long )_tokenType;
public string Name => _name;
public ExpSchema Context
{
get;
private set;
}
protected void AssertSchemaInclude(ExpToken expressionRoot)
{
if (expressionRoot.Context != Context &&
Context.HasSchemaInclude(expressionRoot.Context))
{
throw new ExpInvalidSchemaIncludeException(Context, expressionRoot.Context);
}
}
}
}
@@ -0,0 +1,54 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="IExpressionToken.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script
{
public interface IExpressionToken
{
long TokenTypeCode
{
get;
}
string Name
{
get;
}
bool TryGetNextLevel(out ICollection<IExpressionToken> nextLevel);
}
}
@@ -0,0 +1,48 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="IScriptSourceProvider.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script
{
public interface IScriptSourceProvider
{
int Location
{
get;
}
string ReadLine();
}
}
@@ -0,0 +1,73 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ScriptSourceTransmitter.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Script
{
public class ScriptSourceTransmitter : IScriptSourceProvider
{
private bool _isWriting = true;
private ConcurrentQueue<string> cache = new ConcurrentQueue<string>();
private int _location;
private readonly string _completeMark;
public ScriptSourceTransmitter( string endMark )
{
_completeMark = endMark;
}
public int Location => throw new NotImplementedException();
public string ReadLine()
{
cache.TryDequeue( out string line );
_location++;
return line;
}
public void WriteLine( string line )
{
if( !_isWriting ) {
return;
}
if( string.Equals( _completeMark, line ) ) {
_isWriting = false;
}
cache.Enqueue( line );
}
}
}
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StgSharp.Common\StgSharp.Common.csproj" />
</ItemGroup>
</Project>
@@ -0,0 +1,93 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.1/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.1": {},
".NETStandard,Version=v2.1/": {
"StgSharp.Script/1.0.0": {
"dependencies": {
"CommunityToolkit.HighPerformance": "8.4.0",
"StgSharp.Common": "1.0.0"
},
"runtime": {
"StgSharp.Script.dll": {}
}
},
"CommunityToolkit.HighPerformance/8.4.0": {
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.1.0"
},
"runtime": {
"lib/netstandard2.1/CommunityToolkit.HighPerformance.dll": {
"assemblyVersion": "8.4.0.0",
"fileVersion": "8.4.0.1"
}
}
},
"Microsoft.CSharp/4.7.0": {
"runtime": {
"lib/netstandard2.0/Microsoft.CSharp.dll": {
"assemblyVersion": "4.0.5.0",
"fileVersion": "4.700.19.56404"
}
}
},
"System.Runtime.CompilerServices.Unsafe/6.1.0": {
"runtime": {
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.100.24.56208"
}
}
},
"StgSharp.Common/1.0.0": {
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Runtime.CompilerServices.Unsafe": "6.1.0"
},
"runtime": {
"StgSharp.Common.dll": {
"assemblyVersion": "1.0.0",
"fileVersion": "1.0.0.0"
}
}
}
}
},
"libraries": {
"StgSharp.Script/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"CommunityToolkit.HighPerformance/8.4.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-flxspiBs0G/0GMp7IK2J2ijV9bTG6hEwFc/z6ekHqB6nwRJ4Ry2yLdx+TkbCUYFCl4XhABkAwomeKbT6zM2Zlg==",
"path": "communitytoolkit.highperformance/8.4.0",
"hashPath": "communitytoolkit.highperformance.8.4.0.nupkg.sha512"
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
"path": "microsoft.csharp/4.7.0",
"hashPath": "microsoft.csharp.4.7.0.nupkg.sha512"
},
"System.Runtime.CompilerServices.Unsafe/6.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg==",
"path": "system.runtime.compilerservices.unsafe/6.1.0",
"hashPath": "system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512"
},
"StgSharp.Common/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e687473132786f419a48170313782d6779890c3d")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e687473132786f419a48170313782d6779890c3d")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。
@@ -0,0 +1,150 @@
{
"format": 1,
"restore": {
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj": {}
},
"projects": {
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj",
"projectName": "StgSharp.Common",
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj",
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"D:\\Programmer\\NugetLocal": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"dependencies": {
"Microsoft.CSharp": {
"target": "Package",
"version": "[4.7.0, )"
},
"System.Runtime.CompilerServices.Unsafe": {
"target": "Package",
"version": "[6.1.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"NETStandard.Library": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400\\RuntimeIdentifierGraph.json"
}
}
},
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj",
"projectName": "StgSharp.Script",
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj",
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"D:\\Programmer\\NugetLocal": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"projectReferences": {
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": {
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"dependencies": {
"CommunityToolkit.HighPerformance": {
"target": "Package",
"version": "[8.4.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"NETStandard.Library": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400\\RuntimeIdentifierGraph.json"
}
}
}
}
}
@@ -0,0 +1,267 @@
{
"version": 3,
"targets": {
".NETStandard,Version=v2.1": {
"CommunityToolkit.HighPerformance/8.4.0": {
"type": "package",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.1.0"
},
"compile": {
"lib/netstandard2.1/CommunityToolkit.HighPerformance.dll": {
"related": ".pdb;.xml"
}
},
"runtime": {
"lib/netstandard2.1/CommunityToolkit.HighPerformance.dll": {
"related": ".pdb;.xml"
}
}
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"compile": {
"ref/netstandard2.0/Microsoft.CSharp.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/Microsoft.CSharp.dll": {
"related": ".xml"
}
}
},
"System.Runtime.CompilerServices.Unsafe/6.1.0": {
"type": "package",
"compile": {
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll": {
"related": ".xml"
}
}
},
"StgSharp.Common/1.0.0": {
"type": "project",
"framework": ".NETStandard,Version=v2.1",
"dependencies": {
"Microsoft.CSharp": "4.7.0",
"System.Runtime.CompilerServices.Unsafe": "6.1.0"
},
"compile": {
"bin/placeholder/StgSharp.Common.dll": {}
},
"runtime": {
"bin/placeholder/StgSharp.Common.dll": {}
}
}
}
},
"libraries": {
"CommunityToolkit.HighPerformance/8.4.0": {
"sha512": "flxspiBs0G/0GMp7IK2J2ijV9bTG6hEwFc/z6ekHqB6nwRJ4Ry2yLdx+TkbCUYFCl4XhABkAwomeKbT6zM2Zlg==",
"type": "package",
"path": "communitytoolkit.highperformance/8.4.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"License.md",
"ThirdPartyNotices.txt",
"communitytoolkit.highperformance.8.4.0.nupkg.sha512",
"communitytoolkit.highperformance.nuspec",
"lib/net7.0/CommunityToolkit.HighPerformance.dll",
"lib/net7.0/CommunityToolkit.HighPerformance.pdb",
"lib/net7.0/CommunityToolkit.HighPerformance.xml",
"lib/net8.0/CommunityToolkit.HighPerformance.dll",
"lib/net8.0/CommunityToolkit.HighPerformance.pdb",
"lib/net8.0/CommunityToolkit.HighPerformance.xml",
"lib/netstandard2.0/CommunityToolkit.HighPerformance.dll",
"lib/netstandard2.0/CommunityToolkit.HighPerformance.pdb",
"lib/netstandard2.0/CommunityToolkit.HighPerformance.xml",
"lib/netstandard2.1/CommunityToolkit.HighPerformance.dll",
"lib/netstandard2.1/CommunityToolkit.HighPerformance.pdb",
"lib/netstandard2.1/CommunityToolkit.HighPerformance.xml"
]
},
"Microsoft.CSharp/4.7.0": {
"sha512": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
"type": "package",
"path": "microsoft.csharp/4.7.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"lib/MonoAndroid10/_._",
"lib/MonoTouch10/_._",
"lib/net45/_._",
"lib/netcore50/Microsoft.CSharp.dll",
"lib/netcoreapp2.0/_._",
"lib/netstandard1.3/Microsoft.CSharp.dll",
"lib/netstandard2.0/Microsoft.CSharp.dll",
"lib/netstandard2.0/Microsoft.CSharp.xml",
"lib/portable-net45+win8+wp8+wpa81/_._",
"lib/uap10.0.16299/_._",
"lib/win8/_._",
"lib/wp80/_._",
"lib/wpa81/_._",
"lib/xamarinios10/_._",
"lib/xamarinmac20/_._",
"lib/xamarintvos10/_._",
"lib/xamarinwatchos10/_._",
"microsoft.csharp.4.7.0.nupkg.sha512",
"microsoft.csharp.nuspec",
"ref/MonoAndroid10/_._",
"ref/MonoTouch10/_._",
"ref/net45/_._",
"ref/netcore50/Microsoft.CSharp.dll",
"ref/netcore50/Microsoft.CSharp.xml",
"ref/netcore50/de/Microsoft.CSharp.xml",
"ref/netcore50/es/Microsoft.CSharp.xml",
"ref/netcore50/fr/Microsoft.CSharp.xml",
"ref/netcore50/it/Microsoft.CSharp.xml",
"ref/netcore50/ja/Microsoft.CSharp.xml",
"ref/netcore50/ko/Microsoft.CSharp.xml",
"ref/netcore50/ru/Microsoft.CSharp.xml",
"ref/netcore50/zh-hans/Microsoft.CSharp.xml",
"ref/netcore50/zh-hant/Microsoft.CSharp.xml",
"ref/netcoreapp2.0/_._",
"ref/netstandard1.0/Microsoft.CSharp.dll",
"ref/netstandard1.0/Microsoft.CSharp.xml",
"ref/netstandard1.0/de/Microsoft.CSharp.xml",
"ref/netstandard1.0/es/Microsoft.CSharp.xml",
"ref/netstandard1.0/fr/Microsoft.CSharp.xml",
"ref/netstandard1.0/it/Microsoft.CSharp.xml",
"ref/netstandard1.0/ja/Microsoft.CSharp.xml",
"ref/netstandard1.0/ko/Microsoft.CSharp.xml",
"ref/netstandard1.0/ru/Microsoft.CSharp.xml",
"ref/netstandard1.0/zh-hans/Microsoft.CSharp.xml",
"ref/netstandard1.0/zh-hant/Microsoft.CSharp.xml",
"ref/netstandard2.0/Microsoft.CSharp.dll",
"ref/netstandard2.0/Microsoft.CSharp.xml",
"ref/portable-net45+win8+wp8+wpa81/_._",
"ref/uap10.0.16299/_._",
"ref/win8/_._",
"ref/wp80/_._",
"ref/wpa81/_._",
"ref/xamarinios10/_._",
"ref/xamarinmac20/_._",
"ref/xamarintvos10/_._",
"ref/xamarinwatchos10/_._",
"useSharedDesignerContext.txt",
"version.txt"
]
},
"System.Runtime.CompilerServices.Unsafe/6.1.0": {
"sha512": "5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg==",
"type": "package",
"path": "system.runtime.compilerservices.unsafe/6.1.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"PACKAGE.md",
"buildTransitive/net461/System.Runtime.CompilerServices.Unsafe.targets",
"buildTransitive/net462/_._",
"buildTransitive/net6.0/_._",
"buildTransitive/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.targets",
"lib/net462/System.Runtime.CompilerServices.Unsafe.dll",
"lib/net462/System.Runtime.CompilerServices.Unsafe.xml",
"lib/net7.0/_._",
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll",
"lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml",
"system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512",
"system.runtime.compilerservices.unsafe.nuspec"
]
},
"StgSharp.Common/1.0.0": {
"type": "project",
"path": "../StgSharp.Common/StgSharp.Common.csproj",
"msbuildProject": "../StgSharp.Common/StgSharp.Common.csproj"
}
},
"projectFileDependencyGroups": {
".NETStandard,Version=v2.1": [
"CommunityToolkit.HighPerformance >= 8.4.0",
"StgSharp.Common >= 1.0.0"
]
},
"packageFolders": {
"C:\\Users\\Youmu\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj",
"projectName": "StgSharp.Script",
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj",
"packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\",
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"D:\\Programmer\\NugetLocal": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"projectReferences": {
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": {
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"dependencies": {
"CommunityToolkit.HighPerformance": {
"target": "Package",
"version": "[8.4.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"NETStandard.Library": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400\\RuntimeIdentifierGraph.json"
}
}
}
}
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e687473132786f419a48170313782d6779890c3d")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。
@@ -0,0 +1,15 @@
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\netstandard2.1\StgSharp.Script.deps.json
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\netstandard2.1\StgSharp.Script.dll
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\netstandard2.1\StgSharp.Script.pdb
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\netstandard2.1\StgSharp.Common.dll
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\netstandard2.1\StgSharp.Common.pdb
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\bin\x64\Debug\netstandard2.1\StgSharp.Common.xml
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\netstandard2.1\StgSharp.Script.csproj.AssemblyReference.cache
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\netstandard2.1\StgSharp.Script.GeneratedMSBuildEditorConfig.editorconfig
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\netstandard2.1\StgSharp.Script.AssemblyInfoInputs.cache
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\netstandard2.1\StgSharp.Script.AssemblyInfo.cs
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\netstandard2.1\StgSharp.Script.csproj.CoreCompileInputs.cache
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\netstandard2.1\StgSharp.Script.sourcelink.json
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\netstandard2.1\StgSharp.D39FE6B0.Up2Date
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\netstandard2.1\StgSharp.Script.dll
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Script\obj\x64\Debug\netstandard2.1\StgSharp.Script.pdb
@@ -0,0 +1 @@
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/e687473132786f419a48170313782d6779890c3d/*"}}
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e687473132786f419a48170313782d6779890c3d")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。