Skip to content

Commit 0d18d1e

Browse files
committed
Initial commit of the runtime as a service
1 parent 841a4cd commit 0d18d1e

29 files changed

+2863
-0
lines changed

build/jwiXML.adv.cls.js

+106
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jwiXML.css

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
@import "styles/checkbox.css";
2+
3+
* {
4+
font-family:arial, helvetica, sans-serif
5+
}
6+
pre, textarea {
7+
font-size: smaller;
8+
font-family: monospace;
9+
}
10+
pre.grammar {
11+
font-size: xx-small;
12+
}
13+
pre.result {
14+
font-size: xx-small;
15+
}
16+
pre.input {
17+
display: inline-block;
18+
font-size: small;
19+
padding-right: 2pt;
20+
margin: 0;
21+
}
22+
23+
table * {
24+
text-align: left;
25+
vertical-align: top;
26+
padding-right: 10pt;
27+
}
28+
table.states {
29+
font-size: small;
30+
}
31+
td.description {
32+
/*font-family: serif;*/
33+
font-size: x-small;
34+
}
35+
pre.sppf {
36+
display: block;
37+
}
38+
.stateSpace {
39+
background-color: lightblue;
40+
}
41+
.used {
42+
background-color: yellow;
43+
}
44+
.finished {
45+
background-color: pink;
46+
}
47+
.finished.used {
48+
background-color: lightgreen;
49+
}
50+
.input,
51+
.parseresult {
52+
font-weight: bold;
53+
}
54+
.parseresult,
55+
.pass,
56+
.fail {
57+
color: white;
58+
}
59+
.parseresult.true,
60+
.pass {
61+
background-color: green;
62+
}
63+
.parseresult.false,
64+
.fail {
65+
background-color: red;
66+
}
67+
.timing {
68+
font-size: x-small;
69+
}
70+
.resultXML {
71+
font-weight: bold;
72+
}
73+
.testSet {
74+
background-color: lightBlue;
75+
width: 100%;
76+
}
77+
.testSetInner {
78+
background-color: pink;
79+
font-size: x-small;
80+
margin: 1pt;
81+
width: 100pt;
82+
}
83+
div.side > *,
84+
div.horizontal > * {
85+
display: table-cell;
86+
}
87+
.testName {
88+
display: block;
89+
font-weight: bold;
90+
font-family: sans-serif;
91+
font-size: smaller;
92+
}
93+
.notification {
94+
font-weight: bold;
95+
font-size: smaller;
96+
background-color: lightgrey;
97+
}
98+
.note {
99+
font-style: italic;
100+
font-size: x-small;
101+
}
102+
.instruction {
103+
font-size:smaller;
104+
}
105+
106+
#go {
107+
background-color: green;
108+
color: white;
109+
cursor:pointer;
110+
}
111+
label.grammarTest,
112+
textarea {
113+
display: block;
114+
text-align: left;
115+
vertical-align: top
116+
}
117+
label.grammarTest {
118+
display: block;
119+
/*width: 20ex;*/
120+
font-weight: bold;
121+
font-family: sans-serif;
122+
}
123+
.sample {
124+
background-color: lightgreen;
125+
width: 80ex;
126+
cursor: pointer;
127+
}
128+
129+
details > summary {
130+
padding: 2px 6px;
131+
width: 15em;
132+
background-color: #eee;
133+
border: none;
134+
box-shadow: 3px 3px 4px black;
135+
cursor: pointer;
136+
}
137+
138+
details > table {
139+
border-radius: 0 0 10px 10px;
140+
background-color: #eee;
141+
padding: 2px 6px;
142+
margin: 0;
143+
box-shadow: 3px 3px 4px black;
144+
}

jwiXML.sef.json

+1
Large diffs are not rendered by default.

jwiXML.xhtml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml">
5+
<head>
6+
<title>jωiXML processor</title>
7+
<link rel="stylesheet" href="jwiXML.css" type="text/css" />
8+
9+
<!--<script type="text/javascript" src="/sxjs/SaxonJS2.debug.js" language="javascript"></script>-->
10+
<script type="text/javascript" src="saxonJS/SaxonJS2.rt.js" language="javascript"></script>
11+
<script type="text/javascript" src="build/jwiXML.adv.cls.js" language="javascript"></script>
12+
</head>
13+
<body onload="SaxonJS.transform({
14+
'stylesheetLocation' : 'jwiXML.sef.json',
15+
'sourceLocation' : 'jwiXML.xml',
16+
'initialTemplate' : 'Q{}go'
17+
})">
18+
19+
20+
<div id="body">
21+
<h2><a href="https://invisiblexml.org/"><img src="logos/logo_gradient.png" alt="InvisibleXML Logo"
22+
width="60pt" /></a>
23+
<span style="font-style:italic">j</span>ω<img src="logos/logotype.png" alt="InvisibleXML Logo"
24+
width="60pt" /> processor</h2>
25+
<p id="status" class="note">A SaxonJS/JavaScript processor of <a href="https://invisiblexml.org/">Invisible XML</a></p>
26+
<p id="messages"></p>
27+
<div id="sandpit"></div>
28+
</div>
29+
30+
</body>
31+
</html>

jwiXML.xml

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<tests>
3+
<!-- Example tests and samples for the jωiXML processor
4+
These take two forms - simple sample grammars for the interactive processor
5+
and test grammar/input sets for automatic execution (used during development)
6+
-->
7+
8+
<!-- Sample grammars for use in the interactive processor
9+
They will appear on the left hand side and can be loaded by clicking their box.
10+
11+
Note that sample[@href] will load a sample from a file if available -
12+
see the (commented-out) samples at the end which load from the ixml test suite,
13+
assuming /ixmlTests has aliased in your web server to your local repository ixml/tests-->
14+
15+
<sample>S:S;'a'. </sample>
16+
<sample>S: [L]++(+':';+'=';+'-').</sample>
17+
<sample>a: "a"*; ()?. </sample>
18+
<sample>input: line++lf.
19+
line: ~[#a | #d]*.
20+
lf: -#a | -#d, -#a.
21+
</sample>
22+
<sample>diary: entry+.
23+
entry: date, para.
24+
date: day, s, month, s, year, nl.
25+
day: digit, digit?.
26+
-digit:["0"-"9"].
27+
month: "January"; "February"; "March"; "April"; "May"; "June";
28+
"July"; "August"; "September"; "October"; "November"; "December".
29+
year: digit, digit, digit, digit.
30+
31+
para: word++s, s?, blank.
32+
-blank: nl, nl.
33+
-word: (letter; punctuation)+.
34+
-letter: [L].
35+
-punctuation: [".;:,'?!"].
36+
-s: " "+.
37+
-nl: -#a | -#d, -#a .
38+
</sample>
39+
<sample>url: scheme, ":", authority, path.
40+
@scheme: name.
41+
-name: letter+.
42+
-authority: "//", host.
43+
host: sub++".".
44+
-sub: name.
45+
path: ("/", seg)+.
46+
-seg: sname.
47+
-sname: fletter*.
48+
-letter: ["a"-"z"]; ["A"-"Z"]; ["0"-"9"].
49+
-fletter: letter; ".".
50+
</sample>
51+
52+
<sample>address: person, lf, street, lf, postcode, city, lf, country, lf;
53+
person, lf, street, lf, city, postcode, lf, country, lf.
54+
person: (title, S?)?, (initials; given, S), surname, S?.
55+
title: "Mr."; "Mrs."; "Dr."; "Ms.".
56+
initials: initial+.
57+
initial: LETTER, ".", S?.
58+
surname: name.
59+
given: name.
60+
-name: LETTER, letters.
61+
street: no, S?, streetname; streetname, S?, no, S?.
62+
streetname: name, S; name, S, name.
63+
city: name, S; name, S, name, S.
64+
country: name, S?; name, S, name, S?.
65+
postcode: digits, S, LETTER, LETTER, S?;
66+
LETTER, LETTER, digits, S, digit, LETTER, LETTER, S?.
67+
no: digits.
68+
-LETTER: ["A"-"Z"].
69+
-letters: ["a"-"z"]*.
70+
-digit: ["0"-"9"].
71+
-digits: ["0"-"9"]+.
72+
-S: " "+.
73+
-lf: -#a | -#d, -#a .
74+
</sample>
75+
76+
<!-- Samples that fetch the grammar from a file,
77+
typically a grammar from the test-suite, which can be found at
78+
https://github.com/invisibleXML/ixml/tree/master/tests
79+
80+
If you wish to reference test-suite grammars, please ensure the URIs point appropriately
81+
For example:
82+
83+
<sample href="/ixmlTests/correct/address.ixml"/>
84+
85+
will get one of the test suit grammars, assuming your localhost website is configured
86+
that /ixmlTests/ is aliased to the location of ixml/tests
87+
-->
88+
89+
<!--<sample href="/ixmlTests/correct/expr3.ixml"/>
90+
<sample href="/ixmlTests/correct/address.ixml"/>
91+
-->
92+
93+
94+
95+
<!-- Non-interactive test groups of grammars and inputs
96+
97+
<include href/> will include tests declared in another file
98+
-->
99+
100+
101+
102+
<test>
103+
<grammar>S: [L]++(+':';+'=').</grammar>
104+
<input>abcd</input>
105+
</test>
106+
<include href="myTests/welcome.xml"/>
107+
<test>
108+
<grammar>S: [L]+ .</grammar>
109+
<input showStates="">a5</input>
110+
</test>
111+
112+
113+
</tests>

lib/controls.xsl

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
4+
xmlns:math="http://www.w3.org/2005/xpath-functions/math" xmlns:doc="Documentation"
5+
xmlns:f="MyFunctions" exclude-result-prefixes="xs math" version="3.0">
6+
<xsl:mode name="make-controls" on-no-match="shallow-copy" doc:doc="Construct option controls"/>
7+
8+
<xsl:template match="datalist/option" mode="make-controls">
9+
<xsl:copy>
10+
<xsl:apply-templates select="@*, *" mode="#current"/>
11+
</xsl:copy>
12+
</xsl:template>
13+
<xsl:template match="option" mode="make-controls">
14+
<xsl:sequence
15+
select="f:makeToggler((@name, ../@name, 'showTest')[1], ., ., (@id, generate-id(.))[1], exists(@default))"
16+
/>
17+
</xsl:template>
18+
<xsl:template match="label" mode="make-controls">
19+
<xsl:sequence select="."/>
20+
</xsl:template>
21+
<xsl:template match="title" mode="make-controls">
22+
<label class="title">
23+
<xsl:apply-templates mode="#current"/>
24+
</label>
25+
</xsl:template>
26+
<xsl:template match="group[@type eq 'radio']/option" mode="make-controls">
27+
<xsl:param name="groupName" as="xs:string?" tunnel="true" select="'RadioOption'"/>
28+
<xsl:sequence
29+
select="f:makeRadio(../@class, (@value, .)[1], exists(@default), $groupName, ., generate-id(.))"/>
30+
<!-- <xsl:sequence select="f:makeRadio((../(@class, @name), 'showTest')[1], (@value, .)[1], exists(@default), ../@name, ., generate-id(.))"/>-->
31+
</xsl:template>
32+
<xsl:template match="group[@type eq 'radio']" mode="make-controls">
33+
<xsl:param name="group.id" as="xs:string?" tunnel="true"/>
34+
<xsl:variable name="name" select="
35+
if (@name) then
36+
@name
37+
else
38+
$group.id || generate-id(.)"/>
39+
<div class="radio {@class}" name="{$name}" id="{$name}">
40+
<xsl:apply-templates mode="#current">
41+
<xsl:with-param name="groupName" select="$name" tunnel="true"/>
42+
</xsl:apply-templates>
43+
</div>
44+
</xsl:template>
45+
46+
</xsl:stylesheet>

lib/serialize.xsl

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:svg="http://www.w3.org/2000/svg"
3+
xmlns:math="http://www.w3.org/2005/xpath-functions/math" xmlns:xlink="http://www.w3.org/1999/xlink"
4+
xmlns:map="http://www.w3.org/2005/xpath-functions/map" xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT" xmlns:saxon="http://saxon.sf.net/"
5+
xmlns:js="http://saxonica.com/ns/globalJS" xmlns:doc="http://www.saxonica.com/ns/documentation" xmlns:jwL="https://lists.w3.org/Archives/Public/public-ixml/2022May/0099.html"
6+
exclude-result-prefixes="xs js v p r doc math map saxon svg f xlink ixsl jwL" xmlns:v="vector" xmlns:p="path" xmlns:r="rail" xmlns:f="MyFunctions"
7+
version="3.0" xmlns="http://www.w3.org/2000/svg">
8+
<xsl:function name="f:serialize" as="xs:string*" expand-text="false">
9+
<xsl:param name="in" as="item()*"/>
10+
<xsl:sequence select="f:serialize($in, '')"/>
11+
</xsl:function>
12+
<xsl:function name="f:serialize" as="xs:string*" expand-text="false">
13+
<xsl:param name="in" as="item()*"/>
14+
<xsl:param name="indent" as="xs:string"/>
15+
<xsl:for-each select="$in">
16+
<xsl:choose>
17+
<xsl:when test=". instance of map(*)">
18+
<xsl:variable name="indent" select="$indent || ' '"/>
19+
<!-- <xsl:text>map{</xsl:text>-->
20+
<xsl:sequence
21+
select="
22+
'map{&#xA;' ||
23+
(let $m := .
24+
return
25+
string-join(map:keys(.) ! ($indent || string(.) || ':' || (let $p := f:serialize($m(.), $indent)
26+
return
27+
if (count($p) eq 1) then
28+
$p
29+
else
30+
('(' || string-join($p, ',') || ')'))), ',&#xA;')) || '}'"/>
31+
<!--<xsl:text>}</xsl:text>-->
32+
</xsl:when>
33+
<xsl:when test=". instance of attribute()">
34+
<xsl:sequence select="name(.) || '=&quot;' || string(.) || '&quot;'"/>
35+
</xsl:when>
36+
<xsl:when test=". instance of xs:string">
37+
<xsl:sequence select="'&quot;' || string(.) || '&quot;'"/>
38+
</xsl:when>
39+
<xsl:when test=". instance of xs:anyAtomicType">
40+
<xsl:sequence select="string(.)"/>
41+
</xsl:when>
42+
<xsl:otherwise>
43+
<xsl:sequence select="serialize(., map{'indent':true(),'omit-xml-declaration': true()})"/>
44+
</xsl:otherwise>
45+
</xsl:choose>
46+
</xsl:for-each>
47+
</xsl:function>
48+
</xsl:stylesheet>

0 commit comments

Comments
 (0)