sfp 0.3.5 → 0.3.6
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/README.md +2 -2
- data/bin/sfp +8 -2
- data/lib/sfp/SfpLangLexer.rb +340 -372
- data/lib/sfp/SfpLangParser.rb +4065 -3960
- data/lib/sfp/Sfplib.rb +32 -31
- data/lib/sfp/parser.rb +43 -129
- data/lib/sfp/sas_translator.rb +25 -28
- data/sfp.gemspec +3 -3
- data/src/SfpLang.g +52 -39
- metadata +18 -8
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
SFP Language Parser
|
2
2
|
===================
|
3
3
|
- Author: Herry (herry13@gmail.com)
|
4
|
-
- Version: 0.3.
|
4
|
+
- Version: 0.3.6
|
5
5
|
- License: [BSD License](https://github.com/herry13/sfp-ruby/blob/master/LICENSE)
|
6
6
|
|
7
7
|
A Ruby gem that provides a Ruby interface to parse [SFP language](https://github.com/herry13/nuri/wiki/SFP-language), a declarative language to specify a planning task.
|
@@ -23,7 +23,7 @@ Requirements
|
|
23
23
|
------------
|
24
24
|
- Ruby (>= 1.8.7)
|
25
25
|
- Rubygems
|
26
|
-
- antlr3
|
26
|
+
- antlr3 (<= 1.8.12)
|
27
27
|
- json
|
28
28
|
|
29
29
|
|
data/bin/sfp
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
libdir = File.expand_path(File.dirname(__FILE__))
|
4
4
|
require "#{libdir}/../lib/sfp"
|
5
|
+
require 'yaml'
|
5
6
|
|
6
7
|
opts = Trollop::options do
|
7
8
|
version "sfp 0.3.5 (c) 2013 Herry"
|
@@ -12,7 +13,8 @@ Usage:
|
|
12
13
|
sfp <file>
|
13
14
|
EOS
|
14
15
|
|
15
|
-
opt :pretty, "Print the result in pretty JSON format.", :
|
16
|
+
opt :pretty, "Print the result in pretty JSON format.", :short => '-r'
|
17
|
+
opt :yaml, "Print the result in YAML format.", :short => '-y'
|
16
18
|
end
|
17
19
|
|
18
20
|
def parse(filepath)
|
@@ -24,7 +26,11 @@ end
|
|
24
26
|
|
25
27
|
filepath = ARGV[0].to_s
|
26
28
|
if filepath != ''
|
27
|
-
|
29
|
+
if opts[:yaml]
|
30
|
+
puts YAML.dump(JSON[parse(filepath).to_json({:pretty => opts[:pretty]})])
|
31
|
+
else
|
32
|
+
puts parse(filepath).to_json({:pretty => opts[:pretty]})
|
33
|
+
end
|
28
34
|
else
|
29
35
|
Trollop::help
|
30
36
|
end
|