From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QSTio-0002aA-NU for garchives@archives.gentoo.org; Fri, 03 Jun 2011 12:43:27 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1654A1C0CD; Fri, 3 Jun 2011 12:43:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D6E0C1C0CD for ; Fri, 3 Jun 2011 12:43:18 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 704A01BC013 for ; Fri, 3 Jun 2011 12:43:18 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id CE94E8050A for ; Fri, 3 Jun 2011 12:43:17 +0000 (UTC) From: "Petteri Räty" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Petteri Räty" Message-ID: <85725730eaaafbbf3afeb7a220d21c42e2b2d836.betelgeuse@gentoo> Subject: [gentoo-commits] proj/libbash:master commit in: / X-VCS-Repository: proj/libbash X-VCS-Committer: betelgeuse X-VCS-Committer-Name: Petteri Räty X-VCS-Revision: 85725730eaaafbbf3afeb7a220d21c42e2b2d836 Date: Fri, 3 Jun 2011 12:43:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 0bca0537aee806852bc514a66ea981f7 commit: 85725730eaaafbbf3afeb7a220d21c42e2b2d836 Author: Petteri R=C3=A4ty petteriraty eu> AuthorDate: Fri Jun 3 12:39:17 2011 +0000 Commit: Petteri R=C3=A4ty gentoo org> CommitDate: Fri Jun 3 12:39:28 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/libbash.git;a= =3Dcommit;h=3D85725730 Merge remote-tracking branch 'mu/keyword_test' into review Conflicts: src/builtins/let_builtin.cpp src/core/interpreter.cpp bashast/libbashWalker.g | 19 +++++++--- scripts/test_expr.bash | 10 +++++ scripts/test_expr.bash.result | 4 ++ src/builtins/let_builtin.cpp | 9 ++--- src/core/bash_condition.cpp | 17 +++++---- src/core/bash_condition.h | 5 ++- src/core/interpreter.cpp | 7 ++++ src/core/interpreter.h | 5 +++ src/core/tests/bash_condition_test.cpp | 62 ++++++++++++++++++--------= ------ 9 files changed, 92 insertions(+), 46 deletions(-) diff --cc src/builtins/let_builtin.cpp index b1dd9b7,97785ab..5f1f9e5 --- a/src/builtins/let_builtin.cpp +++ b/src/builtins/let_builtin.cpp @@@ -23,10 -24,9 +23,8 @@@ #include =20 #include - #include -=20 - #include "core/bash_ast.h" =20 -#include "core/bash_ast.h" - ++#include "core/interpreter.h" #include "builtins/let_builtin.h" =20 int let_builtin::exec(const std::vector& bash_args) diff --cc src/core/interpreter.cpp index d3c078e,83fd29a..ce1d2d8 --- a/src/core/interpreter.cpp +++ b/src/core/interpreter.cpp @@@ -419,10 -414,8 +420,16 @@@ void interpreter::set_option(const std: iter->second =3D value; } =20 +int interpreter::exp(int left, int right) +{ + int init =3D 1; + while(right--) + init *=3D left; + return init; +} ++ + int interpreter::eval_arithmetic(const std::string& expression) + { + bash_ast ast(std::stringstream(expression), &bash_ast::parser_arithme= tics); + return ast.interpret_with(*this, &bash_ast::walker_arithmetics); + }