Skip to content

Commit

Permalink
Finish adding accept bitwise operator support.
Browse files Browse the repository at this point in the history
  • Loading branch information
GGG-KILLER committed Apr 9, 2021
1 parent c1e765c commit 26d1c97
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Compilers/Lua/Portable/LuaSyntaxOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class LuaSyntaxOptions : IEquatable<LuaSyntaxOptions?>
acceptShebang: false,
acceptUnderscoreInNumberLiterals: false,
useLuaJitIdentifierRules: false,
acceptBitwiseOperators: false,
continueType: ContinueType.None);

/// <summary>
Expand Down Expand Up @@ -52,6 +53,7 @@ public class LuaSyntaxOptions : IEquatable<LuaSyntaxOptions?>
acceptShebang: false,
acceptUnderscoreInNumberLiterals: false,
useLuaJitIdentifierRules: true,
acceptBitwiseOperators: false,
continueType: ContinueType.None);

/// <summary>
Expand All @@ -78,6 +80,7 @@ public class LuaSyntaxOptions : IEquatable<LuaSyntaxOptions?>
acceptShebang: false,
acceptUnderscoreInNumberLiterals: true,
useLuaJitIdentifierRules: false,
acceptBitwiseOperators: true,
continueType: ContinueType.ContextualKeyword);

/// <summary>
Expand All @@ -97,6 +100,7 @@ public class LuaSyntaxOptions : IEquatable<LuaSyntaxOptions?>
acceptShebang: true,
acceptUnderscoreInNumberLiterals: true,
useLuaJitIdentifierRules: true,
acceptBitwiseOperators: true,
continueType: ContinueType.ContextualKeyword);

