Skip to content

Commit 2771fbd

Browse files
committed
Include website source in repo.
1 parent 0aaf6aa commit 2771fbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+10494
-21
lines changed

Jakefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var FILE = require("file"),
44
OS = require("os"),
5+
bundler = require("cjs-bundler"),
56
jake = require("jake");
67

78
jake.task("build", ["build:bnf", "build:lex"]);
@@ -29,3 +30,26 @@ jake.task("test:lexer", function () {
2930
jake.task("test:grammar", function () {
3031
OS.system(['narwhal', 'tests/grammar/grammar-tests.js']);
3132
});
33+
34+
var path = FILE.path(FILE.cwd());
35+
36+
jake.task("build:web", function() {
37+
var script = bundler.bundle([
38+
{ id : "jison", path : path.join("lib", "jison.js") },
39+
{ id : "jison/lexer", path : path.join("lib", "jison", "lexer.js") },
40+
{ id : "jison/bnf", path : path.join("lib", "jison", "bnf.js") },
41+
{ id : "jison/jisonlex", path : path.join("lib", "jison", "jisonlex.js") },
42+
{ id : "jison/json2jison", path : path.join("lib", "jison", "json2jison.js") },
43+
{ id : "jison/util/set", path : path.join("lib", "jison", "util", "set.js") },
44+
{ id : "jison/util/typal", path : path.join("lib", "jison", "util", "typal.js") },
45+
{ id : "jison/util/bnf-parser", path : path.join("lib", "jison", "util", "bnf-parser.js") },
46+
{ id : "jison/util/lex-parser", path : path.join("lib", "jison", "util", "lex-parser.js") }
47+
]);
48+
49+
FILE.write("web/content/assets/js/jison.js", "var require = (function() {\n" + script + ";\nreturn require;\n})();");
50+
OS.system(['make', 'web']);
51+
});
52+
53+
jake.task("preview", function () {
54+
OS.system(['make', 'preview']);
55+
});

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
all: web preview
3+
4+
web:
5+
cd web/ && nanoc compile
6+
7+
preview:
8+
cd web/ && nanoc view
9+
10+
deploy:
11+
git clone [email protected]:zaach/jison.git /tmp/jison-gh-pages
12+
cd /tmp/jison-gh-pages && git checkout gh-pages

lib/jison.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,9 @@
22
// Zachary Carter <[email protected]>
33
// MIT X Licensed
44

5-
if (typeof exports === 'undefined') {
6-
exports = {};
7-
} else if (typeof require !== 'undefined') {
8-
// assume we're in commonjs land
9-
//var system = require("system");
10-
var typal = require('./jison/util/typal').typal;
11-
var Set = require('./jison/util/set').Set;
12-
var RegExpLexer = require('./jison/lexer').RegExpLexer;
13-
}
5+
var typal = require('./jison/util/typal').typal,
6+
Set = require('./jison/util/set').Set,
7+
RegExpLexer = require('./jison/lexer').RegExpLexer;
148

159
var Jison = exports.Jison = exports;
1610

lib/jison/bnf.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
if (typeof require !== 'undefined') {
2-
var bnf = require("./util/bnf-parser").parser;
3-
var jisonlex = require("./jisonlex");
4-
exports.parse = function parse () { return bnf.parse.apply(bnf, arguments) };
5-
}
1+
var bnf = require("./util/bnf-parser").parser,
2+
jisonlex = require("./jisonlex");
3+
4+
exports.parse = function parse () { return bnf.parse.apply(bnf, arguments) };
65

76
// adds a declaration to the grammar
87
bnf.yy.addDeclaration = function (grammar, decl) {

lib/jison/jisonlex.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
if (typeof require !== 'undefined') {
2-
var jisonlex = require("./util/lex-parser").parser;
3-
} else {
4-
var exports = jisonlex;
5-
}
1+
var jisonlex = require("./util/lex-parser").parser;
62

73
var parse_ = jisonlex.parse;
84
jisonlex.parse = exports.parse = function parse () {

lib/jison/util/set.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Set class to wrap arrays
22

3-
if (typeof require !== 'undefined')
4-
var typal = require("./typal").typal;
3+
var typal = require("./typal").typal;
54

65
var setMixin = {
76
constructor: function Set_constructor (set, raw) {

web/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
output/
2+
tmp/

web/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Build with nanoc

web/Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require 'nanoc3/tasks'

web/Rules

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/usr/bin/env ruby
2+
3+
# A few helpful tips about the Rules file:
4+
#
5+
# * The order of rules is important: for each item, only the first matching
6+
# rule is applied.
7+
#
8+
# * Item identifiers start and end with a slash (e.g. “/about/” for the file
9+
# “content/about.html”). To select all children, grandchildren, … of an
10+
# item, use the pattern “/about/*/”; “/about/*” will also select the parent,
11+
# because “*” matches zero or more characters.
12+
13+
14+
compile '/jison/assets/*' do
15+
# do nothing
16+
end
17+
18+
19+
compile '/jison/demos/*/' do
20+
layout 'default'
21+
end
22+
23+
compile '/jison/try/' do
24+
filter :erb
25+
layout 'default'
26+
end
27+
28+
compile '/jison/try/*' do
29+
# do nothing
30+
end
31+
32+
compile '/jison/' do
33+
filter :erb
34+
end
35+
36+
compile '*' do
37+
filter :kramdown
38+
layout 'default'
39+
end
40+
41+
### Routing #########################################################
42+
43+
route '/jison/assets/styles/*' do
44+
item.identifier.gsub(/\/$/, '') + '.css'
45+
end
46+
47+
route '/jison/assets/js/*' do
48+
item.identifier.gsub(/\/$/, '') + '.js'
49+
end
50+
51+
route '/jison/assets/pngs/*' do
52+
item.identifier.gsub('/pngs/', '/images/').gsub(/\/$/, '') + '.png'
53+
end
54+
55+
56+
route '/jison/assets/*' do
57+
dir = File.join('content', item.identifier)
58+
puts dir
59+
base = File.basename(dir)
60+
regexp = /^#{base}\.(?!yaml)(.*)/
61+
62+
file_name = Dir.entries(dir).sort.find do |d|
63+
d.match(regexp)
64+
end
65+
66+
if file_name
67+
ext = file_name.match(regexp)[1]
68+
File.join(File.dirname(item.identifier), "#{base}.#{ext}")
69+
else
70+
nil
71+
end
72+
end
73+
74+
route '*' do
75+
item.identifier + 'index.html'
76+
end
77+
78+
layout '*', :erb

0 commit comments

Comments
 (0)