From 4c6157a06e94f6ea309b29f5b14faaf47a530b3c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 6 Jan 2017 14:32:37 +0000 Subject: [PATCH] Tidy up merge commit of validatePropertyExpression --- editor/js/ui/utils.js | 4 ++-- red/runtime/util.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/editor/js/ui/utils.js b/editor/js/ui/utils.js index ef88bdb09..60303fd3c 100644 --- a/editor/js/ui/utils.js +++ b/editor/js/ui/utils.js @@ -303,8 +303,8 @@ RED.utils = (function() { if (i===0 || i===length-1) { return false; } - // Next char is a-z - if (!/[a-z0-9]/i.test(str[i+1])) { + // Next char is first char of an identifier: a-z 0-9 $ _ + if (!/[a-z0-9\$\_]/i.test(str[i+1])) { return false; } start = i+1; diff --git a/red/runtime/util.js b/red/runtime/util.js index 4ed1cd4d3..38177e3b4 100644 --- a/red/runtime/util.js +++ b/red/runtime/util.js @@ -164,7 +164,7 @@ function normalisePropertyExpression(str) { if (i===length-1) { throw new Error("Invalid property expression: unterminated expression"); } - // Next char is a-z + // Next char is first char of an identifier: a-z 0-9 $ _ if (!/[a-z0-9\$\_]/i.test(str[i+1])) { throw new Error("Invalid property expression: unexpected "+str[i+1]+" at position "+(i+1)); }