Make path parsing more robust in the JsonStore.
parent
841ca0fe38
commit
c7179ff454
|
@ -68,14 +68,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||||
protected List<TakeValueCallbackClass> m_TakeStore;
|
protected List<TakeValueCallbackClass> m_TakeStore;
|
||||||
protected List<TakeValueCallbackClass> m_ReadStore;
|
protected List<TakeValueCallbackClass> m_ReadStore;
|
||||||
|
|
||||||
// add separators for quoted paths
|
// add separators for quoted paths and array references
|
||||||
protected static Regex m_ParsePassOne = new Regex("{[^}]+}");
|
protected static Regex m_ParsePassOne = new Regex("({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");
|
||||||
|
|
||||||
// add separators for array references
|
|
||||||
protected static Regex m_ParsePassTwo = new Regex("(\\[[0-9]+\\]|\\[\\+\\])");
|
|
||||||
|
|
||||||
// add quotes to bare identifiers which are limited to alphabetic characters
|
// 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
|
// remove extra separator characters
|
||||||
protected static Regex m_ParsePassFour = new Regex("\\.+");
|
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]+\\]|\\[\\+\\])\\.)*$");
|
protected static Regex m_ValidatePath = new Regex("^\\.(({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])\\.)*$");
|
||||||
|
|
||||||
// expression used to match path components
|
// 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
|
// extract the internals of an array reference
|
||||||
protected static Regex m_SimpleArrayPattern = new Regex("\\[([0-9]+)\\]");
|
protected static Regex m_SimpleArrayPattern = new Regex("\\[([0-9]+)\\]");
|
||||||
|
@ -435,11 +432,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||||
// add front and rear separators
|
// add front and rear separators
|
||||||
expr = "." + expr + ".";
|
expr = "." + expr + ".";
|
||||||
|
|
||||||
// add separators for quoted exprs
|
// add separators for quoted exprs and array references
|
||||||
expr = m_ParsePassOne.Replace(expr,".$0.",-1,0);
|
expr = m_ParsePassOne.Replace(expr,".$1.",-1,0);
|
||||||
|
|
||||||
// add separators for array references
|
|
||||||
expr = m_ParsePassTwo.Replace(expr,".$0.",-1,0);
|
|
||||||
|
|
||||||
// add quotes to bare identifier
|
// add quotes to bare identifier
|
||||||
expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0);
|
expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0);
|
||||||
|
|
Loading…
Reference in New Issue