diff src/luan/impl/LuanParser.java @ 1680:9ef19f5ea973

add // operator
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 02 Jun 2022 22:34:55 -0600
parents eb89db694225
children 6061be2cd84b
line wrap: on
line diff
--- a/src/luan/impl/LuanParser.java	Tue May 31 15:39:58 2022 -0600
+++ b/src/luan/impl/LuanParser.java	Thu Jun 02 22:34:55 2022 -0600
@@ -1030,16 +1030,29 @@
 				newExp.add( ")" );
 				exp = newExp;
 			} else if( parser.match('/') ) {
-				Spaces();
-				exp = exp.single();
-				Expr exp2 = required(UnaryExpr()).single();
-				Expr newExp = new Expr(Val.SINGLE,false);
-				newExp.add( "LuanImpl.div(luan," );
-				newExp.addAll( exp );
-				newExp.add( "," );
-				newExp.addAll( exp2 );
-				newExp.add( ")" );
-				exp = newExp;
+				if( parser.match('/') ) {
+					Spaces();
+					exp = exp.single();
+					Expr exp2 = required(UnaryExpr()).single();
+					Expr newExp = new Expr(Val.SINGLE,false);
+					newExp.add( "LuanImpl.idiv(luan," );
+					newExp.addAll( exp );
+					newExp.add( "," );
+					newExp.addAll( exp2 );
+					newExp.add( ")" );
+					exp = newExp;
+				} else {
+					Spaces();
+					exp = exp.single();
+					Expr exp2 = required(UnaryExpr()).single();
+					Expr newExp = new Expr(Val.SINGLE,false);
+					newExp.add( "LuanImpl.div(luan," );
+					newExp.addAll( exp );
+					newExp.add( "," );
+					newExp.addAll( exp2 );
+					newExp.add( ")" );
+					exp = newExp;
+				}
 			} else if( Mod() ) {
 				Spaces();
 				exp = exp.single();