{"record":{"id":"81fc2821de5009bf","repo":"AvaloniaUI/Avalonia","slug":"unexpected-token-81fc28","errorCode":null,"errorMessage":"Unexpected token","messagePattern":"Unexpected token","errorType":"exception","errorClass":"ExpressionParseException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParser.cs","lineNumber":232,"sourceCode":"                }\n                \n                ExpressionType? op = null;\n                if (left.NotEmpty)\n                {\n                    if (parser.TryConsume('?'))\n                    {\n                        var truePart = ParseTillTerminator(ref parser, \":\",\n                            false, true, out _);\n                        // pass through the current parsing rules to consume the rest\n                        var falsePart = ParseTillTerminator(ref parser, terminatorChars, throwOnTerminator, throwOnEnd,\n                            out token);\n                        \n                        return new ConditionalExpression(left.ToExpression(), truePart, falsePart);\n                    }\n                    \n                    // We expect a binary operator here\n                    if (!TryParseOperator(ref parser, out var sop))\n                        throw new ExpressionParseException(\"Unexpected token\", parser.Position);\n                    op = sop;\n                }\n                \n                // We expect an expression to be parsed (either due to expecting a binary operator or parsing the first part\n                var applyNegation = false;\n                while (parser.TryConsume('!')) \n                    applyNegation = !applyNegation;\n\n                var applyUnaryMinus = false;\n                while (parser.TryConsume('-')) \n                    applyUnaryMinus = !applyUnaryMinus;\n\n                Expression? parsed;\n                \n                if (parser.TryConsume('(')) \n                    parsed = ParseTillTerminator(ref parser, \")\", false, true, out _);\n                else if (parser.TryParseCall(out var functionName))\n                {","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Rendering/Composition/Expressions/ExpressionParser.cs#L214-L250","documentation":"Error \"Unexpected token\" thrown in AvaloniaUI/Avalonia.","triggerScenarios":"Raised when the expression parser reads a token it cannot handle while building the expression tree. Defend by restricting expressions to the supported grammar and validating user-supplied expression text ahead of parsing.","commonSituations":"See trigger scenarios.","solutions":["Review the expression grammar and replace the unexpected token with a valid operand, operator, or function name.","Simplify the expression and reintroduce parts incrementally to locate the invalid token."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}