Skip to content

Commit

Permalink
Merge branch 'feature/lang-improve-1348' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilBeaver committed Oct 19, 2023
2 parents 212d189 + 7246307 commit 70474cc
Show file tree
Hide file tree
Showing 26 changed files with 577 additions and 527 deletions.
248 changes: 0 additions & 248 deletions Build.csproj

This file was deleted.

1 change: 0 additions & 1 deletion src/1Script.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ EndProject

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D14BF321-348C-46B8-B96A-43A22BA7AC10}"
ProjectSection(SolutionItems) = preProject
..\Build.csproj = ..\Build.csproj
oscommon.targets = oscommon.targets
..\Build_Core.csproj = ..\Build_Core.csproj
..\Jenkinsfile = ..\Jenkinsfile
Expand Down
33 changes: 7 additions & 26 deletions src/OneScript.Language/LanguageDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ public static class LanguageDef
static readonly Dictionary<Token, int> _priority = new Dictionary<Token, int>();
public const int MAX_OPERATION_PRIORITY = 8;

private static readonly LexemTrie<Token> _stringToToken = new LexemTrie<Token>();
private static readonly IdentifiersTrie<Token> _stringToToken = new IdentifiersTrie<Token>();

private static readonly LexemTrie<bool> _undefined = new LexemTrie<bool>();
private static readonly LexemTrie<bool> _booleans = new LexemTrie<bool>();
private static readonly LexemTrie<bool> _logicalOp = new LexemTrie<bool>();
private static readonly IdentifiersTrie<bool> _undefined = new IdentifiersTrie<bool>();
private static readonly IdentifiersTrie<bool> _booleans = new IdentifiersTrie<bool>();
private static readonly IdentifiersTrie<bool> _logicalOp = new IdentifiersTrie<bool>();

private static readonly LexemTrie<bool> _preprocRegion = new LexemTrie<bool>();
private static readonly LexemTrie<bool> _preprocEndRegion = new LexemTrie<bool>();

private static readonly LexemTrie<bool> _preprocImport = new LexemTrie<bool>();
private static readonly IdentifiersTrie<bool> _preprocImport = new IdentifiersTrie<bool>();

const int BUILTINS_INDEX = (int)Token.ByValParam;

Expand Down Expand Up @@ -110,6 +107,7 @@ static LanguageDef()
AddToken(Token.RemoveHandler, "УдалитьОбработчик", "RemoveHandler");
AddToken(Token.Async, "Асинх", "Async");
AddToken(Token.Await, "Ждать", "Await");
AddToken(Token.Goto, "Перейти", "Goto");

#endregion

Expand Down Expand Up @@ -216,11 +214,6 @@ static LanguageDef()

#endregion

_preprocRegion.Add("Область",true);
_preprocRegion.Add("Region", true);
_preprocEndRegion.Add("КонецОбласти", true);
_preprocEndRegion.Add("EndRegion", true);

_preprocImport.Add("Использовать", true);
_preprocImport.Add("Use", true);
}
Expand Down Expand Up @@ -292,7 +285,7 @@ public static bool IsUnaryOperator(Token token)
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsLiteral(ref Lexem lex)
public static bool IsLiteral(in Lexem lex)
{
return lex.Type == LexemType.StringLiteral
|| lex.Type == LexemType.NumberLiteral
Expand Down Expand Up @@ -410,18 +403,6 @@ public static bool IsLogicalOperatorString(string content)
return _logicalOp.TryGetValue(content, out var nodeIsFilled) && nodeIsFilled;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsPreprocRegion(string value)
{
return _preprocRegion.TryGetValue(value, out var nodeIsFilled) && nodeIsFilled;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsPreprocEndRegion(string value)
{
return _preprocEndRegion.TryGetValue(value, out var nodeIsFilled) && nodeIsFilled;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsImportDirective(string value)
{
Expand Down
Loading

0 comments on commit 70474cc

Please sign in to comment.