static bool builtin_constant_p(struct psi_cpp *cpp, struct psi_token *target, struct psi_plist **args, struct psi_plist **res);
static bool BASE_FILE__(struct psi_cpp *cpp, struct psi_token *target, struct psi_plist **args, struct psi_plist **res);
static bool COUNTER__(struct psi_cpp *cpp, struct psi_token *target, struct psi_plist **args, struct psi_plist **res);
+static bool FILE__(struct psi_cpp *cpp, struct psi_token *target, struct psi_plist **args, struct psi_plist **res);
static bool INCLUDE_LEVEL__(struct psi_cpp *cpp, struct psi_token *target, struct psi_plist **args, struct psi_plist **res);
+static bool LINE__(struct psi_cpp *cpp, struct psi_token *target, struct psi_plist **args, struct psi_plist **res);
static bool TIMESTAMP__(struct psi_cpp *cpp, struct psi_token *target, struct psi_plist **args, struct psi_plist **res);
static inline struct psi_plist *builtin_sig(token_t typ, ...)
PSI_BUILTIN(BASE_FILE__, -1);
PSI_BUILTIN(COUNTER__, -1);
+ PSI_BUILTIN(FILE__, -1);
PSI_BUILTIN(INCLUDE_LEVEL__, -1);
+ PSI_BUILTIN(LINE__, -1);
PSI_BUILTIN(TIMESTAMP__, -1);
return SUCCESS;
return true;
}
+static bool FILE__(struct psi_cpp *cpp, struct psi_token *target,
+ struct psi_plist **args, struct psi_plist **res)
+{
+ ADD_QUOTED_ZSTRING(target->file);
+ return true;
+}
+
static bool INCLUDE_LEVEL__(struct psi_cpp *cpp, struct psi_token *target,
struct psi_plist **args, struct psi_plist **res)
{
return true;
}
+static bool LINE__(struct psi_cpp *cpp, struct psi_token *target,
+ struct psi_plist **args, struct psi_plist **res)
+{
+ ADD_UNSIGNED_NUMBER(target->line);
+ return true;
+}
+
static bool TIMESTAMP__(struct psi_cpp *cpp, struct psi_token *target,
struct psi_plist **args, struct psi_plist **res)
{
===TEST===
<?php
var_dump(CPP_TEST0, CPP_TEST1, CPP_TEST2, CPP_TEST3, CPP_TEST4, CPP_TEST5);
-var_dump(base_file, include_level, timestamp);
+var_dump(base_file, include_level, timestamp, file, line);
?>
===DONE===
--EXPECTF--
string(%d) "%s/tests/parser/cpp004/builtins.psi"
int(2)
string(24) "%s %s %w%d %d:%d:%d %d"
+string(54) "/%s/tests/parser/cpp004/include_level.h"
+int(3)
===DONE===