Make path parsing more robust in the JsonStore.

0.7.4-extended
Mic Bowman 2013-02-12 23:21:49 -08:00 committed by Justin Clark-Casey (justincc)
parent 841ca0fe38
commit c7179ff454
1 changed files with 6 additions and 12 deletions

View File

@ -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]+)\\]");
@ -435,11 +432,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);