Class: Lexicon
- Inherits:
-
Object
- Object
- Lexicon
- Defined in:
- lib/lucio/lexicon.rb
Instance Method Summary collapse
- #add_function(token, code) ⇒ Object
- #add_macro(token, code) ⇒ Object
- #get(operator) ⇒ Object
-
#initialize ⇒ Lexicon
constructor
A new instance of Lexicon.
Constructor Details
#initialize ⇒ Lexicon
Returns a new instance of Lexicon.
2 3 4 |
# File 'lib/lucio/lexicon.rb', line 2 def initialize @operator_list = {} end |
Instance Method Details
#add_function(token, code) ⇒ Object
6 7 8 |
# File 'lib/lucio/lexicon.rb', line 6 def add_function(token, code) @operator_list[token] = {:type => :function, :code => code} end |
#add_macro(token, code) ⇒ Object
10 11 12 |
# File 'lib/lucio/lexicon.rb', line 10 def add_macro(token, code) @operator_list[token] = {:type => :macro, :code => code} end |
#get(operator) ⇒ Object
14 15 16 |
# File 'lib/lucio/lexicon.rb', line 14 def get(operator) @operator_list[operator] end |