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 96 of file fortranscanner.l.

Member Enumeration Documentation

◆ Direction

Enumerator
NONE_D 
IN 
OUT 
INOUT 

Definition at line 99 of file fortranscanner.l.

99{NONE_D, IN, OUT, INOUT};

◆ Protection

Enumerator
NONE_P 
PUBLIC 
PRIVATE 

Definition at line 98 of file fortranscanner.l.

98{NONE_P, PUBLIC, PRIVATE};

Constructor & Destructor Documentation

◆ SymbolModifiers()

SymbolModifiers::SymbolModifiers ( )
inline

Definition at line 125 of file fortranscanner.l.

126 optional(false), protect(false), dimension(), allocatable(false),
127 external(false), intrinsic(false), parameter(false),
128 pointer(false), target(false), save(false), deferred(false), nonoverridable(false),
129 nopass(false), pass(false), contiguous(false), volat(false), value(false), passVar(),
130 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 2343 of file fortranscanner.l.

2344{
2345 if (mdfs.protection!=NONE_P) protection = mdfs.protection;
2346 if (mdfs.direction!=NONE_D) direction = mdfs.direction;
2347 optional |= mdfs.optional;
2348 if (!mdfs.dimension.empty()) dimension = mdfs.dimension;
2349 allocatable |= mdfs.allocatable;
2350 external |= mdfs.external;
2351 intrinsic |= mdfs.intrinsic;
2352 protect |= mdfs.protect;
2353 parameter |= mdfs.parameter;
2354 pointer |= mdfs.pointer;
2355 target |= mdfs.target;
2356 save |= mdfs.save;
2357 deferred |= mdfs.deferred;
2359 nopass |= mdfs.nopass;
2360 pass |= mdfs.pass;
2361 passVar = mdfs.passVar;
2362 bindVar = mdfs.bindVar;
2363 contiguous |= mdfs.contiguous;
2364 volat |= mdfs.volat;
2365 value |= mdfs.value;
2366 return *this;
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
2367}

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 2370 of file fortranscanner.l.

2371{
2372 DString mdfString = mdfStringArg.lower();
2373 SymbolModifiers newMdf;
DString lower() const
Definition dstring.h:326
2374
2375 if (mdfString.startsWith("dimension"))
2376 {
2377 newMdf.dimension=mdfString;
2378 }
2379 else if (mdfString.contains("intent"))
2380 {
2381 DString tmp = extractFromParens(mdfString);
2382 bool isin = tmp.find("in")!=DString::npos;
2383 bool isout = tmp.find("out")!=DString::npos;
2384 if (isin && isout) newMdf.direction = SymbolModifiers::INOUT;
2385 else if (isin) newMdf.direction = SymbolModifiers::IN;
2386 else if (isout) newMdf.direction = SymbolModifiers::OUT;
2387 }
2388 else if (mdfString=="public")
2389 {
2391 }
2392 else if (mdfString=="private")
2393 {
2395 }
2396 else if (mdfString=="protected")
2397 {
2398 newMdf.protect = true;
2399 }
2400 else if (mdfString=="optional")
2401 {
2402 newMdf.optional = true;
2403 }
2404 else if (mdfString=="allocatable")
2405 {
2406 newMdf.allocatable = true;
2407 }
2408 else if (mdfString=="external")
2409 {
2410 newMdf.external = true;
2411 }
2412 else if (mdfString=="intrinsic")
2413 {
2414 newMdf.intrinsic = true;
2415 }
2416 else if (mdfString=="parameter")
2417 {
2418 newMdf.parameter = true;
2419 }
2420 else if (mdfString=="pointer")
2421 {
2422 newMdf.pointer = true;
2423 }
2424 else if (mdfString=="target")
2425 {
2426 newMdf.target = true;
2427 }
2428 else if (mdfString=="save")
2429 {
2430 newMdf.save = true;
2431 }
2432 else if (mdfString=="nopass")
2433 {
2434 newMdf.nopass = true;
2435 }
2436 else if (mdfString=="deferred")
2437 {
2438 newMdf.deferred = true;
2439 }
2440 else if (mdfString=="non_overridable")
2441 {
2442 newMdf.nonoverridable = true;
2443 }
2444 else if (mdfString=="contiguous")
2445 {
2446 newMdf.contiguous = true;
2447 }
2448 else if (mdfString=="volatile")
2449 {
2450 newMdf.volat = true;
2451 }
2452 else if (mdfString=="value")
2453 {
2454 newMdf.value = true;
2455 }
2456 else if (mdfString.contains("pass"))
2457 {
2458 newMdf.pass = true;
2459 if (mdfString.contains("("))
2460 newMdf.passVar = extractFromParens(mdfString);
2461 else
2462 newMdf.passVar = "";
2463 }
2464 else if (mdfString.startsWith("bind"))
2465 {
2466 // 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
2467 newMdf.bindVar = extractBind(mdfStringArg);
2468 }
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:178
int contains(char c, bool cs=true) const
Definition dstring.cpp:85
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
bool startsWith(const char *s) const
Definition dstring.h:600
static DString extractFromParens(const DString &name)
static DString extractBind(const DString &name)
2469
2470 (*this) |= newMdf;
2471 return *this;
2472}

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 108 of file fortranscanner.l.

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

◆ bindVar

DString SymbolModifiers::bindVar

Definition at line 123 of file fortranscanner.l.

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

◆ contiguous

bool SymbolModifiers::contiguous

Definition at line 119 of file fortranscanner.l.

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

◆ deferred

bool SymbolModifiers::deferred

◆ dimension

DString SymbolModifiers::dimension

Definition at line 107 of file fortranscanner.l.

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

◆ direction

Direction SymbolModifiers::direction

Definition at line 104 of file fortranscanner.l.

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

◆ external

bool SymbolModifiers::external

Definition at line 109 of file fortranscanner.l.

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

◆ intrinsic

bool SymbolModifiers::intrinsic

Definition at line 110 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 105 of file fortranscanner.l.

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

◆ parameter

bool SymbolModifiers::parameter

Definition at line 111 of file fortranscanner.l.

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

◆ pass

bool SymbolModifiers::pass

Definition at line 118 of file fortranscanner.l.

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

◆ passVar

DString SymbolModifiers::passVar

Definition at line 122 of file fortranscanner.l.

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

◆ pointer

bool SymbolModifiers::pointer

Definition at line 112 of file fortranscanner.l.

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

◆ protect

bool SymbolModifiers::protect

Definition at line 106 of file fortranscanner.l.

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

◆ protection

Protection SymbolModifiers::protection

◆ returnName

DString SymbolModifiers::returnName

Definition at line 102 of file fortranscanner.l.

Referenced by SymbolModifiers().

◆ save

bool SymbolModifiers::save

Definition at line 114 of file fortranscanner.l.

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

◆ target

bool SymbolModifiers::target

Definition at line 113 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 102 of file fortranscanner.l.

Referenced by SymbolModifiers().

◆ value

bool SymbolModifiers::value

Definition at line 121 of file fortranscanner.l.

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

◆ volat

bool SymbolModifiers::volat

Definition at line 120 of file fortranscanner.l.

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


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