mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7133c3b11a | ||
|
|
d72114083b | ||
|
|
683925fcd5 | ||
|
|
1c8bf32d35 | ||
|
|
28913833f4 | ||
|
|
c6752be546 | ||
|
|
395e474cad | ||
|
|
16ea189aa6 | ||
|
|
ac81fc5da9 | ||
|
|
58191c10b3 | ||
|
|
c2ca23d580 | ||
|
|
b5dfb40c7d | ||
|
|
7e647fd915 | ||
|
|
5b9f9bc0e6 | ||
|
|
b1c057fa30 | ||
|
|
ca348dd373 | ||
|
|
b802045c5c | ||
|
|
3c244a9501 | ||
|
|
832a7b9b06 | ||
|
|
e7d856345f | ||
|
|
ac559effaa | ||
|
|
95d0daba80 | ||
|
|
a0ad1523a1 | ||
|
|
06c049b8c0 | ||
|
|
24c7380765 | ||
|
|
73ef1bf156 | ||
|
|
c8b30a62f9 | ||
|
|
48dfdd2dfe | ||
|
|
68727f724a | ||
|
|
f46e053633 | ||
|
|
d2e739ba8c | ||
|
|
37174e1d2c | ||
|
|
cdb5206def | ||
|
|
d636eaf1e3 | ||
|
|
49f3eb1286 | ||
|
|
8ab94a8643 | ||
|
|
f72c337c5b | ||
|
|
d22321de07 | ||
|
|
473e5db51f | ||
|
|
8b9fc4683a | ||
|
|
3b4415cc3c | ||
|
|
2afce1754a | ||
|
|
f232b93214 | ||
|
|
db64f192fa | ||
|
|
ca96ecdc55 | ||
|
|
2a06d1aa19 | ||
|
|
b2fa2a1f46 | ||
|
|
6839516b5c | ||
|
|
2fddaaf3d7 | ||
|
|
741d246581 | ||
|
|
538f479b60 | ||
|
|
88cc73fa49 | ||
|
|
01bb6c37ab |
9
.gitmodules
vendored
9
.gitmodules
vendored
@@ -683,9 +683,18 @@
|
|||||||
[submodule "vendor/grammars/language-babel"]
|
[submodule "vendor/grammars/language-babel"]
|
||||||
path = vendor/grammars/language-babel
|
path = vendor/grammars/language-babel
|
||||||
url = https://github.com/gandm/language-babel
|
url = https://github.com/gandm/language-babel
|
||||||
|
[submodule "vendor/grammars/UrWeb-Language-Definition"]
|
||||||
|
path = vendor/grammars/UrWeb-Language-Definition
|
||||||
|
url = https://github.com/gwalborn/UrWeb-Language-Definition.git
|
||||||
[submodule "vendor/grammars/Stata.tmbundle"]
|
[submodule "vendor/grammars/Stata.tmbundle"]
|
||||||
path = vendor/grammars/Stata.tmbundle
|
path = vendor/grammars/Stata.tmbundle
|
||||||
url = https://github.com/pschumm/Stata.tmbundle
|
url = https://github.com/pschumm/Stata.tmbundle
|
||||||
[submodule "vendor/grammars/FreeMarker.tmbundle"]
|
[submodule "vendor/grammars/FreeMarker.tmbundle"]
|
||||||
path = vendor/grammars/FreeMarker.tmbundle
|
path = vendor/grammars/FreeMarker.tmbundle
|
||||||
url = https://github.com/freemarker/FreeMarker.tmbundle
|
url = https://github.com/freemarker/FreeMarker.tmbundle
|
||||||
|
[submodule "vendor/grammars/language-click"]
|
||||||
|
path = vendor/grammars/language-click
|
||||||
|
url = https://github.com/stenverbois/language-click.git
|
||||||
|
[submodule "vendor/grammars/language-maxscript"]
|
||||||
|
path = vendor/grammars/language-maxscript
|
||||||
|
url = https://github.com/Alhadis/language-maxscript
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ vendor/grammars/TXL/:
|
|||||||
- source.txl
|
- source.txl
|
||||||
vendor/grammars/Textmate-Gosu-Bundle:
|
vendor/grammars/Textmate-Gosu-Bundle:
|
||||||
- source.gosu.2
|
- source.gosu.2
|
||||||
|
vendor/grammars/UrWeb-Language-Definition:
|
||||||
|
- source.ur
|
||||||
vendor/grammars/VBDotNetSyntax:
|
vendor/grammars/VBDotNetSyntax:
|
||||||
- source.vbnet
|
- source.vbnet
|
||||||
vendor/grammars/Vala-TMBundle:
|
vendor/grammars/Vala-TMBundle:
|
||||||
@@ -322,6 +324,8 @@ vendor/grammars/kotlin-sublime-package:
|
|||||||
vendor/grammars/language-babel/:
|
vendor/grammars/language-babel/:
|
||||||
- source.js.jsx
|
- source.js.jsx
|
||||||
- source.regexp.babel
|
- source.regexp.babel
|
||||||
|
vendor/grammars/language-click/:
|
||||||
|
- source.click
|
||||||
vendor/grammars/language-clojure:
|
vendor/grammars/language-clojure:
|
||||||
- source.clojure
|
- source.clojure
|
||||||
vendor/grammars/language-coffee-script:
|
vendor/grammars/language-coffee-script:
|
||||||
@@ -345,6 +349,8 @@ vendor/grammars/language-javascript:
|
|||||||
vendor/grammars/language-jsoniq/:
|
vendor/grammars/language-jsoniq/:
|
||||||
- source.jq
|
- source.jq
|
||||||
- source.xq
|
- source.xq
|
||||||
|
vendor/grammars/language-maxscript:
|
||||||
|
- source.maxscript
|
||||||
vendor/grammars/language-ncl:
|
vendor/grammars/language-ncl:
|
||||||
- source.ncl
|
- source.ncl
|
||||||
vendor/grammars/language-python:
|
vendor/grammars/language-python:
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ module Linguist
|
|||||||
disambiguate ".for", ".f" do |data|
|
disambiguate ".for", ".f" do |data|
|
||||||
if /^: /.match(data)
|
if /^: /.match(data)
|
||||||
Language["Forth"]
|
Language["Forth"]
|
||||||
elsif /^([c*][^a-z]| (subroutine|program)\s|\s*!)/i.match(data)
|
elsif /^([c*][^abd-z]| (subroutine|program|end)\s|\s*!)/i.match(data)
|
||||||
Language["FORTRAN"]
|
Language["FORTRAN"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -238,8 +238,10 @@ module Linguist
|
|||||||
disambiguate ".ms" do |data|
|
disambiguate ".ms" do |data|
|
||||||
if /^[.'][a-z][a-z](\s|$)/i.match(data)
|
if /^[.'][a-z][a-z](\s|$)/i.match(data)
|
||||||
Language["Groff"]
|
Language["Groff"]
|
||||||
elsif /((^|\s)move?[. ])|\.(include|globa?l)\s/.match(data)
|
elsif /(?<!\S)\.(include|globa?l)\s/.match(data) || /(?<!\/\*)(\A|\n)\s*\.[A-Za-z]/.match(data.gsub(/"([^\\"]|\\.)*"|'([^\\']|\\.)*'|\\\s*(?:--.*)?\n/, ""))
|
||||||
Language["GAS"]
|
Language["GAS"]
|
||||||
|
else
|
||||||
|
Language["MAXScript"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ Agda:
|
|||||||
|
|
||||||
Alloy:
|
Alloy:
|
||||||
type: programming # 'modeling' would be more appropiate
|
type: programming # 'modeling' would be more appropiate
|
||||||
color: "#cc5c24"
|
color: "#64C800"
|
||||||
extensions:
|
extensions:
|
||||||
- .als
|
- .als
|
||||||
ace_mode: text
|
ace_mode: text
|
||||||
@@ -393,6 +393,7 @@ C#:
|
|||||||
- csharp
|
- csharp
|
||||||
extensions:
|
extensions:
|
||||||
- .cs
|
- .cs
|
||||||
|
- .cake
|
||||||
- .cshtml
|
- .cshtml
|
||||||
- .csx
|
- .csx
|
||||||
|
|
||||||
@@ -540,6 +541,14 @@ Clean:
|
|||||||
tm_scope: none
|
tm_scope: none
|
||||||
ace_mode: text
|
ace_mode: text
|
||||||
|
|
||||||
|
Click:
|
||||||
|
type: programming
|
||||||
|
color: "#E4E6F3"
|
||||||
|
extensions:
|
||||||
|
- .click
|
||||||
|
tm_scope: source.click
|
||||||
|
ace_mode: text
|
||||||
|
|
||||||
Clojure:
|
Clojure:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: clojure
|
ace_mode: clojure
|
||||||
@@ -568,6 +577,7 @@ CoffeeScript:
|
|||||||
extensions:
|
extensions:
|
||||||
- .coffee
|
- .coffee
|
||||||
- ._coffee
|
- ._coffee
|
||||||
|
- .cake
|
||||||
- .cjsx
|
- .cjsx
|
||||||
- .cson
|
- .cson
|
||||||
- .iced
|
- .iced
|
||||||
@@ -885,6 +895,8 @@ Elixir:
|
|||||||
ace_mode: elixir
|
ace_mode: elixir
|
||||||
filenames:
|
filenames:
|
||||||
- mix.lock
|
- mix.lock
|
||||||
|
interpreters:
|
||||||
|
- elixir
|
||||||
|
|
||||||
Elm:
|
Elm:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1012,6 +1024,7 @@ Formatted:
|
|||||||
type: data
|
type: data
|
||||||
extensions:
|
extensions:
|
||||||
- .for
|
- .for
|
||||||
|
- .eam.fs
|
||||||
tm_scope: none
|
tm_scope: none
|
||||||
ace_mode: text
|
ace_mode: text
|
||||||
|
|
||||||
@@ -1691,6 +1704,18 @@ Julia:
|
|||||||
color: "#a270ba"
|
color: "#a270ba"
|
||||||
ace_mode: julia
|
ace_mode: julia
|
||||||
|
|
||||||
|
Jupyter Notebook:
|
||||||
|
type: markup
|
||||||
|
ace_mode: json
|
||||||
|
tm_scope: source.json
|
||||||
|
color: "#DA5B0B"
|
||||||
|
extensions:
|
||||||
|
- .ipynb
|
||||||
|
filenames:
|
||||||
|
- Notebook
|
||||||
|
aliases:
|
||||||
|
- IPython Notebook
|
||||||
|
|
||||||
KRL:
|
KRL:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#28431f"
|
color: "#28431f"
|
||||||
@@ -1953,6 +1978,15 @@ M:
|
|||||||
tm_scope: source.lisp
|
tm_scope: source.lisp
|
||||||
ace_mode: lisp
|
ace_mode: lisp
|
||||||
|
|
||||||
|
MAXScript:
|
||||||
|
type: programming
|
||||||
|
color: "#00a6a6"
|
||||||
|
extensions:
|
||||||
|
- .ms
|
||||||
|
- .mcr
|
||||||
|
tm_scope: source.maxscript
|
||||||
|
ace_mode: text
|
||||||
|
|
||||||
MTML:
|
MTML:
|
||||||
type: markup
|
type: markup
|
||||||
color: "#b7e1f4"
|
color: "#b7e1f4"
|
||||||
@@ -2038,6 +2072,8 @@ Mathematica:
|
|||||||
Matlab:
|
Matlab:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#bb92ac"
|
color: "#bb92ac"
|
||||||
|
aliases:
|
||||||
|
- octave
|
||||||
extensions:
|
extensions:
|
||||||
- .matlab
|
- .matlab
|
||||||
- .m
|
- .m
|
||||||
@@ -2606,6 +2642,13 @@ Perl6:
|
|||||||
tm_scope: source.perl.6
|
tm_scope: source.perl.6
|
||||||
ace_mode: perl
|
ace_mode: perl
|
||||||
|
|
||||||
|
Pickle:
|
||||||
|
type: data
|
||||||
|
extensions:
|
||||||
|
- .pkl
|
||||||
|
tm_scope: none
|
||||||
|
ace_mode: text
|
||||||
|
|
||||||
PicoLisp:
|
PicoLisp:
|
||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
@@ -3148,7 +3191,7 @@ Sass:
|
|||||||
Scala:
|
Scala:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: scala
|
ace_mode: scala
|
||||||
color: "#7dd3b0"
|
color: "#DC322F"
|
||||||
extensions:
|
extensions:
|
||||||
- .scala
|
- .scala
|
||||||
- .sbt
|
- .sbt
|
||||||
@@ -3519,6 +3562,17 @@ UnrealScript:
|
|||||||
tm_scope: source.java
|
tm_scope: source.java
|
||||||
ace_mode: java
|
ace_mode: java
|
||||||
|
|
||||||
|
UrWeb:
|
||||||
|
type: programming
|
||||||
|
aliases:
|
||||||
|
- Ur/Web
|
||||||
|
- Ur
|
||||||
|
extensions:
|
||||||
|
- .ur
|
||||||
|
- .urs
|
||||||
|
tm_scope: source.ur
|
||||||
|
ace_mode: text
|
||||||
|
|
||||||
VCL:
|
VCL:
|
||||||
group: Perl
|
group: Perl
|
||||||
type: programming
|
type: programming
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
- jquery.fn.gantt.js
|
- jquery.fn.gantt.js
|
||||||
|
|
||||||
# jQuery fancyBox
|
# jQuery fancyBox
|
||||||
- jquery.fancybox.js
|
- jquery.fancybox.(js|css)
|
||||||
|
|
||||||
# Fuel UX
|
# Fuel UX
|
||||||
- fuelux.js
|
- fuelux.js
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
module Linguist
|
module Linguist
|
||||||
VERSION = "4.7.1"
|
VERSION = "4.7.3"
|
||||||
end
|
end
|
||||||
|
|||||||
86
samples/C#/build.cake
Normal file
86
samples/C#/build.cake
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// ARGUMENTS
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var target = Argument<string>("target", "Default");
|
||||||
|
var configuration = Argument<string>("configuration", "Release");
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// GLOBAL VARIABLES
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var solutions = GetFiles("./**/*.sln");
|
||||||
|
var solutionPaths = solutions.Select(solution => solution.GetDirectory());
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// SETUP / TEARDOWN
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Setup(() =>
|
||||||
|
{
|
||||||
|
// Executed BEFORE the first task.
|
||||||
|
Information("Running tasks...");
|
||||||
|
});
|
||||||
|
|
||||||
|
Teardown(() =>
|
||||||
|
{
|
||||||
|
// Executed AFTER the last task.
|
||||||
|
Information("Finished running tasks.");
|
||||||
|
});
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// TASK DEFINITIONS
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Task("Clean")
|
||||||
|
.Does(() =>
|
||||||
|
{
|
||||||
|
// Clean solution directories.
|
||||||
|
foreach(var path in solutionPaths)
|
||||||
|
{
|
||||||
|
Information("Cleaning {0}", path);
|
||||||
|
CleanDirectories(path + "/**/bin/" + configuration);
|
||||||
|
CleanDirectories(path + "/**/obj/" + configuration);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Task("Restore")
|
||||||
|
.Does(() =>
|
||||||
|
{
|
||||||
|
// Restore all NuGet packages.
|
||||||
|
foreach(var solution in solutions)
|
||||||
|
{
|
||||||
|
Information("Restoring {0}...", solution);
|
||||||
|
NuGetRestore(solution);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Task("Build")
|
||||||
|
.IsDependentOn("Clean")
|
||||||
|
.IsDependentOn("Restore")
|
||||||
|
.Does(() =>
|
||||||
|
{
|
||||||
|
// Build all solutions.
|
||||||
|
foreach(var solution in solutions)
|
||||||
|
{
|
||||||
|
Information("Building {0}", solution);
|
||||||
|
MSBuild(solution, settings =>
|
||||||
|
settings.SetPlatformTarget(PlatformTarget.MSIL)
|
||||||
|
.WithProperty("TreatWarningsAsErrors","true")
|
||||||
|
.WithTarget("Build")
|
||||||
|
.SetConfiguration(configuration));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// TARGETS
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Task("Default")
|
||||||
|
.IsDependentOn("Build");
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// EXECUTION
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
RunTarget(target);
|
||||||
133
samples/Click/sr2.click
Normal file
133
samples/Click/sr2.click
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
rates :: AvailableRates
|
||||||
|
elementclass sr2 {
|
||||||
|
$sr2_ip, $sr2_nm, $wireless_mac, $gateway, $probes|
|
||||||
|
|
||||||
|
|
||||||
|
arp :: ARPTable();
|
||||||
|
lt :: LinkTable(IP $sr2_ip);
|
||||||
|
|
||||||
|
|
||||||
|
gw :: SR2GatewaySelector(ETHTYPE 0x062c,
|
||||||
|
IP $sr2_ip,
|
||||||
|
ETH $wireless_mac,
|
||||||
|
LT lt,
|
||||||
|
ARP arp,
|
||||||
|
PERIOD 15,
|
||||||
|
GW $gateway);
|
||||||
|
|
||||||
|
|
||||||
|
gw -> SR2SetChecksum -> [0] output;
|
||||||
|
|
||||||
|
set_gw :: SR2SetGateway(SEL gw);
|
||||||
|
|
||||||
|
|
||||||
|
es :: SR2ETTStat(ETHTYPE 0x0641,
|
||||||
|
ETH $wireless_mac,
|
||||||
|
IP $sr2_ip,
|
||||||
|
PERIOD 30000,
|
||||||
|
TAU 300000,
|
||||||
|
ARP arp,
|
||||||
|
PROBES $probes,
|
||||||
|
ETT metric,
|
||||||
|
RT rates);
|
||||||
|
|
||||||
|
|
||||||
|
metric :: SR2ETTMetric(LT lt);
|
||||||
|
|
||||||
|
|
||||||
|
forwarder :: SR2Forwarder(ETHTYPE 0x0643,
|
||||||
|
IP $sr2_ip,
|
||||||
|
ETH $wireless_mac,
|
||||||
|
ARP arp,
|
||||||
|
LT lt);
|
||||||
|
|
||||||
|
|
||||||
|
querier :: SR2Querier(ETH $wireless_mac,
|
||||||
|
SR forwarder,
|
||||||
|
LT lt,
|
||||||
|
ROUTE_DAMPENING true,
|
||||||
|
TIME_BEFORE_SWITCH 5,
|
||||||
|
DEBUG true);
|
||||||
|
|
||||||
|
|
||||||
|
query_forwarder :: SR2MetricFlood(ETHTYPE 0x0644,
|
||||||
|
IP $sr2_ip,
|
||||||
|
ETH $wireless_mac,
|
||||||
|
LT lt,
|
||||||
|
ARP arp,
|
||||||
|
DEBUG false);
|
||||||
|
|
||||||
|
query_responder :: SR2QueryResponder(ETHTYPE 0x0645,
|
||||||
|
IP $sr2_ip,
|
||||||
|
ETH $wireless_mac,
|
||||||
|
LT lt,
|
||||||
|
ARP arp,
|
||||||
|
DEBUG true);
|
||||||
|
|
||||||
|
|
||||||
|
query_responder -> SR2SetChecksum -> [0] output;
|
||||||
|
query_forwarder -> SR2SetChecksum -> SR2Print(forwarding) -> [0] output;
|
||||||
|
query_forwarder [1] -> query_responder;
|
||||||
|
|
||||||
|
data_ck :: SR2SetChecksum()
|
||||||
|
|
||||||
|
input [1]
|
||||||
|
-> host_cl :: IPClassifier(dst net $sr2_ip mask $sr2_nm,
|
||||||
|
-)
|
||||||
|
-> querier
|
||||||
|
-> data_ck;
|
||||||
|
|
||||||
|
|
||||||
|
host_cl [1] -> [0] set_gw [0] -> querier;
|
||||||
|
|
||||||
|
forwarder[0]
|
||||||
|
-> dt ::DecIPTTL
|
||||||
|
-> data_ck
|
||||||
|
-> [2] output;
|
||||||
|
|
||||||
|
|
||||||
|
dt[1]
|
||||||
|
-> Print(ttl-error)
|
||||||
|
-> ICMPError($sr2_ip, timeexceeded, 0)
|
||||||
|
-> querier;
|
||||||
|
|
||||||
|
|
||||||
|
// queries
|
||||||
|
querier [1] -> [1] query_forwarder;
|
||||||
|
es -> SetTimestamp() -> [1] output;
|
||||||
|
|
||||||
|
|
||||||
|
forwarder[1] //ip packets to me
|
||||||
|
-> SR2StripHeader()
|
||||||
|
-> CheckIPHeader()
|
||||||
|
-> from_gw_cl :: IPClassifier(src net $sr2_ip mask $sr2_nm,
|
||||||
|
-)
|
||||||
|
-> [3] output;
|
||||||
|
|
||||||
|
from_gw_cl [1] -> [1] set_gw [1] -> [3] output;
|
||||||
|
|
||||||
|
input [0]
|
||||||
|
-> ncl :: Classifier(
|
||||||
|
12/0643 , //sr2_forwarder
|
||||||
|
12/0644 , //sr2
|
||||||
|
12/0645 , //replies
|
||||||
|
12/0641 , //sr2_es
|
||||||
|
12/062c , //sr2_gw
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ncl[0] -> SR2CheckHeader() -> [0] forwarder;
|
||||||
|
ncl[1] -> SR2CheckHeader() -> PrintSR(query) -> query_forwarder
|
||||||
|
ncl[2] -> SR2CheckHeader() -> query_responder;
|
||||||
|
ncl[3] -> es;
|
||||||
|
ncl[4] -> SR2CheckHeader() -> gw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Idle -> s :: sr2(2.0.0.1, 255.0.0.0, 00:00:00:00:00:01, false, "12 60 12 1500") -> Discard;
|
||||||
|
Idle -> [1] s;
|
||||||
|
s[1] -> Discard;
|
||||||
|
s[2] -> Discard;
|
||||||
|
s[3] -> Discard;
|
||||||
142
samples/Click/thomer-nat.click
Normal file
142
samples/Click/thomer-nat.click
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
// This Click configuration implements a firewall and NAT, roughly based on the
|
||||||
|
// mazu-nat.click example.
|
||||||
|
//
|
||||||
|
// This example assumes there is one interface that is IP-aliased. In this
|
||||||
|
// example, eth0 and eth0:0 have IP addresses 66.68.65.90 and 192.168.1.1,
|
||||||
|
// respectively. There is a local network, 192.168.1.0/24, and an upstream
|
||||||
|
// gateway, 66.58.65.89. Traffic from the local network is NATed.
|
||||||
|
//
|
||||||
|
// Connections can be initiated from the NAT box itself, also.
|
||||||
|
//
|
||||||
|
// For bugs, suggestions, and, corrections, please email me.
|
||||||
|
//
|
||||||
|
// Author: Thomer M. Gil (click@thomer.com)
|
||||||
|
|
||||||
|
AddressInfo(
|
||||||
|
eth0-in 192.168.1.1 192.168.1.0/24 00:0d:87:9d:1c:e9,
|
||||||
|
eth0-ex 66.58.65.90 00:0d:87:9d:1c:e9,
|
||||||
|
gw-addr 66.58.65.89 00:20:6f:14:54:c2
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
elementclass SniffGatewayDevice {
|
||||||
|
$device |
|
||||||
|
from :: FromDevice($device)
|
||||||
|
-> t1 :: Tee
|
||||||
|
-> output;
|
||||||
|
input -> q :: Queue(1024)
|
||||||
|
-> t2 :: PullTee
|
||||||
|
-> to :: ToDevice($device);
|
||||||
|
t1[1] -> ToHostSniffers;
|
||||||
|
t2[1] -> ToHostSniffers($device);
|
||||||
|
ScheduleInfo(from .1, to 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
device :: SniffGatewayDevice(eth0);
|
||||||
|
arpq_in :: ARPQuerier(eth0-in) -> device;
|
||||||
|
ip_to_extern :: GetIPAddress(16)
|
||||||
|
-> CheckIPHeader
|
||||||
|
-> EtherEncap(0x800, eth0-ex, gw-addr)
|
||||||
|
-> device;
|
||||||
|
ip_to_host :: EtherEncap(0x800, gw-addr, eth0-ex)
|
||||||
|
-> ToHost;
|
||||||
|
ip_to_intern :: GetIPAddress(16)
|
||||||
|
-> CheckIPHeader
|
||||||
|
-> arpq_in;
|
||||||
|
|
||||||
|
|
||||||
|
arp_class :: Classifier(
|
||||||
|
12/0806 20/0001, // [0] ARP requests
|
||||||
|
12/0806 20/0002, // [1] ARP replies to host
|
||||||
|
12/0800); // [2] IP packets
|
||||||
|
|
||||||
|
device -> arp_class;
|
||||||
|
|
||||||
|
// ARP crap
|
||||||
|
arp_class[0] -> ARPResponder(eth0-in, eth0-ex) -> device;
|
||||||
|
arp_class[1] -> arp_t :: Tee;
|
||||||
|
arp_t[0] -> ToHost;
|
||||||
|
arp_t[1] -> [1]arpq_in;
|
||||||
|
|
||||||
|
|
||||||
|
// IP packets
|
||||||
|
arp_class[2] -> Strip(14)
|
||||||
|
-> CheckIPHeader
|
||||||
|
-> ipclass :: IPClassifier(dst host eth0-ex,
|
||||||
|
dst host eth0-in,
|
||||||
|
src net eth0-in);
|
||||||
|
|
||||||
|
// Define pattern NAT
|
||||||
|
iprw :: IPRewriterPatterns(NAT eth0-ex 50000-65535 - -);
|
||||||
|
|
||||||
|
// Rewriting rules for UDP/TCP packets
|
||||||
|
// output[0] rewritten to go into the wild
|
||||||
|
// output[1] rewritten to come back from the wild or no match
|
||||||
|
rw :: IPRewriter(pattern NAT 0 1,
|
||||||
|
pass 1);
|
||||||
|
|
||||||
|
// Rewriting rules for ICMP packets
|
||||||
|
irw :: ICMPPingRewriter(eth0-ex, -);
|
||||||
|
irw[0] -> ip_to_extern;
|
||||||
|
irw[1] -> icmp_me_or_intern :: IPClassifier(dst host eth0-ex, -);
|
||||||
|
icmp_me_or_intern[0] -> ip_to_host;
|
||||||
|
icmp_me_or_intern[1] -> ip_to_intern;
|
||||||
|
|
||||||
|
// Rewriting rules for ICMP error packets
|
||||||
|
ierw :: ICMPRewriter(rw irw);
|
||||||
|
ierw[0] -> icmp_me_or_intern;
|
||||||
|
ierw[1] -> icmp_me_or_intern;
|
||||||
|
|
||||||
|
|
||||||
|
// Packets directed at eth0-ex.
|
||||||
|
// Send it through IPRewriter(pass). If there was a mapping, it will be
|
||||||
|
// rewritten such that dst is eth0-in:net, otherwise dst will still be for
|
||||||
|
// eth0-ex.
|
||||||
|
ipclass[0] -> [1]rw;
|
||||||
|
|
||||||
|
// packets that were rewritten, heading into the wild world.
|
||||||
|
rw[0] -> ip_to_extern;
|
||||||
|
|
||||||
|
// packets that come back from the wild or are not part of an established
|
||||||
|
// connection.
|
||||||
|
rw[1] -> established_class :: IPClassifier(dst host eth0-ex,
|
||||||
|
dst net eth0-in);
|
||||||
|
|
||||||
|
// not established yet or returning packets for a connection that was
|
||||||
|
// established from this host itself.
|
||||||
|
established_class[0] ->
|
||||||
|
firewall :: IPClassifier(dst tcp port ssh,
|
||||||
|
dst tcp port smtp,
|
||||||
|
dst tcp port domain,
|
||||||
|
dst udp port domain,
|
||||||
|
icmp type echo-reply,
|
||||||
|
proto icmp,
|
||||||
|
port > 4095,
|
||||||
|
-);
|
||||||
|
|
||||||
|
firewall[0] -> ip_to_host; // ssh
|
||||||
|
firewall[1] -> ip_to_host; // smtp
|
||||||
|
firewall[2] -> ip_to_host; // domain (t)
|
||||||
|
firewall[3] -> ip_to_host; // domain (u)
|
||||||
|
firewall[4] -> [0]irw; // icmp reply
|
||||||
|
firewall[5] -> [0]ierw; // other icmp
|
||||||
|
firewall[6] -> ip_to_host; // port > 4095, probably for connection
|
||||||
|
// originating from host itself
|
||||||
|
firewall[7] -> Discard; // don't allow incoming for port <= 4095
|
||||||
|
|
||||||
|
// established connection
|
||||||
|
established_class[1] -> ip_to_intern;
|
||||||
|
|
||||||
|
// To eth0-in. Only accept from inside network.
|
||||||
|
ipclass[1] -> IPClassifier(src net eth0-in) -> ip_to_host;
|
||||||
|
|
||||||
|
// Packets from eth0-in:net either stay on local network or go to the wild.
|
||||||
|
// Those that go into the wild need to go through the appropriate rewriting
|
||||||
|
// element. (Either UDP/TCP rewriter or ICMP rewriter.)
|
||||||
|
ipclass[2] -> inter_class :: IPClassifier(dst net eth0-in, -);
|
||||||
|
inter_class[0] -> ip_to_intern;
|
||||||
|
inter_class[1] -> ip_udp_class :: IPClassifier(tcp or udp,
|
||||||
|
icmp type echo);
|
||||||
|
ip_udp_class[0] -> [0]rw;
|
||||||
|
ip_udp_class[1] -> [0]irw;
|
||||||
17
samples/CoffeeScript/build.cake
Normal file
17
samples/CoffeeScript/build.cake
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
fs = require 'fs'
|
||||||
|
|
||||||
|
{print} = require 'sys'
|
||||||
|
{spawn} = require 'child_process'
|
||||||
|
|
||||||
|
build = (callback) ->
|
||||||
|
coffee = spawn 'coffee', ['-c', '-o', '.', '.']
|
||||||
|
coffee.stderr.on 'data', (data) ->
|
||||||
|
process.stderr.write data.toString()
|
||||||
|
coffee.stdout.on 'data', (data) ->
|
||||||
|
print data.toString()
|
||||||
|
coffee.on 'exit', (code) ->
|
||||||
|
callback?() if code is 0
|
||||||
|
|
||||||
|
task 'build', 'Build from source', ->
|
||||||
|
build()
|
||||||
|
|
||||||
3608
samples/Formatted/NiAlH_jea.eam.fs
Normal file
3608
samples/Formatted/NiAlH_jea.eam.fs
Normal file
File diff suppressed because it is too large
Load Diff
210
samples/Jupyter Notebook/JupyterNotebook.ipynb
Normal file
210
samples/Jupyter Notebook/JupyterNotebook.ipynb
Normal file
File diff suppressed because one or more lines are too long
29
samples/MAXScript/macro-1.mcr
Normal file
29
samples/MAXScript/macro-1.mcr
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
-- Taken from an example from Autodesk's MAXScript reference:
|
||||||
|
-- http://help.autodesk.com/view/3DSMAX/2016/ENU/?guid=__files_GUID_84E24969_C175_4389_B9A6_3B2699B66785_htm
|
||||||
|
|
||||||
|
macroscript MoveToSurface
|
||||||
|
category: "HowTo"
|
||||||
|
(
|
||||||
|
fn g_filter o = superclassof o == Geometryclass
|
||||||
|
fn find_intersection z_node node_to_z = (
|
||||||
|
local testRay = ray node_to_z.pos [0,0,-1]
|
||||||
|
local nodeMaxZ = z_node.max.z
|
||||||
|
testRay.pos.z = nodeMaxZ + 0.0001 * abs nodeMaxZ
|
||||||
|
intersectRay z_node testRay
|
||||||
|
)
|
||||||
|
|
||||||
|
on isEnabled return selection.count > 0
|
||||||
|
|
||||||
|
on Execute do (
|
||||||
|
target_mesh = pickObject message:"Pick Target Surface:" filter:g_filter
|
||||||
|
|
||||||
|
if isValidNode target_mesh then (
|
||||||
|
undo "MoveToSurface" on (
|
||||||
|
for i in selection do (
|
||||||
|
int_point = find_intersection target_mesh i
|
||||||
|
if int_point != undefined then i.pos = int_point.pos
|
||||||
|
)--end i loop
|
||||||
|
)--end undo
|
||||||
|
)--end if
|
||||||
|
)--end execute
|
||||||
|
)--end script
|
||||||
53
samples/MAXScript/macro-2.mcr
Normal file
53
samples/MAXScript/macro-2.mcr
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
-- Taken from an example from Autodesk's MAXScript reference:
|
||||||
|
-- http://help.autodesk.com/view/3DSMAX/2016/ENU/?guid=__files_GUID_0876DF46_FAA3_4131_838D_5739A67FF2C1_htm
|
||||||
|
|
||||||
|
macroscript FreeSpline category:"HowTo" tooltip:"FreeSpline" (
|
||||||
|
local old_pos
|
||||||
|
local new_spline
|
||||||
|
local second_knot_set
|
||||||
|
|
||||||
|
fn get_mouse_pos pen_pos old_pen_pos = (
|
||||||
|
if old_pos == undefined then old_pos = old_pen_pos
|
||||||
|
if distance pen_pos old_pos > 10 then
|
||||||
|
(
|
||||||
|
if second_knot_set then
|
||||||
|
addKnot new_spline 1 #smooth #curve pen_pos
|
||||||
|
else
|
||||||
|
(
|
||||||
|
setKnotPoint new_spline 1 2 pen_pos
|
||||||
|
second_knot_set = true
|
||||||
|
)
|
||||||
|
old_pos = pen_pos
|
||||||
|
updateShape new_spline
|
||||||
|
)-- end if
|
||||||
|
)-- end fn
|
||||||
|
|
||||||
|
fn draw_new_line old_pen_pos = (
|
||||||
|
pickPoint mouseMoveCallback:#(get_mouse_pos,old_pen_pos)
|
||||||
|
)
|
||||||
|
|
||||||
|
undo"Free Spline"on(
|
||||||
|
new_spline = splineShape ()
|
||||||
|
old_pen_pos = pickPoint ()
|
||||||
|
|
||||||
|
if old_pen_pos == #RightClick then
|
||||||
|
delete new_spline
|
||||||
|
else
|
||||||
|
(
|
||||||
|
select new_spline
|
||||||
|
new_spline.pos = old_pen_pos
|
||||||
|
addNewSpline new_spline
|
||||||
|
addKnot new_spline 1 #smooth #curve old_pen_pos
|
||||||
|
addKnot new_spline 1 #smooth #curve old_pen_pos
|
||||||
|
second_knot_set = false
|
||||||
|
draw_new_line old_pen_pos
|
||||||
|
q = querybox "Close Spline?" title:"Free Spline"
|
||||||
|
if q then
|
||||||
|
(
|
||||||
|
close new_spline 1
|
||||||
|
updateshape new_spline
|
||||||
|
)
|
||||||
|
select new_spline
|
||||||
|
)--end else
|
||||||
|
)--end undo
|
||||||
|
)--end script
|
||||||
64
samples/MAXScript/svg-renderer.ms
Normal file
64
samples/MAXScript/svg-renderer.ms
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
-- Taken from a 3-part tutorial from Autodesk's MAXScript reference
|
||||||
|
-- Source: http://help.autodesk.com/view/3DSMAX/2016/ENU/?guid=__files_GUID_6B5EDC11_A154_4AA7_A972_A11AC36949E9_htm
|
||||||
|
|
||||||
|
fn ColourToHex col = (
|
||||||
|
local theComponents = #(bit.intAsHex col.r, bit.intAsHex col.g, bit.intAsHex col.b)
|
||||||
|
local theValue = "#"
|
||||||
|
for i in theComponents do
|
||||||
|
theValue += (if i.count == 1 then "0" else "") + i
|
||||||
|
theValue
|
||||||
|
)
|
||||||
|
|
||||||
|
local st = timestamp()
|
||||||
|
local theFileName = (getDir #userscripts + "\\PolygonRendering3.svg")
|
||||||
|
local theSVGfile = createFile theFileName
|
||||||
|
format "<svg xmlns=\"http://www.w3.org/2000/svg\"\n" to:theSVGfile
|
||||||
|
format "\t\txmlns:xlink=\"http://www.w3.org/1999/xlink\">\n" to:theSVGfile
|
||||||
|
|
||||||
|
local theViewTM = viewport.getTM()
|
||||||
|
theViewTM.row4 = [0,0,0]
|
||||||
|
|
||||||
|
local theViewTM2 = viewport.getTM()
|
||||||
|
local theViewSize = getViewSize()
|
||||||
|
local theViewScale = getViewSize()
|
||||||
|
theViewScale.x /= 1024.0
|
||||||
|
theViewScale.y /= 1024.0
|
||||||
|
|
||||||
|
local theStrokeThickness = 3
|
||||||
|
|
||||||
|
gw.setTransform (matrix3 1)
|
||||||
|
for o in Geometry where not o.isHiddenInVpt and classof o != TargetObject do (
|
||||||
|
local theStrokeColour = white
|
||||||
|
local theFillColour = o.wirecolor
|
||||||
|
|
||||||
|
local theMesh = snapshotAsMesh o
|
||||||
|
for f = 1 to theMesh.numfaces do (
|
||||||
|
local theNormal = normalize (getFaceNormal theMesh f)
|
||||||
|
|
||||||
|
if (theNormal*theViewTM).z > 0 do
|
||||||
|
(
|
||||||
|
local theFace = getFace theMesh f
|
||||||
|
local v1 = gw.transPoint (getVert theMesh theFace.x)
|
||||||
|
local v2 = gw.transPoint (getVert theMesh theFace.y)
|
||||||
|
local v3 = gw.transPoint (getVert theMesh theFace.z)
|
||||||
|
|
||||||
|
v1.x /= theViewScale.x
|
||||||
|
v1.y /= theViewScale.y
|
||||||
|
v2.x /= theViewScale.x
|
||||||
|
v2.y /= theViewScale.y
|
||||||
|
v3.x /= theViewScale.x
|
||||||
|
v3.y /= theViewScale.y
|
||||||
|
|
||||||
|
format "\t<polygon points='%,% %,% %,%' \n" v1.x v1.y v2.x v2.y v3.x v3.y to:theSVGfile
|
||||||
|
format "\tstyle='stroke:%; fill:%; stroke-width:%'/>\n" (ColourToHex theStrokeColour) (ColourToHex theFillColour) theStrokeThickness to:theSVGfile
|
||||||
|
)--end if normal positive
|
||||||
|
)--end f loop
|
||||||
|
)--end o loop
|
||||||
|
|
||||||
|
format "</svg>\n" to:theSVGfile
|
||||||
|
close theSVGfile
|
||||||
|
local theSVGMap = VectorMap vectorFile:theFileName alphasource:0
|
||||||
|
local theBitmap = bitmap theViewSize.x theViewSize.y
|
||||||
|
renderMap theSVGMap into:theBitmap filter:true
|
||||||
|
display theBitmap
|
||||||
|
format "Render Time: % sec.\n" ((timestamp()-st)/1000.0)
|
||||||
22
samples/MAXScript/volume-calc.ms
Normal file
22
samples/MAXScript/volume-calc.ms
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
fn CalculateVolumeAndCentreOfMass obj =
|
||||||
|
(
|
||||||
|
local Volume= 0.0
|
||||||
|
local Centre= [0.0, 0.0, 0.0]
|
||||||
|
local theMesh = snapshotasmesh obj
|
||||||
|
local numFaces = theMesh.numfaces
|
||||||
|
for i = 1 to numFaces do
|
||||||
|
(
|
||||||
|
local Face= getFace theMesh i
|
||||||
|
local vert2 = getVert theMesh Face.z
|
||||||
|
local vert1 = getVert theMesh Face.y
|
||||||
|
local vert0 = getVert theMesh Face.x
|
||||||
|
local dV = Dot (Cross (vert1 - vert0) (vert2 - vert0)) vert0
|
||||||
|
Volume+= dV
|
||||||
|
Centre+= (vert0 + vert1 + vert2) * dV
|
||||||
|
)
|
||||||
|
delete theMesh
|
||||||
|
Volume /= 6
|
||||||
|
Centre /= 24
|
||||||
|
Centre /= Volume
|
||||||
|
#(Volume,Centre)
|
||||||
|
)
|
||||||
24
samples/Pickle/data.pkl
Normal file
24
samples/Pickle/data.pkl
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
(dp0
|
||||||
|
S'a'
|
||||||
|
p1
|
||||||
|
(lp2
|
||||||
|
I1
|
||||||
|
aF2.0
|
||||||
|
aI3
|
||||||
|
ac__builtin__
|
||||||
|
complex
|
||||||
|
p3
|
||||||
|
(F4.0
|
||||||
|
F6.0
|
||||||
|
tp4
|
||||||
|
Rp5
|
||||||
|
asS'c'
|
||||||
|
p6
|
||||||
|
NsS'b'
|
||||||
|
p7
|
||||||
|
(S'string'
|
||||||
|
p8
|
||||||
|
VUnicode string
|
||||||
|
p9
|
||||||
|
tp10
|
||||||
|
s.
|
||||||
60
samples/Pickle/neural-network-ce-l2reg-784-10-30.pkl
Normal file
60
samples/Pickle/neural-network-ce-l2reg-784-10-30.pkl
Normal file
File diff suppressed because one or more lines are too long
36
samples/Pickle/random.pkl
Normal file
36
samples/Pickle/random.pkl
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
cnumpy.core.multiarray
|
||||||
|
_reconstruct
|
||||||
|
p0
|
||||||
|
(cnumpy
|
||||||
|
ndarray
|
||||||
|
p1
|
||||||
|
(I0
|
||||||
|
tp2
|
||||||
|
S'b'
|
||||||
|
p3
|
||||||
|
tp4
|
||||||
|
Rp5
|
||||||
|
(I1
|
||||||
|
(I100
|
||||||
|
tp6
|
||||||
|
cnumpy
|
||||||
|
dtype
|
||||||
|
p7
|
||||||
|
(S'f8'
|
||||||
|
p8
|
||||||
|
I0
|
||||||
|
I1
|
||||||
|
tp9
|
||||||
|
Rp10
|
||||||
|
(I3
|
||||||
|
S'<'
|
||||||
|
p11
|
||||||
|
NNNI-1
|
||||||
|
I-1
|
||||||
|
I0
|
||||||
|
tp12
|
||||||
|
bI00
|
||||||
|
S'\x1cc~\xc3\xa7r\xed?\xe5${\xec\xd6\xcd\xed?\x809-\x02%\xa9\xa2?F\x0f\x1d\xe8\xef\xa3\xdb?\xfe\xd1\x0c\xb7\x83\x13\xef?\xe0<o\xa1\xa9^\xdf?CE\x96\x88/o\xe2?<\xd8\xa1\x96\xa2T\xce?\x152\x8e\xe5\xa8\x7f\xe8?\xe4\xb7\x9a\xe0$\x0f\xdc?\x90\xe4\xe2\xd4=\xce\xc3?Ix\xe3P\xc4C\xe1?\x16\xd17\xc1Y\xfc\xed?5\xd7\xae@4\xfa\xe8?\x0f\x87\x8d>\xfcO\xe5?Y\x97\xcb"\xa7%\xe7?\x9b\x8d\x16\xda\x97\xe1\xeb?T\x14\xbd\xfe|\xf4\xd0?\x18\xdfH\xc56A\xba?\x90\xc5\xfb\xc63:\xe5?\xbf%\xad\xe5.\x86\xe9?\xc6\x0c\xa9\x8c\xd7\xd5\xe9?\xf8\xafc:\x84g\xd7?\xf8\x98\x879\x9a\x16\xee?\xba\xdf\x88\x8az\x06\xe2?~g-\xeb\xc8\xed\xee?\x08A\xcc\x8c\xe7>\xef?\xceD\xc4ar\n\xdc?\x92w\xbb\xa34\xb1\xd9?\x88\xb9\xc0{u\xa3\xdc?d\x1a\xad\xe8\xf3\x14\xdd?\x9c\x95\x13\x96o?\xe5?\x9cT[\xb8r\xa9\xe5?0\xf1\x01+(\x0f\xdf?W\xbdjqD&\xed?c\xcf1-W\xe6\xe1?\xce\xbc\xe1{zW\xd9?"d\xcf\xd7\x13\x93\xde?\xf2P\xf6\xc3\xd6\x87\xd5?\xc2\x0e\x92q\x89\xda\xd5?\xc0:B\x1bb\x00\x9e?Y\xafHmr\x80\xe3?\x1co\xa7\xba\xa5/\xe4?\xa2\xbc \x9c\xddB\xd0?\xd2L\x935\x17\'\xee?|\x8cM\xeb\x97=\xe8?\x0f0xN*V\xea?\x81p\xe3,!\xf2\xee?\xf5w\xed\x10\x9eu\xe0?\xc5\x16\\LR\xb5\xe1?\xbeh\x04\xa4g\xe5\xd6?\xea\xc0\xb9\xf0\xb2\xd8\xd9?\xac\x9c\xeep\x1a\xa9\xd8?@W9hp\x16\xb1?\xc4\xedS\xd6V\xa1\xed?\x93,!\xdc\xa1\x8b\xe9?\x80)\xb1\xa6[T\xc9?\xac\xbc\x8a\xd21\xdd\xc5?\x80\x9c.g\xf1\xf2\xc6?\tLu\xc3\xf7U\xe9?n\'\x9f?\xbe\xf9\xe9?\xa3\xe7K\x1c\xb3\xa9\xea?X\x98\x1a\xcb\xa0\xcd\xd3? \xb6O\x9c\x1bQ\xc2?"\x89[\xad1\x8e\xea?\xdd\x8f\xa0P\xc7\x0e\xe2?c\xa4j\xa3\r\xac\xef?\xba\xb6\x0f\x8emo\xef?\xe0\xed\xa0\xc5R9\xab?U\xf1\xcd\xcf\xbf\xcb\xea?\x89*#\x06\xb0|\xe8?d\xa3\xad\xcd\xe0]\xcc?\xb5\xe78\xa7w\x13\xe3?\xce\x99\x98\xefS%\xd7?\xb1\xf8\xd8\x8eI\x13\xef?\x91`]\x93\xd4 \xec?\xc0\rPz\xee\xbd\xe7?7\x92\xd4\x0fP\x8f\xe1?L\x0f\xaf\xa9\xc3\x19\xdd?\\}\x15X\x870\xc7? ~ t\xcat\xb1?@?\xec\x97u\x05\xe9?F\x8d:\xac4D\xdb?qY\xe1Qk|\xe2? \xaf\xeaj\xa5\x04\xab?J[\x1al;\x00\xd5?\x00^{n\xc2\xf1S?\xb0\x82dN\xda\xb5\xc7?\xe0 \x07\xe1?R\x92?\xc4\r\x08+\x99J\xe1?I|&U\x19\xc4\xe1?|*\xf9\xebq\x7f\xed?\xbc*\x93\x89k\xab\xe9?oiL\x90;\xe0\xef?\x96\xcd\x9b\xff\x18g\xdc?pt\xb4\xa5\x9c\xa2\xbc?Nu]w*\xb7\xd2?\x88k\xac\xd0\xfd\xbf\xd5?Q\x02$b\xfeH\xea?5\xf6\t\xb6K\x1a\xee?'
|
||||||
|
p13
|
||||||
|
tp14
|
||||||
|
b.
|
||||||
10
samples/Pickle/save.pkl
Normal file
10
samples/Pickle/save.pkl
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
(dp0
|
||||||
|
S'lion'
|
||||||
|
p1
|
||||||
|
S'yellow'
|
||||||
|
p2
|
||||||
|
sS'kitty'
|
||||||
|
p3
|
||||||
|
S'red'
|
||||||
|
p4
|
||||||
|
s.
|
||||||
79
samples/UrWeb/iso8601.ur
Normal file
79
samples/UrWeb/iso8601.ur
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
open Parse.String
|
||||||
|
|
||||||
|
val digit = satisfy isdigit
|
||||||
|
|
||||||
|
val decimal_of_len n =
|
||||||
|
ds <- count n digit;
|
||||||
|
return (List.foldl (fn d acc => 10*acc + ((ord d)-(ord #"0"))) 0 ds)
|
||||||
|
|
||||||
|
val date =
|
||||||
|
y <- decimal_of_len 4;
|
||||||
|
char' #"-";
|
||||||
|
m <- decimal_of_len 2;
|
||||||
|
char' #"-";
|
||||||
|
d <- decimal_of_len 2;
|
||||||
|
if m > 0 && m <= 12 then
|
||||||
|
return {Year=y, Month=(Datetime.intToMonth (m-1)), Day=d}
|
||||||
|
else
|
||||||
|
fail
|
||||||
|
|
||||||
|
(* We parse fractions of a second, but ignore them since Datetime
|
||||||
|
doesn't permit representing them. *)
|
||||||
|
val time =
|
||||||
|
h <- decimal_of_len 2;
|
||||||
|
char' #":";
|
||||||
|
m <- decimal_of_len 2;
|
||||||
|
s <- maybe (char' #":";
|
||||||
|
s <- decimal_of_len 2;
|
||||||
|
maybe' (char' #"."; skipWhile isdigit);
|
||||||
|
return s);
|
||||||
|
return {Hour=h, Minute=m, Second=Option.get 0 s}
|
||||||
|
|
||||||
|
val timezone_offset =
|
||||||
|
let val zulu = char' #"Z"; return 0
|
||||||
|
val digits = decimal_of_len 2
|
||||||
|
val sign = or (char' #"+"; return 1)
|
||||||
|
(char' #"-"; return (-1))
|
||||||
|
in
|
||||||
|
zulu `or` (s <- sign;
|
||||||
|
h <- digits;
|
||||||
|
m <- (maybe' (char' #":"); or digits (return 0));
|
||||||
|
return (s*(h*60+m)))
|
||||||
|
end
|
||||||
|
|
||||||
|
val datetime_with_tz =
|
||||||
|
d <- date; char' #"T"; t <- time;
|
||||||
|
tz <- timezone_offset;
|
||||||
|
return (d ++ t ++ {TZOffsetMinutes=tz})
|
||||||
|
|
||||||
|
val datetime =
|
||||||
|
d <- datetime_with_tz;
|
||||||
|
return (d -- #TZOffsetMinutes)
|
||||||
|
|
||||||
|
fun process v =
|
||||||
|
case parse (d <- datetime_with_tz; eof; return d) v of
|
||||||
|
Some r =>
|
||||||
|
let
|
||||||
|
val {Year=year,Month=month,Day=day,
|
||||||
|
Hour=hour,Minute=minute,Second=second} =
|
||||||
|
Datetime.addMinutes (r.TZOffsetMinutes) (r -- #TZOffsetMinutes)
|
||||||
|
fun pad x =
|
||||||
|
if x < 10 then "0" `strcat` show x else show x
|
||||||
|
in
|
||||||
|
<xml>{[pad hour]}:{[pad minute]}:{[pad second]} {[month]} {[day]}, {[year]}</xml>
|
||||||
|
end
|
||||||
|
| None => <xml>none</xml>
|
||||||
|
|
||||||
|
fun main () : transaction page =
|
||||||
|
input <- source "2012-01-01T01:10:42Z";
|
||||||
|
return <xml>
|
||||||
|
<body>
|
||||||
|
<label>
|
||||||
|
Enter an
|
||||||
|
<a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a>
|
||||||
|
datetime here:
|
||||||
|
<ctextbox source={input} />
|
||||||
|
</label>
|
||||||
|
<ul><dyn signal={v <- signal input; return (process v)} /></ul>
|
||||||
|
</body>
|
||||||
|
</xml>
|
||||||
85
samples/UrWeb/parse.urs
Normal file
85
samples/UrWeb/parse.urs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
functor Make(Stream : sig type t end) : sig
|
||||||
|
con t :: Type -> Type
|
||||||
|
|
||||||
|
val mreturn : a ::: Type -> a -> t a
|
||||||
|
val mbind : a ::: Type -> b ::: Type ->
|
||||||
|
(t a) -> (a -> t b) -> (t b)
|
||||||
|
val monad_parse : monad t
|
||||||
|
|
||||||
|
val parse : a ::: Type -> t a -> Stream.t -> option a
|
||||||
|
|
||||||
|
(** Combinators *)
|
||||||
|
val fail : a ::: Type -> t a
|
||||||
|
val or : a ::: Type -> t a -> t a -> t a
|
||||||
|
val maybe : a ::: Type -> t a -> t (option a)
|
||||||
|
val maybe' : a ::: Type -> t a -> t unit
|
||||||
|
val many : a ::: Type -> t a -> t (list a)
|
||||||
|
val count : a ::: Type -> int -> t a -> t (list a)
|
||||||
|
val skipMany : a ::: Type -> t a -> t unit
|
||||||
|
val sepBy : a ::: Type -> s ::: Type -> t a -> t s -> t (list a)
|
||||||
|
end
|
||||||
|
|
||||||
|
structure String : sig
|
||||||
|
con t :: Type -> Type
|
||||||
|
val monad_parse : monad t
|
||||||
|
|
||||||
|
val parse : a ::: Type -> t a -> string -> option a
|
||||||
|
|
||||||
|
(** Combinators *)
|
||||||
|
val fail : a ::: Type -> t a
|
||||||
|
val or : a ::: Type -> t a -> t a -> t a
|
||||||
|
val maybe : a ::: Type -> t a -> t (option a)
|
||||||
|
val maybe' : a ::: Type -> t a -> t unit
|
||||||
|
val many : a ::: Type -> t a -> t (list a)
|
||||||
|
val count : a ::: Type -> int -> t a -> t (list a)
|
||||||
|
val skipMany : a ::: Type -> t a -> t unit
|
||||||
|
val sepBy : a ::: Type -> s ::: Type -> t a -> t s -> t (list a)
|
||||||
|
|
||||||
|
val eof : t unit
|
||||||
|
(* We provide alternative versions of some of these predicates
|
||||||
|
* that return t unit as a monadic syntactical convenience. *)
|
||||||
|
val string : string -> t string
|
||||||
|
val string' : string -> t unit
|
||||||
|
val stringCI : string -> t string
|
||||||
|
val stringCI' : string -> t unit
|
||||||
|
val char : char -> t char
|
||||||
|
val char' : char -> t unit
|
||||||
|
val take : int -> t (string*int)
|
||||||
|
val drop : int -> t unit
|
||||||
|
val satisfy : (char -> bool) -> t char
|
||||||
|
val skip : (char -> bool) -> t unit
|
||||||
|
val skipWhile : (char -> bool) -> t unit
|
||||||
|
val takeWhile : (char -> bool) -> t (string*int)
|
||||||
|
val takeWhile' : (char -> bool) -> t string (* conses *)
|
||||||
|
(* Well, "till" is the correct form; but "til" is in common enough
|
||||||
|
* usage that I'll prefer it for terseness. *)
|
||||||
|
val takeTil : (char -> bool) -> t (string*int)
|
||||||
|
val takeTil' : (char -> bool) -> t string (* conses *)
|
||||||
|
val takeRest : t string
|
||||||
|
|
||||||
|
(** Convenience functions *)
|
||||||
|
val skipSpace : t unit
|
||||||
|
val endOfLine : t unit
|
||||||
|
val unsigned_int_of_radix : int -> t int
|
||||||
|
(*
|
||||||
|
* val signed_int_of_radix : int -> t int
|
||||||
|
* val double : t float
|
||||||
|
*)
|
||||||
|
end
|
||||||
|
|
||||||
|
structure Blob : sig
|
||||||
|
con t :: Type -> Type
|
||||||
|
val monad_parse : monad t
|
||||||
|
|
||||||
|
val parse : a ::: Type -> t a -> blob -> option a
|
||||||
|
|
||||||
|
(** Combinators *)
|
||||||
|
val fail : a ::: Type -> t a
|
||||||
|
val or : a ::: Type -> t a -> t a -> t a
|
||||||
|
val maybe : a ::: Type -> t a -> t (option a)
|
||||||
|
val maybe' : a ::: Type -> t a -> t unit
|
||||||
|
val many : a ::: Type -> t a -> t (list a)
|
||||||
|
val count : a ::: Type -> int -> t a -> t (list a)
|
||||||
|
val skipMany : a ::: Type -> t a -> t unit
|
||||||
|
val sepBy : a ::: Type -> s ::: Type -> t a -> t s -> t (list a)
|
||||||
|
end
|
||||||
2
vendor/grammars/AutoHotkey
vendored
2
vendor/grammars/AutoHotkey
vendored
Submodule vendor/grammars/AutoHotkey updated: 8a9bb55597...77b8f2d785
2
vendor/grammars/Elm.tmLanguage
vendored
2
vendor/grammars/Elm.tmLanguage
vendored
Submodule vendor/grammars/Elm.tmLanguage updated: f17b1914dd...ab79692fed
2
vendor/grammars/InnoSetup
vendored
2
vendor/grammars/InnoSetup
vendored
Submodule vendor/grammars/InnoSetup updated: 2853a397c7...9da37ae690
2
vendor/grammars/NimLime
vendored
2
vendor/grammars/NimLime
vendored
Submodule vendor/grammars/NimLime updated: 7aea8846e1...4e60e5657f
2
vendor/grammars/SublimeClarion
vendored
2
vendor/grammars/SublimeClarion
vendored
Submodule vendor/grammars/SublimeClarion updated: f070aadd26...5823e7f447
1
vendor/grammars/UrWeb-Language-Definition
vendored
Submodule
1
vendor/grammars/UrWeb-Language-Definition
vendored
Submodule
Submodule vendor/grammars/UrWeb-Language-Definition added at cd47cc7891
2
vendor/grammars/abap.tmbundle
vendored
2
vendor/grammars/abap.tmbundle
vendored
Submodule vendor/grammars/abap.tmbundle updated: 8ab33a8978...5b7e30fd8f
2
vendor/grammars/atom-fsharp
vendored
2
vendor/grammars/atom-fsharp
vendored
Submodule vendor/grammars/atom-fsharp updated: eb5553c3b9...500cdb5f04
2
vendor/grammars/atom-language-purescript
vendored
2
vendor/grammars/atom-language-purescript
vendored
Submodule vendor/grammars/atom-language-purescript updated: 5fd5b6460e...21ed0c417a
2
vendor/grammars/carto-atom
vendored
2
vendor/grammars/carto-atom
vendored
Submodule vendor/grammars/carto-atom updated: 9895909323...08a80dc54a
2
vendor/grammars/cmake.tmbundle
vendored
2
vendor/grammars/cmake.tmbundle
vendored
Submodule vendor/grammars/cmake.tmbundle updated: 926867a414...1421c6ba47
2
vendor/grammars/elixir-tmbundle
vendored
2
vendor/grammars/elixir-tmbundle
vendored
Submodule vendor/grammars/elixir-tmbundle updated: 25bf933246...4b502e436d
2
vendor/grammars/factor
vendored
2
vendor/grammars/factor
vendored
Submodule vendor/grammars/factor updated: a97f840daa...9d95602591
2
vendor/grammars/fancy-tmbundle
vendored
2
vendor/grammars/fancy-tmbundle
vendored
Submodule vendor/grammars/fancy-tmbundle updated: d48b6100cc...c9cdcd61f5
2
vendor/grammars/haskell.tmbundle
vendored
2
vendor/grammars/haskell.tmbundle
vendored
Submodule vendor/grammars/haskell.tmbundle updated: c3137ccc28...df3d54278a
2
vendor/grammars/html.tmbundle
vendored
2
vendor/grammars/html.tmbundle
vendored
Submodule vendor/grammars/html.tmbundle updated: 181a15de24...a0bc0c479b
2
vendor/grammars/jade-tmbundle
vendored
2
vendor/grammars/jade-tmbundle
vendored
Submodule vendor/grammars/jade-tmbundle updated: 6cde1da688...d27b61d178
2
vendor/grammars/json.tmbundle
vendored
2
vendor/grammars/json.tmbundle
vendored
Submodule vendor/grammars/json.tmbundle updated: 4100e5b016...06b38d5532
2
vendor/grammars/language-babel
vendored
2
vendor/grammars/language-babel
vendored
Submodule vendor/grammars/language-babel updated: b555180508...4b0e9658e0
1
vendor/grammars/language-click
vendored
Submodule
1
vendor/grammars/language-click
vendored
Submodule
Submodule vendor/grammars/language-click added at 1ee1fe012b
2
vendor/grammars/language-clojure
vendored
2
vendor/grammars/language-clojure
vendored
Submodule vendor/grammars/language-clojure updated: 3173abe995...12b73d41a0
2
vendor/grammars/language-coffee-script
vendored
2
vendor/grammars/language-coffee-script
vendored
Submodule vendor/grammars/language-coffee-script updated: cea48a62ab...afa4f6f157
2
vendor/grammars/language-gfm
vendored
2
vendor/grammars/language-gfm
vendored
Submodule vendor/grammars/language-gfm updated: 597d382a8c...e5b24d57e7
2
vendor/grammars/language-javascript
vendored
2
vendor/grammars/language-javascript
vendored
Submodule vendor/grammars/language-javascript updated: 9167541232...b227486fc8
1
vendor/grammars/language-maxscript
vendored
Submodule
1
vendor/grammars/language-maxscript
vendored
Submodule
Submodule vendor/grammars/language-maxscript added at a465c9ca4a
2
vendor/grammars/language-python
vendored
2
vendor/grammars/language-python
vendored
Submodule vendor/grammars/language-python updated: 6d7b52b882...cdb699e7a8
2
vendor/grammars/language-shellscript
vendored
2
vendor/grammars/language-shellscript
vendored
Submodule vendor/grammars/language-shellscript updated: 331dbfea1f...bbaca532de
2
vendor/grammars/language-yaml
vendored
2
vendor/grammars/language-yaml
vendored
Submodule vendor/grammars/language-yaml updated: 1f5a5b2db0...e1d62e5aff
2
vendor/grammars/latex.tmbundle
vendored
2
vendor/grammars/latex.tmbundle
vendored
Submodule vendor/grammars/latex.tmbundle updated: 0774651f87...bb4edc2b6a
2
vendor/grammars/make.tmbundle
vendored
2
vendor/grammars/make.tmbundle
vendored
Submodule vendor/grammars/make.tmbundle updated: 371a9e8a56...e0d96dc1d6
2
vendor/grammars/matlab.tmbundle
vendored
2
vendor/grammars/matlab.tmbundle
vendored
Submodule vendor/grammars/matlab.tmbundle updated: e1460dd9e7...2cdc1f8414
2
vendor/grammars/perl.tmbundle
vendored
2
vendor/grammars/perl.tmbundle
vendored
Submodule vendor/grammars/perl.tmbundle updated: fd81fe586b...dedebdcfd4
2
vendor/grammars/php-smarty.tmbundle
vendored
2
vendor/grammars/php-smarty.tmbundle
vendored
Submodule vendor/grammars/php-smarty.tmbundle updated: 3e673e1980...36c058a467
2
vendor/grammars/smali-sublime
vendored
2
vendor/grammars/smali-sublime
vendored
Submodule vendor/grammars/smali-sublime updated: b9eba91397...28a4336421
2
vendor/grammars/sublime-pony
vendored
2
vendor/grammars/sublime-pony
vendored
Submodule vendor/grammars/sublime-pony updated: 2b69dd3e47...384ba3ed98
2
vendor/grammars/sublime-typescript
vendored
2
vendor/grammars/sublime-typescript
vendored
Submodule vendor/grammars/sublime-typescript updated: 51341e0ae7...6540de452e
2
vendor/grammars/sublimeprolog
vendored
2
vendor/grammars/sublimeprolog
vendored
Submodule vendor/grammars/sublimeprolog updated: 9fd46df4b6...c71d8a1e0f
2
vendor/grammars/vue-syntax-highlight
vendored
2
vendor/grammars/vue-syntax-highlight
vendored
Submodule vendor/grammars/vue-syntax-highlight updated: 3b5c4183bf...a2336ddc7e
Reference in New Issue
Block a user