Exemple #1
0
        /// <summary>
        /// Loads next <see cref="LToken"/> from the specified <see cref="LuaTableTextReader"/>.
        /// </summary>
        /// <param name="reader">The reader from which to load the next <see cref="LToken"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is <c>null</c>.</exception>
        /// <exception cref="LuaTableReaderException">There are unexpected input in the <paramref name="reader"/>.</exception>
        /// <returns>The loaded Lua token.</returns>
        public static LToken Load(LuaTableTextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }
            if (reader.CurrentToken == LuaTableReaderToken.None)
            {
                reader.Read();
            }
            SkipComments(reader);
            switch (reader.CurrentToken)
            {
            case LuaTableReaderToken.None:
            case LuaTableReaderToken.TableStart:
                return(LTable.Load(reader));

            case LuaTableReaderToken.Key:
                return(LField.Load(reader));

            case LuaTableReaderToken.Value:
                return(LValue.Load(reader));

            default:
                throw MakeUnexpectedTokenException(reader);
            }
        }
Exemple #2
0
        public new static LTable Load(LuaTableTextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }
            if (reader.CurrentToken == LuaTableReaderToken.None)
            {
                reader.Read();
            }
            SkipComments(reader);
            AssertReaderToken(reader, LuaTableReaderToken.TableStart);
            // Read fields.
            reader.Read();
            SkipComments(reader);
            var table = new LTable();

            while (true)
            {
                if (reader.CurrentToken == LuaTableReaderToken.TableEnd)
                {
                    reader.Read();
                    break;
                }
                table.Add(LField.Load(reader));
            }
            return(table);
        }
Exemple #3
0
 public DebuggerView(LTable table)
 {
     Debug.Assert(table != null);
     myTable = table;
 }
Exemple #4
0
        /// <inheritdoc />
        public override LToken DeepClone()
        {
            var table = new LTable(store.Select(t => t.DeepClone()));

            return(table);
        }