qlang 0.0.27180000 → 0.0.27182000

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ print_zip_choropleth = function(choropleth.df, states, scaleName, theme, min, ma
17
17
  {
18
18
  stopifnot(states %in% state.abb)
19
19
 
20
- a = (1 3 4)
20
+ a = c(1, 3, 4)
21
21
 
22
22
  state.df = subset_map("state", states)
23
23
  colnames(state.df)[names(state.df) == "long"] = "longitude"
@@ -1,11 +1,38 @@
1
1
  require 'spec_helper'
2
2
 
3
+ include Lexer::Tokens
4
+
3
5
  describe 'Regular expressions' do
4
6
  def self.should_match(num, rgx, str)
5
7
  it 'ex' + num.to_s do
6
8
  expect(rgx =~ str).to eq(0)
9
+ expect($&).to eq(str)
10
+ end
11
+ end
12
+
13
+ def self.should_not_match(num, rgx, str)
14
+ it 'ex' + num.to_s do
15
+ expect(rgx =~ str).not_to eq(0)
7
16
  end
8
17
  end
18
+
19
+ describe 'tokens' do
20
+ describe 'nums' do
21
+ should_match(1, NUM, '1')
22
+ should_match(2, NUM, '234987423')
23
+ should_match(3, NUM, '23423948.298743')
24
+ should_match(4, NUM, 'e')
25
+ should_match(5, NUM, 'pi')
26
+ should_not_match(6, NUM, 'a')
27
+ end
28
+ describe 'vars' do
29
+ # should_match(1, VAR_MUL, 'ab')
30
+ # should_not_match(2, VAR_MUL, 'pi')
31
+ # should_not_match(3, VAR_MUL, 'sin')
32
+ end
33
+ end
34
+
35
+
9
36
  describe 'function' do
10
37
  should_match(1, /[fgh]\(\w( ?, ?\w)*\) ?= ?[^\r\n]+/, 'f(x) = xy')
11
38
  end
@@ -23,6 +23,7 @@ describe Qlang do
23
23
  )
24
24
  end
25
25
  end
26
+
26
27
  context 'into Ruby' do
27
28
  it do
28
29
  expect(
@@ -32,5 +33,15 @@ describe Qlang do
32
33
  )
33
34
  end
34
35
  end
36
+
37
+ context 'into Python' do
38
+ it do
39
+ expect(
40
+ Q.to_python.compile('(1 2 3)')
41
+ ).to eq(
42
+ "array([1, 2, 3])"
43
+ )
44
+ end
45
+ end
35
46
  end
36
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qlang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27180000
4
+ version: 0.0.27182000
5
5
  platform: ruby
6
6
  authors:
7
7
  - gogotanaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-16 00:00:00.000000000 Z
11
+ date: 2014-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dydx
@@ -110,9 +110,15 @@ files:
110
110
  - lib/qlang/parser/list_parser.rb
111
111
  - lib/qlang/parser/matrix_parser.rb
112
112
  - lib/qlang/parser/vector_parser.rb
113
+ - lib/qlang/utils/langs.yml
114
+ - lib/qlang/utils/ruby_ext.rb
113
115
  - lib/qlang/version.rb
114
116
  - q_lang.gemspec
115
117
  - spec/iq_spec.rb
118
+ - spec/langs/Haskell/ex1_after.hs
119
+ - spec/langs/Haskell/ex1_before.hs
120
+ - spec/langs/Python/ex1_after.py
121
+ - spec/langs/Python/ex1_before.py
116
122
  - spec/langs/R/ex1_after.R
117
123
  - spec/langs/R/ex1_before.R
118
124
  - spec/lexer/regular_expressions_spec.rb
@@ -149,6 +155,10 @@ specification_version: 4
149
155
  summary: Enjoy MATH!
150
156
  test_files:
151
157
  - spec/iq_spec.rb
158
+ - spec/langs/Haskell/ex1_after.hs
159
+ - spec/langs/Haskell/ex1_before.hs
160
+ - spec/langs/Python/ex1_after.py
161
+ - spec/langs/Python/ex1_before.py
152
162
  - spec/langs/R/ex1_after.R
153
163
  - spec/langs/R/ex1_before.R
154
164
  - spec/lexer/regular_expressions_spec.rb