From fc33fd86b7727365caab44c05a90d5b52209131b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 18 Nov 2013 20:14:54 +0100 Subject: Add a symbol __curPos that expands to the current source location I.e. an attribute set { file = ; line = ; column = ; }. --- src/libexpr/parser.y | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/libexpr/parser.y') diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index b4f72e599..7699cf502 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -355,7 +355,12 @@ expr_select ; expr_simple - : ID { $$ = new ExprVar(CUR_POS, data->symbols.create($1)); } + : ID { + if (strcmp($1, "__curPos") == 0) + $$ = new ExprPos(CUR_POS); + else + $$ = new ExprVar(CUR_POS, data->symbols.create($1)); + } | INT { $$ = new ExprInt($1); } | '"' string_parts '"' { /* For efficiency, and to simplify parse trees a bit. */ -- cgit v1.2.3