Unverified Commit 2c95e634 authored by Gao, Xiang's avatar Gao, Xiang Committed by GitHub
Browse files

Support nan as value in NeuroChem parser (#383)

parent fb2072c9
......@@ -121,8 +121,11 @@ def load_atomic_network(filename):
start: inputsize atom_net
nans: "-"?"nan"
value : SIGNED_INT
| SIGNED_FLOAT
| nans
| "FILE" ":" FILENAME "[" INT "]"
FILENAME : ("_"|"-"|"."|LETTER|DIGIT)+
......@@ -150,6 +153,10 @@ def load_atomic_network(filename):
def value(self, v):
if len(v) == 1:
v = v[0]
if isinstance(v, lark.tree.Tree):
assert v.data == 'nans'
return math.nan
assert isinstance(v, lark.lexer.Token)
if v.type == 'FILENAME':
v = v.value
elif v.type == 'SIGNED_INT' or v.type == 'INT':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment