csv_plus_plus 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -3
  3. data/docs/CHANGELOG.md +16 -0
  4. data/lib/csv_plus_plus/a1_reference.rb +202 -0
  5. data/lib/csv_plus_plus/benchmarked_compiler.rb +3 -3
  6. data/lib/csv_plus_plus/cell.rb +1 -35
  7. data/lib/csv_plus_plus/cli.rb +43 -80
  8. data/lib/csv_plus_plus/cli_flag.rb +71 -70
  9. data/lib/csv_plus_plus/color.rb +1 -1
  10. data/lib/csv_plus_plus/compiler.rb +31 -21
  11. data/lib/csv_plus_plus/entities/ast_builder.rb +11 -4
  12. data/lib/csv_plus_plus/entities/boolean.rb +16 -9
  13. data/lib/csv_plus_plus/entities/builtins.rb +68 -40
  14. data/lib/csv_plus_plus/entities/date.rb +14 -11
  15. data/lib/csv_plus_plus/entities/entity.rb +11 -29
  16. data/lib/csv_plus_plus/entities/entity_with_arguments.rb +18 -31
  17. data/lib/csv_plus_plus/entities/function.rb +22 -11
  18. data/lib/csv_plus_plus/entities/function_call.rb +35 -11
  19. data/lib/csv_plus_plus/entities/has_identifier.rb +19 -0
  20. data/lib/csv_plus_plus/entities/number.rb +15 -10
  21. data/lib/csv_plus_plus/entities/reference.rb +77 -0
  22. data/lib/csv_plus_plus/entities/runtime_value.rb +36 -23
  23. data/lib/csv_plus_plus/entities/string.rb +13 -10
  24. data/lib/csv_plus_plus/entities.rb +2 -18
  25. data/lib/csv_plus_plus/error/cli_error.rb +17 -0
  26. data/lib/csv_plus_plus/error/compiler_error.rb +17 -0
  27. data/lib/csv_plus_plus/error/error.rb +18 -5
  28. data/lib/csv_plus_plus/error/formula_syntax_error.rb +12 -13
  29. data/lib/csv_plus_plus/error/modifier_syntax_error.rb +10 -36
  30. data/lib/csv_plus_plus/error/modifier_validation_error.rb +6 -32
  31. data/lib/csv_plus_plus/error/positional_error.rb +15 -0
  32. data/lib/csv_plus_plus/error/writer_error.rb +1 -1
  33. data/lib/csv_plus_plus/error.rb +4 -1
  34. data/lib/csv_plus_plus/error_formatter.rb +111 -0
  35. data/lib/csv_plus_plus/google_api_client.rb +18 -8
  36. data/lib/csv_plus_plus/lexer/racc_lexer.rb +144 -0
  37. data/lib/csv_plus_plus/lexer/tokenizer.rb +53 -17
  38. data/lib/csv_plus_plus/lexer.rb +40 -1
  39. data/lib/csv_plus_plus/modifier/data_validation.rb +1 -1
  40. data/lib/csv_plus_plus/modifier/expand.rb +17 -0
  41. data/lib/csv_plus_plus/modifier.rb +6 -1
  42. data/lib/csv_plus_plus/options/file_options.rb +49 -0
  43. data/lib/csv_plus_plus/options/google_sheets_options.rb +42 -0
  44. data/lib/csv_plus_plus/options/options.rb +97 -0
  45. data/lib/csv_plus_plus/options.rb +22 -110
  46. data/lib/csv_plus_plus/parser/cell_value.tab.rb +65 -66
  47. data/lib/csv_plus_plus/parser/code_section.tab.rb +92 -84
  48. data/lib/csv_plus_plus/parser/modifier.tab.rb +40 -30
  49. data/lib/csv_plus_plus/reader/csv.rb +50 -0
  50. data/lib/csv_plus_plus/reader/google_sheets.rb +129 -0
  51. data/lib/csv_plus_plus/reader/reader.rb +27 -0
  52. data/lib/csv_plus_plus/reader/rubyxl.rb +37 -0
  53. data/lib/csv_plus_plus/reader.rb +14 -0
  54. data/lib/csv_plus_plus/runtime/graph.rb +6 -6
  55. data/lib/csv_plus_plus/runtime/{position_tracker.rb → position.rb} +16 -5
  56. data/lib/csv_plus_plus/runtime/references.rb +32 -27
  57. data/lib/csv_plus_plus/runtime/runtime.rb +73 -67
  58. data/lib/csv_plus_plus/runtime/scope.rb +280 -0
  59. data/lib/csv_plus_plus/runtime.rb +9 -9
  60. data/lib/csv_plus_plus/source_code.rb +14 -9
  61. data/lib/csv_plus_plus/template.rb +17 -12
  62. data/lib/csv_plus_plus/version.rb +1 -1
  63. data/lib/csv_plus_plus/writer/csv.rb +32 -5
  64. data/lib/csv_plus_plus/writer/excel.rb +19 -6
  65. data/lib/csv_plus_plus/writer/file_backer_upper.rb +27 -14
  66. data/lib/csv_plus_plus/writer/google_sheets.rb +23 -129
  67. data/lib/csv_plus_plus/writer/{google_sheet_builder.rb → google_sheets_builder.rb} +39 -55
  68. data/lib/csv_plus_plus/writer/merger.rb +31 -0
  69. data/lib/csv_plus_plus/writer/open_document.rb +16 -2
  70. data/lib/csv_plus_plus/writer/rubyxl_builder.rb +68 -43
  71. data/lib/csv_plus_plus/writer/writer.rb +42 -0
  72. data/lib/csv_plus_plus/writer.rb +58 -19
  73. data/lib/csv_plus_plus.rb +26 -14
  74. metadata +37 -12
  75. data/lib/csv_plus_plus/entities/cell_reference.rb +0 -231
  76. data/lib/csv_plus_plus/entities/variable.rb +0 -37
  77. data/lib/csv_plus_plus/error/syntax_error.rb +0 -71
  78. data/lib/csv_plus_plus/google_options.rb +0 -32
  79. data/lib/csv_plus_plus/lexer/lexer.rb +0 -89
  80. data/lib/csv_plus_plus/runtime/can_define_references.rb +0 -87
  81. data/lib/csv_plus_plus/runtime/can_resolve_references.rb +0 -209
  82. data/lib/csv_plus_plus/writer/base_writer.rb +0 -45
