treecard 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,86 @@
1
+ grammar VCardGrammar
2
+
3
+ rule contentlines
4
+ contentline*
5
+ end
6
+
7
+ rule contentline
8
+ (group ".")? name param_list:(";" param)* ":" value crlf <TreeCard::ContentLineNode>
9
+ end
10
+
11
+ rule group
12
+ (alpha / digit / "-")+
13
+ end
14
+
15
+ rule name
16
+ x_name / iana_token
17
+ end
18
+
19
+ rule iana_token
20
+ (alpha / digit / "-")+
21
+ end
22
+
23
+ rule x_name
24
+ [Xx] "-" (alpha / digit / "-")+
25
+ end
26
+
27
+ rule param
28
+ param_name ("=" param_value extra_params:("," param_value)*)? <TreeCard::ParamNode>
29
+ end
30
+
31
+ rule param_name
32
+ x_name / iana_token
33
+ end
34
+
35
+ rule param_value
36
+ ptext / quoted_string
37
+ end
38
+
39
+ rule ptext
40
+ safe_char*
41
+ end
42
+
43
+ rule value
44
+ value_char*
45
+ end
46
+
47
+ rule quoted_string
48
+ "\"" qsafe_char* "\""
49
+ end
50
+
51
+ rule non_ascii
52
+ [\x80-\xFF]
53
+ end
54
+
55
+ rule qsafe_char
56
+ whitespace / "\x21" / [\x23-\x7E] / non_ascii
57
+ end
58
+
59
+ rule safe_char
60
+ whitespace / "\x21" / [\x23-\x2B] / [\x2D-\x39] / [\x3C-\x7E] / non_ascii
61
+ end
62
+
63
+ rule value_char
64
+ whitespace / vchar / non_ascii
65
+ end
66
+
67
+ rule vchar
68
+ [\x21-\x7E]
69
+ end
70
+
71
+ rule alpha
72
+ [A-Za-z]
73
+ end
74
+
75
+ rule digit
76
+ [0-9]
77
+ end
78
+
79
+ rule whitespace
80
+ [\x20\x09]
81
+ end
82
+
83
+ rule crlf
84
+ [\x0D\x0A]+
85
+ end
86
+ end
data/lib/treecard.rb CHANGED
@@ -3,6 +3,9 @@ require 'grammar/vcard' # implements the vcard spec, found at http://tools.ietf.
3
3
 
4
4
  class TreeCard; end
5
5
 
6
+ class TreeCard::ParseError < Exception
7
+ end
8
+
6
9
  require 'treecard/nodes/content_line_node'
7
10
  require 'treecard/nodes/param_node'
8
11
  require 'treecard/attribute'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: treecard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Weiss
@@ -66,6 +66,7 @@ files:
66
66
  - lib/treecard.rb
67
67
  - test/test_helper.rb
68
68
  - test/unit/treecard_test.rb
69
+ - lib/grammar/vcard.treetop
69
70
  - README.md
70
71
  has_rdoc: true
71
72
  homepage: