The unified diff between revisions [6726c07e..] and [adff2b70..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'src/lsc/ast.c'

#
# old_revision [6726c07e4874e76763555e1476ce427743e8f73c]
# new_revision [adff2b70cc1870df9f9b4d736b855dffae74eca2]
#
# patch "src/lsc/ast.c"
#  from [38b009ee4723c4e585350f483aa20ae113304362]
#    to [d0c7066749da60adc317b58c4630de00a072a23f]
#
============================================================
--- src/lsc/ast.c	38b009ee4723c4e585350f483aa20ae113304362
+++ src/lsc/ast.c	d0c7066749da60adc317b58c4630de00a072a23f
@@ -7,6 +7,8 @@
 #include "ast.h"
 #include "mem.h"
 
+extern int yylineno;
+
 ast_list *make_list(ast *elem, ast_list *tail)
 {
 	ast_list *list = safe_malloc(sizeof(ast_list));
@@ -39,6 +41,7 @@ ast *make_list_node(ast_list *list)
 	elem->tag = node_ast;
 	elem->info.node.tag = kind_list;
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -49,6 +52,7 @@ ast *make_string(char *string)
 
 	elem->tag = str_ast;
 	elem->info.string = string;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -59,6 +63,7 @@ ast *make_integer(long integer)
 
 	elem->tag = int_ast;
 	elem->info.integer = integer;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -69,6 +74,7 @@ ast *make_real(float real)
 
 	elem->tag = real_ast;
 	elem->info.real = real;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -84,6 +90,7 @@ ast *make_function(char *identifier, ast
 	list = make_list(make_list_node(args), list);
 	list = make_list(make_string(identifier), list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -98,10 +105,26 @@ ast *make_fndefint(char *identifier, lon
 	list = make_list(make_integer(num), list);
 	list = make_list(make_string(identifier), list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
 
+ast *make_fndefint_v(char *identifier, long num)
+{
+	ast *elem = safe_malloc(sizeof(ast));
+	ast_list *list = NULL;
+
+	elem->tag = node_ast;
+	elem->info.node.tag = kind_fndefint_v;
+	list = make_list(make_integer(num), list);
+	list = make_list(make_string(identifier), list);
+	elem->info.node.head = list;
+	elem->lineno = yylineno;
+
+	return elem;
+}
+
 ast *make_constant(char *identifier, long num)
 {
 	ast *elem = safe_malloc(sizeof(ast));
@@ -112,6 +135,7 @@ ast *make_constant(char *identifier, lon
 	list = make_list(make_integer(num), list);
 	list = make_list(make_string(identifier), list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -126,6 +150,7 @@ ast *make_realconstant(char *identifier,
 	list = make_list(make_real(num), list);
 	list = make_list(make_string(identifier), list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -139,6 +164,7 @@ ast *make_fndefext(char *identifier)
 	elem->info.node.tag = kind_fndefext;
 	list = make_list(make_string(identifier), list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -149,6 +175,7 @@ ast *make_variable(char *identifier)
 
 	elem->tag = var_ast;
 	elem->info.variable = identifier;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -163,6 +190,7 @@ ast *make_array(char *identifier, ast *e
 	list = make_list(expression, NULL);
 	list = make_list(make_variable(identifier), list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -178,6 +206,7 @@ ast *make_assignment(char *identifier, a
 	list = make_list(expression, NULL);
 	list = make_list(make_variable(identifier), list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -193,6 +222,7 @@ ast *make_assignment(ast_list *identifie
 	list = make_list(expression, NULL);
 	list = make_list(make_list_node(identifier_list), list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -207,6 +237,7 @@ ast *make_binary_op(ast_kind op, ast *ex
 	list = make_list(exp2, NULL);
 	list = make_list(exp1, list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -220,6 +251,7 @@ ast *make_unary_op(ast_kind op, ast *exp
 	elem->info.node.tag = op;
 	list = make_list(exp1, NULL);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -234,6 +266,7 @@ ast *make_call(char *identifier, ast_lis
 	list = make_list(make_list_node(args), NULL);
 	list = make_list(make_string(identifier), list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -252,6 +285,7 @@ ast *make_statement(ast_kind type, ast *
 	list = make_list(make_list_node(statements), list);
 	list = make_list(expression, list);
 	elem->info.node.head = list;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -262,6 +296,7 @@ ast *make_case_statement_variable(char *
 
 	elem->tag = casevar_ast;
 	elem->info.variable = identifier;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -272,17 +307,19 @@ ast *make_case_statement_number(long num
 
 	elem->tag = casenum_ast;
 	elem->info.integer = num;
+	elem->lineno = yylineno;
 
 	return elem;
 }
 
-ast *make_return_statement(void)
+ast *make_return_statement(ast *expression)
 {
 	ast *elem = safe_malloc(sizeof(ast));
 
 	elem->tag = node_ast;
 	elem->info.node.tag = stmt_return;
-	elem->info.node.head = NULL;
+	elem->info.node.head = make_list(expression, NULL);
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -294,6 +331,7 @@ ast *make_break_statement(void)
 	elem->tag = node_ast;
 	elem->info.node.tag = stmt_break;
 	elem->info.node.head = NULL;
+	elem->lineno = yylineno;
 
 	return elem;
 }
@@ -305,6 +343,7 @@ ast *make_default_statement(void)
 	elem->tag = node_ast;
 	elem->info.node.tag = stmt_default;
 	elem->info.node.head = NULL;
+	elem->lineno = yylineno;
 
 	return elem;
 }