Module: Vpim::Bnf

Defined in:
lib/vpim/rfc2425.rb

Overview

Contains regular expression strings for the EBNF of RFC 2425.

Constant Summary collapse

NAME =

1*(ALPHA / DIGIT / “-”) Note: I think I can add A-Z here, and get rid of the “i” matches elsewhere. Note: added ‘_’ to allowed because its produced by Notes (X-LOTUS-CHILD_UID:) Note: added ‘/’ to allowed because its produced by KAddressBook (X-messaging/xmpp-All:) Note: added ‘ ’ to allowed because its produced by highrisehq.com (X-GOOGLE TALK:)

'[-a-z0-9_/][-a-z0-9_/ ]*'
QSTR =

<“> <Any character except CTLs, DQUOTE> <”>

'"([^"]*)"'
PTEXT =

*<Any character except CTLs, DQUOTE, “;”, “:”, “,”>

'([^";:,]+)'
PVALUE =

param-value = ptext / quoted-string

"(?:#{QSTR}|#{PTEXT})"
PARAM =

param = name “=” param-value *(“,” param-value) Note: v2.1 allows a type or encoding param-value to appear without the type= or the encoding=. This is hideous, but we try and support it, if there is no “=”, then $2 will be “”, and we will treat it as a v2.1 param.

";(#{NAME})(=?)((?:#{PVALUE})?(?:,#{PVALUE})*)"
LINE =

V3.0: contentline = [group “.”] name *(“;” param) “:” value V2.1: contentline = *( group “.” ) name *(“;” param) “:” value

We accept the V2.1 syntax for backwards compatibility. LINE = “((?:#NAME\.)*)?(#NAME)([^:]*):(.*)”

"^((?:#{NAME}\\.)*)?(#{NAME})((?:#{PARAM})*):(.*)$"
DATE =

date = date-fullyear [“-”] date-month [“-”] date-mday date-fullyear = 4 DIGIT date-month = 2 DIGIT date-mday = 2 DIGIT

'(\d\d\d\d)-?(\d\d)-?(\d\d)'
TIME =

time = time-hour [“:”] time-minute [“:”] time-second [time-secfrac] [time-zone] time-hour = 2 DIGIT time-minute = 2 DIGIT time-second = 2 DIGIT time-secfrac = “,” 1*DIGIT time-zone = “Z” / time-numzone time-numzone = sign time-hour [“:”] time-minute

'(\d\d):?(\d\d):?(\d\d)(\.\d+)?(Z|[-+]\d\d:?\d\d)?'
INTEGER =

integer = ([“+”] / “-”) 1*DIGIT

'[-+]?\d+'
QSAFECHAR =

QSAFE-CHAR = WSP / %x21 / %x23-7E / NON-US-ASCII

; Any character except CTLs and DQUOTE
'[ \t\x21\x23-\x7e\x80-\xff]'
SAFECHAR =

SAFE-CHAR = WSP / %x21 / %x23-2B / %x2D-39 / %x3C-7E / NON-US-ASCII

; Any character except CTLs, DQUOTE, ";", ":", ","
'[ \t\x21\x23-\x2b\x2d-\x39\x3c-\x7e\x80-\xff]'