Beispiel #1
0
 public void InvokeHandler(string token)
 {
     if (token != null && token.Length != 0)
     {
         TranslationHelper.RunInterpreter(
             this.InvokeMenuHandlerFunctionPointer,
             new Value[] { CrayonWrapper.v_buildString(token) });
     }
 }
Beispiel #2
0
        private static Value ParseJsonString(char[] rawValue, int length, Index i)
        {
            i.Value++;             // opening quote
            StringBuilder sb = new StringBuilder();

            while (i.Value < length && rawValue[i.Value] != '"')
            {
                char c = rawValue[i.Value++];
                if (c == '\\')
                {
                    switch (rawValue[i.Value++])
                    {
                    case '\\': c = '\\'; break;

                    case '"': c = '"'; break;

                    case '\'': c = '\''; break;

                    case 'n': c = '\n'; break;

                    case 't': c = '\t'; break;

                    case 'r': c = '\r'; break;

                    case '0': c = '\0'; break;

                    default: throw new JsonParserException();
                    }
                }
                sb.Append(c);
            }

            if (i.Value >= length)
            {
                throw new JsonParserException();
            }
            i.Value++;             // closing quote
            return(CrayonWrapper.v_buildString(sb.ToString()));
        }