/// <summary>
Expand Down Expand Up @@ -127,6 +131,7 @@ public class LuaSyntaxOptions : IEquatable<LuaSyntaxOptions?>
/// <param name="acceptShebang"><inheritdoc cref="AcceptShebang" path="/summary" /></param>
/// <param name="acceptUnderscoreInNumberLiterals"><inheritdoc cref="AcceptUnderscoreInNumberLiterals" path="/summary" /></param>
/// <param name="useLuaJitIdentifierRules"><inheritdoc cref="UseLuaJitIdentifierRules" path="/summary" /></param>
/// <param name="acceptBitwiseOperators"><inheritdoc cref="AcceptBitwiseOperators" path="/summary"/></param>
/// <param name="continueType"><inheritdoc cref="ContinueType" path="/summary" /></param>
public LuaSyntaxOptions(
bool acceptBinaryNumbers,
Expand All @@ -141,6 +146,7 @@ public LuaSyntaxOptions(
bool acceptShebang,
bool acceptUnderscoreInNumberLiterals,
bool useLuaJitIdentifierRules,
bool acceptBitwiseOperators,
ContinueType continueType)
{
AcceptBinaryNumbers = acceptBinaryNumbers;
Expand All @@ -155,6 +161,7 @@ public LuaSyntaxOptions(
AcceptShebang = acceptShebang;
AcceptUnderscoreInNumberLiterals = acceptUnderscoreInNumberLiterals;
UseLuaJitIdentifierRules = useLuaJitIdentifierRules;
AcceptBitwiseOperators = acceptBitwiseOperators;
ContinueType = continueType;
}

Expand Down Expand Up @@ -287,6 +294,10 @@ public LuaSyntaxOptions(
/// <inheritdoc cref="UseLuaJitIdentifierRules" path="/summary" /> If None uses the value of
/// <see cref="UseLuaJitIdentifierRules" />.
/// </param>
/// <param name="acceptBitwiseOperators">
/// <inheritdoc cref="AcceptBitwiseOperators" path="/summary"/> If None uses the value of
/// <see cref="AcceptBitwiseOperators"/>.
/// </param>
/// <param name="continueType">
/// <inheritdoc cref="ContinueType" path="/summary" /> If None uses the value of <see
/// cref="ContinueType" />.
Expand All @@ -305,6 +316,7 @@ public LuaSyntaxOptions With(
Option<bool> acceptShebang = default,
Option<bool> acceptUnderscoreInNumberLiterals = default,
Option<bool> useLuaJitIdentifierRules = default,
Option<bool> acceptBitwiseOperators = default,
Option<ContinueType> continueType = default) =>
new LuaSyntaxOptions(
acceptBinaryNumbers.UnwrapOr(AcceptBinaryNumbers),
Expand All @@ -319,6 +331,7 @@ public LuaSyntaxOptions With(
acceptShebang.UnwrapOr(AcceptShebang),
acceptUnderscoreInNumberLiterals.UnwrapOr(AcceptUnderscoreInNumberLiterals),
useLuaJitIdentifierRules.UnwrapOr(UseLuaJitIdentifierRules),
acceptBitwiseOperators.UnwrapOr(AcceptBitwiseOperators),
continueType.UnwrapOr(ContinueType));

/// <inheritdoc/>
Expand All @@ -341,6 +354,7 @@ public bool Equals(LuaSyntaxOptions? other)
&& AcceptShebang == other.AcceptShebang
&& AcceptUnderscoreInNumberLiterals == other.AcceptUnderscoreInNumberLiterals
&& UseLuaJitIdentifierRules == other.UseLuaJitIdentifierRules
&& AcceptBitwiseOperators == other.AcceptBitwiseOperators
&& ContinueType == other.ContinueType);

/// <inheritdoc/>
Expand All @@ -359,6 +373,7 @@ public override int GetHashCode()
hash.Add(AcceptShebang);
hash.Add(AcceptUnderscoreInNumberLiterals);
hash.Add(UseLuaJitIdentifierRules);
hash.Add(AcceptBitwiseOperators);
hash.Add(ContinueType);
return hash.ToHashCode();
}
Expand Down Expand Up @@ -392,7 +407,7 @@ public override string ToString()
}
else
{
return $"{{ AcceptBinaryNumbers = {AcceptBinaryNumbers}, AcceptCCommentSyntax = {AcceptCCommentSyntax}, AcceptCompoundAssignment = {AcceptCompoundAssignment}, AcceptEmptyStatements = {AcceptEmptyStatements}, AcceptCBooleanOperators = {AcceptCBooleanOperators}, AcceptGoto = {AcceptGoto}, AcceptHexEscapesInStrings = {AcceptHexEscapesInStrings}, AcceptHexFloatLiterals = {AcceptHexFloatLiterals}, AcceptOctalNumbers = {AcceptOctalNumbers}, AcceptShebang = {AcceptShebang}, AcceptUnderscoreInNumberLiterals = {AcceptUnderscoreInNumberLiterals}, UseLuaJitIdentifierRules = {UseLuaJitIdentifierRules}, ContinueType = {ContinueType} }}";
return $"{{ AcceptBinaryNumbers = {AcceptBinaryNumbers}, AcceptCCommentSyntax = {AcceptCCommentSyntax}, AcceptCompoundAssignment = {AcceptCompoundAssignment}, AcceptEmptyStatements = {AcceptEmptyStatements}, AcceptCBooleanOperators = {AcceptCBooleanOperators}, AcceptGoto = {AcceptGoto}, AcceptHexEscapesInStrings = {AcceptHexEscapesInStrings}, AcceptHexFloatLiterals = {AcceptHexFloatLiterals}, AcceptOctalNumbers = {AcceptOctalNumbers}, AcceptShebang = {AcceptShebang}, AcceptUnderscoreInNumberLiterals = {AcceptUnderscoreInNumberLiterals}, UseLuaJitIdentifierRules = {UseLuaJitIdentifierRules}, AcceptBitwiseOperators = {AcceptBitwiseOperators}, ContinueType = {ContinueType} }}";
}
}

Expand Down

0 comments on commit 26d1c97

Please sign in to comment.