From c6fc6f718951de807ba2f8d855b9473952d8331c Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Mon, 20 Feb 2017 11:40:35 +0100
Subject: [PATCH] Accept node call with no argument.

---
 src/lic2soc.ml               |  5 ++++-
 src/lv6parser.mly            |  5 ++++-
 src/lv6version.ml            |  4 ++--
 test/should_work/noinput.lus | 25 +++++++++++++++++++++++++
 test/should_work/sqrt.lus    |  6 ++++++
 5 files changed, 41 insertions(+), 4 deletions(-)
 create mode 100644 test/should_work/noinput.lus
 create mode 100644 test/should_work/sqrt.lus

diff --git a/src/lic2soc.ml b/src/lic2soc.ml
index 6ce04a93..e29497d3 100644
--- a/src/lic2soc.ml
+++ b/src/lic2soc.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 10/01/2017 (at 17:27) by Erwan Jahier> *)
+(** Time-stamp: <modified the 20/02/2017 (at 11:38) by Erwan Jahier> *)
 
 (* XXX ce module est mal écrit. A reprendre. (R1) *)
  
@@ -418,9 +418,12 @@ let rec (is_a_sub_clock : Lic.clock -> Lic.clock -> bool) =
 *)
 let (clock_of_expr : Lic.val_exp -> Lic.clock) =
   function
+  | { ve_core = CallByPosLic({it=CALL _}, []) } ->
+     BaseLic (* the clock of a node with no arg is the base clock *)
     | { ve_core = CallByPosLic({it=CALL _}, args) } ->
         let clks = List.map (fun arg -> arg.ve_clk) args in
         let clks = List.flatten clks in
+        assert(clks<>[]);
         List.fold_left 
           (fun ck1 ck2 -> 
               if is_a_sub_clock ck1 ck2 then ck2 else
diff --git a/src/lv6parser.mly b/src/lv6parser.mly
index 4a36b71c..f740196f 100644
--- a/src/lv6parser.mly
+++ b/src/lv6parser.mly
@@ -1180,7 +1180,10 @@ CallByNameParam:
         ;
 
 /* WARNING ! : les listes sont créées à l'envers */
-ExpressionList:   Expression
+ExpressionList:   
+		/* empty */
+        { [] }
+        |   Expression
                         { [$1] }
         |   ExpressionList TK_COMA Expression
                         { $3::$1 }
diff --git a/src/lv6version.ml b/src/lv6version.ml
index 7f74b50f..e514b997 100644
--- a/src/lv6version.ml
+++ b/src/lv6version.ml
@@ -1,7 +1,7 @@
 (** Automatically generated from Makefile *) 
 let tool = "lus2lic"
 let branch = "master"
-let commit = "681"
-let sha_1 = "2b8578b2a47f71b209731302d7216c1f25b600e7"
+let commit = "682"
+let sha_1 = "91120cfbec86724f356d936c3c991c01922002e7"
 let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")")
 let maintainer = "jahier@imag.fr"
diff --git a/test/should_work/noinput.lus b/test/should_work/noinput.lus
new file mode 100644
index 00000000..2e1ec9b9
--- /dev/null
+++ b/test/should_work/noinput.lus
@@ -0,0 +1,25 @@
+-- Time-stamp: <modified the 20/02/2017 (at 11:19) by Erwan Jahier>
+
+
+
+function foo() returns (x: bool);
+let
+   x = true;
+tel
+
+node bar(a: bool) returns (b: bool);
+let
+   b = foo() -> pre a;
+tel
+
+  -- FIXME:
+  -- XXX:
+ 
+node noinput(x1,x2:int) returns (y:int); 
+let
+  y = x1+ if bar(x2<0) then 1 else 0;
+tel
+  -- end of myplus
+
+  -- comment
+    
\ No newline at end of file
diff --git a/test/should_work/sqrt.lus b/test/should_work/sqrt.lus
new file mode 100644
index 00000000..580f57a5
--- /dev/null
+++ b/test/should_work/sqrt.lus
@@ -0,0 +1,6 @@
+extern function sqrt(x:real) returns (y:real);
+
+node test_sqrt(x:real) returns (y:real);
+let
+  y = sqrt(x);
+tel
\ No newline at end of file
-- 
GitLab