Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: determine tree schema and print it out #413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lutter
Copy link
Member

@lutter lutter commented Oct 9, 2016

This uses the structure of lenses, simplifies it a little bit and adds a
command 'schema' in augtool that makes it possible to print out the schema
for the tree that this lens will produce.

The output format is pretty inscrutable right now and looks like this (for schema Hosts.lns):

*
  |
    { <NULL> = <NULL> }
    { /#comment/ = /[^\001-\004\t\n\r ][^\001-\004\n]*[^\001-\004\t\n\r ]|[^\001-\004\t\n\r ]/ }
    [ /[0-9]+/ = <NULL> ]
      .
        ()
        ()
        { /ipaddr/ = /[^\001-\004\t\n #]+/ }
        ()
        { /canonical/ = /[^\001-\004\t\n #]+/ }
        *
          { /alias/ = /[^\001-\004\t\n #]+/ }
        { /#comment/ = /[^\001-\004\t\n\r ][^\001-\004\n]*[^\001-\004\t\n\r ]|[^\001-\004\t\n\r ]/ }

For operators like *, |, or ., the operands are indented, i.e., the topmost union has three branches. The () means there's a lens that won't put anything in the tree (that output could just be suppressed). For the subtree lens [ l ], the output is either [ key_rx = value_rx ] followed by the (indented) schema of the schema for l, or { key_rx = value_rx } if we know that [ l ] will only produce leaves in the tree.

This uses the structure of lenses, simplifies it a little bit and adds a
command 'schema' in augtool that makes it possible to print out the schema
for the tree that this lens will produce.

The output format is pretty inscrutable right now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant