ascode 0.3.1 → 0.3.2

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: a84ef30c0d5d4a4e9cf006e4dfeb586679d7537b73427f15ed224e439f6d1d68
4
- data.tar.gz: 4bb125bb43ca2101f16b82dc1f20fcc8593b1ed22f35b990f42b235fd789f69f
3
+ metadata.gz: d8e23bc6e653965a74e847c726fd2475c9d80787d36eef439b68a8d4f9ad7f6f
4
+ data.tar.gz: 2e99a66181a565e217e3820fb18da9a44710dea2e91fb84b6e6dc838b880003d
5
5
  SHA512:
6
- metadata.gz: 981a7a17e6d78e2d3338c61776a773e87abfd895272312bad806806a9a675b01b91d2ea0242814f30f0d9f2caa3897743c6bd1ad6ae2fb78be8d7d47b9fc6e0f
7
- data.tar.gz: 6ae9e6aa11e741780b319e453e59f061bfcd947de699a3a8efed42573a850b0cad260e8baef74dc2064381104fb5b36bc5bcc0d37ca396c4c5077ff097c64b63
6
+ metadata.gz: 1c8680657e8d13ac141d4f7499f79f522a8b496b86dc28a62f9bc4594f6e3811b493be98a7cadf87f0a5694bb7e5bf02c22f445cd30ed89c990567a84593fa25
7
+ data.tar.gz: 00fb2ca59f0e7b23d3070b503be1472b338acf6a5cd8be40a6de6d1b9e95c6e673e3112cf488a358094ceb7e7ed49cd3b5290c8f3d43f54a93e5d14241cea51c
@@ -5,7 +5,7 @@ module Ascode
5
5
  def initialize
6
6
  @csv_data = []
7
7
 
8
- file = File.open(File.join(File.dirname(__FILE__), 'functions.md'), 'r')
8
+ file = File.open(File.join(File.dirname(__FILE__), "functions.md"), "r")
9
9
  read_csv file
10
10
  file.close
11
11
 
@@ -15,7 +15,7 @@ module Ascode
15
15
 
16
16
  def read_csv(file)
17
17
  until (line = file.gets).nil?
18
- src = line.strip.split('|')
18
+ src = line.strip.split("|")
19
19
 
20
20
  @csv_data.push(
21
21
  short: clear_quotes(src[0]),
@@ -29,7 +29,7 @@ module Ascode
29
29
 
30
30
  def clear_quotes(str)
31
31
  return str unless str
32
- str.delete('`')
32
+ str.delete("`")
33
33
  end
34
34
  end
35
35
  end
@@ -1,4 +1,4 @@
1
- require_relative 'converter'
1
+ require_relative "converter"
2
2
 
3
3
  module Ascode
4
4
  class Interpreter
@@ -12,9 +12,9 @@ module Ascode
12
12
  @ast.each do |action|
13
13
  name = action[:action]
14
14
 
15
- if name == 'push'
15
+ if name == "push"
16
16
  push(action[:what])
17
- elsif name == 'condition'
17
+ elsif name == "condition"
18
18
  condition_begin action[:true_block], action[:false_block]
19
19
  else
20
20
  send(name)
data/lib/ascode/parser.rb CHANGED
@@ -1,5 +1,5 @@
1
- require_relative 'functions'
2
- require_relative 'converter'
1
+ require_relative "functions"
2
+ require_relative "converter"
3
3
 
4
4
  module Ascode
5
5
  class Parser
@@ -16,7 +16,7 @@ module Ascode
16
16
  @skip_chars = 0
17
17
  @implicit_output = @do_implicit_output
18
18
 
19
- @code.split('').to_enum.each_with_index do |char, index|
19
+ @code.split("").to_enum.each_with_index do |char, index|
20
20
  if @skip_chars > 0
21
21
  @skip_chars -= 1
22
22
  next
@@ -26,7 +26,7 @@ module Ascode
26
26
  end
27
27
  ast_add_buffer
28
28
 
29
- ast_add_action 'output' if @implicit_output
29
+ ast_add_action "output" if @implicit_output
30
30
 
31
31
  @ast
32
32
  end
@@ -52,15 +52,15 @@ module Ascode
52
52
  false_block_ast = (Parser.new block_code[(split_pos + 1)..-1], false).parse
53
53
  end
54
54
 
55
- @ast.push(action: 'condition', true_block: true_block_ast, false_block: false_block_ast )
55
+ @ast.push(action: "condition", true_block: true_block_ast, false_block: false_block_ast )
56
56
 
57
57
  end_index + 2
58
58
  end
59
59
 
60
60
  def find_block_end(block)
61
61
  end_index = -1
62
- block.split('').to_enum.with_index.reverse_each do |char, index|
63
- if char == ']'
62
+ block.split("").to_enum.with_index.reverse_each do |char, index|
63
+ if char == "]"
64
64
  end_index = index
65
65
  break
66
66
  end
@@ -72,12 +72,12 @@ module Ascode
72
72
  def find_block_split(block)
73
73
  level = 0
74
74
  split_pos = -1
75
- block.split('').to_enum.each_with_index do |char, index|
76
- if char == '['
75
+ block.split("").to_enum.each_with_index do |char, index|
76
+ if char == "["
77
77
  level += 1
78
- elsif char == ']'
78
+ elsif char == "]"
79
79
  level -= 1
80
- elsif char == '~' && level.zero?
80
+ elsif char == "~" && level.zero?
81
81
  split_pos = index
82
82
  end
83
83
  end
@@ -86,12 +86,12 @@ module Ascode
86
86
  end
87
87
 
88
88
  def parse_character(char, index)
89
- if char == '['
89
+ if char == "["
90
90
  end_index = parse_condition_block index
91
91
  @skip_chars = end_index - index
92
92
  elsif char =~ /[\w.,:;!?]/
93
93
  buffer_push char
94
- elsif char == ' '
94
+ elsif char == " "
95
95
  ast_add_buffer
96
96
  else
97
97
  ast_add_buffer
@@ -121,12 +121,12 @@ module Ascode
121
121
 
122
122
  @push_buffer = Converter.convert @push_buffer
123
123
 
124
- ast_add_action 'push', @push_buffer
124
+ ast_add_action "push", @push_buffer
125
125
  @push_buffer = false
126
126
  end
127
127
 
128
128
  def ast_add_action(name, what = nil)
129
- @implicit_output = false if name == 'output'
129
+ @implicit_output = false if name == "output"
130
130
 
131
131
  data = { action: name }
132
132
  data[:what] = what if what
data/lib/ascode.rb CHANGED
@@ -1,5 +1,5 @@
1
- require_relative 'ascode/interpreter'
2
- require_relative 'ascode/parser'
1
+ require_relative "ascode/interpreter"
2
+ require_relative "ascode/parser"
3
3
 
4
4
  module Ascode
5
5
  def self.run(code)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ascode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Varaksa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-14 00:00:00.000000000 Z
11
+ date: 2018-01-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Esoteric golfing language. In active development, so behavior may be
14
14
  changed without prior notice.