Skip to content

Commit 473f7fb

Browse files
Added support for PC-Axis file format (#1940)
This adds a new language for the PC-Axis file format.
1 parent de10bd1 commit 473f7fb

14 files changed

+291
-3
lines changed

components.js

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

components.json

+5
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,11 @@
632632
},
633633
"owner": "Golmote"
634634
},
635+
"pcaxis": {
636+
"title": "PC-Axis",
637+
"alias": "px",
638+
"owner": "RunDevelopment"
639+
},
635640
"perl": {
636641
"title": "Perl",
637642
"owner": "Golmote"

components/prism-pcaxis.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Prism.languages.pcaxis = {
2+
'string': /"[^"]*"/,
3+
'keyword': {
4+
pattern: /((?:^|;)\s*)[-A-Z\d]+(?:\s*\[[-\w]+\])?(?:\s*\("[^"]*"(?:,\s*"[^"]*")*\))?(?=\s*=)/,
5+
lookbehind: true,
6+
greedy: true,
7+
inside: {
8+
'keyword': /^[-A-Z\d]+/,
9+
'language': {
10+
pattern: /^(\s*)\[[-\w]+\]/,
11+
lookbehind: true,
12+
inside: {
13+
'punctuation': /^\[|\]$/,
14+
'property': /[-\w]+/
15+
}
16+
},
17+
'sub-key': {
18+
pattern: /^(\s*)[\s\S]+/,
19+
lookbehind: true,
20+
inside: {
21+
'parameter': {
22+
pattern: /"[^"]*"/,
23+
alias: 'property'
24+
},
25+
'punctuation': /^\(|\)$|,/
26+
}
27+
}
28+
}
29+
},
30+
'operator': /=/,
31+
'tlist': {
32+
pattern: /TLIST\s*\(\s*\w+(?:(?:\s*,\s*"[^"]*")+|\s*,\s*"[^"]*"-"[^"]*")?\s*\)/,
33+
greedy: true,
34+
inside: {
35+
'function': /^TLIST/,
36+
'property': {
37+
pattern: /^(\s*\(\s*)\w+/,
38+
lookbehind: true
39+
},
40+
'string': /"[^"]*"/,
41+
'punctuation': /[(),]/,
42+
'operator': /-/
43+
}
44+
},
45+
'punctuation': /[;,]/,
46+
'number': {
47+
pattern: /(^|\s)\d+(?:\.\d+)?(?!\S)/,
48+
lookbehind: true
49+
},
50+
'boolean': /YES|NO/,
51+
};
52+
53+
Prism.languages.px = Prism.languages.pcaxis;

components/prism-pcaxis.min.js

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

examples/prism-pcaxis.html

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h2>Full example</h2>
2+
<pre><code>CHARSET="ANSI";
3+
AXIS-VERSION="2000";
4+
LANGUAGE="en";
5+
CREATION-DATE="20170406 11:08";
6+
TIMEVAL("time")=TLIST(A1, "1994"-"1996");
7+
SUBJECT-AREA="";
8+
UNITS="Number";
9+
10+
STUB="County","Sex";
11+
VALUES("County")="State","Carlow","Dublin","Kildare","Kilkenny","Laois","Longford","Louth","Meath","Offaly","Westmeath","Wexford",
12+
"Wicklow","Clare","Cork","Kerry","Limerick","Tipperary","Waterford","Galway","Leitrim","Mayo","Roscommon","Sligo","Cavan",
13+
"Donegal","Monaghan";
14+
VALUES("Sex")="Both sexes","Male","Female";
15+
VALUES[de]("Sex")="Beide Geschlechter","Mann","Frau";
16+
CODES("County")="-","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";
17+
CODES("Sex")="-","1","2";
18+
19+
DATA=
20+
47163 87913 70192 84531 93120 343 5911 47038 51126 47870 95976 5643 66043 38987 63125 46882
21+
57422 89992 11661 35817 92686 21781 37230 80669 14129 56688 81300 20184 88680 52135 17148 28192
22+
92218 99175 76054 79907 90207 50547 31522 4244 91079 58776 83402 54109 21254 42946 83519 31242
23+
10925 37377 45279 19704 96633 51732 34458 9746 91761 42687 51681 54409 61058 74227 70802 34546
24+
64862 12022 29896 23616 50371 89808 57186 63895 94767 76388 66475 56716 50133 6604 52853 40763
25+
70558 74672 58190 40909 6869 49937 9271 28067 99656 25674 69442 20608 28046 73287 60416 77515
26+
51639 15516 40968 95524 6694 12956 83150 77099 45687 27241 6492 94966 36856 60693 720 74671
27+
17309 4831 69376 67757 67499 69029 5209 50738 86947 77747 10996 9167 69176 98856 29531 5865
28+
27654 52277 62293 30179 85049 76961 92772 65142 16252 6768 55784 20556 26088 97219 97245 44060
29+
64577 91018 75157 42780 96186 62948 73288 74597 2145 16047 1671 2690 2275 45398 71478 53720
30+
94832 91800 10398 84830 6009 9024 53132 97850 63832 13269 45376 38564 60343 85293 9330 16810
31+
24898 76675 32778 26905 40945 37569 43532 38650 38316 75398 60829 91004 97946 49080 93534 78275
32+
20002 87183 80802 56487 12666 18416 91632 74573 70729 97984 48479 93014 10281 90382 28497 15366
33+
29720 25646 98513 47065 37662 94058 17383 47234 87293 37849 32087 98641 62012 12584 35492 87090
34+
85157 90539 31005 67590 13627 44803 46789 8026 86877 18429 8935 78118 41728 67025 69312 52172
35+
49224 68064 93025 1195 64873 684 90039 86065 67324 66534 1110 22354 36867 27479 76286 8539</code></pre>

plugins/autoloader/prism-autoloader.js

+1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
"md": "markdown",
145145
"n4jsd": "n4js",
146146
"objectpascal": "pascal",
147+
"px": "pcaxis",
147148
"py": "python",
148149
"rb": "ruby",
149150
"ts": "typescript",

plugins/autoloader/prism-autoloader.min.js

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

plugins/show-language/prism-show-language.js

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
"opencl": "OpenCL",
9696
"parigp": "PARI/GP",
9797
"objectpascal": "Object Pascal",
98+
"pcaxis": "PC-Axis",
99+
"px": "PC-Axis",
98100
"php": "PHP",
99101
"phpdoc": "PHPDoc",
100102
"php-extras": "PHP Extras",

plugins/show-language/prism-show-language.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
YES
2+
NO
3+
4+
----------------------------------------------------
5+
6+
[
7+
["boolean", "YES"],
8+
["boolean", "NO"]
9+
]
10+
11+
----------------------------------------------------
12+
13+
Checks for booleans.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FOO=0;
2+
FOO[en]=1;
3+
FOO("param")=0;
4+
FOO("param1","param2")=0;
5+
FOO-BAR[en]("param1","param2")=1;
6+
7+
----------------------------------------------------
8+
9+
[
10+
["keyword", [
11+
["keyword", "FOO"]
12+
]],
13+
["operator", "="],
14+
["number", "0"],
15+
["punctuation", ";"],
16+
["keyword", [
17+
["keyword", "FOO"],
18+
["language", [
19+
["punctuation", "["],
20+
["property", "en"],
21+
["punctuation", "]"]
22+
]]
23+
]],
24+
["operator", "="],
25+
["number", "1"],
26+
["punctuation", ";"],
27+
28+
["keyword", [
29+
["keyword", "FOO"],
30+
["sub-key", [
31+
["punctuation", "("],
32+
["parameter", "\"param\""],
33+
["punctuation", ")"]
34+
]]
35+
]],
36+
["operator", "="],
37+
["number", "0"],
38+
["punctuation", ";"],
39+
40+
["keyword", [
41+
["keyword", "FOO"],
42+
["sub-key", [
43+
["punctuation", "("],
44+
["parameter", "\"param1\""],
45+
["punctuation", ","],
46+
["parameter", "\"param2\""],
47+
["punctuation", ")"]
48+
]]
49+
]],
50+
["operator", "="],
51+
["number", "0"],
52+
["punctuation", ";"],
53+
54+
["keyword", [
55+
["keyword", "FOO-BAR"],
56+
["language", [
57+
["punctuation", "["],
58+
["property", "en"],
59+
["punctuation", "]"]
60+
]],
61+
["sub-key", [
62+
["punctuation", "("],
63+
["parameter", "\"param1\""],
64+
["punctuation", ","],
65+
["parameter", "\"param2\""],
66+
["punctuation", ")"]
67+
]]
68+
]],
69+
["operator", "="],
70+
["number", "1"],
71+
["punctuation", ";"]
72+
]
73+
74+
----------------------------------------------------
75+
76+
Checks for keywords.
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
0
2+
123456789
3+
123.456
4+
0.123
5+
6+
----------------------------------------------------
7+
8+
[
9+
["number", "0"],
10+
["number", "123456789"],
11+
["number", "123.456"],
12+
["number", "0.123"]
13+
]
14+
15+
----------------------------------------------------
16+
17+
Checks for numbers.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"foo ,; ()[] bar"
2+
""
3+
4+
----------------------------------------------------
5+
6+
[
7+
["string", "\"foo ,; ()[] bar\""],
8+
["string", "\"\""]
9+
]
10+
11+
----------------------------------------------------
12+
13+
Checks for strings.

0 commit comments

Comments
 (0)