Skip to main content

module lang::php::analysis::cfg::LabelState

rascal-0.43.0
org.rascalmpl.php-analysis-0.3.6

Usage​

import lang::php::analysis::cfg::LabelState;

Dependencies​

import lang::php::ast::AbstractSyntax;
import lang::php::analysis::cfg::CFG;
import lang::php::analysis::cfg::Label;
import List;

data LabelState​

data LabelState  
= ls(int counter)
| ls(int counter, CFGNode entryNode, CFGNode exitNode, set[CFGNode] nodes, list[Lab] breakLabels, list[Lab] continueLabels, map[Lab,Lab] headerNodes, map[Lab,Lab] footerNodes, map[str,Lab] gotoNodes, map[str,Lab] catchHandlers)
;

The labeling state keeps track of information needed during the labeling and edge computation operations.

function newLabelState​

LabelState newLabelState()

Initialize the label state

function addEntryAndExit​

LabelState addEntryAndExit(LabelState lstate, CFGNode entryNode, CFGNode exitNode)

Expand the label state to include entry and exit information.

function shrink​

LabelState shrink(LabelState lstate)

Throw away the entry and exit information, leaving just the counter.

function getBreakLabels​

list[Lab] getBreakLabels(LabelState lstate)

Get the labels of all the break targets

function getBreakLabel​

Lab getBreakLabel(int n, LabelState lstate)

Get the nth break target (for, e.g., break 5)

function hasBreakLabel​

bool hasBreakLabel(int n, LabelState lstate)

Check to see if the given break target is available; it may not be if this code is included and breaks into surrounding code.

function pushBreakLabel​

LabelState pushBreakLabel(Lab l, LabelState lstate)

Push a new break label onto the stack

function popBreakLabel​

LabelState popBreakLabel(LabelState lstate)

Pop a break label off the stack

function getContinueLabels​

list[Lab] getContinueLabels(LabelState lstate)

Get the labels of all the continue targets

function getContinueLabel​

Lab getContinueLabel(int n, LabelState lstate)

Get the nth continue target (for, e.g., continue 5)

function hasContinueLabel​

bool hasContinueLabel(int n, LabelState lstate)

Check to see if the given continue target is available; it may not be if this code is included and continues into surrounding code.

function pushContinueLabel​

LabelState pushContinueLabel(Lab l, LabelState lstate)

Push a new continue label onto the stack

function popContinueLabel​

LabelState popContinueLabel(LabelState lstate)

Pop a continue label off the stack

function getExitNode​

CFGNode getExitNode(LabelState lstate)

Get the current exit node

function getExitNodeLabel​

Lab getExitNodeLabel(LabelState lstate)

Get the label of the current exit node

function labelScript​

tuple[Script,LabelState] labelScript(Script script, LabelState lstate)

Label the statements and expressions in a script.