Sha256: 0b0e636580e1cba9331799dea60929346e30d5037e6f7b5ea59682567a7fc7df
Contents?: true
Size: 1.4 KB
Versions: 5
Compression:
Stored size: 1.4 KB
Contents
require 'ipv4address' grammar IPv6Address include IPv4Address # A 128-bit IPv6 address is divided into eight 16-bit pieces. Each # piece is represented numerically in case-insensitive hexadecimal, # using one to four hexadecimal digits (leading zeroes are permitted). # The eight encoded pieces are given most-significant first, separated # by colon characters. Optionally, the least-significant two pieces # may instead be represented in IPv4 address textual format. A # sequence of one or more consecutive zero-valued 16-bit pieces within # the address may be elided, omitting all their digits and leaving # exactly two consecutive colons in their place to mark the elision. rule IPv6address ( (h16 ":")6*6 ls32 | "::" (h16 ":")5*5 ls32 | h16 ? "::" (h16 ":")4*4 ls32 | (h16 (":" h16)*1)? "::" (h16 ":")3*3 ls32 | (h16 (":" h16)*2)? "::" (h16 ":")2*2 ls32 | (h16 (":" h16)*3)? "::" h16 ":" ls32 | (h16 (":" h16)*4)? "::" ls32 | (h16 (":" h16)*5)? "::" h16 | (h16 (":" h16)*6)? "::" ) { def version; 6 end } end # 16-bit address represented in hexadecimal. rule h16 HEXDIG 1*4 end # Least-significant 32 bits of address. rule ls32 (h16 ":" h16) | IPv4address end rule HEXDIG DIGIT | [a-fA-F] # Hexadecimal should be case-insensitive. end end
Version data entries
5 entries across 5 versions & 1 rubygems