- Example JBeam Files
- JBFL configuration files
- AST source examples
- Formatted JBeam Outputs
- Invalid JBeam Examples
- Transformed JBeam Outputs
- How JBFL affects formatting
- Using these examples
- yaml configuration file for transformation
This directory provides hands-on examples and test materials to explore jbeam-edit’s parsing, formatting, and transformation capabilities.
It includes raw .jbeam files, example .jbfl configuration rules, parsed AST representations in Haskell, and automatically formatted or transformed outputs.
Directory: examples/jbeam/
Contains the base .jbeam files used for parsing, formatting, and transformation tests.
-
fender.jbeamA simple, clean JBeam file demonstrating basic parsing and formatting. Runningjbeam-editon this file will:- Parse the full structure, including comments
- Apply consistent indentation and spacing
- Sequentially rename nodes (e.g.,
bf1->bf0) - Update references accordingly
- Organize vertices into logical groups (e.g.,
LeftTree,MiddleTree,RightTree)
-
frame.jbeamA JBeam file representing a structural vehicle frame with two separate node prefixes. This file is intended to test how jbeam-edit merges multiple prefix trees into a single consistent structure. Running jbeam-edit on this file will: -
Parse nodes and beams across both prefix groups
-
Merge the two prefix trees while preserving structural relationships
-
Sequentially rename nodes and update all cross-prefix references
-
Demonstrate jbeam-edit’s handling of multi-prefix structures for intermediate-level transformation scenarios
-
suspension.jbeamA complex example modeling a vehicle suspension assembly. Demonstrates:- Parsing of nodes, beams, and collision triangles
- Structural renaming with reference updates
- Preservation of group relationships and suspension geometry
Directory: examples/jbfl/
Contains .jbfl configuration files that define formatting rules.
minimal.jbfl— Provides a simple configuration with basic indentation and spacing.complex.jbfl: Demonstrates advanced padding, decimal precision, and line control.
Switch between these configurations to see how JBFL rules influence formatting.
Directory: examples/ast/
Contains Haskell source files showing parsed AST representations of .jbeam and .jbfl files.
ast/jbeam/fender.hsast/jbeam/frame.hsast/jbeam/suspension.hsast/jbfl/minimal.hsast/jbfl/complex.hs
These are used primarily for debugging, testing, and verifying Megaparsec-based parser correctness.
Directory: examples/formatted_jbeam/
Contains formatted .jbeam outputs produced using different JBFL configurations.
fender-minimal-jbfl.jbeamfender-complex-jbfl.jbeamframe-minimal-jbfl.jbeamframe-complex-jbfl.jbeamsuspension-minimal-jbfl.jbeamsuspension-complex-jbfl.jbeam
These illustrate how rule variations affect indentation, padding, and numeric formatting.
Directory: examples/invalid_jbeam/
Contains malformed JBeam files to test parser error handling.
invalid_fender.jbeam: Intentionally invalid syntax to validate parser robustness and error reporting.
Directory: examples/transformed_jbeam/
Contains JBeam files generated by transformation mode (--transformation flag) or configuration-driven edits.
fender-cfg-default.jbeamfender-cfg-example.jbeamframe-cfg-default.jbeamframe-cfg-example.jbeamsuspension-cfg-default.jbeamsuspension-cfg-example.jbeam
These files show how node renaming, reference updating, and rule-driven transformations are applied.
JBFL (JBeam Formatting Language) is a declarative configuration syntax controlling layout behavior for .jbeam files.
- Wildcard-based section targeting
- Decimal and padding control
- Optional newlines and grouping preferences
By switching between the minimal and complex .jbfl configurations, you can observe changes in formatted_jbeam/.
To format an example file with the minimal configuration:
jbeam-edit -cminimal
jbeam-edit examples/jbeam/fender.jbeamTo try the complex configuration, generate it first and run:
jbeam-edit -ccomplex
jbeam-edit examples/jbeam/suspension.jbeamThe resulting formatted outputs will be written to examples/formatted_jbeam/.
The yaml configuration file allows the user to configure custom transformation settings such as a custom support threshold, custom breakpoints for vertex trees or custom support threshold.
File: examples/jbeam-edit.yaml
For complete documentation, refer to the root README.md. See also JBFL_DOCS.md for more details about JBFL syntax and capabilities.