aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorMic Bowman2013-02-12 23:21:49 -0800
committerMic Bowman2013-02-12 23:21:49 -0800
commit708c3f8b864812abc1c9642f65bc284d4bd3f074 (patch)
tree8cd8fd8bd6cdf9daa1bd3be4f5d0e13a269766d8 /OpenSim/Region/OptionalModules
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-708c3f8b864812abc1c9642f65bc284d4bd3f074.zip
opensim-SC_OLD-708c3f8b864812abc1c9642f65bc284d4bd3f074.tar.gz
opensim-SC_OLD-708c3f8b864812abc1c9642f65bc284d4bd3f074.tar.bz2
opensim-SC_OLD-708c3f8b864812abc1c9642f65bc284d4bd3f074.tar.xz
Make path parsing more robust in the JsonStore.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs18
1 files changed, 6 insertions, 12 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
index 3bad06c..f7625fb 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
@@ -68,14 +68,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
68 protected List<TakeValueCallbackClass> m_TakeStore; 68 protected List<TakeValueCallbackClass> m_TakeStore;
69 protected List<TakeValueCallbackClass> m_ReadStore; 69 protected List<TakeValueCallbackClass> m_ReadStore;
70 70
71 // add separators for quoted paths 71 // add separators for quoted paths and array references
72 protected static Regex m_ParsePassOne = new Regex("{[^}]+}"); 72 protected static Regex m_ParsePassOne = new Regex("({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");
73
74 // add separators for array references
75 protected static Regex m_ParsePassTwo = new Regex("(\\[[0-9]+\\]|\\[\\+\\])");
76 73
77 // add quotes to bare identifiers which are limited to alphabetic characters 74 // add quotes to bare identifiers which are limited to alphabetic characters
78 protected static Regex m_ParsePassThree = new Regex("\\.([a-zA-Z]+)"); 75 protected static Regex m_ParsePassThree = new Regex("(?<!{[^}]*)\\.([a-zA-Z]+)(?=\\.)");
79 76
80 // remove extra separator characters 77 // remove extra separator characters
81 protected static Regex m_ParsePassFour = new Regex("\\.+"); 78 protected static Regex m_ParsePassFour = new Regex("\\.+");
@@ -84,7 +81,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
84 protected static Regex m_ValidatePath = new Regex("^\\.(({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])\\.)*$"); 81 protected static Regex m_ValidatePath = new Regex("^\\.(({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])\\.)*$");
85 82
86 // expression used to match path components 83 // expression used to match path components
87 protected static Regex m_PathComponent = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\]+)"); 84 protected static Regex m_PathComponent = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");
88 85
89 // extract the internals of an array reference 86 // extract the internals of an array reference
90 protected static Regex m_SimpleArrayPattern = new Regex("\\[([0-9]+)\\]"); 87 protected static Regex m_SimpleArrayPattern = new Regex("\\[([0-9]+)\\]");
@@ -465,11 +462,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
465 // add front and rear separators 462 // add front and rear separators
466 expr = "." + expr + "."; 463 expr = "." + expr + ".";
467 464
468 // add separators for quoted exprs 465 // add separators for quoted exprs and array references
469 expr = m_ParsePassOne.Replace(expr,".$0.",-1,0); 466 expr = m_ParsePassOne.Replace(expr,".$1.",-1,0);
470
471 // add separators for array references
472 expr = m_ParsePassTwo.Replace(expr,".$0.",-1,0);
473 467
474 // add quotes to bare identifier 468 // add quotes to bare identifier
475 expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0); 469 expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0);