@@ -0,0 +1,97 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module CSVPlusPlus
5
+ module Options
6
+ # The options a user can supply (via CLI flags)
7
+ #
8
+ # @attr backup [Boolean] Create a backup of the spreadsheet before writing
9
+ # @attr create_if_not_exists [Boolean] Create the spreadsheet if it does not exist?
10
+ # @attr key_values [Hash] Additional variables that can be supplied to the template
11
+ # @attr offset [Array<Integer>] An [x, y] offset (array with two integers)
12
+ # @attr sheet_name [String] The name of the spreadsheet to write to
13
+ # @attr verbose [Boolean] Include extra verbose output?
14
+ class Options
15
+ extend ::T::Sig
16
+ extend ::T::Helpers
17
+
18
+ abstract!
19
+
20
+ sig { returns(::T::Boolean) }
21
+ attr_accessor :backup
22
+
23
+ sig { returns(::T::Boolean) }
24
+ attr_accessor :create_if_not_exists
25
+
26
+ sig { returns(::T::Hash[::Symbol, ::CSVPlusPlus::Entities::Entity]) }
27
+ attr_accessor :key_values
28
+
29
+ sig { returns(::T::Array[::Integer]) }
30
+ attr_accessor :offset
31
+
32
+ sig { returns(::String) }
33
+ attr_accessor :sheet_name
34
+
35
+ sig { returns(::T::Boolean) }
36
+ attr_accessor :verbose
37
+
38
+ sig { params(sheet_name: ::String).void }
39
+ # Initialize a defaul +Options+ object
40
+ def initialize(sheet_name)
41
+ @sheet_name = sheet_name
42
+ @offset = ::T.let([0, 0], ::T::Array[::Integer])
43
+ @create_if_not_exists = ::T.let(false, ::T::Boolean)
44
+ @key_values = ::T.let({}, ::T::Hash[::Symbol, ::CSVPlusPlus::Entities::Entity])
45
+ @verbose = ::T.let(false, ::T::Boolean)
46
+ @backup = ::T.let(false, ::T::Boolean)
47
+ end
48
+
49
+ sig { abstract.returns(::CSVPlusPlus::Options::OutputFormat) }
50
+ # Given the options, figure out which type of +OutputFormat+ we'll be writing to
51
+ #
52
+ # @return [Options::OutputFormat]
53
+ def output_format; end
54
+
55
+ sig { abstract.returns(::String) }
56
+ # Return a string with a verbose description of what we're doing with the options
57
+ #
58
+ # @return [String]
59
+ def verbose_summary; end
60
+
61
+ protected
62
+
63
+ sig { params(str: ::String).returns(::String) }
64
+ # Return a string with a verbose description of what we're doing with the options
65
+ #
66
+ # @return [String]
67
+ def shared_summary(str)
68
+ <<~SUMMARY
69
+ #{summary_divider}
70
+
71
+ # csv++ Command Options
72
+
73
+ > Sheet name | #{@sheet_name}
74
+ > Create sheet if it does not exist? | #{@create_if_not_exists}
75
+ > Spreadsheet row-offset | #{@offset[0]}
76
+ > Spreadsheet cell-offset | #{@offset[1]}
77
+ > User-supplied key-values | #{@key_values}
78
+ > Verbose | #{@verbose}
79
+ > Backup | #{@backup}
80
+
81
+ ## Output Options
82
+
83
+ #{str}
84
+
85
+ #{summary_divider}
86
+ SUMMARY
87
+ end
88
+
89
+ private
90
+
91
+ sig { returns(::String) }
92
+ def summary_divider
93
+ '========================================================================='
94
+ end
95
+ end
96
+ end
97
+ end
@@ -2,17 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module CSVPlusPlus
5
- # The options a user can supply (via CLI flags)
6
- #
7
- # @attr backup [boolean] Create a backup of the spreadsheet before writing
8
- # @attr create_if_not_exists [boolean] Create the spreadsheet if it does not exist?
9
- # @attr key_values [Hash] Additional variables that can be supplied to the template
10
- # @attr offset [Array<Integer>] An [x, y] offset (array with two integers)
11
- # @attr output_filename [String] The file to write our compiled results to
12
- # @attr sheet_name [String] The name of the spreadsheet to write to
13
- # @attr verbose [boolean] Include extra verbose output?
14
- # @attr_reader google [GoogleOptions] Options that are specific to the Google Sheets writer
15
- class Options
5
+ # Options that a user can supply - either specific for compiling to a file (xlsx, csv) or Google Sheets
6
+ module Options
16
7
  extend ::T::Sig
