selfml 0.0.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.travis.yml +3 -4
- data/Gemfile +2 -2
- data/Gemfile.travis +9 -0
- data/README.markdown +6 -4
- data/Rakefile +1 -1
- data/lib/selfml.rb +14 -5
- data/lib/selfml/ast.rb +7 -4
- data/lib/selfml/ast/comment.rb +5 -1
- data/lib/selfml/ast/document.rb +4 -1
- data/lib/selfml/ast/node.rb +6 -1
- data/lib/selfml/ast/string_node.rb +4 -1
- data/lib/selfml/engines.rb +6 -3
- data/lib/selfml/engines/array.rb +1 -0
- data/lib/selfml/engines/document.rb +12 -8
- data/lib/selfml/engines/hash.rb +1 -0
- data/lib/selfml/parser.rb +21 -17
- data/lib/selfml/version.rb +2 -1
- data/self-ml.gemspec +9 -9
- data/spec/basic_spec.rb +9 -8
- data/spec/engines_spec.rb +7 -5
- data/spec/parser/comment_spec.rb +40 -0
- data/spec/parser/list_spec.rb +34 -0
- data/spec/parser/string_spec.rb +47 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/string_spec.rb +15 -6
- metadata +45 -52
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e6d3cece40ecbb92fb0952afcd5b61eff8f20150
|
4
|
+
data.tar.gz: 1c34dcda8933810e212fda54a8a55cc10a5a880d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9518f4bd4fe9337ca3d444783e1f42ce184e83a04cc743226638bf67c83c08edc20d7af64338617d350c705d2706ab84b42cdc9bdf997b7c3e08d2c9647be84a
|
7
|
+
data.tar.gz: 898ddad6cdee6d4fc41176356b6b4b7cc3acd90d1cd964dd815f1c08ee65e3fed8b94dfc4a65f881b0f661d4abcbdaffded16bb5f9a82ce1b3105642e13be434
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.travis
ADDED
data/README.markdown
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Self-ML
|
2
|
-
[![endorse](http://api.coderwall.com/locks/endorsecount.png)](http://coderwall.com/locks)
|
3
2
|
[![Build Status](https://secure.travis-ci.org/locks/self-ml.png)](http://travis-ci.org/locks/self-ml)
|
4
|
-
[![Gemnasium Build Status](https://gemnasium.com/
|
3
|
+
[![Gemnasium Build Status](https://gemnasium.com/self-ml/selfml.png)](https://gemnasium.com/self-ml/selfml)
|
4
|
+
[![endorse](http://api.coderwall.com/locks/endorsecount.png)](http://coderwall.com/locks)
|
5
5
|
|
6
|
-
This is a ruby library for reading [self-ml](http://chocolatapp.com/blog/self-ml) files.
|
6
|
+
This is a ruby library for reading [self-ml](http://chocolatapp.com/blog/self-ml) files.
|
7
7
|
It is mostly finished, just needs a good polish.
|
8
8
|
|
9
9
|
It will only parse correctly formed files, returning an error otherwise.
|
@@ -47,5 +47,7 @@ See issue tracker.
|
|
47
47
|
## Credits
|
48
48
|
|
49
49
|
* locks - ruby implementation
|
50
|
+
* alexgordon - creating self-ml and clearing up the grammer
|
50
51
|
* devyn - helpful support
|
51
|
-
*
|
52
|
+
* atamis - alternative ruby implementation, inspiration
|
53
|
+
* kschiess - creating parslet and schooling me on how to use it
|
data/Rakefile
CHANGED
data/lib/selfml.rb
CHANGED
@@ -1,20 +1,29 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
|
3
|
+
# SelfML main module
|
4
|
+
#
|
5
|
+
# @author Ricardo Mendes
|
3
6
|
module SelfML; end
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
require 'selfml/engines'
|
9
|
+
require 'selfml/parser'
|
10
|
+
require 'selfml/ast'
|
11
|
+
|
8
12
|
|
9
13
|
module SelfML
|
10
14
|
|
11
|
-
|
15
|
+
# Returns a SelfML document
|
16
|
+
#
|
17
|
+
# @param [String] source the content to be parsed
|
18
|
+
# @param [SelfML::Engines::Document, SelfML::Engines::Array, SelfML::Engines::Hash] engine transformation engine pretended.
|
19
|
+
# @return [SelfML::Document] parsed document
|
20
|
+
def self.parse(source, engine=Engines::Document.new)
|
12
21
|
transformer = engine.new if engine.instance_of? Class
|
13
22
|
|
14
23
|
parser = Parser.new
|
15
24
|
transformer ||= Engines::Document.new
|
16
25
|
|
17
|
-
tree = parser.parse(
|
26
|
+
tree = parser.parse(source)
|
18
27
|
out = transformer.apply(tree)
|
19
28
|
end
|
20
29
|
|
data/lib/selfml/ast.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
# SelfML::AST
|
2
|
+
#
|
3
|
+
# This namespace contains all the classes necessary to make a SelfML document.
|
1
4
|
module SelfML::AST; end
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
6
|
+
require 'selfml/ast/document'
|
7
|
+
require 'selfml/ast/node'
|
8
|
+
require 'selfml/ast/string_node'
|
9
|
+
require 'selfml/ast/comment'
|
data/lib/selfml/ast/comment.rb
CHANGED
data/lib/selfml/ast/document.rb
CHANGED
data/lib/selfml/ast/node.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
module SelfML::AST
|
2
2
|
|
3
|
+
# SelfML::AST::Node
|
4
|
+
#
|
3
5
|
class Node
|
4
6
|
attr_accessor :head , :tail
|
5
7
|
|
8
|
+
# @param [String] head the head of the node.
|
9
|
+
# @param [Array] tail the tail of the node. optional.
|
6
10
|
def initialize( head , tail = [] )
|
7
11
|
@head , @tail = head , tail
|
8
12
|
end
|
9
13
|
|
14
|
+
# @param [Integer] level used in recursion
|
10
15
|
def serialize( level = 1 )
|
11
16
|
tail = @tail.sort.map do |t|
|
12
17
|
case t
|
@@ -24,9 +29,9 @@ module SelfML::AST
|
|
24
29
|
|
25
30
|
"(" + head.serialize + tail.join("") + ")"
|
26
31
|
end
|
27
|
-
|
28
32
|
alias :to_s :serialize
|
29
33
|
|
34
|
+
# @param [SelfML::AST::Node] rhs the right-hand side comparison
|
30
35
|
def <=> rhs
|
31
36
|
case rhs when Node then 0
|
32
37
|
when StringNode then 1
|
@@ -1,16 +1,19 @@
|
|
1
1
|
module SelfML::AST
|
2
2
|
|
3
|
+
# SelfML::AST::StringNode
|
4
|
+
#
|
3
5
|
class StringNode < String
|
4
6
|
|
7
|
+
# @return [String] representation in string format
|
5
8
|
def serialize
|
6
9
|
return "`#{self.gsub("`","``")}`" if self.count("[") != self.count("]")
|
7
10
|
return "[#{self}]" if self.match(/[#`()\[\]{} ]/)
|
8
11
|
|
9
12
|
self
|
10
13
|
end
|
11
|
-
|
12
14
|
alias :to_s :serialize
|
13
15
|
|
16
|
+
# Orders nodes correctly
|
14
17
|
def <=> rhs
|
15
18
|
case rhs when StringNode then 0
|
16
19
|
when Node then -1
|
data/lib/selfml/engines.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
require 'parslet'
|
2
2
|
|
3
|
+
# SelfML::Engines
|
4
|
+
#
|
5
|
+
# An engine is a parslet transformation
|
3
6
|
module SelfML::Engines; end
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
require 'selfml/engines/document'
|
9
|
+
require 'selfml/engines/array'
|
10
|
+
require 'selfml/engines/hash'
|
data/lib/selfml/engines/array.rb
CHANGED
@@ -1,35 +1,39 @@
|
|
1
|
-
|
1
|
+
require 'selfml/ast'
|
2
2
|
|
3
3
|
module SelfML::Engines
|
4
4
|
|
5
|
+
# SelfML::Engines::Document
|
6
|
+
#
|
7
|
+
# The main one.
|
8
|
+
# The real deal.
|
5
9
|
class Document < Parslet::Transform
|
6
10
|
include SelfML::AST
|
7
|
-
|
11
|
+
|
8
12
|
rule(:document => sequence(:doc)) { SelfML::AST::Document.new(doc) }
|
9
13
|
rule(:list => subtree(:l)) do
|
10
14
|
Node.new(
|
11
15
|
StringNode.new(l[:head]) , Array(l[:tail])
|
12
16
|
)
|
13
17
|
end
|
14
|
-
|
18
|
+
|
15
19
|
# Comments
|
16
20
|
rule(:comment => simple(:s)) { Comment.new(s) }
|
17
21
|
rule(:block => simple(:blk)) { Comment.new(blk) }
|
18
22
|
rule(:block => sequence(:blk)) { Comment.new(blk.reduce :+) }
|
19
23
|
rule(:line => simple(:ln)) { Comment.new(ln) }
|
20
|
-
|
24
|
+
|
21
25
|
# Strings
|
22
26
|
rule(:string => simple(:s)) { StringNode.new(s) }
|
23
27
|
rule(:verbatim => simple(:s)) { StringNode.new(s) }
|
24
|
-
|
28
|
+
|
25
29
|
rule(:backticks => sequence(:s)) { StringNode.new(s.reduce :+) }
|
26
30
|
rule(:ticks => simple(:s)) { "`" }
|
27
|
-
|
31
|
+
|
28
32
|
rule(:brackets => sequence(:b)) { StringNode.new(b.reduce :+) }
|
29
33
|
rule(:nested => simple(:n)) { StringNode.new(n) }
|
30
34
|
rule(:nested => sequence(:n)) { "[" + StringNode.new(n.reduce :+) + "]" }
|
31
|
-
|
35
|
+
|
32
36
|
rule(:text => simple(:t)) { StringNode.new(t) }
|
33
37
|
end
|
34
38
|
|
35
|
-
end
|
39
|
+
end
|
data/lib/selfml/engines/hash.rb
CHANGED
data/lib/selfml/parser.rb
CHANGED
@@ -1,23 +1,27 @@
|
|
1
1
|
require 'parslet'
|
2
2
|
|
3
3
|
module SelfML
|
4
|
+
|
5
|
+
# Helper methods
|
4
6
|
class Parslet::Parser
|
5
|
-
|
7
|
+
|
6
8
|
rule(:space) { match('\s').repeat(1) }
|
7
9
|
rule(:space?) { space.maybe }
|
8
|
-
|
10
|
+
|
9
11
|
rule(:word) { match('\w').repeat }
|
10
|
-
rule(:word?) { word.maybe }
|
12
|
+
rule(:word?) { word.maybe }
|
11
13
|
end # monkey patching in a couple of helpers
|
12
|
-
|
14
|
+
|
15
|
+
# Class responsible for parsing all the things.
|
16
|
+
#
|
13
17
|
class Parser < Parslet::Parser
|
14
18
|
root(:top)
|
15
19
|
rule(:top) do
|
16
20
|
(space? >> node >> space?).repeat.as(:document)
|
17
21
|
end
|
18
|
-
|
19
|
-
rule(:node) { comment.as(:comment) | list.as(:list) | string.as(:string)
|
20
|
-
|
22
|
+
|
23
|
+
rule(:node) { comment.as(:comment) | list.as(:list) | string.as(:string) }
|
24
|
+
|
21
25
|
# String
|
22
26
|
rule(:string) { backtick.as(:backticks) | bracketed.as(:brackets) | verbatim.as(:verbatim) }
|
23
27
|
rule(:backtick) do
|
@@ -27,33 +31,33 @@ module SelfML
|
|
27
31
|
).repeat >> str('`')
|
28
32
|
end
|
29
33
|
rule(:bracketed) do
|
30
|
-
|
34
|
+
str('[') >> (
|
31
35
|
# bracketed.as(:nested) | match('[^\]]').as(:text)
|
32
36
|
bracketed.as(:nested) | (str("]").absent? >> any).as(:text)
|
33
37
|
).repeat >> str(']')
|
34
38
|
end
|
35
39
|
rule(:verbatim) { str("#").absnt? >> match['^\[\](){}\s'].repeat(1) }
|
36
|
-
|
40
|
+
|
37
41
|
# List
|
38
42
|
rule(:tail) do
|
39
43
|
(node >> space?).repeat
|
40
44
|
end
|
41
45
|
rule(:list) do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
+
str('(') >> space? >>
|
47
|
+
comment.as(:comment).maybe >> space? >>
|
48
|
+
string.as(:head) >> space? >>
|
49
|
+
tail.as(:tail) >> space? >>
|
46
50
|
space? >> str(')')
|
47
51
|
end
|
48
|
-
|
52
|
+
|
49
53
|
# Comment
|
50
54
|
rule(:comment) { line.as(:line) | block.as(:block) }
|
51
|
-
rule(:line) { str('#') >> match['^\\n'].repeat.as(:text) >> (str("\n") | any.
|
55
|
+
rule(:line) { str('#') >> match['^\\n'].repeat.as(:text) >> (str("\n") | any.absent?) }
|
52
56
|
rule(:block) do
|
53
57
|
str('{#') >> (
|
54
58
|
block.as(:block) | match['^#}'].as(:text)
|
55
59
|
).repeat >> str('#}')
|
56
60
|
end
|
57
|
-
|
61
|
+
|
58
62
|
end
|
59
|
-
end
|
63
|
+
end
|
data/lib/selfml/version.rb
CHANGED
data/self-ml.gemspec
CHANGED
@@ -11,20 +11,20 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{self-ml parser}
|
12
12
|
s.description = %q{Self-ML is, as the name implies, a self-ml parser. It also has some utilities to aid in building self-ml files.}
|
13
13
|
|
14
|
-
s.rubyforge_project = "self-ml"
|
15
|
-
|
16
14
|
s.files = `git ls-files`.split("\n")
|
17
15
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
18
16
|
# s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
17
|
s.executables << 'selfml'
|
20
18
|
s.require_paths = ["lib"]
|
21
19
|
|
22
|
-
s.
|
23
|
-
|
24
|
-
s.add_development_dependency "
|
25
|
-
s.add_development_dependency "
|
20
|
+
s.required_ruby_version = "~> 1.9.3"
|
21
|
+
|
22
|
+
s.add_development_dependency "minitest", "~> 5.0"
|
23
|
+
s.add_development_dependency "rake", "~> 10.0"
|
24
|
+
s.add_development_dependency "pry", "~> 0.10"
|
25
|
+
s.add_development_dependency "ronn", "~> 0.7"
|
26
|
+
|
27
|
+
s.add_runtime_dependency "parslet", "~> 1.5"
|
26
28
|
|
27
|
-
s.add_dependency "
|
28
|
-
s.add_dependency "gem-man"
|
29
|
-
s.add_dependency "require_relative" unless RUBY_VERSION > '1.8'
|
29
|
+
s.add_dependency "gem-man", "~> 0.3"
|
30
30
|
end
|
data/spec/basic_spec.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
|
-
describe SelfML do
|
3
|
+
describe SelfML::Parser do
|
4
4
|
|
5
5
|
subject { SelfML }
|
6
|
-
let(:fixtures) { load_fixture "basic" }
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
subject.parse(fixtures[:input]).to_s.must_equal fixtures[:output]
|
12
|
-
end
|
7
|
+
let(:basic) { load_fixture "basic" }
|
8
|
+
let(:comments) { load_fixture "comments" }
|
9
|
+
let(:strings) { load_fixture "strings" }
|
13
10
|
|
11
|
+
it "parses example correctly" do
|
12
|
+
assert_equal subject.parse(basic[:input]).to_s, basic[:output]
|
13
|
+
assert_equal subject.parse(comments[:input]).to_s, comments[:output]
|
14
|
+
assert_equal subject.parse(strings[:input]).to_s, strings[:output]
|
14
15
|
end
|
15
16
|
|
16
|
-
end
|
17
|
+
end
|
data/spec/engines_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative 'spec_helper'
|
1
2
|
require 'selfml/engines/hash'
|
2
3
|
|
3
4
|
describe SelfML do
|
@@ -5,21 +6,22 @@ describe SelfML do
|
|
5
6
|
let(:document) { SelfML::Parser.new.parse("(grandparent (parent child1 child2))") }
|
6
7
|
|
7
8
|
describe "Engines" do
|
8
|
-
|
9
|
+
|
9
10
|
describe "Hash" do
|
10
11
|
subject { SelfML::Engines::Hash.new }
|
11
12
|
# let(:engine) { SelfML::Engines::Hash }
|
12
|
-
|
13
|
+
|
13
14
|
it "parses correctly" do
|
14
15
|
subject.apply(document)
|
15
16
|
end
|
16
|
-
|
17
|
+
|
17
18
|
it "outputs correctly" do
|
18
19
|
output = {:document=>[{:grandparent=>[{:parent=>["child1", "child2"]}]}]}
|
19
|
-
|
20
|
+
|
21
|
+
assert_equal subject.apply(document), output
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
25
|
end
|
24
26
|
|
25
|
-
end
|
27
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe SelfML::Parser do
|
4
|
+
|
5
|
+
subject { SelfML::Parser.new }
|
6
|
+
|
7
|
+
describe "Comments" do
|
8
|
+
|
9
|
+
it "parses a line comment" do
|
10
|
+
assert subject.line.parse('#')
|
11
|
+
assert subject.line.parse('# ')
|
12
|
+
assert subject.line.parse('# a')
|
13
|
+
assert subject.line.parse("#\n")
|
14
|
+
assert subject.line.parse("# \n")
|
15
|
+
assert subject.line.parse("#asdfadsf\n")
|
16
|
+
assert subject.line.parse("# asdfadsf\n")
|
17
|
+
|
18
|
+
lambda { subject.line.parse("#\na") }.must_raise Parslet::ParseFailed
|
19
|
+
end
|
20
|
+
|
21
|
+
it "parses a simple block comment" do
|
22
|
+
assert subject.block.parse('{##}')
|
23
|
+
assert subject.block.parse('{# #}')
|
24
|
+
assert subject.block.parse('{#a#}')
|
25
|
+
assert subject.block.parse('{# a #}')
|
26
|
+
assert subject.block.parse('{#\n#}')
|
27
|
+
assert subject.block.parse('{# \n #}')
|
28
|
+
assert subject.block.parse('{# a \n a \n a #}')
|
29
|
+
end
|
30
|
+
|
31
|
+
it "parses nested block comments" do
|
32
|
+
assert subject.block.parse('{#{##}#}')
|
33
|
+
assert subject.block.parse('{#{# #}#}')
|
34
|
+
assert subject.block.parse('{#{#a#}#}')
|
35
|
+
assert subject.block.parse('{#{# a #}#}')
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe SelfML::Parser do
|
4
|
+
|
5
|
+
subject { SelfML::Parser.new }
|
6
|
+
|
7
|
+
describe "List" do
|
8
|
+
let(:empty_list) { "()" }
|
9
|
+
let(:head_list) { "(head)" }
|
10
|
+
let(:basic_list) { "(head rest1 rest2)" }
|
11
|
+
let(:nested_list) { "(head1 (head2 tail))" }
|
12
|
+
|
13
|
+
it "cannot be empty" do
|
14
|
+
lambda { subject.list.parse(empty_list) }.must_raise Parslet::ParseFailed
|
15
|
+
end
|
16
|
+
|
17
|
+
it "has head" do
|
18
|
+
assert subject.parse("(head)")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "has head and tail" do
|
22
|
+
assert subject.parse("(head tail1 tail2)")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "has nested tail only" do
|
26
|
+
lambda { subject.list.parse("((head) head)") }.must_raise Parslet::ParseFailed
|
27
|
+
|
28
|
+
assert subject.parse("(head (head tail))")
|
29
|
+
assert subject.parse("(head (head (head)))")
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
require 'parslet/convenience'
|
3
|
+
|
4
|
+
describe SelfML::Parser do
|
5
|
+
|
6
|
+
subject { SelfML::Parser.new }
|
7
|
+
|
8
|
+
describe "String" do
|
9
|
+
|
10
|
+
it "is a verbatim string" do
|
11
|
+
lambda { subject.verbatim.parse("verbatim[string") }.must_raise Parslet::ParseFailed
|
12
|
+
lambda { subject.verbatim.parse("verbatim]string") }.must_raise Parslet::ParseFailed
|
13
|
+
lambda { subject.verbatim.parse("verbatim(string") }.must_raise Parslet::ParseFailed
|
14
|
+
lambda { subject.verbatim.parse("verbatim)string") }.must_raise Parslet::ParseFailed
|
15
|
+
lambda { subject.verbatim.parse("verbatim{string") }.must_raise Parslet::ParseFailed
|
16
|
+
lambda { subject.verbatim.parse("verbatim}string") }.must_raise Parslet::ParseFailed
|
17
|
+
lambda { subject.verbatim.parse("verbatim string") }.must_raise Parslet::ParseFailed
|
18
|
+
|
19
|
+
assert subject.verbatim.parse("verbatim")
|
20
|
+
assert subject.verbatim.parse("verbatim-string")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "is a simple bracket string" do
|
24
|
+
assert subject.bracketed.parse("[bracket]")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "is a nested bracket string" do
|
28
|
+
assert subject.bracketed.parse("[[bracket] [bracket] ]")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "is a simple backtick string" do
|
32
|
+
assert subject.backtick.parse("`blabla bla bla [] ]`")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "is an escaped backtick string" do
|
36
|
+
assert subject.backtick.parse("`blabla `` blabla`")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "parses all kinds of strings" do
|
40
|
+
assert subject.string.parse("verbatim-string")
|
41
|
+
assert subject.string.parse("[bracketed string]")
|
42
|
+
assert subject.string.parse("`backtick `` string`")
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/string_spec.rb
CHANGED
@@ -1,16 +1,25 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
3
|
describe SelfML do
|
4
|
-
|
4
|
+
|
5
5
|
subject { SelfML }
|
6
6
|
let(:fixtures) { load_fixture "strings" }
|
7
7
|
|
8
8
|
describe "Strings" do
|
9
|
-
|
9
|
+
|
10
|
+
it "is a verbatim string" do
|
11
|
+
end
|
12
|
+
|
13
|
+
it "is a bracketed string" do
|
14
|
+
end
|
15
|
+
|
16
|
+
it "is a backtick string" do
|
17
|
+
end
|
18
|
+
|
10
19
|
it "parses example correctly" do
|
11
|
-
subject.parse(fixtures[:input]).to_s
|
20
|
+
assert_equal subject.parse(fixtures[:input]).to_s, fixtures[:output]
|
12
21
|
end
|
13
|
-
|
22
|
+
|
14
23
|
end
|
15
|
-
|
16
|
-
end
|
24
|
+
|
25
|
+
end
|
metadata
CHANGED
@@ -1,112 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selfml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ricardo Mendes
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-08-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: minitest
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
19
|
+
version: '5.0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
26
|
+
version: '5.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
33
|
+
version: '10.0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
40
|
+
version: '10.0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: pry
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
47
|
+
version: '0.10'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
54
|
+
version: '0.10'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
56
|
+
name: ronn
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
61
|
+
version: '0.7'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
68
|
+
version: '0.7'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: parslet
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - "~>"
|
84
74
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
75
|
+
version: '1.5'
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - "~>"
|
92
81
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
82
|
+
version: '1.5'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: gem-man
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - "~>"
|
100
88
|
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
89
|
+
version: '0.3'
|
102
90
|
type: :runtime
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - "~>"
|
108
95
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
96
|
+
version: '0.3'
|
110
97
|
description: Self-ML is, as the name implies, a self-ml parser. It also has some utilities
|
111
98
|
to aid in building self-ml files.
|
112
99
|
email:
|
@@ -116,9 +103,10 @@ executables:
|
|
116
103
|
extensions: []
|
117
104
|
extra_rdoc_files: []
|
118
105
|
files:
|
119
|
-
- .gitignore
|
120
|
-
- .travis.yml
|
106
|
+
- ".gitignore"
|
107
|
+
- ".travis.yml"
|
121
108
|
- Gemfile
|
109
|
+
- Gemfile.travis
|
122
110
|
- LICENSE
|
123
111
|
- README.markdown
|
124
112
|
- Rakefile
|
@@ -150,31 +138,33 @@ files:
|
|
150
138
|
- spec/fixtures/output.comments.selfml
|
151
139
|
- spec/fixtures/output.strings.selfml
|
152
140
|
- spec/fixtures/strings.selfml
|
141
|
+
- spec/parser/comment_spec.rb
|
142
|
+
- spec/parser/list_spec.rb
|
143
|
+
- spec/parser/string_spec.rb
|
153
144
|
- spec/spec_helper.rb
|
154
145
|
- spec/string_spec.rb
|
155
146
|
homepage: http://locks.github.com/self-ml
|
156
147
|
licenses: []
|
148
|
+
metadata: {}
|
157
149
|
post_install_message:
|
158
150
|
rdoc_options: []
|
159
151
|
require_paths:
|
160
152
|
- lib
|
161
153
|
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
-
none: false
|
163
154
|
requirements:
|
164
|
-
- -
|
155
|
+
- - "~>"
|
165
156
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
157
|
+
version: 1.9.3
|
167
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
-
none: false
|
169
159
|
requirements:
|
170
|
-
- -
|
160
|
+
- - ">="
|
171
161
|
- !ruby/object:Gem::Version
|
172
162
|
version: '0'
|
173
163
|
requirements: []
|
174
|
-
rubyforge_project:
|
175
|
-
rubygems_version:
|
164
|
+
rubyforge_project:
|
165
|
+
rubygems_version: 2.2.2
|
176
166
|
signing_key:
|
177
|
-
specification_version:
|
167
|
+
specification_version: 4
|
178
168
|
summary: self-ml parser
|
179
169
|
test_files:
|
180
170
|
- spec/basic_spec.rb
|
@@ -185,5 +175,8 @@ test_files:
|
|
185
175
|
- spec/fixtures/output.comments.selfml
|
186
176
|
- spec/fixtures/output.strings.selfml
|
187
177
|
- spec/fixtures/strings.selfml
|
178
|
+
- spec/parser/comment_spec.rb
|
179
|
+
- spec/parser/list_spec.rb
|
180
|
+
- spec/parser/string_spec.rb
|
188
181
|
- spec/spec_helper.rb
|
189
182
|
- spec/string_spec.rb
|