View Javadoc

1   /*
2    * #%L
3    * prolobjectlink-jpi
4    * %%
5    * Copyright (C) 2019 Prolobjectlink Project
6    * %%
7    * Permission is hereby granted, free of charge, to any person obtaining a copy
8    * of this software and associated documentation files (the "Software"), to deal
9    * in the Software without restriction, including without limitation the rights
10   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11   * copies of the Software, and to permit persons to whom the Software is
12   * furnished to do so, subject to the following conditions:
13   * 
14   * The above copyright notice and this permission notice shall be included in
15   * all copies or substantial portions of the Software.
16   * 
17   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23   * THE SOFTWARE.
24   * #L%
25   */
26  package io.github.prolobjectlink.prolog;
27  
28  public class PrologError extends Error {
29  
30  	private static final long serialVersionUID = 4344277636991967495L;
31  
32  	// parser errors
33  	static final String UNRECOGNIZABLE_TOKEN = "The current token is unrecognizable.";
34  	static final String LPAR_EXPECTED_TOKEN = "The current token is differents to expected prolog tokens left parenthesis '(' ";
35  	static final String RPAR_EXPECTED_TOKEN = "The current token is differents to expected prolog tokens right parenthesis ')' ";
36  	static final String COMMA_EXPECTED_TOKEN = "The current token is differents to expected prolog tokens comma ',' ";
37  	static final String NOT_DEFINED_OPERATOR = "The current token is not defined operator";
38  	static final String NOT_DEFINED_BUILT_IN = "The current token is not defined built-in predicate";
39  	static final String INVALID_IDICATOR_TERM = "The current token is not a correct predicate indicator";
40  	static final String DOT_EXPECTED_TOKEN = "The current token is not expected end dot";
41  	static final String NUMBER_EXPECTED = "The current token is not a number";
42  
43  	// runtime errors
44  	static final String NULL_ARGUMENTS = "Arguments null.";
45  	static final String STACK_OVERFLOW = "Stack overflow.";
46  	static final String ARGUMENTS_OVERFLOW = "Arguments overflow.";
47  	static final String NULL_FUNCTOR = "The specified term's functor is null";
48  	static final String EMPTY_ARGUMENTS = "The Prolog term don't have argument.";
49  	static final String NUMBERS_HAVE_NOT_FUNCTOR = "Numbers don't have functor.";
50  	static final String VAR_HAVE_NOT_FUNCTOR = "Variables don't have functor.";
51  	static final String VAR_HAVE_NOT_ARITY = "Variables don't have arity value";
52  	static final String VAR_HAVE_NOT_ARGUMENTS = "Variables don't have arguments";
53  	static final String RANGE_NOT_VALID = "The specified range is not valid range";
54  	static final String INDEX_OUT_OF_BOUND = "The indexed position is out of bound.";
55  	static final String CALLABLE_ERROR = "The term don't correspond with a predication";
56  	static final String ILLEGAL_FUNCTOR = "The specified term's functor is empty string";
57  	static final String INSTANTATION_ERROR = "The term is not instance sufficiently";
58  	static final String ILLEGAL_VAR_NAME = "Illegal variable name. Variable name should match with [A-Z_][A-Za-z0-9_]* regular expression.";
59  	static final String ILLEGAL_ATOM_VALUE = "Illegal atom value. Prolog atom value should match with [a-z][A-Za-z0-9_]* regular expression.";
60  	static final String ILLEGAL_FLOAT_VALUE = "Illegal float value. Prolog float number should match with [0-9]+|[0-9]+\\.[0-9]+|[-][0-9]+\\.[0-9]+ regular expression";
61  	static final String ILLEGAL_INTEGER_VALUE = "Illegal integer value. Prolog integer number should match with [0-9]+|[-][0-9]+ regular expression";
62  	static final String ILLEGAL_ARITY = "The specified arity is negative or greater than maximum arguments allowed";
63  	static final String NUMBERS_HAVE_NOT_KEY = "Numbers don't have key value.";
64  	static final String VAR_HAVE_NOT_KEY = "Variables don't have key value";
65  	static final String ATOMIC_HAVE_NOT_ARGUMENT_AT = "Atomics terms have not any argument at specified position";
66  	static final String NON_ARITMETHIC_OPERAND = "The term is not an aritmethic operand";
67  	static final String DOMAIN_ERROR = "Not less than zero number is expected";
68  
69  	static final String ATOM_TYPE_EXPECTED = "Atom type expected";
70  	static final String INTEGER_TYPE_EXPECTED = "Integer type expected";
71  	static final String FLOAT_TYPE_EXPECTED = "Float type expected";
72  	static final String VARIABLE_TYPE_EXPECTED = "Variable type expected";
73  	static final String STRUCTURE_TYPE_EXPECTED = "Structure type expected";
74  	static final String LIST_TYPE_EXPECTED = "List type expected";
75  	static final String NUMBER_EXPECTED_TYPES = "Number type expected";
76  	static final String CALLABLE_EXPECTED_TYPES = "Callable type expected";
77  	static final String CHARACTER_TYPE_EXPECTED = "Character type expected";
78  	static final String EXPRESSION_TYPE_EXPECTED = "Expression type expected";
79  	static final String OBJECT_TYPE_EXPECTED = "Java Object type expected";
80  	static final String STREAM_TYPE_EXPECTED = "Stream type expected";
81  	static final String WRON_CHAR_REPRESENTATION = "Wron character representation";
82  	static final String WRON_INTEGER_REPRESENTATION = "Wron integer representation";
83  	static final String ARGUMENTS_INSTANTATION_ERROR = "Arguments are not sufficiently instantiated";
84  	static final String TYPE_ERROR = "Type error";
85  	static final String HEAD_NOT_ATOM = "The head of the list is not an atom term";
86  	static final String ILLEGAL_NUMBER_REPRESENTATION = "Illegal number reresentation";
87  	static final String NOT_PROLOG_TERM_INSTANCE = "The object is not prolog term instance";
88  	static final String LEFT_TERM_EXPECTED = "The expression don't have defined most left term";
89  	static final String IMPOSSIBLE_UPDATE = "Impossible update for diferent clauses keys";
90  	static final String ILLEGAL_OPERATOR_PRIORITY = "Not valid operator prority";
91  	static final String ILLEGAL_OPERATOR_SPECIFIER = "Not valid operator specifier";
92  
93  	public PrologError(String message) {
94  		super(message);
95  	}
96  
97  	public PrologError(String message, Throwable t) {
98  		super(message + "\n Caused by: " + t);
99  	}
100 
101 }