italian-ruby 0.5.8 → 0.7.3

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: 879547a51b7cd48e47bad81d076172dd59f900169ecb57be1a7d15987032830f
4
- data.tar.gz: 430f8327290ea73a9f540eebb92fe43e7e879c5f694e40027b8f7387b428f823
3
+ metadata.gz: 5e15f6f86b0961ca74ad83f10083f4c6fe2cdaff1d3d7285af51ff1d15f1a3ff
4
+ data.tar.gz: c1d4294786b4604dc750b0faa3881088b6d49e7df4bc1b5ef638baf589607b91
5
5
  SHA512:
6
- metadata.gz: dcd29c6284309ab1f289e76de4e19aa6be26c8b43920f8cdb37b8e8b0f4eb094e726cc47dffe1067ae8da54fce9dd3be7725a4038d58c7ba02ec9887eeead7a8
7
- data.tar.gz: be93db401eb8bfe8c86d86b511d0d2cc5a0844abb7b64446768abe05227bfd51eaaf531565c01f75283cb7a65f92e8f53739c7739daf1783c9e7004f6c409bc5
6
+ metadata.gz: e5945be346028fc2dbebb5a5b20b7c61da3954733a4a9b6d8d3b3d8955eb7a09f65562896fc02bd1350b65fd9b872eba41c22e6c9893e7bc72036dd5eee3f480
7
+ data.tar.gz: f84419f5ddff172b0831ab9326178be0ef95f9c4f2a468aab422bf704eaa28818fd39ee21c063c430eddf9db023a8387eba468b2d446a6c22b9a6b16c48a4634
data/README.md CHANGED
@@ -100,7 +100,7 @@ Bato però ha solo un binario che permette di eseguire codice filippino. Italian
100
100
 
101
101
  Per concludere, ci sono degli avvertimenti.
102
102
  1. il namespace verrà sporcato. Ho fatto del mio meglio per essere più chirurgico possibile, ma se fate `require "italian/ruby"` sappiate che verranno su un sacco di classi e di alias nuovi (es. `Oggetto.nuovo` ecc.).
103
- 2. il `richiedi` e `richiedi_relativo` funzionano traducendo un file sorgente in italiano nella stessa cartella in cui si trova, caricandolo in memoria con il `require` di Ruby, e poi cancellandolo. Non so se questo possa creare problemi. Immagino di no. Ma vi ho avvertito!
103
+ 2. il `richiedi` e `richiedi_relativo` funzionano traducendo un file sorgente in italiano nella cartella `.italian-ruby`, che viene creata in automatico nella home dell'utente. Viene ricreato l'intero percorso del file, in modo tale da preservarne l'unicità e il riferimento con il sorgente iniziale. Unaa volta tradotto, il file viene caricato in memoria con il `require` di Ruby. Non so se questo possa creare problemi. Immagino di no. Ma vi ho avvertito!
104
104
 
105
105
  ## Contribuire
106
106
 
@@ -5,7 +5,9 @@ require "rspec"
5
5
  require "italian/ruby"
6
6
 
7
7
  def translate_spec(spec_file)
8
- translated_spec_file = "#{File.dirname spec_file}/#{File.basename(spec_file, ".ir")}.rb"
8
+ translated_spec_file = ".italian-ruby/#{File.dirname spec_file}/#{File.basename(spec_file, ".ir")}.rb"
9
+ translated_spec_dir = File.dirname translated_spec_file
10
+ FileUtils.mkdir_p translated_spec_dir unless Dir.exists? translated_spec_dir
9
11
  File.write translated_spec_file, Italian::Ruby::Traduttore.traduci(spec_file)
10
12
  translated_spec_file
11
13
  end
@@ -26,4 +28,4 @@ end
26
28
 
27
29
  translated_spec_files = spec_files.map { |file| translate_spec file }
28
30
  RSpec::Core::Runner.run(translated_spec_files, STDIN, STDOUT)
