Skip to content

Error when parsing simple table #5

@NatElkins

Description

@NatElkins

Issue
Parser fails on the following:

let test = TomlFSharp.Read.readTomlString """
[package]

author = ["Test"]
"""

with this error

> 
System.AggregateException: One or more errors occurred. ---> System.Exception: Error in Ln: 3 Col: 10
author = 
         ^
Note: The error occurred at the end of the input stream.
The char `�` with int value: 65535 at Ln 3 Col 10, was unexpected in a parse
for a TOML value

   at Microsoft.FSharp.Core.Operators.FailWith[T](String message)
>    at Microsoft.FSharp.Collections.ArrayModule.Parallel.Map@1089-3.Invoke(Int32 obj)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, Action`1 body)
   at Microsoft.FSharp.Collections.ArrayModule.Parallel.Map[T,TResult](FSharpFunc`2 mapping, T[] array)
   at FParsec.Primitives.op_BarGreaterGreater@143.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_DotGreaterGreaterDot@104.Invoke(CharStream`1 stream)
   at FParsec.Primitives.op_BarGreaterGreater@143.Invoke(CharStream`1 stream)
   at FParsec.CharParsers.applyParser[Result,UserState](FSharpFunc`2 parser, CharStream`1 stream)
   at FParsec.CharParsers.runParserOnString@67.Invoke(CharStream`1 stream)
   at FParsec.CharStream.ParseString[T,TUserState](String chars, Int32 index, Int32 length, FSharpFunc`2 parser, TUserState userState, String streamName)
   at FParsec.CharParsers.runParserOnString[a,u](FSharpFunc`2 parser, u ustate, String streamName, String chars)
   at FSI_0002.TomlFSharp.Read.readTomlString(String text) in C:\Users\nat\Projects\toml-fs\src\Toml.FSharp\Parsers.fs:line 530
   at <StartupCode$FSI_0003>.$FSI_0003.main@() in C:\Users\nat\Projects\toml-fs\src\Toml.FSharp\Script.fsx:line 335
---> (Inner Exception #0) System.Exception: Error in Ln: 3 Col: 10
author = 
         ^
Note: The error occurred at the end of the input stream.
The char `�` with int value: 65535 at Ln 3 Col 10, was unexpected in a parse
for a TOML value

   at Microsoft.FSharp.Core.Operators.FailWith[T](String message)
   at Microsoft.FSharp.Collections.ArrayModule.Parallel.Map@1089-3.Invoke(Int32 obj)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<---

Stopped due to error

Steps to reproduce
Send the required dependencies to FSI (the first couple of lines at the top of the file), and then send the snippet above to FSI.

The same error will occur if the text is saved in a file and readFromTomlFile is used

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions