summaryrefslogtreecommitdiffstats
path: root/edify/parser.y
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2009-06-15 06:12:26 +0200
committerThe Android Open Source Project <initial-contribution@android.com>2009-06-15 06:12:26 +0200
commit84cbfb6cb4a82824a662137282c689f40057b28b (patch)
tree30b5d33a047b5ae2eb86f53fa16de49d47486b1f /edify/parser.y
parentam 8edb00c9: edify extensions for OTA package installation, part 2 (diff)
parentfixes to edify and updater script (diff)
downloadandroid_bootable_recovery-84cbfb6cb4a82824a662137282c689f40057b28b.tar
android_bootable_recovery-84cbfb6cb4a82824a662137282c689f40057b28b.tar.gz
android_bootable_recovery-84cbfb6cb4a82824a662137282c689f40057b28b.tar.bz2
android_bootable_recovery-84cbfb6cb4a82824a662137282c689f40057b28b.tar.lz
android_bootable_recovery-84cbfb6cb4a82824a662137282c689f40057b28b.tar.xz
android_bootable_recovery-84cbfb6cb4a82824a662137282c689f40057b28b.tar.zst
android_bootable_recovery-84cbfb6cb4a82824a662137282c689f40057b28b.zip
Diffstat (limited to 'edify/parser.y')
-rw-r--r--edify/parser.y31
1 files changed, 19 insertions, 12 deletions
diff --git a/edify/parser.y b/edify/parser.y
index cf163c026..3f9ade144 100644
--- a/edify/parser.y
+++ b/edify/parser.y
@@ -20,6 +20,7 @@
#include <string.h>
#include "expr.h"
+#include "yydefs.h"
#include "parser.h"
extern int gLine;
@@ -30,6 +31,8 @@ int yyparse(Expr** root, int* error_count);
%}
+%locations
+
%union {
char* str;
Expr* expr;
@@ -68,19 +71,21 @@ expr: STRING {
$$->name = $1;
$$->argc = 0;
$$->argv = NULL;
+ $$->start = @$.start;
+ $$->end = @$.end;
}
-| '(' expr ')' { $$ = $2; }
-| expr ';' { $$ = $1; }
-| expr ';' expr { $$ = Build(SequenceFn, 2, $1, $3); }
-| error ';' expr { $$ = $3; }
-| expr '+' expr { $$ = Build(ConcatFn, 2, $1, $3); }
-| expr EQ expr { $$ = Build(EqualityFn, 2, $1, $3); }
-| expr NE expr { $$ = Build(InequalityFn, 2, $1, $3); }
-| expr AND expr { $$ = Build(LogicalAndFn, 2, $1, $3); }
-| expr OR expr { $$ = Build(LogicalOrFn, 2, $1, $3); }
-| '!' expr { $$ = Build(LogicalNotFn, 1, $2); }
-| IF expr THEN expr ENDIF { $$ = Build(IfElseFn, 2, $2, $4); }
-| IF expr THEN expr ELSE expr ENDIF { $$ = Build(IfElseFn, 3, $2, $4, $6); }
+| '(' expr ')' { $$ = $2; $$->start=@$.start; $$->end=@$.end; }
+| expr ';' { $$ = $1; $$->start=@1.start; $$->end=@1.end; }
+| expr ';' expr { $$ = Build(SequenceFn, @$, 2, $1, $3); }
+| error ';' expr { $$ = $3; $$->start=@$.start; $$->end=@$.end; }
+| expr '+' expr { $$ = Build(ConcatFn, @$, 2, $1, $3); }
+| expr EQ expr { $$ = Build(EqualityFn, @$, 2, $1, $3); }
+| expr NE expr { $$ = Build(InequalityFn, @$, 2, $1, $3); }
+| expr AND expr { $$ = Build(LogicalAndFn, @$, 2, $1, $3); }
+| expr OR expr { $$ = Build(LogicalOrFn, @$, 2, $1, $3); }
+| '!' expr { $$ = Build(LogicalNotFn, @$, 1, $2); }
+| IF expr THEN expr ENDIF { $$ = Build(IfElseFn, @$, 2, $2, $4); }
+| IF expr THEN expr ELSE expr ENDIF { $$ = Build(IfElseFn, @$, 3, $2, $4, $6); }
| STRING '(' arglist ')' {
$$ = malloc(sizeof(Expr));
$$->fn = FindFunction($1);
@@ -93,6 +98,8 @@ expr: STRING {
$$->name = $1;
$$->argc = $3.argc;
$$->argv = $3.argv;
+ $$->start = @$.start;
+ $$->end = @$.end;
}
;