{"record":{"id":"ed07f7d91d8fcf9e","repo":"egametang/ET","slug":"condition-compare-op-expected-actual-token-text","errorCode":null,"errorMessage":"condition compare op expected, actual: {token.Text}","messagePattern":"condition compare op expected, actual: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.conditionexpr/Scripts/Model/Share/ConditionExprParser.cs","lineNumber":232,"sourceCode":"            }\n\n            this.Expect(ConditionTokenType.RightParen);\n            return paramValues.ToArray();\n        }\n\n        private ConditionCompareOp ReadCompareOp()\n        {\n            ConditionToken token = this.Current;\n            ++this.position;\n            return token.Type switch\n            {\n                ConditionTokenType.Greater => ConditionCompareOp.Greater,\n                ConditionTokenType.GreaterEqual => ConditionCompareOp.GreaterEqual,\n                ConditionTokenType.Less => ConditionCompareOp.Less,\n                ConditionTokenType.LessEqual => ConditionCompareOp.LessEqual,\n                ConditionTokenType.Equal => ConditionCompareOp.Equal,\n                ConditionTokenType.NotEqual => ConditionCompareOp.NotEqual,\n                _ => throw new Exception($\"condition compare op expected, actual: {token.Text}\")\n            };\n        }\n\n        private int ReadErrorCode()\n        {\n            ConditionToken token = this.Expect(ConditionTokenType.Number);\n            if (token.Number < int.MinValue || token.Number > int.MaxValue)\n            {\n                throw new Exception($\"condition error code out of range: {token.Number}\");\n            }\n\n            return (int)token.Number;\n        }\n\n        private void ApplyErrorCode(BTNode node, int errorCode)\n        {\n            if (node is BTNumericCompare numericCompare)\n            {","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.conditionexpr/Scripts/Model/Share/ConditionExprParser.cs#L214-L250","documentation":"Thrown by ConditionExprParser.ReadCompareOp as the default arm when the token following a variable (and optional params) is not a comparison operator. The grammar requires one of >, >=, <, <=, ==, != after the variable. Any other token (a bare number, identifier, end-of-input, etc.) is rejected.","triggerScenarios":"An expression like 'HP 50' (missing operator), 'HP + 50' (unsupported '+'), 'HP & MP > 0' (misplaced logical op), or 'HP' at end of input with no operator and operand.","commonSituations":"Missing comparison operator typo; using arithmetic symbols the grammar lacks; malformed expression where an operand was omitted; copy-paste dropping the operator.","solutions":["Ensure every comparison clause is 'Variable OP Number', e.g. 'HP > 50'.","Use only the supported operators: >, >=, <, <=, ==, !=.","Check the expression is complete (variable, operator, number all present).","Validate expression strings at config-import time to flag missing operators."],"exampleFix":"// before (expression cell)\n//   HP 50\n// after\n//   HP > 50","handlingStrategy":"validation","validationCode":"// Validate structure at import: each compare clause must be Variable (params?) Op Number.\n// Ensure the token after the variable is one of >, >=, <, <=, ==, !=.","typeGuard":"static bool IsCompareToken(ConditionTokenType t) =>\n    t is ConditionTokenType.Greater or ConditionTokenType.GreaterEqual or\n           ConditionTokenType.Less or ConditionTokenType.LessEqual or\n           ConditionTokenType.Equal or ConditionTokenType.NotEqual;","tryCatchPattern":null,"preventionTips":["Author comparisons as 'Variable OP Number' only.","Use only the six supported comparison operators.","Add a config-time lint to detect missing operators."],"tags":["conditionexpr","parser","operator","syntax","config","csharp","unity"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}