Module: PrintError
- Defined in:
- lib/linmeric/Error_print.rb
Overview
This modue provides a set of error messages for linmeric
- Author
-
Massimiliano Dal Mas ([email protected])
- License
-
Distributed under MIT license
Class Method Summary collapse
-
.default(token, expression) ⇒ Object
-
argument: unexpected Token * argument: expression (commands) where the error has been found.
-
-
.missing(token, expression) ⇒ Object
-
argument: Token arguments are missing for * argument: expression (commands) where the error has been found.
-
-
.missing_expression_after_equal(pos, expression) ⇒ Object
-
argument: position where the error is located * argument: expression (commands) where the error has been found.
-
-
.missing_general_string(position, expression) ⇒ Object
-
argument: position where the error is located * argument: expression (commands) where the error has been found.
-
-
.missing_integ_range(pos, expression) ⇒ Object
-
argument: position where the error is located * argument: expression (commands) where the error has been found.
-
-
.missmatch(token, expression, expectation) ⇒ Object
-
argument: missmatched Token found * argument: expression (commands) where the error has been found * argument: token type (String) expected.
-
-
.no_final_quotes(expression, position) ⇒ Object
-
argument: expression (commands) where the error has been found * argument: position where the error is located.
-
-
.numPoint_missing(position, expression) ⇒ Object
-
argument: position where the error is located * argument: expression (commands) where the error has been found.
-
-
.print(message, expression, pos) ⇒ Object
Main function that prints the error message.
-
.reduced(token, expression) ⇒ Object
-
argument: unexpected Token * argument: expression (commands) where the error has been found.
-
-
.unexpected_token_in_solve(token, expression) ⇒ Object
-
argument: unexpected Token found * argument: expression (commands) where the error has been found.
-
-
.unknown(token, expression) ⇒ Object
-
argument: unknown Token found * argument: expression (commands) where the error has been found.
-
Class Method Details
.default(token, expression) ⇒ Object
-
argument: unexpected Token
-
argument: expression (commands) where the error has been found
24 25 26 27 |
# File 'lib/linmeric/Error_print.rb', line 24 def self.default(token,expression) = " Sintax Error: unexpected #{token.attribute} token '#{token.me}' found" self.print(,expression,token.position) end |
.missing(token, expression) ⇒ Object
-
argument: Token arguments are missing for
-
argument: expression (commands) where the error has been found
53 54 55 56 |
# File 'lib/linmeric/Error_print.rb', line 53 def self.missing(token,expression) = " Sintax Error: missing argument for '#{token.me}' #{token.attribute}" self.print(,expression,token.position) end |
.missing_expression_after_equal(pos, expression) ⇒ Object
-
argument: position where the error is located
-
argument: expression (commands) where the error has been found
81 82 83 84 |
# File 'lib/linmeric/Error_print.rb', line 81 def self.missing_expression_after_equal(pos,expression) = " Sintax Error: missing expression after EQUAL operator" self.print(,expression,pos) end |
.missing_general_string(position, expression) ⇒ Object
-
argument: position where the error is located
-
argument: expression (commands) where the error has been found
67 68 69 70 |
# File 'lib/linmeric/Error_print.rb', line 67 def self.missing_general_string(position,expression) = " Sintax Error: missing agument block" self.print(,expression,position) end |
.missing_integ_range(pos, expression) ⇒ Object
-
argument: position where the error is located
-
argument: expression (commands) where the error has been found
95 96 97 98 |
# File 'lib/linmeric/Error_print.rb', line 95 def self.missing_integ_range(pos,expression) = " Sintax Error: missing integration range for 'integ:' method" self.print(,expression,pos) end |
.missmatch(token, expression, expectation) ⇒ Object
-
argument: missmatched Token found
-
argument: expression (commands) where the error has been found
-
argument: token type (String) expected
46 47 48 49 |
# File 'lib/linmeric/Error_print.rb', line 46 def self.missmatch(token,expression,expectation) = " Sintax Error: expecting #{expectation} but #{token.attribute} token '#{token.me}' found" self.print(,expression,token.position) end |
.no_final_quotes(expression, position) ⇒ Object
-
argument: expression (commands) where the error has been found
-
argument: position where the error is located
60 61 62 63 |
# File 'lib/linmeric/Error_print.rb', line 60 def self.no_final_quotes(expression,position) = " Sintax Error: missing quotes for block" self.print(,expression,position) end |
.numPoint_missing(position, expression) ⇒ Object
-
argument: position where the error is located
-
argument: expression (commands) where the error has been found
74 75 76 77 |
# File 'lib/linmeric/Error_print.rb', line 74 def self.numPoint_missing(position,expression) = " Sintax Error: number of points is missing" self.print(,expression,position) end |
.print(message, expression, pos) ⇒ Object
Main function that prints the error message
-
argument: message to be printed (string)
-
argument: expression (commands) where the error has been found
-
argument: error position
16 17 18 19 20 |
# File 'lib/linmeric/Error_print.rb', line 16 def self.print(,expression,pos) puts puts expression puts " " * pos + "^" end |
.reduced(token, expression) ⇒ Object
-
argument: unexpected Token
-
argument: expression (commands) where the error has been found
31 32 33 34 |
# File 'lib/linmeric/Error_print.rb', line 31 def self.reduced(token,expression) = " Sintax Error: unexpected #{token.attribute} '#{token.me}' found" self.print(,expression,token.position) end |
.unexpected_token_in_solve(token, expression) ⇒ Object
-
argument: unexpected Token found
-
argument: expression (commands) where the error has been found
88 89 90 91 |
# File 'lib/linmeric/Error_print.rb', line 88 def self.unexpected_token_in_solve(token,expression) = " Sintax Error: unexpected #{token.attribute} token '#{token.me}' in 'solve:' args" self.print(,expression,token.position) end |
.unknown(token, expression) ⇒ Object
-
argument: unknown Token found
-
argument: expression (commands) where the error has been found
38 39 40 41 |
# File 'lib/linmeric/Error_print.rb', line 38 def self.unknown(token,expression) = " Sintax Error: unknown #{token.attribute} '#{token.me}' found" self.print(,expression,token.position) end |