mvinl 0.1.3 → 0.1.5
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/README.md +3 -3
- data/Rakefile +9 -3
- data/bin/imvnl +5 -3
- data/lib/mvinl/context.rb +24 -0
- data/lib/mvinl/info.rb +2 -2
- data/lib/mvinl/lexer.rb +24 -14
- data/lib/mvinl/parser.rb +14 -8
- data/lib/mvinl.rb +16 -3
- data/mvinl.gemspec +1 -1
- data/rakelib/build.rake +6 -3
- data/spec/program_spec.rb +116 -0
- data/spec/spec_helper.rb +3 -0
- data/syntax/mvinl.tab.rb +266 -186
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ceac64e8ec7e1ff3f8fab41d82d4b69a577098bca195f7ed01205dfc3b54b2d
|
4
|
+
data.tar.gz: f8592113d9ac37d001048f8f49c4e46e4c1f09d6209e32800f73f821549fab61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e31891e65cde3f3de7124ec7665eaf89561f3a5db04201e03c316ee214e09b5d67db5f79d108eee5ddeae30daaddea187dbe27bcec2881aa7ff1bb4970b50536
|
7
|
+
data.tar.gz: 2b05bef7791eec6129ba210fd146f3ea575098d7ab70afe44cf709297319d2915ad7d5c876cf0dfe64a9f177dc299bb46a17a3769ed40d0317b77d6d0ebdbeb2
|
data/README.md
CHANGED
@@ -15,8 +15,8 @@ gem install mvinl
|
|
15
15
|
or build and install it from this repo if you have it downloaded
|
16
16
|
|
17
17
|
```
|
18
|
-
|
19
|
-
|
18
|
+
rake build
|
19
|
+
rake install
|
20
20
|
```
|
21
21
|
|
22
22
|
## Usage
|
@@ -46,7 +46,7 @@ def (center x (/ x 2))
|
|
46
46
|
Buttom (center 1920)
|
47
47
|
(center 1080)
|
48
48
|
"Hello, MVinl!"
|
49
|
-
|
49
|
+
font_size: 21 # END_TAG is optional
|
50
50
|
```
|
51
51
|
|
52
52
|
## Contribute
|
data/Rakefile
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
-
|
1
|
+
# frozen-string-literal: true
|
2
2
|
|
3
|
-
|
4
|
-
rspec
|
3
|
+
begin
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec, :tag) do |t, task_args|
|
6
|
+
t.rspec_opts = ENV['SPEC_OPTS'] || '--format documentation'
|
7
|
+
end
|
8
|
+
task default: :spec
|
9
|
+
rescue LoadError
|
10
|
+
warn 'Could not run rspec'
|
5
11
|
end
|
data/bin/imvnl
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen-string-literal: true
|
3
3
|
|
4
|
-
=begin
|
4
|
+
=begin imvnl
|
5
5
|
Copyright (c) 2018, 2024, Daniel Sierpiński All rights reserved.
|
6
6
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -27,14 +27,16 @@ require 'readline'
|
|
27
27
|
require 'pry'
|
28
28
|
require 'mvinl/lexer'
|
29
29
|
require 'mvinl/parser'
|
30
|
+
require 'mvinl/context'
|
30
31
|
require 'mvinl/info'
|
31
32
|
|
32
33
|
PSL = "mvnl(#{MVinl::Version})".freeze
|
33
34
|
PS1 = "#{PSL}>".freeze
|
34
35
|
|
35
36
|
module MVinl::REPL
|
36
|
-
|
37
|
-
|
37
|
+
CONTEXT = MVinl::Context.new
|
38
|
+
LEXER = MVinl::Lexer.new(CONTEXT, '')
|
39
|
+
PARSER = MVinl::Parser.new(LEXER, CONTEXT)
|
38
40
|
|
39
41
|
def self.run
|
40
42
|
while (input = Readline.readline("#{PS1} ", true))
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
3
|
+
module MVinl
|
4
|
+
# Lexer and parser shared context
|
5
|
+
class Context
|
6
|
+
attr_accessor :variables, :functions, :state
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
reset
|
10
|
+
end
|
11
|
+
|
12
|
+
def reset
|
13
|
+
@variables = {}
|
14
|
+
@functions = {}
|
15
|
+
@state = {
|
16
|
+
in_prop: false,
|
17
|
+
in_var: false,
|
18
|
+
in_keyword_arg: false,
|
19
|
+
keyword_arg_depth: 0,
|
20
|
+
depth: 0
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/mvinl/info.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
# info.rb
|
4
4
|
# Copyright (c) 2024, Daniel Sierpiński All rights reserved.
|
5
5
|
#
|
6
6
|
# See Copyright Notice in mvnil.rb
|
7
7
|
|
8
8
|
module MVinl
|
9
|
-
VERSION = '0.1.
|
9
|
+
VERSION = '0.1.5'
|
10
10
|
Version = VERSION
|
11
11
|
Copyright = 'Copyright (c) 2024, Daniel Sierpiński'
|
12
12
|
end
|
data/lib/mvinl/lexer.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
=begin
|
3
|
+
=begin lexer.rb
|
4
4
|
Copyright (c) 2024, Daniel Sierpiński All rights reserved.
|
5
5
|
|
6
6
|
See Copyright Notice in mvnil.rb
|
@@ -28,7 +28,10 @@ module MVinl
|
|
28
28
|
KEYWORD_ARG: /(#{ID_REGEX}):/,
|
29
29
|
ID: ID_REGEX,
|
30
30
|
GROUP: /@(#{ID_REGEX})/,
|
31
|
+
VARIABLE: /!(#{ID_REGEX})/,
|
32
|
+
FLOAT: /[+-]?\d+\.\d+/,
|
31
33
|
NUMBER: /[+-]?\d+/,
|
34
|
+
MULTILINE_STRING: /"((?:\\.|[^"\\])*)"\s*\\\s*/,
|
32
35
|
STRING: /"((?:\\.|[^"\\])*)"/,
|
33
36
|
SYMBOL: /:(#{ID_REGEX})/,
|
34
37
|
COMMENT: /#/,
|
@@ -36,7 +39,8 @@ module MVinl
|
|
36
39
|
END_TAG: /\./
|
37
40
|
}.freeze
|
38
41
|
|
39
|
-
def initialize(input)
|
42
|
+
def initialize(context, input = '')
|
43
|
+
@context = context
|
40
44
|
@ss = StringScanner.new(input)
|
41
45
|
@args_n = 0
|
42
46
|
@in_group = false
|
@@ -50,6 +54,11 @@ module MVinl
|
|
50
54
|
def next_token
|
51
55
|
return process_eos if @ss.eos?
|
52
56
|
|
57
|
+
# Check if variable name been used
|
58
|
+
@context.variables.each_key do |var_name|
|
59
|
+
return [:VARIABLE_CALL, @context.variables[var_name]] if @ss.scan(/\A#{Regexp.escape var_name.to_s}\b/)
|
60
|
+
end
|
61
|
+
|
53
62
|
TOKENS.each do |type, regex|
|
54
63
|
if @ss.scan regex
|
55
64
|
@last_type = type
|
@@ -70,13 +79,13 @@ module MVinl
|
|
70
79
|
next_token
|
71
80
|
when :OPEN_PAREN then [:OPEN_PAREN, '(']
|
72
81
|
when :CLOSE_PAREN
|
73
|
-
unless
|
74
|
-
raise UnexpectedTokenError, 'CLOSE_PARAM found
|
82
|
+
unless @context.state[:depth].positive?
|
83
|
+
raise UnexpectedTokenError, 'CLOSE_PARAM found with no matching OPEN_PARAM'
|
75
84
|
end
|
76
85
|
|
77
86
|
[:CLOSE_PAREN, ')']
|
78
87
|
when :OPER
|
79
|
-
unless
|
88
|
+
unless @context.state[:depth].positive?
|
80
89
|
raise UnexpectedTokenError, 'OPER found with no matching OPEN_PARAM'
|
81
90
|
end
|
82
91
|
|
@@ -86,28 +95,29 @@ module MVinl
|
|
86
95
|
|
87
96
|
[:KEYWORD, @ss.matched]
|
88
97
|
when :KEYWORD_ARG
|
89
|
-
if
|
98
|
+
if !@context.state[:in_prop]
|
90
99
|
raise UnexpectedTokenError, 'Looking for identifier but found KEYWORD_ARG'
|
91
|
-
elsif
|
100
|
+
elsif @context.state[:in_keyword_arg]
|
92
101
|
raise UnexpectedTokenError, 'Looking for a keyword argument value but found KEYWORD_ARG'
|
93
102
|
end
|
94
103
|
|
95
104
|
[:KEYWORD_ARG, @ss[1]]
|
96
105
|
when :GROUP
|
97
106
|
# Group gets canceled whenever encountered another group id or a matching end tag
|
98
|
-
if
|
107
|
+
if @context.state[:in_keyword_arg]
|
99
108
|
raise UnexpectedTokenError, 'Looking for a keyword argument value but found GROUP'
|
100
109
|
end
|
101
110
|
|
102
111
|
@in_group = true
|
103
112
|
[:GROUP, @ss[1]]
|
113
|
+
when :VARIABLE then [:VARIABLE, @ss[1]]
|
104
114
|
when :ID then [:ID, @ss.matched]
|
105
|
-
when :NUMBER, :STRING, :SYMBOL
|
115
|
+
when :NUMBER, :FLOAT, :STRING, :SYMBOL, :MULTILINE_STRING
|
106
116
|
# Values can't be used outside an property or a lambda
|
107
|
-
if
|
117
|
+
if !@context.state[:in_prop] && !@context.state[:depth].positive? && !@context.state[:in_var]
|
108
118
|
raise UnexpectedTokenError, "Looking for ID or OPEN_PAREN but found #{@last_type}"
|
109
|
-
elsif
|
110
|
-
|
119
|
+
elsif !@context.state[:in_keyword_arg] && @context.state[:keyword_arg_depth].positive? &&
|
120
|
+
!@context.state[:depth].positive? && !@context.state[:in_var]
|
111
121
|
raise UnexpectedTokenError, "Looking for END_TAG or KEYWORD_ARG but found #{@last_type}"
|
112
122
|
end
|
113
123
|
|
@@ -136,8 +146,8 @@ module MVinl
|
|
136
146
|
|
137
147
|
# Auto end properties
|
138
148
|
lookahead = @ss.check(/\A(?:#{TOKENS[:GROUP]}|#{TOKENS[:ID]}$|#{TOKENS[:END_TAG]}|#{TOKENS[:NEW_LINE]})/)
|
139
|
-
warn "Continue? in_prop?: #{
|
140
|
-
|
149
|
+
warn "Continue? in_prop?: #{@context.state[:in_prop].inspect}, lookahead: #{lookahead.inspect}"
|
150
|
+
@context.state[:in_prop] ? !lookahead : true
|
141
151
|
end
|
142
152
|
|
143
153
|
# Move the cursor to the next new line tag
|
data/lib/mvinl/parser.rb
CHANGED
@@ -1,22 +1,32 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
=begin
|
3
|
+
=begin parser.rb
|
4
4
|
Copyright (c) 2024, Daniel Sierpiński All rights reserved.
|
5
5
|
|
6
6
|
See Copyright Notice in mvnil.rb
|
7
7
|
=end
|
8
8
|
|
9
|
-
|
9
|
+
require 'mvinl.tab'
|
10
10
|
|
11
|
+
# Generated parser class
|
11
12
|
class MVinl::Parser < MVinl::Program
|
12
|
-
def initialize(lexer, debug: false)
|
13
|
-
@yydebug = debug
|
13
|
+
def initialize(lexer, context, debug: false)
|
14
14
|
@lexer = lexer
|
15
|
+
@context = context
|
16
|
+
@yydebug = debug
|
15
17
|
@tokens = []
|
16
18
|
@done = false
|
17
19
|
super()
|
18
20
|
end
|
19
21
|
|
22
|
+
def parse
|
23
|
+
do_parse
|
24
|
+
end
|
25
|
+
|
26
|
+
def feed(input)
|
27
|
+
@lexer.feed input
|
28
|
+
end
|
29
|
+
|
20
30
|
def next_token
|
21
31
|
if @tokens.empty?
|
22
32
|
@lexer.next_token
|
@@ -36,8 +46,4 @@ class MVinl::Parser < MVinl::Program
|
|
36
46
|
def parsing_done?
|
37
47
|
@done && @tokens.empty?
|
38
48
|
end
|
39
|
-
|
40
|
-
def parse
|
41
|
-
do_parse
|
42
|
-
end
|
43
49
|
end
|
data/lib/mvinl.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
=begin
|
3
|
+
=begin mvinl.rb
|
4
4
|
Copyright (c) 2018, 2024, Daniel Sierpiński All rights reserved.
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -24,14 +24,27 @@ THE SOFTWARE.
|
|
24
24
|
|
25
25
|
require 'mvinl/parser'
|
26
26
|
require 'mvinl/lexer'
|
27
|
+
require 'mvinl/context'
|
27
28
|
|
29
|
+
# Library entry point
|
28
30
|
module MVinl
|
31
|
+
@context = Context.new
|
32
|
+
@parser = Parser.new(Lexer.new(@context, ''), @context)
|
33
|
+
|
29
34
|
def self.eval(input)
|
30
|
-
parser
|
31
|
-
parser.parse
|
35
|
+
@parser.feed input
|
36
|
+
@parser.parse
|
32
37
|
end
|
33
38
|
|
34
39
|
def self.eval_from_file(path)
|
35
40
|
self.eval File.read(path)
|
36
41
|
end
|
42
|
+
|
43
|
+
def self.context
|
44
|
+
@context
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.reset
|
48
|
+
@context.reset
|
49
|
+
end
|
37
50
|
end
|
data/mvinl.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
# Compile syntax file
|
27
27
|
s.files.delete(GRAMMAR_FILE)
|
28
28
|
s.files << COMPILED_FILE
|
29
|
-
s.require_paths = %w[lib
|
29
|
+
s.require_paths = %w[lib syntax]
|
30
30
|
s.executables << 'imvnl'
|
31
31
|
|
32
32
|
s.add_dependency 'pp', '~> 0.6.2'
|
data/rakelib/build.rake
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
|
4
|
-
COMPILED_FILE = 'syntax/mvinl.tab.rb'
|
3
|
+
require 'bundler/gem_tasks'
|
5
4
|
|
6
|
-
task '
|
5
|
+
desc 'Push MVinl gem; use this task in stead of \'release\''
|
6
|
+
task push: %I[compile build release]
|
7
|
+
|
8
|
+
desc 'Compile the grammar file'
|
9
|
+
task :compile do
|
7
10
|
system('racc', GRAMMAR_FILE, '-o', COMPILED_FILE)
|
8
11
|
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
3
|
+
require_relative 'spec_helper'
|
4
|
+
require 'mvinl'
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
describe MVinl, '#eval' do
|
8
|
+
context 'no input' do
|
9
|
+
it 'returns an empty hash' do
|
10
|
+
result = MVinl.eval('')
|
11
|
+
expect(result).to eq({})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'groups' do
|
16
|
+
it 'retruns a single group' do
|
17
|
+
result = MVinl.eval('@x')
|
18
|
+
expect(result).to eq({ x: {} })
|
19
|
+
end
|
20
|
+
it 'returns two groups' do
|
21
|
+
result = MVinl.eval('@x @y')
|
22
|
+
expect(result).to eq({ x: {}, y: {} })
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'properties' do
|
27
|
+
it 'return a single property' do
|
28
|
+
result = MVinl.eval('@x a')
|
29
|
+
expect(result).to eq({ x: { a: [[], {}] } })
|
30
|
+
end
|
31
|
+
it 'returns two properties' do
|
32
|
+
result = MVinl.eval('@x a b')
|
33
|
+
expect(result).to eq({ x: { a: [[], {}], b: [[], {}] } })
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'variables' do
|
38
|
+
it 'stores a single variable' do
|
39
|
+
MVinl.eval('!n 0')
|
40
|
+
expect(MVinl.context.variables[:n]).to be_truthy
|
41
|
+
end
|
42
|
+
it 'stores a two variables' do
|
43
|
+
MVinl.eval('!n 3 !m 6')
|
44
|
+
expect(MVinl.context.variables[:n] && MVinl.context.variables[:m]).to be_truthy
|
45
|
+
end
|
46
|
+
it 'stores a single variable with it\'s value' do
|
47
|
+
MVinl.eval('!n 5')
|
48
|
+
expect(MVinl.context.variables[:n]).to eq 5
|
49
|
+
end
|
50
|
+
it 'evaluates a single variable' do
|
51
|
+
result = MVinl.eval('!n 5 x n')
|
52
|
+
expect(result).to eq({ x: [[5], {}] })
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'functions' do
|
57
|
+
it 'stores function definition with \'+\' OPER and no arguments' do
|
58
|
+
MVinl.eval('def (f (+ 1))')
|
59
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:+, 1] } })
|
60
|
+
end
|
61
|
+
it 'stores function definition with \'-\' OPER and no arguments' do
|
62
|
+
MVinl.eval('def (f (- 1))')
|
63
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:-, 1] } })
|
64
|
+
end
|
65
|
+
it 'stores function definition with \'*\' OPER and no arguments' do
|
66
|
+
MVinl.eval('def (f (* 1))')
|
67
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:*, 1] } })
|
68
|
+
end
|
69
|
+
it 'stores function definition with \'/\' OPER and no arguments' do
|
70
|
+
MVinl.eval('def (f (/ 1))')
|
71
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:/, 1] } })
|
72
|
+
end
|
73
|
+
it 'stores function definition with \'%\' OPER and no arguments' do
|
74
|
+
MVinl.eval('def (f (% 1))')
|
75
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:%, 1] } })
|
76
|
+
end
|
77
|
+
it 'stores function definition with a single argument' do
|
78
|
+
MVinl.eval('def (f a (+ a a))')
|
79
|
+
expect(MVinl.context.functions).to eq({ f: { args: %I[a], body: %I[+ a a] } })
|
80
|
+
end
|
81
|
+
it 'stores function definition with two arguments' do
|
82
|
+
MVinl.eval('def (f a b (+ a b))')
|
83
|
+
expect(MVinl.context.functions).to eq({ f: { args: %I[a b], body: %I[+ a b] } })
|
84
|
+
end
|
85
|
+
it 'evaluates anonimous function' do
|
86
|
+
result = MVinl.eval('x (+ 2 2)')
|
87
|
+
expect(result).to eq({ x: [[4], {}] })
|
88
|
+
end
|
89
|
+
it 'evaluates function' do
|
90
|
+
result = MVinl.eval('def (foo (+ 5)) x (foo)')
|
91
|
+
expect(result).to eq({ x: [[5], {}] })
|
92
|
+
end
|
93
|
+
it 'evaluates function calling another function' do
|
94
|
+
result = MVinl.eval('def (foo (+ 5)) def (bar (foo)) x (bar)')
|
95
|
+
expect(result).to eq({ x: [[5], {}] })
|
96
|
+
end
|
97
|
+
it 'evaluates function inside a variable' do
|
98
|
+
MVinl.eval('def (foo (+ 7)) !n (foo)')
|
99
|
+
expect(MVinl.context.variables[:n]).to eq 7
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe MVinl, '#eval_from_file' do
|
105
|
+
context 'stack example' do
|
106
|
+
it 'evaluates a basic example' do
|
107
|
+
MVinl.reset
|
108
|
+
result = MVinl.eval_from_file('spec/stack.mvnl')
|
109
|
+
expect(result).to eq({ menu: { Menu: [[], { New_Game: :state_next, Exit: :abord }] },
|
110
|
+
game: { Mouse: [[], {}], Board: [[3, 3], {}],
|
111
|
+
Button: [[' Hello Vinl!'], {
|
112
|
+
line_height: 25, padding: 8
|
113
|
+
}] } })
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/syntax/mvinl.tab.rb
CHANGED
@@ -8,22 +8,13 @@ require 'racc/parser.rb'
|
|
8
8
|
module MVinl
|
9
9
|
class Program < Racc::Parser
|
10
10
|
|
11
|
-
module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y',
|
12
|
-
|
13
|
-
FUNCTIONS = {}
|
14
|
-
STATE = {
|
15
|
-
in_prop: false,
|
16
|
-
in_keyword_arg: false,
|
17
|
-
keyword_arg_depth: 0,
|
18
|
-
depth: 0
|
19
|
-
}
|
20
|
-
|
11
|
+
module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y', 121)
|
21
12
|
class MVinl::ParserError < StandardError; end
|
22
13
|
|
23
14
|
private
|
24
15
|
|
25
16
|
def create_property(id, positional_args = [], keyword_args = {})
|
26
|
-
|
17
|
+
@context.state[:in_prop] = false
|
27
18
|
{id => [positional_args, keyword_args]}
|
28
19
|
end
|
29
20
|
|
@@ -31,8 +22,15 @@ module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y', 105)
|
|
31
22
|
properties || Hash.new
|
32
23
|
end
|
33
24
|
|
25
|
+
|
26
|
+
def define_variable(name, value)
|
27
|
+
@context.state[:in_var] = false
|
28
|
+
@context.variables[name] = value
|
29
|
+
value
|
30
|
+
end
|
31
|
+
|
34
32
|
def define_function(name, args, body)
|
35
|
-
|
33
|
+
@context.functions[name.to_sym] = {args: args, body: body}
|
36
34
|
nil
|
37
35
|
end
|
38
36
|
|
@@ -47,8 +45,8 @@ module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y', 105)
|
|
47
45
|
end
|
48
46
|
end
|
49
47
|
|
50
|
-
if
|
51
|
-
function =
|
48
|
+
if @context.functions.key?(operator)
|
49
|
+
function = @context.functions[operator]
|
52
50
|
raise MVinl::ParserError, "Argument mismatch for #{operator}" if operands.size != function[:args].size
|
53
51
|
|
54
52
|
# Map arguments to operands
|
@@ -59,7 +57,7 @@ module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y', 105)
|
|
59
57
|
evaluate_pn(function[0], function[1..], new_context)
|
60
58
|
else
|
61
59
|
begin
|
62
|
-
operands.reduce(operator
|
60
|
+
operands.reduce(operator)
|
63
61
|
rescue NoMethodError
|
64
62
|
raise MVinl::ParserError, "Unknown operator: #{operator}"
|
65
63
|
end
|
@@ -81,126 +79,152 @@ module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y', 105)
|
|
81
79
|
##### State transition tables begin ###
|
82
80
|
|
83
81
|
racc_action_table = [
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
28, nil, nil,
|
82
|
+
-13, 12, -13, -13, -13, -13, 2, 16, 7, 9,
|
83
|
+
10, 25, 26, -13, 36, 16, 36, 16, -13, 11,
|
84
|
+
20, 21, 22, 24, 25, 26, 28, 28, 47, 50,
|
85
|
+
31, 16, 20, 21, 22, 24, 25, 26, 16, 28,
|
86
|
+
47, 50, 16, 16, 21, 22, 24, 25, 26, 45,
|
87
|
+
28, 47, nil, nil, 16, 21, 22, 24, 25, 26,
|
88
|
+
nil, 28, 47, nil, nil, 16, 21, 22, 24, 25,
|
89
|
+
26, nil, 28, 47, nil, nil, 16, -19, 20, 21,
|
90
|
+
22, 24, 25, 26, nil, 28, 20, 21, 22, 24,
|
91
|
+
25, 26, nil, 28, 20, 21, 22, 24, 25, 26,
|
92
|
+
nil, 28 ]
|
91
93
|
|
92
94
|
racc_action_check = [
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
95
|
+
14, 2, 14, 14, 14, 14, 1, 4, 1, 1,
|
96
|
+
1, 26, 26, 14, 27, 27, 53, 53, 14, 1,
|
97
|
+
40, 40, 40, 40, 40, 40, 11, 40, 40, 40,
|
98
|
+
13, 40, 41, 41, 41, 41, 41, 41, 29, 41,
|
99
|
+
41, 41, 30, 41, 42, 42, 42, 42, 42, 38,
|
100
|
+
42, 52, nil, nil, 42, 60, 60, 60, 60, 60,
|
101
|
+
nil, 60, 60, nil, nil, 60, 61, 61, 61, 61,
|
102
|
+
61, nil, 61, 61, nil, nil, 61, 32, 32, 32,
|
103
|
+
32, 32, 32, 32, nil, 32, 8, 8, 8, 8,
|
104
|
+
8, 8, nil, 8, 44, 44, 44, 44, 44, 44,
|
105
|
+
nil, 44 ]
|
100
106
|
|
101
107
|
racc_action_pointer = [
|
102
|
-
nil,
|
103
|
-
|
104
|
-
|
105
|
-
nil,
|
106
|
-
|
107
|
-
|
108
|
+
nil, 6, 1, nil, -11, nil, nil, nil, 79, nil,
|
109
|
+
nil, 12, nil, 25, 0, nil, nil, nil, nil, nil,
|
110
|
+
nil, nil, nil, nil, nil, nil, 0, -3, nil, 20,
|
111
|
+
24, nil, 71, nil, nil, nil, nil, nil, 43, nil,
|
112
|
+
13, 25, 36, nil, 87, nil, nil, nil, nil, nil,
|
113
|
+
nil, nil, 36, -1, nil, nil, nil, nil, nil, nil,
|
114
|
+
47, 58, nil, nil, nil ]
|
108
115
|
|
109
116
|
racc_action_default = [
|
110
|
-
-1, -
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
-
|
117
|
+
-1, -10, -49, -2, -3, -4, -5, -6, -49, -8,
|
118
|
+
-10, -49, 65, -11, -17, -16, -48, -7, -23, -24,
|
119
|
+
-25, -26, -27, -28, -29, -30, -49, -49, -37, -9,
|
120
|
+
-49, -12, -14, -31, -43, -43, -47, -39, -15, -18,
|
121
|
+
-49, -49, -49, -20, -49, -22, -35, -38, -44, -45,
|
122
|
+
-46, -36, -42, -49, -40, -41, -21, -32, -39, -39,
|
123
|
+
-49, -49, -33, -42, -34 ]
|
116
124
|
|
117
125
|
racc_goto_table = [
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
nil, nil, nil,
|
126
|
+
30, 42, 15, 1, 35, 17, 4, 40, 41, 3,
|
127
|
+
5, 6, 46, 51, 8, 29, 55, 32, 38, 43,
|
128
|
+
44, 33, 60, 61, 57, 34, 52, 15, 37, 39,
|
129
|
+
59, 53, 62, 64, 55, 55, nil, nil, 49, 49,
|
130
|
+
nil, 56, nil, nil, nil, nil, nil, nil, nil, 53,
|
131
|
+
53, 58 ]
|
123
132
|
|
124
133
|
racc_goto_check = [
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
nil, nil, nil,
|
134
|
+
18, 19, 12, 1, 22, 7, 3, 23, 23, 2,
|
135
|
+
4, 5, 21, 21, 6, 3, 15, 10, 11, 13,
|
136
|
+
14, 17, 19, 19, 21, 12, 20, 12, 12, 7,
|
137
|
+
22, 18, 21, 21, 15, 15, nil, nil, 12, 12,
|
138
|
+
nil, 7, nil, nil, nil, nil, nil, nil, nil, 18,
|
139
|
+
18, 12 ]
|
130
140
|
|
131
141
|
racc_goto_pointer = [
|
132
|
-
nil,
|
133
|
-
|
142
|
+
nil, 3, 8, 5, 9, 10, 13, -3, nil, nil,
|
143
|
+
3, -14, -2, -19, -18, -26, nil, -5, -11, -36,
|
144
|
+
-16, -28, -23, -27 ]
|
134
145
|
|
135
146
|
racc_goto_default = [
|
136
|
-
nil, nil, nil, nil, nil, nil, nil,
|
137
|
-
|
147
|
+
nil, nil, nil, nil, nil, nil, nil, 48, 13, 14,
|
148
|
+
nil, nil, 54, nil, nil, 18, 19, 23, 27, nil,
|
149
|
+
63, nil, nil, nil ]
|
138
150
|
|
139
151
|
racc_reduce_table = [
|
140
152
|
0, 0, :racc_error,
|
141
|
-
0,
|
142
|
-
2,
|
143
|
-
2,
|
144
|
-
2,
|
145
|
-
2,
|
146
|
-
|
147
|
-
2,
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
1,
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
2,
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
1,
|
163
|
-
1,
|
164
|
-
1,
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
1,
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
153
|
+
0, 20, :_reduce_1,
|
154
|
+
2, 20, :_reduce_2,
|
155
|
+
2, 20, :_reduce_3,
|
156
|
+
2, 20, :_reduce_4,
|
157
|
+
2, 20, :_reduce_5,
|
158
|
+
2, 20, :_reduce_6,
|
159
|
+
2, 23, :_reduce_7,
|
160
|
+
1, 25, :_reduce_8,
|
161
|
+
2, 21, :_reduce_9,
|
162
|
+
0, 22, :_reduce_10,
|
163
|
+
2, 22, :_reduce_11,
|
164
|
+
3, 22, :_reduce_12,
|
165
|
+
1, 27, :_reduce_13,
|
166
|
+
2, 27, :_reduce_14,
|
167
|
+
3, 27, :_reduce_15,
|
168
|
+
1, 28, :_reduce_16,
|
169
|
+
0, 29, :_reduce_17,
|
170
|
+
2, 29, :_reduce_18,
|
171
|
+
0, 30, :_reduce_19,
|
172
|
+
2, 30, :_reduce_20,
|
173
|
+
2, 32, :_reduce_21,
|
174
|
+
1, 33, :_reduce_22,
|
175
|
+
1, 26, :_reduce_23,
|
176
|
+
1, 26, :_reduce_24,
|
177
|
+
1, 26, :_reduce_25,
|
178
|
+
1, 34, :_reduce_26,
|
179
|
+
1, 34, :_reduce_27,
|
180
|
+
1, 34, :_reduce_28,
|
181
|
+
1, 34, :_reduce_29,
|
182
|
+
1, 36, :_reduce_30,
|
183
|
+
2, 36, :_reduce_31,
|
184
|
+
6, 24, :_reduce_32,
|
185
|
+
4, 39, :_reduce_33,
|
186
|
+
4, 39, :_reduce_34,
|
187
|
+
4, 35, :_reduce_35,
|
188
|
+
4, 35, :_reduce_36,
|
189
|
+
1, 37, :_reduce_37,
|
190
|
+
1, 40, :_reduce_38,
|
191
|
+
0, 38, :_reduce_39,
|
192
|
+
2, 38, :_reduce_40,
|
193
|
+
2, 38, :_reduce_41,
|
194
|
+
2, 38, :_reduce_42,
|
195
|
+
0, 42, :_reduce_43,
|
196
|
+
2, 42, :_reduce_44,
|
197
|
+
2, 42, :_reduce_45,
|
198
|
+
2, 42, :_reduce_46,
|
199
|
+
1, 41, :_reduce_47,
|
200
|
+
1, 31, :_reduce_48 ]
|
201
|
+
|
202
|
+
racc_reduce_n = 49
|
203
|
+
|
204
|
+
racc_shift_n = 65
|
185
205
|
|
186
206
|
racc_token_table = {
|
187
207
|
false => 0,
|
188
208
|
:error => 1,
|
189
209
|
:EOS => 2,
|
190
|
-
:
|
191
|
-
:
|
192
|
-
:
|
193
|
-
:
|
194
|
-
:
|
195
|
-
:
|
196
|
-
:
|
197
|
-
:
|
198
|
-
:
|
199
|
-
:
|
200
|
-
:
|
201
|
-
:
|
202
|
-
|
203
|
-
|
210
|
+
:VARIABLE => 3,
|
211
|
+
:GROUP => 4,
|
212
|
+
:END_TAG => 5,
|
213
|
+
:KEYWORD_ARG => 6,
|
214
|
+
:VARIABLE_CALL => 7,
|
215
|
+
:NUMBER => 8,
|
216
|
+
:FLOAT => 9,
|
217
|
+
:SYMBOL => 10,
|
218
|
+
:STRING => 11,
|
219
|
+
:MULTILINE_STRING => 12,
|
220
|
+
:DEF => 13,
|
221
|
+
:OPEN_PAREN => 14,
|
222
|
+
:CLOSE_PAREN => 15,
|
223
|
+
:polish_notation => 16,
|
224
|
+
:OPER => 17,
|
225
|
+
:ID => 18 }
|
226
|
+
|
227
|
+
racc_nt_base = 19
|
204
228
|
|
205
229
|
racc_use_result_var = false
|
206
230
|
|
@@ -225,37 +249,45 @@ Racc_token_to_s_table = [
|
|
225
249
|
"$end",
|
226
250
|
"error",
|
227
251
|
"EOS",
|
252
|
+
"VARIABLE",
|
228
253
|
"GROUP",
|
229
254
|
"END_TAG",
|
230
255
|
"KEYWORD_ARG",
|
256
|
+
"VARIABLE_CALL",
|
231
257
|
"NUMBER",
|
232
|
-
"
|
258
|
+
"FLOAT",
|
233
259
|
"SYMBOL",
|
260
|
+
"STRING",
|
261
|
+
"MULTILINE_STRING",
|
234
262
|
"DEF",
|
235
|
-
"OPER",
|
236
263
|
"OPEN_PAREN",
|
237
264
|
"CLOSE_PAREN",
|
238
265
|
"polish_notation",
|
266
|
+
"OPER",
|
239
267
|
"ID",
|
240
268
|
"$start",
|
241
269
|
"program",
|
242
270
|
"group",
|
243
|
-
"function_def",
|
244
271
|
"properties",
|
272
|
+
"variable_def",
|
273
|
+
"function_def",
|
274
|
+
"var_def_name",
|
275
|
+
"super_value",
|
245
276
|
"property",
|
246
277
|
"prop_id",
|
247
278
|
"positional_args",
|
248
279
|
"keyword_args",
|
249
|
-
"lambda",
|
250
280
|
"identifier",
|
251
|
-
"super_value",
|
252
281
|
"keyword_arg",
|
253
282
|
"keyword_arg_id",
|
254
283
|
"value",
|
284
|
+
"lambda",
|
285
|
+
"string",
|
255
286
|
"open_paren",
|
256
287
|
"args",
|
257
288
|
"polish_notation_def",
|
258
289
|
"close_paren",
|
290
|
+
"operator",
|
259
291
|
"params" ]
|
260
292
|
Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
|
261
293
|
|
@@ -279,7 +311,7 @@ module_eval(<<'.,.,', 'mvinl.y', 13)
|
|
279
311
|
|
280
312
|
module_eval(<<'.,.,', 'mvinl.y', 14)
|
281
313
|
def _reduce_3(val, _values)
|
282
|
-
val[0]
|
314
|
+
val[0].merge(val[1])
|
283
315
|
end
|
284
316
|
.,.,
|
285
317
|
|
@@ -289,224 +321,272 @@ module_eval(<<'.,.,', 'mvinl.y', 15)
|
|
289
321
|
end
|
290
322
|
.,.,
|
291
323
|
|
292
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
324
|
+
module_eval(<<'.,.,', 'mvinl.y', 16)
|
293
325
|
def _reduce_5(val, _values)
|
294
|
-
|
326
|
+
val[0]
|
295
327
|
end
|
296
328
|
.,.,
|
297
329
|
|
298
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
330
|
+
module_eval(<<'.,.,', 'mvinl.y', 17)
|
299
331
|
def _reduce_6(val, _values)
|
300
|
-
|
332
|
+
val[0]
|
301
333
|
end
|
302
334
|
.,.,
|
303
335
|
|
304
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
336
|
+
module_eval(<<'.,.,', 'mvinl.y', 20)
|
305
337
|
def _reduce_7(val, _values)
|
306
|
-
val[0]
|
338
|
+
define_variable(val[0], val[1])
|
307
339
|
end
|
308
340
|
.,.,
|
309
341
|
|
310
342
|
module_eval(<<'.,.,', 'mvinl.y', 23)
|
311
343
|
def _reduce_8(val, _values)
|
312
|
-
val[0].
|
344
|
+
@context.state[:in_var] = true; val[0].to_sym
|
313
345
|
end
|
314
346
|
.,.,
|
315
347
|
|
316
348
|
module_eval(<<'.,.,', 'mvinl.y', 26)
|
317
349
|
def _reduce_9(val, _values)
|
318
|
-
|
350
|
+
{val[0].to_sym => create_group(val[1])}
|
319
351
|
end
|
320
352
|
.,.,
|
321
353
|
|
322
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
354
|
+
module_eval(<<'.,.,', 'mvinl.y', 29)
|
323
355
|
def _reduce_10(val, _values)
|
324
|
-
|
356
|
+
Hash.new
|
325
357
|
end
|
326
358
|
.,.,
|
327
359
|
|
328
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
360
|
+
module_eval(<<'.,.,', 'mvinl.y', 30)
|
329
361
|
def _reduce_11(val, _values)
|
330
|
-
|
362
|
+
val[0].merge(val[1])
|
331
363
|
end
|
332
364
|
.,.,
|
333
365
|
|
334
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
366
|
+
module_eval(<<'.,.,', 'mvinl.y', 31)
|
335
367
|
def _reduce_12(val, _values)
|
336
|
-
|
368
|
+
val[0].merge(val[1])
|
337
369
|
end
|
338
370
|
.,.,
|
339
371
|
|
340
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
372
|
+
module_eval(<<'.,.,', 'mvinl.y', 34)
|
341
373
|
def _reduce_13(val, _values)
|
342
|
-
|
374
|
+
create_property(val[0])
|
343
375
|
end
|
344
376
|
.,.,
|
345
377
|
|
346
378
|
module_eval(<<'.,.,', 'mvinl.y', 35)
|
347
379
|
def _reduce_14(val, _values)
|
348
|
-
|
380
|
+
create_property(val[0], val[1])
|
349
381
|
end
|
350
382
|
.,.,
|
351
383
|
|
352
384
|
module_eval(<<'.,.,', 'mvinl.y', 36)
|
353
385
|
def _reduce_15(val, _values)
|
354
|
-
val[0]
|
386
|
+
create_property(val[0], val[1], val[2])
|
355
387
|
end
|
356
388
|
.,.,
|
357
389
|
|
358
390
|
module_eval(<<'.,.,', 'mvinl.y', 39)
|
359
391
|
def _reduce_16(val, _values)
|
360
|
-
|
392
|
+
@context.state[:in_prop] = true; val[0]
|
361
393
|
end
|
362
394
|
.,.,
|
363
395
|
|
364
396
|
module_eval(<<'.,.,', 'mvinl.y', 42)
|
365
397
|
def _reduce_17(val, _values)
|
366
|
-
|
367
|
-
val[0].merge(val[1])
|
368
|
-
|
398
|
+
Array.new
|
369
399
|
end
|
370
400
|
.,.,
|
371
401
|
|
372
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
402
|
+
module_eval(<<'.,.,', 'mvinl.y', 43)
|
373
403
|
def _reduce_18(val, _values)
|
374
|
-
|
375
|
-
STATE[:keyword_arg_depth] += 1
|
376
|
-
{val[0].to_sym => val[1]}
|
377
|
-
|
404
|
+
val[0] << val[1]
|
378
405
|
end
|
379
406
|
.,.,
|
380
407
|
|
381
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
408
|
+
module_eval(<<'.,.,', 'mvinl.y', 46)
|
382
409
|
def _reduce_19(val, _values)
|
383
|
-
|
410
|
+
Hash.new
|
384
411
|
end
|
385
412
|
.,.,
|
386
413
|
|
387
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
414
|
+
module_eval(<<'.,.,', 'mvinl.y', 49)
|
388
415
|
def _reduce_20(val, _values)
|
389
|
-
|
416
|
+
@context.state[:keyword_arg_depth] = 0
|
417
|
+
val[0].merge(val[1])
|
418
|
+
|
390
419
|
end
|
391
420
|
.,.,
|
392
421
|
|
393
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
422
|
+
module_eval(<<'.,.,', 'mvinl.y', 56)
|
394
423
|
def _reduce_21(val, _values)
|
395
|
-
|
424
|
+
@context.state[:in_keyword_arg] = false
|
425
|
+
@context.state[:keyword_arg_depth] += 1
|
426
|
+
{val[0].to_sym => val[1]}
|
427
|
+
|
396
428
|
end
|
397
429
|
.,.,
|
398
430
|
|
399
431
|
module_eval(<<'.,.,', 'mvinl.y', 62)
|
400
432
|
def _reduce_22(val, _values)
|
401
|
-
val[0]
|
433
|
+
@context.state[:in_keyword_arg] = true; val[0]
|
402
434
|
end
|
403
435
|
.,.,
|
404
436
|
|
405
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
437
|
+
module_eval(<<'.,.,', 'mvinl.y', 65)
|
406
438
|
def _reduce_23(val, _values)
|
407
439
|
val[0]
|
408
440
|
end
|
409
441
|
.,.,
|
410
442
|
|
411
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
443
|
+
module_eval(<<'.,.,', 'mvinl.y', 66)
|
412
444
|
def _reduce_24(val, _values)
|
413
|
-
val[0]
|
445
|
+
val[0]
|
414
446
|
end
|
415
447
|
.,.,
|
416
448
|
|
417
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
449
|
+
module_eval(<<'.,.,', 'mvinl.y', 67)
|
418
450
|
def _reduce_25(val, _values)
|
419
|
-
|
420
|
-
|
451
|
+
val[0]
|
421
452
|
end
|
422
453
|
.,.,
|
423
454
|
|
424
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
455
|
+
module_eval(<<'.,.,', 'mvinl.y', 70)
|
425
456
|
def _reduce_26(val, _values)
|
426
|
-
|
457
|
+
val[0].to_i
|
427
458
|
end
|
428
459
|
.,.,
|
429
460
|
|
430
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
461
|
+
module_eval(<<'.,.,', 'mvinl.y', 71)
|
431
462
|
def _reduce_27(val, _values)
|
432
|
-
|
463
|
+
val[0].to_f
|
433
464
|
end
|
434
465
|
.,.,
|
435
466
|
|
436
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
467
|
+
module_eval(<<'.,.,', 'mvinl.y', 72)
|
437
468
|
def _reduce_28(val, _values)
|
438
|
-
|
469
|
+
val[0]
|
439
470
|
end
|
440
471
|
.,.,
|
441
472
|
|
442
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
473
|
+
module_eval(<<'.,.,', 'mvinl.y', 73)
|
443
474
|
def _reduce_29(val, _values)
|
444
|
-
|
475
|
+
val[0].to_sym
|
445
476
|
end
|
446
477
|
.,.,
|
447
478
|
|
448
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
479
|
+
module_eval(<<'.,.,', 'mvinl.y', 76)
|
449
480
|
def _reduce_30(val, _values)
|
450
|
-
|
481
|
+
val[0]
|
451
482
|
end
|
452
483
|
.,.,
|
453
484
|
|
454
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
485
|
+
module_eval(<<'.,.,', 'mvinl.y', 77)
|
455
486
|
def _reduce_31(val, _values)
|
456
|
-
|
487
|
+
"#{val[0]} #{val[1]}"
|
457
488
|
end
|
458
489
|
.,.,
|
459
490
|
|
460
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
491
|
+
module_eval(<<'.,.,', 'mvinl.y', 82)
|
461
492
|
def _reduce_32(val, _values)
|
462
|
-
|
493
|
+
define_function(val[2], val[3], val[4])
|
494
|
+
|
463
495
|
end
|
464
496
|
.,.,
|
465
497
|
|
466
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
498
|
+
module_eval(<<'.,.,', 'mvinl.y', 86)
|
467
499
|
def _reduce_33(val, _values)
|
468
|
-
val[
|
500
|
+
[val[1], *val[2]]
|
469
501
|
end
|
470
502
|
.,.,
|
471
503
|
|
472
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
504
|
+
module_eval(<<'.,.,', 'mvinl.y', 87)
|
473
505
|
def _reduce_34(val, _values)
|
474
|
-
val[
|
506
|
+
[val[1], *val[2]]
|
475
507
|
end
|
476
508
|
.,.,
|
477
509
|
|
478
510
|
module_eval(<<'.,.,', 'mvinl.y', 90)
|
479
511
|
def _reduce_35(val, _values)
|
480
|
-
val[
|
512
|
+
evaluate_pn(val[1], val[2])
|
481
513
|
end
|
482
514
|
.,.,
|
483
515
|
|
484
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
516
|
+
module_eval(<<'.,.,', 'mvinl.y', 91)
|
485
517
|
def _reduce_36(val, _values)
|
486
|
-
|
518
|
+
evaluate_pn(val[1], val[2])
|
487
519
|
end
|
488
520
|
.,.,
|
489
521
|
|
490
522
|
module_eval(<<'.,.,', 'mvinl.y', 94)
|
491
523
|
def _reduce_37(val, _values)
|
492
|
-
|
524
|
+
@context.state[:depth] += 1
|
493
525
|
end
|
494
526
|
.,.,
|
495
527
|
|
496
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
528
|
+
module_eval(<<'.,.,', 'mvinl.y', 97)
|
497
529
|
def _reduce_38(val, _values)
|
498
|
-
|
530
|
+
@context.state[:depth] -= 1
|
499
531
|
end
|
500
532
|
.,.,
|
501
533
|
|
502
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
534
|
+
module_eval(<<'.,.,', 'mvinl.y', 100)
|
503
535
|
def _reduce_39(val, _values)
|
504
|
-
|
536
|
+
Array.new
|
505
537
|
end
|
506
538
|
.,.,
|
507
539
|
|
508
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
540
|
+
module_eval(<<'.,.,', 'mvinl.y', 101)
|
509
541
|
def _reduce_40(val, _values)
|
542
|
+
val[0] << val[1]
|
543
|
+
end
|
544
|
+
.,.,
|
545
|
+
|
546
|
+
module_eval(<<'.,.,', 'mvinl.y', 102)
|
547
|
+
def _reduce_41(val, _values)
|
548
|
+
val[0] << val[1]
|
549
|
+
end
|
550
|
+
.,.,
|
551
|
+
|
552
|
+
module_eval(<<'.,.,', 'mvinl.y', 103)
|
553
|
+
def _reduce_42(val, _values)
|
554
|
+
val[0] << val[1]
|
555
|
+
end
|
556
|
+
.,.,
|
557
|
+
|
558
|
+
module_eval(<<'.,.,', 'mvinl.y', 106)
|
559
|
+
def _reduce_43(val, _values)
|
560
|
+
Array.new
|
561
|
+
end
|
562
|
+
.,.,
|
563
|
+
|
564
|
+
module_eval(<<'.,.,', 'mvinl.y', 107)
|
565
|
+
def _reduce_44(val, _values)
|
566
|
+
val[0] << val[1]
|
567
|
+
end
|
568
|
+
.,.,
|
569
|
+
|
570
|
+
module_eval(<<'.,.,', 'mvinl.y', 108)
|
571
|
+
def _reduce_45(val, _values)
|
572
|
+
val[0] << val[1]
|
573
|
+
end
|
574
|
+
.,.,
|
575
|
+
|
576
|
+
module_eval(<<'.,.,', 'mvinl.y', 109)
|
577
|
+
def _reduce_46(val, _values)
|
578
|
+
val[0] << val[1]
|
579
|
+
end
|
580
|
+
.,.,
|
581
|
+
|
582
|
+
module_eval(<<'.,.,', 'mvinl.y', 112)
|
583
|
+
def _reduce_47(val, _values)
|
584
|
+
val[0].to_sym
|
585
|
+
end
|
586
|
+
.,.,
|
587
|
+
|
588
|
+
module_eval(<<'.,.,', 'mvinl.y', 115)
|
589
|
+
def _reduce_48(val, _values)
|
510
590
|
val[0].to_sym
|
511
591
|
end
|
512
592
|
.,.,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mvinl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- siery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pp
|
@@ -41,11 +41,14 @@ files:
|
|
41
41
|
- bin/imvnl
|
42
42
|
- edit/mvinl.vim
|
43
43
|
- lib/mvinl.rb
|
44
|
+
- lib/mvinl/context.rb
|
44
45
|
- lib/mvinl/info.rb
|
45
46
|
- lib/mvinl/lexer.rb
|
46
47
|
- lib/mvinl/parser.rb
|
47
48
|
- mvinl.gemspec
|
48
49
|
- rakelib/build.rake
|
50
|
+
- spec/program_spec.rb
|
51
|
+
- spec/spec_helper.rb
|
49
52
|
- spec/stack.mvnl
|
50
53
|
- syntax/mvinl.tab.rb
|
51
54
|
homepage: https://rubygems.org/gems/mvinl
|
@@ -57,9 +60,6 @@ post_install_message:
|
|
57
60
|
rdoc_options: []
|
58
61
|
require_paths:
|
59
62
|
- lib
|
60
|
-
- bin
|
61
|
-
- s
|
62
|
-
- rakelib
|
63
63
|
- syntax
|
64
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|