Doxygen
Loading...
Searching...
No Matches
SymbolModifiers Struct Reference

Holds yyextra->modifiers (ie attributes) for one symbol (variable, function, etc). More...

Collaboration diagram for SymbolModifiers:

Public Types

enum  Protection { NONE_P , PUBLIC , PRIVATE }
enum  Direction { NONE_D , IN , OUT , INOUT }

Public Member Functions

 SymbolModifiers ()
SymbolModifiersoperator|= (const SymbolModifiers &mdfs)
SymbolModifiersoperator|= (DString mdfrString)

Public Attributes

DString type
 This is only used with function return value.
DString returnName
Protection protection
Direction direction
bool optional
bool protect
DString dimension
bool allocatable
bool external
bool intrinsic
bool parameter
bool pointer
bool target
bool save
bool deferred
bool nonoverridable
bool nopass
bool pass
bool contiguous
bool volat
bool value
DString passVar
DString bindVar

Detailed Description

Holds yyextra->modifiers (ie attributes) for one symbol (variable, function, etc).

Definition at line 98 of file fortranscanner.l.

Member Enumeration Documentation

◆ Direction

Enumerator
NONE_D 
IN 
OUT 
INOUT 

Definition at line 101 of file fortranscanner.l.

101{NONE_D, IN, OUT, INOUT};

◆ Protection

Enumerator
NONE_P 
PUBLIC 
PRIVATE 

Definition at line 100 of file fortranscanner.l.

100{NONE_P, PUBLIC, PRIVATE};

Constructor & Destructor Documentation

◆ SymbolModifiers()

SymbolModifiers::SymbolModifiers ( )
inline

Definition at line 127 of file fortranscanner.l.

128 optional(false), protect(false), dimension(), allocatable(false),
129 external(false), intrinsic(false), parameter(false),
130 pointer(false), target(false), save(false), deferred(false), nonoverridable(false),
131 nopass(false), pass(false), contiguous(false), volat(false), value(false), passVar(),
132 bindVar() {}
DString type
This is only used with function return value.
Protection protection

References allocatable, bindVar, contiguous, deferred, dimension, direction, external, intrinsic, NONE_D, NONE_P, nonoverridable, nopass, optional, parameter, pass, passVar, pointer, protect, protection, returnName, save, target, type, value, and volat.

Referenced by operator|=(), and operator|=().

Member Function Documentation

◆ operator|=() [1/2]

SymbolModifiers & SymbolModifiers::operator|= ( const SymbolModifiers & mdfs)

Adds passed yyextra->modifiers to these yyextra->modifiers.

Definition at line 2257 of file fortranscanner.l.

2258{
2259 if (mdfs.protection!=NONE_P) protection = mdfs.protection;
2260 if (mdfs.direction!=NONE_D) direction = mdfs.direction;
2261 optional |= mdfs.optional;
2262 if (!mdfs.dimension.empty()) dimension = mdfs.dimension;
2263 allocatable |= mdfs.allocatable;
2264 external |= mdfs.external;
2265 intrinsic |= mdfs.intrinsic;
2266 protect |= mdfs.protect;
2267 parameter |= mdfs.parameter;
2268 pointer |= mdfs.pointer;
2269 target |= mdfs.target;
2270 save |= mdfs.save;
2271 deferred |= mdfs.deferred;
2273 nopass |= mdfs.nopass;
2274 pass |= mdfs.pass;
2275 passVar = mdfs.passVar;
2276 bindVar = mdfs.bindVar;
2277 contiguous |= mdfs.contiguous;
2278 volat |= mdfs.volat;
2279 value |= mdfs.value;
2280 return *this;
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:153
2281}

References allocatable, bindVar, contiguous, deferred, dimension, direction, DString::empty(), external, intrinsic, NONE_D, NONE_P, nonoverridable, nopass, optional, parameter, pass, passVar, pointer, protect, protection, save, SymbolModifiers(), target, value, and volat.

◆ operator|=() [2/2]

SymbolModifiers & SymbolModifiers::operator|= ( DString mdfStringArg)

Extracts and adds passed modifier to these yyextra->modifiers.

Definition at line 2284 of file fortranscanner.l.

