P4C
The P4 Compiler
Loading...
Searching...
No Matches
BFN::Pragma Class Referenceabstract

#include <pragma.h>

Public Member Functions

 Pragma (const char *name, const char *description, const char *help)
 
virtual const char * description () const =0
 short description that will be printed as help
 
virtual const char * help () const =0
 detailed description that will be printed as help
 
virtual const char * name () const
 the pragma name – should be overriden
 

Static Public Member Functions

static std::ostream & printHelp (std::ostream &o)
 print the currently supported pragmas
 
static std::ostream & printHelp (std::ostream &o)
 print the currently supported pragmas
 
static void registerPragma (const Pragma *p, bool internal=false)
 

Static Protected Member Functions

static bool registerPragma (const Pragma *p, bool internal=false)
 

Detailed Description

Abstract class/interface for pragmas

Helper class for pragma help The class captures a name, description, and detailed help for a pragma. The class also stores to static lists for supported pragmas (external and internal). The ParseAnnotation class creates instances of the Pragma class and registers them.

The original intent was that each class will derive from this class, however, registration needs an instance of the class, and implementing the support this way only requires defining the three strings that provide the help.

Member Function Documentation

◆ registerPragma()

static bool BFN::Pragma::registerPragma ( const Pragma * p,
bool internal = false )
inlinestaticprotected

add a pragma to the list of supported pragmas invoked by subclasses to register themselves