Skip to content

Commit

Permalink
updated prog/tools/pythonCommon/datablock.py for dag2blend
Browse files Browse the repository at this point in the history
  • Loading branch information
NicSavichev committed Jun 29, 2024
1 parent c7824cf commit 71a2658
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions prog/tools/pythonCommon/datablock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@
else:
from pyparsing import *

def getTokensEndLoc():
"""Method to be called from within a parse action to determine the end
location of the parsed tokens."""
import inspect
fstack = inspect.stack()
try:
# search up the stack (through intervening argument normalizers) for correct calling routine
for f in fstack[2:]:
if f[3] == "_parseNoCache":
endloc = f[0].f_locals["loc"]
return endloc
else:
raise ParseFatalException("incorrect usage of getTokensEndLoc - may only be called from within a parse action")
finally:
del fstack

class DataBlock:
def __init__(self, fname = None, name = None, include_includes = False, preserve_formating = False, root_directory = None):
self.blocks = []
Expand Down

0 comments on commit 71a2658

Please sign in to comment.