textpow1x 1.2.1 → 1.2.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/Gemfile.lock +1 -1
- data/README.rdoc +5 -6
- data/lib/textpow/syntax.rb +9 -9
- data/lib/textpow/version.rb +1 -1
- data/spec/textpow/syntax_files_spec.rb +3 -7
- data/spec/textpow/syntax_spec.rb +3 -3
- metadata +34 -51
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -43,12 +43,12 @@ Install oniguruma
|
|
43
43
|
|
44
44
|
Syntax files are written with {Textmate grammer}[http://macromates.com/textmate/manual/language_grammars#language_grammars].
|
45
45
|
They are written in text/binary/xml/yaml format (all can be translated into each other).
|
46
|
-
Textpow can understand the yaml form (ending in .syntax) and the xml form (ending in .tmSyntax or .plist) via plist library, but not the text or binary form.
|
46
|
+
Textpow can understand the yaml form (ending in .syntax) and the xml form (ending in .tmSyntax or .plist or tmLanguage) via plist library, but not the text or binary form.
|
47
47
|
All syntax files shipped with textpow are in the yaml form, since its easiest to read and less verbose.
|
48
48
|
|
49
49
|
Adding a new syntax:
|
50
|
-
*
|
51
|
-
*
|
50
|
+
* add download location and scopeName to update_syntax task in Rakefile
|
51
|
+
* <tt>rake update_syntax</tt>
|
52
52
|
* run tests <tt>rake</tt> to see if the syntax is parseable
|
53
53
|
|
54
54
|
=== Processors
|
@@ -76,10 +76,9 @@ having <tt>name="text.string", position=10</tt> and the second having
|
|
76
76
|
<tt>"markup.string"</tt> tag is inside the <tt>"text.string"</tt> tag.
|
77
77
|
|
78
78
|
== TODO
|
79
|
-
|
79
|
+
* fix markdown and php syntax
|
80
80
|
* parse text plist files {example}[https://raw.github.com/kangax/textmate-js-language-syntax-file/master/JavaScript.plist]
|
81
|
-
*
|
82
|
-
* document / spec / fix include languages (they dont work very well)
|
81
|
+
* update more languages via github urls
|
83
82
|
|
84
83
|
== LICENSE: MIT
|
85
84
|
|
data/lib/textpow/syntax.rb
CHANGED
@@ -56,14 +56,14 @@ module Textpow
|
|
56
56
|
attr_accessor :repository
|
57
57
|
attr_accessor :patterns
|
58
58
|
|
59
|
-
def self.load(file,
|
59
|
+
def self.load(file, options={})
|
60
60
|
table = convert_file_to_table(file)
|
61
|
-
SyntaxNode.new(table,
|
61
|
+
SyntaxNode.new(table, options)
|
62
62
|
end
|
63
63
|
|
64
|
-
def initialize(table,
|
65
|
-
@syntax = syntax || self
|
66
|
-
@name_space = name_space
|
64
|
+
def initialize(table, options={})
|
65
|
+
@syntax = options[:syntax] || self
|
66
|
+
@name_space = options[:name_space]
|
67
67
|
|
68
68
|
register_in_syntaxes(table["scopeName"])
|
69
69
|
parse_and_store_syntax_info(table)
|
@@ -134,23 +134,23 @@ module Textpow
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
def parse_repository
|
137
|
+
def parse_repository(repository)
|
138
138
|
@repository = {}
|
139
139
|
repository.each do |key, value|
|
140
140
|
if value["include"]
|
141
141
|
@repository[key] = SyntaxProxy.new(value["include"], syntax)
|
142
142
|
else
|
143
|
-
@repository[key] = SyntaxNode.new(value, syntax, @name_space)
|
143
|
+
@repository[key] = SyntaxNode.new(value, :syntax => syntax, :name_space => @name_space)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
def create_children
|
148
|
+
def create_children(patterns)
|
149
149
|
@patterns = patterns.map do |pattern|
|
150
150
|
if pattern["include"]
|
151
151
|
SyntaxProxy.new(pattern["include"], syntax)
|
152
152
|
else
|
153
|
-
SyntaxNode.new(pattern, syntax, @name_space)
|
153
|
+
SyntaxNode.new(pattern, :syntax => syntax, :name_space => @name_space)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
data/lib/textpow/version.rb
CHANGED
@@ -5,22 +5,18 @@ describe "syntax files" do
|
|
5
5
|
STDERR.stub!(:puts)
|
6
6
|
end
|
7
7
|
|
8
|
-
let(:processor){ Textpow::DebugProcessor.new }
|
9
|
-
|
10
8
|
it "has syntax files" do
|
11
9
|
Dir["#{Textpow.syntax_path}/*.syntax"].should_not == []
|
12
10
|
end
|
13
11
|
|
14
12
|
Dir["#{Textpow.syntax_path}/*.syntax"].each do |syntax|
|
15
13
|
it "#{syntax} can parse" do
|
16
|
-
|
17
|
-
node.parse("xxx\n1 + 1\n### xxx", processor)
|
14
|
+
Textpow.syntax(syntax).parse("xxx\n1 + 1\n### xxx")
|
18
15
|
end
|
19
16
|
end
|
20
17
|
|
21
|
-
# syntax broken in 1.9
|
22
18
|
xit "parses markdown" do
|
23
|
-
node = Textpow
|
24
|
-
node.parse("### xxx\nabc\n xxx\
|
19
|
+
node = Textpow.syntax("lib/textpow/syntax/broken/markdown.syntax")
|
20
|
+
node.parse("### xxx\nabc\n xxx\nyyy\n - abc\n - ac").stack.should_not == []
|
25
21
|
end
|
26
22
|
end
|
data/spec/textpow/syntax_spec.rb
CHANGED
@@ -52,7 +52,7 @@ describe Textpow::SyntaxNode do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it "stores given parent" do
|
55
|
-
node = Textpow::SyntaxNode.new({}, 1)
|
55
|
+
node = Textpow::SyntaxNode.new({}, :syntax => 1)
|
56
56
|
node.syntax.should == 1
|
57
57
|
end
|
58
58
|
|
@@ -63,9 +63,9 @@ describe Textpow::SyntaxNode do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "stores itself in scoped global namespace under scopeName" do
|
66
|
-
node = Textpow::SyntaxNode.new({"scopeName" => 'xxx'},
|
66
|
+
node = Textpow::SyntaxNode.new({"scopeName" => 'xxx'}, :name_space => 'foo')
|
67
67
|
node.syntaxes['xxx'].should == node
|
68
|
-
Textpow::SyntaxNode.new({}
|
68
|
+
Textpow::SyntaxNode.new({},:name_space => 'foo').syntaxes['xxx'].should == node
|
69
69
|
Textpow::SyntaxNode.new({}).syntaxes['xxx'].should == nil
|
70
70
|
end
|
71
71
|
end
|
metadata
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: textpow1x
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
- 1
|
10
|
-
version: 1.2.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Dizan Vasquez
|
14
9
|
- Spox
|
15
10
|
- Chris Hoffman
|
@@ -17,37 +12,28 @@ authors:
|
|
17
12
|
autorequire:
|
18
13
|
bindir: bin
|
19
14
|
cert_chain: []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
15
|
+
date: 2011-10-08 00:00:00.000000000Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: plist
|
19
|
+
requirement: &84372580 !ruby/object:Gem::Requirement
|
26
20
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 5
|
31
|
-
segments:
|
32
|
-
- 3
|
33
|
-
- 0
|
34
|
-
- 1
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
35
24
|
version: 3.0.1
|
36
25
|
type: :runtime
|
37
|
-
name: plist
|
38
|
-
version_requirements: *id001
|
39
26
|
prerelease: false
|
27
|
+
version_requirements: *84372580
|
40
28
|
description: A library for parsing TextMate bundles on ruby 1.x
|
41
|
-
email:
|
29
|
+
email:
|
42
30
|
- michael@grosser.it
|
43
|
-
executables:
|
31
|
+
executables:
|
44
32
|
- plist2yaml
|
45
33
|
- plist2syntax
|
46
34
|
extensions: []
|
47
|
-
|
48
35
|
extra_rdoc_files: []
|
49
|
-
|
50
|
-
files:
|
36
|
+
files:
|
51
37
|
- .travis.yml
|
52
38
|
- Gemfile
|
53
39
|
- Gemfile.lock
|
@@ -237,40 +223,37 @@ files:
|
|
237
223
|
- spec/textpow/syntax_spec.rb
|
238
224
|
- spec/textpow_spec.rb
|
239
225
|
- textpow1x.gemspec
|
240
|
-
has_rdoc: true
|
241
226
|
homepage: http://github.com/grosser/textpow
|
242
|
-
licenses:
|
227
|
+
licenses:
|
243
228
|
- MIT
|
244
229
|
post_install_message:
|
245
|
-
rdoc_options:
|
230
|
+
rdoc_options:
|
246
231
|
- --main
|
247
232
|
- README.rdoc
|
248
|
-
require_paths:
|
233
|
+
require_paths:
|
249
234
|
- lib
|
250
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
235
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
251
236
|
none: false
|
252
|
-
requirements:
|
253
|
-
- -
|
254
|
-
- !ruby/object:Gem::Version
|
255
|
-
|
256
|
-
segments:
|
237
|
+
requirements:
|
238
|
+
- - ! '>='
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: '0'
|
241
|
+
segments:
|
257
242
|
- 0
|
258
|
-
|
259
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
|
+
hash: -225371251
|
244
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
245
|
none: false
|
261
|
-
requirements:
|
262
|
-
- -
|
263
|
-
- !ruby/object:Gem::Version
|
264
|
-
|
265
|
-
segments:
|
246
|
+
requirements:
|
247
|
+
- - ! '>='
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '0'
|
250
|
+
segments:
|
266
251
|
- 0
|
267
|
-
|
252
|
+
hash: -225371251
|
268
253
|
requirements: []
|
269
|
-
|
270
254
|
rubyforge_project:
|
271
|
-
rubygems_version: 1.
|
255
|
+
rubygems_version: 1.8.10
|
272
256
|
signing_key:
|
273
257
|
specification_version: 3
|
274
258
|
summary: A library for parsing TextMate bundles on ruby 1.x
|
275
259
|
test_files: []
|
276
|
-
|