iv-phonic 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -3,45 +3,45 @@ Manifest.txt
3
3
  README.rdoc
4
4
  Rakefile
5
5
  test/test_iv_phonic.rb
6
+ ext/include/iv/ast_factory.h
7
+ ext/include/iv/uchar.h
8
+ ext/include/iv/space.h
9
+ ext/include/iv/lexer.h
10
+ ext/include/iv/conversions.h
11
+ ext/include/iv/dtoa.h
6
12
  ext/include/iv/mt19937.h
7
- ext/include/iv/token.h
8
- ext/include/iv/any.h
9
- ext/include/iv/ast-fwd.h
10
- ext/include/iv/static_assert.h
11
13
  ext/include/iv/ast.h
12
- ext/include/iv/dtoa.h
13
- ext/include/iv/ast-visitor.h
14
- ext/include/iv/ustringpiece.h
15
- ext/include/iv/ucdata.h
16
- ext/include/iv/ustring.h
17
14
  ext/include/iv/noncopyable.h
18
- ext/include/iv/keyword.h
19
- ext/include/iv/chars.h
15
+ ext/include/iv/stringpiece.h
16
+ ext/include/iv/static_assert.h
17
+ ext/include/iv/functor.h
18
+ ext/include/iv/ast_fwd.h
19
+ ext/include/iv/parser.h
20
+ ext/include/iv/errors.h
21
+ ext/include/iv/token.h
20
22
  ext/include/iv/enable_if.h
21
- ext/include/iv/utils.h
22
- ext/include/iv/conversions.h
23
- ext/include/iv/location.h
24
- ext/include/iv/lexer.h
23
+ ext/include/iv/any.h
24
+ ext/include/iv/keyword.h
25
+ ext/include/iv/cmdline.h
25
26
  ext/include/iv/xorshift.h
26
- ext/include/iv/space.h
27
+ ext/include/iv/location.h
28
+ ext/include/iv/ast_info.h
29
+ ext/include/iv/none.h
27
30
  ext/include/iv/algorithm.h
28
- ext/include/iv/fixedcontainer.h
29
- ext/include/iv/functor.h
30
- ext/include/iv/cmdline.h
31
- ext/include/iv/ast-serializer.h
32
- ext/include/iv/stringpiece.h
33
- ext/include/iv/uchar.h
34
- ext/include/iv/ast-factory.h
31
+ ext/include/iv/ustring.h
32
+ ext/include/iv/ast_serializer.h
33
+ ext/include/iv/utils.h
34
+ ext/include/iv/ast_visitor.h
35
35
  ext/include/iv/alloc.h
36
- ext/include/iv/ast-info.h
37
- ext/include/iv/parser.h
38
- ext/include/iv/none.h
39
- ext/include/iv/errors.h
40
- ext/iv/phonic/ast-fwd.h
36
+ ext/include/iv/chars.h
37
+ ext/include/iv/fixedcontainer.h
38
+ ext/include/iv/ustringpiece.h
39
+ ext/include/iv/ucdata.h
40
+ ext/iv/phonic/factory.h
41
+ ext/iv/phonic/ast_fwd.h
42
+ ext/iv/phonic/parser.h
43
+ ext/iv/phonic/encoding.h
41
44
  ext/iv/phonic/source.h
42
- ext/iv/phonic/creator.h
43
45
  ext/iv/phonic/phonic.cc
44
- ext/iv/phonic/extconf.rb
45
- ext/iv/phonic/encoding.h
46
- ext/iv/phonic/parser.h
47
- ext/iv/phonic/factory.h
46
+ ext/iv/phonic/creator.h
47
+ ext/iv/phonic/extconf.rb
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ directory "ext/include/iv"
10
10
 
11
11
  HOE = Hoe.spec 'iv-phonic' do
12
12
  developer('Constellation', 'utatane.tea@gmail.com')
