@@ -191,7 +191,7 @@ def test_30_relation_and_field():
191191FOOBAR
192192"""
193193
194- tree = MarkerLexer .parse (input_string , parse_nodes = True )
194+ tree = MarkerLexer .parse (input_string , custom_tags = [ "STATEMENT" ] )
195195 assert tree .data == "start"
196196
197197 assert len (tree .children ) == 5
@@ -256,7 +256,7 @@ def test_31_single_node_field():
256256 STATEMENT: This can likely replace _weak below with no problem.
257257 """
258258
259- tree = MarkerLexer .parse (input_string , parse_nodes = True )
259+ tree = MarkerLexer .parse (input_string , custom_tags = [ "STATEMENT" ] )
260260 assert tree .data == "start"
261261
262262 assert len (tree .children ) == 1
@@ -291,7 +291,7 @@ def test_31B_single_node_field():
291291
292292 """ # noqa: W293
293293
294- tree = MarkerLexer .parse (input_string , parse_nodes = True )
294+ tree = MarkerLexer .parse (input_string , custom_tags = [ "INTENTION" ] )
295295 assert tree .data == "start"
296296
297297 assert len (tree .children ) == 1
@@ -326,7 +326,7 @@ def test_31C_single_node_field():
326326}
327327""" # noqa: W293
328328
329- tree = MarkerLexer .parse (input_string , parse_nodes = True )
329+ tree = MarkerLexer .parse (input_string , custom_tags = [ "INTENTION" ] )
330330 assert tree .data == "start"
331331
332332 assert len (tree .children ) == 2
@@ -351,7 +351,7 @@ def test_32_two_single_line_fields():
351351 STATEMENT: This can likely replace _weak below with no problem.
352352 """
353353
354- tree = MarkerLexer .parse (input_string , parse_nodes = True )
354+ tree = MarkerLexer .parse (input_string , custom_tags = [ "STATEMENT" ] )
355355 assert tree .data == "start"
356356
357357 assert len (tree .children ) == 2
@@ -375,7 +375,9 @@ def test_32B_two_single_line_fields_consecutive():
375375 STATEMENTT: This can likely replace _weak below with no problem.
376376 """
377377
378- tree = MarkerLexer .parse (input_string , parse_nodes = True )
378+ tree = MarkerLexer .parse (
379+ input_string , custom_tags = ["STATEMENT" , "STATEMENTT" ]
380+ )
379381
380382 assert tree .data == "start"
381383
@@ -403,7 +405,7 @@ def test_33_multiline_and_multiparagraph_fields():
403405FOOBAR
404406"""
405407
406- tree = MarkerLexer .parse (input_string , parse_nodes = True )
408+ tree = MarkerLexer .parse (input_string , custom_tags = [ "STATEMENT" ] )
407409 assert tree .data == "start"
408410
409411 assert len (tree .children ) == 1
@@ -434,6 +436,38 @@ def test_60_exclude_reserved_keywords():
434436 assert len (tree .children ) == 0
435437
436438
439+ def test_70_exclude_similar_but_not_in_grammar ():
440+ input_string = """
441+ Note: This is ordinary comment text.
442+
443+ STATEMENT: This can likely replace _weak below with no problem.
444+ FYI: More ordinary comment text.
445+
446+ TEST: This can likely replace _weak below with no problem.
447+
448+ Hint: Again, ordinary comment text.
449+ """
450+
451+ tree = MarkerLexer .parse (input_string , custom_tags = ["STATEMENT" , "TEST" ])
452+ assert tree .data == "start"
453+ assert len (tree .children ) == 2
454+ assert tree .children [0 ].data == "node_field"
455+ assert tree .children [0 ].children [0 ].data == "node_name"
456+ assert tree .children [0 ].children [0 ].children [0 ].value == "STATEMENT"
457+ assert (
458+ tree .children [0 ].children [1 ].children [0 ].value
459+ == "This can likely replace _weak below with no problem."
460+ )
461+ assert tree .children [0 ].children [1 ].data == "node_multiline_value"
462+ assert tree .children [1 ].children [0 ].data == "node_name"
463+ assert tree .children [1 ].children [0 ].children [0 ].value == "TEST"
464+ assert (
465+ tree .children [1 ].children [1 ].children [0 ].value
466+ == "This can likely replace _weak below with no problem."
467+ )
468+ assert tree .children [1 ].children [1 ].data == "node_multiline_value"
469+
470+
437471def test_80_linux_spdx_like_identifiers ():
438472 input_string = """\
439473 SPDX-ID: REQ-1
@@ -445,7 +479,7 @@ def test_80_linux_spdx_like_identifiers():
445479 And this is the same statement's another paragraph.
446480"""
447481
448- tree = MarkerLexer .parse (input_string , parse_nodes = True )
482+ tree = MarkerLexer .parse (input_string , custom_tags = [ "SPDX-ID" , "SPDX-Text" ] )
449483 assert tree .data == "start"
450484
451485 assert len (tree .children ) == 2
0 commit comments