Skip to content

ChifiSource/ParseNotEval.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


version deps pkgeval

ParseNotEval Is a core odd data package that acts as both an implicit and explicit type parser. The main usage for such a thing is in file/string reading, by being able to quickly parse strings into their appropriate types. This is helpful if you want to make secure and fast data readers. This module is moreso ecosystem geared.

adding and using

Until the team is ready to release a stable version (very soon, likely today,) you will need to add the package via URL:

using Pkg
Pkg.add(url = "https://github.com/ChifiSource/ParseNotEval.jl.git")

The only thing that this module exports is the parse method and Dates.DateTime + Dates.Date. The extensions provided to parse() allow for one to pass tons of different types and structures through in order to create them. For example, we could read a Dict in from a string:

dct_str = "A => [5, 10, 15], B => [5, 10, 15]"
parse(Dict, dct_string)
Dict(:A => [5, 10, 15], :B => [5, 10, 15])

# This also works with JSON.
dct_str = "{A : [5, 10, 15], B : [5, 10, 15]}"
parse(Dict, dct_string)
Dict(:A => [5, 10, 15], :B => [5, 10, 15])

There are a lot more structures involved as well, the best choice is to use ?(parse) to get the docs all of the methods for parse, or view the JuliaHub documentation. One notable other example is that of parse(Any, ::String).

typeof(parse(Any, 5.0))
Float64
typeof(parse(Any, 5))
Int64

About

Expands the usage of Base.parse to work with more Base structures.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Languages