17
8
 
18
9
  # The supported output formats. We use this to dispatch flow in several places
@@ -25,109 +16,30 @@ module CSVPlusPlus
25
16
  end
26
17
  end
27
18
 
28
- sig { returns(::T::Boolean) }
29
- attr_accessor :backup
30
-
31
- sig { returns(::T::Boolean) }
32
- attr_accessor :create_if_not_exists
33
-
34
- sig { returns(::T::Hash[::Symbol, ::String]) }
35
- attr_accessor :key_values
36
-
37
- sig { returns(::T::Array[::Integer]) }
38
- attr_accessor :offset
39
-
40
- sig { returns(::T.nilable(::String)) }
41
- attr_accessor :output_filename
42
-
43
- sig { returns(::T.nilable(::String)) }
44
- attr_accessor :sheet_name
45
-
46
- sig { returns(::T::Boolean) }
47
- attr_accessor :verbose
48
-
49
- sig { returns(::T.nilable(::CSVPlusPlus::GoogleOptions)) }
50
- attr_reader :google
51
-
52
- sig { void }
53
- # Initialize a default +Options+ object
54
- def initialize
55
- @offset = ::T.let([0, 0], ::T::Array[::Integer])
56
- @create_if_not_exists = ::T.let(false, ::T::Boolean)
57
- @key_values = ::T.let({}, ::T::Hash[::Symbol, ::String])
58
- @verbose = ::T.let(false, ::T::Boolean)
59
- @backup = ::T.let(false, ::T::Boolean)
60
- @google = ::T.let(nil, ::T.nilable(::CSVPlusPlus::GoogleOptions))
19
+ sig do
20
+ params(flags: ::T::Hash[::Symbol, ::String], input_filename: ::Pathname).returns(::CSVPlusPlus::Options::Options)
61
21
  end
