1% 2% @ extension : Generic exact match to back reference 3% 4:- module(csg_pPEGxt, ['@'/6]). 5 6:- (current_module(pPEG) -> true ; use_module(library(pPEG),[peg_lookup_previous/3])). % for retrieving previous match 7 8@(Name,Env,Input,PosIn,PosOut,[]) :- 9 (peg_lookup_previous(Name,Env,Match) 10 -> sub_string(Input,PosIn,Len,_,Match), % same as previous result 11 PosOut is PosIn+Len 12 ; PosOut = PosIn % no previous, match nothing 13 )