aboutsummaryrefslogtreecommitdiff
path: root/lib/forlangrm.y
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-10-01 11:14:58 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2012-10-01 11:14:58 +0300
commit78b25d9756403fef919684738f7aecb2cdcee465 (patch)
treed43f312f8f994be9d485dcc9c7c8ded3f415898f /lib/forlangrm.y
parentf2ce145a8d27d18db064fc35313b7495f868b18b (diff)
downloadeclat-78b25d9756403fef919684738f7aecb2cdcee465.tar.gz
eclat-78b25d9756403fef919684738f7aecb2cdcee465.tar.bz2
Implement get-console-output command.
* etc/Makefile.am: Add new files. * etc/get-console-output.fln: New file. * lib/forlan.c: New built-in function "decode". * lib/forlangrm.y: Fix grammar to allow functions to return any data type, not only node. * src/Makefile.am (eclat_SOURCES): Add new files. * src/eclat.c: Register get-console-output command. * src/eclat.h (eclat_get_console_output): New proto. * src/getconout.c: New file. * tests/Makefile.am: Add new files. * tests/testsuite.at: Include new files. * tests/decode.at: New test case. * tests/get-console-output.at: New test case. * tests/last.at: Minor change.
Diffstat (limited to 'lib/forlangrm.y')
-rw-r--r--lib/forlangrm.y29
1 files changed, 12 insertions, 17 deletions
diff --git a/lib/forlangrm.y b/lib/forlangrm.y
index 6261c5e..884ff1e 100644
--- a/lib/forlangrm.y
+++ b/lib/forlangrm.y
@@ -66,11 +66,11 @@ free_comp(void *p)
%left AND
%left NOT
-%type <node> stmt stmt_cond stmt_expr stmt_blk cond bool node funcall arg
+%type <node> stmt stmt_cond stmt_expr stmt_blk cond bool node funcall arg rval
%type <node> stmt_let stmt_for stmt_ctrl stmt_asgn
%type <list> stmtlist arglist
-%type <complist> complist
%type <string> string
+%type <complist> complist
%type <comp> comp
%%
@@ -158,16 +158,8 @@ bool : node
}
;
-node : funcall
- {
- $$ = forlan_node_create(forlan_type_comp);
- $$->comp.root = $1;
- $$->comp.wildcards = 0;
- $$->comp.argc = 0;
- $$->comp.argv = NULL;
- $$->comp.labelv = NULL;
- }
- | funcall '.' complist
+node : rval
+ | rval '.' complist
{
$$ = create_comp_node($1, $3.list, $3.wildcards);
}
@@ -297,6 +289,14 @@ funcall : IDENT '(' ')'
}
;
+rval : funcall
+ | STRING
+ {
+ $$ = forlan_node_create(forlan_type_lit);
+ $$->lit.string = $1;
+ }
+ ;
+
arglist : arg
{
$$ = forlan_stmt_list();
@@ -310,11 +310,6 @@ arglist : arg
;
arg : node
- | STRING
- {
- $$ = forlan_node_create(forlan_type_lit);
- $$->lit.string = $1;
- }
;
stmt_expr : funcall ';'

Return to:

Send suggestions and report system problems to the System administrator.