chelsy 0.0.7 → 0.0.8
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.
- checksums.yaml +4 -4
- data/lib/chelsy/ast.rb +14 -10
- data/lib/chelsy/version.rb +1 -1
- data/sample/temperature.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12890aa7a65ea8ba2ae82a58ccde7c00b6f48dcc
|
4
|
+
data.tar.gz: 925692aeeb8a6afefddad2120c937e572ec37881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 002b987b8be634228cdb3d23399211df5aa311727359749f7e646623e938fd5442841ccf5915b1b9ce2ae1559a10ec515b30ad940248442aaa031ab97ed795ea
|
7
|
+
data.tar.gz: ae9080c3b6b5fe7b77ad4241cf1a237b604f91d0b4a449a35233f9523d3f2840cec32020135cb9d3b54e6c1e68b2be357726f2d0f4e6546440f5495ffad3d5db
|
data/lib/chelsy/ast.rb
CHANGED
@@ -1248,7 +1248,7 @@ module Chelsy
|
|
1248
1248
|
attr_reader :lineno, :filename
|
1249
1249
|
|
1250
1250
|
def initialize(lineno, filename=nil, **rest)
|
1251
|
-
@lineno = Syntax::
|
1251
|
+
@lineno = Syntax::Coercers::Int.ensure(lineno)
|
1252
1252
|
@filename = immutable_stringify(filename) if filename
|
1253
1253
|
|
1254
1254
|
super **rest
|
@@ -1288,13 +1288,17 @@ end
|
|
1288
1288
|
module Chelsy
|
1289
1289
|
module Syntax
|
1290
1290
|
|
1291
|
-
module
|
1292
|
-
Int = Coercer.new(
|
1293
|
-
|
1291
|
+
module Coercers
|
1292
|
+
Int = Coercer.new(Constant::Int) do |value|
|
1293
|
+
Constant::Int.new(value) if ::Integer === value
|
1294
1294
|
end
|
1295
1295
|
|
1296
|
-
String = Coercer.new(
|
1297
|
-
|
1296
|
+
String = Coercer.new(Constant::String) do |value|
|
1297
|
+
Constant::String.new(value) if ::String === value
|
1298
|
+
end
|
1299
|
+
|
1300
|
+
Param = Coercer.new(Chelsy::Param) do |value|
|
1301
|
+
Chelsy::Param.new(*value) if ::Array === value
|
1298
1302
|
end
|
1299
1303
|
end
|
1300
1304
|
|
@@ -1304,18 +1308,18 @@ module Chelsy
|
|
1304
1308
|
Expr = Any.new('Expression', [
|
1305
1309
|
Chelsy::Expr,
|
1306
1310
|
Syntax::Ident,
|
1307
|
-
|
1308
|
-
|
1311
|
+
Coercers::Int,
|
1312
|
+
Coercers::String,
|
1309
1313
|
])
|
1310
1314
|
ExprOrType = Any.new('Expression-Or-Type', [Syntax::Expr, Syntax::Type])
|
1311
1315
|
Fragment = Any.new('Fragment', [Fragment, String])
|
1312
1316
|
Storage = Any.new('Storage-class specifiers', [:typedef, :extern, :static])
|
1313
|
-
Param = Any.new('Parameter', [
|
1317
|
+
Param = Any.new('Parameter', [Syntax::Coercers::Param, :void, :"..."])
|
1314
1318
|
ProtoParam = Any.new('Prototype Parameter', [Syntax::Param, Symbol, Chelsy::Type::Base])
|
1315
1319
|
ArraySize = Any.new('ArraySize', [Syntax::Expr])
|
1316
1320
|
BitField = Any.new('BitField', [
|
1317
1321
|
Chelsy::Constant::Integral,
|
1318
|
-
|
1322
|
+
Coercers::Int,
|
1319
1323
|
])
|
1320
1324
|
StructOrUnionMember = Any.new('StructOrUnionMember', [Chelsy::Declaration, Chelsy::BitField])
|
1321
1325
|
EnumMember = Any.new('EnumMember', [Chelsy::EnumMember, Symbol])
|
data/lib/chelsy/version.rb
CHANGED
data/sample/temperature.rb
CHANGED
@@ -16,8 +16,8 @@ doc.fragments << Directive::Define.new(:STEP, 20)
|
|
16
16
|
|
17
17
|
doc << Function.new(:main,
|
18
18
|
Type::Int.new, [
|
19
|
-
|
20
|
-
|
19
|
+
[:argc, Type::Int.new],
|
20
|
+
[:argv, Type::Pointer.new(Type::Pointer.new(Type::Char.new(const: true)))],
|
21
21
|
]) do |b|
|
22
22
|
init = Declaration.new(:fahr, Type::Int.new, :LOWER)
|
23
23
|
cond = Operator::LessThanOrEqual.new(:fahr, :UPPER)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chelsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takanori Ishikawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|