Bridgeconn / usfm-grammar

An elegant USFM parser.
https://usfmgrammar.vachanengine.org/
MIT License
36 stars 14 forks source link

\usfm marker's value is not a named node in AST #252

Open kavitharaju opened 1 month ago

kavitharaju commented 1 month ago

Issue originally faced by Nicola and Jonathan:

We've printed the full tree to see each leaf in the console Here's the output

node.kind: File
  - child.kind: book
  node.kind: book
    - child.kind: id
    node.kind: id
      - child.kind: \id
      - child.kind: bookcode
      node.kind: bookcode
        - child.kind: PSA
      - child.kind: description
        - text = child.utf8_text:  unfoldingWord Literal Text

  - child.kind: usfm
  node.kind: usfm
    - child.kind: \usfm
  - child.kind: ide
  node.kind: ide
    - child.kind: \ide
    - child.kind: text
      - text = child.utf8_text: UTF-8

  - child.kind: hBlock
  node.kind: hBlock
    - child.kind: h
    node.kind: h
      - child.kind: hTag
      node.kind: hTag
        - child.kind: \h
        - child.kind:
      - child.kind: text
        - text = child.utf8_text: Psalms
...

As you can see on the leaf "usfm" we expect to see the value "3.0". But we weren't able to get this value from the tree.