62
-
63
- sig { params(sheet_id: ::String).returns(::CSVPlusPlus::GoogleOptions) }
64
- # Set the Google Sheet ID
65
- #
66
- # @param sheet_id [::String] The identifier used by Google's API to reference the sheet. You can find it in the URL
67
- # for the sheet
22
+ # Use the given +flags+ to determine if we're dealing with either a Google Sheets or file-based
23
+ # compilation and build an +Options+ instance accordingly.
68
24
  #
69
- # @return [::String]
70
- def google_sheet_id=(sheet_id)
71
- @google = ::CSVPlusPlus::GoogleOptions.new(sheet_id)
72
- end
73
-
74
- sig { returns(::CSVPlusPlus::Options::OutputFormat) }
75
- # Given the options, figure out which type of +OutputFormat+ we'll be writing to
25
+ # @param flags [Hash<Symbol, String>]
26
+ # @param input_filename [Pathname]
76
27
  #
77
- # @return [Options::OutputFormat]
78
- def output_format
79
- return ::CSVPlusPlus::Options::OutputFormat::GoogleSheets if @google
80
-
81
- case @output_filename
82
- when /\.csv$/ then ::CSVPlusPlus::Options::OutputFormat::CSV
83
- when /\.ods$/ then ::CSVPlusPlus::Options::OutputFormat::OpenDocument
84
- when /\.xl(sx|sm|tx|tm)$/ then ::CSVPlusPlus::Options::OutputFormat::Excel
85
- else raise(::CSVPlusPlus::Error::Error, "Unsupported file extension: #{@output_filename}")
28
+ # @return [Options::Options]
29
+ def self.from_cli_flags(flags, input_filename)
30
+ sheet_name = flags[:'sheet-name'] || input_filename.sub_ext('').to_s
31
+ if (google_sheet_id = flags[:'google-sheet-id'])
32
+ ::CSVPlusPlus::Options::GoogleSheetsOptions.new(sheet_name, google_sheet_id)
33
+ elsif (output_filename = flags[:output])
34
+ ::CSVPlusPlus::Options::FileOptions.new(sheet_name, output_filename)
35
+ else
36
+ raise(::CSVPlusPlus::Error::CLIError, 'You must supply either -o/--output or -g/-google-sheet-id')
86
37
  end
87
38
  end
88
-
89
- sig { returns(::T.nilable(::String)) }
90
- # Returns an error string or nil if there are no validation problems
91
- #
92
- # @return [String, nil]
93
- def validate
94
- return if @google || @output_filename
95
-
96
- 'You must supply either a Google Sheet ID or an output file'
97
- end
98
-
99
- sig { returns(::String) }
100
- # Return a string with a verbose description of what we're doing with the options
101
- #
102
- # @return [String]
103
- def verbose_summary
104
- <<~SUMMARY
105
- #{summary_divider}
106
-
107
- # csv++ Command Options
108
-
109
- > Sheet name | #{@sheet_name}
110
- > Create sheet if it does not exist? | #{@create_if_not_exists}
111
- > Spreadsheet row-offset | #{@offset[0]}
112
- > Spreadsheet cell-offset | #{@offset[1]}
113
- > User-supplied key-values | #{@key_values}
114
- > Verbose | #{@verbose}
115
-
116
- ## Output Options
117
-
118
- > Backup | #{@backup}
119
- > Output filename | #{@output_filename}
120
-
121
- #{@google&.verbose_summary || ''}
122
- #{summary_divider}
123
- SUMMARY
124
- end
125
-
126
- private
127
-
128
- sig { returns(::String) }
129
- def summary_divider
130
- '========================================================================='
131
- end
132
39
  end
133
40
  end
41
+
42
+ require_relative './options/options'
43
+
44
+ require_relative './options/file_options'
45
+ require_relative './options/google_sheets_options'
@@ -7,6 +7,7 @@
7
7
  require 'racc/parser.rb'
8
8
 
9
9
  require_relative '../lexer'
10
+ require_relative '../lexer/racc_lexer'
10
11
  require_relative '../entities/ast_builder'
11
12
 
12
13
  module CSVPlusPlus
@@ -14,35 +15,43 @@ module CSVPlusPlus
14
15
  class CellValue < Racc::Parser
15
16
 
