Skip to content

Commit

Permalink
feat: add ocafile grammar rules for AttributeFraming Overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
olichwiruk committed Jan 16, 2025
1 parent 308c152 commit cab0634
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions semantics/oca-file/src/ocafile.pest
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ oca_object = _{
entry_code |
entry |
link |
attribute_framing |
flagged_attrs
)
}
Expand All @@ -153,6 +154,7 @@ remove_oca_object = _{
entry_code |
entry |
link |
attribute_framing |
flagged_attrs
)
}
Expand All @@ -172,6 +174,21 @@ entry_code = {^"entry_code" ~ arg_ws ~ attrs_key ~ attr_entry_code_key_pairs}
entry = {^"entry" ~ arg_ws ~ lang ~ arg_ws ~ attrs_key ~ attr_entry_key_pairs}
unit = {^"unit" ~ arg_ws ~ attrs_key ~ unit_attr_key_pairs}
link = {^"link" ~ arg_ws ~ reference_type ~ arg_ws ~ attrs_key ~ attr_key_pairs}
attribute_framing = {^"attr_framing" ~ arg_ws ~ framing_metadata ~ arg_ws ~ attrs_key ~ attr_framing_key_pairs+}

framing_metadata_key = ${ "id" | "label" | "location" | "version" }
framing_metadata_value = ${ string | char+ }
framing_metadata_pair = @{ framing_metadata_key ~ arg_ws? ~ "=" ~ arg_ws? ~ framing_metadata_value }
framing_metadata = { framing_metadata_pair ~ (arg_ws ~ framing_metadata_pair)* }

attr_framing_key_pair = @{ attr_key ~ arg_ws? ~ "=" ~ arg_ws? ~ json_object }
attr_framing_key_pairs = ${ arg_ws* ~ attr_framing_key_pair ~ (arg_ws | NEWLINE)? }

url = ${ string }
json_key = ${ string }
json_value = ${ string | url | json_object }
json_pair = ${ json_key ~ arg_ws* ~ ":" ~ (arg_ws | NEWLINE)? ~ json_value ~ (arg_ws? ~ "," ~ (arg_ws | NEWLINE)?)? }
json_object = ${ "{" ~ ((arg_ws | NEWLINE)? ~ arg_ws* ~ json_pair ~ (arg_ws | NEWLINE)?)+ ~ arg_ws* ~ "}" }

flagged_attrs = {^"flagged_attributes" ~ arg_ws ~ list_value}
classification = { ^"classification" ~ arg_ws ~ classification_value}
Expand Down

0 comments on commit cab0634

Please sign in to comment.