2285{
2286 DString mdfString = mdfStringArg.lower();
2287 SymbolModifiers newMdf;
DString lower() const
Definition dstring.h:331
2288
2289 if (mdfString.startsWith("dimension"))
2290 {
2291 newMdf.dimension=mdfString;
2292 }
2293 else if (mdfString.contains("intent"))
2294 {
2295 DString tmp = extractFromParens(mdfString);
2296 bool isin = tmp.find("in")!=DString::npos;
2297 bool isout = tmp.find("out")!=DString::npos;
2298 if (isin && isout) newMdf.direction = SymbolModifiers::INOUT;
2299 else if (isin) newMdf.direction = SymbolModifiers::IN;
2300 else if (isout) newMdf.direction = SymbolModifiers::OUT;
2301 }
2302 else if (mdfString=="public")
2303 {
2305 }
2306 else if (mdfString=="private")
2307 {
2309 }
2310 else if (mdfString=="protected")
2311 {
2312 newMdf.protect = true;
2313 }
2314 else if (mdfString=="optional")
2315 {
2316 newMdf.optional = true;
2317 }
2318 else if (mdfString=="allocatable")
2319 {
2320 newMdf.allocatable = true;
2321 }
2322 else if (mdfString=="external")
2323 {
2324 newMdf.external = true;
2325 }
2326 else if (mdfString=="intrinsic")
2327 {
2328 newMdf.intrinsic = true;
2329 }
2330 else if (mdfString=="parameter")
2331 {
2332 newMdf.parameter = true;
2333 }
2334 else if (mdfString=="pointer")
2335 {
2336 newMdf.pointer = true;
2337 }
2338 else if (mdfString=="target")
2339 {
2340 newMdf.target = true;
2341 }
2342 else if (mdfString=="save")
2343 {
2344 newMdf.save = true;
2345 }
2346 else if (mdfString=="nopass")
2347 {
2348 newMdf.nopass = true;
2349 }
2350 else if (mdfString=="deferred")
2351 {
2352 newMdf.deferred = true;
2353 }
2354 else if (mdfString=="non_overridable")
2355 {
2356 newMdf.nonoverridable = true;
2357 }
2358 else if (mdfString=="contiguous")
2359 {
2360 newMdf.contiguous = true;
2361 }
2362 else if (mdfString=="volatile")
2363 {
2364 newMdf.volat = true;
2365 }
2366 else if (mdfString=="value")
2367 {
2368 newMdf.value = true;
2369 }
2370 else if (mdfString.contains("pass"))
2371 {
2372 newMdf.pass = true;
2373 if (mdfString.contains("("))
2374 newMdf.passVar = extractFromParens(mdfString);
2375 else
2376 newMdf.passVar = "";
2377 }
2378 else if (mdfString.startsWith("bind"))
2379 {
2380 // we need here the original string as we want to don't want to have the lowercase name between the quotes of the name= part
2381 newMdf.bindVar = extractBind(mdfStringArg);
2382 }
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:183
int contains(char c, bool cs=true) const
Definition dstring.cpp:76
size_t find(char c, size_t pos=0) const
Definition dstring.h:244
bool startsWith(const char *s) const
Definition dstring.h:589
static DString extractFromParens(const DString &name)
static DString extractBind(const DString &name)
2383
2384 (*this) |= newMdf;
2385 return *this;
2386}

References allocatable, bindVar, DString::contains(), contiguous, deferred, dimension, direction, external, extractBind(), extractFromParens(), DString::find(), IN, INOUT, intrinsic, DString::lower(), nonoverridable, nopass, DString::npos, optional, OUT, parameter, pass, passVar, pointer, PRIVATE, protect, protection, PUBLIC, save, DString::startsWith(), SymbolModifiers(), target, value, and volat.

Member Data Documentation

◆ allocatable

bool SymbolModifiers::allocatable

Definition at line 110 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ bindVar

DString SymbolModifiers::bindVar

Definition at line 125 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ contiguous

bool SymbolModifiers::contiguous

Definition at line 121 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ deferred

bool SymbolModifiers::deferred

◆ dimension

DString SymbolModifiers::dimension

Definition at line 109 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ direction

Direction SymbolModifiers::direction

Definition at line 106 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ external

bool SymbolModifiers::external

Definition at line 111 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ intrinsic

bool SymbolModifiers::intrinsic

Definition at line 112 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ nonoverridable

bool SymbolModifiers::nonoverridable

◆ nopass

bool SymbolModifiers::nopass

◆ optional

bool SymbolModifiers::optional

Definition at line 107 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ parameter

bool SymbolModifiers::parameter

Definition at line 113 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ pass

bool SymbolModifiers::pass

Definition at line 120 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ passVar

DString SymbolModifiers::passVar

Definition at line 124 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ pointer

bool SymbolModifiers::pointer

Definition at line 114 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ protect

bool SymbolModifiers::protect

Definition at line 108 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ protection

Protection SymbolModifiers::protection

◆ returnName

DString SymbolModifiers::returnName

Definition at line 104 of file fortranscanner.l.

Referenced by SymbolModifiers().

◆ save

bool SymbolModifiers::save

Definition at line 116 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ target

bool SymbolModifiers::target

Definition at line 115 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ type

DString SymbolModifiers::type

This is only used with function return value.

Definition at line 104 of file fortranscanner.l.

Referenced by SymbolModifiers().

◆ value

bool SymbolModifiers::value

Definition at line 123 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().

◆ volat

bool SymbolModifiers::volat

Definition at line 122 of file fortranscanner.l.

Referenced by applyModifiers(), operator|=(), operator|=(), and SymbolModifiers().


The documentation for this struct was generated from the following file: