-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/feature/modules-init-1000' into …
…feature/modules-init-1000 # Conflicts: # src/ScriptEngine/Libraries/LibraryManager.cs # src/ScriptEngine/RuntimeEnvironment.cs
- Loading branch information
Showing
43 changed files
with
692 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM ubuntu:18.04 | ||
|
||
# MAINTAINER EvilBeaver <[email protected]> | ||
|
||
ENV LANG ru_RU.UTF-8 | ||
|
||
RUN apt update \ | ||
&& apt-get -y install locales tzdata \ | ||
&& locale-gen ru_RU && locale-gen ru_RU.UTF-8 \ | ||
&& update-locale LANG=ru_RU.UTF-8 \ | ||
&& apt install -y gnupg ca-certificates \ | ||
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \ | ||
&& sh -c 'echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" > /etc/apt/sources.list.d/mono-official-stable.list' \ | ||
&& apt-get update \ | ||
&& apt-get -y install mono-runtime binutils curl mono-devel ca-certificates-mono mono-vbnc referenceassemblies-pcl mono-fastcgi-server4 \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM evilbeaver/mono-ru:6.12 | ||
|
||
# Файл базируется на моно с русской локалью | ||
# Устанавливает через ovm версию движка | ||
|
||
LABEL MAINTAINER="EvilBeaver <[email protected]>" | ||
|
||
ARG VERSION=stable | ||
|
||
RUN curl -L https://github.com/oscript-library/ovm/releases/latest/download/ovm.exe > ovm.exe \ | ||
&& mono ovm.exe use --install $VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM evilbeaver/onescript:1.9.2 | ||
|
||
# Использует в качестве системы с ovm и mono образ onescript, создаваемый из файла Dockerfile_v1 (лежит рядом в репо) | ||
# Потом копирует бинари из него в образ от Microsoft | ||
|
||
LABEL MAINTAINER="EvilBeaver <[email protected]>" | ||
|
||
ARG VERSION="dev" | ||
|
||
# Установка FDD двойки через ovm, имеющийся в базовом образе | ||
RUN mono ovm.exe install --fdd ${VERSION} | ||
|
||
# Основной образ | ||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 | ||
|
||
ARG VERSION="dev" | ||
|
||
RUN mkdir -p /var/oscript | ||
COPY --from=0 /root/.local/share/ovm/${VERSION}/ /var/oscript/ | ||
ENV PATH="$PATH:/var/oscript/bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/*---------------------------------------------------------- | ||
This Source Code Form is subject to the terms of the | ||
Mozilla Public License, v.2.0. If a copy of the MPL | ||
was not distributed with this file, You can obtain one | ||
at http://mozilla.org/MPL/2.0/. | ||
----------------------------------------------------------*/ | ||
|
||
using OneScript.Contexts; | ||
|
||
namespace OneScript.Compilation.Binding | ||
{ | ||
public interface ISymbolTable | ||
{ | ||
SymbolScope GetScope(int index); | ||
IAttachableContext GetBinding(int scopeIndex); | ||
int ScopeCount { get; } | ||
int PushScope(SymbolScope scope, IAttachableContext target); | ||
void PopScope(); | ||
bool FindVariable(string name, out SymbolBinding binding); | ||
bool TryFindMethodBinding(string name, out SymbolBinding binding); | ||
bool TryFindMethod(string name, out IMethodSymbol method); | ||
SymbolBinding DefineMethod(IMethodSymbol symbol); | ||
SymbolBinding DefineVariable(IVariableSymbol symbol); | ||
IVariableSymbol GetVariable(SymbolBinding binding); | ||
IMethodSymbol GetMethod(SymbolBinding binding); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/*---------------------------------------------------------- | ||
This Source Code Form is subject to the terms of the | ||
Mozilla Public License, v.2.0. If a copy of the MPL | ||
was not distributed with this file, You can obtain one | ||
at http://mozilla.org/MPL/2.0/. | ||
----------------------------------------------------------*/ | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using OneScript.Compilation.Binding; | ||
using OneScript.Contexts; | ||
|
||
namespace OneScript.Compilation | ||
{ | ||
public class CompoundSymbolTable : ISymbolTable | ||
{ | ||
private readonly ISymbolTable _masterTable; | ||
private readonly SymbolTable _innerTable; | ||
|
||
public CompoundSymbolTable(ISymbolTable masterTable) | ||
{ | ||
_masterTable = masterTable; | ||
_innerTable = new SymbolTable(); | ||
} | ||
|
||
private int MasterSize => _masterTable.ScopeCount; | ||
|
||
public SymbolScope GetScope(int index) | ||
{ | ||
return index < MasterSize ? | ||
_masterTable.GetScope(index) : | ||
_innerTable.GetScope(index - MasterSize); | ||
} | ||
|
||
public IAttachableContext GetBinding(int scopeIndex) | ||
{ | ||
return scopeIndex < MasterSize ? | ||
_masterTable.GetBinding(scopeIndex) : | ||
_innerTable.GetBinding(scopeIndex - MasterSize); | ||
} | ||
|
||
public int ScopeCount => _masterTable.ScopeCount + _innerTable.ScopeCount; | ||
|
||
public int PushScope(SymbolScope scope, IAttachableContext target) | ||
{ | ||
return _innerTable.PushScope(scope, target) + MasterSize; | ||
} | ||
|
||
public void PopScope() | ||
{ | ||
if (_innerTable.ScopeCount == 0) | ||
throw new InvalidOperationException("Inner scopes are empty"); | ||
|
||
_innerTable.PopScope(); | ||
} | ||
|
||
public bool FindVariable(string name, out SymbolBinding binding) | ||
{ | ||
if (_innerTable.FindVariable(name, out binding)) | ||
{ | ||
ShiftToPublicIndex(ref binding); | ||
return true; | ||
} | ||
|
||
return _masterTable.FindVariable(name, out binding); | ||
} | ||
|
||
public bool TryFindMethodBinding(string name, out SymbolBinding binding) | ||
{ | ||
if (_innerTable.TryFindMethodBinding(name, out binding)) | ||
{ | ||
ShiftToPublicIndex(ref binding); | ||
return true; | ||
} | ||
|
||
return _masterTable.TryFindMethodBinding(name, out binding); | ||
} | ||
|
||
public bool TryFindMethod(string name, out IMethodSymbol method) | ||
{ | ||
return _innerTable.TryFindMethod(name, out method) | ||
|| _masterTable.TryFindMethod(name, out method); | ||
} | ||
|
||
public SymbolBinding DefineMethod(IMethodSymbol symbol) | ||
{ | ||
var binding = _innerTable.DefineMethod(symbol); | ||
ShiftToPublicIndex(ref binding); | ||
return binding; | ||
} | ||
|
||
public SymbolBinding DefineVariable(IVariableSymbol symbol) | ||
{ | ||
var binding = _innerTable.DefineVariable(symbol); | ||
ShiftToPublicIndex(ref binding); | ||
return binding; | ||
} | ||
|
||
public IVariableSymbol GetVariable(SymbolBinding binding) | ||
{ | ||
if (binding.ScopeNumber < MasterSize) | ||
{ | ||
return _masterTable.GetVariable(binding); | ||
} | ||
else | ||
{ | ||
UnshiftToInnerIndex(ref binding); | ||
return _innerTable.GetVariable(binding); | ||
} | ||
} | ||
|
||
public IMethodSymbol GetMethod(SymbolBinding binding) | ||
{ | ||
if (binding.ScopeNumber < MasterSize) | ||
{ | ||
return _masterTable.GetMethod(binding); | ||
} | ||
else | ||
{ | ||
UnshiftToInnerIndex(ref binding); | ||
return _innerTable.GetMethod(binding); | ||
} | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
private void ShiftToPublicIndex(ref SymbolBinding binding) | ||
{ | ||
binding.ScopeNumber += MasterSize; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
private void UnshiftToInnerIndex(ref SymbolBinding binding) | ||
{ | ||
binding.ScopeNumber -= MasterSize; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.