{"record":{"id":"b07d06bc6b54cf99","repo":"mono/mono","slug":"s-w-line-d-of-s-the-value-of-s-has-been","errorCode":null,"errorMessage":"%s: w - line %d of \"%s\", the value of %s has been redeclared\n","messagePattern":"(.+?): w - line (.+?) of \"(.+?)\", the value of (.+?) has been redeclared\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"mcs/jay/error.c","lineNumber":186,"sourceCode":"\nvoid\nretyped_warning (const char *s)\n{\n    fprintf(stderr, \"%s: w - line %d of \\\"%s\\\", the type of %s has been \\\nredeclared\\n\", myname, lineno, input_file_name, s);\n}\n\nvoid\nreprec_warning (const char *s)\n{\n    fprintf(stderr, \"%s: w - line %d of \\\"%s\\\", the precedence of %s has been \\\nredeclared\\n\", myname, lineno, input_file_name, s);\n}\n\nvoid\nrevalued_warning (const char *s)\n{\n    fprintf(stderr, \"%s: w - line %d of \\\"%s\\\", the value of %s has been \\\nredeclared\\n\", myname, lineno, input_file_name, s);\n}\n\nvoid\nterminal_start (const char *s)\n{\n    fprintf(stderr, \"%s: e - line %d of \\\"%s\\\", the start symbol %s is a \\\ntoken\\n\", myname, lineno, input_file_name, s);\n    done(1);\n}\n\nvoid\nrestarted_warning (void)\n{\n    fprintf(stderr, \"%s: w - line %d of \\\"%s\\\", the start symbol has been \\\nredeclared\\n\", myname, lineno, input_file_name);\n}\n","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mcs/jay/error.c#L168-L204","documentation":"Warning (not fatal) in jay: revalued_warning(s) prints '<progname>: w - line <n> of \"<file>\", the value of <s> has been redeclared'. It does NOT call done(), so jay continues. It fires when the same token's numeric value is assigned more than once via %token (e.g. '%token A 1' and later '%token A 2').","triggerScenarios":"Two %token declarations give the same token name different literal integer values, or a generated grammar re-emits a token with a new number.","commonSituations":"Merging grammars that number tokens differently; regeneration that changed token numbering but left an old declaration; manual edits that duplicated a %token line.","solutions":["Locate every %token declaration for the symbol and keep one with a single value.","Remove the duplicate/conflicting %token value line.","If numbering must change, update all references consistently in one pass."],"exampleFix":"// before\n%token PLUS '+'\n%token PLUS '+'\n\n// after\n%token PLUS '+'","handlingStrategy":"validation","validationCode":"import re, sys\nfrom collections import defaultdict\nsrc = open(sys.argv[1]).read()\nvals = defaultdict(set)\nfor m in re.finditer(r'%token\\s+(?:<[^>]+>\\s+)?(\\w+)(?:\\s+(\\d+))?', src):\n    if m.group(2):\n        vals[m.group(1)].add(m.group(2))\ndups = {t: v for t, v in vals.items() if len(v) > 1}\nif dups:\n    raise SystemExit(f'token value redeclared: {dups}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assign each %token a value at most once.","When renumbering tokens, update all declarations in a single pass.","After merging grammars, dedupe %token value lines."],"tags":["jay","parser-generator","warning","token-value","grammar"],"backgroundTag":null,"analyzedSha":"0f53e9e151d92944cacab3e24ac359410c606df6","analyzedAt":"2026-08-13T18:54:37.190Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}