From 14158a5f5d06afc2a78f3017486dedc4397cd705 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 15 Apr 2026 10:29:57 +1200 Subject: [PATCH 1/2] [docs] document why [] are not allowed in identifiers in LP format --- docs/src/submodules/FileFormats/LP.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/src/submodules/FileFormats/LP.md b/docs/src/submodules/FileFormats/LP.md index e1c204333d..24f47c0ec7 100644 --- a/docs/src/submodules/FileFormats/LP.md +++ b/docs/src/submodules/FileFormats/LP.md @@ -203,3 +203,21 @@ Additional solvers put additional restrictions: but they will normalize to the legal letters on write **We choose to allow any valid UTF-8 names.** + +### Brackets in identifiers + +In the CPLEX specification, `[]` are not allowed in identifiers. However, they +are fairly common in names because of naming conventions like `x[1,2]`. +Supporting `[` in an identifier when it is not the starting character is fairly +trivial since it can't be ambiguous with any other syntax. However, deciding +whether `]` is part of an idenfitier or represents a closing bracket from a +quadratic term is quite tricky. + +Consider the case: `[ x * x] + y]`. Is that the valid `"x"^2 + "y]"` or the +corrupt `"x" * "x]" + "y"` where we're missing a multiplying variable on `"y"`? + +Gurobi supports `[]` in identifiers because the require identifiers to be +separated by whitespace. Since we allow juxtaposed tokens without whitespace, it +follows that we cannot easily support `]` in identifiers. + +**We choose not to allow `[]` in identifiers.** From d7de78788e20c3c87ac47d3750b1608217d016a1 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Wed, 15 Apr 2026 10:47:04 +1200 Subject: [PATCH 2/2] Update --- docs/src/submodules/FileFormats/LP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/submodules/FileFormats/LP.md b/docs/src/submodules/FileFormats/LP.md index 24f47c0ec7..3395336ca8 100644 --- a/docs/src/submodules/FileFormats/LP.md +++ b/docs/src/submodules/FileFormats/LP.md @@ -210,7 +210,7 @@ In the CPLEX specification, `[]` are not allowed in identifiers. However, they are fairly common in names because of naming conventions like `x[1,2]`. Supporting `[` in an identifier when it is not the starting character is fairly trivial since it can't be ambiguous with any other syntax. However, deciding -whether `]` is part of an idenfitier or represents a closing bracket from a +whether `]` is part of an identifier or represents a closing bracket from a quadratic term is quite tricky. Consider the case: `[ x * x] + y]`. Is that the valid `"x"^2 + "y]"` or the