summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-05-31 17:07:42 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-05-31 17:07:42 +0200
commit42117720963873e57c3092d9249ffbfe5ca0aa18 (patch)
tree698243a527d35f3072ff9ff200635a091ac246e1
parent6fea30e26cf1486b9bb862c3f9a2079617c2332f (diff)
downloadhastabel-master.zip
hastabel-master.tar.bz2
Prepares for solution printing...HEADmaster
-rw-r--r--src/hastabel/LangLexer.g41
-rw-r--r--src/hastabel/LangParser.g420
-rw-r--r--src/hastabel/lang/Predicate.java11
3 files changed, 32 insertions, 0 deletions
diff --git a/src/hastabel/LangLexer.g4 b/src/hastabel/LangLexer.g4
index 2de366f..fc72bf0 100644
--- a/src/hastabel/LangLexer.g4
+++ b/src/hastabel/LangLexer.g4
@@ -14,6 +14,7 @@ STAR: '*';
ADD_TYPE_KW: 'add_type' SEP;
ADD_PREDICATE_KW: 'add_predicate' SEP;
+ADD_NAMING_KW: 'add_naming' SEP;
ADD_FUNCTION_KW: 'add_function' SEP;
ADD_TEMPLATE_KW: 'add_template' SEP;
diff --git a/src/hastabel/LangParser.g4 b/src/hastabel/LangParser.g4
index 19f2ea0..a5146b3 100644
--- a/src/hastabel/LangParser.g4
+++ b/src/hastabel/LangParser.g4
@@ -45,6 +45,10 @@ lang_instr:
{
}
+ | (WS)* ADD_NAMING_KW (WS)* new_naming (WS)*
+ {
+ }
+
| (WS)* ADD_TEMPLATE_KW (WS)* new_template (WS)*
{
}
@@ -164,6 +168,22 @@ new_type:
}
;
+new_naming:
+ ID (WS)* L_PAREN (WS)* ident_list (WS)* R_PAREN
+ {
+ final Predicate pred;
+
+ pred = WORLD.get_predicates_manager().get(($ID.text));
+
+ if (pred == null)
+ {
+ WORLD.invalidate();
+ }
+
+ pred.set_naming(($ident_list.list));
+ }
+;
+
new_predicate:
ID (WS)* L_PAREN (WS)* ident_list (WS)* R_PAREN
{
diff --git a/src/hastabel/lang/Predicate.java b/src/hastabel/lang/Predicate.java
index 2cdafb0..b196bbb 100644
--- a/src/hastabel/lang/Predicate.java
+++ b/src/hastabel/lang/Predicate.java
@@ -16,6 +16,7 @@ public class Predicate
private final Type function_type;
private final Set<List<Element>> members;
private final String name;
+ private List<String> naming;
private boolean can_be_used_as_function;
private boolean is_used_as_predicate, is_used_as_function;
@@ -104,6 +105,16 @@ public class Predicate
add_member(params);
}
+ public void set_naming (final List<String> naming)
+ {
+ this.naming = naming;
+ }
+
+ public List<String> get_naming ()
+ {
+ return naming;
+ }
+
private boolean add_partial_signature
(
final List<Type> partial_signature