-
Notifications
You must be signed in to change notification settings - Fork 0
/
sm_grammar.lark
78 lines (71 loc) · 2.41 KB
/
sm_grammar.lark
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
%import common.INT
%import common.NEWLINE
%import common.SIGNED_NUMBER
%import common.WORD
%import common.WS
%ignore NEWLINE
%ignore WS
NO_SEMICOLON_SENTENCE: /[^\;\n\r\t]+/i
NO_COLON_SENTENCE: /[^:\n\r\t]+/i
BEAT_SENTENCE: /[0-9\.=]+/
OBJECT: "0" | "1" | "2" | "3" | "4" | "5" | "M" | "R" | "F" | "L"
true: "YES"
false: "NO"
phrase: NO_SEMICOLON_SENTENCE
no_colon_phrase: NO_COLON_SENTENCE
unsafe_file: NO_SEMICOLON_SENTENCE
safe_file: NO_SEMICOLON_SENTENCE
float: SIGNED_NUMBER
time: float
int: INT
beat_bpm_pair: BEAT_SENTENCE ("," BEAT_SENTENCE)*
beat_value_pair: BEAT_SENTENCE ("," BEAT_SENTENCE)*
beat_beat_pair: BEAT_SENTENCE ("," BEAT_SENTENCE)*
display_bpm_string: phrase
simfile: (meta ";")+
meta:
| "#TITLE:" [phrase] -> title
| "#SUBTITLE:" [phrase] -> subtitle
| "#ARTIST:" [phrase] -> artist
| "#GENRE:" [phrase] -> genre
| "#CREDIT:" [phrase] -> credit
| "#BANNER:" [phrase] -> banner_path
| "#BACKGROUND:" [phrase] -> bg_path
| "#CDTITLE:" [phrase] -> cdtitle_path
| "#MUSIC:" [phrase] -> music_path
| "#OFFSET:" [time] -> offset
| "#SAMPLESTART:" [time] -> sample_start
| "#SAMPLELENGTH:" [time] -> sample_length
| "#BPMS:" [beat_bpm_pair] -> bpms
| ("#STOPS:" | "#FREEZES:") [beat_beat_pair] -> stops
| "#ANIMATIONS:" [phrase] -> meta_animations
| "#ARTISTTRANSLIT:" [phrase] -> meta_artisttranslit
| "#ATTACKS:" [phrase] -> meta_attacks
| "#BGCHANGES:" [phrase] -> meta_bgchanges
| "#DISPLAYBPM:" [display_bpm_string] -> display_bpm
| "#FGCHANGES:" [phrase] -> meta_fgchanges
| "#KEYSOUNDS:" [phrase] -> meta_keysounds
| "#LYRICSPATH:" [phrase] -> meta_lyricspath
| "#MENUCOLOR:" [phrase] -> meta_menucolor
| "#SELECTABLE:" [phrase] -> meta_selectable
| "#SUBTITLETRANSLIT:" [phrase] -> meta_subtitletranslit
| "#TITLETRANSLIT:" [phrase] -> meta_titletranslit
| "#DELAYS:" -> meta_delays
| "#TIMESIGNATURES:" [phrase] -> meta_timesignatures
| "#NOTES:" ("dance-single" | "dance-couple") _chart_info measures4+ -> notes
| "#NOTES:" "dance-solo" _chart_info measures6+ -> notes
| "#NOTES:" "dance-double" _chart_info measures8+ -> notes
_chart_info: ":" [step_artist] ":" [difficulty_name] ":" [difficulty_value] ":" [radar_values] ":"
step_artist: no_colon_phrase
difficulty_name: no_colon_phrase
difficulty_value: int
radar_values: (float [","])+ float -> dontcare
measures4: (measure4 [","])+
measure4: row4+
row4: OBJECT~4
measures6: (measure6 [","])+
measure6: row6+
row6: OBJECT~6
measures8: (measure8 [","])+
measure8: row8+
row8: OBJECT~8