Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions JBFL_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ Typical use cases include:

# Properties Overview

| Setting Name | Description | Applies To |
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
| `PadDecimals` | Adds trailing zeros only if the fractional part is shorter than `PadDecimals`, leaving existing extra decimals untouched. Guarantees a minimum number of decimal digits. | Numeric values |
| `PadAmount` | Specifies the **total length** (number of characters) the formatted value should occupy. | Any scalar except for comments |
| `NoComplexNewLine` | When true, disables multiline or indented formatting for arrays, outputting values inline. | Any complex data structure |
| `ForceComplexNewLine` | Forces complex structures (arrays or objects) to always use multiline and indented formatting, even if NoComplexNewLine is not set. Overrides inline formatting. | Any complex data structure |
| `Indent` | When set, controls the the amount of indentation. Defaults to 2 spaces. | Any complex data structure |
| Setting Name | Description | Applies To |
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------|
| `PadDecimals` | Adds trailing zeros only if the fractional part is shorter than `PadDecimals`, leaving existing extra decimals untouched. Guarantees a minimum number of decimal digits. | Numeric values |
| `PadAmount` | Specifies the **total length** (number of characters) the formatted value should occupy. | Any scalar except for comments |
| `AutoPad` | Aligns values in array rows into columns by padding each cell to the maximum width in that column. Applies to the array it is set on (e.g. `nodes`, `beams`). | Arrays of arrays |
| `AlignObjectKeys` | Pads object keys so that `:` separators align vertically across all entries in the same object. | Objects |
| `AutoPadSubObjects` | Aligns values within sibling inline objects by treating matching sub-keys as columns. Useful for `glowMap`-style structures. | Objects with inline sub-objects |
| `NoComplexNewLine` | When true, disables multiline or indented formatting for arrays, outputting values inline. | Any complex data structure |
| `ForceComplexNewLine` | Forces complex structures (arrays or objects) to always use multiline and indented formatting, even if NoComplexNewLine is not set. Overrides inline formatting. | Any complex data structure |
| `Indent` | Controls the amount of indentation. Defaults to 4 spaces. | Any complex data structure |

# How Matching Works

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ A fast, robust command-line parser, formatter, and editor for JBeam files, the J
Renames nodes sequentially (e.g., `["bf1", ...]` → `["bf0", "bf1", "bf2"]`) and updates all references automatically. Feature currently unstable, enabled by build flag `transformation`.

- **Configurable Formatting with JBFL:**
Customize formatting rules using JBFL, a mini-language to specify padding, decimals, indentation, and more with wildcard targeting.
Customize formatting rules using JBFL, a mini-language to specify padding, decimals, indentation, object key alignment, and more with wildcard targeting.

Example JBFL snippet:

