-
Notifications
You must be signed in to change notification settings - Fork 0
/
jcr_sv.rm
110 lines (85 loc) · 2.25 KB
/
jcr_sv.rm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include "xml.rm"
#include "eng.rm"
#include "sentence.rm"
#include "url.rm"
#include "chars.rm"
package jcr_sv;
import header,attr,start,end from xml;
import url from url;
import alpha,digit,nzDigit from chars;
import noun_singular from eng;
top:
(i="")
header "\n"
rootNode;
rootNode:
(attrs=
attr["xmlns:ns",url] " "
attr["xmlns:jcr","http://www.jcp.org/jcr/1.0"] " "
attr["xmlns:nt","http://www.jcp.org/jcr/nt/1.0"] " "
attr["xmlns:sv","http://www.jcp.org/jcr/sv/1.0"])
node["jcr:root",attrs];
node[n,attrs]:
(attrs=attrs" "attr["sv:name",n])
i start["sv:node",attrs] "\n"
((i=i" ")
primaryType
properties
children)
i end["sv:node"] "\n";
primaryType:
property["jcr:primaryType","Name",value["nt:base"]];
properties:
property[name,"String",value[sentence.s]{1,3}] |
property[name,"Long",value[long]{1,3}] |
property[name,"Binary",value[binary]] |
property[name,"Double",value[double]] |
property[name,"Name",value[name]] |
property[name,"Boolean",value[boolean]] |
property[name,"Path",value[path]] |
property[name,"Date",value[date]]
;
property[name,type,values]:
i start["sv:property",attr["sv:name",name]" "attr["sv:type",type]] "\n"
values
i end["sv:property"] "\n";
value[content]:
i " " start["sv:value",] content end["sv:value"] "\n";
long:
"-"? nzDigit digit{0,5};
binary:
((alpha 52 | digit 10 | "/" | "+"){4}){0,256};
double:
"-"? nzDigit digit{0,5} "." digit{1,5};
boolean:
"true" | "false";
path:
(".." ("/.."){0,3})?
("/" name ("[" nzDigit "]")?){0,4};
date:
year "-" month "-" day "T" hour ":" minute ":" second "." fracSeconds tzd;
year:
("19"|"20") digit{2};
month:
"01","02","03","04","05","06","07","08","09","10","11","12";
day:
"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15",
"16","17","18","19","20","21","22","23","24","25","26","27","28","29";
hour:
"00","01","02","03","04","05","06","07","08","09","10","11","12",
"13","14","15","16","17","18","19","20","21","22","23";
minute:
("0","1","2","3","4","5") digit;
second: minute;
fracSeconds:
digit{5};
tzd: "-05:00";
children:
child{0} 16 |
child{1} 8 |
child{2} 4 |
child{3} 2 |
child{4} 1;
child: node[name,];
name:
"ns:" noun_singular > /[^A-Za-z]/_/;