{"record":{"id":"7dc71856cafe90ee","repo":"egametang/ET","slug":"condition-number-parse-error-text","errorCode":null,"errorMessage":"condition number parse error: {text}","messagePattern":"condition number parse error: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.conditionexpr/Scripts/Model/Share/ConditionExprLexer.cs","lineNumber":71,"sourceCode":"                ++this.index;\n            }\n\n            string text = this.expr.Substring(start, this.index - start);\n            this.tokens.Add(new ConditionToken(ConditionTokenType.Identifier, text, 0));\n        }\n\n        private void ReadNumber()\n        {\n            int start = this.index++;\n            while (this.index < this.expr.Length && char.IsDigit(this.expr[this.index]))\n            {\n                ++this.index;\n            }\n\n            string text = this.expr.Substring(start, this.index - start);\n            if (!long.TryParse(text, out long number))\n            {\n                throw new Exception($\"condition number parse error: {text}\");\n            }\n\n            this.tokens.Add(new ConditionToken(ConditionTokenType.Number, text, number));\n        }\n\n        private void ReadOperator()\n        {\n            char c = this.expr[this.index];\n            switch (c)\n            {\n                case '>':\n                    this.AddIfNext('=', ConditionTokenType.GreaterEqual, ConditionTokenType.Greater);\n                    return;\n                case '<':\n                    this.AddIfNext('=', ConditionTokenType.LessEqual, ConditionTokenType.Less);\n                    return;\n                case '=':\n                    this.ExpectNext('=', ConditionTokenType.Equal);","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.conditionexpr/Scripts/Model/Share/ConditionExprLexer.cs#L53-L89","documentation":"Thrown by ConditionExprLexer.ReadNumber when a digit run cannot be parsed as a long. The lexer only enters ReadNumber on a leading digit (or a minus followed by a digit), so long.TryParse fails almost exclusively on numeric overflow — the digit string exceeds Int64.MaxValue.","triggerScenarios":"A condition expression contains an integer literal too large for long, e.g. 'HP > 99999999999999999999' or an extremely large error-code suffix after ':' that exceeds long range.","commonSituations":"A typo'd extra digit in a config cell; a comparison value or error code copied with too many digits; an Excel/Luban cell formatting artifact that appended zeros.","solutions":["Correct the numeric literal in the condition expression (Luban/Excel cell) to fit within long range.","If the value is genuinely large, redesign to use a scaled unit so it fits.","Run a config-validation pass that parses all condition expressions at build time to catch overflow early."],"exampleFix":"// before (Luban/Excel expression cell)\n//   HP > 99999999999999999999\n// after\n//   HP > 9999999999","handlingStrategy":"validation","validationCode":"// Validate config-time: attempt to tokenize/parse all condition expression cells at import.\n// Reject any cell whose numeric literal exceeds long.MaxValue:\n// if (ulong.TryParse(numText, out _) && numText.Length > 18) flag for review.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate all condition expressions at config-import/build time, not just at runtime.","Watch for accidental extra digits in Excel/Luban cells.","Prefer a CI step that compiles every condition expression."],"tags":["conditionexpr","lexer","parsing","overflow","config","csharp","unity"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}