mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
Make path parsing more robust in the JsonStore.
This commit is contained in:
@@ -68,14 +68,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
protected List<TakeValueCallbackClass> m_TakeStore;
|
||||
protected List<TakeValueCallbackClass> m_ReadStore;
|
||||
|
||||
// add separators for quoted paths
|
||||
protected static Regex m_ParsePassOne = new Regex("{[^}]+}");
|
||||
|
||||
// add separators for array references
|
||||
protected static Regex m_ParsePassTwo = new Regex("(\\[[0-9]+\\]|\\[\\+\\])");
|
||||
// add separators for quoted paths and array references
|
||||
protected static Regex m_ParsePassOne = new Regex("({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");
|
||||
|
||||
// add quotes to bare identifiers which are limited to alphabetic characters
|
||||
protected static Regex m_ParsePassThree = new Regex("\\.([a-zA-Z]+)");
|
||||
protected static Regex m_ParsePassThree = new Regex("(?<!{[^}]*)\\.([a-zA-Z]+)(?=\\.)");
|
||||
|
||||
// remove extra separator characters
|
||||
protected static Regex m_ParsePassFour = new Regex("\\.+");
|
||||
@@ -84,7 +81,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
protected static Regex m_ValidatePath = new Regex("^\\.(({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])\\.)*$");
|
||||
|
||||
// expression used to match path components
|
||||
protected static Regex m_PathComponent = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\]+)");
|
||||
protected static Regex m_PathComponent = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");
|
||||
|
||||
// extract the internals of an array reference
|
||||
protected static Regex m_SimpleArrayPattern = new Regex("\\[([0-9]+)\\]");
|
||||
@@ -465,11 +462,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
// add front and rear separators
|
||||
expr = "." + expr + ".";
|
||||
|
||||
// add separators for quoted exprs
|
||||
expr = m_ParsePassOne.Replace(expr,".$0.",-1,0);
|
||||
|
||||
// add separators for array references
|
||||
expr = m_ParsePassTwo.Replace(expr,".$0.",-1,0);
|
||||
// add separators for quoted exprs and array references
|
||||
expr = m_ParsePassOne.Replace(expr,".$1.",-1,0);
|
||||
|
||||
// add quotes to bare identifier
|
||||
expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0);
|
||||
|
||||
Reference in New Issue
Block a user