Class that parses a string that contains the contents of an
OpenFOAM-file and builds a nested structure of directories and lists from
it
|
|
|
|
|
|
|
__init__(self,
content,
fName=None,
debug=False,
noHeader=False,
noBody=False,
doMacroExpansion=False,
boundaryDict=False,
preserveComments=True,
preserveNewlines=True,
listDict=False,
listDictWithHeader=False,
listLengthUnparsed=None,
binaryMode=False,
treatBinaryAsASCII=False,
duplicateCheck=False,
noVectorOrTensor=False,
dictStack=None,
duplicateFail=True)
Constructs the parser and the lexer |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
condenseAllPreFixLists(self,
orig)
Checks whether this list is a list that consists only of prefix-Lists |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
p_binaryblob(self,
p)
binaryblob : BINARYBLOB |
source code
|
|
|
p_boundaryDict(self,
p)
boundaryDict : header list | header prelist |
source code
|
|
|
|
|
p_codestream(self,
p)
codestream : codeSeen CODESTART CODESTREAMCHUNK CODEEND |
source code
|
|
|
p_dictbody(self,
p)
dictbody : dictbody dictline | dictline | empty |
source code
|
|
|
p_dictionary(self,
p)
dictionary : '{' enter_dict dictbody '}' exit_dict | '{' '}' |
source code
|
|
|
p_dictitem(self,
p)
dictitem : longitem | pitem |
source code
|
|
|
|
|
p_dictline(self,
p)
dictline : dictkey dictitem ';' | dictkey list ';' | dictkey prelist
';' | dictkey fieldvalue ';' | macro | substitution ';' | dictkey
codestream ';' | dictkey dictionary |
source code
|
|
|
p_dimension(self,
p)
dimension : '[' number number number number number number number ']'
| '[' number number number number number ']' |
source code
|
|
|
|
|
|
|
|
|
|
|
p_fieldvalue_nonuniform(self,
p)
fieldvalue : NONUNIFORM NAME list | NONUNIFORM prelist | NONUNIFORM
NAME prelist |
source code
|
|
|
p_fieldvalue_uniform(self,
p)
fieldvalue : UNIFORM number | UNIFORM vector | UNIFORM tensor |
UNIFORM symmtensor |
source code
|
|
|
|
|
|
|
|
|
p_header(self,
p)
header : FOAMFILE dictionary |
source code
|
|
|
p_include(self,
p)
include : INCLUDE SCONST | INCLUDEIFPRESENT SCONST |
source code
|
|
|
p_inputMode(self,
p)
inputMode : INPUTMODE ERROR | INPUTMODE WARN | INPUTMODE PROTECT |
INPUTMODE DEFAULT | INPUTMODE MERGE | INPUTMODE OVERWRITE |
source code
|
|
|
|
|
p_item(self,
p)
item : pitem | REACTION | list | dictionary |
source code
|
|
|
p_itemlist(self,
p)
itemlist : itemlist item | itemlist ';' | item |
source code
|
|
|
|
|
p_longitem(self,
p)
longitem : pitemlist pitem |
source code
|
|
|
p_macro(self,
p)
macro : KANALGITTER include | KANALGITTER inputMode | KANALGITTER
remove |
source code
|
|
|
p_noBody(self,
p)
noBody : FOAMFILE '{' dictbody gotHeader '}' |
source code
|
|
|
|
|
p_number(self,
p)
number : integer | FCONST |
source code
|
|
|
p_onlyListOrPList(self,
p)
onlyListOrPList : list | prelist |
source code
|
|
|
p_pitem(self,
p)
pitem : word | SCONST | number | dictionary | list | dimension |
substitution | empty |
source code
|
|
|
p_pitemlist(self,
p)
pitemlist : pitemlist pitem | pitem |
source code
|
|
|
p_prelist(self,
p)
prelist : integer prelist_seen '(' itemlist ')' | integer
prelist_seen '(' binaryblob ')' | integer prelist_seen '(' unparsed
')' |
source code
|
|
|
|
|
p_pureList(self,
p)
pureList : onlyListOrPList |
source code
|
|
|
p_pureListWithHeader(self,
p)
pureListWithHeader : header onlyListOrPList |
source code
|
|
|
p_remove(self,
p)
remove : REMOVE word | REMOVE wlist |
source code
|
|
|
p_substitution(self,
p)
substitution : SUBSTITUTION |
source code
|
|
|
p_symmtensor(self,
p)
symmtensor : '(' number number number number number number ')' |
source code
|
|
|
p_tensor(self,
p)
tensor : '(' number number number number number number number number
number ')' |
source code
|
|
|
p_unparsed(self,
p)
unparsed : UNPARSEDCHUNK |
source code
|
|
|
p_vector(self,
p)
vector : '(' number number number ')' |
source code
|
|
|
|
|
p_word(self,
p)
word : NAME | UNIFORM | NONUNIFORM | MERGE | OVERWRITE | DEFAULT |
WARN | PROTECT | ERROR |
source code
|
|
|
p_wordlist(self,
p)
wordlist : wordlist word | word |
source code
|
|
|
|
|
parserError(self,
text,
c,
ind)
Prints the error message of the parser and exit |
source code
|
|
|
printContext(self,
c,
ind)
Prints the context of the current index |
source code
|
|
|
|
|
t_NAME(self,
t)
[a-zA-Z_][+\-<>(),.\*|a-zA-Z_0-9&%:]* |
source code
|
|
|
t_SUBSTITUITION(self,
t)
\$[a-zA-Z_.:{][+\-<>(),.\*|a-zA-Z_0-9&%:${}]* |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
|
|