29
- translated_spec_files.each { |file| destroy_spec file }
31
+ # translated_spec_files.each { |file| destroy_spec file }
@@ -28,8 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
29
29
  spec.require_paths = ["lib"]
30
30
 
31
- spec.add_dependency 'ruby2ruby', '~> 2.4'
32
-
33
31
  spec.add_development_dependency 'bundler', '~> 2.1'
34
32
  spec.add_development_dependency 'rake', '~> 13.0'
35
33
  spec.add_development_dependency 'rspec', '~> 3.9'
@@ -10,5 +10,14 @@ require "italian/ruby/core_ext"
10
10
 
11
11
  module Italian
12
12
  module Ruby
13
+ class << self
14
+
15
+ def translations_dir_path
16
+ path = File.join File.expand_path("~"), ".italian-ruby", "translations"
17
+ FileUtils.mkdir_p path unless Dir.exists? path
18
+ path
19
+ end
20
+
21
+ end
13
22
  end
14
23
  end
@@ -68,6 +68,7 @@ class Array
68
68
  alias :somma :sum
69
69
  alias :rovescia :reverse
70
70
  alias :inverti :reverse
71
+ alias :lista :entries
71
72
 
72
73
  def esiste?
73
74
  !nil? && !empty?
@@ -15,26 +15,43 @@ module Kernel
15
15
 
16
16
  def richiedi(name)
17
17
  file_to_require = $:.map { |dir| Dir["#{dir}/**/#{name}.ir"] }.flatten.compact.first
18
- raise LoadError.new("cannot load such file -- #{name}") if file_to_require.nil?
19
18
 
20
- traduci_carica_e_distruggi file_to_require
19
+ if file_to_require.nil?
20
+ begin
21
+ require name
22
+ rescue SyntaxError => errore
23
+ riga = errore.message.split("\n").first.split(":")[1].to_i rescue 0
24
+ Italian::Ruby::Errore::Sintassi.new("Errore di sintassi.", name, riga, 0).stampa
25
+ end
26
+ else
27
+ traduci_e_carica file_to_require
28
+ end
21
29
  end
22
30
 
23
31
  def richiedi_relativo(name)
24
32
  caller_location_dir = File.dirname caller_locations.first.absolute_path
25
- file_to_require = File.expand_path "#{caller_location_dir}/#{name}.ir"
33
+ if caller_location_dir.start_with?(Italian::Ruby.translations_dir_path)
34
+ caller_location_dir = caller_location_dir[Italian::Ruby.translations_dir_path.length..-1]
35
+ elsif caller_location_dir.include?(".italian-ruby/")
36
+ caller_location_dir.gsub! ".italian-ruby/", ""
37
+ end
38
+ caller_location_file = File.expand_path "#{caller_location_dir}/#{name}"
39
+ file_to_require = Dir["#{caller_location_file}.{ir,rb}"].compact.first
26
40
  raise LoadError.new("cannot load such file -- #{name}") unless File.exist? file_to_require
27
41
 
28
- traduci_carica_e_distruggi file_to_require
42
+ traduci_e_carica file_to_require
29
43
  end
30
44
 
31
45
  def richiedi_assoluto(file)
32
- raise LoadError.new("cannot load suc file -- #{file}") unless File.exist? file
33
- traduci_carica_e_distruggi file
46
+ raise LoadError.new("cannot load such file -- #{file}") unless File.exist? file
47
+ traduci_e_carica file
34
48
  end
35
49
 
36
50
  def richiedi_tutti(dir)
37
51
  caller_location_dir = "#{File.dirname caller_locations.first.absolute_path}/#{dir}"
52
+ if caller_location_dir.start_with?(Italian::Ruby.translations_dir_path)
53
+ caller_location_dir = caller_location_dir[Italian::Ruby.translations_dir_path.length..-1]
54
+ end
38
55
  raise LoadError.new("cannot load such directory -- #{dir}") unless Dir.exist? caller_location_dir
