dgh 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +42 -0
- data/.rspec +1 -0
- data/.rvmrc +2 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +47 -0
- data/Rakefile +20 -0
- data/bin/dgh +4 -0
- data/cucumber.yml +1 -0
- data/dgh.gemspec +44 -0
- data/features/dgh.feature +9 -0
- data/features/step_definitions/dgh_steps.rb +11 -0
- data/features/support/env.rb +19 -0
- data/lib/dgh.rb +45 -0
- data/lib/dgh/version.rb +10 -0
- data/lib/policy.rb +1301 -0
- data/lib/policy.treetop +170 -0
- data/spec/dgh_spec.rb +74 -0
- data/spec/spec_helper.rb +20 -0
- data/tests.watchr +162 -0
- metadata +184 -0
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
|
4
|
+
# rdoc generated
|
5
|
+
rdoc
|
6
|
+
|
7
|
+
# yard generated
|
8
|
+
doc
|
9
|
+
.yardoc
|
10
|
+
|
11
|
+
# bundler
|
12
|
+
.bundle
|
13
|
+
|
14
|
+
# jeweler generated
|
15
|
+
pkg
|
16
|
+
|
17
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
18
|
+
#
|
19
|
+
# * Create a file at ~/.gitignore
|
20
|
+
# * Include files you want ignored
|
21
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
22
|
+
#
|
23
|
+
# After doing this, these files will be ignored in all your git projects,
|
24
|
+
# saving you from having to 'pollute' every project you touch with them
|
25
|
+
#
|
26
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
27
|
+
#
|
28
|
+
# For MacOS:
|
29
|
+
#
|
30
|
+
#.DS_Store
|
31
|
+
#
|
32
|
+
# For TextMate
|
33
|
+
#*.tmproj
|
34
|
+
#tmtags
|
35
|
+
#
|
36
|
+
# For emacs:
|
37
|
+
#*~
|
38
|
+
#\#*
|
39
|
+
#.\#*
|
40
|
+
#
|
41
|
+
# For vim:
|
42
|
+
#*.swp
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rvmrc
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Ilkka Laukkanen
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
= dgh -- the Debian/Ubuntu downgrade helper
|
2
|
+
|
3
|
+
Ever installed a bunch of stuff from a lovely PPA or other repository, only to
|
4
|
+
find that you managed to break your entire system? And then when you want to go
|
5
|
+
back to the way things were before, you have to find out which packages got
|
6
|
+
installed or upgraded and downgrade them manually, and hope you caught them
|
7
|
+
all?
|
8
|
+
|
9
|
+
Dgh can't solve the whole problem, but it will help you. What it does is scan
|
10
|
+
the installed and available versions of all packages, and report packages that
|
11
|
+
have an installed version that is higher than the version in any repository.
|
12
|
+
That way you can downgrade by first removing the offending repository, then
|
13
|
+
updating your package cache, then running dgh and manually downgrading the
|
14
|
+
packages it reports.
|
15
|
+
|
16
|
+
Note that it can't know which repository a package originally came from, so if
|
17
|
+
you are running some homebrew packages that are meant to override versions from
|
18
|
+
repositories, dgh will report them too.
|
19
|
+
|
20
|
+
== Usage ==
|
21
|
+
|
22
|
+
Create a file with the policy output for your installed packages:
|
23
|
+
|
24
|
+
$ dpkg --get-selections|egrep '\binstall'|awk '{print $1}'| \
|
25
|
+
xargs env LANG=C apt-cache policy|tee packages.list
|
26
|
+
|
27
|
+
Run dgh on the file:
|
28
|
+
|
29
|
+
$ dgh packages.list
|
30
|
+
|
31
|
+
The output should be the list of packages you might want to downgrade.
|
32
|
+
|
33
|
+
== Contributing to dgh
|
34
|
+
|
35
|
+
* Check out the develop branch to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
36
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
37
|
+
* Fork the project
|
38
|
+
* Start a feature/bugfix branch off of the develop branch
|
39
|
+
* Commit and push until you are happy with your contribution
|
40
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
41
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
42
|
+
|
43
|
+
== Copyright
|
44
|
+
|
45
|
+
Copyright (c) 2011 Ilkka Laukkanen. See LICENSE.txt for
|
46
|
+
further details.
|
47
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
require 'rspec/core'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
8
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
12
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
13
|
+
spec.rcov = true
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'cucumber/rake/task'
|
17
|
+
Cucumber::Rake::Task.new(:features)
|
18
|
+
|
19
|
+
require 'yard'
|
20
|
+
YARD::Rake::YardocTask.new
|
data/bin/dgh
ADDED
data/cucumber.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default: --color --drb --port 8990
|
data/dgh.gemspec
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'dgh/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'dgh'
|
7
|
+
s.version = Dgh::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Ilkka Laukkanen"]
|
10
|
+
s.email = [%q{ilkka.s.laukkanen@gmail.com}]
|
11
|
+
s.homepage = %q{http://github.com/ilkka/dgh}
|
12
|
+
s.summary = %q{The Debian/Ubuntu Downgrade Helper}
|
13
|
+
s.licenses = ["GPLv3"]
|
14
|
+
s.description = %q{Dgh helps when you have to manually downgrade a large amount of packages.
|
15
|
+
It requires the user to generate a file with `apt-cache policy` output for all
|
16
|
+
installed packages, which it then reads. It looks for packages that have a
|
17
|
+
currently installed version that doesn't exist in any repository, and prints
|
18
|
+
those. This includes both locally generated packages that never did exist in
|
19
|
+
any repository, and more crucially, packages that have been upgraded from e.g.
|
20
|
+
a PPA that has since been removed from the system.
|
21
|
+
}
|
22
|
+
|
23
|
+
s.files = `git ls-files`.split("\n")
|
24
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map {|f| File.basename f}
|
26
|
+
s.default_executable = %q{dgh}
|
27
|
+
s.extra_rdoc_files = [
|
28
|
+
"LICENSE.txt",
|
29
|
+
"README.rdoc"
|
30
|
+
]
|
31
|
+
s.require_paths = ["lib"]
|
32
|
+
|
33
|
+
s.add_runtime_dependency('treetop', [">= 0"])
|
34
|
+
|
35
|
+
s.add_development_dependency('rake', '~> 0.9.0')
|
36
|
+
s.add_development_dependency('rspec', ["~> 2.6.0"])
|
37
|
+
s.add_development_dependency('yard', ["~> 0.6.0"])
|
38
|
+
s.add_development_dependency('cucumber', [">= 0"])
|
39
|
+
s.add_development_dependency('bundler', ["~> 1.0.13"])
|
40
|
+
s.add_development_dependency('jeweler', ["~> 1.5.2"])
|
41
|
+
s.add_development_dependency('spork', [">= 0"])
|
42
|
+
s.add_development_dependency('watchr', [">= 0"])
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: report downgrade candidates
|
2
|
+
In order to fix my computer
|
3
|
+
As an administrator
|
4
|
+
I want to get a list of packages I need to downgrade
|
5
|
+
|
6
|
+
Scenario: no downgradable packages
|
7
|
+
Given that there are no downgradable packages
|
8
|
+
When I run dgh
|
9
|
+
Then no packages should be reported as downgrade candidates
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Given /^that there are no downgradable packages$/ do
|
2
|
+
# pass
|
3
|
+
end
|
4
|
+
|
5
|
+
When /^I run dgh$/ do
|
6
|
+
@output = `#{File.join(File.dirname(__FILE__), '..', '..', 'bin', 'dgh')}`
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^no packages should be reported as downgrade candidates$/ do
|
10
|
+
@output.length.should == 0
|
11
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spork'
|
3
|
+
|
4
|
+
Spork.prefork do
|
5
|
+
require 'bundler'
|
6
|
+
begin
|
7
|
+
Bundler.setup(:default, :development)
|
8
|
+
rescue Bundler::BundlerError => e
|
9
|
+
$stderr.puts e.message
|
10
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
11
|
+
exit e.status_code
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'rspec/expectations'
|
15
|
+
end
|
16
|
+
|
17
|
+
Spork.each_run do
|
18
|
+
end
|
19
|
+
|
data/lib/dgh.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'treetop'
|
2
|
+
require 'policy'
|
3
|
+
|
4
|
+
module Dgh
|
5
|
+
extend self
|
6
|
+
|
7
|
+
# Parse input with the policy grammar
|
8
|
+
#
|
9
|
+
# @param input [String] apt-cache policy input
|
10
|
+
# @return a list of hashes with info on packages
|
11
|
+
def parse(input)
|
12
|
+
@parser ||= PolicyParser.new
|
13
|
+
@parser.parse input
|
14
|
+
end
|
15
|
+
|
16
|
+
# Find downgradable packages
|
17
|
+
#
|
18
|
+
# @param paca
|
19
|
+
def find_downgradable(packages)
|
20
|
+
packages.select do |pkg|
|
21
|
+
pkg[:versions].any? do |ver|
|
22
|
+
ver[:current] && ver[:sources].length == 1 && ver[:sources][0][:source] == '/var/lib/dpkg/status'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def run
|
29
|
+
if ARGV.empty? || ARGV.any? {|a| !File.exist? a}
|
30
|
+
puts "dgh, the Debian/Ubuntu Downgrade Helper"
|
31
|
+
puts "Usage: dgh <apt-cache policy listing>"
|
32
|
+
puts "You can generate a policy listing by running e.g."
|
33
|
+
puts "`dpkg --get-selections|egrep '\\binstall'|awk '{print $1}'|\\"
|
34
|
+
puts " xargs env LANG=C apt-cache policy`"
|
35
|
+
else
|
36
|
+
ARGV.each do |f|
|
37
|
+
puts "Parsing #{f}:"
|
38
|
+
find_downgradable(parse(File.open(f).read).content).each do |pkg|
|
39
|
+
puts " " + pkg[:name]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/dgh/version.rb
ADDED
data/lib/policy.rb
ADDED
@@ -0,0 +1,1301 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
# Treetop grammar for apt-cache policy output
|
5
|
+
module Policy
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root ||= :package_list
|
10
|
+
end
|
11
|
+
|
12
|
+
module PackageList0
|
13
|
+
def content
|
14
|
+
elements.map {|e| e.content}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def _nt_package_list
|
19
|
+
start_index = index
|
20
|
+
if node_cache[:package_list].has_key?(index)
|
21
|
+
cached = node_cache[:package_list][index]
|
22
|
+
if cached
|
23
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
24
|
+
@index = cached.interval.end
|
25
|
+
end
|
26
|
+
return cached
|
27
|
+
end
|
28
|
+
|
29
|
+
s0, i0 = [], index
|
30
|
+
loop do
|
31
|
+
r1 = _nt_package_entry
|
32
|
+
if r1
|
33
|
+
s0 << r1
|
34
|
+
else
|
35
|
+
break
|
36
|
+
end
|
37
|
+
end
|
38
|
+
if s0.empty?
|
39
|
+
@index = i0
|
40
|
+
r0 = nil
|
41
|
+
else
|
42
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
43
|
+
r0.extend(PackageList0)
|
44
|
+
end
|
45
|
+
|
46
|
+
node_cache[:package_list][start_index] = r0
|
47
|
+
|
48
|
+
r0
|
49
|
+
end
|
50
|
+
|
51
|
+
module PackageEntry0
|
52
|
+
def package_name
|
53
|
+
elements[0]
|
54
|
+
end
|
55
|
+
|
56
|
+
def installed
|
57
|
+
elements[3]
|
58
|
+
end
|
59
|
+
|
60
|
+
def candidate
|
61
|
+
elements[6]
|
62
|
+
end
|
63
|
+
|
64
|
+
def version_table
|
65
|
+
elements[8]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
module PackageEntry1
|
70
|
+
def content
|
71
|
+
{
|
72
|
+
:name => elements[0].content,
|
73
|
+
:installed_version => elements[3].content,
|
74
|
+
:candidate_version => elements[6].content,
|
75
|
+
:versions => elements[8].content
|
76
|
+
}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def _nt_package_entry
|
81
|
+
start_index = index
|
82
|
+
if node_cache[:package_entry].has_key?(index)
|
83
|
+
cached = node_cache[:package_entry][index]
|
84
|
+
if cached
|
85
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
86
|
+
@index = cached.interval.end
|
87
|
+
end
|
88
|
+
return cached
|
89
|
+
end
|
90
|
+
|
91
|
+
i0, s0 = index, []
|
92
|
+
r1 = _nt_package_name
|
93
|
+
s0 << r1
|
94
|
+
if r1
|
95
|
+
if has_terminal?(":\n", false, index)
|
96
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
97
|
+
@index += 2
|
98
|
+
else
|
99
|
+
terminal_parse_failure(":\n")
|
100
|
+
r2 = nil
|
101
|
+
end
|
102
|
+
s0 << r2
|
103
|
+
if r2
|
104
|
+
if has_terminal?(" ", false, index)
|
105
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
106
|
+
@index += 2
|
107
|
+
else
|
108
|
+
terminal_parse_failure(" ")
|
109
|
+
r3 = nil
|
110
|
+
end
|
111
|
+
s0 << r3
|
112
|
+
if r3
|
113
|
+
r4 = _nt_installed
|
114
|
+
s0 << r4
|
115
|
+
if r4
|
116
|
+
if has_terminal?("\n", false, index)
|
117
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
118
|
+
@index += 1
|
119
|
+
else
|
120
|
+
terminal_parse_failure("\n")
|
121
|
+
r5 = nil
|
122
|
+
end
|
123
|
+
s0 << r5
|
124
|
+
if r5
|
125
|
+
if has_terminal?(" ", false, index)
|
126
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 2))
|
127
|
+
@index += 2
|
128
|
+
else
|
129
|
+
terminal_parse_failure(" ")
|
130
|
+
r6 = nil
|
131
|
+
end
|
132
|
+
s0 << r6
|
133
|
+
if r6
|
134
|
+
r7 = _nt_candidate
|
135
|
+
s0 << r7
|
136
|
+
if r7
|
137
|
+
if has_terminal?("\n", false, index)
|
138
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
139
|
+
@index += 1
|
140
|
+
else
|
141
|
+
terminal_parse_failure("\n")
|
142
|
+
r8 = nil
|
143
|
+
end
|
144
|
+
s0 << r8
|
145
|
+
if r8
|
146
|
+
r9 = _nt_version_table
|
147
|
+
s0 << r9
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
if s0.last
|
157
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
158
|
+
r0.extend(PackageEntry0)
|
159
|
+
r0.extend(PackageEntry1)
|
160
|
+
else
|
161
|
+
@index = i0
|
162
|
+
r0 = nil
|
163
|
+
end
|
164
|
+
|
165
|
+
node_cache[:package_entry][start_index] = r0
|
166
|
+
|
167
|
+
r0
|
168
|
+
end
|
169
|
+
|
170
|
+
module PackageName0
|
171
|
+
def content
|
172
|
+
elements.inject("") {|s,e| s << e.text_value}
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def _nt_package_name
|
177
|
+
start_index = index
|
178
|
+
if node_cache[:package_name].has_key?(index)
|
179
|
+
cached = node_cache[:package_name][index]
|
180
|
+
if cached
|
181
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
182
|
+
@index = cached.interval.end
|
183
|
+
end
|
184
|
+
return cached
|
185
|
+
end
|
186
|
+
|
187
|
+
s0, i0 = [], index
|
188
|
+
loop do
|
189
|
+
if has_terminal?('\G[a-z0-9_.+-]', true, index)
|
190
|
+
r1 = true
|
191
|
+
@index += 1
|
192
|
+
else
|
193
|
+
r1 = nil
|
194
|
+
end
|
195
|
+
if r1
|
196
|
+
s0 << r1
|
197
|
+
else
|
198
|
+
break
|
199
|
+
end
|
200
|
+
end
|
201
|
+
if s0.empty?
|
202
|
+
@index = i0
|
203
|
+
r0 = nil
|
204
|
+
else
|
205
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
206
|
+
r0.extend(PackageName0)
|
207
|
+
end
|
208
|
+
|
209
|
+
node_cache[:package_name][start_index] = r0
|
210
|
+
|
211
|
+
r0
|
212
|
+
end
|
213
|
+
|
214
|
+
module Installed0
|
215
|
+
def version
|
216
|
+
elements[1]
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
module Installed1
|
221
|
+
def content
|
222
|
+
elements[1].content
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
def _nt_installed
|
227
|
+
start_index = index
|
228
|
+
if node_cache[:installed].has_key?(index)
|
229
|
+
cached = node_cache[:installed][index]
|
230
|
+
if cached
|
231
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
232
|
+
@index = cached.interval.end
|
233
|
+
end
|
234
|
+
return cached
|
235
|
+
end
|
236
|
+
|
237
|
+
i0, s0 = index, []
|
238
|
+
if has_terminal?("Installed: ", false, index)
|
239
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 11))
|
240
|
+
@index += 11
|
241
|
+
else
|
242
|
+
terminal_parse_failure("Installed: ")
|
243
|
+
r1 = nil
|
244
|
+
end
|
245
|
+
s0 << r1
|
246
|
+
if r1
|
247
|
+
r2 = _nt_version
|
248
|
+
s0 << r2
|
249
|
+
end
|
250
|
+
if s0.last
|
251
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
252
|
+
r0.extend(Installed0)
|
253
|
+
r0.extend(Installed1)
|
254
|
+
else
|
255
|
+
@index = i0
|
256
|
+
r0 = nil
|
257
|
+
end
|
258
|
+
|
259
|
+
node_cache[:installed][start_index] = r0
|
260
|
+
|
261
|
+
r0
|
262
|
+
end
|
263
|
+
|
264
|
+
module Candidate0
|
265
|
+
def version
|
266
|
+
elements[1]
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
module Candidate1
|
271
|
+
def content
|
272
|
+
elements[1].content
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
def _nt_candidate
|
277
|
+
start_index = index
|
278
|
+
if node_cache[:candidate].has_key?(index)
|
279
|
+
cached = node_cache[:candidate][index]
|
280
|
+
if cached
|
281
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
282
|
+
@index = cached.interval.end
|
283
|
+
end
|
284
|
+
return cached
|
285
|
+
end
|
286
|
+
|
287
|
+
i0, s0 = index, []
|
288
|
+
if has_terminal?("Candidate: ", false, index)
|
289
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 11))
|
290
|
+
@index += 11
|
291
|
+
else
|
292
|
+
terminal_parse_failure("Candidate: ")
|
293
|
+
r1 = nil
|
294
|
+
end
|
295
|
+
s0 << r1
|
296
|
+
if r1
|
297
|
+
r2 = _nt_version
|
298
|
+
s0 << r2
|
299
|
+
end
|
300
|
+
if s0.last
|
301
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
302
|
+
r0.extend(Candidate0)
|
303
|
+
r0.extend(Candidate1)
|
304
|
+
else
|
305
|
+
@index = i0
|
306
|
+
r0 = nil
|
307
|
+
end
|
308
|
+
|
309
|
+
node_cache[:candidate][start_index] = r0
|
310
|
+
|
311
|
+
r0
|
312
|
+
end
|
313
|
+
|
314
|
+
module Version0
|
315
|
+
end
|
316
|
+
|
317
|
+
module Version1
|
318
|
+
end
|
319
|
+
|
320
|
+
module Version2
|
321
|
+
def content
|
322
|
+
text_value
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
def _nt_version
|
327
|
+
start_index = index
|
328
|
+
if node_cache[:version].has_key?(index)
|
329
|
+
cached = node_cache[:version][index]
|
330
|
+
if cached
|
331
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
332
|
+
@index = cached.interval.end
|
333
|
+
end
|
334
|
+
return cached
|
335
|
+
end
|
336
|
+
|
337
|
+
i0, s0 = index, []
|
338
|
+
i2, s2 = index, []
|
339
|
+
if has_terminal?('\G[0-9]', true, index)
|
340
|
+
r3 = true
|
341
|
+
@index += 1
|
342
|
+
else
|
343
|
+
r3 = nil
|
344
|
+
end
|
345
|
+
s2 << r3
|
346
|
+
if r3
|
347
|
+
if has_terminal?(":", false, index)
|
348
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
349
|
+
@index += 1
|
350
|
+
else
|
351
|
+
terminal_parse_failure(":")
|
352
|
+
r4 = nil
|
353
|
+
end
|
354
|
+
s2 << r4
|
355
|
+
end
|
356
|
+
if s2.last
|
357
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
358
|
+
r2.extend(Version0)
|
359
|
+
else
|
360
|
+
@index = i2
|
361
|
+
r2 = nil
|
362
|
+
end
|
363
|
+
if r2
|
364
|
+
r1 = r2
|
365
|
+
else
|
366
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
367
|
+
end
|
368
|
+
s0 << r1
|
369
|
+
if r1
|
370
|
+
s5, i5 = [], index
|
371
|
+
loop do
|
372
|
+
if has_terminal?('\G[a-zA-Z0-9_.~+-]', true, index)
|
373
|
+
r6 = true
|
374
|
+
@index += 1
|
375
|
+
else
|
376
|
+
r6 = nil
|
377
|
+
end
|
378
|
+
if r6
|
379
|
+
s5 << r6
|
380
|
+
else
|
381
|
+
break
|
382
|
+
end
|
383
|
+
end
|
384
|
+
if s5.empty?
|
385
|
+
@index = i5
|
386
|
+
r5 = nil
|
387
|
+
else
|
388
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
389
|
+
end
|
390
|
+
s0 << r5
|
391
|
+
end
|
392
|
+
if s0.last
|
393
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
394
|
+
r0.extend(Version1)
|
395
|
+
r0.extend(Version2)
|
396
|
+
else
|
397
|
+
@index = i0
|
398
|
+
r0 = nil
|
399
|
+
end
|
400
|
+
|
401
|
+
node_cache[:version][start_index] = r0
|
402
|
+
|
403
|
+
r0
|
404
|
+
end
|
405
|
+
|
406
|
+
module VersionTable0
|
407
|
+
def version_table_entries
|
408
|
+
elements[1]
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
module VersionTable1
|
413
|
+
def content
|
414
|
+
elements[1].content
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
def _nt_version_table
|
419
|
+
start_index = index
|
420
|
+
if node_cache[:version_table].has_key?(index)
|
421
|
+
cached = node_cache[:version_table][index]
|
422
|
+
if cached
|
423
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
424
|
+
@index = cached.interval.end
|
425
|
+
end
|
426
|
+
return cached
|
427
|
+
end
|
428
|
+
|
429
|
+
i0, s0 = index, []
|
430
|
+
if has_terminal?(" Version table:\n", false, index)
|
431
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 17))
|
432
|
+
@index += 17
|
433
|
+
else
|
434
|
+
terminal_parse_failure(" Version table:\n")
|
435
|
+
r1 = nil
|
436
|
+
end
|
437
|
+
s0 << r1
|
438
|
+
if r1
|
439
|
+
r2 = _nt_version_table_entries
|
440
|
+
s0 << r2
|
441
|
+
end
|
442
|
+
if s0.last
|
443
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
444
|
+
r0.extend(VersionTable0)
|
445
|
+
r0.extend(VersionTable1)
|
446
|
+
else
|
447
|
+
@index = i0
|
448
|
+
r0 = nil
|
449
|
+
end
|
450
|
+
|
451
|
+
node_cache[:version_table][start_index] = r0
|
452
|
+
|
453
|
+
r0
|
454
|
+
end
|
455
|
+
|
456
|
+
module VersionTableEntries0
|
457
|
+
def content
|
458
|
+
elements.map {|e| e.content}
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
def _nt_version_table_entries
|
463
|
+
start_index = index
|
464
|
+
if node_cache[:version_table_entries].has_key?(index)
|
465
|
+
cached = node_cache[:version_table_entries][index]
|
466
|
+
if cached
|
467
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
468
|
+
@index = cached.interval.end
|
469
|
+
end
|
470
|
+
return cached
|
471
|
+
end
|
472
|
+
|
473
|
+
s0, i0 = [], index
|
474
|
+
loop do
|
475
|
+
r1 = _nt_version_table_entry
|
476
|
+
if r1
|
477
|
+
s0 << r1
|
478
|
+
else
|
479
|
+
break
|
480
|
+
end
|
481
|
+
end
|
482
|
+
if s0.empty?
|
483
|
+
@index = i0
|
484
|
+
r0 = nil
|
485
|
+
else
|
486
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
487
|
+
r0.extend(VersionTableEntries0)
|
488
|
+
end
|
489
|
+
|
490
|
+
node_cache[:version_table_entries][start_index] = r0
|
491
|
+
|
492
|
+
r0
|
493
|
+
end
|
494
|
+
|
495
|
+
module VersionTableEntry0
|
496
|
+
def version
|
497
|
+
elements[1]
|
498
|
+
end
|
499
|
+
|
500
|
+
def source_lines
|
501
|
+
elements[5]
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
module VersionTableEntry1
|
506
|
+
def content
|
507
|
+
{
|
508
|
+
:version => elements[1].content,
|
509
|
+
:current => elements[0].content,
|
510
|
+
:sources => elements[5].content
|
511
|
+
}
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
def _nt_version_table_entry
|
516
|
+
start_index = index
|
517
|
+
if node_cache[:version_table_entry].has_key?(index)
|
518
|
+
cached = node_cache[:version_table_entry][index]
|
519
|
+
if cached
|
520
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
521
|
+
@index = cached.interval.end
|
522
|
+
end
|
523
|
+
return cached
|
524
|
+
end
|
525
|
+
|
526
|
+
i0, s0 = index, []
|
527
|
+
i1 = index
|
528
|
+
r2 = _nt_current_mark
|
529
|
+
if r2
|
530
|
+
r1 = r2
|
531
|
+
else
|
532
|
+
r3 = _nt_not_current_mark
|
533
|
+
if r3
|
534
|
+
r1 = r3
|
535
|
+
else
|
536
|
+
@index = i1
|
537
|
+
r1 = nil
|
538
|
+
end
|
539
|
+
end
|
540
|
+
s0 << r1
|
541
|
+
if r1
|
542
|
+
r4 = _nt_version
|
543
|
+
s0 << r4
|
544
|
+
if r4
|
545
|
+
if has_terminal?(" ", false, index)
|
546
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
547
|
+
@index += 1
|
548
|
+
else
|
549
|
+
terminal_parse_failure(" ")
|
550
|
+
r5 = nil
|
551
|
+
end
|
552
|
+
s0 << r5
|
553
|
+
if r5
|
554
|
+
s6, i6 = [], index
|
555
|
+
loop do
|
556
|
+
if has_terminal?('\G[0-9]', true, index)
|
557
|
+
r7 = true
|
558
|
+
@index += 1
|
559
|
+
else
|
560
|
+
r7 = nil
|
561
|
+
end
|
562
|
+
if r7
|
563
|
+
s6 << r7
|
564
|
+
else
|
565
|
+
break
|
566
|
+
end
|
567
|
+
end
|
568
|
+
if s6.empty?
|
569
|
+
@index = i6
|
570
|
+
r6 = nil
|
571
|
+
else
|
572
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
573
|
+
end
|
574
|
+
s0 << r6
|
575
|
+
if r6
|
576
|
+
if has_terminal?("\n", false, index)
|
577
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
578
|
+
@index += 1
|
579
|
+
else
|
580
|
+
terminal_parse_failure("\n")
|
581
|
+
r8 = nil
|
582
|
+
end
|
583
|
+
s0 << r8
|
584
|
+
if r8
|
585
|
+
r9 = _nt_source_lines
|
586
|
+
s0 << r9
|
587
|
+
end
|
588
|
+
end
|
589
|
+
end
|
590
|
+
end
|
591
|
+
end
|
592
|
+
if s0.last
|
593
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
594
|
+
r0.extend(VersionTableEntry0)
|
595
|
+
r0.extend(VersionTableEntry1)
|
596
|
+
else
|
597
|
+
@index = i0
|
598
|
+
r0 = nil
|
599
|
+
end
|
600
|
+
|
601
|
+
node_cache[:version_table_entry][start_index] = r0
|
602
|
+
|
603
|
+
r0
|
604
|
+
end
|
605
|
+
|
606
|
+
module CurrentMark0
|
607
|
+
def content
|
608
|
+
true
|
609
|
+
end
|
610
|
+
end
|
611
|
+
|
612
|
+
def _nt_current_mark
|
613
|
+
start_index = index
|
614
|
+
if node_cache[:current_mark].has_key?(index)
|
615
|
+
cached = node_cache[:current_mark][index]
|
616
|
+
if cached
|
617
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
618
|
+
@index = cached.interval.end
|
619
|
+
end
|
620
|
+
return cached
|
621
|
+
end
|
622
|
+
|
623
|
+
if has_terminal?(" *** ", false, index)
|
624
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
625
|
+
r0.extend(CurrentMark0)
|
626
|
+
@index += 5
|
627
|
+
else
|
628
|
+
terminal_parse_failure(" *** ")
|
629
|
+
r0 = nil
|
630
|
+
end
|
631
|
+
|
632
|
+
node_cache[:current_mark][start_index] = r0
|
633
|
+
|
634
|
+
r0
|
635
|
+
end
|
636
|
+
|
637
|
+
module NotCurrentMark0
|
638
|
+
def content
|
639
|
+
false
|
640
|
+
end
|
641
|
+
end
|
642
|
+
|
643
|
+
def _nt_not_current_mark
|
644
|
+
start_index = index
|
645
|
+
if node_cache[:not_current_mark].has_key?(index)
|
646
|
+
cached = node_cache[:not_current_mark][index]
|
647
|
+
if cached
|
648
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
649
|
+
@index = cached.interval.end
|
650
|
+
end
|
651
|
+
return cached
|
652
|
+
end
|
653
|
+
|
654
|
+
if has_terminal?(" ", false, index)
|
655
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 5))
|
656
|
+
r0.extend(NotCurrentMark0)
|
657
|
+
@index += 5
|
658
|
+
else
|
659
|
+
terminal_parse_failure(" ")
|
660
|
+
r0 = nil
|
661
|
+
end
|
662
|
+
|
663
|
+
node_cache[:not_current_mark][start_index] = r0
|
664
|
+
|
665
|
+
r0
|
666
|
+
end
|
667
|
+
|
668
|
+
module SourceLines0
|
669
|
+
def content
|
670
|
+
elements.map {|e| e.content}
|
671
|
+
end
|
672
|
+
end
|
673
|
+
|
674
|
+
def _nt_source_lines
|
675
|
+
start_index = index
|
676
|
+
if node_cache[:source_lines].has_key?(index)
|
677
|
+
cached = node_cache[:source_lines][index]
|
678
|
+
if cached
|
679
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
680
|
+
@index = cached.interval.end
|
681
|
+
end
|
682
|
+
return cached
|
683
|
+
end
|
684
|
+
|
685
|
+
s0, i0 = [], index
|
686
|
+
loop do
|
687
|
+
r1 = _nt_source_line
|
688
|
+
if r1
|
689
|
+
s0 << r1
|
690
|
+
else
|
691
|
+
break
|
692
|
+
end
|
693
|
+
end
|
694
|
+
if s0.empty?
|
695
|
+
@index = i0
|
696
|
+
r0 = nil
|
697
|
+
else
|
698
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
699
|
+
r0.extend(SourceLines0)
|
700
|
+
end
|
701
|
+
|
702
|
+
node_cache[:source_lines][start_index] = r0
|
703
|
+
|
704
|
+
r0
|
705
|
+
end
|
706
|
+
|
707
|
+
module SourceLine0
|
708
|
+
def priority
|
709
|
+
elements[1]
|
710
|
+
end
|
711
|
+
|
712
|
+
end
|
713
|
+
|
714
|
+
module SourceLine1
|
715
|
+
def content
|
716
|
+
{
|
717
|
+
:priority => elements[1].content,
|
718
|
+
:source => elements[3].content
|
719
|
+
}
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
def _nt_source_line
|
724
|
+
start_index = index
|
725
|
+
if node_cache[:source_line].has_key?(index)
|
726
|
+
cached = node_cache[:source_line][index]
|
727
|
+
if cached
|
728
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
729
|
+
@index = cached.interval.end
|
730
|
+
end
|
731
|
+
return cached
|
732
|
+
end
|
733
|
+
|
734
|
+
i0, s0 = index, []
|
735
|
+
s1, i1 = [], index
|
736
|
+
loop do
|
737
|
+
if has_terminal?(" ", false, index)
|
738
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
739
|
+
@index += 1
|
740
|
+
else
|
741
|
+
terminal_parse_failure(" ")
|
742
|
+
r2 = nil
|
743
|
+
end
|
744
|
+
if r2
|
745
|
+
s1 << r2
|
746
|
+
else
|
747
|
+
break
|
748
|
+
end
|
749
|
+
end
|
750
|
+
if s1.empty?
|
751
|
+
@index = i1
|
752
|
+
r1 = nil
|
753
|
+
else
|
754
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
755
|
+
end
|
756
|
+
s0 << r1
|
757
|
+
if r1
|
758
|
+
r3 = _nt_priority
|
759
|
+
s0 << r3
|
760
|
+
if r3
|
761
|
+
s4, i4 = [], index
|
762
|
+
loop do
|
763
|
+
if has_terminal?(" ", false, index)
|
764
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
765
|
+
@index += 1
|
766
|
+
else
|
767
|
+
terminal_parse_failure(" ")
|
768
|
+
r5 = nil
|
769
|
+
end
|
770
|
+
if r5
|
771
|
+
s4 << r5
|
772
|
+
else
|
773
|
+
break
|
774
|
+
end
|
775
|
+
end
|
776
|
+
if s4.empty?
|
777
|
+
@index = i4
|
778
|
+
r4 = nil
|
779
|
+
else
|
780
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
781
|
+
end
|
782
|
+
s0 << r4
|
783
|
+
if r4
|
784
|
+
i6 = index
|
785
|
+
r7 = _nt_status_file
|
786
|
+
if r7
|
787
|
+
r6 = r7
|
788
|
+
else
|
789
|
+
r8 = _nt_apt_source
|
790
|
+
if r8
|
791
|
+
r6 = r8
|
792
|
+
else
|
793
|
+
@index = i6
|
794
|
+
r6 = nil
|
795
|
+
end
|
796
|
+
end
|
797
|
+
s0 << r6
|
798
|
+
if r6
|
799
|
+
if has_terminal?("\n", false, index)
|
800
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
801
|
+
@index += 1
|
802
|
+
else
|
803
|
+
terminal_parse_failure("\n")
|
804
|
+
r9 = nil
|
805
|
+
end
|
806
|
+
s0 << r9
|
807
|
+
end
|
808
|
+
end
|
809
|
+
end
|
810
|
+
end
|
811
|
+
if s0.last
|
812
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
813
|
+
r0.extend(SourceLine0)
|
814
|
+
r0.extend(SourceLine1)
|
815
|
+
else
|
816
|
+
@index = i0
|
817
|
+
r0 = nil
|
818
|
+
end
|
819
|
+
|
820
|
+
node_cache[:source_line][start_index] = r0
|
821
|
+
|
822
|
+
r0
|
823
|
+
end
|
824
|
+
|
825
|
+
module Priority0
|
826
|
+
def content
|
827
|
+
text_value.to_i
|
828
|
+
end
|
829
|
+
end
|
830
|
+
|
831
|
+
def _nt_priority
|
832
|
+
start_index = index
|
833
|
+
if node_cache[:priority].has_key?(index)
|
834
|
+
cached = node_cache[:priority][index]
|
835
|
+
if cached
|
836
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
837
|
+
@index = cached.interval.end
|
838
|
+
end
|
839
|
+
return cached
|
840
|
+
end
|
841
|
+
|
842
|
+
s0, i0 = [], index
|
843
|
+
loop do
|
844
|
+
if has_terminal?('\G[0-9]', true, index)
|
845
|
+
r1 = true
|
846
|
+
@index += 1
|
847
|
+
else
|
848
|
+
r1 = nil
|
849
|
+
end
|
850
|
+
if r1
|
851
|
+
s0 << r1
|
852
|
+
else
|
853
|
+
break
|
854
|
+
end
|
855
|
+
end
|
856
|
+
if s0.empty?
|
857
|
+
@index = i0
|
858
|
+
r0 = nil
|
859
|
+
else
|
860
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
861
|
+
r0.extend(Priority0)
|
862
|
+
end
|
863
|
+
|
864
|
+
node_cache[:priority][start_index] = r0
|
865
|
+
|
866
|
+
r0
|
867
|
+
end
|
868
|
+
|
869
|
+
module StatusFile0
|
870
|
+
def content
|
871
|
+
text_value
|
872
|
+
end
|
873
|
+
end
|
874
|
+
|
875
|
+
def _nt_status_file
|
876
|
+
start_index = index
|
877
|
+
if node_cache[:status_file].has_key?(index)
|
878
|
+
cached = node_cache[:status_file][index]
|
879
|
+
if cached
|
880
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
881
|
+
@index = cached.interval.end
|
882
|
+
end
|
883
|
+
return cached
|
884
|
+
end
|
885
|
+
|
886
|
+
if has_terminal?("/var/lib/dpkg/status", false, index)
|
887
|
+
r0 = instantiate_node(SyntaxNode,input, index...(index + 20))
|
888
|
+
r0.extend(StatusFile0)
|
889
|
+
@index += 20
|
890
|
+
else
|
891
|
+
terminal_parse_failure("/var/lib/dpkg/status")
|
892
|
+
r0 = nil
|
893
|
+
end
|
894
|
+
|
895
|
+
node_cache[:status_file][start_index] = r0
|
896
|
+
|
897
|
+
r0
|
898
|
+
end
|
899
|
+
|
900
|
+
module AptSource0
|
901
|
+
def section
|
902
|
+
elements[0]
|
903
|
+
end
|
904
|
+
|
905
|
+
end
|
906
|
+
|
907
|
+
module AptSource1
|
908
|
+
def arch
|
909
|
+
elements[0]
|
910
|
+
end
|
911
|
+
|
912
|
+
end
|
913
|
+
|
914
|
+
module AptSource2
|
915
|
+
def url
|
916
|
+
elements[0]
|
917
|
+
end
|
918
|
+
|
919
|
+
end
|
920
|
+
|
921
|
+
module AptSource3
|
922
|
+
def content
|
923
|
+
text_value
|
924
|
+
end
|
925
|
+
end
|
926
|
+
|
927
|
+
def _nt_apt_source
|
928
|
+
start_index = index
|
929
|
+
if node_cache[:apt_source].has_key?(index)
|
930
|
+
cached = node_cache[:apt_source][index]
|
931
|
+
if cached
|
932
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
933
|
+
@index = cached.interval.end
|
934
|
+
end
|
935
|
+
return cached
|
936
|
+
end
|
937
|
+
|
938
|
+
i0, s0 = index, []
|
939
|
+
r1 = _nt_url
|
940
|
+
s0 << r1
|
941
|
+
if r1
|
942
|
+
s2, i2 = [], index
|
943
|
+
loop do
|
944
|
+
if has_terminal?(" ", false, index)
|
945
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
946
|
+
@index += 1
|
947
|
+
else
|
948
|
+
terminal_parse_failure(" ")
|
949
|
+
r3 = nil
|
950
|
+
end
|
951
|
+
if r3
|
952
|
+
s2 << r3
|
953
|
+
else
|
954
|
+
break
|
955
|
+
end
|
956
|
+
end
|
957
|
+
if s2.empty?
|
958
|
+
@index = i2
|
959
|
+
r2 = nil
|
960
|
+
else
|
961
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
962
|
+
end
|
963
|
+
s0 << r2
|
964
|
+
if r2
|
965
|
+
i5, s5 = index, []
|
966
|
+
r6 = _nt_section
|
967
|
+
s5 << r6
|
968
|
+
if r6
|
969
|
+
s7, i7 = [], index
|
970
|
+
loop do
|
971
|
+
if has_terminal?(" ", false, index)
|
972
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
973
|
+
@index += 1
|
974
|
+
else
|
975
|
+
terminal_parse_failure(" ")
|
976
|
+
r8 = nil
|
977
|
+
end
|
978
|
+
if r8
|
979
|
+
s7 << r8
|
980
|
+
else
|
981
|
+
break
|
982
|
+
end
|
983
|
+
end
|
984
|
+
if s7.empty?
|
985
|
+
@index = i7
|
986
|
+
r7 = nil
|
987
|
+
else
|
988
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
989
|
+
end
|
990
|
+
s5 << r7
|
991
|
+
end
|
992
|
+
if s5.last
|
993
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
994
|
+
r5.extend(AptSource0)
|
995
|
+
else
|
996
|
+
@index = i5
|
997
|
+
r5 = nil
|
998
|
+
end
|
999
|
+
if r5
|
1000
|
+
r4 = r5
|
1001
|
+
else
|
1002
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
1003
|
+
end
|
1004
|
+
s0 << r4
|
1005
|
+
if r4
|
1006
|
+
i10, s10 = index, []
|
1007
|
+
r11 = _nt_arch
|
1008
|
+
s10 << r11
|
1009
|
+
if r11
|
1010
|
+
s12, i12 = [], index
|
1011
|
+
loop do
|
1012
|
+
if has_terminal?(" ", false, index)
|
1013
|
+
r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1014
|
+
@index += 1
|
1015
|
+
else
|
1016
|
+
terminal_parse_failure(" ")
|
1017
|
+
r13 = nil
|
1018
|
+
end
|
1019
|
+
if r13
|
1020
|
+
s12 << r13
|
1021
|
+
else
|
1022
|
+
break
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
if s12.empty?
|
1026
|
+
@index = i12
|
1027
|
+
r12 = nil
|
1028
|
+
else
|
1029
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
1030
|
+
end
|
1031
|
+
s10 << r12
|
1032
|
+
end
|
1033
|
+
if s10.last
|
1034
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
1035
|
+
r10.extend(AptSource1)
|
1036
|
+
else
|
1037
|
+
@index = i10
|
1038
|
+
r10 = nil
|
1039
|
+
end
|
1040
|
+
if r10
|
1041
|
+
r9 = r10
|
1042
|
+
else
|
1043
|
+
r9 = instantiate_node(SyntaxNode,input, index...index)
|
1044
|
+
end
|
1045
|
+
s0 << r9
|
1046
|
+
if r9
|
1047
|
+
if has_terminal?("Packages", false, index)
|
1048
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 8))
|
1049
|
+
@index += 8
|
1050
|
+
else
|
1051
|
+
terminal_parse_failure("Packages")
|
1052
|
+
r14 = nil
|
1053
|
+
end
|
1054
|
+
s0 << r14
|
1055
|
+
end
|
1056
|
+
end
|
1057
|
+
end
|
1058
|
+
end
|
1059
|
+
if s0.last
|
1060
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1061
|
+
r0.extend(AptSource2)
|
1062
|
+
r0.extend(AptSource3)
|
1063
|
+
else
|
1064
|
+
@index = i0
|
1065
|
+
r0 = nil
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
node_cache[:apt_source][start_index] = r0
|
1069
|
+
|
1070
|
+
r0
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
module Url0
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
module Url1
|
1077
|
+
def content
|
1078
|
+
text_value
|
1079
|
+
end
|
1080
|
+
end
|
1081
|
+
|
1082
|
+
def _nt_url
|
1083
|
+
start_index = index
|
1084
|
+
if node_cache[:url].has_key?(index)
|
1085
|
+
cached = node_cache[:url][index]
|
1086
|
+
if cached
|
1087
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1088
|
+
@index = cached.interval.end
|
1089
|
+
end
|
1090
|
+
return cached
|
1091
|
+
end
|
1092
|
+
|
1093
|
+
i0, s0 = index, []
|
1094
|
+
s1, i1 = [], index
|
1095
|
+
loop do
|
1096
|
+
if has_terminal?('\G[a-z]', true, index)
|
1097
|
+
r2 = true
|
1098
|
+
@index += 1
|
1099
|
+
else
|
1100
|
+
r2 = nil
|
1101
|
+
end
|
1102
|
+
if r2
|
1103
|
+
s1 << r2
|
1104
|
+
else
|
1105
|
+
break
|
1106
|
+
end
|
1107
|
+
end
|
1108
|
+
if s1.empty?
|
1109
|
+
@index = i1
|
1110
|
+
r1 = nil
|
1111
|
+
else
|
1112
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1113
|
+
end
|
1114
|
+
s0 << r1
|
1115
|
+
if r1
|
1116
|
+
if has_terminal?("://", false, index)
|
1117
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
|
1118
|
+
@index += 3
|
1119
|
+
else
|
1120
|
+
terminal_parse_failure("://")
|
1121
|
+
r3 = nil
|
1122
|
+
end
|
1123
|
+
s0 << r3
|
1124
|
+
if r3
|
1125
|
+
s4, i4 = [], index
|
1126
|
+
loop do
|
1127
|
+
if has_terminal?('\G[^ ]', true, index)
|
1128
|
+
r5 = true
|
1129
|
+
@index += 1
|
1130
|
+
else
|
1131
|
+
r5 = nil
|
1132
|
+
end
|
1133
|
+
if r5
|
1134
|
+
s4 << r5
|
1135
|
+
else
|
1136
|
+
break
|
1137
|
+
end
|
1138
|
+
end
|
1139
|
+
if s4.empty?
|
1140
|
+
@index = i4
|
1141
|
+
r4 = nil
|
1142
|
+
else
|
1143
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1144
|
+
end
|
1145
|
+
s0 << r4
|
1146
|
+
end
|
1147
|
+
end
|
1148
|
+
if s0.last
|
1149
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1150
|
+
r0.extend(Url0)
|
1151
|
+
r0.extend(Url1)
|
1152
|
+
else
|
1153
|
+
@index = i0
|
1154
|
+
r0 = nil
|
1155
|
+
end
|
1156
|
+
|
1157
|
+
node_cache[:url][start_index] = r0
|
1158
|
+
|
1159
|
+
r0
|
1160
|
+
end
|
1161
|
+
|
1162
|
+
module Section0
|
1163
|
+
end
|
1164
|
+
|
1165
|
+
module Section1
|
1166
|
+
def content
|
1167
|
+
text_value
|
1168
|
+
end
|
1169
|
+
end
|
1170
|
+
|
1171
|
+
def _nt_section
|
1172
|
+
start_index = index
|
1173
|
+
if node_cache[:section].has_key?(index)
|
1174
|
+
cached = node_cache[:section][index]
|
1175
|
+
if cached
|
1176
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1177
|
+
@index = cached.interval.end
|
1178
|
+
end
|
1179
|
+
return cached
|
1180
|
+
end
|
1181
|
+
|
1182
|
+
i0, s0 = index, []
|
1183
|
+
s1, i1 = [], index
|
1184
|
+
loop do
|
1185
|
+
if has_terminal?('\G[a-z-]', true, index)
|
1186
|
+
r2 = true
|
1187
|
+
@index += 1
|
1188
|
+
else
|
1189
|
+
r2 = nil
|
1190
|
+
end
|
1191
|
+
if r2
|
1192
|
+
s1 << r2
|
1193
|
+
else
|
1194
|
+
break
|
1195
|
+
end
|
1196
|
+
end
|
1197
|
+
if s1.empty?
|
1198
|
+
@index = i1
|
1199
|
+
r1 = nil
|
1200
|
+
else
|
1201
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
1202
|
+
end
|
1203
|
+
s0 << r1
|
1204
|
+
if r1
|
1205
|
+
if has_terminal?("/", false, index)
|
1206
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
1207
|
+
@index += 1
|
1208
|
+
else
|
1209
|
+
terminal_parse_failure("/")
|
1210
|
+
r3 = nil
|
1211
|
+
end
|
1212
|
+
s0 << r3
|
1213
|
+
if r3
|
1214
|
+
s4, i4 = [], index
|
1215
|
+
loop do
|
1216
|
+
if has_terminal?('\G[a-z-]', true, index)
|
1217
|
+
r5 = true
|
1218
|
+
@index += 1
|
1219
|
+
else
|
1220
|
+
r5 = nil
|
1221
|
+
end
|
1222
|
+
if r5
|
1223
|
+
s4 << r5
|
1224
|
+
else
|
1225
|
+
break
|
1226
|
+
end
|
1227
|
+
end
|
1228
|
+
if s4.empty?
|
1229
|
+
@index = i4
|
1230
|
+
r4 = nil
|
1231
|
+
else
|
1232
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
1233
|
+
end
|
1234
|
+
s0 << r4
|
1235
|
+
end
|
1236
|
+
end
|
1237
|
+
if s0.last
|
1238
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1239
|
+
r0.extend(Section0)
|
1240
|
+
r0.extend(Section1)
|
1241
|
+
else
|
1242
|
+
@index = i0
|
1243
|
+
r0 = nil
|
1244
|
+
end
|
1245
|
+
|
1246
|
+
node_cache[:section][start_index] = r0
|
1247
|
+
|
1248
|
+
r0
|
1249
|
+
end
|
1250
|
+
|
1251
|
+
module Arch0
|
1252
|
+
def content
|
1253
|
+
text_value
|
1254
|
+
end
|
1255
|
+
end
|
1256
|
+
|
1257
|
+
def _nt_arch
|
1258
|
+
start_index = index
|
1259
|
+
if node_cache[:arch].has_key?(index)
|
1260
|
+
cached = node_cache[:arch][index]
|
1261
|
+
if cached
|
1262
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1263
|
+
@index = cached.interval.end
|
1264
|
+
end
|
1265
|
+
return cached
|
1266
|
+
end
|
1267
|
+
|
1268
|
+
s0, i0 = [], index
|
1269
|
+
loop do
|
1270
|
+
if has_terminal?('\G[a-zA-Z0-9]', true, index)
|
1271
|
+
r1 = true
|
1272
|
+
@index += 1
|
1273
|
+
else
|
1274
|
+
r1 = nil
|
1275
|
+
end
|
1276
|
+
if r1
|
1277
|
+
s0 << r1
|
1278
|
+
else
|
1279
|
+
break
|
1280
|
+
end
|
1281
|
+
end
|
1282
|
+
if s0.empty?
|
1283
|
+
@index = i0
|
1284
|
+
r0 = nil
|
1285
|
+
else
|
1286
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1287
|
+
r0.extend(Arch0)
|
1288
|
+
end
|
1289
|
+
|
1290
|
+
node_cache[:arch][start_index] = r0
|
1291
|
+
|
1292
|
+
r0
|
1293
|
+
end
|
1294
|
+
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
class PolicyParser < Treetop::Runtime::CompiledParser
|
1298
|
+
include Policy
|
1299
|
+
end
|
1300
|
+
|
1301
|
+
# vim: filetype=ruby
|