From 4c6a2bc6b50a6529fdc53986492a5bcde247aeb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Teichgr=C3=A4ber?= Date: Sat, 21 Apr 2012 23:06:04 +0200 Subject: [PATCH] parser.leg: move concat_str_list implementation into mk_str_from_list --- parser.leg | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/parser.leg b/parser.leg index 0bddc22..a7af8de 100644 --- a/parser.leg +++ b/parser.leg @@ -864,17 +864,6 @@ func reverse(list *element) (new *element) { return } -/* concat_string_list - concatenates string contents of list of STR elements. - */ -func concat_string_list(list *element) string { - s := "" - for list != nil { - s += list.contents.str - list = list.next - } - return s -} - /* * Auxiliary functions for parsing actions. @@ -912,7 +901,11 @@ func mk_str(s string) (result *element) { * reversed list of strings, adding optional extra newline */ func mk_str_from_list(list *element, extra_newline bool) (result *element) { - s := concat_string_list(reverse(list)) + s := "" + for list = reverse(list); list != nil; list = list.next { + s += list.contents.str + } + if extra_newline { s += "\n" }