Exemple #1
0
 public ExpressionSyntax Transpile(IExpressionSyntax expression)
 {
     return(expression switch
     {
         JassCharacterLiteralExpressionSyntax characterLiteralExpression => Transpile(characterLiteralExpression),
         JassFourCCLiteralExpressionSyntax fourCCLiteralExpression => Transpile(fourCCLiteralExpression),
         JassHexadecimalLiteralExpressionSyntax hexadecimalLiteralExpression => Transpile(hexadecimalLiteralExpression),
         JassRealLiteralExpressionSyntax realLiteralExpression => Transpile(realLiteralExpression),
         JassOctalLiteralExpressionSyntax octalLiteralExpression => Transpile(octalLiteralExpression),
         JassDecimalLiteralExpressionSyntax decimalLiteralExpression => Transpile(decimalLiteralExpression),
         JassBooleanLiteralExpressionSyntax booleanLiteralExpression => Transpile(booleanLiteralExpression),
         JassStringLiteralExpressionSyntax stringLiteralExpression => Transpile(stringLiteralExpression),
         JassNullLiteralExpressionSyntax nullLiteralExpression => Transpile(nullLiteralExpression),
         JassFunctionReferenceExpressionSyntax functionReferenceExpression => Transpile(functionReferenceExpression),
         JassInvocationExpressionSyntax invocationExpression => Transpile(invocationExpression),
         JassArrayReferenceExpressionSyntax arrayReferenceExpression => Transpile(arrayReferenceExpression),
         JassVariableReferenceExpressionSyntax variableReferenceExpression => Transpile(variableReferenceExpression),
         JassParenthesizedExpressionSyntax parenthesizedExpression => Transpile(parenthesizedExpression),
         JassUnaryExpressionSyntax unaryExpression => Transpile(unaryExpression),
         JassBinaryExpressionSyntax binaryExpression => Transpile(binaryExpression),
     });
        public LuaExpressionSyntax Transpile(JassStringLiteralExpressionSyntax stringLiteralExpression, out JassTypeSyntax type)
        {
            type = JassTypeSyntax.String;

            return($"\"{stringLiteralExpression.Value.Replace($"{JassSymbol.CarriageReturn}", @"\r").Replace($"{JassSymbol.LineFeed}", @"\n")}\"");
        }
Exemple #3
0
 public void Render(JassStringLiteralExpressionSyntax stringLiteralExpression)
 {
     Write(stringLiteralExpression.ToString());
 }
Exemple #4
0
 public ExpressionSyntax Transpile(JassStringLiteralExpressionSyntax stringLiteralExpression)
 {
     return(SyntaxFactory.ParseExpression($"\"{stringLiteralExpression.Value.Replace($"{JassSymbol.CarriageReturn}", @"\r").Replace($"{JassSymbol.LineFeed}", @"\n")}\""));
 }