File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from pprint import pprint
2+
13import pytest
24
35import modflow_devtools .models as models
46from modflow_devtools .codec import make_parser
57
68MODELS = [name for name in models .get_models ().keys () if name .startswith ("mf6/" )]
9+ PARSER = make_parser ()
710
811
912@pytest .mark .parametrize ("model_name" , MODELS )
1013def test_parser (model_name , function_tmpdir ):
1114 workspace = models .copy_to (function_tmpdir , model_name )
1215 nam_path = next (iter (workspace .glob ("*.nam" )))
1316 text = nam_path .open ().read ()
14- parser = make_parser ( )
15- tree = parser .parse (text )
17+ pprint ( text )
18+ tree = PARSER .parse (text )
1619 print (tree .pretty ())
Original file line number Diff line number Diff line change 1- start : [WS ] block + [WS ]
2- block : " begin" i CNAME _ NL _ content " end" i CNAME _ NL
1+ start : [WS ] [_ NL* ] (block [[WS ] _ NL* ])+ [WS ]
2+ block : " begin" i CNAME [_ block_index ] _ NL _ content " end" i CNAME [_ block_index ] _ NL+
3+ _ block_index: INT
34_ content: line * [WS ]
4- line : [WS ] value * _ NL
5- value : WORD | NUMBER
5+ line : [WS ] item * _ NL+
6+ item : word | NUMBER
7+ word : / [a-zA-Z0-9._'~,- \\ ( \\ ) ]+ /
68
79%import common .NEWLINE -> _ NL
810%import common .WS
911%import common .WS_INLINE
1012%import common .CNAME
1113%import common .WORD
1214%import common .NUMBER
15+ %import common .INT
1316%import common .SH_COMMENT
17+ %import common ._ STRING_INNER
1418%ignore WS_INLINE
1519%ignore SH_COMMENT
You can’t perform that action at this time.
0 commit comments