Skip to content

very simple ASS/SSA files parser for Rust using nom

Notifications You must be signed in to change notification settings

ren-chon/ass-parser-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ass_parser

Disclaimer: This parser is currently in an experimental stage and is a work in progress.

This Rust crate provides a parser for .ass files using the nom crate. Developed primarily for learning purposes, there may be future updates. The parser currently supports reading .ass files structured as follows:

[Script Info]
...fields here

[Aegisub Project Garbage]
...fields here

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
...styles here

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
...events here

Notes

  • If certain fields are missing inside [Script Info], the Default trait will be invoked to handle the missing fields.
  • The parser will panic if [Aegisub Project Garbage] section does not exist.

Usage

use ass_parser::prelude::*;
use std::fs::read_to_string;

let file_content = read_to_string("my.ass").unwrap();
let parsed_file = parse_file(file_content.as_str()).unwrap();

println!("{:#?}", parsed_file);

Feel free to use the parser for your ass files, and if you encounter any issues or have suggestions for improvement, don't hesitate to reach out. Though contributions are not currently accepted, your feedback is valuable for potential future enhancements.

About

very simple ASS/SSA files parser for Rust using nom

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages