alphalang 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/alphalang +32 -11
- data/lib/alpha.rb +3 -3
- data/lib/lang_creator.rb +39 -48
- data/lib/locale_defaulter.rb +16 -0
- data/lib/locale_deleter.rb +6 -9
- data/lib/locale_lister.rb +21 -15
- data/lib/locales/de +1 -0
- data/lib/locales/default +18 -0
- data/lib/locales/en +1 -0
- data/lib/locales/locale_template +1 -0
- data/lib/locales/sv +1 -0
- data/lib/nodes/scopemanager.rb +53 -0
- data/lib/nodes/stmtnodes.rb +0 -48
- data/lib/rdparse.rb +2 -3
- data/lib/rdparse_quiet.rb +2 -3
- metadata +4 -3
- data/lib/locale_deleter.rb~ +0 -0
- data/lib/locale_lister.rb~ +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9d0971b25f1f629686a4ca72899a014ab9dd0934b3021e1509faa46870e79fc
|
4
|
+
data.tar.gz: 7ff3c836669793b4b58deea30bd8e8c485ca7ce9465ab3ac6ef490b8a7508d04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a44e1156d6e59488c1891af9eaa3d9a304ddd812b54ad44656762d169d84a2c1df057a8030654aea52c791037dfc1620a551b0e72b4f8882b20ea8d9c45edc2
|
7
|
+
data.tar.gz: 1459484c62af5206acf1d9e657f25fae40cc8adfbb36838c59e1a37434034be283bdb48fbe4efb820eb0c6cb779e2a933925d4cbcc35796769df56e0bcce5f20
|
data/bin/alphalang
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'optparse'
|
3
3
|
require File.expand_path('../lib/alpha', __dir__)
|
4
|
-
ALPHA_VER = '0.1.
|
4
|
+
ALPHA_VER = '0.1.5'.freeze
|
5
5
|
ABORT_ANSWERS = [' ', '', 'none', 'abort'].freeze # something here? Some cases empty means yes tho..
|
6
|
+
LOCALES_PATH = File.join(__dir__, '../lib/locales')
|
7
|
+
PROTECTED_LOCALES = ['.', '..', 'locale_template', 'default', 'default.old', 'en', 'sv', 'de'].freeze
|
6
8
|
|
7
9
|
basic_error_msg = "Usage: alphalang [options] file.alpha\nUsage: alphalang -h for the help menu."
|
8
10
|
|
@@ -18,8 +20,12 @@ OptionParser.new do |opts|
|
|
18
20
|
options[:verify] = true
|
19
21
|
end
|
20
22
|
|
21
|
-
opts.on('--
|
22
|
-
options[:
|
23
|
+
opts.on('--locale=LOCALE', 'Set the syntax locale for current program keywords.') do |locale|
|
24
|
+
options[:locale] = locale
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on('--setlocale=LOCALE', 'Set the default syntax locale for all program keywords.') do |new_locale|
|
28
|
+
options[:defaultlocale] = new_locale
|
23
29
|
end
|
24
30
|
|
25
31
|
opts.on('--createlocale', 'Creates a new locale file for all program keywords available.') do
|
@@ -39,9 +45,10 @@ OptionParser.new do |opts|
|
|
39
45
|
end
|
40
46
|
end.parse!
|
41
47
|
|
42
|
-
|
43
|
-
|
44
|
-
|
48
|
+
verbose_flag = options[:verbose]
|
49
|
+
verify_flag = options[:verify]
|
50
|
+
language_flag = options[:locale]
|
51
|
+
set_locale_flag = options[:defaultlocale]
|
45
52
|
create_locale_flag = options[:createlocale]
|
46
53
|
delete_locale_flag = options[:deletelocale]
|
47
54
|
list_locales_flag = options[:listlocales]
|
@@ -53,6 +60,20 @@ if create_locale_flag
|
|
53
60
|
return
|
54
61
|
end
|
55
62
|
|
63
|
+
if language_flag.is_a?(NilClass)
|
64
|
+
language_flag = 'default'
|
65
|
+
end
|
66
|
+
|
67
|
+
if !set_locale_flag.is_a?(NilClass)
|
68
|
+
unless ARGV.empty?
|
69
|
+
puts 'Flag for verification found. Ignoring input file.'
|
70
|
+
sleep 0.5
|
71
|
+
end
|
72
|
+
require_relative '../lib/locale_defaulter'
|
73
|
+
set_default_locale(set_locale_flag)
|
74
|
+
return
|
75
|
+
end
|
76
|
+
|
56
77
|
if delete_locale_flag
|
57
78
|
require_relative '../lib/locale_deleter'
|
58
79
|
delete_locale_file
|
@@ -72,23 +93,23 @@ if list_locale_flag
|
|
72
93
|
end
|
73
94
|
|
74
95
|
raise OptionParser::MissingArgument, "No file provided.
|
75
|
-
Usage: alphalang my_file.alpha | alphalang -h" if ARGV.empty? unless
|
96
|
+
Usage: alphalang my_file.alpha | alphalang -h" if ARGV.empty? unless verify_flag
|
76
97
|
raise OptionParser::InvalidArgument, 'Too many files provided.
|
77
98
|
Did you mean to use an --[option]? | alphalang -h' if ARGV.length > 1
|
78
|
-
raise OptionParser::InvalidArgument, 'File must end with .alpha' unless
|
99
|
+
raise OptionParser::InvalidArgument, 'File must end with .alpha' unless verify_flag or ARGV[0].end_with?('.alpha')
|
79
100
|
|
80
|
-
if
|
101
|
+
if verbose_flag
|
81
102
|
require_relative '../lib/rdparse'
|
82
103
|
else
|
83
104
|
require_relative '../lib/rdparse_quiet'
|
84
105
|
end
|
85
106
|
|
86
|
-
if
|
107
|
+
if verify_flag
|
87
108
|
unless ARGV.empty?
|
88
109
|
puts 'Flag for verification found. Ignoring input file.'
|
89
110
|
sleep 1
|
90
111
|
end
|
91
112
|
require_relative '../lib/tester/test_unit'
|
92
113
|
else
|
93
|
-
LangParser.new(
|
114
|
+
LangParser.new(language_flag).parse_file(ARGV[0])
|
94
115
|
end
|
data/lib/alpha.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require_relative './nodes/
|
1
|
+
require_relative './nodes/scopemanager'
|
2
2
|
|
3
3
|
class LangParser
|
4
|
-
def initialize(locale = '
|
5
|
-
ScopeManager.new
|
4
|
+
def initialize(locale = 'default')
|
6
5
|
@langParser = Parser.new('lang parser', locale) do
|
6
|
+
token(/;;.*$/)
|
7
7
|
token(/while/) { |_| :WHILE }
|
8
8
|
token(/print/) { |_| :PRINT }
|
9
9
|
token(/pause/) { |_| :PAUSE }
|
data/lib/lang_creator.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
require_relative 'locale_lister'
|
2
3
|
|
3
4
|
# Function to read user input for translation
|
4
5
|
def read_translation(line)
|
@@ -29,77 +30,67 @@ def read_translation_not_and_or(line)
|
|
29
30
|
return "(#{input.empty? ? word : input}#{postfix}"
|
30
31
|
end
|
31
32
|
|
32
|
-
def prompt_user(
|
33
|
+
def prompt_user(file)
|
34
|
+
locale_template = File.readlines("#{LOCALES_PATH}/locale_template")
|
35
|
+
|
33
36
|
counter = 0
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
File.open(file, 'a') do |f|
|
38
|
+
f.puts ';;.*$ ;;.*$'
|
39
|
+
locale_template.each do |line|
|
40
|
+
counter += 1
|
41
|
+
break if counter == 15
|
37
42
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
if counter > 1 && counter < 10
|
44
|
+
translation = read_translation(line.chomp)
|
45
|
+
f.puts "#{line.chomp} #{translation}"
|
46
|
+
end
|
47
|
+
if counter == 10
|
48
|
+
translation = read_translation_true_false(line.chomp)
|
49
|
+
f.puts "#{line.chomp} #{translation}"
|
50
|
+
end
|
51
|
+
if counter == 11
|
52
|
+
f.puts "#{line.chomp} (==|<=|>=)"
|
53
|
+
end
|
54
|
+
if counter > 11
|
55
|
+
translation = read_translation_not_and_or(line.chomp)
|
56
|
+
f.puts "#{line.chomp} #{translation}"
|
57
|
+
end
|
48
58
|
end
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def save_file(file)
|
57
|
-
ruby_version = "#{RUBY_VERSION}"
|
58
|
-
ruby_version[-1] = '0'
|
59
|
-
install_path = "/home/#{ENV['USER']}/.local/share/gem/ruby/#{ruby_version}/gems/alphalang-#{ALPHA_VER}"
|
60
|
-
|
61
|
-
if File.exist?(install_path)
|
62
|
-
File.rename(file, "#{install_path}/lib/locales/#{file}")
|
63
|
-
puts "Locale/syntax saved to #{install_path}/lib/locales/#{file}"
|
64
|
-
else
|
65
|
-
raise ArgumentError, "Didn't find your #{install_path}.\nTried #{ruby_version} as <VERSION>"
|
59
|
+
f.puts '\s+ \s+'
|
60
|
+
f.puts '\d+ \d+'
|
61
|
+
f.puts '\w+ \w+'
|
62
|
+
f.puts '. .'
|
66
63
|
end
|
67
64
|
end
|
68
65
|
|
69
66
|
def create_locale_file()
|
70
67
|
puts 'Choose a filename for your locale/syntax:'
|
71
|
-
|
72
|
-
|
68
|
+
new_locale_name = gets.chomp
|
69
|
+
new_locale_file_path = "#{LOCALES_PATH}/#{new_locale_name}"
|
73
70
|
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
if File.exist?(new_locale_file_path)
|
72
|
+
puts "#{new_locale_name} already exists."
|
73
|
+
return
|
74
|
+
end
|
77
75
|
|
78
76
|
# prompt user for translations
|
79
|
-
prompt_user(
|
80
|
-
|
81
|
-
# Append additional translations
|
82
|
-
File.open(filename, 'a') do |f|
|
83
|
-
f.puts '\s+ \s+'
|
84
|
-
f.puts '\d+ \d+'
|
85
|
-
f.puts '\w+ \w+'
|
86
|
-
f.puts '. .'
|
87
|
-
end
|
77
|
+
prompt_user(new_locale_file_path)
|
88
78
|
|
89
79
|
# Clear the screen
|
90
80
|
system('clear')
|
91
81
|
|
92
82
|
# Display the contents of the translation file
|
93
|
-
|
83
|
+
locale_as_array = clean_locale_file_to_array(new_locale_name)
|
84
|
+
print_clean_locale_array(new_locale_name, locale_as_array)
|
94
85
|
|
95
86
|
# Ask user if the translation is correct
|
96
87
|
puts 'Is this correct? [Y/n]'
|
97
88
|
answer = gets.chomp
|
98
89
|
|
99
90
|
if answer.downcase == /y|Y/ or answer.empty?
|
100
|
-
|
91
|
+
puts "Locale is saved as #{new_locale_name} in #{LOCALES_PATH}"
|
101
92
|
else
|
102
93
|
puts 'Translation removed'
|
103
|
-
File.delete(
|
94
|
+
File.delete(new_locale_file_path)
|
104
95
|
end
|
105
96
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative 'locale_lister'
|
4
|
+
|
5
|
+
def set_default_locale(new_locale)
|
6
|
+
available_locales = get_locale_files
|
7
|
+
|
8
|
+
available_locales.each do |locale|
|
9
|
+
if locale == new_locale
|
10
|
+
File.rename("#{LOCALES_PATH}/default", "#{LOCALES_PATH}/default.old")
|
11
|
+
File.copy_stream("#{LOCALES_PATH}/#{new_locale}", "#{LOCALES_PATH}/default")
|
12
|
+
puts "[alphalang] Default syntax locale is now set to #{locale}."
|
13
|
+
return
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/locale_deleter.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
def prompt_user_for_deletion(locales
|
3
|
+
def prompt_user_for_deletion(locales)
|
4
4
|
puts 'Which locale would you like to delete?: RET or "none" to abort'
|
5
5
|
|
6
6
|
locales.each do |locale|
|
@@ -11,25 +11,22 @@ def prompt_user_for_deletion(locales, install_path, protected_paths)
|
|
11
11
|
|
12
12
|
return if ABORT_ANSWERS.include?(locale_file)
|
13
13
|
|
14
|
-
if
|
14
|
+
if PROTECTED_LOCALES.include?(locale_file)
|
15
15
|
puts 'You may not delete a default locale.'
|
16
16
|
return
|
17
17
|
else
|
18
|
-
File.delete("#{
|
19
|
-
puts "Successfully deleted #{
|
18
|
+
File.delete("#{LOCALES_PATH}/#{locale_file}")
|
19
|
+
puts "Successfully deleted #{LOCALES_PATH}/#{locale_file}"
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
def delete_locale_file()
|
24
|
-
|
25
|
-
protected_locales = ['.', '..', 'locale_template', 'en', 'sv', 'de']
|
26
|
-
|
27
|
-
imported_locales = Dir.entries(locale_path).reject { |entry| protected_locales.include?(entry) }
|
24
|
+
imported_locales = Dir.entries(LOCALES_PATH).reject { |entry| PROTECTED_LOCALES.include?(entry) }
|
28
25
|
|
29
26
|
if imported_locales.empty?
|
30
27
|
puts '[alphalang] There are no locale files to delete. Default locale files are protected.'
|
31
28
|
return
|
32
29
|
else
|
33
|
-
prompt_user_for_deletion(imported_locales
|
30
|
+
prompt_user_for_deletion(imported_locales)
|
34
31
|
end
|
35
32
|
end
|
data/lib/locale_lister.rb
CHANGED
@@ -2,41 +2,37 @@
|
|
2
2
|
|
3
3
|
# extra_entries_array in case we wanna make a "protected locale" function later on
|
4
4
|
def get_locale_files(extra_entries_array = [])
|
5
|
-
|
6
|
-
|
7
|
-
Dir.entries(locale_path).reject { |entry| protected_locales.include?(entry) }
|
5
|
+
protected_locales = ['.', '..', 'locale_template', 'default', 'default.old', extra_entries_array].flatten
|
6
|
+
Dir.entries(LOCALES_PATH).reject { |entry| protected_locales.include?(entry) }
|
8
7
|
end
|
9
8
|
|
10
9
|
def list_locale_files()
|
11
10
|
locales = get_locale_files
|
12
|
-
puts
|
11
|
+
puts "[alphalang] These are the available locales.\ndefault"
|
13
12
|
locales.each do |locale|
|
14
13
|
puts locale
|
15
14
|
end
|
16
15
|
puts
|
17
16
|
end
|
18
17
|
|
19
|
-
def
|
20
|
-
|
21
|
-
specific_locale = gets.chomp
|
22
|
-
|
23
|
-
return if ABORT_ANSWERS.include?(specific_locale)
|
24
|
-
|
25
|
-
locale_path = File.join(__dir__, 'locales')
|
26
|
-
locale_file = File.readlines("#{locale_path}/#{specific_locale}")
|
18
|
+
def clean_locale_file_to_array(locale_name)
|
19
|
+
locale_file = File.readlines("#{LOCALES_PATH}/#{locale_name}")
|
27
20
|
|
28
21
|
clean_locale_file_array = []
|
29
22
|
locale_file.each do |line|
|
30
|
-
line.scan(/\b\p{
|
23
|
+
line.scan(/\b\p{Word}+\b/) do |word|
|
31
24
|
clean_locale_file_array << word if word.size > 1
|
32
25
|
end
|
33
26
|
end
|
27
|
+
clean_locale_file_array
|
28
|
+
end
|
34
29
|
|
35
|
-
|
30
|
+
def print_clean_locale_array(locale_name, clean_array)
|
31
|
+
header = "\n[alphalang] Syntax for locale <#{locale_name}>."
|
36
32
|
puts header
|
37
33
|
puts '+' * (header.size - 2)
|
38
34
|
clean_line = ''
|
39
|
-
|
35
|
+
clean_array.each_with_index do |word, index|
|
40
36
|
if index.even?
|
41
37
|
clean_line += "+ #{word}"
|
42
38
|
else
|
@@ -48,3 +44,13 @@ def list_specific_locale_file()
|
|
48
44
|
end
|
49
45
|
puts '+' * (header.size - 2)
|
50
46
|
end
|
47
|
+
|
48
|
+
def list_specific_locale_file()
|
49
|
+
list_locale_files
|
50
|
+
specific_locale = gets.chomp
|
51
|
+
|
52
|
+
return if ABORT_ANSWERS.include?(specific_locale)
|
53
|
+
|
54
|
+
specific_locale_array = clean_locale_file_to_array(specific_locale)
|
55
|
+
print_clean_locale_array(specific_locale, specific_locale_array)
|
56
|
+
end
|
data/lib/locales/de
CHANGED
data/lib/locales/default
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
;;.*$ ;;.*$
|
2
|
+
while while
|
3
|
+
print print
|
4
|
+
pause pause
|
5
|
+
def def
|
6
|
+
end end
|
7
|
+
if if
|
8
|
+
elseif elseif
|
9
|
+
else else
|
10
|
+
(false|true) (false|true)
|
11
|
+
(==|<=|>=) (==|<=|>=)
|
12
|
+
(not|!) (not|!)
|
13
|
+
(and|&&) (and|&&)
|
14
|
+
(or|\|\|) (or|\|\|)
|
15
|
+
\s+ \s+
|
16
|
+
\d+ \d+
|
17
|
+
\w+ \w+
|
18
|
+
. .
|
data/lib/locales/en
CHANGED
data/lib/locales/locale_template
CHANGED
data/lib/locales/sv
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
require_relative 'stmtnodes'
|
2
|
+
|
3
|
+
####################################################
|
4
|
+
|
5
|
+
$scopes = [{}]
|
6
|
+
$scope_lvl = 0
|
7
|
+
$test_nodes = false
|
8
|
+
|
9
|
+
# Need to figure out how to move the scopes in here as class members in a sane way
|
10
|
+
class ScopeManager
|
11
|
+
def self.scope_lvl
|
12
|
+
$scope_lvl
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.scope_lvl=(value)
|
16
|
+
$scope_lvl = value
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.lookup_var(name)
|
20
|
+
temp_scope_lvl = $scope_lvl
|
21
|
+
while temp_scope_lvl >= 0
|
22
|
+
if !$scopes[temp_scope_lvl].key?(name)
|
23
|
+
temp_scope_lvl -= 1
|
24
|
+
else
|
25
|
+
return $scopes[temp_scope_lvl][name]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
raise ArgumentError, "Variable '#{name}' is not defined" unless @value
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.increment_scope_level
|
32
|
+
$scope_lvl += 1
|
33
|
+
$scopes.push({})
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.decrement_scope_level
|
37
|
+
$scope_lvl -= 1
|
38
|
+
$scopes.pop
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.lookup_func(name)
|
42
|
+
raise ArgumentError, "Function '#{name}' is not defined" if $scopes[0][name].is_a?(NilClass)
|
43
|
+
return $scopes[0][name]
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.add_to_current_scope(name, value)
|
47
|
+
$scopes[$scope_lvl][name.name] = value.evaluate
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.add_func_to_global_scope(name, value, args)
|
51
|
+
$scopes[0][name.name] = [value, args]
|
52
|
+
end
|
53
|
+
end
|
data/lib/nodes/stmtnodes.rb
CHANGED
@@ -2,54 +2,6 @@ require_relative 'basenodes'
|
|
2
2
|
|
3
3
|
####################################################
|
4
4
|
|
5
|
-
$scopes = [{}]
|
6
|
-
$scope_lvl = 0
|
7
|
-
$test_nodes = false
|
8
|
-
|
9
|
-
# Need to expand this to actually handle scopes, not just lookups
|
10
|
-
class ScopeManager
|
11
|
-
def self.scope_lvl
|
12
|
-
$scope_lvl
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.lookup_var(name)
|
16
|
-
temp_scope_lvl = $scope_lvl
|
17
|
-
while temp_scope_lvl >= 0
|
18
|
-
if !$scopes[temp_scope_lvl].key?(name)
|
19
|
-
temp_scope_lvl -= 1
|
20
|
-
else
|
21
|
-
return $scopes[temp_scope_lvl][name]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
raise ArgumentError, "Variable '#{name}' is not defined" unless @value
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.increment_scope_level
|
28
|
-
$scope_lvl += 1
|
29
|
-
$scopes.push({})
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.decrement_scope_level
|
33
|
-
$scope_lvl -= 1
|
34
|
-
$scopes.pop
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.lookup_func(name)
|
38
|
-
raise ArgumentError, "Function '#{name}' is not defined" if $scopes[0][name].is_a?(NilClass)
|
39
|
-
return $scopes[0][name]
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.add_to_current_scope(name, value)
|
43
|
-
$scopes[$scope_lvl][name.name] = value.evaluate
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.add_func_to_global_scope(name, value, args)
|
47
|
-
$scopes[0][name.name] = [value, args]
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
####################################################
|
52
|
-
|
53
5
|
class VariableCallNode < Node
|
54
6
|
attr_accessor :name
|
55
7
|
|
data/lib/rdparse.rb
CHANGED
@@ -125,10 +125,9 @@ class Parser
|
|
125
125
|
class ParseError < RuntimeError
|
126
126
|
end
|
127
127
|
|
128
|
-
def initialize(language_name, locale='
|
128
|
+
def initialize(language_name, locale = 'default', &block)
|
129
129
|
|
130
|
-
|
131
|
-
token_pairs = File.readlines(locales_path)
|
130
|
+
token_pairs = File.readlines("#{LOCALES_PATH}/#{locale}")
|
132
131
|
@token_list = Hash.new
|
133
132
|
token_pairs.each do |pair|
|
134
133
|
default_value, locale_value = pair.split(' ')
|
data/lib/rdparse_quiet.rb
CHANGED
@@ -126,10 +126,9 @@ class Parser
|
|
126
126
|
class ParseError < RuntimeError
|
127
127
|
end
|
128
128
|
|
129
|
-
def initialize(language_name, locale='
|
129
|
+
def initialize(language_name, locale = 'default', &block)
|
130
130
|
|
131
|
-
|
132
|
-
token_pairs = File.readlines(locales_path)
|
131
|
+
token_pairs = File.readlines("#{LOCALES_PATH}/#{locale}")
|
133
132
|
@token_list = Hash.new
|
134
133
|
token_pairs.each do |pair|
|
135
134
|
default_value, locale_value = pair.split(' ')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alphalang
|
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
|
- mattias
|
@@ -61,15 +61,16 @@ files:
|
|
61
61
|
- bin/alphalang
|
62
62
|
- lib/alpha.rb
|
63
63
|
- lib/lang_creator.rb
|
64
|
+
- lib/locale_defaulter.rb
|
64
65
|
- lib/locale_deleter.rb
|
65
|
-
- lib/locale_deleter.rb~
|
66
66
|
- lib/locale_lister.rb
|
67
|
-
- lib/locale_lister.rb~
|
68
67
|
- lib/locales/de
|
68
|
+
- lib/locales/default
|
69
69
|
- lib/locales/en
|
70
70
|
- lib/locales/locale_template
|
71
71
|
- lib/locales/sv
|
72
72
|
- lib/nodes/basenodes.rb
|
73
|
+
- lib/nodes/scopemanager.rb
|
73
74
|
- lib/nodes/stmtnodes.rb
|
74
75
|
- lib/rdparse.rb
|
75
76
|
- lib/rdparse_quiet.rb
|
data/lib/locale_deleter.rb~
DELETED
File without changes
|
data/lib/locale_lister.rb~
DELETED
File without changes
|