16
17
  module_eval(<<'...end cell_value.y/module_eval...', 'cell_value.y', 49)
18
+ extend ::T::Sig
19
+ extend ::T::Generic
17
20
  include ::CSVPlusPlus::Entities::ASTBuilder
18
- include ::CSVPlusPlus::Lexer
21
+ include ::CSVPlusPlus::Lexer::RaccLexer
22
+
23
+ ReturnType = type_member {{ fixed: ::T.nilable(::CSVPlusPlus::Entities::Entity) }}
19
24
 
20
25
  protected
21
26
 
27
+ sig { override.params(input: ::String).returns(::T::Boolean) }
22
28
  def anything_to_parse?(input)
23
29
  input.strip.start_with?('=')
24
30
  end
25
31
 
32
+ sig { override.returns(::String) }
26
33
  def parse_subject
27
34
  'cell value'
28
35
  end
29
36
 
37
+ sig { override.returns(ReturnType) }
30
38
  def return_value
31
39
  @ast
32
40
  end
33
41
 
42
+ sig { override.returns(::CSVPlusPlus::Lexer::Tokenizer) }
34
43
  def tokenizer
35
44
  ::CSVPlusPlus::Lexer::Tokenizer.new(
36
45
  catchall: /[\{\}\(\),=]/,
37
46
  ignore: /\s+/,
38
47
  tokens: [
39
- TOKEN_LIBRARY[:TRUE],
40
- TOKEN_LIBRARY[:FALSE],
41
- TOKEN_LIBRARY[:NUMBER],
42
- TOKEN_LIBRARY[:STRING],
43
- TOKEN_LIBRARY[:INFIX_OP],
44
- TOKEN_LIBRARY[:VAR_REF],
45
- TOKEN_LIBRARY[:ID]
48
+ ::CSVPlusPlus::Lexer::TOKEN_LIBRARY[:TRUE],
49
+ ::CSVPlusPlus::Lexer::TOKEN_LIBRARY[:FALSE],
50
+ ::CSVPlusPlus::Lexer::TOKEN_LIBRARY[:NUMBER],
51
+ ::CSVPlusPlus::Lexer::TOKEN_LIBRARY[:STRING],
52
+ ::CSVPlusPlus::Lexer::TOKEN_LIBRARY[:INFIX_OP],
53
+ ::CSVPlusPlus::Lexer::TOKEN_LIBRARY[:VAR_REF],
54
+ ::CSVPlusPlus::Lexer::TOKEN_LIBRARY[:REF]
46
55
  ]
47
56
  )
48
57
  end
@@ -50,45 +59,43 @@ module_eval(<<'...end cell_value.y/module_eval...', 'cell_value.y', 49)
50
59
  ##### State transition tables begin ###
51
60
 
52
61
  racc_action_table = [
53
- 7, 21, 15, 25, 2, 16, 3, 7, 14, 18,
54
- 19, 16, 16, 16, 7, 12, 13, 16, 10, 9,
55
- 11, 8, 12, 13, 26, 10, 9, 11, 8, 12,
56
- 13, nil, 10, 9, 11, 8, 7, 23, nil, nil,
57
- nil, nil, nil, 7, nil, nil, nil, nil, nil, nil,
58
- nil, 12, 13, nil, 10, 9, 11, 8, 12, 13,
59
- nil, 10, 9, 11, 8 ]
62
+ 23, 19, 14, 2, 15, 7, 3, 13, 17, 15,
63
+ 15, 7, 15, nil, nil, nil, 15, 7, nil, nil,
64
+ 11, 24, 9, 12, 8, 10, 11, 7, 9, 12,
65
+ 8, 10, 11, nil, 9, 12, 8, 10, 7, 21,
66
+ nil, nil, 11, nil, 9, 12, 8, 10, nil, nil,
67
+ nil, nil, nil, 11, nil, 9, 12, 8, 10 ]
60
68
 
61
69
  racc_action_check = [
62
- 2, 17, 4, 22, 0, 4, 1, 7, 3, 8,
63
- 13, 20, 24, 27, 16, 2, 2, 17, 2, 2,
64
- 2, 2, 7, 7, 22, 7, 7, 7, 7, 16,
65
- 16, nil, 16, 16, 16, 16, 19, 19, nil, nil,
66
- nil, nil, nil, 26, nil, nil, nil, nil, nil, nil,
67
- nil, 19, 19, nil, 19, 19, 19, 19, 26, 26,
68
- nil, 26, 26, 26, 26 ]
70
+ 20, 16, 4, 0, 4, 2, 1, 3, 12, 18,
71
+ 22, 7, 25, nil, nil, nil, 16, 15, nil, nil,
72
+ 2, 20, 2, 2, 2, 2, 7, 24, 7, 7,
73
+ 7, 7, 15, nil, 15, 15, 15, 15, 17, 17,
74
+ nil, nil, 24, nil, 24, 24, 24, 24, nil, nil,
75
+ nil, nil, nil, 17, nil, 17, 17, 17, 17 ]
69
76
 
70
77
  racc_action_pointer = [
71
- -6, 6, -2, 8, -14, nil, nil, 5, -9, nil,
72
- nil, nil, nil, 8, nil, nil, 12, -2, nil, 34,
73
- -8, nil, 0, nil, -7, nil, 41, -6 ]
78
+ -7, 6, 3, 7, -14, nil, nil, 9, nil, nil,
79
+ nil, nil, 6, nil, nil, 15, -2, 36, -9, nil,
80
+ -3, nil, -8, nil, 25, -6 ]
74
81
 
75
82
  racc_action_default = [
76
- -16, -16, -16, -16, -16, -2, -3, -16, -16, -6,
77
- -7, -8, -9, -10, 28, -1, -16, -16, -5, -16,
78
- -15, -4, -16, -12, -14, -11, -16, -13 ]
83
+ -15, -15, -15, -15, -15, -2, -3, -15, -5, -6,
84
+ -7, -8, -9, 26, -1, -15, -15, -15, -14, -4,
85
+ -15, -11, -13, -10, -15, -12 ]
79
86
 
80
87
  racc_goto_table = [
81
- 4, 1, 22, nil, nil, 17, nil, nil, nil, nil,
82
- nil, nil, nil, nil, 20, nil, nil, 24, nil, nil,
83
- nil, nil, nil, nil, 27 ]
88
+ 4, 1, 20, nil, nil, 16, nil, nil, nil, nil,
89
+ nil, nil, nil, 18, nil, 22, nil, nil, nil, nil,
90
+ nil, nil, 25 ]
84
91
 
85
92
  racc_goto_check = [
86
93
  2, 1, 5, nil, nil, 2, nil, nil, nil, nil,
87
- nil, nil, nil, nil, 2, nil, nil, 2, nil, nil,
88
- nil, nil, nil, nil, 2 ]
94
+ nil, nil, nil, 2, nil, 2, nil, nil, nil, nil,
95
+ nil, nil, 2 ]
89
96
 
90
97
  racc_goto_pointer = [
91
- nil, 1, -2, nil, nil, -17 ]
98
+ nil, 1, -2, nil, nil, -15 ]
92
99
 
93
100
  racc_goto_default = [
94
101
  nil, nil, nil, 5, 6, nil ]
@@ -99,21 +106,20 @@ racc_reduce_table = [
99
106
  1, 27, :_reduce_none,
100
107
  1, 27, :_reduce_none,
101
108
  3, 27, :_reduce_4,
102
- 2, 27, :_reduce_5,
109
+ 1, 27, :_reduce_5,
103
110
  1, 27, :_reduce_6,
104
111
  1, 27, :_reduce_7,
105
112
  1, 27, :_reduce_8,
106
113
  1, 27, :_reduce_9,
107
- 1, 27, :_reduce_10,
108
- 4, 28, :_reduce_11,
109
- 3, 28, :_reduce_12,
110
- 3, 30, :_reduce_13,
111
- 1, 30, :_reduce_14,
112
- 3, 29, :_reduce_15 ]
114
+ 4, 28, :_reduce_10,
115
+ 3, 28, :_reduce_11,
116
+ 3, 30, :_reduce_12,
117
+ 1, 30, :_reduce_13,
118
+ 3, 29, :_reduce_14 ]
113
119
 
114
- racc_reduce_n = 16
120
+ racc_reduce_n = 15
115
121
 
116
- racc_shift_n = 28
122
+ racc_shift_n = 26
117
123
 
