Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AUTO] Format files using DocumentFormat #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ percentagestring = "35.35%"
percentagestringlen = our_lastindex(percentagestring)
somestring = "foo something,"
somestringlen = our_lastindex(somestring)
somequotedstring = "\"Owner 2 ”Vicepresident\"\"\""
somequotedstring = "\"Owner 2 ”Vicepresident\"\"\""
somequotedstringlen = our_lastindex(somequotedstring)

longfloat64str = "2344345.1232353459389238738435"
Expand All @@ -65,14 +65,14 @@ datetimestr = "1970-02-02 02:20:20"
datetimestrlen = our_lastindex(datetimestr)

SUITE["util"]["tryparsenext"] = BenchmarkGroup()
SUITE["util"]["tryparsenext"]["NumericFloat64"] = @benchmarkable TextParse.tryparsenext($(TextParse.Numeric(Float64)), $float64str,1,$float64strlen)
SUITE["util"]["tryparsenext"]["LongNumericFloat64"] = @benchmarkable TextParse.tryparsenext($(TextParse.Numeric(Float64)), $longfloat64str,1,$longfloat64strlen)
SUITE["util"]["tryparsenext"]["UInt64"] = @benchmarkable TextParse.tryparsenext($(TextParse.Numeric(UInt64)), $intstr,1,$intstrlen)
SUITE["util"]["tryparsenext"]["NegInt64"] = @benchmarkable TextParse.tryparsenext($(TextParse.Numeric(Int64)), $negintstr,1,$negintstrlen)
SUITE["util"]["tryparsenext"]["Percentage"] = @benchmarkable TextParse.tryparsenext($(TextParse.Percentage()), $percentagestring,1,$percentagestringlen, TextParse.default_opts)
SUITE["util"]["tryparsenext"]["StringToken"] = @benchmarkable TextParse.tryparsenext($(TextParse.StringToken(String)), $somestring,1,$somestringlen, TextParse.default_opts)
SUITE["util"]["tryparsenext"]["DateTimeToken"] = @benchmarkable TextParse.tryparsenext($tok, $datetimestr,1,$datetimestrlen, $opts)
SUITE["util"]["tryparsenext"]["QuotedStringToken"] = @benchmarkable TextParse.tryparsenext($(Quoted(String,quotechar='"', escapechar='"')), $somequotedstring)
SUITE["util"]["tryparsenext"]["NumericFloat64"] = @benchmarkable TextParse.tryparsenext($(TextParse.Numeric(Float64)), $float64str, 1, $float64strlen)
SUITE["util"]["tryparsenext"]["LongNumericFloat64"] = @benchmarkable TextParse.tryparsenext($(TextParse.Numeric(Float64)), $longfloat64str, 1, $longfloat64strlen)
SUITE["util"]["tryparsenext"]["UInt64"] = @benchmarkable TextParse.tryparsenext($(TextParse.Numeric(UInt64)), $intstr, 1, $intstrlen)
SUITE["util"]["tryparsenext"]["NegInt64"] = @benchmarkable TextParse.tryparsenext($(TextParse.Numeric(Int64)), $negintstr, 1, $negintstrlen)
SUITE["util"]["tryparsenext"]["Percentage"] = @benchmarkable TextParse.tryparsenext($(TextParse.Percentage()), $percentagestring, 1, $percentagestringlen, TextParse.default_opts)
SUITE["util"]["tryparsenext"]["StringToken"] = @benchmarkable TextParse.tryparsenext($(TextParse.StringToken(String)), $somestring, 1, $somestringlen, TextParse.default_opts)
SUITE["util"]["tryparsenext"]["DateTimeToken"] = @benchmarkable TextParse.tryparsenext($tok, $datetimestr, 1, $datetimestrlen, $opts)
SUITE["util"]["tryparsenext"]["QuotedStringToken"] = @benchmarkable TextParse.tryparsenext($(Quoted(String, quotechar='"', escapechar='"')), $somequotedstring)

somefieldstring = " 12,3"
f = TextParse.fromtype(Int)
Expand Down
10 changes: 5 additions & 5 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Documenter, TextParse

makedocs(
modules = [TextParse],
sitename = "TextParse.jl",
authors = "Shashi Gowda",
pages = Any["Home" => "index.md"],
modules=[TextParse],
sitename="TextParse.jl",
authors="Shashi Gowda",
pages=Any["Home"=>"index.md"],
)

deploydocs(
repo = "github.com/JuliaComputing/TextParse.jl.git"
repo="github.com/JuliaComputing/TextParse.jl.git"
)
7 changes: 4 additions & 3 deletions src/VectorBackedStrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Base.@propagate_inbounds function Base.iterate(s::VectorBackedUTF8String, i::Int
i > ncodeunits(s) && return nothing
b = codeunit(s, i)
u = UInt32(b) << 24
Base.between(b, 0x80, 0xf7) || return reinterpret(Char, u), i+1
Base.between(b, 0x80, 0xf7) || return reinterpret(Char, u), i + 1
return our_next_continued(s, i, u)
end

Expand All @@ -57,8 +57,9 @@ function our_next_continued(s::VectorBackedUTF8String, i::Int, u::UInt32)
((i += 1) > n) | (u < 0xf0000000) && @goto ret
@inbounds b = codeunit(s, i)
b & 0xc0 == 0x80 || @goto ret
u |= UInt32(b); i += 1
@label ret
u |= UInt32(b)
i += 1
@label ret
return reinterpret(Char, u), i
end

Expand Down
Loading