Expand Down
334 changes: 334 additions & 0 deletions examples/ast/jbeam/frame.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,340 @@ Object
]
]
)
, ObjectKey
( String "glowMap"
, Object
[ Comment
( InternalComment
{ cText = "main lights"
, cMultiline = False
, cAssociationDirection = NextNode
, cHadNewlineBefore = False
}
)
, ObjectKey
( String "chassis_headlight_L"
, Object
[ ObjectKey
( String "simpleFunction"
, String "lowhighbeam_filament"
)
, ObjectKey
( String "off"
, String "chassis_headlight"
)
, ObjectKey
( String "on"
, String "chassis_headlight_on"
)
, ObjectKey
( String "materialEmissiveScaling"
, Object
[ ObjectKey
( String "on_max"
, Number 1.0
)
]
)
]
)
, ObjectKey
( String "chassis_headlight_R"
, Object
[ ObjectKey
( String "simpleFunction"
, String "lowhighbeam_filament"
)
, ObjectKey
( String "off"
, String "chassis_headlight"
)
, ObjectKey
( String "on"
, String "chassis_headlight_on"
)
, ObjectKey
( String "materialEmissiveScaling"
, Object
[ ObjectKey
( String "on_max"
, Number 1.0
)
]
)
]
)
, ObjectKey
( String "chassis_signal_L"
, Object
[ ObjectKey
( String "simpleFunction"
, String "signal_L_filament"
)
, ObjectKey
( String "off"
, String "chassis_signal_amber"
)
, ObjectKey
( String "on"
, String "chassis_signal_amber_on"
)
, ObjectKey
( String "materialEmissiveScaling"
, Object
[ ObjectKey
( String "on_max"
, Number 1.0
)
]
)
]
)
, ObjectKey
( String "chassis_signal_R"
, Object
[ ObjectKey
( String "simpleFunction"
, String "signal_R_filament"
)
, ObjectKey
( String "off"
, String "chassis_signal_amber"
)
, ObjectKey
( String "on"
, String "chassis_signal_amber_on"
)
, ObjectKey
( String "materialEmissiveScaling"
, Object
[ ObjectKey
( String "on_max"
, Number 1.0
)
]
)
]
)
, ObjectKey
( String "chassis_reverselight"
, Object
[ ObjectKey
( String "simpleFunction"
, String "reverselight_filament"
)
, ObjectKey
( String "off"
, String "chassis_reverselight"
)
, ObjectKey
( String "on"
, String "chassis_reverselight_on"
)
, ObjectKey
( String "materialEmissiveScaling"
, Object
[ ObjectKey
( String "on_max"
, Number 1.0
)
]
)
]
)
, ObjectKey
( String "chassis_brakelight_L"
, Object
[ ObjectKey
( String "simpleFunction"
, String "brakelight_filament"
)
, ObjectKey
( String "off"
, String "chassis_taillight"
)
, ObjectKey
( String "on"
, String "chassis_taillight_on"
)
, ObjectKey
( String "materialEmissiveScaling"
, Object
[ ObjectKey
( String "on_max"
, Number 1.0
)
]
)
]
)
, ObjectKey
( String "chassis_brakelight_R"
, Object
[ ObjectKey
( String "simpleFunction"
, String "brakelight_filament"
)
, ObjectKey
( String "off"
, String "chassis_taillight"
)
, ObjectKey
( String "on"
, String "chassis_taillight_on"
)
, ObjectKey
( String "materialEmissiveScaling"
, Object
[ ObjectKey
( String "on_max"
, Number 1.0
)
]
)
]
)
, Comment
( InternalComment
{ cText = "gauge lights"
, cMultiline = False
, cAssociationDirection = NextNode
, cHadNewlineBefore = False
}
)
, Comment
( InternalComment
{ cText = "(turn signals, battery, parking brake, highbeam)"
, cMultiline = False
, cAssociationDirection = NextNode
, cHadNewlineBefore = True
}
)
, ObjectKey
( String "chassis_gaugelight_highbeam"
, Object
[ ObjectKey
( String "simpleFunction"
, String "highbeam"
)
, ObjectKey
( String "off"
, String "chassis_gauges"
)
, ObjectKey
( String "on"
, String "chassis_gauges_on"
)
]
)
, ObjectKey
( String "chassis_gaugelight_signal_L"
, Object
[ ObjectKey
( String "simpleFunction"
, String "signal_L"
)
, ObjectKey
( String "off"
, String "chassis_gauges"
)
, ObjectKey
( String "on"
, String "chassis_gauges_on"
)
]
)
, ObjectKey
( String "chassis_gaugelight_signal_R"
, Object
[ ObjectKey
( String "simpleFunction"
, String "signal_R"
)
, ObjectKey
( String "off"
, String "chassis_gauges"
)
, ObjectKey
( String "on"
, String "chassis_gauges_on"
)
]
)
, ObjectKey
( String "chassis_gaugelight_battery"
, Object
[ ObjectKey
( String "simpleFunction"
, String "battery"
)
, ObjectKey
( String "off"
, String "chassis_gauges"
)
, ObjectKey
( String "on"
, String "chassis_gauges_on"
)
]
)
, ObjectKey
( String "chassis_gaugelight_parkbrake"
, Object
[ ObjectKey
( String "simpleFunction"
, String "parkingbrakelight"
)
, ObjectKey
( String "off"
, String "chassis_gauges"
)
, ObjectKey
( String "on"
, String "chassis_gauges_on"
)
]
)
, Comment
( InternalComment
{ cText = "multi-condition warning light"
, cMultiline = False
, cAssociationDirection = NextNode
, cHadNewlineBefore = True
}
)
, ObjectKey
( String "chassis_gaugelight_warning"
, Object
[ ObjectKey
( String "simpleFunction"
, Object
[ ObjectKey
( String "checkengine"
, Number 1.0
)
, ObjectKey
( String "battery"
, Number 1.0
)
, ObjectKey
( String "lowpressure"
, Number 1.0
)
]
)
, ObjectKey
( String "off"
, String "chassis_gauges"
)
, ObjectKey
( String "on"
, String "chassis_gauges_on"
)
]
)
]
)
]
)
]
Loading
Loading