Top Prev Next Up Down

Y2018.Text.Jets.Compiler

This is the compiler for the Regex expression


001| with Y2018.Text.Jets.RangeVectorPack; --use Y2018.Text.Jets.RangeVectorPack;
002| with Y2018.Text.Jets.JetsTool; use Y2018.Text.Jets.JetsTool;
003| with Y2018.Text.Jets.MatchPack; --use Y2018.Text.Jets.MatchPack;
004| with Y2018.Text.Core; use Y2018.Text.Core;
005| package Y2018.Text.Jets.Compiler is
006| __type PST_TY is (PST_NONE, PST_MATCH, PST_FAIL);
007| __type CompileResult is
008| _____record
009| ________state: PST_TY;
010| ________top: RE_Elem_AC;
011| ________current:RE_ID;
012| ________map:MatchPack.MatchID2RE_ID_TY.Map; -- mapping of MatchID's to RE id's. Key is MatchID.
013| ________pool:JetsTool.Pool_TY;
014| _____end record;
015| __procedure compileP(s : CFix;urv:RangeVectorPack.Map_TY.Map:=RangeVectorPack.Map_TY.Empty_Map;ptc:out CompileResult);
016| end Y2018.Text.Jets.Compiler;

One procedure ‘compileP’ with:

The compilator is a state engine with 30 states and after that is a clean up process to get rid of nodes of type:

and replace theese with a node of type REQ_CLASS.

CompileP procedure is called by Y2018-Text-Jets-Patternpack CompileM for connecting the result to a pattern object. The result is a node tree cooresponding to the regular expression in the parameters ‘s’.