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 ()
SymbolModifiers & operator|= (const SymbolModifiers &mdfs)
SymbolModifiers & operator|= (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 2333 of file fortranscanner.l.

2334{
2335 if (mdfs.protection!=NONE_P) protection = mdfs.protection;
2336 if (mdfs.direction!=NONE_D) direction = mdfs.direction;
2337 optional |= mdfs.optional;
2338 if (!mdfs.dimension.empty()) dimension = mdfs.dimension;
2339 allocatable |= mdfs.allocatable;
2340 external |= mdfs.external;
2341 intrinsic |= mdfs.intrinsic;
2342 protect |= mdfs.protect;
2343 parameter |= mdfs.parameter;
2344 pointer |= mdfs.pointer;
2345 target |= mdfs.target;
2346 save |= mdfs.save;
2347 deferred |= mdfs.deferred;
2349 nopass |= mdfs.nopass;
2350 pass |= mdfs.pass;
2351 passVar = mdfs.passVar;
2352 bindVar = mdfs.bindVar;
2353 contiguous |= mdfs.contiguous;
2354 volat |= mdfs.volat;
2355 value |= mdfs.value;
2356 return *this;
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
2357}

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

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

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: