aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-07-20 20:18:12 +0800
committerMu Qiao <qiaomuf@gentoo.org>2011-07-20 23:15:43 +0800
commit1d9a50c973025c3c1e9d48f3b2e0a8b7baf41278 (patch)
tree409879b967abec1657b6f99d49d3ebad463c9ccd /src
parentParser: add rules to perform bash expansions (diff)
downloadlibbash-1d9a50c973025c3c1e9d48f3b2e0a8b7baf41278.tar.gz
libbash-1d9a50c973025c3c1e9d48f3b2e0a8b7baf41278.tar.bz2
libbash-1d9a50c973025c3c1e9d48f3b2e0a8b7baf41278.zip
Walker: reimplement runtime for parameter expansion
Diffstat (limited to 'src')
-rw-r--r--src/core/bash_ast.cpp10
-rw-r--r--src/core/bash_ast.h8
2 files changed, 18 insertions, 0 deletions
diff --git a/src/core/bash_ast.cpp b/src/core/bash_ast.cpp
index 3787f84..213264c 100644
--- a/src/core/bash_ast.cpp
+++ b/src/core/bash_ast.cpp
@@ -211,6 +211,11 @@ long bash_ast::walker_arithmetics(plibbashWalker tree_parser)
return tree_parser->arithmetics(tree_parser);
}
+std::string bash_ast::walker_string_expr(libbashWalker_Ctx_struct* tree_parser)
+{
+ return tree_parser->string_expr(tree_parser).libbash_value;
+}
+
pANTLR3_BASE_TREE bash_ast::parser_start(plibbashParser parser)
{
return parser->start(parser).tree;
@@ -221,6 +226,11 @@ pANTLR3_BASE_TREE bash_ast::parser_arithmetics(plibbashParser parser)
return parser->arithmetics(parser).tree;
}
+pANTLR3_BASE_TREE bash_ast::parser_all_expansions(libbashParser_Ctx_struct* parser)
+{
+ return parser->all_expansions(parser).tree;
+}
+
void bash_ast::call_function(plibbashWalker ctx,
ANTLR3_MARKER index)
{
diff --git a/src/core/bash_ast.h b/src/core/bash_ast.h
index 1dd7be2..8aa291a 100644
--- a/src/core/bash_ast.h
+++ b/src/core/bash_ast.h
@@ -92,6 +92,10 @@ public:
/// \param tree_parser the pointer to the tree_parser
static long walker_arithmetics(libbashWalker_Ctx_struct* tree_parser);
+ /// \brief the functor for walker string_expr rule
+ /// \param tree_parser the pointer to the tree_parser
+ static std::string walker_string_expr(libbashWalker_Ctx_struct* tree_parser);
+
/// \brief call a function that is defined in the AST
/// \param tree_parser the pointer to the tree_parser
/// \param index the function index
@@ -106,6 +110,10 @@ public:
/// \param parser the pointer to the parser
static pANTLR3_BASE_TREE parser_arithmetics(libbashParser_Ctx_struct* parser);
+ /// \brief the functor for parser all_expansions rule
+ /// \param parser the pointer to the parser
+ static pANTLR3_BASE_TREE parser_all_expansions(libbashParser_Ctx_struct* parser);
+
///
/// \brief interpret the script with a given interpreter
/// \param walker the interpreter object