diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /web/yacco2/library/tblkup.w |
Initial commit
Diffstat (limited to 'web/yacco2/library/tblkup.w')
-rw-r--r-- | web/yacco2/library/tblkup.w | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/web/yacco2/library/tblkup.w b/web/yacco2/library/tblkup.w new file mode 100644 index 0000000000..989c8a47cd --- /dev/null +++ b/web/yacco2/library/tblkup.w @@ -0,0 +1,36 @@ +@q file: tblkup.w@> +@q% Copyright Dave Bone 1998 - 2015@> +@q% /*@> +@q% This Source Code Form is subject to the terms of the Mozilla Public@> +@q% License, v. 2.0. If a copy of the MPL was not distributed with this@> +@q% file, You can obtain one at http://mozilla.org/MPL/2.0/.@> +@q% */@> +@** Table lookup functor. Inheritance earns its keep. +See ``Yacco2 - symbol table'' document as an example of use. +@<Structure...@>+= +template @=<typename Functor>@> +struct functor2{ + struct functor{}; + void operator()(Functor* Func){Func->operator()();}; +};@/ +template @=<typename T>@>@/ +class tble_lkup : public std::unary_function@=<T,T>@>{ +public:@/ + tble_lkup():lkup__(ON){}; + ~tble_lkup(){}; + virtual T operator()(T t)=0; + void turn_off_lkup(){ + lkup__ = OFF;@/ +/// yacco2::lrclog << "TURN OFF TBLE LK" << std::endl; + }; + void turn_on_lkup(){ + lkup__ = ON;@/ +/// yacco2::lrclog << "TURN ON TBLE LK" << std::endl; + }; + bool lkup(){return lkup__;}; + bool lkup__; +}; + +@ +@<Structure...@>+= +typedef tble_lkup<yacco2::CAbs_lr1_sym*> tble_lkup_type;@/ |