13
- self.version = '0.0.6'
13
+ self.version = '0.0.7'
14
14
  self.readme_file = 'README.rdoc'
15
15
  self.history_file = 'ChangeLog'
16
16
  self.extra_rdoc_files = FileList['*.rdoc']
data/ext/include/iv/ast.h CHANGED
@@ -10,8 +10,8 @@
10
10
  #include "space.h"
11
11
  #include "functor.h"
12
12
  #include "token.h"
13
- #include "ast-fwd.h"
14
- #include "ast-visitor.h"
13
+ #include "ast_fwd.h"
14
+ #include "ast_visitor.h"
15
15
  #include "location.h"
16
16
  #include "static_assert.h"
17
17
  #include "ustringpiece.h"
@@ -6,7 +6,7 @@
6
6
  #include <tr1/tuple>
7
7
  #include "uchar.h"
8
8
  #include "ast.h"
9
- #include "ast-visitor.h"
9
+ #include "ast_visitor.h"
10
10
  #include "ustring.h"
11
11
  #include "stringpiece.h"
12
12
  #include "ustringpiece.h"
@@ -2,7 +2,7 @@
2
2
  #define _IV_AST_VISITOR_H_
3
3
  #include <tr1/type_traits>
4
4
  #include "noncopyable.h"
5
- #include "ast-fwd.h"
5
+ #include "ast_fwd.h"
6
6
 
