summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2018-06-14 11:57:13 +0530
committerSunil Shetye2018-06-14 11:57:13 +0530
commitcaafd891713bfb1f0df708737b18a8a18d542325 (patch)
treef0bc40d5f7bd16717afe87baf0d96d2456fc4ee1
parent1df154abb3a2be1de529b3c06701f8c7485de1d0 (diff)
downloadsci2js-caafd891713bfb1f0df708737b18a8a18d542325.tar.gz
sci2js-caafd891713bfb1f0df708737b18a8a18d542325.tar.bz2
sci2js-caafd891713bfb1f0df708737b18a8a18d542325.zip
add support for function block
-rwxr-xr-xsci2jsyacc.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/sci2jsyacc.py b/sci2jsyacc.py
index bf5dc5fd..3dd1904f 100755
--- a/sci2jsyacc.py
+++ b/sci2jsyacc.py
@@ -11,7 +11,15 @@ precedence = (
('right', 'UNARYADDITION'),
)
-start = 'statementblock'
+start = 'functionblock'
+
+# define functionblock
+
+def p_functionblock_function_statementblock_endfunction(p):
+ 'functionblock : emptystatementblock FUNCTION lterm ASSIGNMENT VAR OPENBRACKET list CLOSEBRACKET EOL statementblock ENDFUNCTION EOL'
+ p[0] = str(p[5])
+
+# end define functionblock
# define statementblock
@@ -23,6 +31,11 @@ def p_statementblock_statement(p):
'statementblock : statement'
p[0] = str(p[1])
+def p_emptystatementblock_eol(p):
+ '''emptystatementblock : emptystatementblock EOL
+ | EOL'''
+ p[0] = str(p[1])
+
# end define statementblock
# define statement
@@ -35,7 +48,7 @@ def p_statement_assignment(p):
def p_statement_eol(p):
'statement : EOL'
- pass
+ p[0] = ''
# end define statement