kaiser-ruby 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb628fa95145a8ff9f2c8fccbbbf17d879ee8e349b66166286a9f0b1a0d654e2
4
- data.tar.gz: 10747f14ccbdc25d6b5e3d29b04ea8dbeb880cf0fc3deb890184e28211cefdfe
3
+ metadata.gz: 7b9d062d700db52c37367a613f89ff577927d8b013bfea6d994e0eda03e26758
4
+ data.tar.gz: 6082e82328bdb866c38c50eb2765984bbded0c29c81ef2ca14fdaaee87f83a21
5
5
  SHA512:
6
- metadata.gz: 7b417722ea526b3c98d6dac794a679bea64bc1513114e4724e6dddd12b9d1a945fe29c52196a2255fd11f00ed0fe69a54b63590653f9670df7d341816995b3a5
7
- data.tar.gz: 9c12b3832c94be7812b5f052fa3e6d1240246f3fcb62812f5087252e0a9e9ab0c57da79222a077ae6e1512bb7f497f56f6594efbb05de6a226aafba0efd4a8cf
6
+ metadata.gz: 470d1fd4008cae879d727e0de6f99abe5f3261067dbf738e70f9431f4e2c7cd04100ea64621fffefb8c6c1830821f020767d7b83209cf9f9304f4df098b0faf4
7
+ data.tar.gz: 41825a7a6f9bad109f36c3a2984960c9d7c4b23d27fa7aef2f60ef2ecdc6872f49898aba9793cb3c1ae8a0728c93b34d772e75da147c7f6ebae4cdd94ceb630d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kaiser-ruby (0.2.1)
4
+ kaiser-ruby (0.2.3)
5
5
  parslet (~> 1.8)
6
6
  thor (~> 0.20)
7
7
 
data/README.md CHANGED
@@ -49,6 +49,22 @@ Saved output in `a.rb`
49
49
 
50
50
  ```
51
51
 
52
+ Another option is to run an interactive console (REPL):
53
+
54
+ ```
55
+ $ kaiser-ruby rock --debug
56
+ Type 'exit' to exit the console. Otherwise, rock on!
57
+ \m/> Put "Hello San Francisco" into the message
58
+ \m/> the_message = "Hello San Francisco"
59
+ => Hello San Francisco
60
+ \m/> Scream the message
61
+ \m/> puts the_message
62
+ Hello San Francisco
63
+ => nil
64
+ \m/> exit
65
+ $
66
+ ```
67
+
52
68
  Finally, you can also transpile and immediately execute the code, like this:
53
69
 
54
70
  ```
data/TODO.md CHANGED
@@ -6,8 +6,8 @@
6
6
 
7
7
  ## Types
8
8
 
9
- - [ ] Handle null type differently - nil in Ruby isn't really comparable to 0
10
- - [ ] Handle mysterious type - probably this should be nil and what is now nil should be 0 instead
9
+ - [x] Handle null type differently - nil in Ruby isn't really comparable to 0
10
+ - [x] Handle mysterious type - probably this should be nil and what is now nil should be 0 instead
11
11
  - [ ] Handle object type
12
12
 
13
13
  ## Comparisons
@@ -1,11 +1,14 @@
1
1
  module KaiserRuby
2
2
  class RockstarParser < Parslet::Parser
3
3
  rule(:reserved) do
4
- nil_value_keywords | true_value_keywords | false_value_keywords | plus_keywords | minus_keywords | times_keywords | over_keywords |
5
- str('Knock') | str('Build') | str('Put') | str('into') | str('says') | poetic_number_keywords | say_keywords
4
+ mysterious_value_keywords | null_value_keywords | true_value_keywords | false_value_keywords |
5
+ plus_keywords | minus_keywords | times_keywords | over_keywords |
6
+ str('Knock') | str('Build') | str('Put') | str('into') | str('says') |
7
+ poetic_number_keywords | say_keywords
6
8
  end
7
9
 
8
- rule(:nil_value_keywords) { str('nothing') | str('nowhere') | str('nobody') | str('empty') | str('gone') }
10
+ rule(:mysterious_value_keywords) { str('mysterious') }
11
+ rule(:null_value_keywords) { str('nothing') | str('nowhere') | str('nobody') | str('empty') | str('gone') }
9
12
  rule(:false_value_keywords) { str('false') | str('wrong') | str('no') | str('lies') }
10
13
  rule(:true_value_keywords) { str('true') | str('right') | str('yes') | str('ok') }
11
14
  rule(:plus_keywords) { str('plus') | str('with') }
@@ -35,7 +38,8 @@ module KaiserRuby
35
38
  (common_variable_name | proper_variable_name).as(:variable_name)
36
39
  end
37
40
 
38
- rule(:nil_value) { nil_value_keywords.as(:nil_value) }
41
+ rule(:mysterious_value) { mysterious_value_keywords.as(:mysterious_value) }
42
+ rule(:null_value) { null_value_keywords.as(:null_value) }
39
43
  rule(:true_value) { true_value_keywords.as(:true_value) }
40
44
  rule(:false_value) { false_value_keywords.as(:false_value) }
41
45
  rule(:string_value) { (str('"') >> match['[[:alpha:]] '].repeat >> str('"')).as(:string_value) }
@@ -97,7 +101,7 @@ module KaiserRuby
97
101
  rule(:poetic_type_literal) do
98
102
  (flow_keywords.absent?) >>
99
103
  (
100
- variable_names.as(:left) >> str(' is ') >> (nil_value | false_value | true_value).as(:right)
104
+ variable_names.as(:left) >> str(' is ') >> (mysterious_value | null_value | false_value | true_value).as(:right)
101
105
  ).as(:assignment)
102
106
  end
103
107
 
@@ -154,7 +158,7 @@ module KaiserRuby
154
158
  ).as(:if_else)
155
159
  end
156
160
 
157
- rule(:simple_values) { nil_value | false_value | true_value | string_value | numeric_value }
161
+ rule(:simple_values) { mysterious_value | null_value | false_value | true_value | string_value | numeric_value }
158
162
  rule(:value_or_variable) { variable_names | simple_values }
159
163
  rule(:expressions) { basic_assignment_expression | increment | decrement | addition | subtraction | multiplication | division }
160
164
  rule(:comparisons) { equality }
@@ -3,7 +3,8 @@ module KaiserRuby
3
3
  class RockstarTransform < Parslet::Transform
4
4
  rule(variable_name: simple(:str)) { |c| parameterize(c[:str]) }
5
5
 
6
- rule(nil_value: simple(:_)) { 'nil' }
6
+ rule(mysterious_value: simple(:_)) { 'nil' }
7
+ rule(null_value: simple(:_)) { '0' }
7
8
  rule(true_value: simple(:_)) { 'true' }
8
9
  rule(false_value: simple(:_)) { 'false' }
9
10
  rule(string_value: simple(:str)) { str }
@@ -1,3 +1,3 @@
1
1
  module KaiserRuby
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaiser-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Ruszkiewicz