From b50c7e99603e9f85d82d700d62c16c4fcef88715 Mon Sep 17 00:00:00 2001
From: Geno <48206120+gabrielegenovese@users.noreply.github.com>
Date: Thu, 11 Jul 2024 12:57:56 +0200
Subject: Code generation (#20)

Co-authored-by: geno <gabrigeno@gmail>
Co-authored-by: Santo Cariotti <santo@dcariotti.me>
---
 src/ast/Python3VisitorImpl.java | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

(limited to 'src/ast/Python3VisitorImpl.java')

diff --git a/src/ast/Python3VisitorImpl.java b/src/ast/Python3VisitorImpl.java
index 1cf15b7..98ede6d 100644
--- a/src/ast/Python3VisitorImpl.java
+++ b/src/ast/Python3VisitorImpl.java
@@ -336,7 +336,7 @@ public class Python3VisitorImpl extends Python3ParserBaseVisitor<Node> {
     }
 
     /**
-     * Returns a `CompNode`. It should never be null.
+     * Returns a `CompOpNode`. It should never be null.
      *
      * ``` comp_op : '<' | '>' | '==' | '>=' | '<=' | '<>' | '!=' | 'in' | 'not'
      * 'in' | 'is' | 'is' 'not' ; ```
@@ -344,24 +344,24 @@ public class Python3VisitorImpl extends Python3ParserBaseVisitor<Node> {
     public Node visitComp_op(Comp_opContext ctx) {
         Node comp = null;
         if (ctx.LESS_THAN() != null) {
-            comp = new CompNode(ctx.LESS_THAN());
+            comp = new CompOpNode(ctx.LESS_THAN());
         } else if (ctx.GREATER_THAN() != null) {
-            comp = new CompNode(ctx.GREATER_THAN());
+            comp = new CompOpNode(ctx.GREATER_THAN());
         } else if (ctx.EQUALS() != null) {
-            comp = new CompNode(ctx.EQUALS());
+            comp = new CompOpNode(ctx.EQUALS());
         } else if (ctx.GT_EQ() != null) {
-            comp = new CompNode(ctx.GT_EQ());
+            comp = new CompOpNode(ctx.GT_EQ());
         } else if (ctx.LT_EQ() != null) {
-            comp = new CompNode(ctx.LT_EQ());
+            comp = new CompOpNode(ctx.LT_EQ());
         } else if (ctx.NOT_EQ_2() != null) {
             // We're ignoring NOT_EQ_1() because no one uses `<>`
-            comp = new CompNode(ctx.NOT_EQ_2());
+            comp = new CompOpNode(ctx.NOT_EQ_2());
         } else if (ctx.IN() != null) {
-            comp = new CompNode(ctx.IN());
+            comp = new CompOpNode(ctx.IN());
         } else if (ctx.NOT() != null) {
-            comp = new CompNode(ctx.NOT());
+            comp = new CompOpNode(ctx.NOT());
         } else if (ctx.IS() != null) {
-            comp = new CompNode(ctx.IS());
+            comp = new CompOpNode(ctx.IS());
         }
 
         return comp;
@@ -396,6 +396,14 @@ public class Python3VisitorImpl extends Python3ParserBaseVisitor<Node> {
             op = ctx.NOT().toString();
         }
 
+        if (ctx.AND() != null) {
+            op = ctx.AND().toString();
+        }
+
+        if (ctx.OR() != null) {
+            op = ctx.OR().toString();
+        }
+
         if (ctx.STAR() != null) {
             op = ctx.STAR().toString();
         }
@@ -404,6 +412,10 @@ public class Python3VisitorImpl extends Python3ParserBaseVisitor<Node> {
             op = ctx.DIV().toString();
         }
 
+        if (ctx.MOD() != null) {
+            op = ctx.MOD().toString();
+        }
+
         if (ctx.atom() != null) {
             atom = visit(ctx.atom());
         }
-- 
cgit v1.2.3-18-g5258