Merge branch 'master' into remove-lexer

This commit is contained in:
Paul Chaignon
2015-01-24 00:57:20 +01:00
37 changed files with 7869 additions and 26 deletions

3
.gitmodules vendored
View File

@@ -546,3 +546,6 @@
[submodule "vendor/grammars/Racket"] [submodule "vendor/grammars/Racket"]
path = vendor/grammars/Racket path = vendor/grammars/Racket
url = https://github.com/soegaard/racket-highlight-for-github url = https://github.com/soegaard/racket-highlight-for-github
[submodule "vendor/grammars/turtle.tmbundle"]
path = vendor/grammars/turtle.tmbundle
url = https://github.com/peta/turtle.tmbundle

View File

@@ -452,6 +452,9 @@ vendor/grammars/thrift.tmbundle:
- source.thrift - source.thrift
vendor/grammars/toml.tmbundle: vendor/grammars/toml.tmbundle:
- source.toml - source.toml
vendor/grammars/turtle.tmbundle:
- source.sparql
- source.turtle
vendor/grammars/verilog.tmbundle: vendor/grammars/verilog.tmbundle:
- source.verilog - source.verilog
vendor/grammars/x86-assembly-textmate-bundle: vendor/grammars/x86-assembly-textmate-bundle:

View File

@@ -69,6 +69,14 @@ module Linguist
end end
end end
disambiguate "C#", "Smalltalk" do |data|
if /![\w\s]+methodsFor: /.match(data)
Language["Smalltalk"]
elsif /^\s*namespace\s*[\w\.]+\s*{/.match(data) || /^\s*\/\//.match(data)
Language["C#"]
end
end
disambiguate "Objective-C", "C++", "C" do |data| disambiguate "Objective-C", "C++", "C" do |data|
if (/^[ \t]*@(interface|class|protocol|property|end|synchronised|selector|implementation)\b/.match(data)) if (/^[ \t]*@(interface|class|protocol|property|end|synchronised|selector|implementation)\b/.match(data))
Language["Objective-C"] Language["Objective-C"]
@@ -104,6 +112,15 @@ module Linguist
end end
end end
disambiguate "GAP", "Scilab" do |data|
if (data.include?("gap> "))
Language["GAP"]
# Heads up - we don't usually write heuristics like this (with no regex match)
else
Language["Scilab"]
end
end
disambiguate "Common Lisp", "OpenCL", "Cool" do |data| disambiguate "Common Lisp", "OpenCL", "Cool" do |data|
if data.include?("(defun ") if data.include?("(defun ")
Language["Common Lisp"] Language["Common Lisp"]

View File

@@ -504,10 +504,10 @@ Clojure:
- .cl2 - .cl2
- .cljc - .cljc
- .cljs - .cljs
- .cljs.hl
- .cljscm - .cljscm
- .cljx - .cljx
- .hic - .hic
- .hl
filenames: filenames:
- riemann.config - riemann.config
@@ -951,11 +951,13 @@ GAMS:
GAP: GAP:
type: programming type: programming
lexer: GAP
extensions: extensions:
- .g - .g
- .gap - .gap
- .gd - .gd
- .gi - .gi
- .tst
tm_scope: none tm_scope: none
ace_mode: text ace_mode: text
@@ -1172,6 +1174,7 @@ HTML:
extensions: extensions:
- .html - .html
- .htm - .htm
- .html.hl
- .st - .st
- .xht - .xht
- .xhtml - .xhtml
@@ -1197,7 +1200,7 @@ HTML+ERB:
- erb - erb
extensions: extensions:
- .erb - .erb
- .deface - .erb.deface
ace_mode: html_ruby ace_mode: html_ruby
HTML+PHP: HTML+PHP:
@@ -1228,7 +1231,7 @@ Haml:
type: markup type: markup
extensions: extensions:
- .haml - .haml
- .deface - .haml.deface
ace_mode: haml ace_mode: haml
Handlebars: Handlebars:
@@ -2054,7 +2057,7 @@ OpenSCAD:
extensions: extensions:
- .scad - .scad
tm_scope: none tm_scope: none
ace_mode: text ace_mode: scad
Org: Org:
type: prose type: prose
@@ -2211,6 +2214,8 @@ Perl6:
- .pm - .pm
- .pm6 - .pm6
- .t - .t
filenames:
- Rexfile
interpreters: interpreters:
- perl6 - perl6
tm_scope: none tm_scope: none
@@ -2230,6 +2235,8 @@ Pike:
extensions: extensions:
- .pike - .pike
- .pmod - .pmod
interpreters:
- pike
ace_mode: text ace_mode: text
Pod: Pod:
@@ -2612,6 +2619,14 @@ SCSS:
extensions: extensions:
- .scss - .scss
SPARQL:
type: data
tm_scope: source.sparql
ace_mode: text
extensions:
- .sparql
- .rq
SQF: SQF:
type: programming type: programming
color: "#FFCB1F" color: "#FFCB1F"
@@ -2639,14 +2654,15 @@ STON:
group: Smalltalk group: Smalltalk
extensions: extensions:
- .ston - .ston
tm_scope: source.json tm_scope: source.smalltalk
ace_mode: lisp ace_mode: text
Sage: Sage:
type: programming type: programming
group: Python group: Python
extensions: extensions:
- .sage - .sage
- .sagews
tm_scope: source.python tm_scope: source.python
ace_mode: python ace_mode: python
@@ -2968,6 +2984,13 @@ Turing:
tm_scope: none tm_scope: none
ace_mode: text ace_mode: text
Turtle:
type: data
extensions:
- .ttl
tm_scope: source.turtle
ace_mode: text
Twig: Twig:
type: markup type: markup
group: PHP group: PHP
@@ -3082,6 +3105,14 @@ Volt:
tm_scope: source.d tm_scope: source.d
ace_mode: d ace_mode: d
Web Ontology Language:
type: markup
color: "#3994bc"
extensions:
- .owl
tm_scope: text.xml
ace_mode: xml
WebIDL: WebIDL:
type: programming type: programming
extensions: extensions:
@@ -3118,6 +3149,7 @@ XML:
- .dll.config - .dll.config
- .filters - .filters
- .fsproj - .fsproj
- .fxml
- .glade - .glade
- .grxml - .grxml
- .ivy - .ivy

View File

@@ -1,3 +1,3 @@
module Linguist module Linguist
VERSION = "4.2.6" VERSION = "4.2.7"
end end

161
samples/GAP/bugfix.tst Normal file
View File

@@ -0,0 +1,161 @@
gap> START_TEST("Test for various former bugs");
gap> # The following used to trigger an error starting with:
gap> # "SolutionMat: matrix and vector incompatible called from"
gap> K:=AbelianPcpGroup([3,3,3]);;
gap> A:=Subgroup(K,[K.1]);;
gap> cr:=CRRecordBySubgroup(K,A);;
gap> ExtensionsCR(cr);;
# Comparing homomorphisms used to be broken
gap> K:=AbelianPcpGroup(1,[3]);;
gap> hom1:=GroupHomomorphismByImages(K,K,[K.1],[K.1]);;
gap> hom2:=GroupHomomorphismByImages(K,K,[K.1^2],[K.1^2]);;
gap> hom1=hom2;
true
gap> hom1=IdentityMapping(K);
true
gap> hom2=IdentityMapping(K);
true
gap> # The following incorrectly triggered an error at some point
gap> IsTorsionFree(ExamplesOfSomePcpGroups(5));
true
gap> # Verify IsGeneratorsOfMagmaWithInverses warnings are silenced
gap> IsGeneratorsOfMagmaWithInverses(GeneratorsOfGroup(ExamplesOfSomePcpGroups(5)));
true
gap> # Check for a bug reported 2012-01-19 by Robert Morse
gap> g := PcGroupToPcpGroup(SmallGroup(48,1));
Pcp-group with orders [ 2, 2, 2, 2, 3 ]
gap> # The next two commands used to trigger errors
gap> NonAbelianTensorSquare(Centre(g));
Pcp-group with orders [ 8 ]
gap> NonAbelianExteriorSquare(Centre(g));
Pcp-group with orders [ ]
gap> # Check for a bug reported 2012-01-19 by Robert Morse
gap> F := FreeGroup("x","y");
<free group on the generators [ x, y ]>
gap> x := F.1;; y := F.2;;
gap> G := F/[x^2/y^24, y^24, y^x/y^23];
<fp group on the generators [ x, y ]>
gap> iso := IsomorphismPcGroup(G);
[ x, y ] -> [ f1, f2*f5 ]
gap> iso1 := IsomorphismPcpGroup(Image(iso));
[ f1, f2, f3, f4, f5 ] -> [ g1, g2, g3, g4, g5 ]
gap> G := Image(iso*iso1);
Pcp-group with orders [ 2, 2, 2, 2, 3 ]
gap> # The next command used to trigger an error
gap> NonAbelianTensorSquare(Image(iso*iso1));
Pcp-group with orders [ 2, 2, 3, 2, 2, 2, 2 ]
gap> # The problem with the previous example is/was that Igs(G)
gap> # is set to a non-standard value:
gap> Igs(G);
[ g1, g2*g5, g3*g4*g5^2, g4*g5, g5 ]
gap> # Unfortunately, it seems that a lot of code that
gap> # really should be using Ngs or Cgs is using Igs incorrectly.
gap> # For example, direct products could return *invalid* embeddings:
gap> D := DirectProduct(G, G);
Pcp-group with orders [ 2, 2, 2, 2, 3, 2, 2, 2, 2, 3 ]
gap> hom:=Embedding(D,1);;
gap> mapi:=MappingGeneratorsImages(hom);;
gap> GroupHomomorphismByImages(Source(hom),Range(hom),mapi[1],mapi[2]) <> fail;
true
gap> hom:=Projection(D,1);;
gap> mapi:=MappingGeneratorsImages(hom);;
gap> GroupHomomorphismByImages(Source(hom),Range(hom),mapi[1],mapi[2]) <> fail;
true
gap> # Check for bug computing Schur extension of infinite cyclic groups,
gap> # found by Max Horn 2012-05-25
gap> G:=AbelianPcpGroup(1,[0]);
Pcp-group with orders [ 0 ]
gap> # The next command used to trigger an error
gap> SchurExtension(G);
Pcp-group with orders [ 0 ]
gap> # Check for bug computing Schur extensions of subgroups, found by MH 2012-05-25.
gap> G:=HeisenbergPcpGroup(2);
Pcp-group with orders [ 0, 0, 0, 0, 0 ]
gap> H:=Subgroup(G,[G.2^3*G.3^2, G.1^9]);
Pcp-group with orders [ 0, 0, 0 ]
gap> # The next command used to trigger an error
gap> SchurExtension(H);
Pcp-group with orders [ 0, 0, 0, 0, 0, 0 ]
gap> # Check for bug computing Schur extensions of subgroups, found by MH 2012-05-25.
gap> G:=HeisenbergPcpGroup(2);
Pcp-group with orders [ 0, 0, 0, 0, 0 ]
gap> H:=Subgroup(G,[G.1, G.2]);
Pcp-group with orders [ 0, 0 ]
gap> # The next command used to trigger an error
gap> SchurExtension(H);
Pcp-group with orders [ 0, 0, 0 ]
gap> # Check for bug computing normalizer of two subgroups, found by MH 2012-05-30.
gap> # The problem was caused by incorrect resp. overly restrictive use of Parent().
gap> G:=HeisenbergPcpGroup(2);
Pcp-group with orders [ 0, 0, 0, 0, 0 ]
gap> A:=Subgroup(Subgroup(G,[G.2,G.3,G.4,G.5]), [G.3]);
Pcp-group with orders [ 0 ]
gap> B:=Subgroup(Subgroup(G,[G.1,G.4,G.5]), [G.4]);
Pcp-group with orders [ 0 ]
gap> Normalizer(A,B);
Pcp-group with orders [ 0 ]
gap> # The following used to trigger the error "arguments must have a common parent group"
gap> Normalizer(B,A);
Pcp-group with orders [ 0 ]
gap> # In polycyclic 2.9 and 2.10, the code for 2-cohomology computations was broken.
gap> G := UnitriangularPcpGroup(3,0);
Pcp-group with orders [ 0, 0, 0 ]
gap> mats := G!.mats;
[ [ [ 1, 1, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ],
[ [ 1, 0, 0 ], [ 0, 1, 1 ], [ 0, 0, 1 ] ],
[ [ 1, 0, 1 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] ]
gap> C := CRRecordByMats(G,mats);;
gap> cc := TwoCohomologyCR(C);;
gap> cc.factor.rels;
[ 2, 0, 0 ]
gap> c := cc.factor.prei[2];
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1, 1 ]
gap> cc.gcb;
[ [ 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0 ],
[ 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1 ],
[ -1, 0, 1, 1, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1 ] ]
gap> cc.gcc;
[ [ 1, 0, 0, 0, 0, -2, -1, 0, 1, 1, -1, -1, 0, 0, 0, 0, 0, 0 ],
[ 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 1, 0, 0, -2, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 1, 0, 0, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1, 1 ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1 ] ]
gap> # LowerCentralSeriesOfGroup for non-nilpotent pcp-groups used to trigger
gap> # an infinite recursion
gap> G := PcGroupToPcpGroup(SmallGroup(6,1));
Pcp-group with orders [ 2, 3 ]
gap> LowerCentralSeriesOfGroup(G);
[ Pcp-group with orders [ 2, 3 ], Pcp-group with orders [ 3 ] ]
gap> STOP_TEST( "bugfix.tst", 10000000);

21
samples/GAP/factor.tst Normal file
View File

@@ -0,0 +1,21 @@
gap> START_TEST("Test of factor groups and natural homomorphisms");
gap> G:=HeisenbergPcpGroup(2);
Pcp-group with orders [ 0, 0, 0, 0, 0 ]
gap> H:=Subgroup(G,[G.2,G.3,G.4,G.5]);
gap> K:=G/H;
gap> NaturalHomomorphism(K);
gap> A:=Subgroup(H, [G.3]);
Pcp-group with orders [ 0 ]
gap> B:=Subgroup(Subgroup(G,[G.1,G.4,G.5]), [G.4]);
Pcp-group with orders [ 0 ]
gap> Normalizer(A,B);
Pcp-group with orders [ 0 ]
gap> # The following used to trigger the error "arguments must have a common parent group"
gap> Normalizer(B,A);
Pcp-group with orders [ 0 ]
gap> STOP_TEST( "factor.tst", 10000000);

328
samples/HTML/index.html.hl Normal file
View File

@@ -0,0 +1,328 @@
<script type="text/hoplon">
(page "index.html")
(defn mouse-loc->vec
"Given a Google Closure normalized DOM mouse event return the
mouse x and y position as a two element vector."
[e]
[(.-clientX e) (.-clientY e)])
;; =============================================================================
;; Example 1
(defc ex1-content ["Waiting for a click ...."])
(defc ex1-click-count 0)
(defn ex1 []
(when (< @ex1-click-count 1)
(swap! ex1-click-count inc)
(swap! ex1-content conj "Got a click!")))
;; =============================================================================
;; Example 2
(defc ex2-content ["Waiting for a click ...."])
(defc ex2-click-count 0)
(defn ex2 []
(when (= @ex2-click-count 1)
(swap! ex2-click-count inc)
(swap! ex2-content conj "Done"))
(when (= @ex2-click-count 0)
(swap! ex2-click-count inc)
(swap! ex2-content conj "Got a Click!" "Waiting for another click ....")))
;; =============================================================================
;; Example 3
(defc ex3-content ["Waiting for a click from Button A ....."])
(defc ex3-click-count-a 0)
(defc ex3-click-count-b 0)
(defn ex3a []
(when (= @ex3-click-count-a 0)
(swap! ex3-click-count-a inc)
(swap! ex3-content conj "Got a click!" "Waiting for a click from Button B ....")) )
(defn ex3b []
(when (and (= @ex3-click-count-a 1) (= @ex3-click-count-b 0))
(swap! ex3-click-count-b inc)
(swap! ex3-content conj "Done!")))
;; =============================================================================
;; Example 6
(defc ex6-content ["Click the button to start tracking the mouse."])
(defc ex6-button-name "GO!")
(defn ex6-toggle []
(let [new-name (if (= @ex6-button-name "GO!") "STOP!" "GO!")]
(reset! ex6-button-name new-name)))
(defn ex6 [e]
(when (= @ex6-button-name "STOP!")
(swap! ex6-content conj (str (mouse-loc->vec e)))))
;; =============================================================================
;; Example 7
(defc ex7-content ["Click the button to start tracking the mouse."])
(defc ex7-button-name "GO!")
(defn ex7-toggle []
(let [new-name (if (= @ex7-button-name "GO!") "STOP!" "GO!")]
(reset! ex7-button-name new-name)))
(defn ex7 [e]
(when (= @ex7-button-name "STOP!")
(let [[x y :as m] (mouse-loc->vec e)]
(when (zero? (mod y 5))
(swap! ex7-content conj (str m))))))
;; =============================================================================
;; Example 8
(defc ex8-content ["Click the button ten times."])
(defc ex8-click-count 0)
(defn ex8 []
(when (< @ex8-click-count 10)
(swap! ex8-click-count inc)
(when (= @ex8-click-count 1)
(swap! ex8-content conj "1 Click!"))
(when (> @ex8-click-count 1)
(swap! ex8-content conj (str @ex8-click-count " clicks!")))
(when (= @ex8-click-count 10)
(swap! ex8-content conj "Done."))))
;; =============================================================================
;; Example 9
(defc ex9-index 0)
(defc ex9-animals [:aardvark :beetle :cat :dog :elk :ferret
:goose :hippo :ibis :jellyfish :kangaroo])
(defc= ex9-card (nth ex9-animals ex9-index))
(defn ex9-prev []
(when (> @ex9-index 0)
(swap! ex9-index dec)))
(defn ex9-next []
(when (< @ex9-index (dec (count @ex9-animals)))
(swap! ex9-index inc)))
;; =============================================================================
;; Example 10
(defc ex10-button-name "START!")
(defc ex10-index 0)
(defn ex10 []
(let [the-name @ex10-button-name]
(when (= the-name"START!")
(reset! ex10-button-name "STOP!"))
(when (= the-name"STOP!")
(reset! ex10-button-name "DONE!"))))
(defc ex10-animals [:aardvark :beetle :cat :dog :elk :ferret
:goose :hippo :ibis :jellyfish :kangaroo])
(defc= ex10-max (dec (count ex10-animals)))
(defc= ex10-card (nth ex10-animals ex10-index))
(defn ex10-prev []
(if (> @ex10-index 0)
(swap! ex10-index dec)
(reset! ex10-index @ex10-max)))
(defn ex10-next []
(if (< @ex10-index @ex10-max)
(swap! ex10-index inc)
(reset! ex10-index 0)))
(defn ex10-nav [k]
(when (= @ex10-button-name "STOP!")
(when (= k :next)
(ex10-next))
(when (= k :prev)
(ex10-prev))))
(defn ex10-keys [e]
(when (= @ex10-button-name "STOP!")
(if (= (.-keyCode e) 39) (ex10-nav :next))
(if (= (.-keyCode e) 37) (ex10-nav :prev))
)
)
</script>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
<!-- Example 1 -->
<div id="ex1" class="example">
<h2>Example 1</h2>
<table>
<tr>
<td class="left">
<button id="ex1-button" on-click='{{ #(ex1) }}'>Click me</button>
</td>
<td id="ex1-display" class="display">
<div id="ex1-messages">
<loop-tpl bindings='{{ [x ex1-content] }}'>
<p><text>~{x}</text></p>
</loop-tpl>
</div>
</td>
</tr>
</table>
</div>
<!-- Example 2 -->
<div id="ex2" class="example">
<h2>Example 2</h2>
<table>
<tr>
<td class="left">
<button id="ex2-button" on-click='{{ #(ex2) }}'>Click me</button>
</td>
<td id="ex2-display" class="display">
<div id="ex2-messages">
<loop-tpl bindings='{{ [x ex2-content] }}'>
<p><text>~{x}</text></p>
</loop-tpl>
</div>
</td>
</tr>
</table>
</div>
<!-- Example 3 -->
<div id="ex3" class="example">
<h2>Example 3</h2>
<table>
<tr>
<td class="left">
<button id="ex3-button-a" on-click='{{ #(ex3a) }}'>Button A</button>
<button id="ex3-button-b" on-click='{{ #(ex3b) }}'>Button B</button>
</td>
<td id="ex3-display" class="display">
<div id="ex3-messages">
<loop-tpl bindings='{{ [x ex3-content] }}'>
<p><text>~{x}</text></p>
</loop-tpl>
</div>
</td>
</tr>
</table>
</div>
<!-- Example 4 -->
<div id="ex4" class="example">
<h2>Example 4</h2>
<table>
<tr>
<td class="left">
<button id="ex4-button-a">Go!</button>
</td>
<td id="ex4-display" class="display">
<div id="ex4-messages"></div>
</td>
</tr>
</table>
</div>
<!-- Example 5 -->
<div id="ex5" class="example">
<h2>Example 5</h2>
<table>
<tr>
<td class="left">
<button id="ex5-button">Go!</button>
</td>
<td id="ex5-display" class="display">
<div id="ex5-messages"></div>
</td>
</tr>
</table>
</div>
<!-- Example 6 -->
<div id="ex6" class="example" on-mousemove='{{ #(ex6 %) }}' >
<h2>Example 6</h2>
<table>
<tr>
<td class="left">
<button id="ex6-button" do-text='{{ ex6-button-name }}' on-click='{{ #(ex6-toggle)}}' ></button>
</td>
<td id="ex6-display" class="display">
<div class="scrolling">
<div id="ex6-messages">
<loop-tpl bindings='{{ [x ex6-content] }}'>
<p><text>~{x}</text></p>
</loop-tpl>
</div>
</div>
</td>
</tr>
</table>
</div>
<!-- Example 7 -->
<div id="ex7" class="example" on-mousemove='{{ #(ex7 %) }}'>
<h2>Example 7</h2>
<table>
<tr>
<td class="left">
<button id="ex7-button" do-text='{{ ex7-button-name }}' on-click='{{ #(ex7-toggle)}}'></button>
</td>
<td id="ex7-display" class="display">
<div class="scrolling">
<div id="ex7-messages">
<loop-tpl bindings='{{ [x ex7-content] }}'>
<p><text>~{x}</text></p>
</loop-tpl>
</div>
</div>
</td>
</tr>
</table>
</div>
<!-- Example 8 -->
<div id="ex8" class="example">
<h2>Example 8</h2>
<table>
<tr>
<td class="left">
<button id="ex8-button" on-click='{{ #(ex8) }}'>Click me!</button>
</td>
<td id="ex8-display" class="display card">
<div class="scrolling">
<div id="ex8-messages">
<loop-tpl bindings='{{ [x ex8-content] }}'>
<p><text>~{x}</text></p>
</loop-tpl>
</div>
</div>
</td>
</tr>
</table>
</div>
<!-- Example 9 -->
<div id="ex9" class="example">
<h2>Example 9</h2>
<table>
<tr>
<td class="left">
<button id="ex9-button-prev" on-click='{{ #(ex9-prev) }}' do-class='{{ (cell= {:disabled (= ex9-index 0)})}}'>Previous</button>
<button id="ex9-button-next" on-click='{{ #(ex9-next) }}' do-class='{{ (cell= {:disabled (= ex9-index (dec (count ex9-animals)))}) }}'>Next</button>
</td>
<td id="ex9-card" class="display card" do-text='{{ ex9-card }}'></td>
</tr>
</table>
</div>
<!-- Example 10 -->
<div id="ex10" class="example" on-keydown='{{ #(ex10-keys %) }}'>
<h2>Example 10</h2>
<table>
<tr>
<td class="left">
<button id="ex10-button-start-stop" do-text='{{ ex10-button-name}}' on-click='{{ #(ex10) }}'></button>
<button id="ex10-button-prev" on-click='{{ #(ex10-nav :prev) }}'
do-class='{{ (cell= {:disabled (not= ex10-button-name "STOP!")}) }}'>Previous
</button>
<button id="ex10-button-next" on-click='{{ #(ex10-nav :next) }}' do-class='{{ (cell= {:disabled (not= ex10-button-name "STOP!")}) }}'>Next</button>
</td>
<td id="ex10-card" class="display card" do-text='{{ ex10-card }}'></td>
</tr>
</table>
</div>
</body>
</html>

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env pike
int main(int argc, array argv) {
return 0;
}

View File

@@ -0,0 +1,7 @@
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?email
WHERE {
?person a foaf:Person.
?person foaf:name ?name.
?person foaf:mbox ?email.
}

View File

@@ -0,0 +1,40 @@
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?s ?label
WHERE {
SERVICE <http://api.finto.fi/sparql>
{
SELECT DISTINCT ?s ?label ?plabel ?alabel ?hlabel (GROUP_CONCAT(DISTINCT STR(?type)) as ?types)
WHERE {
GRAPH <http://www.yso.fi/onto/kauno/>
{
?s rdf:type <http://www.w3.org/2004/02/skos/core#Concept>
{
?s rdf:type ?type .
?s ?prop ?match .
FILTER (
strstarts(lcase(str(?match)), "test") && !(?match != ?label && strstarts(lcase(str(?label)), "test"))
)
OPTIONAL {
?s skos:prefLabel ?label .
FILTER (langMatches(lang(?label), "en"))
}
OPTIONAL { # in case previous OPTIONAL block gives no labels
?s ?prop ?match .
?s skos:prefLabel ?label .
FILTER (langMatches(lang(?label), lang(?match))) }
}
FILTER NOT EXISTS { ?s owl:deprecated true }
}
BIND(IF(?prop = skos:prefLabel && ?match != ?label, ?match, "") as ?plabel)
BIND(IF(?prop = skos:altLabel, ?match, "") as ?alabel)
BIND(IF(?prop = skos:hiddenLabel, ?match, "") as ?hlabel)
VALUES (?prop) { (skos:prefLabel) (skos:altLabel) (skos:hiddenLabel) }
}
GROUP BY ?match ?s ?label ?plabel ?alabel ?hlabel ?prop
ORDER BY lcase(str(?match)) lang(?match)
LIMIT 10
}
}

View File

@@ -0,0 +1,136 @@
# -*- coding: utf-8 -*-
#
# Funciones en Python/Sage para el trabajo con polinomios con una
# incógnita (x).
#
# Copyright (C) 2014-2015, David Abián <davidabian [at] davidabian.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
def pols (grado=-1, K=GF(2), mostrar=False):
"""Devuelve la lista de polinomios constantes y no constantes de
coeficientes mónicos y grado igual o menor que el especificado.
Si el grado indicado no es válido, devuelve una lista vacía.
"""
lpols = []
if not grado.is_integer():
grado = grado.round()
if grado >= 0:
var('x')
xs = vector([(x^i) for i in range(grado+1)])
V = VectorSpace(K,grado+1)
lpols = [cs*xs for cs in V]
if mostrar:
for pol in lpols:
print pol
return lpols
def polsNoCtes (grado=-1, K=GF(2), mostrar=False):
"""Devuelve la lista de polinomios no constantes de coeficientes mónicos y
grado igual o menor que el especificado.
Si el grado indicado no es válido, devuelve una lista vacía.
"""
lpols = []
if not grado.is_integer():
grado = grado.round()
if grado >= 0:
var('x')
xs = vector([(x^i) for i in range(grado+1)])
for cs in K^(grado+1):
if cs[:grado] != vector(grado*[0]): # no constantes
lpols += [cs*xs]
if mostrar:
for pol in lpols:
print pol
return lpols
def polsMismoGrado (grado=-1, K=GF(2), mostrar=False):
"""Devuelve la lista de polinomios de coeficientes mónicos del grado
especificado.
Si el grado indicado no es válido, devuelve una lista vacía.
"""
lpols = []
if not grado.is_integer():
grado = grado.round()
if grado >= 0:
var('x')
xs = vector([(x^(grado-i)) for i in [0..grado]])
for cs in K^(grado+1):
if cs[0] != 0: # polinomios del mismo grado
lpols += [cs*xs]
if mostrar:
for pol in lpols:
print pol
return lpols
def excluirReducibles (lpols=[], mostrar=False):
"""Filtra una lista dada de polinomios de coeficientes mónicos y devuelve
aquellos irreducibles.
"""
var('x')
irreds = []
for p in lpols:
fp = (p.factor_list())
if len(fp) == 1 and fp[0][1] == 1:
irreds += [p]
if mostrar:
for pol in irreds:
print pol
return irreds
def vecPol (vec=random_vector(GF(2),0)):
"""Transforma los coeficientes dados en forma de vector en el polinomio
que representan.
Por ejemplo, con vecPol(vector([1,0,3,1])) se obtiene x³ + 3*x + 1.
Para la función opuesta, véase polVec().
"""
var('x')
xs = vector([x^(len(vec)-1-i) for i in range(len(vec))])
return vec*xs
def polVec (p=None):
"""Devuelve el vector de coeficientes del polinomio dado que acompañan a la
incógnita x, de mayor a menor grado.
Por ejemplo, con polVec(x^3 + 3*x + 1) se obtiene el vector (1, 0, 3, 1).
Para la función opuesta, véase vecPol().
"""
cs = []
if p != None:
var('x')
p(x) = p
for i in [0..p(x).degree(x)]:
cs.append(p(x).coefficient(x,i))
cs = list(reversed(cs))
return vector(cs)
def completar2 (p=0):
"""Aplica el método de completar cuadrados en parábolas al polinomio dado de
grado 2 y lo devuelve en su nueva forma.
Si el polinomio dado no es válido, devuelve 0.
Por ejemplo, con complCuad(3*x^2 + 12*x + 5) se obtiene 3*(x + 2)^2 - 7.
"""
var('x')
p(x) = p.expand()
if p(x).degree(x) != 2:
p(x) = 0
else:
cs = polVec(p(x))
p(x) = cs[0]*(x+(cs[1]/(2*cs[0])))^2+(4*cs[0]*cs[2]-cs[1]^2)/(4*cs[0])
return p(x)

View File

@@ -0,0 +1,183 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix gndo: <http://d-nb.info/standards/elementset/gnd#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://d-nb.info/gnd/118514768>
a <http://d-nb.info/standards/elementset/gnd#Pseudonym> ;
foaf:page <http://de.wikipedia.org/wiki/Bertolt_Brecht> ;
owl:sameAs <http://dbpedia.org/resource/Bertolt_Brecht>, <http://viaf.org/viaf/2467372>, <http://www.filmportal.de/person/261E2D3A93D54134BF8AB5F21F0B2399> ;
gndo:gndIdentifier "118514768" ;
gndo:oldAuthorityNumber "(DE-588)1022091077", "(DE-588a)118514768", "(DE-588a)141399074", "(DE-588a)139089691", "(DE-588a)141300248", "(DE-588a)136949541", "(DE-588a)134336232", "(DE-588a)12794544X", "(DE-588a)12736630X", "(DE-588a)12722811X", "(DE-588a)127228098", "(DE-588a)127228101" ;
gndo:variantNameForThePerson "Brêcht, Becton", "Brecht, Bert", "Brecht, Bertolʹ", "Brecht, Berthold", "Brecht, Bertholt", "Brecht, Bertold", "Brecht, B.", "Brecht, Eugen Berthold Friedrich", "Brecht, ...", "Brecht-Eisler, ...", "Becht, Bertolt", "Beituo'erte-Bulaixite", "Berchito, B.", "Brechtas, B.", "Brechts, Bertolts", "Brehd, Berd", "Breht, Bertolt", "Brehts, Bertolts", "Breḳhṭ, Bārṭolṭ", "Brekt, Berṭolṭ", "Brekṭ, Berṭōlṭ", "Breḳṭ, Berṭôlṭ", "Breśṭ, Berṭalṭa", "Breṣṭa, Barṭolṭa", "Brišt, Bartūlt", "Brišt, Birtūld", "Brišt, Birtult", "Buchito, Berutorutu", "Bulaixite, Beituo'erte", "Bulaixite, ...", "Burehito, Berutoruto", "Burehito, ...", "B. B.", "Larsen, Berthold", "Mprecht, Mpertolt", "Mprecht, ...", "Pulaihsit'ê, Peit'oĉrht'ê", "Pulaihsit'ê, ...", "Pŭrehit'ŭ, Peŏt'olt'ŭ", "Bŭrehit'ŭ, Beŏt'olt'ŭ", "برشت، برتولد", "브레히트, 베르톨트", "ברכט, ברטולט", "贝·布莱希特", "布莱希特, 贝", "ブレヒト, ベルトルト" ;
gndo:variantNameEntityForThePerson [
gndo:forename "Becton" ;
gndo:surname "Brêcht"
], [
gndo:forename "Bert" ;
gndo:surname "Brecht"
], [
gndo:forename "Bertolʹ" ;
gndo:surname "Brecht"
], [
gndo:forename "Berthold" ;
gndo:surname "Brecht"
], [
gndo:forename "Bertholt" ;
gndo:surname "Brecht"
], [
gndo:forename "Bertold" ;
gndo:surname "Brecht"
], [
gndo:forename "B." ;
gndo:surname "Brecht"
], [
gndo:forename "Eugen Berthold Friedrich" ;
gndo:surname "Brecht"
], [
gndo:forename "..." ;
gndo:surname "Brecht"
], [
gndo:forename "..." ;
gndo:surname "Brecht-Eisler"
], [
gndo:forename "Bertolt" ;
gndo:surname "Becht"
], [ gndo:personalName "Beituo'erte-Bulaixite" ], [
gndo:forename "B." ;
gndo:surname "Berchito"
], [
gndo:forename "B." ;
gndo:surname "Brechtas"
], [
gndo:forename "Bertolts" ;
gndo:surname "Brechts"
], [
gndo:forename "Berd" ;
gndo:surname "Brehd"
], [
gndo:forename "Bertolt" ;
gndo:surname "Breht"
], [
gndo:forename "Bertolts" ;
gndo:surname "Brehts"
], [
gndo:forename "Bārṭolṭ" ;
gndo:surname "Breḳhṭ"
], [
gndo:forename "Berṭolṭ" ;
gndo:surname "Brekt"
], [
gndo:forename "Berṭōlṭ" ;
gndo:surname "Brekṭ"
], [
gndo:forename "Berṭôlṭ" ;
gndo:surname "Breḳṭ"
], [
gndo:forename "Berṭalṭa" ;
gndo:surname "Breśṭ"
], [
gndo:forename "Barṭolṭa" ;
gndo:surname "Breṣṭa"
], [
gndo:forename "Bartūlt" ;
gndo:surname "Brišt"
], [
gndo:forename "Birtūld" ;
gndo:surname "Brišt"
], [
gndo:forename "Birtult" ;
gndo:surname "Brišt"
], [
gndo:forename "Berutorutu" ;
gndo:surname "Buchito"
], [
gndo:forename "Beituo'erte" ;
gndo:surname "Bulaixite"
], [
gndo:forename "..." ;
gndo:surname "Bulaixite"
], [
gndo:forename "Berutoruto" ;
gndo:surname "Burehito"
], [
gndo:forename "..." ;
gndo:surname "Burehito"
], [ gndo:personalName "B. B." ], [
gndo:forename "Berthold" ;
gndo:surname "Larsen"
], [
gndo:forename "Mpertolt" ;
gndo:surname "Mprecht"
], [
gndo:forename "..." ;
gndo:surname "Mprecht"
], [
gndo:forename "Peit'oĉrht'ê" ;
gndo:surname "Pulaihsit'ê"
], [
gndo:forename "..." ;
gndo:surname "Pulaihsit'ê"
], [
gndo:forename "Peŏt'olt'ŭ" ;
gndo:surname "Pŭrehit'ŭ"
], [
gndo:forename "Beŏt'olt'ŭ" ;
gndo:surname "Bŭrehit'ŭ"
], [ gndo:personalName "برشت، برتولد" ], [
gndo:forename "베르톨트" ;
gndo:surname "브레히트"
], [
gndo:forename "ברטולט" ;
gndo:surname "ברכט"
], [ gndo:personalName "贝·布莱希特" ], [
gndo:forename "" ;
gndo:surname "布莱希特"
], [
gndo:forename "ベルトルト" ;
gndo:surname "ブレヒト"
] ;
gndo:preferredNameForThePerson "Brecht, Bertolt" ;
gndo:preferredNameEntityForThePerson [
gndo:forename "Bertolt" ;
gndo:surname "Brecht"
] ;
gndo:familialRelationship <http://d-nb.info/gnd/121608557>, <http://d-nb.info/gnd/119056011>, <http://d-nb.info/gnd/118738348>, <http://d-nb.info/gnd/137070411>, <http://d-nb.info/gnd/118809849>, <http://d-nb.info/gnd/119027615>, <http://d-nb.info/gnd/118940163>, <http://d-nb.info/gnd/118630091>, <http://d-nb.info/gnd/123783283>, <http://d-nb.info/gnd/118940155>, <http://d-nb.info/gnd/110005449>, <http://d-nb.info/gnd/13612495X>, <http://d-nb.info/gnd/123757398>, <http://d-nb.info/gnd/1030496250>, <http://d-nb.info/gnd/1030496366> ;
gndo:professionOrOccupation <http://d-nb.info/gnd/4185053-1>, <http://d-nb.info/gnd/4140241-8>, <http://d-nb.info/gnd/4052154-0>, <http://d-nb.info/gnd/4168391-2>, <http://d-nb.info/gnd/4053309-8>, <http://d-nb.info/gnd/4049050-6>, <http://d-nb.info/gnd/4294338-3> ;
gndo:playedInstrument <http://d-nb.info/gnd/4057587-1> ;
gndo:gndSubjectCategory <http://d-nb.info/standards/vocab/gnd/gnd-sc#12.2p>, <http://d-nb.info/standards/vocab/gnd/gnd-sc#15.1p>, <http://d-nb.info/standards/vocab/gnd/gnd-sc#15.3p> ;
gndo:geographicAreaCode <http://d-nb.info/standards/vocab/gnd/geographic-area-code#XA-DE> ;
gndo:languageCode <http://id.loc.gov/vocabulary/iso639-2/ger> ;
gndo:placeOfBirth <http://d-nb.info/gnd/4003614-5> ;
gndo:placeOfDeath <http://d-nb.info/gnd/4005728-8> ;
gndo:placeOfExile <http://d-nb.info/gnd/4010877-6>, <http://d-nb.info/gnd/4077258-5> ;
gndo:gender <http://d-nb.info/standards/vocab/gnd/Gender#male> ;
gndo:dateOfBirth "1898-02-10"^^xsd:date ;
gndo:dateOfDeath "1956-08-14"^^xsd:date .
<http://d-nb.info/gnd/121608557> gndo:preferredNameForThePerson "Brecht, Berthold Friedrich" .
<http://d-nb.info/gnd/119056011> gndo:preferredNameForThePerson "Banholzer, Paula" .
<http://d-nb.info/gnd/118738348> gndo:preferredNameForThePerson "Neher, Carola" .
<http://d-nb.info/gnd/137070411> gndo:preferredNameForThePerson "Banholzer, Frank" .
<http://d-nb.info/gnd/118809849> gndo:preferredNameForThePerson "Berlau, Ruth" .
<http://d-nb.info/gnd/119027615> gndo:preferredNameForThePerson "Steffin, Margarete" .
<http://d-nb.info/gnd/118940163> gndo:preferredNameForThePerson "Zoff, Marianne" .
<http://d-nb.info/gnd/118630091> gndo:preferredNameForThePerson "Weigel, Helene" .
<http://d-nb.info/gnd/123783283> gndo:preferredNameForThePerson "Reichel, Käthe" .
<http://d-nb.info/gnd/118940155> gndo:preferredNameForThePerson "Hiob, Hanne" .
<http://d-nb.info/gnd/110005449> gndo:preferredNameForThePerson "Brecht, Stefan" .
<http://d-nb.info/gnd/13612495X> gndo:preferredNameForThePerson "Brecht-Schall, Barbara" .
<http://d-nb.info/gnd/123757398> gndo:preferredNameForThePerson "Schall, Ekkehard" .
<http://d-nb.info/gnd/1030496250> gndo:preferredNameForThePerson "Brezing, Joseph Friedrich" .
<http://d-nb.info/gnd/1030496366> gndo:preferredNameForThePerson "Brezing, Friederike" .
<http://d-nb.info/gnd/4185053-1> gndo:preferredNameForTheSubjectHeading "Theaterregisseur" .
<http://d-nb.info/gnd/4140241-8> gndo:preferredNameForTheSubjectHeading "Dramatiker" .
<http://d-nb.info/gnd/4052154-0> gndo:preferredNameForTheSubjectHeading "Schauspieler" .
<http://d-nb.info/gnd/4168391-2> gndo:preferredNameForTheSubjectHeading "Lyriker" .
<http://d-nb.info/gnd/4053309-8> gndo:preferredNameForTheSubjectHeading "Schriftsteller" .
<http://d-nb.info/gnd/4049050-6> gndo:preferredNameForTheSubjectHeading "Regisseur" .
<http://d-nb.info/gnd/4294338-3> gndo:preferredNameForTheSubjectHeading "Drehbuchautor" .
<http://d-nb.info/gnd/4003614-5> gndo:preferredNameForThePlaceOrGeographicName "Augsburg" .
<http://d-nb.info/gnd/4005728-8> gndo:preferredNameForThePlaceOrGeographicName "Berlin" .
<http://d-nb.info/gnd/4010877-6> gndo:preferredNameForThePlaceOrGeographicName "Dänemark" .
<http://d-nb.info/gnd/4077258-5> gndo:preferredNameForThePlaceOrGeographicName "Schweden" .

View File

@@ -0,0 +1,10 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix ex: <http://example.org/stuff/1.0/> .
<http://www.w3.org/TR/rdf-syntax-grammar>
dc:title "RDF/XML Syntax Specification (Revised)" ;
ex:editor [
ex:fullname "Dave Beckett";
ex:homePage <http://purl.org/net/dajobe/>
] .

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<center>
<TableView prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<columns>
<TableColumn prefWidth="114.0" text="Column 1" />
<TableColumn minWidth="0.0" prefWidth="243.0" text="Column 2" />
<TableColumn prefWidth="214.0" text="Column 3" />
</columns>
</TableView>
</center>
<bottom>
<HBox alignment="CENTER_RIGHT" prefWidth="200.0" spacing="10.0" BorderPane.alignment="CENTER">
<children>
<Button mnemonicParsing="false" text="Button">
<HBox.margin>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</HBox.margin>
</Button>
</children>
</HBox>
</bottom>
</BorderPane>

View File

@@ -133,6 +133,13 @@ class TestHeuristcs < Minitest::Test
}) })
end end
def test_cs_by_heuristics
assert_heuristics({
"C#" => all_fixtures("C#", "*.cs"),
"Smalltalk" => all_fixtures("Smalltalk", "*.cs")
})
end
def assert_heuristics(hash) def assert_heuristics(hash)
candidates = hash.keys.map { |l| Language[l] } candidates = hash.keys.map { |l| Language[l] }