sydney 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -2
- data/NEWS.md +6 -0
- data/README.md +21 -10
- data/doc/Gemfile.html +107 -0
- data/doc/LICENSE.html +125 -0
- data/doc/Rakefile.html +105 -0
- data/doc/Sydney.html +276 -0
- data/doc/SydneyAliasFile.html +141 -0
- data/doc/SydneyAliasFile/AliasComment.html +193 -0
- data/doc/SydneyAliasFile/AliasDefinition.html +259 -0
- data/doc/SydneyAliasFile/AliasEntry.html +257 -0
- data/doc/SydneyAliasFile/Document.html +193 -0
- data/doc/SydneyAliasFile/Section.html +225 -0
- data/doc/SydneyAliasFile/SectionComment.html +193 -0
- data/doc/SydneyAliasFile/SyntaxNode.html +193 -0
- data/doc/created.rid +15 -0
- data/doc/images/add.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +100 -0
- data/doc/js/darkfish.js +153 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +94 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/rdoc.css +543 -0
- data/doc/spec/fixtures/aliases.html +123 -0
- data/doc/table_of_contents.html +116 -0
- data/lib/sydney.rb +23 -1
- data/lib/sydney/sydney_alias_file/node_extensions.rb +18 -0
- data/lib/sydney/version.rb +1 -1
- data/spec/sydney_alias_file/alias_definition_spec.rb +6 -0
- data/spec/sydney_alias_file/alias_entry_spec.rb +1 -0
- data/spec/sydney_spec.rb +23 -8
- metadata +49 -1
data/.gitignore
CHANGED
data/NEWS.md
ADDED
data/README.md
CHANGED
@@ -1,29 +1,40 @@
|
|
1
1
|
# Sydney
|
2
2
|
|
3
|
-
|
3
|
+
A [Treetop](https://github.com/nathansobo/treetop) parser for bash alias files. Organize your aliases by sections and keep comments associated with the aliases they document.
|
4
|
+
|
5
|
+
Sydney was created to feed my process an alias file and feed it to
|
6
|
+
[cheaters](http://github.com/brettterpstra/cheaters), an excellent
|
7
|
+
cheatsheet system. The output from Sydney can be a Treetop::Runtime::SyntaxNode tree, an array of the sections in your alias file, or an array of the aliases without section groupings.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
7
|
-
|
11
|
+
Install it yourself as:
|
8
12
|
|
9
|
-
gem
|
13
|
+
$ gem install sydney
|
10
14
|
|
11
|
-
|
15
|
+
## Usage
|
12
16
|
|
13
|
-
|
17
|
+
Feed your alias file to Sydney as a single string.
|
14
18
|
|
15
|
-
|
19
|
+
Sydney.parse(IO.readlines("/my/home/folder/.aliases").join)
|
16
20
|
|
17
|
-
|
21
|
+
Sydney.parse returns a Treetop syntax tree. If you organize your alias
|
22
|
+
file into sections, preceeding each section with double-banged comments,
|
23
|
+
you can use `Sydney.sections` to return an array of Section nodes.
|
18
24
|
|
19
|
-
|
25
|
+
Each section contains one or more AliasEntry nodes. An AliasEntry node
|
26
|
+
ties comments (AliasComment) before an alias to the definition
|
27
|
+
(AliasDefinition).
|
20
28
|
|
21
|
-
|
29
|
+
## Credits
|
30
|
+
Sydney was created and is maintained by [Geoff Harcourt](http://github.com/geoffharcourt) at [Five Tool Development](http://fivetool.io).
|
22
31
|
|
23
32
|
## Contributing
|
24
33
|
|
34
|
+
I'm looking for further ideas for Sydney. Please report parsing issues through [Github Issues](https://github.com/geoffharcourt/sydney/issues). Pull requests for feature additions are welcome!
|
35
|
+
|
25
36
|
1. Fork it
|
26
37
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
38
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
39
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
40
|
+
5. Create new Pull Request
|
data/doc/Gemfile.html
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Gemfile - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="project-metadata">
|
47
|
+
<nav id="fileindex-section" class="section project-section">
|
48
|
+
<h3 class="section-header">Pages</h3>
|
49
|
+
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a>
|
53
|
+
|
54
|
+
<li class="file"><a href="./LICENSE.html">LICENSE</a>
|
55
|
+
|
56
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a>
|
57
|
+
|
58
|
+
<li class="file"><a href="./spec/fixtures/aliases.html">aliases</a>
|
59
|
+
|
60
|
+
</ul>
|
61
|
+
</nav>
|
62
|
+
|
63
|
+
<nav id="classindex-section" class="section project-section">
|
64
|
+
<h3 class="section-header">Class and Module Index</h3>
|
65
|
+
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="./SydneyAliasFile.html">SydneyAliasFile</a>
|
69
|
+
|
70
|
+
<li><a href="./SydneyAliasFile/AliasComment.html">SydneyAliasFile::AliasComment</a>
|
71
|
+
|
72
|
+
<li><a href="./SydneyAliasFile/AliasDefinition.html">SydneyAliasFile::AliasDefinition</a>
|
73
|
+
|
74
|
+
<li><a href="./SydneyAliasFile/AliasEntry.html">SydneyAliasFile::AliasEntry</a>
|
75
|
+
|
76
|
+
<li><a href="./SydneyAliasFile/Document.html">SydneyAliasFile::Document</a>
|
77
|
+
|
78
|
+
<li><a href="./SydneyAliasFile/Section.html">SydneyAliasFile::Section</a>
|
79
|
+
|
80
|
+
<li><a href="./SydneyAliasFile/SectionComment.html">SydneyAliasFile::SectionComment</a>
|
81
|
+
|
82
|
+
<li><a href="./SydneyAliasFile/SyntaxNode.html">SydneyAliasFile::SyntaxNode</a>
|
83
|
+
|
84
|
+
<li><a href="./Sydney.html">Sydney</a>
|
85
|
+
|
86
|
+
</ul>
|
87
|
+
</nav>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
</nav>
|
91
|
+
|
92
|
+
<div id="documentation" class="description">
|
93
|
+
|
94
|
+
<p>source ‘<a href="https://rubygems.org">rubygems.org</a>’</p>
|
95
|
+
|
96
|
+
<p># Specify your gem’s dependencies in sydney.gemspec gemspec</p>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<footer id="validator-badges">
|
103
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
104
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
105
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
106
|
+
</footer>
|
107
|
+
|
data/doc/LICENSE.html
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>LICENSE - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="project-metadata">
|
47
|
+
<nav id="fileindex-section" class="section project-section">
|
48
|
+
<h3 class="section-header">Pages</h3>
|
49
|
+
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a>
|
53
|
+
|
54
|
+
<li class="file"><a href="./LICENSE.html">LICENSE</a>
|
55
|
+
|
56
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a>
|
57
|
+
|
58
|
+
<li class="file"><a href="./spec/fixtures/aliases.html">aliases</a>
|
59
|
+
|
60
|
+
</ul>
|
61
|
+
</nav>
|
62
|
+
|
63
|
+
<nav id="classindex-section" class="section project-section">
|
64
|
+
<h3 class="section-header">Class and Module Index</h3>
|
65
|
+
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="./SydneyAliasFile.html">SydneyAliasFile</a>
|
69
|
+
|
70
|
+
<li><a href="./SydneyAliasFile/AliasComment.html">SydneyAliasFile::AliasComment</a>
|
71
|
+
|
72
|
+
<li><a href="./SydneyAliasFile/AliasDefinition.html">SydneyAliasFile::AliasDefinition</a>
|
73
|
+
|
74
|
+
<li><a href="./SydneyAliasFile/AliasEntry.html">SydneyAliasFile::AliasEntry</a>
|
75
|
+
|
76
|
+
<li><a href="./SydneyAliasFile/Document.html">SydneyAliasFile::Document</a>
|
77
|
+
|
78
|
+
<li><a href="./SydneyAliasFile/Section.html">SydneyAliasFile::Section</a>
|
79
|
+
|
80
|
+
<li><a href="./SydneyAliasFile/SectionComment.html">SydneyAliasFile::SectionComment</a>
|
81
|
+
|
82
|
+
<li><a href="./SydneyAliasFile/SyntaxNode.html">SydneyAliasFile::SyntaxNode</a>
|
83
|
+
|
84
|
+
<li><a href="./Sydney.html">Sydney</a>
|
85
|
+
|
86
|
+
</ul>
|
87
|
+
</nav>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
</nav>
|
91
|
+
|
92
|
+
<div id="documentation" class="description">
|
93
|
+
|
94
|
+
<p>Copyright © 2013 Geoff Harcourt</p>
|
95
|
+
|
96
|
+
<p>MIT License</p>
|
97
|
+
|
98
|
+
<p>Permission is hereby granted, free of charge, to any person obtaining a
|
99
|
+
copy of this software and associated documentation files (the “Software”),
|
100
|
+
to deal in the Software without restriction, including without limitation
|
101
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
102
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
103
|
+
Software is furnished to do so, subject to the following conditions:</p>
|
104
|
+
|
105
|
+
<p>The above copyright notice and this permission notice shall be included in
|
106
|
+
all copies or substantial portions of the Software.</p>
|
107
|
+
|
108
|
+
<p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
109
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
110
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
111
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
112
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
113
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
114
|
+
DEALINGS IN THE SOFTWARE.</p>
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<footer id="validator-badges">
|
121
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
122
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
123
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
124
|
+
</footer>
|
125
|
+
|
data/doc/Rakefile.html
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Rakefile - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="project-metadata">
|
47
|
+
<nav id="fileindex-section" class="section project-section">
|
48
|
+
<h3 class="section-header">Pages</h3>
|
49
|
+
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a>
|
53
|
+
|
54
|
+
<li class="file"><a href="./LICENSE.html">LICENSE</a>
|
55
|
+
|
56
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a>
|
57
|
+
|
58
|
+
<li class="file"><a href="./spec/fixtures/aliases.html">aliases</a>
|
59
|
+
|
60
|
+
</ul>
|
61
|
+
</nav>
|
62
|
+
|
63
|
+
<nav id="classindex-section" class="section project-section">
|
64
|
+
<h3 class="section-header">Class and Module Index</h3>
|
65
|
+
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="./SydneyAliasFile.html">SydneyAliasFile</a>
|
69
|
+
|
70
|
+
<li><a href="./SydneyAliasFile/AliasComment.html">SydneyAliasFile::AliasComment</a>
|
71
|
+
|
72
|
+
<li><a href="./SydneyAliasFile/AliasDefinition.html">SydneyAliasFile::AliasDefinition</a>
|
73
|
+
|
74
|
+
<li><a href="./SydneyAliasFile/AliasEntry.html">SydneyAliasFile::AliasEntry</a>
|
75
|
+
|
76
|
+
<li><a href="./SydneyAliasFile/Document.html">SydneyAliasFile::Document</a>
|
77
|
+
|
78
|
+
<li><a href="./SydneyAliasFile/Section.html">SydneyAliasFile::Section</a>
|
79
|
+
|
80
|
+
<li><a href="./SydneyAliasFile/SectionComment.html">SydneyAliasFile::SectionComment</a>
|
81
|
+
|
82
|
+
<li><a href="./SydneyAliasFile/SyntaxNode.html">SydneyAliasFile::SyntaxNode</a>
|
83
|
+
|
84
|
+
<li><a href="./Sydney.html">Sydney</a>
|
85
|
+
|
86
|
+
</ul>
|
87
|
+
</nav>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
</nav>
|
91
|
+
|
92
|
+
<div id="documentation" class="description">
|
93
|
+
|
94
|
+
<p>require “bundler/gem_tasks”</p>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<footer id="validator-badges">
|
101
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
102
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
103
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
104
|
+
</footer>
|
105
|
+
|
data/doc/Sydney.html
ADDED
@@ -0,0 +1,276 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>module Sydney - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="module">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/sydney/version.rb
|
51
|
+
<li>lib/sydney.rb
|
52
|
+
</ul>
|
53
|
+
</nav>
|
54
|
+
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
<!-- Method Quickref -->
|
63
|
+
<nav id="method-list-section" class="section">
|
64
|
+
<h3 class="section-header">Methods</h3>
|
65
|
+
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="#method-c-aliases">::aliases</a>
|
69
|
+
|
70
|
+
<li><a href="#method-c-parse">::parse</a>
|
71
|
+
|
72
|
+
<li><a href="#method-c-sections">::sections</a>
|
73
|
+
|
74
|
+
</ul>
|
75
|
+
</nav>
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="project-metadata">
|
80
|
+
<nav id="fileindex-section" class="section project-section">
|
81
|
+
<h3 class="section-header">Pages</h3>
|
82
|
+
|
83
|
+
<ul>
|
84
|
+
|
85
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a>
|
86
|
+
|
87
|
+
<li class="file"><a href="./LICENSE.html">LICENSE</a>
|
88
|
+
|
89
|
+
<li class="file"><a href="./Rakefile.html">Rakefile</a>
|
90
|
+
|
91
|
+
<li class="file"><a href="./spec/fixtures/aliases.html">aliases</a>
|
92
|
+
|
93
|
+
</ul>
|
94
|
+
</nav>
|
95
|
+
|
96
|
+
<nav id="classindex-section" class="section project-section">
|
97
|
+
<h3 class="section-header">Class and Module Index</h3>
|
98
|
+
|
99
|
+
<ul class="link-list">
|
100
|
+
|
101
|
+
<li><a href="./SydneyAliasFile.html">SydneyAliasFile</a>
|
102
|
+
|
103
|
+
<li><a href="./SydneyAliasFile/AliasComment.html">SydneyAliasFile::AliasComment</a>
|
104
|
+
|
105
|
+
<li><a href="./SydneyAliasFile/AliasDefinition.html">SydneyAliasFile::AliasDefinition</a>
|
106
|
+
|
107
|
+
<li><a href="./SydneyAliasFile/AliasEntry.html">SydneyAliasFile::AliasEntry</a>
|
108
|
+
|
109
|
+
<li><a href="./SydneyAliasFile/Document.html">SydneyAliasFile::Document</a>
|
110
|
+
|
111
|
+
<li><a href="./SydneyAliasFile/Section.html">SydneyAliasFile::Section</a>
|
112
|
+
|
113
|
+
<li><a href="./SydneyAliasFile/SectionComment.html">SydneyAliasFile::SectionComment</a>
|
114
|
+
|
115
|
+
<li><a href="./SydneyAliasFile/SyntaxNode.html">SydneyAliasFile::SyntaxNode</a>
|
116
|
+
|
117
|
+
<li><a href="./Sydney.html">Sydney</a>
|
118
|
+
|
119
|
+
</ul>
|
120
|
+
</nav>
|
121
|
+
|
122
|
+
</div>
|
123
|
+
</nav>
|
124
|
+
|
125
|
+
<div id="documentation">
|
126
|
+
<h1 class="module">module Sydney</h1>
|
127
|
+
|
128
|
+
<div id="description" class="description">
|
129
|
+
|
130
|
+
</div><!-- description -->
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<!-- Constants -->
|
142
|
+
<section id="constants-list" class="section">
|
143
|
+
<h3 class="section-header">Constants</h3>
|
144
|
+
<dl>
|
145
|
+
|
146
|
+
<dt id="VERSION">VERSION
|
147
|
+
|
148
|
+
<dd class="description">
|
149
|
+
|
150
|
+
|
151
|
+
</dl>
|
152
|
+
</section>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<!-- Methods -->
|
158
|
+
|
159
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
160
|
+
<h3 class="section-header">Public Class Methods</h3>
|
161
|
+
|
162
|
+
|
163
|
+
<div id="method-c-aliases" class="method-detail ">
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<span class="method-name">aliases</span><span
|
167
|
+
class="method-args">(data)</span>
|
168
|
+
<span class="method-click-advice">click to toggle source</span>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
|
174
|
+
<p>Parse the string and return an array of AliasEntry nodes</p>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<div class="method-source-code" id="aliases-source">
|
179
|
+
<pre><span class="ruby-comment"># File lib/sydney.rb, line 35</span>
|
180
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">aliases</span>(<span class="ruby-identifier">data</span>)
|
181
|
+
<span class="ruby-identifier">sections</span>(<span class="ruby-identifier">data</span>).<span class="ruby-identifier">map</span>(&<span class="ruby-value">:entries</span>).<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">map</span>(&<span class="ruby-value">:alias</span>).<span class="ruby-identifier">flatten</span>
|
182
|
+
<span class="ruby-keyword">end</span></pre>
|
183
|
+
</div><!-- aliases-source -->
|
184
|
+
|
185
|
+
</div>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
</div><!-- aliases-method -->
|
191
|
+
|
192
|
+
|
193
|
+
<div id="method-c-parse" class="method-detail ">
|
194
|
+
|
195
|
+
<div class="method-heading">
|
196
|
+
<span class="method-name">parse</span><span
|
197
|
+
class="method-args">(data)</span>
|
198
|
+
<span class="method-click-advice">click to toggle source</span>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
<div class="method-description">
|
203
|
+
|
204
|
+
<p>Parse the supplied string and return a Treetop::Runtime::SyntaxNode tree</p>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<div class="method-source-code" id="parse-source">
|
209
|
+
<pre><span class="ruby-comment"># File lib/sydney.rb, line 19</span>
|
210
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">data</span>)
|
211
|
+
<span class="ruby-comment"># Pass the data over to the parser instance</span>
|
212
|
+
<span class="ruby-identifier">tree</span> = <span class="ruby-identifier">@@parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">data</span>)
|
213
|
+
|
214
|
+
<span class="ruby-comment"># If the AST is nil then there was an error during parsing</span>
|
215
|
+
<span class="ruby-comment"># we need to report a simple error message to help the user</span>
|
216
|
+
<span class="ruby-keyword">if</span>(<span class="ruby-identifier">tree</span>.<span class="ruby-identifier">nil?</span>)
|
217
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Exception</span>, <span class="ruby-node">"Parse error at offset: #{@@parser.index}"</span>
|
218
|
+
<span class="ruby-keyword">end</span>
|
219
|
+
|
220
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">clean_tree</span>(<span class="ruby-identifier">tree</span>)
|
221
|
+
|
222
|
+
<span class="ruby-identifier">tree</span>
|
223
|
+
<span class="ruby-keyword">end</span></pre>
|
224
|
+
</div><!-- parse-source -->
|
225
|
+
|
226
|
+
</div>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</div><!-- parse-method -->
|
232
|
+
|
233
|
+
|
234
|
+
<div id="method-c-sections" class="method-detail ">
|
235
|
+
|
236
|
+
<div class="method-heading">
|
237
|
+
<span class="method-name">sections</span><span
|
238
|
+
class="method-args">(data)</span>
|
239
|
+
<span class="method-click-advice">click to toggle source</span>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
|
243
|
+
<div class="method-description">
|
244
|
+
|
245
|
+
<p>Parse the string and return an array of Section nodes</p>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<div class="method-source-code" id="sections-source">
|
250
|
+
<pre><span class="ruby-comment"># File lib/sydney.rb, line 40</span>
|
251
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">sections</span>(<span class="ruby-identifier">data</span>)
|
252
|
+
<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">data</span>).<span class="ruby-identifier">sections</span>
|
253
|
+
<span class="ruby-keyword">end</span></pre>
|
254
|
+
</div><!-- sections-source -->
|
255
|
+
|
256
|
+
</div>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
</div><!-- sections-method -->
|
262
|
+
|
263
|
+
|
264
|
+
</section><!-- public-class-method-details -->
|
265
|
+
|
266
|
+
</section><!-- 5Buntitled-5D -->
|
267
|
+
|
268
|
+
</div><!-- documentation -->
|
269
|
+
|
270
|
+
|
271
|
+
<footer id="validator-badges">
|
272
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
273
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
274
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
275
|
+
</footer>
|
276
|
+
|