From: Jay Freeman (saurik) Date: Thu, 31 Dec 2015 21:13:11 +0000 (-0800) Subject: Hide complicated hold manipulation behind CYHLD(). X-Git-Tag: v0.9.590~106 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/197e361cb64ce8262bbc917fd93a22a0f65db27b?ds=inline Hide complicated hold manipulation behind CYHLD(). --- diff --git a/Parser.ypp.in b/Parser.ypp.in index 5efee05..c2927f2 100644 --- a/Parser.ypp.in +++ b/Parser.ypp.in @@ -184,6 +184,13 @@ type; }) yyla.type = yytranslate_(token::to); \ } while (false) +#define CYHLD(location, token) do { \ + if (driver.hold_ != empty_symbol) \ + CYERR(location, "unexpected hold"); \ + driver.hold_ = yyla.type; \ + yyla.type = yytranslate_(token); \ +} while (false) + #define CYERR(location, message) do { \ error(location, message); \ YYABORT; \ @@ -778,11 +785,11 @@ LexPushYieldOff: { driver.yield_.push(false); }; LexPopYield: { driver.yield_.pop(); }; LexNewLineOrOpt - : { CYLEX(); if (driver.hold_ != empty_symbol) CYERR(@$, "unexpected hold"); if (driver.newline_) { driver.hold_ = yyla.type; yyla.type = yytranslate_(cy::parser::token::NewLine); } } + : { CYLEX(); if (driver.newline_) { CYHLD(@$, tk::NewLine); } } ; LexNewLineOrNot - : { CYLEX(); if (driver.hold_ != empty_symbol) CYERR(@$, "unexpected hold"); driver.hold_ = yyla.type; yyla.type = yytranslate_(driver.newline_ ? cy::parser::token::NewLine : cy::parser::token::__); } + : { CYLEX(); CYHLD(@$, driver.newline_ ? tk::NewLine : tk::__); } ; LexNoStar