7
7
  namespace iv {
8
8
  namespace core {
@@ -252,7 +252,7 @@ inline double StringToDouble(Iter it, Iter last, bool parse_float) {
252
252
  return (parse_float && !is_found_zero) ? Conversions::kNaN : 0;
253
253
  } else {
254
254
  buffer[pos++] = '\0';
255
- return std::strtod(buffer.data(), NULL);
255
+ return std::atof(buffer.data());
256
256
  }
257
257
  } else {
258
258
  return Conversions::kNaN;
@@ -421,13 +421,20 @@ inline double DoubleToInteger(double d) {
421
421
  return std::floor(std::abs(d)) * (std::signbit(d) ? -1 : 1);
422
422
  }
423
423
 
424
- inline bool ConvertToUInt32(const UStringPiece& str, uint32_t* value) {
424
+ template<typename Iter>
425
+ inline bool ConvertToUInt32(Iter it, const Iter last, uint32_t* value) {
425
426
  static const uint32_t uint32_t_max = std::numeric_limits<uint32_t>::max();
426
427
  uint16_t ch;
427
428
  *value = 0;
428
- UStringPiece::const_iterator it = str.begin();
429
- const UStringPiece::const_iterator last = str.end();
430
- if (it != last && *it != '0' && Chars::IsDecimalDigit(*it)) {
429
+ if (it != last && *it == '0') {
430
+ if (it + 1 != last) {
431
+ return false;
432
+ } else {
433
+ *value = 0;
434
+ return true;
435
+ }
436
+ }
437
+ if (it != last && Chars::IsDecimalDigit(*it)) {
431
438
  ch = *it - '0';
432
439
  *value = ch;
433
440
  } else {
@@ -449,6 +456,14 @@ inline bool ConvertToUInt32(const UStringPiece& str, uint32_t* value) {
449
456
  (ch < (uint32_t_max % 10))));
450
457
  }
451
458
 
459
+ inline bool ConvertToUInt32(const UStringPiece& str, uint32_t* value) {
460
+ return ConvertToUInt32(str.begin(), str.end(), value);
461
+ }
462
+
463
+ inline bool ConvertToUInt32(const StringPiece& str, uint32_t* value) {
464
+ return ConvertToUInt32(str.begin(), str.end(), value);
465
+ }
466
+
452
467
  template<typename T>
453
468
  inline std::size_t DoubleToStringWithRadix(double v, int radix, T* buf) {
454
469
  static const int kMaxBufSize = 1100;
@@ -801,7 +801,7 @@ class Lexer: private Noncopyable<Lexer<Source> >::type {
801
801
  }
802
802
  numeric_ = val;
803
803
  } else {
804
- numeric_ = std::strtod(buffer8_.c_str(), NULL);
804
+ numeric_ = std::atof(buffer8_.c_str());
805
805
  }
806
806
  type_ = type;
807
807
  return Token::NUMBER;
@@ -8,7 +8,7 @@
8
8
  #include <tr1/type_traits>
9
9
  #include "static_assert.h"
10
10
  #include "ast.h"
11
- #include "ast-factory.h"
11
+ #include "ast_factory.h"
12
12
  #include "lexer.h"
13
13
  #include "noncopyable.h"
14
14
  #include "utils.h"
@@ -92,19 +92,18 @@ class SpaceAllocator {
92
92
  return *this;
93
93
  }
94
94
 
95
- Factory* space() const {
95
+ inline Factory* space() const {
96
96
  return space_;
97
97
  }
98
98
 
99
- protected:
99
+ private:
100
100
  void Swap(this_type& rhs) {
101
101
  using std::swap;
102
102
  swap(space_, rhs.space_);
103
103
  }
104
- Factory* space_;
105
-
106
- private:
107
104
  void operator=(const SpaceAllocator&);
105
+
106
+ Factory* space_;
108
107
  };
109
108
 
110
109
  template <typename Factory, typename T>
@@ -97,7 +97,7 @@ class BasicStringPiece {
97
97
  if (!empty()) {
98
98
  target->assign(data(), size());
99
99
  } else {
100
- target->assign(NULL, 0);
100
+ target->assign(0UL, static_cast<CharT>('\0'));
101
101
  }
102
102
  }
103
103
 
@@ -3,7 +3,7 @@
3
3
  extern "C" {
4
4
  #include <ruby.h>
5
5
  }
6
- #include <iv/ast-visitor.h>
6
+ #include <iv/ast_visitor.h>
7
7
  #include <iv/utils.h>
8
8
  #include "factory.h"
9
9
  #include "encoding.h"
@@ -8,7 +8,7 @@ extern "C" {
8
8
  #include <iv/alloc.h>
9
9
  #include <iv/ustringpiece.h>
10
10
  #include "encoding.h"
11
- #include "ast-fwd.h"
11
+ #include "ast_fwd.h"
12
12
  namespace iv {
13
13
  namespace phonic {
14
14
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iv-phonic
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 6
10
- version: 0.0.6
8
+ - 7
9
+ version: 0.0.7
11
10
  platform: ruby
12
11
  authors:
13
12
  - Constellation
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-12-02 00:00:00 +09:00
17
+ date: 2010-12-11 00:00:00 +09:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 7
30
28
  segments:
31
29
  - 2
32
30
  - 0
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 3
46
43
  segments:
47
44
  - 0
48
45
  version: "0"
@@ -56,12 +53,11 @@ dependencies:
56
53
  requirements:
57
54
  - - ">="
58
55
  - !ruby/object:Gem::Version
59
- hash: 19
60
56
  segments:
61
57
  - 2
62
- - 7
63
- - 0
64
- version: 2.7.0
58
+ - 6
59
+ - 2
60
+ version: 2.6.2
65
61
  type: :development
66
62
  version_requirements: *id003
67
63
  description: phonic is ruby binding for iv AST API
@@ -80,48 +76,48 @@ files:
80
76
  - README.rdoc
81
77
  - Rakefile
82
78
  - test/test_iv_phonic.rb
79
+ - ext/include/iv/ast_factory.h
80
+ - ext/include/iv/uchar.h
81
+ - ext/include/iv/space.h
82
+ - ext/include/iv/lexer.h
83
+ - ext/include/iv/conversions.h
84
+ - ext/include/iv/dtoa.h
83
85
  - ext/include/iv/mt19937.h
84
- - ext/include/iv/token.h
85
- - ext/include/iv/any.h
86
- - ext/include/iv/ast-fwd.h
87
- - ext/include/iv/static_assert.h
88
86
  - ext/include/iv/ast.h
89
- - ext/include/iv/dtoa.h
90
- - ext/include/iv/ast-visitor.h
91
- - ext/include/iv/ustringpiece.h
92
- - ext/include/iv/ucdata.h
93
- - ext/include/iv/ustring.h
94
87
  - ext/include/iv/noncopyable.h
95
- - ext/include/iv/keyword.h
96
- - ext/include/iv/chars.h
88
+ - ext/include/iv/stringpiece.h
89
+ - ext/include/iv/static_assert.h
90
+ - ext/include/iv/functor.h
91
+ - ext/include/iv/ast_fwd.h
92
+ - ext/include/iv/parser.h
93
+ - ext/include/iv/errors.h
94
+ - ext/include/iv/token.h
97
95
  - ext/include/iv/enable_if.h
98
- - ext/include/iv/utils.h
99
- - ext/include/iv/conversions.h
100
- - ext/include/iv/location.h
101
- - ext/include/iv/lexer.h
96
+ - ext/include/iv/any.h
97
+ - ext/include/iv/keyword.h
98
+ - ext/include/iv/cmdline.h
102
99
  - ext/include/iv/xorshift.h
103
- - ext/include/iv/space.h
100
+ - ext/include/iv/location.h
101
+ - ext/include/iv/ast_info.h
102
+ - ext/include/iv/none.h
104
103
  - ext/include/iv/algorithm.h
105
- - ext/include/iv/fixedcontainer.h
106
- - ext/include/iv/functor.h
107
- - ext/include/iv/cmdline.h
108
- - ext/include/iv/ast-serializer.h
109
- - ext/include/iv/stringpiece.h
110
- - ext/include/iv/uchar.h
111
- - ext/include/iv/ast-factory.h
104
+ - ext/include/iv/ustring.h
105
+ - ext/include/iv/ast_serializer.h
106
+ - ext/include/iv/utils.h
107
+ - ext/include/iv/ast_visitor.h
112
108
  - ext/include/iv/alloc.h
113
- - ext/include/iv/ast-info.h
114
- - ext/include/iv/parser.h
115
- - ext/include/iv/none.h
116
- - ext/include/iv/errors.h
117
- - ext/iv/phonic/ast-fwd.h
109
+ - ext/include/iv/chars.h
110
+ - ext/include/iv/fixedcontainer.h
111
+ - ext/include/iv/ustringpiece.h
112
+ - ext/include/iv/ucdata.h
113
+ - ext/iv/phonic/factory.h
114
+ - ext/iv/phonic/ast_fwd.h
115
+ - ext/iv/phonic/parser.h
116
+ - ext/iv/phonic/encoding.h
118
117
  - ext/iv/phonic/source.h
119
- - ext/iv/phonic/creator.h
120
118
  - ext/iv/phonic/phonic.cc
119
+ - ext/iv/phonic/creator.h
121
120
  - ext/iv/phonic/extconf.rb
122
- - ext/iv/phonic/encoding.h
123
- - ext/iv/phonic/parser.h
124
- - ext/iv/phonic/factory.h
125
121
  has_rdoc: true
126
122
  homepage: https://github.com/Constellation/iv/tree/master/src/phonic/
127
123
  licenses: []
@@ -137,7 +133,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
133
  requirements:
138
134
  - - ">="
139
135
  - !ruby/object:Gem::Version
140
- hash: 49
141
136
  segments:
142
137
  - 1
143
138
  - 9
@@ -148,7 +143,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
143
  requirements:
149
144
  - - ">="
150
145
  - !ruby/object:Gem::Version
151
- hash: 3
152
146
  segments:
153
147
  - 0
154
148
  version: "0"
File without changes
File without changes
File without changes
File without changes