Update documentation for supported letters in variable names in SpEL

Closes gh-32138
This commit is contained in:
Sam Brannen 2024-01-26 16:42:09 +01:00
parent 68cf3b928b
commit 86266b3d67
2 changed files with 10 additions and 7 deletions

View File

@ -6,11 +6,14 @@ are set by using the `setVariable()` method in `EvaluationContext` implementatio
[NOTE] [NOTE]
==== ====
Valid variable names must be composed of one or more of the following supported Variable names must be begin with a letter (as defined below), an underscore, or a dollar
sign.
Variable names must be composed of one or more of the following supported types of
characters. characters.
* letters: `A` to `Z` and `a` to `z` * letter: any character for which `java.lang.Character.isLetter(char)` returns `true`
* digits: `0` to `9` * digit: `0` to `9`
* underscore: `_` * underscore: `_`
* dollar sign: `$` * dollar sign: `$`
==== ====

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -93,8 +93,8 @@ class Tokenizer {
pushCharToken(TokenKind.PLUS); pushCharToken(TokenKind.PLUS);
} }
break; break;
case '_': // the other way to start an identifier case '_':
lexIdentifier(); lexIdentifier(); // '_' is another way to start an identifier
break; break;
case '-': case '-':
if (isTwoCharToken(TokenKind.DEC)) { if (isTwoCharToken(TokenKind.DEC)) {
@ -206,7 +206,7 @@ class Tokenizer {
pushPairToken(TokenKind.SELECT_LAST); pushPairToken(TokenKind.SELECT_LAST);
} }
else { else {
lexIdentifier(); lexIdentifier(); // '$' is another way to start an identifier
} }
break; break;
case '>': case '>':