Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
47
Task/URL-parser/J/url-parser-1.j
Normal file
47
Task/URL-parser/J/url-parser-1.j
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
split=:1 :0
|
||||
({. ; ] }.~ 1+[)~ i.&m
|
||||
)
|
||||
|
||||
uriparts=:3 :0
|
||||
'server fragment'=. '#' split y
|
||||
'sa query'=. '?' split server
|
||||
'scheme authpath'=. ':' split sa
|
||||
scheme;authpath;query;fragment
|
||||
)
|
||||
|
||||
queryparts=:3 :0
|
||||
(0<#y)#<;._1 '?',y
|
||||
)
|
||||
|
||||
authpathparts=:3 :0
|
||||
if. '//' -: 2{.y do.
|
||||
split=. <;.1 y
|
||||
(}.1{::split);;2}.split
|
||||
else.
|
||||
'';y
|
||||
end.
|
||||
)
|
||||
|
||||
authparts=:3 :0
|
||||
if. '@' e. y do.
|
||||
'userinfo hostport'=. '@' split y
|
||||
else.
|
||||
hostport=. y [ userinfo=.''
|
||||
end.
|
||||
if. '[' = {.hostport do.
|
||||
'host_t port_t'=. ']' split hostport
|
||||
assert. (0=#port_t)+.':'={.port_t
|
||||
(':' split userinfo),(host_t,']');}.port_t
|
||||
else.
|
||||
(':' split userinfo),':' split hostport
|
||||
end.
|
||||
)
|
||||
|
||||
taskparts=:3 :0
|
||||
'scheme authpath querystring fragment'=. uriparts y
|
||||
'auth path'=. authpathparts authpath
|
||||
'user creds host port'=. authparts auth
|
||||
query=. queryparts querystring
|
||||
export=. ;:'scheme user creds host port path query fragment'
|
||||
(#~ 0<#@>@{:"1) (,. do each) export
|
||||
)
|
||||
96
Task/URL-parser/J/url-parser-2.j
Normal file
96
Task/URL-parser/J/url-parser-2.j
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
taskparts 'foo://example.com:8042/over/there?name=ferret#nose'
|
||||
┌────────┬─────────────┐
|
||||
│scheme │foo │
|
||||
├────────┼─────────────┤
|
||||
│host │example.com │
|
||||
├────────┼─────────────┤
|
||||
│port │8042 │
|
||||
├────────┼─────────────┤
|
||||
│path │/over/there │
|
||||
├────────┼─────────────┤
|
||||
│query │┌───────────┐│
|
||||
│ ││name=ferret││
|
||||
│ │└───────────┘│
|
||||
├────────┼─────────────┤
|
||||
│fragment│nose │
|
||||
└────────┴─────────────┘
|
||||
taskparts 'urn:example:animal:ferret:nose'
|
||||
┌──────┬──────────────────────────┐
|
||||
│scheme│urn │
|
||||
├──────┼──────────────────────────┤
|
||||
│path │example:animal:ferret:nose│
|
||||
└──────┴──────────────────────────┘
|
||||
taskparts 'jdbc:mysql://test_user:ouupppssss@localhost:3306/sakila?profileSQL=true'
|
||||
┌──────┬──────────────────────────────────────────────────┐
|
||||
│scheme│jdbc │
|
||||
├──────┼──────────────────────────────────────────────────┤
|
||||
│path │mysql://test_user:ouupppssss@localhost:3306/sakila│
|
||||
├──────┼──────────────────────────────────────────────────┤
|
||||
│query │┌───────────────┐ │
|
||||
│ ││profileSQL=true│ │
|
||||
│ │└───────────────┘ │
|
||||
└──────┴──────────────────────────────────────────────────┘
|
||||
taskparts 'ftp://ftp.is.co.za/rfc/rfc1808.txt'
|
||||
┌──────┬────────────────┐
|
||||
│scheme│ftp │
|
||||
├──────┼────────────────┤
|
||||
│host │ftp.is.co.za │
|
||||
├──────┼────────────────┤
|
||||
│path │/rfc/rfc1808.txt│
|
||||
└──────┴────────────────┘
|
||||
taskparts 'http://www.ietf.org/rfc/rfc2396.txt#header1'
|
||||
┌────────┬────────────────┐
|
||||
│scheme │http │
|
||||
├────────┼────────────────┤
|
||||
│host │www.ietf.org │
|
||||
├────────┼────────────────┤
|
||||
│path │/rfc/rfc2396.txt│
|
||||
├────────┼────────────────┤
|
||||
│fragment│header1 │
|
||||
└────────┴────────────────┘
|
||||
taskparts 'ldap://[2001:db8::7]/c=GB?objectClass=one&objectClass=two'
|
||||
┌──────┬─────────────────────────────────┐
|
||||
│scheme│ldap │
|
||||
├──────┼─────────────────────────────────┤
|
||||
│host │[2001:db8::7] │
|
||||
├──────┼─────────────────────────────────┤
|
||||
│path │/c=GB │
|
||||
├──────┼─────────────────────────────────┤
|
||||
│query │┌───────────────────────────────┐│
|
||||
│ ││objectClass=one&objectClass=two││
|
||||
│ │└───────────────────────────────┘│
|
||||
└──────┴─────────────────────────────────┘
|
||||
taskparts 'mailto:John.Doe@example.com'
|
||||
┌──────┬────────────────────┐
|
||||
│scheme│mailto │
|
||||
├──────┼────────────────────┤
|
||||
│path │John.Doe@example.com│
|
||||
└──────┴────────────────────┘
|
||||
taskparts 'news:comp.infosystems.www.servers.unix'
|
||||
┌──────┬─────────────────────────────────┐
|
||||
│scheme│news │
|
||||
├──────┼─────────────────────────────────┤
|
||||
│path │comp.infosystems.www.servers.unix│
|
||||
└──────┴─────────────────────────────────┘
|
||||
taskparts 'tel:+1-816-555-1212'
|
||||
┌──────┬───────────────┐
|
||||
│scheme│tel │
|
||||
├──────┼───────────────┤
|
||||
│path │+1-816-555-1212│
|
||||
└──────┴───────────────┘
|
||||
taskparts 'telnet://192.0.2.16:80/'
|
||||
┌──────┬──────────┐
|
||||
│scheme│telnet │
|
||||
├──────┼──────────┤
|
||||
│host │192.0.2.16│
|
||||
├──────┼──────────┤
|
||||
│port │80 │
|
||||
├──────┼──────────┤
|
||||
│path │/ │
|
||||
└──────┴──────────┘
|
||||
taskparts 'urn:oasis:names:specification:docbook:dtd:xml:4.1.2'
|
||||
┌──────┬───────────────────────────────────────────────┐
|
||||
│scheme│urn │
|
||||
├──────┼───────────────────────────────────────────────┤
|
||||
│path │oasis:names:specification:docbook:dtd:xml:4.1.2│
|
||||
└──────┴───────────────────────────────────────────────┘
|
||||
14
Task/URL-parser/J/url-parser-3.j
Normal file
14
Task/URL-parser/J/url-parser-3.j
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
taskparts 'mysql://test_user:ouupppssss@localhost:3306/sakila'
|
||||
┌──────┬──────────┐
|
||||
│scheme│mysql │
|
||||
├──────┼──────────┤
|
||||
│user │test_user │
|
||||
├──────┼──────────┤
|
||||
│pass │ouupppssss│
|
||||
├──────┼──────────┤
|
||||
│host │localhost │
|
||||
├──────┼──────────┤
|
||||
│port │3306 │
|
||||
├──────┼──────────┤
|
||||
│path │/sakila │
|
||||
└──────┴──────────┘
|
||||
32
Task/URL-parser/J/url-parser-4.j
Normal file
32
Task/URL-parser/J/url-parser-4.j
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
taskparts 'ssh://alice@example.com'
|
||||
┌──────┬───────────┐
|
||||
│scheme│ssh │
|
||||
├──────┼───────────┤
|
||||
│user │alice │
|
||||
├──────┼───────────┤
|
||||
│host │example.com│
|
||||
└──────┴───────────┘
|
||||
taskparts 'https://bob:pass@example.com/place'
|
||||
┌──────┬───────────┐
|
||||
│scheme│https │
|
||||
├──────┼───────────┤
|
||||
│user │bob │
|
||||
├──────┼───────────┤
|
||||
│creds │pass │
|
||||
├──────┼───────────┤
|
||||
│host │example.com│
|
||||
├──────┼───────────┤
|
||||
│path │/place │
|
||||
└──────┴───────────┘
|
||||
taskparts 'http://example.com/?a=1&b=2+2&c=3&c=4&d=%65%6e%63%6F%64%65%64'
|
||||
┌──────┬───────────────────────────────────────────┐
|
||||
│scheme│http │
|
||||
├──────┼───────────────────────────────────────────┤
|
||||
│host │example.com │
|
||||
├──────┼───────────────────────────────────────────┤
|
||||
│path │/ │
|
||||
├──────┼───────────────────────────────────────────┤
|
||||
│query │┌─────────────────────────────────────────┐│
|
||||
│ ││a=1&b=2+2&c=3&c=4&d=%65%6e%63%6F%64%65%64││
|
||||
│ │└─────────────────────────────────────────┘│
|
||||
└──────┴───────────────────────────────────────────┘
|
||||
Loading…
Add table
Add a link
Reference in a new issue