39
56
 
40
57
  Dir["#{caller_location_dir}/**/*.ir"].each do |file|
@@ -44,16 +61,28 @@ module Kernel
44
61
 
45
62
  private
46
63
 
47
- def traduci_carica_e_distruggi(file_to_require)
48
- parsed_code = Italian::Ruby::Traduttore.traduci file_to_require
49
- file_to_require_dir = File.dirname(file_to_require)
50
- file_to_require_basename = File.basename(file_to_require, ".ir")
51
- tmp_parsed_file = "#{file_to_require_dir}/#{file_to_require_basename}.rb"
64
+ def traduci_e_carica(file_to_require)
65
+ file_to_require_dir = File.dirname file_to_require
66
+ file_to_require_ext = File.extname file_to_require
67
+ file_to_require_basename = File.basename file_to_require, file_to_require_ext
68
+
69
+ parsed_dir = File.join Italian::Ruby.translations_dir_path, file_to_require_dir
70
+ FileUtils.mkdir_p parsed_dir unless Dir.exists? parsed_dir
71
+ parsed_file = File.join parsed_dir, "#{file_to_require_basename}.rb"
72
+
73
+ if file_to_require_ext == ".rb"
74
+ parsed_code = File.read file_to_require
75
+ else
76
+ parsed_code = Italian::Ruby::Traduttore.traduci file_to_require
77
+ end
52
78
 
53
- File.write tmp_parsed_file, parsed_code
54
- require_output = require tmp_parsed_file
55
- File.delete tmp_parsed_file if File.exist? tmp_parsed_file
56
- require_output
79
+ File.write parsed_file, parsed_code
80
+ begin
81
+ require parsed_file
82
+ rescue SyntaxError => errore
83
+ riga = errore.message.split("\n").first.split(":")[1].to_i rescue 0
84
+ Italian::Ruby::Errore::Sintassi.new("Errore di sintassi.", parsed_file, riga, 0).stampa
85
+ end
57
86
  end
58
87
 
59
88
  end
@@ -66,6 +66,12 @@ class Object
66
66
  inizializzatore *args, **options, &block
67
67
  end
68
68
 
69
+ def istanza
70
+ self
71
+ end
72
+ alias :se_stesso :istanza
73
+ alias :se_stessa :istanza
74
+
69
75
  end
70
76
 
71
77
  Oggetto = Object
@@ -0,0 +1,52 @@
1
+ require_relative "utils/debug"
2
+
3
+ module Italian
4
+ module Ruby
5
+ class Errore < StandardError
6
+ class Sintassi < Errore; end
7
+ class NonSupportato < Errore; end
8
+ class IndividuazioneStringa < Errore; end
9
+
10
+ def initialize(messaggio = nil, file = nil, riga = 0, posizione = 0)
11
+ @messaggio = messaggio
12
+ @file = file
13
+ @riga = riga
14
+ @posizione = posizione
15
+ begin
16
+ @linea = File.readlines(@file)[@riga - 1]
17
+ rescue StandardError => e
18
+ @linea = "Non è stato possibile recuperare la riga #{@riga} del file."
19
+ end
20
+ end
21
+
22
+ def stampa
23
+ prova_ad_ottenere_maggiori_informazioni
24
+ puts "-----------------------------------------------------------------------------".alzavola
25
+ puts "Si è verificato un errore durante la traduzione del file `#{@file}`."
26
+ print "L'errore è: "
27
+ puts "#{self.class}.".rosso
28
+ puts @messaggio
29
+ puts
30
+ print "Riga: "
31
+ puts "#{@riga}".ciano
32
+ puts @linea
33
+ puts "^".rjust(@posizione + 1, " ").verde_lime
34
+ puts
35
+ puts "-----------------------------------------------------------------------------".alzavola
36
+ exit 1
37
+ end
38
+
39
+ private
40
+
41
+ ##
42
+ # Prova a recuperare maggiori informazioni su errore.
43
+ def prova_ad_ottenere_maggiori_informazioni
44
+ case
45
+ when self.class.is_a?(Sintassi)
46
+ # TO DO
47
+ end
48
+ end
49
+
50
+ end
51
+ end
52
+ end
@@ -1,30 +1,141 @@
1
1
  # frozen_string_literal: true
