Field propagation
This commit is contained in:
parent
591da0c971
commit
94f5958087
1 changed files with 5 additions and 1 deletions
|
|
@ -205,7 +205,11 @@ def convert_to_tree_sitter(rule: parser.Rule, grammar: parser.Grammar) -> str:
|
|||
return f"$['{target_name}']"
|
||||
|
||||
elif isinstance(rule, parser.MetadataRule):
|
||||
return convert_to_tree_sitter(rule.rule, grammar)
|
||||
result = convert_to_tree_sitter(rule.rule, grammar)
|
||||
field = rule.metadata.get("field")
|
||||
if field is not None:
|
||||
result = f"field('{field}', {result})"
|
||||
return result
|
||||
|
||||
else:
|
||||
raise ValueError(f"Rule {rule} not supported for tree-sitter")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue