// Parses code
        public static Chunk Parse(string UserCode)
        {
            bool Success;
            Parser Parser = new Parser();

            Chunk Chunk = Parser.ParseChunk(new TextInput(UserCode), out Success);

            if (Success)
                return Chunk;
            else
                throw new ArgumentException("Interpreter: Code has syntax errors:\r\n" + Parser.GetErrorMessages());
        }
Пример #2
0
        public static Chunk Parse(string luaCode)
        {
            bool  success;
            Chunk chunk = parser.ParseChunk(new TextInput(luaCode), out success);

            if (success)
            {
                return(chunk);
            }
            else
            {
                throw new ArgumentException("Code has syntax errors:\r\n" + parser.GetErrorMessages());
            }
        }
Пример #3
0
        public static Chunk Parse(string luaCode)
        {
            bool  success;
            Chunk chunk = parser.ParseChunk(new TextInput(luaCode), out success);

            if (success)
            {
                return(chunk);
            }
            else
            {
                //[PixelCrushers] Clear error stack:
                var errorMessages = parser.GetErrorMessages();
                parser.ClearErrors();
                throw new ArgumentException("Code has syntax errors:\r\n" + errorMessages);
            }
        }