2
- require "ruby2ruby"
3
- require "ruby_parser"
4
- require_relative "ruby_parser_patches"
2
+ require "rainbow"
3
+ require_relative "utils/debug"
4
+ require_relative "errore"
5
5
 
6
6
  module Italian
7
7
  module Ruby
8
8
  class Traduttore
9
9
 
10
+ STAMPA_DETTAGLI_TRADUZIONE = false
11
+
10
12
  class << self
11
13
 
12
- def traduci(file)
13
- begin
14
- @@ruby2ruby ||= Ruby2Ruby.new
15
- @@parser ||= RubyParser.new
16
-
17
- codice = File.read file
18
- sexp = @@parser.process("# encoding: utf-8\n#{codice}")
19
- codice_ruby = @@ruby2ruby.process(sexp)
20
-
21
- "# encoding: utf-8\n#{codice_ruby}"
22
- rescue StandardError => error
23
- raise "Errore nella traduzione del file #{file}.\n"\
24
- "#{error.message}\n#{error.backtrace.join("\n")}"
14
+ def traduci(file = nil, &block)
15
+ if not file.nil?
16
+ codice_tradotto = File.readlines(file).map.with_index do |linea, riga|
17
+ traduci_linea file, linea, riga
18
+ end
19
+ codice_tradotto.join
20
+ else
21
+ if block_given?
22
+ begin
23
+ block.call
24
+ rescue StandardError => errore
25
+ Italian::Ruby::Errore.new([ errore.message, errore.backtrace ].join("\n"), "-", 0, 0).stampa
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ def traduci_linea(file, linea, riga)
32
+ puts "Traduco linea [#{riga}]: #{linea.inspect}".magenta if STAMPA_DETTAGLI_TRADUZIONE
33
+ posizione_commento = linea.index(%{#}) || linea.length
34
+ posizione_stringa_singola = linea.index(%{'}) || linea.length
35
+ posizione_stringa_doppia = linea.index(%{"}) || linea.length
36
+ contesto = [
37
+ file, linea, riga,
38
+ posizione_commento,
39
+ posizione_stringa_singola,
40
+ posizione_stringa_doppia ]
41
+
42
+ controlla_stringa_singola *contesto
43
+ controlla_stringa_doppia *contesto
44
+
45
+ if posizione_commento < posizione_stringa_doppia
46
+ pezzi_da_tradurre = [
47
+ linea[0..posizione_commento],
48
+ linea[posizione_commento + 1..]
49
+ ]
50
+ elsif posizione_stringa_doppia < posizione_commento
51
+ pezzi_da_tradurre = linea.scan( /([^"]*)("[^"]*")([^"]*)/ ).flatten
52
+ else
53
+ pezzi_da_tradurre = [ linea ]
54
+ end
55
+
56
+ debug pezzi_da_tradurre if STAMPA_DETTAGLI_TRADUZIONE
57
+ linea_tradotta = pezzi_da_tradurre.map { |pezzo| traduci_pezzo pezzo }.join
58
+
59
+ if STAMPA_DETTAGLI_TRADUZIONE
60
+ puts "Linea tradotta [#{riga}]: #{linea_tradotta.inspect}".verde_lime
61
+ puts
25
62
  end
63
+ linea_tradotta
26
64
  end
27
65
 
66
+ private
67
+
68
+ def controlla_stringa_singola(file, linea, riga, posizione_commento, posizione_stringa_singola, posizione_stringa_doppia)
69
+ if posizione_stringa_singola < posizione_commento and posizione_stringa_singola < posizione_stringa_doppia
70
+ Italian::Ruby::Errore::NonSupportato.new(
71
+ "Le stringhe con singolo apice non sono supportate.",
72
+ file, riga, posizione_stringa_singola).stampa
73
+ end
74
+ end
75
+
76
+ def controlla_stringa_doppia(file, linea, riga, posizione_commento, posizione_stringa_singola, posizione_stringa_doppia)
77
+ return if posizione_commento <= posizione_stringa_doppia
78
+
79
+ prossima_posizione_stringa_doppia = linea[posizione_stringa_doppia + 1..].index %{"}
80
+ if prossima_posizione_stringa_doppia.nil?
81
+ Italian::Ruby::Errore::IndividuazioneStringa.new(
82
+ "Non è stato possibile trovare la terminazione della stringa.",
83
+ file, riga, posizione_stringa_doppia).stampa
84
+ end
85
+ end
86
+
87
+ def traduci_pezzo(pezzo)
88
+ return pezzo if pezzo.nil? or pezzo.length == 0
89
+ return pezzo if pezzo.start_with? %{#}
90
+ return pezzo if pezzo.start_with? %{"}
91
+
92
+ pezzo.gsub! /(\b)e(\b)/, "\\1and\\2"
93
+ pezzo.gsub! /(\b)inizia(\b)/, "\\1begin\\2"
94
+ pezzo.gsub! /(\b)blocco_dato\?(\b)/, "\\1block_given?\\2"
95
+ pezzo.gsub! /(\b)esci(\b)/, "\\1break\\2"
96
+ pezzo.gsub! /(\b)considera(\b)/, "\\1case\\2"
97
+ pezzo.gsub! /(\b)classe([\s]+[A-Z][\w]*)/, "\\1class\\2"
98
+ pezzo.gsub! /(\b)classe([\s]+)(<<)([\s]+)/, "\\1class\\2\\3\\4"
99
+ pezzo.gsub! /(\b)definisci([\s]+[^\s]+)/, "\\1def\\2"
100
+ pezzo.gsub! /(\b)definito\?([\s]+[^\s]+)/, "\\1defined?\\2"
101
+ pezzo.gsub! /(\b)definita\?([\s]+[^\s]+)/, "\\1defined?\\2"
102
+ pezzo.gsub! /(\b)esegui(\b)/, "\\1do\\2"
103
+ pezzo.gsub! /(\b)altrimenti(\b)/, "\\1else\\2"
104
+ pezzo.gsub! /(\b)altrimenti_se(\b)/, "\\1elsif\\2"
105
+ pezzo.gsub! /(\b)fine(\b)/, "\\1end\\2"
106
+ pezzo.gsub! /(\b)assicura(\b)/, "\\1ensure\\2"
107
+ pezzo.gsub! /(\b)estendi([\s]+[A-Z][\w]*)/, "\\1extend\\2"
108
+ pezzo.gsub! /(\b)no(\b)/, "\\1false\\2"
109
+ pezzo.gsub! /(\b)falso(\b)/, "\\1false\\2"
110
+ pezzo.gsub! /(\b)per(\b)/, "\\1for\\2"
111
+ pezzo.gsub! /(\b)se(\b)/, "\\1if\\2"
112
+ pezzo.gsub! /(\b)includi([\s]+[A-Z][\w]*)/, "\\1include\\2"
113
+ pezzo.gsub! /(\b)modulo([\s]+[A-Z][\w]*)/, "\\1module\\2"
114
+ pezzo.gsub! /(\b)prossimo(\b)/, "\\1next\\2"
115
+ pezzo.gsub! /(\b)prossima(\b)/, "\\1next\\2"
116
+ pezzo.gsub! /(\b)nullo(\b)/, "\\1nil\\2"
117
+ pezzo.gsub! /(\b)nulla(\b)/, "\\1nil\\2"
118
+ pezzo.gsub! /(\b)non(\b)/, "\\1not\\2"
119
+ pezzo.gsub! /(\b)o(\b)/, "\\1or\\2"
120
+ pezzo.gsub! /(\b)preponi([\s]+[A-Z][\w]*)/, "\\1prepend\\2"
121
+ pezzo.gsub! /(\b)riesegui(\b)/, "\\1redo\\2"
122
+ pezzo.gsub! /(\b)recupera(\b)/, "\\1rescue\\2"
123
+ pezzo.gsub! /(\b)riprova(\b)/, "\\1retry\\2"
124
+ pezzo.gsub! /(\b)ritorna(\b)/, "\\1return\\2"
125
+ pezzo.gsub! /(\b)istanza/, "\\1self"
126
+ pezzo.gsub! /(\b)se_stesso/, "\\1self"
127
+ pezzo.gsub! /(\b)se_stessa/, "\\1self"
128
+ pezzo.gsub! /(\b)allora(\b)/, "\\1then\\2"
129
+ pezzo.gsub! /(\b)si(\b)/, "\\1true\\2"
130
+ pezzo.gsub! /(\b)vero(\b)/, "\\1true\\2"
131
+ pezzo.gsub! /(\b)a_meno_che(\b)/, "\\1unless\\2"
132
+ pezzo.gsub! /(\b)finché(\b)/, "\\1until\\2"
133
+ pezzo.gsub! /(\b)quando(\b)/, "\\1when\\2"
134
+ pezzo.gsub! /(\b)mentre(\b)/, "\\1while\\2"
135
+ pezzo.gsub! /(\b)rilascia(\b)/, "\\1yield\\2"
136
+ pezzo
137
+ end
138
+
28
139
  end
29
140
 
30
141
  end
@@ -30,9 +30,9 @@ end
30
30
 
31
31
  ##
32
32
  # Crea un metodo per ogni colore da poter chiamare su un'istanza di una stringa.
33
- class Stringa
33
+ class String
34
34
 
35
- COLORI = Mappa[
35
+ COLORI = Hash[
36
36
  aliceblue: :blu_ghiaccio,
37
37
  antiquewhite: :bianco_antico,
38
38
  aqua: :acqua,
@@ -1,5 +1,5 @@
1
1
  module Italian
2
2
  module Ruby
3
- VERSION = "0.5.8"
3
+ VERSION = "0.7.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: italian-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Ballardin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: ruby2ruby
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.4'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.4'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +99,7 @@ files:
113
99
  - lib/italian/ruby/core_ext/string.rb
114
100
  - lib/italian/ruby/core_ext/symbol.rb
115
101
  - lib/italian/ruby/core_ext/time.rb
116
- - lib/italian/ruby/ruby_parser_patches.rb
102
+ - lib/italian/ruby/errore.rb
117
103
  - lib/italian/ruby/traduttore.rb
118
104
  - lib/italian/ruby/utils/debug.rb
119
105
  - lib/italian/ruby/version.rb
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubyParserStuff
4
- class Keyword
5
- expr_woot = EXPR_FNAME|EXPR_FITEM
6
-
7
- italian_wordlist = [
8
- ["alias", [:kALIAS, :kALIAS ], expr_woot ],
9
- ["e", [:kAND, :kAND ], EXPR_BEG ],
10
- ["inizia", [:kBEGIN, :kBEGIN ], EXPR_BEG ],
11
- ["esci", [:kBREAK, :kBREAK ], EXPR_MID ],
12
- ["considera", [:kCASE, :kCASE ], EXPR_BEG ],
13
- ["classe", [:kCLASS, :kCLASS ], EXPR_CLASS ],
14
- ["def", [:kDEF, :kDEF ], EXPR_FNAME ],
15
- ["definisci", [:kDEF, :kDEF ], EXPR_FNAME ],
16
- ["definito?", [:kDEFINED, :kDEFINED ], EXPR_ARG ],
17
- ["definita?", [:kDEFINED, :kDEFINED ], EXPR_ARG ],
18
- ["esegui", [:kDO, :kDO ], EXPR_BEG ],
19
- ["fai", [:kDO, :kDO ], EXPR_BEG ],
20
- ["altrimenti", [:kELSE, :kELSE ], EXPR_BEG ],
21
- ["altrimenti_se", [:kELSIF, :kELSIF ], EXPR_BEG ],
22
- ["fine", [:kEND, :kEND ], EXPR_END ],
23
- ["assicura", [:kENSURE, :kENSURE ], EXPR_BEG ],
24
- ["no", [:kFALSE, :kFALSE ], EXPR_END ],
25
- ["falso", [:kFALSE, :kFALSE ], EXPR_END ],
26
- ["per", [:kFOR, :kFOR ], EXPR_BEG ],
27
- ["se", [:kIF, :kIF_MOD ], EXPR_BEG ],
28
- ["in", [:kIN, :kIN ], EXPR_BEG ],
29
- ["modulo", [:kMODULE, :kMODULE ], EXPR_BEG ],
30
- ["prossimo", [:kNEXT, :kNEXT ], EXPR_MID ],
31
- ["prossima", [:kNEXT, :kNEXT ], EXPR_MID ],
32
- ["nullo", [:kNIL, :kNIL ], EXPR_END ],
33
- ["nulla", [:kNIL, :kNIL ], EXPR_END ],
34
- ["non", [:kNOT, :kNOT ], EXPR_ARG ],
35
- ["o", [:kOR, :kOR ], EXPR_BEG ],
36
- ["rifai", [:kREDO, :kREDO ], EXPR_END ],
37
- ["riesegui", [:kREDO, :kREDO ], EXPR_END ],
38
- ["recupera", [:kRESCUE, :kRESCUE_MOD ], EXPR_MID ],
39
- ["riprova", [:kRETRY, :kRETRY ], EXPR_END ],
40
- ["ritorna", [:kRETURN, :kRETURN ], EXPR_MID ],
41
- ["istanza", [:kSELF, :kSELF ], EXPR_END ],
42
- ["se_stesso", [:kSELF, :kSELF ], EXPR_END ],
43
- ["se_stessa", [:kSELF, :kSELF ], EXPR_END ],
44
- ["super", [:kSUPER, :kSUPER ], EXPR_ARG ],
45
- ["allora", [:kTHEN, :kTHEN ], EXPR_BEG ],
46
- ["si", [:kTRUE, :kTRUE ], EXPR_END ],
47
- ["vero", [:kTRUE, :kTRUE ], EXPR_END ],
48
- ["undef", [:kUNDEF, :kUNDEF ], expr_woot ],
49
- ["a_meno_che", [:kUNLESS, :kUNLESS_MOD ], EXPR_BEG ],
50
- ["finché", [:kUNTIL, :kUNTIL_MOD ], EXPR_BEG ],
51
- ["quando", [:kWHEN, :kWHEN ], EXPR_BEG ],
52
- ["mentre", [:kWHILE, :kWHILE_MOD ], EXPR_BEG ],
53
- ["rilascia", [:kYIELD, :kYIELD ], EXPR_ARG ],
54
- ["INIZIA", [:klBEGIN, :klBEGIN ], EXPR_END ],
55
- ["FINE", [:klEND, :klEND ], EXPR_END ],
56
- ["__FILE__", [:k__FILE__, :k__FILE__ ], EXPR_END ],
57
- ["__LINE__", [:k__LINE__, :k__LINE__ ], EXPR_END ],
58
- ["__ENCODING__", [:k__ENCODING__, :k__ENCODING__], EXPR_END],
59
- ].map { |args| KWtable.new(*args) }
60
-
61
- ITALIAN_WORDLIST = Hash[*italian_wordlist.map { |o| [o.name, o] }.flatten]
62
-
63
- def self.keyword str
64
- ITALIAN_WORDLIST[str]
65
- end
66
- end
67
- end