118
124
  racc_token_table = {
119
125
  false => 0,
@@ -134,9 +140,9 @@ racc_token_table = {
134
140
  "<>" => 15,
135
141
  :EOL => 16,
136
142
  :FALSE => 17,
137
- :ID => 18,
138
- :INFIX_OP => 19,
139
- :NUMBER => 20,
143
+ :INFIX_OP => 18,
144
+ :NUMBER => 19,
145
+ :REF => 20,
140
146
  :STRING => 21,
141
147
  :TRUE => 22,
142
148
  :VAR_REF => 23,
@@ -181,9 +187,9 @@ Racc_token_to_s_table = [
181
187
  "\"<>\"",
182
188
  "EOL",
183
189
  "FALSE",
184
- "ID",
185
190
  "INFIX_OP",
186
191
  "NUMBER",
192
+ "REF",
187
193
  "STRING",
188
194
  "TRUE",
189
195
  "VAR_REF",
@@ -221,76 +227,69 @@ module_eval(<<'.,.,', 'cell_value.y', 25)
221
227
 
222
228
  module_eval(<<'.,.,', 'cell_value.y', 26)
223
229
  def _reduce_5(val, _values, result)
224
- result = variable(val[1].to_sym)
230
+ result = string(val[0])
225
231
  result
226
232
  end
227
233
  .,.,
228
234
 
229
235
  module_eval(<<'.,.,', 'cell_value.y', 27)
230
236
  def _reduce_6(val, _values, result)
231
- result = string(val[0])
237
+ result = number(val[0])
232
238
  result
233
239
  end
234
240
  .,.,
235
241
 
236
242
  module_eval(<<'.,.,', 'cell_value.y', 28)
237
243
  def _reduce_7(val, _values, result)
238
- result = number(val[0])
244
+ result = boolean(true)
239
245
  result
240
246
  end
241
247
  .,.,
242
248
 
243
249
  module_eval(<<'.,.,', 'cell_value.y', 29)
244
250
  def _reduce_8(val, _values, result)
245
- result = boolean(true)
251
+ result = boolean(false)
246
252
  result
247
253
  end
248
254
  .,.,
249
255
 
250
256
  module_eval(<<'.,.,', 'cell_value.y', 30)
251
257
  def _reduce_9(val, _values, result)
252
- result = boolean(false)
258
+ result = reference(ref: val[0])
253
259
  result
254
260
  end
255
261
  .,.,
256
262
 
257
- module_eval(<<'.,.,', 'cell_value.y', 31)
263
+ module_eval(<<'.,.,', 'cell_value.y', 32)
258
264
  def _reduce_10(val, _values, result)
259
- result = cell_reference(ref: val[0])
265
+ result = function_call(val[0].to_sym, val[2])
260
266
  result
261
267
  end
262
268
  .,.,
263
269
 
264
270
  module_eval(<<'.,.,', 'cell_value.y', 33)
265
271
  def _reduce_11(val, _values, result)
266
- result = function_call(val[0].to_sym, val[2])
272
+ result = function_call(val[0].to_sym, [])
267
273
  result
268
274
  end
269
275
  .,.,
270
276
 
271
- module_eval(<<'.,.,', 'cell_value.y', 34)
277
+ module_eval(<<'.,.,', 'cell_value.y', 35)
272
278
  def _reduce_12(val, _values, result)
273
- result = function_call(val[0].to_sym, [])
279
+ result = val[0] << val[2]
274
280
  result
275
281
  end
276
282
  .,.,
277
283
 
278
284
  module_eval(<<'.,.,', 'cell_value.y', 36)
279
285
  def _reduce_13(val, _values, result)
280
- result = val[0] << val[2]
281
- result
282
- end
283
- .,.,
284
-
285
- module_eval(<<'.,.,', 'cell_value.y', 37)
286
- def _reduce_14(val, _values, result)
287
286
  result = [val[0]]
288
287
  result
289
288
  end
290
289
  .,.,
291
290
 
292
- module_eval(<<'.,.,', 'cell_value.y', 39)
293
- def _reduce_15(val, _values, result)
291
+ module_eval(<<'.,.,', 'cell_value.y', 38)
292
+ def _reduce_14(val, _values, result)
294
293
  result = function_call(val[1].to_sym, [val[0], val[2]], infix: true)
295
294
  result
296
295
  end