Created
February 4, 2021 17:02
-
-
Save Nnubes256/560fbc5a1273c795d3b4984506c64e90 to your computer and use it in GitHub Desktop.
Pest grammar definition for Cytus I chart format (based on https://sites.google.com/site/cytoidcommunity/guides/charting/chart-format/c1-chart-format)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO find out if spaces and tabs are interchangeable in which contexts | |
WHITESPACE = _{ " " | "\t" } | |
version_number = @{ASCII_DIGIT} | |
version = {"VERSION" ~ version_number} | |
// Floating-point values in Cytus I always have 6 decimals | |
fp_value = @{ASCII_DIGIT+ ~ "." ~ ASCII_DIGIT{6}} | |
bpm = {"BPM" ~ fp_value} | |
page_shift = {"PAGE_SHIFT" ~ fp_value} | |
page_size = {"PAGE_SIZE" ~ fp_value} | |
note_id = @{ASCII_DIGIT+} | |
// Identifier + Note ID + Time (Y) + X position + Hold note duration | |
note = {"NOTE" ~ note_id ~ fp_value ~ fp_value ~ fp_value} | |
notes = { ((note ~ NEWLINE* ~ EOI) | (note ~ NEWLINE))+ } | |
link_notes = { (note_id)+ } | |
// Identifier + one or more note IDs | |
link = {"LINK" ~ link_notes} | |
links = { ((link ~ NEWLINE* ~ EOI) | (link ~ NEWLINE))*} | |
cytus1 = { | |
SOI ~ | |
version ~ NEWLINE | |
~ bpm ~ NEWLINE | |
~ page_shift ~ NEWLINE | |
~ page_size ~ NEWLINE | |
~ notes | |
~ links | |
~ EOI | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment