dtr_core 0.1.2 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9594c7bac85d086ec888836ba17242023cadaccc4f6d4dc268520035324e682b
4
- data.tar.gz: a9cb05cd8ac136ebaf433b7f7f6c6d2fc64f60e807588b59f435a056311a2374
3
+ metadata.gz: 418d168f86346b48188db512dbc5980049b3a66550157500b613cd7f318605b1
4
+ data.tar.gz: c19f00a497602180987bc8337d738b738737e9d262339a864228654e08683d7b
5
5
  SHA512:
6
- metadata.gz: 189ffb27f3065aaa6d09bb5da75b693abe88236e073792aea4b0f33a609fa9383d187cbb12bf246e5bb470476bb767b4c74f60067f7cfa3e51a24383f742ff46
7
- data.tar.gz: a261d658929cd4c9208f47ccebafc3d5b9b065fb328a184637fad60c843d6a000ec4cbbf736b57e9a4152be1e2433dd2bfb13b86319a653c7cec25a3d71b122a
6
+ metadata.gz: 8107337a5ef32a7fa3dada9be8f9c4fae276755072512cf9b3afd7025d8a3e853e1b3118c2ec2cf60e7eb34b78cfe29e102b9344b9d7261790723443e64211f4
7
+ data.tar.gz: 346171c09102be20a9af5d9c65765fea1cae983148fd9586bfeb725756413a80058a730478030c16076b3332cbef4af71c62a7c5e5ac40001283591fa7703801
@@ -27,13 +27,13 @@ module DTRCore
27
27
 
28
28
  raise 'Missing contract name.' if name_section.nil?
29
29
 
30
- @name_section ||= name_section
30
+ @name_section ||= name_section.strip
31
31
  end
32
32
 
33
33
  def state_section
34
34
  return @state_definitions if @state_definitions
35
35
 
36
- state_section = first_match_for_content(/\[State\]:\s*((?:\s*\*\s*\[.+?\]\n(?:\s* \* .+\n?)*)*)/)
36
+ state_section = first_match_for_content(/\[State\]:\s*((?:\s*\*\s*\[.+?\]\n(?:\s*\*.+\n?)*)*)/)
37
37
 
38
38
  return nil if state_section.nil?
39
39
 
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DTRCore
4
+ module SupportedTypes
5
+ # Supported Instructions for DTR.
6
+ ## Instruction Categories ##
7
+ INSTRUCTION_CATEGORY_BASIC = 'basic'
8
+ INSTRUCTION_CATEGORY_STATE = 'state'
9
+ INSTRUCTION_CATEGORY_NUMERIC = 'numeric'
10
+ INSTRUCTION_CATEGORY_STRING = 'string'
11
+ INSTRUCTION_CATEGORIES = [
12
+ INSTRUCTION_CATEGORY_BASIC,
13
+ INSTRUCTION_CATEGORY_STATE,
14
+ INSTRUCTION_CATEGORY_NUMERIC,
15
+ INSTRUCTION_CATEGORY_STRING
16
+ ].freeze
17
+ ## Instructions ##
18
+ INSTRUCTIONS = [
19
+ # basic operations
20
+ { name: 'return', description: 'Return a value from a function.', category: INSTRUCTION_CATEGORY_BASIC },
21
+ # state operations
22
+ { name: 'fetch_state', description: 'Fetch a value from the state.', category: INSTRUCTION_CATEGORY_STATE },
23
+ { name: 'save_state', description: 'Save a value to the state.', category: INSTRUCTION_CATEGORY_STATE },
24
+ # numeric operations
25
+ { name: 'add_numbers', description: 'Add two numbers.', category: INSTRUCTION_CATEGORY_NUMERIC },
26
+ { name: 'subtract_numbers', description: 'Subtract two numbers.', category: INSTRUCTION_CATEGORY_NUMERIC },
27
+ { name: 'multiply_numbers', description: 'Multiply two numbers.', category: INSTRUCTION_CATEGORY_NUMERIC },
28
+ { name: 'divide_numbers', description: 'Divide two numbers.', category: INSTRUCTION_CATEGORY_NUMERIC },
29
+ # string operations
30
+ { name: 'add_strings', description: 'Concatenate two strings.', category: INSTRUCTION_CATEGORY_STRING }
31
+ ].freeze
32
+
33
+ # Supported Types for DTR.
34
+ TYPES = [
35
+ # basic types
36
+ 'address',
37
+ 'boolean',
38
+ # string types
39
+ 'symbol',
40
+ # collection types
41
+ 'array',
42
+ 'map',
43
+ # numeric types
44
+ ## signed
45
+ 'i32',
46
+ 'i64',
47
+ 'i128',
48
+ 'i256',
49
+ ## unsigned
50
+ 'u32',
51
+ 'u64',
52
+ 'u128',
53
+ 'u256'
54
+ ].freeze
55
+ end
56
+ end
data/lib/dtr_core.rb CHANGED
@@ -8,6 +8,5 @@ module DTRCore
8
8
  autoload :Parser, 'dtr_core/parser'
9
9
  autoload :State, 'dtr_core/state'
10
10
  autoload :TypeValidator, 'dtr_core/type_validator'
11
-
12
- VERSION = '0.1.0'
11
+ autoload :SupportedAttributes, 'dtr_core/supported_attributes'
13
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtr_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Durst
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-12 00:00:00.000000000 Z
11
+ date: 2024-05-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Core smart contract intermediate language (Digicus Textual Representation)
14
14
  parser.
@@ -25,6 +25,7 @@ files:
25
25
  - lib/dtr_core/number.rb
26
26
  - lib/dtr_core/parser.rb
27
27
  - lib/dtr_core/state.rb
28
+ - lib/dtr_core/supported_attributes.rb
28
29
  - lib/dtr_core/type_validator.rb
29
30
  homepage: https://spaced-out-thoughts-dev-foundation.github.io/digicus/
30
31
  licenses: